X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=951eccc4c311220612748565e88b52f63d079692;hb=be3b4e75c82b6e9d2b5c4300138d490ec1a4932a;hp=aa2089043ebe2100990645c9d2b99240604424b5;hpb=f0da7a839b18b9860fad1c62f36003628f84b5b3;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index aa20890..951eccc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,7 @@ #include "map/Map.h" #include "map/MapState.h" #include "map/Tile.h" +#include "map/Trigger.h" #include "sdl/InitImage.h" #include "sdl/InitScreen.h" #include "sdl/InitSDL.h" @@ -79,6 +80,7 @@ using map::Entity; using map::Map; using map::MapState; using map::Tile; +using map::Trigger; using sdl::InitImage; using sdl::InitScreen; using sdl::InitSDL; @@ -311,16 +313,20 @@ int main(int argc, char **argv) { tiles[62].SetOffset(Vector(1, 1)); tiles[63].SetOffset(Vector(1, 1)); - Area area; - area.SetTiles(tiles, 64); - area.SetWidth(8); + Area areas[1]; + areas[0].SetTiles(tiles, 64); + areas[0].SetWidth(8); + + Trigger triggers[1]; + triggers[0].SetTilePosition(Vector(2, 0)); SDL_Surface *tilesetImg(IMG_Load("test-data/tileset.png")); Sprite tileset(tilesetImg, tileSize, tileSize); Map map; - map.SetAreas(&area, 1); + map.SetAreas(areas, 1); map.SetTileset(&tileset); + map.SetTriggers(triggers, 1); map.SetWidth(1); SDL_Surface *mapMaximImg(IMG_Load("test-data/maxim-map.png")); @@ -330,6 +336,30 @@ int main(int argc, char **argv) { mapMaxim.SetAnimation(&mapMaximAnimation); mapMaxim.Position() = Vector(80, 128); + SDL_Surface *mapSelanImg(IMG_Load("test-data/selan-map.png")); + Sprite mapSelanSprite(mapSelanImg, 32, 64); + SimpleAnimation mapSelanAnimation(&mapSelanSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapSelan; + mapSelan.SetAnimation(&mapSelanAnimation); + mapSelan.Position() = Vector(80, 128); + mapMaxim.AddFollower(&mapSelan); + + SDL_Surface *mapGuyImg(IMG_Load("test-data/guy-map.png")); + Sprite mapGuySprite(mapGuyImg, 32, 64); + SimpleAnimation mapGuyAnimation(&mapGuySprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapGuy; + mapGuy.SetAnimation(&mapGuyAnimation); + mapGuy.Position() = Vector(80, 128); + mapSelan.AddFollower(&mapGuy); + + SDL_Surface *mapDekarImg(IMG_Load("test-data/dekar-map.png")); + Sprite mapDekarSprite(mapDekarImg, 32, 64); + SimpleAnimation mapDekarAnimation(&mapDekarSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapDekar; + mapDekar.SetAnimation(&mapDekarAnimation); + mapDekar.Position() = Vector(80, 128); + mapGuy.AddFollower(&mapDekar); + InitScreen screen(width, height); app::State *state(0); @@ -348,6 +378,9 @@ int main(int argc, char **argv) { } else { MapState *mapState(new MapState(&map)); mapState->AddEntity(&mapMaxim); +// mapState->AddEntity(&mapSelan); +// mapState->AddEntity(&mapGuy); +// mapState->AddEntity(&mapDekar); mapState->ControlEntity(&mapMaxim); mapState->SetWalkingSpeed(walkSpeed); state = mapState;