source: trunk/deushax/game.cpp @ 686

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

Put everything in the "lol" namespace. Better late than never.

  • 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
14using namespace lol;
15
16#include "game.h"
17
18/*
19 * Game implementation class
20 */
21
22class GameData
23{
24    friend class Game;
25
26private:
27    Map *map;
28    int x, y;
29    int mousex, mousey;
30    int done;
31};
32
33/*
34 * Public Game class
35 */
36
37Game::Game(char const *mapname)
38  : data(new GameData())
39{
40    data->map = new Map(mapname);
41    data->x = data->y = 0;
42    data->done = 0;
43}
44
45Game::~Game()
46{
47    delete data->map;
48    delete data;
49}
50
51void Game::TickGame(float deltams)
52{
53    Entity::TickGame(deltams);
54}
55
56void Game::TickDraw(float deltams)
57{
58    Entity::TickDraw(deltams);
59
60    data->map->Render(-data->mousex, -data->mousey, 0);
61}
62
63#if 0
64Scene *Game::GetScene()
65{
66    if (!data->scene)
67        data->scene = new Scene(45.0f);
68    return data->scene;
69}
70#endif
71
72void Game::SetMouse(int x, int y)
73{
74    data->mousex = x;
75    data->mousey = y;
76}
77
78void Game::Quit()
79{
80    data->done = 1;
81}
82
83int Game::Finished()
84{
85    return data->done;
86}
87
Note: See TracBrowser for help on using the repository browser.