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.0 KB
|
Rev | Line | |
---|
[155] | 1 | // |
---|
| 2 | // Deus Hax (working title) |
---|
| 3 | // Copyright (c) 2010 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" |
---|
[220] | 13 | #include "mapviewer.h" |
---|
[155] | 14 | |
---|
| 15 | /* |
---|
| 16 | * MapViewer implementation class |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | class MapViewerData |
---|
| 20 | { |
---|
| 21 | friend class MapViewer; |
---|
| 22 | |
---|
| 23 | private: |
---|
| 24 | Map *map; |
---|
| 25 | int x, y; |
---|
[157] | 26 | int povx, povy; |
---|
[155] | 27 | int done; |
---|
| 28 | }; |
---|
| 29 | |
---|
| 30 | /* |
---|
| 31 | * Public MapViewer class |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | MapViewer::MapViewer(char const *mapname) |
---|
[259] | 35 | : data(new MapViewerData()) |
---|
[155] | 36 | { |
---|
| 37 | data->map = new Map(mapname); |
---|
| 38 | data->x = data->y = 0; |
---|
| 39 | data->done = 0; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | MapViewer::~MapViewer() |
---|
| 43 | { |
---|
| 44 | delete data->map; |
---|
| 45 | delete data; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | void MapViewer::TickGame(float deltams) |
---|
| 49 | { |
---|
| 50 | Entity::TickGame(deltams); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | void MapViewer::TickDraw(float deltams) |
---|
| 54 | { |
---|
| 55 | Entity::TickDraw(deltams); |
---|
| 56 | |
---|
[289] | 57 | data->map->Render(-data->povx, -data->povy, 0); |
---|
[155] | 58 | } |
---|
| 59 | |
---|
[157] | 60 | int MapViewer::GetWidth() |
---|
[155] | 61 | { |
---|
[157] | 62 | return data->map->GetWidth(); |
---|
[155] | 63 | } |
---|
| 64 | |
---|
[157] | 65 | int MapViewer::GetHeight() |
---|
| 66 | { |
---|
| 67 | return data->map->GetHeight(); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | void MapViewer::SetPOV(int x, int y) |
---|
| 71 | { |
---|
| 72 | data->povx = x; |
---|
| 73 | data->povy = y; |
---|
| 74 | } |
---|
| 75 | |
---|
Note: See
TracBrowser
for help on using the repository browser.