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

Last change on this file since 75 was 75, checked in by sam, 11 years ago

Much better resource allocation and release. Scene manager stub.

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