This commit is contained in:
parent
def763d6ae
commit
88c0e9d2fe
@ -1,2 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
<module classpath="CIDR" type="CPP_MODULE" version="4" />
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
<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/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" 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/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
@ -139,6 +139,7 @@
|
|||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOverrideWithDifferentVisibility/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
@ -265,7 +266,6 @@
|
|||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||||
|
|||||||
@ -332,6 +332,8 @@ if(BUILD_GAME)
|
|||||||
src/engine/core/EngineContext.h
|
src/engine/core/EngineContext.h
|
||||||
src/engine/core/gui/uiMain/UiConfig.h
|
src/engine/core/gui/uiMain/UiConfig.h
|
||||||
src/engine/renderer/RenderContext.h
|
src/engine/renderer/RenderContext.h
|
||||||
|
src/game/scenes/MainGame.cpp
|
||||||
|
src/game/scenes/MainGame.h
|
||||||
)
|
)
|
||||||
target_compile_options(Dicewars_Siedler PRIVATE
|
target_compile_options(Dicewars_Siedler PRIVATE
|
||||||
-Wall
|
-Wall
|
||||||
|
|||||||
@ -45,6 +45,8 @@ void SceneManager::update() {
|
|||||||
|
|
||||||
void SceneManager::render() {
|
void SceneManager::render() {
|
||||||
if (currentScene) {
|
if (currentScene) {
|
||||||
|
glClearColor(0.3254901961, 0.6431372549, 0.9254901961f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Todo: Refactor to a general renderer
|
||||||
currentScene->onRender();
|
currentScene->onRender();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
void MasterRenderer::render(const Light &light, const Camera &camera) {
|
void MasterRenderer::render(const Light &light, const Camera &camera) {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glClearColor(0.3254901961, 0.6431372549, 0.9254901961f, 1.0f);
|
glClearColor(0.3254901961, 0.6431372549, 0.9254901961f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Todo: Refactor to a general renderer
|
||||||
|
|
||||||
entityRenderer->prepare(camera, light, projectionMatrix);
|
entityRenderer->prepare(camera, light, projectionMatrix);
|
||||||
entityRenderer->renderEntities(entities);
|
entityRenderer->renderEntities(entities);
|
||||||
|
|||||||
@ -61,16 +61,6 @@ void GameLayer::onAttach()
|
|||||||
//printf("Generated Terrain with %lu Tiles!\n", map->tiles.size());
|
//printf("Generated Terrain with %lu Tiles!\n", map->tiles.size());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AssetManager::loadAsset("assets/buildings/stone_mason/stone_mason.json", loader);
|
|
||||||
AssetManager::loadAsset("assets/buildings/forest_hut/cabin.json", loader);
|
|
||||||
AssetManager::loadAsset("assets/buildings/forest_hut/level2/cabin.json", loader);
|
|
||||||
|
|
||||||
auto modelTexture = AssetManager::loadTexture("warning", "assets/worldIcons/warning.png", loader);
|
|
||||||
AssetManager::loadTexture("error", "assets/worldIcons/error.png", loader);
|
|
||||||
AssetManager::loadTexture("upgrade", "assets/worldIcons/up-arrow.png", loader);
|
|
||||||
|
|
||||||
|
|
||||||
EventBus::getInstance().subscribe<TurnChangedEvent>([this](const TurnChangedEvent& event) {
|
EventBus::getInstance().subscribe<TurnChangedEvent>([this](const TurnChangedEvent& event) {
|
||||||
ProducingSystem::onTurnEnded(*entityManager);
|
ProducingSystem::onTurnEnded(*entityManager);
|
||||||
});
|
});
|
||||||
|
|||||||
40
src/game/scenes/MainGame.cpp
Normal file
40
src/game/scenes/MainGame.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// Created by sebastian on 01.07.26.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MainGame.h"
|
||||||
|
|
||||||
|
#include "../GameLayer.h"
|
||||||
|
#include "../UILayer.h"
|
||||||
|
|
||||||
|
|
||||||
|
void MainGame::onEnter(EngineContext &ctx) {
|
||||||
|
gameMode=std::make_shared<GameMode>();
|
||||||
|
|
||||||
|
auto gameLayer = std::make_unique<GameLayer>();
|
||||||
|
gameLayer->setGameMode(gameMode);
|
||||||
|
addLayer(std::move(gameLayer));
|
||||||
|
|
||||||
|
auto uiLayer = std::make_unique<UILayer>();
|
||||||
|
uiLayer->setGameMode(gameMode);
|
||||||
|
addLayer(std::move(uiLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainGame::onExit() {
|
||||||
|
Scene::onExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<AssetRequest> MainGame::getRequiredAssets() {
|
||||||
|
std::vector<AssetRequest> requests;
|
||||||
|
// requests.emplace_back(ModelRequest("lowPolyTree", "assets/trees/lowPolyTree.obj"));
|
||||||
|
// requests.emplace_back(ModelRequest("lowPolyTree2", "assets/trees/tree.obj"));
|
||||||
|
|
||||||
|
requests.emplace_back(StagedModelRequest("stone_mason", "assets/buildings/stone_mason/stone_mason.json"));
|
||||||
|
requests.emplace_back(StagedModelRequest("cabin", "assets/buildings/forest_hit/cabin.json"));
|
||||||
|
requests.emplace_back(StagedModelRequest("cabin_l2", "assets/buildings/forest_hut/cabin.json"));
|
||||||
|
|
||||||
|
requests.emplace_back(TextureRequest("warning", "assets/worldIcons/warning.png"));
|
||||||
|
requests.emplace_back(TextureRequest("error", "assets/worldIcons/error.png"));
|
||||||
|
requests.emplace_back(TextureRequest("upgrade", "assets/worldIcons/up-arrow.png"));
|
||||||
|
return requests;
|
||||||
|
}
|
||||||
22
src/game/scenes/MainGame.h
Normal file
22
src/game/scenes/MainGame.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// Created by sebastian on 01.07.26.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DICEWARS_SIEDLER_MAINGAME_H
|
||||||
|
#define DICEWARS_SIEDLER_MAINGAME_H
|
||||||
|
|
||||||
|
#include "../../engine/core/scenes/Scene.h"
|
||||||
|
|
||||||
|
class MainGame : public Scene {
|
||||||
|
public:
|
||||||
|
void onEnter(EngineContext &ctx) override;
|
||||||
|
|
||||||
|
void onExit() override;
|
||||||
|
|
||||||
|
std::vector<AssetRequest> getRequiredAssets() override;
|
||||||
|
private:
|
||||||
|
std::shared_ptr<GameMode> gameMode;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //DICEWARS_SIEDLER_MAINGAME_H
|
||||||
@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
#include "MainUiLayer.h"
|
#include "MainUiLayer.h"
|
||||||
|
|
||||||
|
#include "../MainGame.h"
|
||||||
#include "../../../engine/core/EngineTime.h"
|
#include "../../../engine/core/EngineTime.h"
|
||||||
#include "../../../engine/core/gui/uiComponent/UiButton.h"
|
#include "../../../engine/core/gui/uiComponent/UiButton.h"
|
||||||
|
#include "../../../engine/core/scenes/SceneManager.h"
|
||||||
|
#include "../../../engine/core/scenes/SplashScreen.h"
|
||||||
#include "../../../engine/renderer/loader/AssetManager.h"
|
#include "../../../engine/renderer/loader/AssetManager.h"
|
||||||
#include "events/QuitEvent.h"
|
#include "events/QuitEvent.h"
|
||||||
|
|
||||||
@ -34,9 +37,10 @@ void MainUiLayer::onAttach() {
|
|||||||
*AssetManager::getUiTheme("default")->large, btnStyle2));
|
*AssetManager::getUiTheme("default")->large, btnStyle2));
|
||||||
newGameBtn->addMouseListener([this](const MouseEventData& eventData) {
|
newGameBtn->addMouseListener([this](const MouseEventData& eventData) {
|
||||||
if (eventData.isCompleteClick(MouseButton::LEFT)) {
|
if (eventData.isCompleteClick(MouseButton::LEFT)) {
|
||||||
auto newGameContainer = std::make_unique<UiContainer>();
|
spdlog::info("New Game clicked");
|
||||||
|
Application::getInstance().sceneManager->switchTo(std::make_unique<SplashScreen>(), [this]() {
|
||||||
uiStack->push(std::move(newGameContainer));
|
Application::getInstance().sceneManager->switchTo(std::make_unique<MainGame>());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user