aboutsummaryrefslogtreecommitdiff
path: root/resource-manager/main.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-09-25 16:31:22 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-09-25 16:31:22 +0200
commit9ab843567b27bd23eb7e0d2d4a48b78f7df93595 (patch)
tree5f580dfe75a2cf3148cdd3a9ff2b0b0930340ada /resource-manager/main.cpp
parent35224c07549448e919a18a463e5dec81bbabf7c6 (diff)
testing map implementation
Diffstat (limited to 'resource-manager/main.cpp')
-rw-r--r--resource-manager/main.cpp15
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();