Kaynağa Gözat

refactor: rename project

gugdun 1 ay önce
ebeveyn
işleme
c43cb53e79

+ 9 - 4
CMakeLists.txt

@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.31)
-project(dungeon)
+project(Slate)
 
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 set(CMAKE_CXX_STANDARD 20)
@@ -15,6 +15,11 @@ add_subdirectory(lib/physfs EXCLUDE_FROM_ALL)
 add_subdirectory(lib/pocketpy EXCLUDE_FROM_ALL)
 add_subdirectory(lib/tinyxml2 EXCLUDE_FROM_ALL)
 
-add_executable(dungeon WIN32 src/Dungeon.cpp src/components/Position.cpp src/components/Sprite.cpp src/systems/RenderingSystem.cpp)
-target_link_libraries(dungeon PRIVATE SDL3-static physfs-static pocketpy tinyxml2 EnTT::EnTT)
-target_link_options(dungeon PRIVATE "-static-libgcc" "-static-libstdc++")
+add_executable(${PROJECT_NAME} WIN32
+        src/Slate.cpp
+        src/components/Position.cpp
+        src/components/Sprite.cpp
+        src/systems/RenderingSystem.cpp)
+
+target_link_libraries(${PROJECT_NAME} PRIVATE SDL3-static physfs-static pocketpy tinyxml2 EnTT::EnTT)
+target_link_options(${PROJECT_NAME} PRIVATE "-static-libgcc" "-static-libstdc++")

+ 8 - 10
src/AppState.hpp

@@ -4,13 +4,11 @@
 #include <SDL3/SDL_video.h>
 #include <entt/entt.hpp>
 
-namespace Dungeon {
-
-struct AppState {
-    SDL_Window *window;
-    SDL_Renderer *renderer;
-    entt::registry registry;
-    entt::dispatcher dispatcher;
-};
-
-} // namespace Dungeon
+namespace Slate {
+    struct AppState {
+        SDL_Window *window;
+        SDL_Renderer *renderer;
+        entt::registry registry;
+        entt::dispatcher dispatcher;
+    };
+}

+ 2 - 2
src/Dungeon.cpp → src/Slate.cpp

@@ -12,7 +12,7 @@
 #include "components/Sprite.hpp"
 #include "systems/RenderingSystem.hpp"
 
-using namespace Dungeon;
+using namespace Slate;
 
 SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
     auto *state = new AppState;
@@ -21,7 +21,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
     PHYSFS_mount("assets", "/assets", 1);
 
     bool success = SDL_CreateWindowAndRenderer(
-        "Penis Dungeon",
+        "Slate",
         1280, 720,
         SDL_WINDOW_HIGH_PIXEL_DENSITY,
         &state->window, &state->renderer

+ 1 - 1
src/components/Position.cpp

@@ -1,6 +1,6 @@
 #include "Position.hpp"
 
-namespace Dungeon {
+namespace Slate {
     Position Position::FromXML(const tinyxml2::XMLElement *element) {
         float x = 0, y = 0;
         element->QueryFloatAttribute("x", &x);

+ 1 - 1
src/components/Position.hpp

@@ -2,7 +2,7 @@
 
 #include "tinyxml2.h"
 
-namespace Dungeon {
+namespace Slate {
     struct Position {
         float x, y;
 

+ 1 - 1
src/components/Sprite.cpp

@@ -7,7 +7,7 @@
 #define STB_IMAGE_IMPLEMENTATION
 #include "../stb_image.h"
 
-namespace Dungeon {
+namespace Slate {
     Sprite Sprite::FromFile(SDL_Renderer *renderer, std::string path) {
         Sprite sprite{};
         SDL_Surface *surface = nullptr;

+ 1 - 1
src/components/Sprite.hpp

@@ -4,7 +4,7 @@
 #include <SDL3/SDL.h>
 #include <string>
 
-namespace Dungeon {
+namespace Slate {
     struct Sprite {
         SDL_Texture *texture;
         SDL_FRect rect;

+ 8 - 6
src/systems/RenderingSystem.cpp

@@ -2,11 +2,13 @@
 #include "../components/Position.hpp"
 #include "../components/Sprite.hpp"
 
-void Dungeon::RenderingSystem::Render(SDL_Renderer *renderer, entt::registry &registry) {
-    const auto view = registry.view<Position, Sprite>();
+namespace Slate {
+    void RenderingSystem::Render(SDL_Renderer *renderer, entt::registry &registry) {
+        const auto view = registry.view<Position, Sprite>();
 
-    view.each([&](const Position &p, const Sprite &s) {
-        const SDL_FRect dstRect = {p.x, p.y, s.rect.w, s.rect.h};
-        SDL_RenderTexture(renderer, s.texture, &s.rect, &dstRect);
-    });
+        view.each([&](const Position &p, const Sprite &s) {
+            const SDL_FRect dstRect = {p.x, p.y, s.rect.w, s.rect.h};
+            SDL_RenderTexture(renderer, s.texture, &s.rect, &dstRect);
+        });
+    }
 }

+ 1 - 1
src/systems/RenderingSystem.hpp

@@ -3,7 +3,7 @@
 #include <SDL3/SDL_render.h>
 #include <entt/entt.hpp>
 
-namespace Dungeon {
+namespace Slate {
     class RenderingSystem {
     public:
         static void Render(SDL_Renderer *renderer, entt::registry &registry);