- Moved core components such as `Controller` and `Window` from `src/app/core/` to `src/app/` and `src/app/platform/`, respectively, to improve modularity and clarity. - Updated include paths across the codebase to reflect the new locations of these components. - Introduced a new foundational core library in `src/core/` for project management and ROM patching logic, enhancing the separation of concerns. - Adjusted CMake configurations to ensure proper compilation of the new core library and updated dependencies in various modules. Benefits: - Streamlines the application structure, making it easier to navigate and maintain. - Enhances code organization by clearly delineating core functionalities from application-specific logic. - Improves overall architecture by promoting a clearer separation of concerns between different components.
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#ifndef YAZE_APP_CORE_CONTROLLER_H
|
|
#define YAZE_APP_CORE_CONTROLLER_H
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "absl/status/status.h"
|
|
#include "app/platform/window.h"
|
|
#include "app/rom.h"
|
|
#include "app/editor/editor_manager.h"
|
|
#include "app/gfx/backend/irenderer.h"
|
|
|
|
int main(int argc, char** argv);
|
|
|
|
namespace yaze {
|
|
|
|
/**
|
|
* @brief Main controller for the application.
|
|
*
|
|
* This class is responsible for managing the main window and the
|
|
* main editor. It is the main entry point for the application.
|
|
*/
|
|
class Controller {
|
|
public:
|
|
bool IsActive() const { return active_; }
|
|
absl::Status OnEntry(std::string filename = "");
|
|
void OnInput();
|
|
absl::Status OnLoad();
|
|
void DoRender() const;
|
|
void OnExit();
|
|
|
|
// Set startup editor and cards from command-line flags
|
|
void SetStartupEditor(const std::string& editor_name, const std::string& cards);
|
|
|
|
auto window() -> SDL_Window* { return window_.window_.get(); }
|
|
void set_active(bool active) { active_ = active; }
|
|
auto active() const { return active_; }
|
|
auto overworld() -> yaze::zelda3::Overworld* {
|
|
return editor_manager_.overworld();
|
|
}
|
|
auto GetCurrentRom() -> Rom* { return editor_manager_.GetCurrentRom(); }
|
|
auto renderer() -> gfx::IRenderer* { return renderer_.get(); }
|
|
|
|
private:
|
|
friend int ::main(int argc, char** argv);
|
|
|
|
bool active_ = false;
|
|
core::Window window_;
|
|
editor::EditorManager editor_manager_;
|
|
std::unique_ptr<gfx::IRenderer> renderer_;
|
|
};
|
|
|
|
} // namespace yaze
|
|
|
|
#endif // YAZE_APP_CORE_CONTROLLER_H
|