backend-infra-engineer: Pre-0.2.2 2024 Q4 snapshot
This commit is contained in:
@@ -2,20 +2,18 @@
|
||||
#define YAZE_APP_CORE_CONTROLLER_H
|
||||
|
||||
#include <SDL.h>
|
||||
#include "imgui/backends/imgui_impl_sdl2.h"
|
||||
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
|
||||
#include "imgui/imconfig.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/imgui_internal.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/master_editor.h"
|
||||
#include "app/editor/utils/editor.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
#include "app/core/utils/file_util.h"
|
||||
#include "app/editor/editor_manager.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "imgui/backends/imgui_impl_sdl2.h"
|
||||
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
|
||||
#include "imgui/imconfig.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
@@ -23,8 +21,6 @@ namespace yaze {
|
||||
namespace app {
|
||||
namespace core {
|
||||
|
||||
enum class Platform { kUnknown, kMacOS, kiOS, kWindows, kLinux };
|
||||
|
||||
/**
|
||||
* @brief Main controller for the application.
|
||||
*
|
||||
@@ -37,45 +33,40 @@ class Controller : public ExperimentFlags {
|
||||
absl::Status OnEntry(std::string filename = "");
|
||||
void OnInput();
|
||||
absl::Status OnLoad();
|
||||
absl::Status OnTestLoad();
|
||||
void DoRender() const;
|
||||
void OnExit();
|
||||
|
||||
absl::Status CreateSDL_Window();
|
||||
absl::Status CreateWindow();
|
||||
absl::Status CreateRenderer();
|
||||
absl::Status CreateGuiContext();
|
||||
absl::Status LoadFontFamilies() const;
|
||||
absl::Status LoadAudioDevice();
|
||||
absl::Status LoadConfigFiles();
|
||||
|
||||
auto master_editor() -> editor::MasterEditor & { return master_editor_; }
|
||||
void SetupScreen(std::string filename = "") {
|
||||
editor_manager_.SetupScreen(filename);
|
||||
}
|
||||
auto editor_manager() -> editor::EditorManager & { return editor_manager_; }
|
||||
auto renderer() -> SDL_Renderer * {
|
||||
return Renderer::GetInstance().renderer();
|
||||
}
|
||||
auto window() -> SDL_Window * { return window_.get(); }
|
||||
void init_test_editor(editor::Editor *editor) { test_editor_ = editor; }
|
||||
void set_active(bool active) { active_ = active; }
|
||||
|
||||
private:
|
||||
struct sdl_deleter {
|
||||
void operator()(SDL_Window *p) const {
|
||||
if (p) {
|
||||
SDL_DestroyWindow(p);
|
||||
}
|
||||
}
|
||||
void operator()(SDL_Renderer *p) const {
|
||||
if (p) {
|
||||
SDL_DestroyRenderer(p);
|
||||
}
|
||||
}
|
||||
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
|
||||
};
|
||||
|
||||
void CloseWindow() { active_ = false; }
|
||||
|
||||
friend int ::main(int argc, char **argv);
|
||||
|
||||
bool active_;
|
||||
Platform platform_;
|
||||
editor::MasterEditor master_editor_;
|
||||
editor::Editor *test_editor_;
|
||||
editor::EditorManager editor_manager_;
|
||||
|
||||
int audio_frequency_ = 48000;
|
||||
int16_t *audio_buffer_;
|
||||
SDL_AudioDeviceID audio_device_;
|
||||
std::shared_ptr<int16_t> audio_buffer_;
|
||||
std::shared_ptr<SDL_Window> window_;
|
||||
std::shared_ptr<SDL_Renderer> renderer_;
|
||||
};
|
||||
|
||||
} // namespace core
|
||||
|
||||
Reference in New Issue
Block a user