source: trunk/deushax/game.cpp @ 664

Last change on this file since 664 was 289, checked in by sam, 10 years ago

Change the way the Scene object works.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdio>
11
12#include "core.h"
13#include "game.h"
14
15/*
16 * Game implementation class
17 */
18
19class GameData
20{
21    friend class Game;
22
23private:
24    Map *map;
25    int x, y;
26    int mousex, mousey;
27    int done;
28};
29
30/*
31 * Public Game class
32 */
33
34Game::Game(char const *mapname)
35  : data(new GameData())
36{
37    data->map = new Map(mapname);
38    data->x = data->y = 0;
39    data->done = 0;
40}
41
42Game::~Game()
43{
44    delete data->map;
45    delete data;
46}
47
48void Game::TickGame(float deltams)
49{
50    Entity::TickGame(deltams);
51}
52
53void Game::TickDraw(float deltams)
54{
55    Entity::TickDraw(deltams);
56
57    data->map->Render(-data->mousex, -data->mousey, 0);
58}
59
60#if 0
61Scene *Game::GetScene()
62{
63    if (!data->scene)
64        data->scene = new Scene(45.0f);
65    return data->scene;
66}
67#endif
68
69void Game::SetMouse(int x, int y)
70{
71    data->mousex = x;
72    data->mousey = y;
73}
74
75void Game::Quit()
76{
77    data->done = 1;
78}
79
80int Game::Finished()
81{
82    return data->done;
83}
84
Note: See TracBrowser for help on using the repository browser.