Files
Chocolate/src/Chocolate.h

73 lines
2.0 KiB
C
Raw Normal View History

2026-01-10 23:04:53 -06:00
#ifndef CHOCOLATE_CHOCOLATE_H
#define CHOCOLATE_CHOCOLATE_H
#include <Magnum/Math/Time.h>
#include <Magnum/GL/Mesh.h>
#include <Magnum/Platform/Sdl2Application.h>
#include <Magnum/SceneGraph/Drawable.h>
#include <Magnum/SceneGraph/Scene.h>
#include <Magnum/Shaders/PhongGL.h>
#include <Magnum/ImGuiIntegration/Context.hpp>
#include "Camera.h"
#include "Materials.h"
#include "UI.h"
using namespace Magnum;
using namespace Math::Literals;
class Chocolate: public Platform::Application {
public:
virtual ~Chocolate() = default;
explicit Chocolate(const Arguments& arguments);
private:
//SDL 2 events
void drawEvent() override;
void tickEvent() override;
void viewportEvent(ViewportEvent& event) override;
void pointerPressEvent(PointerEvent& event) override;
void pointerReleaseEvent(PointerEvent& event) override;
void pointerMoveEvent(PointerMoveEvent& event) override;
void keyPressEvent(KeyEvent& event) override;
void keyReleaseEvent(KeyEvent& event) override;
void textInputEvent(TextInputEvent& event) override;
// Render
void RenderToFramebuffer(GL::Framebuffer& framebuffer);
// UI
void DrawUI();
void ResizeUI(Vector2i windowSize);
//Systems
void UpdateMagnumObjects();
// Callbacks
void Import(const std::string& file);
void EntitySelected(entt::entity entity);
//Scene
Scene3D _scene;
SceneGraph::DrawableGroup3D _drawables;
Camera _camera;
// Resources
std::vector<std::unique_ptr<GL::Mesh>> _meshes;
std::vector<std::unique_ptr<GL::Texture2D>> _textures;
std::unordered_map<std::string, PhongMaterialConfig> _materials;
Shaders::PhongGL _phongShader;
entt::registry _registry;
ImGuiIntegration::Context _imgui{NoCreate};
float _sidebarWidth = 0.17f;
std::vector<UI::Component*> _uiComponents;
UI::RenderWindow _uiSceneRenderer;
UI::EntityListPanel _uiEntityListPanel;
UI::EntityEditorWindow _uiEntityEditorWindow;
};
#endif //CHOCOLATE_CHOCOLATE_H