work in progress
This commit is contained in:
50
designer/src/desktop_platform.h
Normal file
50
designer/src/desktop_platform.h
Normal file
@@ -0,0 +1,50 @@
|
||||
// Desktop platform implementation using GLFW + OpenGL 3.3
|
||||
// Note: Graphics context and rendering is handled by RmlUi's backend.
|
||||
// This platform implementation provides file interface and utilities.
|
||||
#pragma once
|
||||
|
||||
#include "platform.h"
|
||||
#include "file_interface.h"
|
||||
#include <memory>
|
||||
|
||||
namespace mosis::desktop {
|
||||
|
||||
class DesktopPlatform : public IPlatform {
|
||||
uint32_t m_width = 540;
|
||||
uint32_t m_height = 960;
|
||||
std::unique_ptr<DesktopFileInterface> m_file_interface;
|
||||
double m_start_time = 0.0;
|
||||
|
||||
public:
|
||||
DesktopPlatform();
|
||||
~DesktopPlatform() override;
|
||||
|
||||
// Initialize the platform
|
||||
bool Initialize(uint32_t width, uint32_t height, const char* title);
|
||||
void Shutdown();
|
||||
|
||||
// IPlatform implementation
|
||||
std::unique_ptr<IGraphicsContext> CreateGraphicsContext() override;
|
||||
std::unique_ptr<IRenderTarget> CreateRenderTarget(uint32_t width, uint32_t height) override;
|
||||
IFileInterface& GetFileInterface() override;
|
||||
|
||||
void Log(const std::string& message) override;
|
||||
void LogError(const std::string& message) override;
|
||||
|
||||
bool PollEvents() override;
|
||||
void SwapBuffers() override;
|
||||
bool ShouldClose() const override;
|
||||
|
||||
uint32_t GetWidth() const override { return m_width; }
|
||||
uint32_t GetHeight() const override { return m_height; }
|
||||
void SetResolution(uint32_t width, uint32_t height) override;
|
||||
float GetDpiScale() const override;
|
||||
|
||||
double GetElapsedTime() const override;
|
||||
|
||||
// Input state (delegated to RmlUi backend)
|
||||
bool IsMouseButtonDown() const;
|
||||
void GetMousePosition(double& x, double& y) const;
|
||||
};
|
||||
|
||||
} // namespace mosis::desktop
|
||||
Reference in New Issue
Block a user