Files
yaze/src/Application/Core/controller.h

55 lines
1.3 KiB
C++

#ifndef YAZE_APPLICATION_CORE_CONTROLLER_H
#define YAZE_APPLICATION_CORE_CONTROLLER_H
#define SDL_MAIN_HANDLED
#include <SDL2/SDL.h>
#include <imgui/backends/imgui_impl_sdl.h>
#include <imgui/backends/imgui_impl_sdlrenderer.h>
#include <imgui/imgui.h>
#include <imgui/imgui_internal.h>
#include "Editor/editor.h"
#include "Graphics/icons.h"
#include "Graphics/style.h"
int main(int argc, char **argv);
namespace yaze {
namespace Application {
namespace Core {
class Controller {
public:
Controller() = default;
bool isActive() const;
void onEntry();
void onInput();
void onLoad();
void doRender();
void onExit();
private:
void CreateWindow();
void CreateRenderer();
void CreateGuiContext();
inline void quit() { active_ = false; }
friend int ::main(int argc, char **argv);
struct sdl_deleter {
void operator()(SDL_Window *p) const { SDL_DestroyWindow(p); }
void operator()(SDL_Renderer *p) const { SDL_DestroyRenderer(p); }
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
};
bool active_;
Editor::Editor editor_;
std::shared_ptr<SDL_Window> sdl_window_;
std::shared_ptr<SDL_Renderer> sdl_renderer_;
};
} // namespace Core
} // namespace Application
} // namespace yaze
#endif // YAZE_APPLICATION_CORE_CONTROLLER_H