diff options
Diffstat (limited to 'resource-manager/main.cpp')
-rw-r--r-- | resource-manager/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/resource-manager/main.cpp b/resource-manager/main.cpp index dc087c6..d0e8312 100644 --- a/resource-manager/main.cpp +++ b/resource-manager/main.cpp @@ -1,11 +1,13 @@ #include "Image_asset.h" +#include "map_asset.h" #include "resource_manager.h" #include "spritesheet.h" #include <SDL.h> #include <SDL2/SDL_image.h> #include <SDL_events.h> +#include <SDL_rect.h> #include <SDL_render.h> #include <SDL_stdinc.h> #include <SDL_surface.h> @@ -29,15 +31,25 @@ int main() { ResourceManager * rm = new ResourceManager(); + /* Texture* img = rm->Load<Texture>("../img.png"); img->setTexture(*renderer); SpriteSheet* SS = rm->Load<SpriteSheet>("../spritesheet_test.png"); + SS->set_spritesheet_data(*renderer, 1, 4); + */ + + Map* map = rm->Load<Map>("../../asset/tiled/demo.tmx"); + map->SetRenderer(*renderer); + + SDL_SetRenderDrawColor(renderer, 168, 230, 255, 255); SDL_RenderClear(renderer); while (!quit) { + Uint32 ticks = SDL_GetTicks(); + int sprite = (ticks / 100) % 4; while (SDL_PollEvent(&event) != NULL) { switch (event.type) { @@ -49,9 +61,10 @@ int main() { SDL_RenderClear(renderer); - SDL_RenderCopy(renderer, img->getTexture(), NULL, NULL); SDL_RenderPresent(renderer); } + delete rm; + SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); |