Compare commits
2 Commits
4072e49b32
...
24252896c7
| Author | SHA1 | Date | |
|---|---|---|---|
|
24252896c7
|
|||
|
4c0078a5f2
|
15
include/td/display/state/MainMenuState.h
Normal file
15
include/td/display/state/MainMenuState.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <td/display/DisplayState.h>
|
||||||
|
|
||||||
|
namespace td {
|
||||||
|
|
||||||
|
class MainMenuState : public DisplayState {
|
||||||
|
public:
|
||||||
|
MainMenuState(Display& a_Display);
|
||||||
|
~MainMenuState();
|
||||||
|
|
||||||
|
virtual void Update(float a_Delta) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace td
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <td/display/state/DebugWorldState.h>
|
#include <td/display/state/MainMenuState.h>
|
||||||
|
|
||||||
float GetDelta() {
|
float GetDelta() {
|
||||||
static std::chrono::time_point<std::chrono::system_clock> m_LastTime = std::chrono::system_clock::now();
|
static std::chrono::time_point<std::chrono::system_clock> m_LastTime = std::chrono::system_clock::now();
|
||||||
@@ -13,7 +13,7 @@ int main(int argc, char** argv) {
|
|||||||
// init GL context
|
// init GL context
|
||||||
td::Display display(1920, 1080, "Tower-Defense 2");
|
td::Display display(1920, 1080, "Tower-Defense 2");
|
||||||
|
|
||||||
display.ChangeState<td::DebugWorldState>();
|
display.ChangeState<td::MainMenuState>();
|
||||||
|
|
||||||
while (!display.IsCloseRequested()) {
|
while (!display.IsCloseRequested()) {
|
||||||
display.PollEvents();
|
display.PollEvents();
|
||||||
|
|||||||
18
src/td/display/state/MainMenuState.cpp
Normal file
18
src/td/display/state/MainMenuState.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <td/display/state/MainMenuState.h>
|
||||||
|
|
||||||
|
#include <td/display/state/DebugWorldState.h>
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
|
namespace td {
|
||||||
|
|
||||||
|
MainMenuState::MainMenuState(Display& a_Display) : DisplayState(a_Display) {}
|
||||||
|
MainMenuState::~MainMenuState() {}
|
||||||
|
|
||||||
|
void MainMenuState::Update(float a_Delta) {
|
||||||
|
ImGui::Begin("MainWindow");
|
||||||
|
if(ImGui::Button("Start debug world"))
|
||||||
|
m_StateMachine.ChangeState<DebugWorldState>();
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace td
|
||||||
@@ -3,8 +3,7 @@ add_rules("mode.debug", "mode.release")
|
|||||||
add_repositories("persson-repo https://git.ale-pri.com/Persson-dev/xmake-repo.git")
|
add_repositories("persson-repo https://git.ale-pri.com/Persson-dev/xmake-repo.git")
|
||||||
|
|
||||||
add_requires("imgui 1.92.0", {configs = {sdl3 = true, opengl3 = true}})
|
add_requires("imgui 1.92.0", {configs = {sdl3 = true, opengl3 = true}})
|
||||||
add_requires("splib 2.3.0", "zlib")
|
add_requires("libsdl3 3.2.16", "splib 2.3.0", "zlib", "glew", "fpm", "enet6")
|
||||||
add_requires("libsdl3 3.2.16", "glew", "fpm", "enet6")
|
|
||||||
|
|
||||||
set_languages("c++17")
|
set_languages("c++17")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user