Godzil 3 年 前
コミット
2590e65f49

+ 2 - 2
source/CMakeLists.txt

@@ -8,8 +8,8 @@ find_package(SDL2_image REQUIRED)
 set(SDL2_LIBS ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARY} ${SDL2_TTF_LIBRARY} ${SDL2_MIXER_LIBRARY})
 set(SDL2_INCDIR ${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})
 
-file(GLOB GE_SOURCES *.cpp)
-file(GLOB GE_HEADERS include/*.h)
+file(GLOB_RECURSE GE_SOURCES *.cpp)
+file(GLOB_RECURSE GE_HEADERS include/*.h)
 
 # set(GE_SOURCES Main.cpp Game.cpp)
 # set(GE_HEADERS include/Game.h)

+ 11 - 0
source/ECS.cpp

@@ -0,0 +1,11 @@
+/*
+ * 2D Game Engine 
+ * ECS.cpp:
+ * Based on pikuma.com 2D game engine in C++ and Lua course
+ * Copyright (c) 2021 986-Studio. All rights reserved.
+ *
+ * Created by Manoël Trapier on 11/02/2021.
+ */
+
+#include <ECS.h>
+

+ 2 - 16
source/Game.cpp

@@ -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);
 }

+ 1 - 1
source/Logger.cpp

@@ -1,6 +1,6 @@
 /*
  * 2D Game Engine 
- * Logger.cpp.c: 
+ * Logger.cpp:
  * Based on pikuma.com 2D game engine in C++ and Lua course
  * Copyright (c) 2021 986-Studio. All rights reserved.
  *

+ 13 - 0
source/include/Components/Transform.h

@@ -0,0 +1,13 @@
+/*
+ * 2D Game Engine 
+ * Transform.h: 
+ * Based on pikuma.com 2D game engine in C++ and Lua course
+ * Copyright (c) 2021 986-Studio. All rights reserved.
+ *
+ * Created by Manoël Trapier on 11/02/2021.
+ */
+
+#ifndef GAMEENGINE_TRANSFORM_H
+#define GAMEENGINE_TRANSFORM_H
+
+#endif /* GAMEENGINE_TRANSFORM_H */

+ 33 - 0
source/include/ECS.h

@@ -0,0 +1,33 @@
+/*
+ * 2D Game Engine 
+ * ECS.h:
+ * Based on pikuma.com 2D game engine in C++ and Lua course
+ * Copyright (c) 2021 986-Studio. All rights reserved.
+ *
+ * Created by Manoël Trapier on 11/02/2021.
+ */
+
+#ifndef GAMEENGINE_ECS_H
+#define GAMEENGINE_ECS_H
+
+class Component
+{
+
+};
+
+class Entity
+{
+
+};
+
+class System
+{
+
+};
+
+class Registry
+{
+
+};
+
+#endif /* GAMEENGINE_ECS_H */

+ 13 - 0
source/include/Systems/Movement.h

@@ -0,0 +1,13 @@
+/*
+ * 2D Game Engine 
+ * Movement.h: 
+ * Based on pikuma.com 2D game engine in C++ and Lua course
+ * Copyright (c) 2021 986-Studio. All rights reserved.
+ *
+ * Created by Manoël Trapier on 11/02/2021.
+ */
+
+#ifndef GAMEENGINE_MOVEMENT_H
+#define GAMEENGINE_MOVEMENT_H
+
+#endif /* GAMEENGINE_MOVEMENT_H */