Changeset 87 for trunk/src/game.cpp


Ignore:
Timestamp:
Jul 14, 2010, 2:14:35 AM (11 years ago)
Author:
sam
Message:

Naive font renderer prototype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/game.cpp

    r79 r87  
     1
     2#include <cstdio>
    13
    24#include "game.h"
    35#include "map.h"
     6#include "font.h"
    47
    58/*
     
    1316private:
    1417    Map *map;
     18    Font *font;
    1519    int x, y;
    1620    int mousex, mousey;
     21
     22    int frame;
    1723};
    1824
     
    2531    data = new GameData();
    2632    data->map = new Map(mapname);
     33    data->font = new Font("gfx/font/ascii.png");
    2734    data->x = data->y = 0;
     35    data->frame = 0;
    2836}
    2937
    3038Game::~Game()
    3139{
     40    delete data->font;
    3241    delete data->map;
    3342    delete data;
     
    4857    scene->Render();
    4958    delete scene;
     59
     60    char buf[1024];
     61    sprintf(buf, "Frame %i", data->frame++);
     62    data->font->Print(10, 10, buf);
    5063}
    5164
Note: See TracChangeset for help on using the changeset viewer.