From 9ab843567b27bd23eb7e0d2d4a48b78f7df93595 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Wed, 25 Sep 2024 16:31:22 +0200 Subject: testing map implementation --- resource-manager/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'resource-manager/main.cpp') 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 #include #include +#include #include #include #include @@ -29,15 +31,25 @@ int main() { ResourceManager * rm = new ResourceManager(); + /* Texture* img = rm->Load("../img.png"); img->setTexture(*renderer); SpriteSheet* SS = rm->Load("../spritesheet_test.png"); + SS->set_spritesheet_data(*renderer, 1, 4); + */ + + Map* map = rm->Load("../../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(); -- cgit v1.2.3