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

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

Dynamically allocate layers when loading maps.

  • 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    Tiler *tiler = new Tiler();
16    Map *map = new Map("maps/testmap-coll.tmx");
17
18    for (int done = 0; !done; )
19    {
20        video->Clear();
21
22        map->Draw(tiler);
23
24        /* Test stuff */
25        int playerx, playery;
26        SDL_GetMouseState(&playerx, &playery);
27
28        tiler->AddTile(50, playerx, playery, 1);
29        tiler->AddTile(50, playerx + 64, playery + 32, 3);
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 tiler;
52    delete video;
53
54    return EXIT_SUCCESS;
55}
56
Note: See TracBrowser for help on using the repository browser.