Compare commits

..

86 Commits

Author SHA1 Message Date
Sebastian Böckelmann
def763d6ae ADD: Dimming textures + pushing newGameLayer
All checks were successful
Tests / test (push) Successful in 2m36s
2026-04-25 11:18:45 +02:00
Sebastian Böckelmann
8d6a314a3c ADD: Dimming Text
All checks were successful
Tests / test (push) Successful in 2m38s
2026-04-25 10:51:48 +02:00
Sebastian Böckelmann
5923f53ce4 ADD: Main Menu Buttons + Quit Game Event
All checks were successful
Tests / test (push) Successful in 2m33s
2026-04-25 08:24:42 +02:00
Sebastian Böckelmann
363b6ca39b ADD: Main Menu
All checks were successful
Tests / test (push) Successful in 2m28s
2026-04-24 21:11:18 +02:00
Sebastian Böckelmann
c33f571567 UPD: Loading Screen Layout
All checks were successful
Tests / test (push) Successful in 2m34s
2026-04-24 20:15:01 +02:00
Sebastian Böckelmann
41cfd46278 ADD: Basic Progressbar
All checks were successful
Tests / test (push) Successful in 2m42s
2026-04-24 18:59:34 +02:00
Sebastian Böckelmann
d84995bd29 ADD: Integrate SceneManager into Application, derive scene for LoadingScreen, closes #17
All checks were successful
Tests / test (push) Successful in 2m34s
2026-04-21 17:33:48 +02:00
Sebastian Böckelmann
8ea01b7850 ADD: Abstract Scenes, #closes 16
All checks were successful
Tests / test (push) Successful in 2m26s
2026-04-21 14:20:04 +02:00
Sebastian Böckelmann
0e2805ed06 FIXUP
Some checks are pending
Tests / test (push) Waiting to run
2026-04-21 14:19:48 +02:00
Sebastian Böckelmann
4ed4452dfb ADD: AssetLoadingProgressEvent, closes #19
All checks were successful
Tests / test (push) Successful in 2m55s
2026-04-21 09:30:34 +02:00
Sebastian Böckelmann
89e98d0f88 ADD: Upload Intermediate Assets to GPU, closes #18
All checks were successful
Tests / test (push) Successful in 3m2s
2026-04-21 09:05:09 +02:00
Sebastian Böckelmann
b71aa63b71 ADD: Async Asset Loading, closes #18
All checks were successful
Tests / test (push) Successful in 2m37s
2026-04-21 08:05:57 +02:00
Sebastian Böckelmann
0894c5615e ADD: Configurable UITheme, closes #14
All checks were successful
Tests / test (push) Successful in 2m36s
2026-04-20 12:39:31 +02:00
Sebastian Böckelmann
f6cada3cf8 UPD: Remove unecessary scissor test, closes #34
All checks were successful
Tests / test (push) Successful in 2m33s
2026-04-20 10:57:03 +02:00
Sebastian Böckelmann
6c7254378c UPD: Move MinimapConfig out of Engine Responsibility, closes #38
All checks were successful
Tests / test (push) Successful in 2m36s
2026-04-20 10:53:57 +02:00
Sebastian Böckelmann
a9b155ffc8 UPD: Move PlayerID inside Engine
All checks were successful
Tests / test (push) Successful in 2m32s
2026-04-20 10:36:12 +02:00
Sebastian Böckelmann
738d424df9 ADD: WindowResizeEvent on Window Resizing; remove dependency of Application for renderers
All checks were successful
Tests / test (push) Successful in 2m33s
2026-04-20 10:12:46 +02:00
Sebastian Böckelmann
67fb1be3b5 DEL: Boilerplate Shader Uniform Code
All checks were successful
Tests / test (push) Successful in 2m31s
2026-04-18 07:32:25 +02:00
sebastian
31d27a8243 UPD: Box Modell vervollständigen, closes #9
All checks were successful
Tests / test (push) Successful in 2m31s
2026-04-17 13:40:24 +02:00
sebastian
00d10e4f0e FIX: Exclude GLFW from test builds
All checks were successful
Tests / test (push) Successful in 2m37s
2026-04-17 11:48:34 +02:00
sebastian
ed86dd78dd FIX: Use modern CMake Version for Tests
Some checks failed
Tests / test (push) Failing after 1m0s
2026-04-17 11:42:35 +02:00
sebastian
69e75fb281 fix: tinyobjloader Submodule-Eintrag reparieren
Some checks failed
Tests / test (push) Failing after 54s
2026-04-17 11:38:01 +02:00
sebastian
6ed8704ead ADD: CI Tests
Some checks failed
Tests / test (push) Failing after 49s
2026-04-17 11:03:02 +02:00
sebastian
b5ddbcf9c4 ADD: LayoutEngineTests 2026-04-17 11:02:22 +02:00
sebastian
4137db0c1f ADD: LayoutEngine 2026-04-17 10:42:10 +02:00
sebastian
309398d76c UPD: Initialize Ressources in InventoryContainer with 0 as default value, closes #7 2026-04-17 10:03:34 +02:00
sebastian
5bb5bf71d1 UPD: Remove Test Button, closes #8 2026-04-17 08:36:13 +02:00
sebastian
697430cfd6 UPD: addChild() gibt typisierte Pointer zurück, keinen Index, closes #6 2026-04-17 08:34:25 +02:00
sebastian
203cf42c26 UPD: Remove Dependency to Application for EventBus, closes #5 2026-04-17 08:07:46 +02:00
sebastian
1b4cc8ef89 UPD: Make Gamesystems static and move their orchestration to GameWorldSystems 2026-04-17 07:58:53 +02:00
sebastian
373fb34ea0 UPD: onRender() als eigener Pass, closes #3 2026-04-17 07:27:40 +02:00
sebastian
705d311c6d UPD: Move Keyboard-Input to GameInputUser, closes #4 2026-04-17 07:09:29 +02:00
sebastian
d67be5b5a9 UPD: Renove GameMode inclusion in Layer, closes #2 2026-04-16 22:53:08 +02:00
sebastian
dcfa6ea38a UPD: Fix canBuild method to actually check resource costs 2026-02-21 10:55:46 +01:00
sebastian
ae618b628b UPD: Destroy Preview Entity when its not needed 2026-02-21 10:47:20 +01:00
sebastian
9602197cb8 ADD: Building Preview 2026-02-21 10:36:37 +01:00
sebastian
ca526e0253 ADD: Visualize Upgradeable Buildings 2026-02-21 07:48:00 +01:00
sebastian
041f423b4f FIX: First build, then upgrade 2026-02-21 07:21:07 +01:00
sebastian
398414a43d ADD: Upgrade buildings 2026-02-21 07:09:44 +01:00
sebastian
a582ddc519 FIX: Handle required texture flipping sometimes 2026-02-15 19:54:34 +01:00
sebastian
1908b5e4b7 ADD: Choose Selected Building for Placement by BuildingMenu 2026-02-15 19:49:50 +01:00
sebastian
d2f9d3541c UPD: Make Building Buttons dependent on BuildingConfigurations 2026-02-15 19:18:04 +01:00
sebastian
911d07e882 ADD: BuildingMenuButton Background 2026-02-15 19:06:50 +01:00
sebastian
caf2cbd42a ADD: BuildingMenuButtons 2026-02-15 19:06:40 +01:00
sebastian
968485ec1b ADD: Remove UiTexts from Rendering and only use GuiTextRendering 2026-02-15 16:56:49 +01:00
sebastian
9ef692ab5d FIX: Correctly Positioning Rendered Texts 2026-02-15 16:45:32 +01:00
sebastian
a8c8e1770c ADD: ClickableUiComponent 2026-02-15 16:16:00 +01:00
sebastian
16b4747175 ADD: Ui can now block inputs for tile highlight system 2026-02-15 14:17:11 +01:00
sebastian
285af0ae47 ADD: Icons for Buildings 2026-02-15 11:03:25 +01:00
sebastian
9f0d1e0f19 ADD: BuildingMenuContainerContainer with(temporary solution to set rootLayout.justifyContent to SpaceBetween) until flexGrowth is supported 2026-02-15 10:36:42 +01:00
sebastian
b3ad023729 FIX: Consistent y flipping of texture coords 2026-02-15 10:08:02 +01:00
sebastian
66020b9b9a UPD: Adjust size of Minimap 2026-02-15 09:50:27 +01:00
sebastian
10a495c205 ADD: Background of InventoryContainer 2026-02-15 09:44:02 +01:00
sebastian
5804ed15ee UPD: Disable texture binding after textrendering 2026-02-15 08:50:34 +01:00
sebastian
4146ea5ea1 ADD: BackgroundTextures for GuiTextures 2026-02-15 08:24:58 +01:00
sebastian
c8531c5ea6 FIX: Complete Map in Minimap 2026-02-14 20:56:03 +01:00
sebastian
7476719bb2 ADD: Minimap 2026-02-14 20:52:30 +01:00
sebastian
e7094dd7de UPD: Consider ResourceTypes 2026-02-14 18:27:03 +01:00
sebastian
762550fccf First approach of area generation 2026-02-14 18:18:58 +01:00
sebastian
dad3a4e0f3 ADD: Introduce Ownership to tiles 2026-02-14 17:17:05 +01:00
sebastian
48bd9bf8d9 ADD: CollectResourceSystem 2026-02-14 16:51:38 +01:00
sebastian
f1f1dde9b5 ADD: Create WorldSprits when Inventory of Building is full 2026-02-14 16:16:29 +01:00
sebastian
1941ee3690 ADD: Include Textures in Assetmanager 2026-02-14 15:44:17 +01:00
sebastian
e62f3ffacc ADD: Basic AnimationSystem 2026-02-14 15:37:05 +01:00
sebastian
40a6c2b048 ADD: Basic WorldSpriteSystem 2026-02-14 14:42:29 +01:00
sebastian
9f1cc007b1 ADD: Cabin Variants 2026-02-14 09:44:47 +01:00
sebastian
994ad89c13 ADD: ProducingSystem for placed Buildings 2026-02-14 09:44:32 +01:00
sebastian
2c1c5b2d63 ADD: ProducingSystem 2026-02-14 09:11:06 +01:00
sebastian
0ca673f702 CLEANUP 2026-02-14 08:37:38 +01:00
sebastian
f301cede21 ADD: Update ModelStages based in ModelParams 2026-02-14 08:35:32 +01:00
sebastian
2d453d05c1 ADD: Introduce ModelStages to ModelComponent and refactor EntityManager 2026-02-14 08:06:19 +01:00
sebastian
8e5036d402 ADD: Support multiple materials per object 2026-02-13 23:09:59 +01:00
sebastian
46110b333d ADD: Add Submodels 2026-02-13 22:01:42 +01:00
sebastian
150fbca06c ADD: Basic StageSystem 2026-02-13 21:47:02 +01:00
sebastian
ce2858534f ADD: Integrate Turnsystem into BuildingPlacementSystem 2026-02-13 21:00:33 +01:00
sebastian
1735d89eca ADD: Implement Basic Turnsystem with UI Update 2026-02-13 20:42:19 +01:00
sebastian
7adf0164c3 ADD: models 2026-02-13 18:50:26 +01:00
sebastian
c224479efc UPD: gitignore 2026-02-13 18:49:54 +01:00
sebastian
e85cee21d2 UPD: Use another stone mason model 2026-02-13 18:49:24 +01:00
sebastian
687a4197e9 ADD: Add Stone Mason Building Type 2026-02-13 18:21:16 +01:00
sebastian
36900334d0 UPD: Refactor BuildingSystem 2026-02-13 17:19:48 +01:00
sebastian
c3a0fa662c ADD: Connect PlayerInventory to UI 2026-02-13 16:34:53 +01:00
sebastian
00e7826209 ADD: InventoryContainer 2026-02-13 15:50:57 +01:00
sebastian
8c50f61d5f ADD: Implement RessourceWidgetFactory 2026-02-13 15:45:40 +01:00
sebastian
a06d649f99 FIX: Align Items recurisvely 2026-02-13 15:09:20 +01:00
sebastian
9a05a0c854 ADD: RessourceWidgets (more or less working) 2026-02-13 08:40:39 +01:00
328 changed files with 5896683 additions and 861 deletions

