add imgui support
This commit is contained in:
@@ -22,6 +22,10 @@ class ClientApp : public Nz::ApplicationComponent {
|
||||
|
||||
void Update(Nz::Time elapsedTime) override;
|
||||
|
||||
Nz::Window* GetWindow() {
|
||||
return m_Window;
|
||||
}
|
||||
|
||||
private:
|
||||
Nz::Window* m_Window;
|
||||
std::unique_ptr<Nz::StateMachine> m_StateMachine;
|
||||
|
||||
33
include/client/ImGuiAppComponent.h
Normal file
33
include/client/ImGuiAppComponent.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <Nazara/Core/ApplicationComponent.hpp>
|
||||
|
||||
namespace Nz {
|
||||
|
||||
class Window;
|
||||
class Texture;
|
||||
|
||||
} // namespace Nz
|
||||
|
||||
namespace blitz {
|
||||
namespace client {
|
||||
|
||||
class StateData;
|
||||
|
||||
class ImGuiAppComponent : public Nz::ApplicationComponent {
|
||||
public:
|
||||
ImGuiAppComponent(Nz::ApplicationBase& app, Nz::Window& a_Window);
|
||||
~ImGuiAppComponent();
|
||||
|
||||
void Update(Nz::Time elapsedTime) override;
|
||||
|
||||
private:
|
||||
Nz::Window& m_Window;
|
||||
std::shared_ptr<Nz::Texture> m_FontTexture;
|
||||
|
||||
void SetStyle();
|
||||
void UpdateFontTexture();
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
} // namespace blitz
|
||||
17
include/client/states/ImGuiDrawer.h
Normal file
17
include/client/states/ImGuiDrawer.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <NazaraImgui/ImguiHandler.hpp>
|
||||
|
||||
namespace blitz {
|
||||
namespace client {
|
||||
|
||||
class ImGuiDrawer : private Nz::ImguiHandler {
|
||||
protected:
|
||||
ImGuiDrawer();
|
||||
~ImGuiDrawer();
|
||||
|
||||
virtual void OnRenderImgui() = 0;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
} // namespace blitz
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
#include <Nazara/Widgets/ButtonWidget.hpp>
|
||||
#include <client/states/AbstractState.h>
|
||||
#include <client/states/ImGuiDrawer.h>
|
||||
|
||||
namespace blitz {
|
||||
namespace client {
|
||||
|
||||
class MainMenuState : public AbstractState {
|
||||
class MainMenuState : public AbstractState, private ImGuiDrawer {
|
||||
public:
|
||||
MainMenuState(std::shared_ptr<StateData>);
|
||||
~MainMenuState();
|
||||
@@ -21,6 +22,8 @@ class MainMenuState : public AbstractState {
|
||||
void LayoutWidgets() override;
|
||||
bool Update(Nz::StateMachine& fsm, Nz::Time elapsedTime) override;
|
||||
|
||||
void OnRenderImgui() override;
|
||||
|
||||
void OnJoinServerPressed();
|
||||
void OnCreateServerPressed();
|
||||
void OnOptionPressed();
|
||||
|
||||
Reference in New Issue
Block a user