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