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

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

The layer name is no longer ignored.

  • 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-grass.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        playerx = playerx * (640 - 32) / 640;
28        playery = playery * (480 - 32) / 480;
29
30        tiler->AddTile(50, playerx, playery, 1);
31
32        tiler->Render();
33        video->Refresh(33.33333f);
34
35        /* This could go in a separate function */
36        SDL_Event event;
37        while (SDL_PollEvent(&event))
38        {
39            if (event.type == SDL_QUIT)
40                done = 1;
41            if (event.type == SDL_KEYDOWN)
42            {
43                if (event.key.keysym.sym == SDLK_RETURN)
44                    video->FullScreen();
45                else if (event.key.keysym.sym == SDLK_ESCAPE)
46                    done = 1;
47            }
48        }
49    }
50
51    delete map;
52    delete tiler;
53    delete video;
54
55    return EXIT_SUCCESS;
56}
57
Note: See TracBrowser for help on using the repository browser.