|
@@ -12,6 +12,7 @@
|
|
|
|
|
|
#include <Game.h>
|
|
|
#include <Logger.h>
|
|
|
+#include <ECS.h>
|
|
|
|
|
|
Game::Game()
|
|
|
{
|
|
@@ -86,13 +87,9 @@ void Game::Run()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-glm::vec2 playerPostion;
|
|
|
-glm::vec2 playerVelocity;
|
|
|
-
|
|
|
void Game::Setup()
|
|
|
{
|
|
|
- playerPostion = glm::vec2(10, 20);
|
|
|
- playerVelocity = glm::vec2(100, 5);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void Game::Update()
|
|
@@ -105,9 +102,6 @@ void Game::Update()
|
|
|
double deltaTime = (SDL_GetTicks() - this->millisecsPerviousFrame) / 1000.0;
|
|
|
|
|
|
this->millisecsPerviousFrame = SDL_GetTicks();
|
|
|
-
|
|
|
- playerPostion.x += (playerVelocity.x * deltaTime);
|
|
|
- playerPostion.y += (playerVelocity.y * deltaTime);
|
|
|
}
|
|
|
|
|
|
void Game::ProcessInput()
|
|
@@ -141,15 +135,7 @@ void Game::Render()
|
|
|
SDL_SetRenderDrawColor(this->renderer, 21, 21, 21, 255);
|
|
|
SDL_RenderClear(this->renderer);
|
|
|
|
|
|
- SDL_Surface *surface = IMG_Load("assets/images/tank-tiger-right.png");
|
|
|
- SDL_Texture *texture = SDL_CreateTextureFromSurface(this->renderer, surface);
|
|
|
- SDL_FreeSurface(surface);
|
|
|
-
|
|
|
- SDL_Rect dest = { static_cast<int>(playerPostion.x), static_cast<int>(playerPostion.y), 32, 32 };
|
|
|
-
|
|
|
- SDL_RenderCopy(this->renderer, texture, NULL, &dest);
|
|
|
|
|
|
- SDL_DestroyTexture(texture);
|
|
|
|
|
|
SDL_RenderPresent(this->renderer);
|
|
|
}
|