source: trunk/src/test-map.cpp @ 96

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

Implement lazy initialisation of TileSet objects.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1// Test stuff
2
3#include <SDL.h>
4
5#include <stdio.h>
6#include <math.h>
7
8#include "sdlvideo.h"
9#include "game.h"
10#include "ticker.h"
11
12int main(int argc, char **argv)
13{
14    Video *video = new SdlVideo("Deus Hax", 640, 480);
15    Game *game = new Game("maps/testmap.tmx");
16
17    for (int done = 0; !done; )
18    {
19        /* Test stuff */
20        int mx, my;
21        SDL_GetMouseState(&mx, &my);
22        game->SetMouse(mx * (640 - 32) / 640, my * (480 - 32) / 480);
23
24        Ticker::TickGame(33.33333f);
25
26        video->PreRender();
27        Ticker::TickRender(33.33333f);
28        game->Render();
29        video->PostRender(33.33333f);
30
31        /* This could go in a separate function */
32        SDL_Event event;
33        while (SDL_PollEvent(&event))
34        {
35            if (event.type == SDL_QUIT)
36                done = 1;
37            if (event.type == SDL_KEYDOWN)
38            {
39                if (event.key.keysym.sym == SDLK_RETURN)
40                    video->FullScreen();
41                else if (event.key.keysym.sym == SDLK_ESCAPE)
42                    done = 1;
43            }
44        }
45    }
46
47    delete game;
48    delete video;
49
50    return EXIT_SUCCESS;
51}
52
Note: See TracBrowser for help on using the repository browser.