Changeset 131


Ignore:
Timestamp:
Aug 16, 2010, 11:40:15 PM (10 years ago)
Author:
sam
Message:

Allow other classes to request the Game's Scene object.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/game.cpp

    r111 r131  
    2727    int done;
    2828
    29     int frame;
     29    Scene *scene;
    3030};
    3131
     
    4040    data->x = data->y = 0;
    4141    data->done = 0;
    42     data->frame = 0;
     42    data->scene = NULL;
    4343}
    4444
     
    6363    Asset::TickRender(delta_time);
    6464
    65     Scene *scene = new Scene();
     65    GetScene();
    6666
    67     data->map->Render(scene, data->mousex, data->mousey, 0);
     67    data->map->Render(data->scene, data->mousex, data->mousey, 0);
     68    data->scene->Render();
    6869
    69     scene->Render();
    70     delete scene;
     70    delete data->scene;
     71    data->scene = NULL;
     72}
     73
     74Scene *Game::GetScene()
     75{
     76    if (!data->scene)
     77        data->scene = new Scene();
     78    return data->scene;
    7179}
    7280
  • trunk/src/game.h

    r106 r131  
    1313
    1414#include "asset.h"
     15#include "scene.h"
    1516
    1617class GameData;
     
    3031public:
    3132    /* New methods */
     33    Scene *GetScene();
    3234    void SetMouse(int x, int y);
    3335    void Quit();
Note: See TracChangeset for help on using the changeset viewer.