Changeset 106


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

Make the Game class an asset like the others.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/asset.cpp

    r101 r106  
    99
    1010#include <cstdlib>
     11#include <cstdio>
    1112
    1213#include "asset.h"
     
    2728Asset::~Asset()
    2829{
     30#if !defined FINAL_RELEASE
     31    if (!destroy)
     32        fprintf(stderr, "ERROR: asset destructor called directly\n");
     33#endif
    2934}
    3035
  • trunk/src/asset.h

    r101 r106  
    2323
    2424public:
    25     Asset();
    26     virtual ~Asset();
    27 
    2825    virtual void Ref();
    2926    virtual int Unref();
     
    3936    Group;
    4037
     38    Asset();
     39    virtual ~Asset();
     40
    4141    virtual Group GetGroup();
    4242
  • trunk/src/game.cpp

    r102 r106  
    5353}
    5454
    55 void Game::SetMouse(int x, int y)
     55Asset::Group Game::GetGroup()
    5656{
    57     data->mousex = x;
    58     data->mousey = y;
     57    return Asset::GetGroup();
    5958}
    6059
    61 void Game::Render()
     60void Game::TickGame(float delta_time)
    6261{
     62    Asset::TickGame(delta_time);
     63}
     64
     65void Game::TickRender(float delta_time)
     66{
     67    Asset::TickRender(delta_time);
     68
    6369    Scene *scene = new Scene();
    6470
     
    7379}
    7480
     81void Game::SetMouse(int x, int y)
     82{
     83    data->mousex = x;
     84    data->mousey = y;
     85}
     86
    7587void Game::Quit()
    7688{
  • trunk/src/game.h

    r102 r106  
    1212#define __DH_GAME_H__
    1313
     14#include "asset.h"
     15
    1416class GameData;
    1517
    16 class Game
     18class Game : public Asset
    1719{
    1820public:
     
    2022    ~Game();
    2123
     24protected:
     25    /* Inherited from Asset */
     26    virtual Group GetGroup();
     27    virtual void TickGame(float delta_time);
     28    virtual void TickRender(float delta_time);
     29
     30public:
     31    /* New methods */
    2232    void SetMouse(int x, int y);
    23     void Render();
    2433    void Quit();
    2534    int Finished();
  • trunk/src/gtk/editor.cpp

    r105 r106  
    3636    window = gtk_window_new( GTK_WINDOW_TOPLEVEL);
    3737    gtk_window_set_title(GTK_WINDOW(window), "Simple");
    38     gtk_container_set_border_width(GTK_CONTAINER(window), 10);
     38    gtk_container_set_border_width(GTK_CONTAINER(window), 5);
    3939
    4040    /* Quit form main if got delete event */
     
    7878        video->PreRender();
    7979        Ticker::TickRender(33.33333f);
    80 
    81         game->Render();
    8280        video->PostRender(33.33333f);
    8381    }
    8482
    85     delete game;
    8683    delete video;
    8784
  • trunk/src/test-map.cpp

    r105 r106  
    3232        video->PreRender();
    3333        Ticker::TickRender(33.33333f);
    34         game->Render();
    3534        video->PostRender(33.33333f);
    3635    }
    3736
    38     delete game;
    3937    delete video;
    4038
  • trunk/src/tileset.h

    r105 r106  
    3333
    3434public:
    35     /* New implementations */
     35    /* New methods */
    3636    char const *GetName();
    3737
Note: See TracChangeset for help on using the changeset viewer.