feat: add summon menu
This commit is contained in:
27
include/render/gui/GuiManager.h
Normal file
27
include/render/gui/GuiManager.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class GuiManager {
|
||||
private:
|
||||
std::vector<std::shared_ptr<GuiWidget>> m_Widgets;
|
||||
public:
|
||||
void renderWidgets(){
|
||||
for(auto widget : m_Widgets){
|
||||
widget->render();
|
||||
}
|
||||
}
|
||||
|
||||
void addWidgets(const std::shared_ptr<GuiWidget>& widget){
|
||||
m_Widgets.push_back(std::move(widget));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace td
|
||||
25
include/render/gui/GuiWidget.h
Normal file
25
include/render/gui/GuiWidget.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
namespace td {
|
||||
|
||||
namespace client {
|
||||
class Client;
|
||||
} // namespace client
|
||||
|
||||
namespace gui {
|
||||
|
||||
class GuiWidget {
|
||||
protected:
|
||||
client::Client* m_Client;
|
||||
public:
|
||||
GuiWidget(client::Client* client) {
|
||||
m_Client = client;
|
||||
}
|
||||
|
||||
client::Client* getClient() { return m_Client; }
|
||||
|
||||
virtual void render() = 0;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace td
|
||||
26
include/render/gui/SummonMenu.h
Normal file
26
include/render/gui/SummonMenu.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "GuiWidget.h"
|
||||
|
||||
#include <array>
|
||||
#include "game/Mobs.h"
|
||||
|
||||
namespace td {
|
||||
namespace gui {
|
||||
|
||||
class SummonMenu : public GuiWidget{
|
||||
private:
|
||||
bool m_MenuOpened;
|
||||
int m_ImageWidth = 100;
|
||||
static constexpr int m_MobTypeCount = static_cast<std::size_t>(td::game::MobType::MOB_COUNT);
|
||||
std::array<int, static_cast<std::size_t>(m_MobTypeCount)> m_Values;
|
||||
public:
|
||||
SummonMenu(client::Client* client);
|
||||
|
||||
virtual void render();
|
||||
private:
|
||||
void setSummonMax(int valueIndex);
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace td
|
||||
Reference in New Issue
Block a user