View File

@ -0,0 +1,41 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Dependencies installieren
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
build-essential \
libfreetype-dev \
libgl1-mesa-dev
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | \
sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
sudo apt-get install -y cmake
- name: Submodules laden
run: git submodule update --init --recursive
- name: Konfigurieren
run: cmake -B build -DBUILD_GAME=OFF
- name: Nur Test-Target bauen
run: cmake --build build --target LayoutEngineTests
- name: Tests ausführen
run: ctest --test-dir build --output-on-failure

3
.gitignore vendored
View File

@ -84,7 +84,6 @@ fabric.properties
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
@ -139,7 +138,7 @@ dkms.conf
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "lib/glm"]
path = lib/glm
url = https://github.com/g-truc/glm.git
[submodule "lib/tinyobjloader"]
path = lib/tinyobjloader
url = https://github.com/tinyobjloader/tinyobjloader.git

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CIDR" type="CPP_MODULE" version="4" />
<module classpath="CMake" type="CPP_MODULE" version="4" />

View File

@ -17,7 +17,7 @@
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
@ -257,7 +257,6 @@
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALLOW_FAR_ALIGNMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />

View File

@ -2,6 +2,8 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/catch2-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/spdlog-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/glfw" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/glm" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/tinyobjloader" vcs="Git" />

View File

