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

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

The GTK loop now works. Sort of.

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