@ -1,25 +1,62 @@
cmake_minimum_required(VERSION 3.31)
cmake_minimum_required(VERSION 3.20)
project(Dicewars_Siedler)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(OpenGL REQUIRED)
option(BUILD_GAME "Build the game executable" ON)
add_subdirectory(lib/glfw)
# GLFW/OpenGL/Freetype nur laden wenn das Spiel gebaut wird
if(BUILD_GAME)
find_package(OpenGL REQUIRED)
add_subdirectory(lib/glfw)
add_library(glad STATIC
lib/glad/src/glad.c
)
target_include_directories(glad PUBLIC
lib/glad/include
add_library(glad STATIC
lib/glad/src/glad.c
)
target_include_directories(glad PUBLIC
lib/glad/include
)
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
endif()
# Catch2 und Tests immer verfügbar
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.7.1
)
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
add_executable(LayoutEngineTests
tests/layout/LayoutEngineTest.cpp
)
target_include_directories(LayoutEngineTests PRIVATE
src
lib/glm
)
add_executable(Dicewars_Siedler src/main.cpp
include(FetchContent)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.17.0
)
FetchContent_MakeAvailable(Catch2 spdlog)
target_link_libraries(LayoutEngineTests PRIVATE Catch2::Catch2WithMain spdlog::spdlog_header_only)
include(CTest)
include(Catch)
catch_discover_tests(LayoutEngineTests)
if(BUILD_GAME)
add_executable(Dicewars_Siedler src/main.cpp
src/engine/core/Window.cpp
src/engine/core/Window.h
src/engine/platform/glfw/GLFWWindow.cpp
@ -74,8 +111,8 @@ add_executable(Dicewars_Siedler src/main.cpp
src/engine/renderer/TerrainRenderer.h
src/engine/renderer/shaders/TerrainShader.cpp
src/engine/renderer/shaders/TerrainShader.h
src/engine/renderer/model/AssetManager.cpp
src/engine/renderer/model/AssetManager.h
src/engine/renderer/loader/AssetManager.cpp
src/engine/renderer/loader/AssetManager.h
src/game/hexWorld/tileGenerator/HexTileGeneratorStrategy.cpp
src/game/hexWorld/tileGenerator/HexTileGeneratorStrategy.h
src/game/hexWorld/tileGenerator/ForestTileGenerator.cpp
@ -107,8 +144,8 @@ add_executable(Dicewars_Siedler src/main.cpp
src/game/hexWorld/ecs/systems/BuildingPlacementSystem.h
src/game/GameMode.cpp
src/game/GameMode.h
src/game/PlayerInventory.cpp
src/game/PlayerInventory.h
src/game/player/PlayerInventory.cpp
src/game/player/PlayerInventory.h
src/game/player/Player.cpp
src/game/player/Player.h
src/game/hexWorld/ecs/components/OwnerComponent.cpp
@ -134,8 +171,8 @@ add_executable(Dicewars_Siedler src/main.cpp
src/engine/core/gui/uiComponent/UiText.h
src/engine/core/gui/text/Font.cpp
src/engine/core/gui/text/Font.h
src/engine/core/gui/uiComponent/UiRenderBundle.cpp
src/engine/core/gui/uiComponent/UiRenderBundle.h
src/engine/renderer/components/UiRenderBundle.cpp
src/engine/renderer/components/UiRenderBundle.h
src/engine/renderer/shaders/TextShader.cpp
src/engine/renderer/shaders/TextShader.h
src/engine/renderer/TextRenderer.cpp
@ -147,19 +184,178 @@ add_executable(Dicewars_Siedler src/main.cpp
src/engine/core/gui/uiComponent/UiButton.h
src/engine/renderer/model/GUIText.cpp
src/engine/renderer/model/GUIText.h
)
src/game/ui/components/UiRessourceWidget.cpp
src/game/ui/components/UiRessourceWidget.h
src/game/ui/components/factorys/RessourceWidgetFactory.cpp
src/game/ui/components/factorys/RessourceWidgetFactory.h
src/game/ui/components/UiInventoryContainer.cpp
src/game/ui/components/UiInventoryContainer.h
src/game/hexWorld/building/BuildingDefinition.h
src/game/hexWorld/building/TemporaryBuildingDefinitionFactory.h
src/game/hexWorld/building/BuildingRules.cpp
src/game/hexWorld/building/BuildingRules.h
src/game/hexWorld/building/BuildingFactory.cpp
src/game/hexWorld/building/BuildingFactory.h
src/game/hexWorld/building/BuildingConfig.cpp
src/game/hexWorld/building/BuildingConfig.h
src/engine/toolbox/util.h
src/engine/core/events/EventBus.cpp
src/engine/core/events/EventBus.h
src/game/hexWorld/events/TurnChangedEvent.cpp
src/game/hexWorld/events/TurnChangedEvent.h
src/game/hexWorld/events/ResourceCollectEvent.cpp
src/game/hexWorld/events/ResourceCollectEvent.h
src/game/hexWorld/gameplay/TurnSystem.cpp
src/game/hexWorld/gameplay/TurnSystem.h
src/game/hexWorld/gameplay/TurnState.h
src/engine/renderer/model/SubModel.h
src/engine/renderer/model/ModelStageConfiguration.cpp
src/engine/renderer/model/ModelStageConfiguration.h
src/engine/renderer/model/ModelStageCondition.h
src/engine/renderer/model/ModelStages.cpp
src/engine/renderer/model/ModelStages.h
src/engine/toolbox/IndexedMap.cpp
src/engine/toolbox/IndexedMap.h
src/engine/core/ECS/ModelStateComponent.cpp
src/engine/core/ECS/ModelStateComponent.h
src/game/hexWorld/ecs/components/ProducingComponent.cpp
src/game/hexWorld/ecs/components/ProducingComponent.h
src/game/hexWorld/ecs/systems/ProducingSystem.cpp
src/game/hexWorld/ecs/systems/ProducingSystem.h
src/engine/core/ECS/WorldSpriteComponent.cpp
src/engine/core/ECS/WorldSpriteComponent.h
src/engine/renderer/WorldSpriteRenderer.cpp
src/engine/renderer/WorldSpriteRenderer.h
src/engine/renderer/components/WorldSpriteRenderingData.h
src/engine/renderer/shaders/WorldSpriteShader.cpp
src/engine/renderer/shaders/WorldSpriteShader.h
src/engine/core/animations/AnimationCurve.h
src/engine/core/animations/AnimationTrack.h
src/engine/core/animations/AnimationComponent.cpp
src/engine/core/animations/AnimationComponent.h
src/engine/core/animations/AnimationSystem.cpp
src/engine/core/animations/AnimationSystem.h
src/engine/core/EngineTime.cpp
src/engine/core/EngineTime.h
src/game/hexWorld/ecs/systems/CollectResourceSystem.cpp
src/game/hexWorld/ecs/systems/CollectResourceSystem.h
src/engine/renderer/model/FramebufferObject.cpp
src/engine/renderer/model/FramebufferObject.h
src/engine/renderer/MinimapRenderer.cpp
src/engine/renderer/MinimapRenderer.h
src/engine/renderer/components/MinimapRenderData.h
src/engine/renderer/shaders/MinimapShader.cpp
src/engine/renderer/shaders/MinimapShader.h
src/engine/renderer/model/RenderTargets.cpp
src/engine/renderer/model/RenderTargets.h
src/engine/renderer/model/GuiTextureBuilder.cpp
src/engine/renderer/model/GuiTextureBuilder.h
src/game/ui/components/buildingMenu/UiBuildingMenuContainer.cpp
src/game/ui/components/buildingMenu/UiBuildingMenuContainer.h
src/engine/core/inputsOutputs/stateControl/states/IState.cpp
src/engine/core/inputsOutputs/stateControl/states/IState.h
src/engine/core/inputsOutputs/stateControl/InputUser.cpp
src/engine/core/inputsOutputs/stateControl/InputUser.h
src/engine/core/inputsOutputs/inputs/Keyboard.cpp
src/engine/core/inputsOutputs/inputs/Keyboard.h
src/engine/core/inputsOutputs/inputs/Mouse.cpp
src/engine/core/inputsOutputs/inputs/Mouse.h
src/engine/core/inputsOutputs/inputs/MouseButton.h
src/engine/core/inputsOutputs/stateControl/RegisteredUsers.cpp
src/engine/core/inputsOutputs/stateControl/RegisteredUsers.h
src/engine/core/inputsOutputs/stateControl/StateManager.cpp
src/engine/core/inputsOutputs/stateControl/StateManager.h
src/engine/core/inputsOutputs/stateControl/states/State.cpp
src/engine/core/inputsOutputs/stateControl/states/State.h
src/engine/core/inputsOutputs/stateControl/states/EmptyState.cpp
src/engine/core/inputsOutputs/stateControl/states/EmptyState.h
src/engine/core/inputsOutputs/stateControl/inputUser/GameInputUser.cpp
src/engine/core/inputsOutputs/stateControl/inputUser/GameInputUser.h
src/engine/core/inputsOutputs/stateControl/StateRegistry.cpp
src/engine/core/inputsOutputs/stateControl/StateRegistry.h
src/engine/core/gui/uiComponent/ClickableUiComponent.cpp
src/engine/core/gui/uiComponent/ClickableUiComponent.h
src/engine/core/inputsOutputs/stateControl/inputUser/UiInputUser.cpp
src/engine/core/inputsOutputs/stateControl/inputUser/UiInputUser.h
src/engine/core/gui/uiComponent/EventData.cpp
src/engine/core/gui/uiComponent/EventData.h
src/game/ui/components/buildingMenu/UiBuildingMenuButton.cpp
src/game/ui/components/buildingMenu/UiBuildingMenuButton.h
src/game/ui/components/buildingMenu/UiBuildingMenuCostContainer.cpp
src/game/ui/components/buildingMenu/UiBuildingMenuCostContainer.h
src/game/hexWorld/events/BuildingTypeSelectEvent.cpp
src/game/hexWorld/events/BuildingTypeSelectEvent.h
src/game/hexWorld/ecs/components/UpgradeComponent.cpp
src/game/hexWorld/ecs/components/UpgradeComponent.h
src/game/hexWorld/ecs/systems/UpgradeSystem.cpp
src/game/hexWorld/ecs/systems/UpgradeSystem.h
src/game/hexWorld/ecs/systems/SelectionSystem.cpp
src/game/hexWorld/ecs/systems/SelectionSystem.h
src/engine/core/ECS/RenderStateComponent.cpp
src/engine/core/ECS/RenderStateComponent.h
src/game/hexWorld/ecs/systems/BuildPreviewSystem.cpp
src/game/hexWorld/ecs/systems/BuildPreviewSystem.h
src/game/hexWorld/ecs/components/BuildingPreviewComponent.cpp
src/game/hexWorld/ecs/components/BuildingPreviewComponent.h
src/game/GameWorldSystems.cpp
src/game/GameWorldSystems.h
src/engine/core/gui/uiComponent/layout/LayoutEngine.h
src/engine/renderer/config/MinimapConfig.h
src/engine/core/Types.h
src/engine/core/gui/text/UiTheme.h
src/engine/renderer/loader/async/RawSubModelData.h
src/engine/renderer/loader/async/RawModelData.h
src/engine/renderer/loader/async/RawTextureData.h
src/engine/renderer/loader/async/RawModelStageData.h
src/engine/renderer/loader/async/RawStagedModelData.h
src/engine/renderer/loader/async/AssetLoader.cpp
src/engine/renderer/loader/async/AssetLoader.h
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
src/engine/core/scenes/Scene.cpp
src/engine/core/scenes/Scene.h
src/engine/core/scenes/SceneManager.cpp
src/engine/core/scenes/SceneManager.h
src/engine/core/scenes/SplashScreen.cpp
src/engine/core/scenes/SplashScreen.h
src/engine/core/scenes/SplashScreenLayer.cpp
src/engine/core/scenes/SplashScreenLayer.h
src/engine/core/gui/uiComponent/UiProgressbar.cpp
src/engine/core/gui/uiComponent/UiProgressbar.h
src/game/scenes/main/MainMenu.cpp
src/game/scenes/main/MainMenu.h
src/game/scenes/main/MainUiLayer.cpp
src/game/scenes/main/MainUiLayer.h
src/game/scenes/main/events/QuitEvent.h
src/engine/core/gui/uiMain/UiStack.cpp
src/engine/core/gui/uiMain/UiStack.h
src/engine/core/EngineContext.cpp
src/engine/core/EngineContext.h
src/engine/core/gui/uiMain/UiConfig.h
src/engine/renderer/RenderContext.h
)
target_compile_options(Dicewars_Siedler PRIVATE
-Wall
-Wextra
-Wpedantic
-Werror=return-type
)
target_include_directories(Dicewars_Siedler PRIVATE
lib/glfw/include
lib/glm
lib/stb_image
lib/tinyobjloader
)
target_link_libraries(Dicewars_Siedler
PRIVATE
target_include_directories(Dicewars_Siedler PRIVATE
lib/glfw/include
lib/glm
lib/stb_image
lib/tinyobjloader
lib/nlohmann
)
target_link_libraries(Dicewars_Siedler
PRIVATE
glfw
glad
OpenGL::GL
${FREETYPE_LIBRARIES}
)
${FREETYPE_LIBRARIES}
spdlog::spdlog_header_only
)
endif()

BIN
assets/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
assets/bar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

View File

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@ -0,0 +1,21 @@
{
"name": "cabin",
"allowedTileResources" : ["stone"],
"cost" : {"wood": 15},
"modelStages": [
{
"name": "cabin-base",
"filename": "cabin.obj",
"conditionKey": "level",
"minValue": 1,
"maxValue": 1
},
{
"name": "cabin-level2",
"filename": "cabin2.obj",
"conditionKey": "level",
"minValue": 2,
"maxValue": 2
}
]
}

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'Untitled.blend'
# www.blender.org
newmtl Material_0.003
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd textures/forest_hut.png

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'None'
# www.blender.org
newmtl Material.001
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd cabin.jpg

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
# Blender 5.0.1 MTL File: 'Untitled.blend'
# www.blender.org
newmtl Log_Mat
Ns 63.117920
Ka 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd textures/Log_C1.jpg
#map_Bump -bm 1.000000 textures/Log_NRM.jpg
newmtl Material_0.003
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd /home/sebastian/Downloads/textures/forest_hut.png

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
# Blender 5.0.1 MTL File: 'Untitled.blend'
# www.blender.org
newmtl Log_Mat
Ns 63.117920
Ka 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd textures/Log_C1.jpg
#map_Bump -bm 1.000000 /home/sebastian/Downloads/log/source/Log/Log_NRM.jpg
newmtl Material_0.003
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd /home/sebastian/Downloads/textures/forest_hut.png

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@ -0,0 +1,14 @@
{
"name": "cabin2",
"allowedTileResources" : ["stone"],
"cost" : {"wood": 15},
"modelStages": [
{
"name": "cabin2-base",
"filename": "cabin2.obj",
"conditionKey": "fillRatio",
"minValue": 0.0,
"maxValue": 0.1
}
]
}

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'None'
# www.blender.org
newmtl Material.001
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd cabin.jpg

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'None'
# www.blender.org
newmtl Material.001
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd cabin.jpg

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

View File

@ -0,0 +1,21 @@
{
"name": "stoneMason",
"allowedTileResources" : ["stone"],
"cost" : {"wood": 15, "stone": 10},
"modelStages": [
{
"name": "stone_mason_empty",
"filename": "stone_mason.obj",
"conditionKey": "fillRatio",
"minValue": 0.0,
"maxValue": 0.5
},
{
"name": "stone_mason_full",
"filename": "stone_mason_full.obj",
"conditionKey": "fillRatio",
"minValue": 0.5,
"maxValue": 1.0
}
]
}

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'Untitled.blend'
# www.blender.org
newmtl Material_0.002
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd stone_mason.png

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -0,0 +1,32 @@
# Blender 5.0.1 MTL File: 'Untitled.blend'
# www.blender.org
newmtl Cobblestone_tjemdayjw
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd textures/tjemdayjw_4K_Albedo_LOD7.jpg
newmtl Cobblestone_tjemdbyiw
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd textures/tjemdbyiw_4K_Albedo_LOD6.jpg
newmtl Material_0.002
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd textures/stone_mason.png

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -1,31 +0,0 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 03.06.2013 16:07:05
newmtl 20958_Log_Cabin_v1
Ns 18.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 1.0000 1.0000 1.0000
Kd 1.0000 1.0000 1.0000
Ks 0.3240 0.3240 0.3240
Ke 0.0000 0.0000 0.0000
map_Ka cabin.jpg
map_Kd cabin.jpg
map_Ks 20958_Log_Cabin_v1_specular.jpg
newmtl 02___Default
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 1.0000 1.0000 1.0000
Kd 1.0000 1.0000 1.0000
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka disc_diffuse.JPG
map_Kd disc_diffuse.JPG

200007
assets/dragon/dragon.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 MiB

View File

@ -0,0 +1,12 @@
# Blender 5.0.1 MTL File: 'None'
# www.blender.org
newmtl _Faerberhaus_FaerberhausFaerberhaus
Ns 0.000000
Ka 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 1
map_Kd /home/sebastian/Downloads/prehistoric-house-asparn/source/Asparn_Weberhaus3/Faerberhaus.jpg

File diff suppressed because it is too large Load Diff

586
assets/progress bar.svg Normal file
View File

@ -0,0 +1,586 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="192"
height="24"
id="svg2"
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="progress bar.svg">
<defs
id="defs4">
<linearGradient
id="linearGradient4693">
<stop
style="stop-color:#272726;stop-opacity:1;"
offset="0"
id="stop4695" />
<stop
style="stop-color:#808080;stop-opacity:1"
offset="1"
id="stop4697" />
</linearGradient>
<linearGradient
id="linearGradient4685">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4687" />
<stop
style="stop-color:#6f8a91;stop-opacity:1;"
offset="1"
id="stop4689" />
</linearGradient>
<linearGradient
id="linearGradient4644">
<stop
style="stop-color:#464646;stop-opacity:1;"
offset="0"
id="stop4646" />
<stop
id="stop4648"
offset="0.32966033"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#6f917c;stop-opacity:1"
offset="1"
id="stop4650" />
</linearGradient>
<linearGradient
id="linearGradient4630">
<stop
style="stop-color:#00ff00;stop-opacity:1"
offset="0"
id="stop4632" />
<stop
style="stop-color:#008000;stop-opacity:1"
offset="1"
id="stop4634" />
</linearGradient>
<linearGradient
id="linearGradient4552">
<stop
style="stop-color:#97e4f3;stop-opacity:1;"
offset="0"
id="stop4554" />
<stop
style="stop-color:#80b3ff;stop-opacity:1;"
offset="1"
id="stop4556" />
</linearGradient>
<linearGradient
id="linearGradient4450">
<stop
id="stop4452"
offset="0"
style="stop-color:#464646;stop-opacity:1;" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0.32966033"
id="stop4454" />
<stop
id="stop4456"
offset="1"
style="stop-color:#3c3c3c;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4272">
<stop
style="stop-color:#464646;stop-opacity:1;"
offset="0"
id="stop4274" />
<stop
id="stop4448"
offset="0.5"
style="stop-color:#000000;stop-opacity:1;" />
<stop
style="stop-color:#3c3c3c;stop-opacity:1;"
offset="1"
id="stop4276" />
</linearGradient>
<linearGradient
id="linearGradient3757">
<stop
style="stop-color:#090a0c;stop-opacity:1;"
offset="0"
id="stop3759" />
<stop
id="stop3773"
offset="0.28483504"
style="stop-color:#414141;stop-opacity:1;" />
<stop
style="stop-color:#1c2017;stop-opacity:1;"
offset="0.65175718"
id="stop3775" />
<stop
style="stop-color:#373737;stop-opacity:1;"
offset="1"
id="stop3761" />
</linearGradient>
<filter
id="filter4136"
inkscape:label="Chalk and sponge"
inkscape:menu="Distort"
inkscape:menu-tooltip="Low turbulence gives sponge look and high turbulence chalk"
width="1.6"
height="2"
y="-0.5"
x="-0.3"
color-interpolation-filters="sRGB">
<feTurbulence
id="feTurbulence4138"
baseFrequency="0.4"
type="fractalNoise"
seed="0"
numOctaves="5"
result="result1" />
<feOffset
id="feOffset4140"
dx="-5"
dy="-5"
result="result2" />
<feDisplacementMap
id="feDisplacementMap4142"
in2="result1"
xChannelSelector="R"
yChannelSelector="G"
scale="30"
in="SourceGraphic" />
</filter>
<filter
id="filter4228"
inkscape:label="Chalk and sponge"
inkscape:menu="Distort"
inkscape:menu-tooltip="Low turbulence gives sponge look and high turbulence chalk"
width="1.6"
height="2"
y="-0.5"
x="-0.3"
color-interpolation-filters="sRGB">
<feTurbulence
id="feTurbulence4230"
baseFrequency="0.4"
type="fractalNoise"
seed="0"
numOctaves="5"
result="result1" />
<feOffset
id="feOffset4232"
dx="-5"
dy="-5"
result="result2" />
<feDisplacementMap
id="feDisplacementMap4234"
in2="result1"
xChannelSelector="R"
yChannelSelector="G"
scale="30"
in="SourceGraphic" />
</filter>
<filter
id="filter4264"
inkscape:label="Torn edges"
inkscape:menu="Distort"
inkscape:menu-tooltip="Displace the outside of shapes and pictures without altering their content"
height="1.4"
y="-0.2"
width="1.4"
x="-0.2"
color-interpolation-filters="sRGB">
<feTurbulence
id="feTurbulence4266"
baseFrequency="0.05"
numOctaves="5"
type="fractalNoise"
result="result91" />
<feDisplacementMap
id="feDisplacementMap4268"
in2="result91"
scale="25"
result="result5"
xChannelSelector="R"
in="SourceGraphic" />
<feComposite
id="feComposite4270"
in2="result5"
in="SourceGraphic"
operator="atop" />
</filter>
<filter
id="filter4378"
height="2"
width="1.6"
y="-0.5"
x="-0.3"
inkscape:label="Chalk and sponge"
inkscape:menu="Distort"
inkscape:menu-tooltip="Low turbulence gives sponge look and high turbulence chalk"
color-interpolation-filters="sRGB">
<feTurbulence
id="feTurbulence4380"
type="fractalNoise"
numOctaves="3"
baseFrequency="1"
seed="0"
result="result0" />
<feColorMatrix
id="feColorMatrix4382"
result="result4"
values="0"
type="saturate" />
<feComposite
id="feComposite4384"
in2="result4"
in="SourceGraphic"
operator="arithmetic"
k1="1.25"
k2="0.5"
k3="0.5"
result="result2" />
<feBlend
id="feBlend4386"
in2="SourceGraphic"
result="result5"
mode="normal"
in="result2" />
<feComposite
id="feComposite4388"
in2="SourceGraphic"
in="result5"
operator="in"
result="fbSourceGraphic" />
<feColorMatrix
result="fbSourceGraphicAlpha"
in="fbSourceGraphic"
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
id="feColorMatrix4396" />
<feTurbulence
id="feTurbulence4398"
baseFrequency="0.4"
type="fractalNoise"
seed="0"
numOctaves="5"
result="result1"
in="fbSourceGraphic" />
<feOffset
id="feOffset4400"
dx="-5"
dy="-5"
result="result2" />
<feDisplacementMap
id="feDisplacementMap4402"
in2="result1"
xChannelSelector="R"
yChannelSelector="G"
scale="30"
in="fbSourceGraphic" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4450-7"
id="radialGradient4444-1"
cx="64.285774"
cy="1043.2878"
fx="64.285774"
fy="1043.2878"
r="88.002487"
gradientTransform="matrix(1.1992386,5.9441478e-4,-3.5638716e-5,0.07009077,-3.2838697,967.86618)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4450-7">
<stop
id="stop4452-4"
offset="0"
style="stop-color:#464646;stop-opacity:1;" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0.32966033"
id="stop4454-0" />
<stop
id="stop4456-9"
offset="1"
style="stop-color:#3c3c3c;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4552"
id="radialGradient4558"
cx="50.773666"
cy="6.0489755"
fx="50.773666"
fy="6.0489755"
r="87.131035"
gradientTransform="matrix(2.0085717,-0.00289837,8.7720163e-5,0.06079008,-11.424877,69.805546)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4552"
id="radialGradient4602"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.0085717,-0.00289837,8.7720163e-5,0.06079008,-9.4248769,-24.194454)"
cx="50.773666"
cy="6.0489755"
fx="50.773666"
fy="6.0489755"
r="87.131035" />
<filter
id="filter4612"
inkscape:label="Evanescent"
inkscape:menu="Blurs"
inkscape:menu-tooltip="Blur the contents of objects, preserving the outline and adding progressive transparency at edges"
color-interpolation-filters="sRGB">
<feGaussianBlur
id="feGaussianBlur4614"
result="result6"
stdDeviation="3"
in="SourceGraphic" />
<feColorMatrix
id="feColorMatrix4616"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 "
result="result7"
in="SourceGraphic" />
<feComposite
id="feComposite4618"
in2="result7"
operator="in"
in="result6" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4552"
id="linearGradient4624"
x1="97.76786"
y1="31.357143"
x2="97.85714"
y2="40.107143"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4630"
id="linearGradient4636"
x1="105.68665"
y1="51.994923"
x2="105.68665"
y2="63.066353"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0105035,0,0,1,-1.9753048,-53.494924)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4685"
id="radialGradient4691"
cx="119.76596"
cy="1013.6822"
fx="119.76596"
fy="1013.6822"
r="96.000001"
gradientTransform="matrix(0,-0.12228403,1.1786193,1.0993711e-8,-1093.9826,1055.1382)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4693"
id="linearGradient4701"
x1="87.75"
y1="1036.1122"
x2="87.5"
y2="1045.8622"
gradientUnits="userSpaceOnUse" />
<linearGradient
gradientTransform="translate(-0.71736204,-985.07272)"
inkscape:collect="always"
xlink:href="#linearGradient4693-7"
id="linearGradient4701-1"
x1="87.75"
y1="1036.1122"
x2="87.5"
y2="1045.8622"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4693-7">
<stop
style="stop-color:#272726;stop-opacity:1;"
offset="0"
id="stop4695-4" />
<stop
style="stop-color:#808080;stop-opacity:1"
offset="1"
id="stop4697-0" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4685-4"
id="radialGradient4691-9"
cx="119.76596"
cy="1013.6822"
fx="119.76596"
fy="1013.6822"
r="96"
gradientTransform="matrix(0,-0.12228403,1.1786193,1.0993711e-8,-1093.9826,1055.1382)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4685-4">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4687-8" />
<stop
style="stop-color:#6f8a91;stop-opacity:1;"
offset="1"
id="stop4689-8" />
</linearGradient>
<radialGradient
r="96"
fy="1013.6822"
fx="119.76596"
cy="1013.6822"
cx="119.76596"
gradientTransform="matrix(0,-0.12228403,1.1786193,1.0993711e-8,-1094.7,70.065524)"
gradientUnits="userSpaceOnUse"
id="radialGradient3092"
xlink:href="#linearGradient4685-4"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4685-4"
id="radialGradient3122"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.12228403,1.1786193,1.0993711e-8,-1093.9754,26.778383)"
cx="119.76596"
cy="1013.6822"
fx="119.76596"
fy="1013.6822"
r="96" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6568543"
inkscape:cx="122.54678"
inkscape:cy="-5.1363583"
inkscape:document-units="px"
inkscape:current-layer="layer4"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1018"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="bg color"
style="display:none">
<rect
style="fill:#ff00ff;fill-opacity:1;fill-rule:nonzero;stroke:#ff00ff;stroke-width:0.64324963;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect4519"
width="191.35675"
height="23.35675"
x="0.32162482"
y="0.32162377" />
</g>
<g
inkscape:label="bg"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1028.3622)"
style="display:inline">
<rect
style="fill:url(#linearGradient4701);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.86400735;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3803"
width="177.1826"
height="11.4773"
x="7.2250452"
y="1034.7675" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="bar"
style="display:inline"
transform="translate(0,8)">
<rect
style="fill:url(#radialGradient4602);fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect4600"
width="174.26207"
height="10.593416"
x="9.6705065"
y="-29.273685" />
<rect
y="64.726318"
x="7.6705065"
height="10.593416"
width="174.26207"
id="rect4474"
style="fill:url(#radialGradient4558);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter4612)" />
<rect
y="30.369171"
x="9.6705065"
height="10.593416"
width="174.26207"
id="rect4620"
style="fill:url(#linearGradient4624);fill-opacity:1;fill-rule:nonzero;stroke:none" />
<rect
style="fill:url(#linearGradient4636);fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect4626"
width="176.09242"
height="10.593416"
x="7.7967758"
y="-1.1257526"
inkscape:export-filename="D:\gdev tools\Sprites\propios\Math Defense\progress-bar.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="fg"
style="display:inline">
<path
style="fill:url(#radialGradient3122);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.26178133;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 6.6308907,0.61910933 c -3.324,0 -6.00000003,2.67599997 -6.00000003,5.99999997 l 0,10.7499997 c 0,3.324 2.67600003,6 6.00000003,6 l 178.7499993,0 c 3.324,0 6,-2.676 6,-6 l 0,-10.7499997 c 0,-3.324 -2.676,-5.99999997 -6,-5.99999997 l -178.7499993,0 z m 0.59375,5.78124997 177.1874993,0 0,11.4999997 -177.1874993,0 0,-11.4999997 z"
id="rect4638-2"
inkscape:connector-curvature="0"
inkscape:export-filename="D:\gdev tools\Sprites\propios\Math Defense\progressbar-sample2.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="marker"
style="display:inline"
transform="translate(0,8)">
<path
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.08829999;stroke-miterlimit:4;stroke-opacity:1"
d="m 113.3769,-7.4558505 c -1.97469,0 -3.54957,1.4550698 -3.54957,3.2467467 0,1.0952171 0.59171,2.0690031 1.50779,2.656429 l 0,11.105349 c -0.91608,0.5874258 -1.5392,1.5612108 -1.5392,2.6564288 0,1.791676 1.60629,3.246747 3.58098,3.246747 1.97469,0 3.58099,-1.455071 3.58099,-3.246747 0,-1.212544 -0.73584,-2.2472668 -1.8219,-2.8040082 l 0,-10.8101902 c 1.08606,-0.5567417 1.8219,-1.5914648 1.8219,-2.8040084 0,-1.7916769 -1.6063,-3.2467467 -3.58099,-3.2467467 z"
id="rect4652"
inkscape:connector-curvature="0"
inkscape:export-filename="D:\gdev tools\Sprites\propios\Math Defense\progress-marker.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/progressbar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -9,6 +9,10 @@ out vec4 outColor;
uniform sampler2D textureSampler;
uniform vec3 lightColor;
uniform vec3 ghostColor;
uniform float pulse;
uniform bool ghostMode;
void main(void) {
vec3 unitNormal = normalize(surfaceNormal);
vec3 unitToLightDir = normalize(toLightVector);
@ -16,5 +20,11 @@ void main(void) {
float cosTheta = dot(unitNormal, unitToLightDir);
float brightness = max(cosTheta, 0.2);
vec3 diffuse = brightness * lightColor;
outColor = vec4(diffuse, 1.0f) * texture(textureSampler, pass_textureCoords);
vec4 finalColor = vec4(diffuse, 1.0f) * texture(textureSampler, pass_textureCoords);
if(ghostMode) {
finalColor = vec4(mix(finalColor.xyz, ghostColor, 0.5) * pulse, 1.0f);
}
outColor = finalColor;
}

View File

@ -5,14 +5,23 @@ in vec2 textureCoords;
out vec4 color;
uniform sampler2D guiTexture;
uniform sampler2D backgroundTexture;
uniform float brightness; // 1.0 = normal
uniform vec3 tintColor; // (0,0,0) = kein Tint
uniform float tintStrength; // 0.0 = aus
uniform bool hasForeground;
uniform bool hasBackground;
uniform float dimFactor;
void main(void) {
vec4 textureColor = texture(guiTexture, textureCoords);
vec4 fg = hasForeground ? texture(guiTexture, textureCoords) : vec4(0.0);
vec4 bg = hasBackground ? texture(backgroundTexture, textureCoords) : vec4(0.0);
vec4 textureColor = mix(bg, fg, fg.a);
textureColor.rgb *= brightness;
@ -20,4 +29,5 @@ void main(void) {
textureColor.rgb = mix(textureColor.rgb, tintColor, tintStrength);
color = textureColor;
color *= dimFactor;
}

View File

@ -8,5 +8,5 @@ uniform mat4 transformationMatrix;
void main(void) {
gl_Position = transformationMatrix * vec4(position, 0.0, 1.0);
textureCoords = vec2((position.x + 1.0)/ 2.0, 1 - (position.y + 1.0)/2.0);
textureCoords = vec2((position.x + 1.0)/ 2.0, (position.y + 1.0)/2.0);
}

View File

@ -0,0 +1,9 @@
#version 400 core
uniform vec3 color;
out vec4 fragColor;
void main() {
fragColor = vec4(color, 1.0);
}

View File

@ -0,0 +1,10 @@
#version 400 core
layout(location = 0) in vec3 position;
uniform mat4 transformationMatrix;
uniform mat4 viewProjectionMatrix;
void main() {
gl_Position = viewProjectionMatrix * transformationMatrix * vec4(position, 1.0);
}

View File

@ -10,6 +10,7 @@ uniform sampler2D textureSampler;
uniform vec3 lightColor;
uniform bool isHighlighted;
uniform vec3 highLightColor;
void main(void) {
vec3 unitNormal = normalize(surfaceNormal);
@ -20,7 +21,7 @@ void main(void) {
vec3 diffuse = brightness * lightColor;
if(isHighlighted) {
outColor = vec4(1.0f, 1.0f, 0.0f, 1.0f);
outColor = vec4(highLightColor, 1.0);
} else {
outColor = vec4(diffuse, 1.0f) * texture(textureSampler, pass_textureCoords);
}

View File

@ -6,8 +6,10 @@ out vec4 outColor;
uniform sampler2D text;
uniform vec3 textColor;
uniform float dimFactor;
void main() {
float alpha = texture(text, pass_texCoords).r;
outColor = vec4(textColor, alpha);
outColor *= dimFactor;
}

View File

@ -0,0 +1,12 @@
#version 400 core
in vec2 passTexCoords;
out vec4 outColor;
uniform sampler2D spriteTexture;
uniform float alpha;
void main() {
vec4 tex = texture(spriteTexture, passTexCoords);
outColor = vec4(tex.rgb, tex.a * alpha);
}

View File

@ -0,0 +1,14 @@
#version 400 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoords;
out vec2 passTexCoords;
uniform mat4 projectionViewMatrix;
uniform mat4 modelMatrix;
void main() {
gl_Position = projectionViewMatrix * modelMatrix * vec4(position, 1.0);
passTexCoords = texCoords;
}

1696
assets/stall/stall.obj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

1099
assets/trees/lowPolyTree.obj Normal file

File diff suppressed because it is too large Load Diff

1649
assets/trees/tree.obj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

10
assets/ui/uiTheme.json Normal file
View File

@ -0,0 +1,10 @@
{
"font": {
"path": "/usr/share/fonts/TTF/DejaVuSans.ttf",
"sizes": {
"small": 18,
"medium": 28,
"large": 48
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
assets/worldIcons/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

25526
lib/nlohmann/json.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,19 +4,28 @@
#include "Application.h"
#include "../layer/Layer.h"
#include "EngineTime.h"
#include "../../game/scenes/main/events/QuitEvent.h"
#include "../platform/glfw/InputManager.h"
#include "inputsOutputs/stateControl/StateRegistry.h"
#include "../core/scenes/SceneManager.h"
#include "../core/scenes/Scene.h"
Application* Application::instance = nullptr;
void Application::pushLayer(Layer* layer) {
layers.push_back(layer);
layer->onAttach();
void Application::updateTime() {
const auto now = static_cast<float>(glfwGetTime());
EngineTime::deltaTime = now - lastFrame;
EngineTime::totalTime += EngineTime::deltaTime;
lastFrame = now;
// printf("Frametime: %f\n", EngineTime::deltaTime);
}
Application::Application()
{
instance = this;
context = std::make_unique<EngineContext>();
sceneManager = std::make_unique<SceneManager>(*context.get());
WindowProps window_props = WindowProps();
window_props.Width = 1280;
@ -25,6 +34,13 @@ Application::Application()
window_props.VSync = true;
window.reset(Window::Create(window_props));
keyboard = std::make_unique<Keyboard>(*window);
mouse = std::make_unique<Mouse>(*window);
stateManager = std::make_unique<StateManager>(StateRegistry::get().empty, StateRegistry::get().game);
EventBus::getInstance().subscribe<QuitEvent>([this](const QuitEvent& e) {
window->close();
});
}
Application::~Application()
@ -34,12 +50,17 @@ Application::~Application()
void Application::run() {
while (!window->shouldClose())
{
for (Layer* layer : layers)
{
layer->onUpdate();
}
window->OnUpdate();
updateTime();
sceneManager->update();
sceneManager->render();
InputManager::update();
mouse->update();
keyboard->update();
stateManager->updateState();
}
}

View File

@ -7,10 +7,17 @@
#include <memory>
#include <vector>
#include "EngineContext.h"
#include "Window.h"
#include "events/EventBus.h"
#include "inputsOutputs/inputs/Keyboard.h"
#include "inputsOutputs/inputs/Mouse.h"
#include "inputsOutputs/stateControl/StateManager.h"
#include "inputsOutputs/stateControl/states/State.h"
class Layer;
class SceneManager;
class Application
{
@ -23,16 +30,21 @@ public:
static Application& getInstance();
[[nodiscard]] Window& getWindow() const {return *window;}
std::unique_ptr<Keyboard> keyboard;
std::unique_ptr<Mouse> mouse;
std::unique_ptr<StateManager> stateManager;
std::shared_ptr<GameState> gameState;
std::unique_ptr<SceneManager> sceneManager;
std::unique_ptr<EngineContext> context;
private:
bool running = true;
std::unique_ptr<Window> window;
static Application* instance;
std::vector<Layer*> layers;
protected:
void pushLayer(Layer* layer);
void updateTime();
float lastFrame;
};

View File

@ -4,17 +4,17 @@
#include "EntityManager.h"
#include <algorithm>
#include <ranges>
EntityID EntityManager::createEntity() {
const EntityID id = nextID++;
entities.push_back(id);
return id;
}
void EntityManager::destroyEntity(EntityID entity) {
entities.erase(std::remove(entities.begin(), entities.end(), entity), entities.end());
transforms.erase(entity);
models.erase(entity);
tileRenderComponents.erase(entity);
tileGameplayComponents.erase(entity);
buildings.erase(entity);
void EntityManager::destroyEntity(const EntityID entity) {
std::erase(entities, entity);
for (auto &compMap: components | std::views::values) {
compMap.erase(entity);
}
}

View File

@ -6,6 +6,7 @@
#define ENTITYMANAGER_H
#include <cstdint>
#include <memory>
#include <typeindex>
#include <unordered_map>
#include <vector>
@ -26,13 +27,7 @@ private:
EntityID nextID = 1;
std::vector<EntityID> entities;
std::unordered_map<EntityID, std::shared_ptr<TransformComponent>> transforms;
std::unordered_map<EntityID, std::shared_ptr<ModelComponent>> models;
std::unordered_map<EntityID, std::shared_ptr<TileRenderComponent>> tileRenderComponents;
std::unordered_map<EntityID, std::shared_ptr<TileGameplayComponent>> tileGameplayComponents;
std::unordered_map<EntityID, std::shared_ptr<MapEntityComponent>> mapEntityComponents;
std::unordered_map<EntityID, std::shared_ptr<BuildingComponent>> buildings;
std::unordered_map<EntityID, std::shared_ptr<OwnerComponent>> owners;
std::unordered_map<std::type_index, std::unordered_map<EntityID, std::shared_ptr<Component>>> components;
public:
EntityID createEntity();
@ -40,50 +35,28 @@ public:
template<typename T>
void addComponent(EntityID entity, std::shared_ptr<T> component) {
if constexpr (std::is_same_v<T, TransformComponent>) {
transforms[entity] = component;
} else if constexpr (std::is_same_v<T, ModelComponent>) {
models[entity] = component;
} else if constexpr (std::is_same_v<T, TileRenderComponent>) {
tileRenderComponents[entity] = component;
} else if constexpr (std::is_same_v<T, TileGameplayComponent>) {
tileGameplayComponents[entity] = component;
} else if constexpr (std::is_same_v<T, MapEntityComponent>) {
mapEntityComponents[entity] = component;
} else if constexpr (std::is_same_v<T, BuildingComponent>) {
buildings[entity] = component;
} else if constexpr (std::is_same_v<T, OwnerComponent>) {
owners[entity] = component;
} else {
static_assert(sizeof(T) == 0, "Component-Typ nicht unterstützt");
}
auto& compMap = components[typeid(T)];
compMap[entity] = component;
}
template<typename T>
std::shared_ptr<T> getComponent(EntityID entity) {
if constexpr (std::is_same_v<T, TransformComponent>) {
auto it = transforms.find(entity);
return (it != transforms.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, ModelComponent>) {
auto it = models.find(entity);
return (it != models.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, TileRenderComponent>) {
auto it = tileRenderComponents.find(entity);
return (it != tileRenderComponents.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, TileGameplayComponent>) {
auto it = tileGameplayComponents.find(entity);
return (it != tileGameplayComponents.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, MapEntityComponent>) {
auto it = mapEntityComponents.find(entity);
return (it != mapEntityComponents.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, BuildingComponent>) {
auto it = buildings.find(entity);
return (it != buildings.end()) ? it->second : nullptr;
} else if constexpr (std::is_same_v<T, OwnerComponent>) {
auto it = owners.find(entity);
return (it != owners.end()) ? it->second : nullptr;
} else {
static_assert(sizeof(T) == 0, "Component-Typ nicht unterstützt");
auto it = components.find(typeid(T));
if (it != components.end()) {
auto& compMap = it->second;
auto compIt = compMap.find(entity);
if (compIt != compMap.end()) {
return std::static_pointer_cast<T>(compIt->second);
}
}
return nullptr;
}
template<typename T>
void removeComponent(EntityID entity) {
auto it = components.find(typeid(T));
if (it != components.end()) {
it->second.erase(entity);
}
}

View File

@ -4,16 +4,47 @@
#ifndef MODELCOMPONENT_H
#define MODELCOMPONENT_H
#include <iostream>
#include <memory>
#include <utility>
#include "Component.h"
#include "../../renderer/model/ModelStages.h"
#include "../../renderer/model/TexturedModel.h"
#include "../../toolbox/IndexedMap.h"
class ModelComponent: public Component {
public:
std::shared_ptr<TexturedModel> model;
ModelComponent(std::shared_ptr<TexturedModel> model) : model(std::move(model)) {};
ModelComponent(const std::shared_ptr<ModelStages> &modelStages, std::string modelname): modelName(std::move(modelname)), currentStage(0) {
for (const auto& stage : modelStages->getModelStages()) {
stages.insert(stage.getStageName(), stage.getModelOfModelStage());
}
};
ModelComponent(std::shared_ptr<TexturedModel> model, std::string modelname): modelName(std::move(modelname)), currentStage(0) {
stages["default"] = std::move(model);
}
void updateStage(const std::string& updatedStage) {
if (stages.containsKey(updatedStage)) {
size_t updatedStageIndex = stages.indexOfKey(updatedStage);
currentStage = updatedStageIndex;
} else {
std::cerr << "Stage " << updatedStage << " not found!" << std::endl;
}
}
[[nodiscard]] std::shared_ptr<TexturedModel> getActiveModel() const{
return stages.atIndex(currentStage);
}
[[nodiscard]] const std::string& getModelName() const {return modelName;}
private:
std::string modelName;
IndexedMap<std::string, std::shared_ptr<TexturedModel>> stages;
size_t currentStage;
};

View File

@ -0,0 +1,5 @@
//
// Created by sebastian on 14.02.26.
//
#include "ModelStateComponent.h"

View File

@ -0,0 +1,18 @@
//
// Created by sebastian on 14.02.26.
//
#ifndef DICEWARS_SIEDLER_MODELSTATECOMPONENT_H
#define DICEWARS_SIEDLER_MODELSTATECOMPONENT_H
#include <string>
#include "Component.h"
class ModelStateComponent : public Component{
public:
std::unordered_map<std::string, float> params;
};
#endif //DICEWARS_SIEDLER_MODELSTATECOMPONENT_H

View File

@ -0,0 +1,5 @@
//
// Created by sebastian on 21.02.26.
//
#include "RenderStateComponent.h"

View File

@ -0,0 +1,19 @@
//
// Created by sebastian on 21.02.26.
//
#ifndef DICEWARS_SIEDLER_RENDERSTATECOMPONENT_H
#define DICEWARS_SIEDLER_RENDERSTATECOMPONENT_H
#include "Component.h"
class RenderStateComponent: public Component {
public:
bool visible = true;
glm::vec3 ghostColor = glm::vec3(1.0, 1.0,1.0f);
bool ghostMode = false;
float pulse = 1.0f;
};
#endif //DICEWARS_SIEDLER_RENDERSTATECOMPONENT_H

View File

@ -4,21 +4,61 @@
#include "RenderSystem.h"
#include "ModelStateComponent.h"
#include "RenderStateComponent.h"
#include "../../renderer/loader/AssetManager.h"
void RenderSystem::render(EntityManager &entityManager, MasterRenderer &renderer) {
for (auto id : entityManager.getAllEntities()) {
auto transform = entityManager.getComponent<TransformComponent>(id);
auto model = entityManager.getComponent<ModelComponent>(id);
auto tileRenderingComponent = entityManager.getComponent<TileRenderComponent>(id);
auto modelStateComponent = entityManager.getComponent<ModelStateComponent>(id);
auto ownerComponent = entityManager.getComponent<OwnerComponent>(id);
auto worldSpriteComponent = entityManager.getComponent<WorldSpriteComponent>(id);
auto renderStateComponent = entityManager.getComponent<RenderStateComponent>(id);
if (renderStateComponent && !renderStateComponent->visible) {
continue;
}
if (modelStateComponent) {
updateModelStage(model.get(), modelStateComponent.get());
}
if (!transform || !model) continue;
if (worldSpriteComponent) {
renderer.submitWorldSprite(transform, worldSpriteComponent, worldSpriteComponent->texture);
}
if (tileRenderingComponent) {
renderer.submitTerrainTile(transform, model, tileRenderingComponent);
renderer.submitTerrainTile(transform, model, tileRenderingComponent, ownerComponent);
} else {
Entity entity = Entity(model->model, transform->position, transform->rotation.x, transform->rotation.y, transform->rotation.z, transform->scale);
Entity entity = Entity(model->getActiveModel(), transform->position, transform->rotation.x, transform->rotation.y, transform->rotation.z, transform->scale);
entity.setRenderState(renderStateComponent);
renderer.submitEntity(std::make_unique<Entity>(entity));
}
}
}
void RenderSystem::updateModelStage(ModelComponent *model, ModelStateComponent *state) {
std::string bestStage = "default";
auto modelStages = AssetManager::getModelStages(model->getModelName());
for (const auto& stage : modelStages->getModelStages()) {
auto it = state->params.find(stage.getCondition().key);
if (it == state->params.end()) continue;
float value = it->second;
if (value >= stage.getCondition().min && value <= stage.getCondition().max) {
bestStage = stage.getStageName();
}
}
model->updateStage(bestStage);
}

Some files were not shown because too many files have changed in this diff Show More