work in progress
This commit is contained in:
89
designer/src/desktop_platform.cpp
Normal file
89
designer/src/desktop_platform.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
// Desktop platform implementation (simplified - uses RmlUi backend for graphics)
|
||||
#include "desktop_platform.h"
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
// Note: Graphics context and rendering is handled by RmlUi's backend.
|
||||
// This platform implementation provides additional utilities and state management.
|
||||
|
||||
namespace mosis::desktop {
|
||||
|
||||
DesktopPlatform::DesktopPlatform()
|
||||
: m_file_interface(std::make_unique<DesktopFileInterface>())
|
||||
{
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
m_start_time = std::chrono::duration<double>(now.time_since_epoch()).count();
|
||||
}
|
||||
|
||||
DesktopPlatform::~DesktopPlatform() = default;
|
||||
|
||||
bool DesktopPlatform::Initialize(uint32_t width, uint32_t height, const char* title) {
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
// Graphics initialization is done by RmlUi Backend
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesktopPlatform::Shutdown() {
|
||||
// Graphics shutdown is done by RmlUi Backend
|
||||
}
|
||||
|
||||
std::unique_ptr<IGraphicsContext> DesktopPlatform::CreateGraphicsContext() {
|
||||
// Graphics context is managed by RmlUi Backend
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<IRenderTarget> DesktopPlatform::CreateRenderTarget(uint32_t width, uint32_t height) {
|
||||
// Render targets are managed by RmlUi Backend
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IFileInterface& DesktopPlatform::GetFileInterface() {
|
||||
return *m_file_interface;
|
||||
}
|
||||
|
||||
void DesktopPlatform::Log(const std::string& message) {
|
||||
std::cout << "[INFO] " << message << std::endl;
|
||||
}
|
||||
|
||||
void DesktopPlatform::LogError(const std::string& message) {
|
||||
std::cerr << "[ERROR] " << message << std::endl;
|
||||
}
|
||||
|
||||
bool DesktopPlatform::PollEvents() {
|
||||
// Events are handled by RmlUi Backend
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesktopPlatform::SwapBuffers() {
|
||||
// Swap is handled by RmlUi Backend
|
||||
}
|
||||
|
||||
bool DesktopPlatform::ShouldClose() const {
|
||||
return false; // Determined by RmlUi Backend
|
||||
}
|
||||
|
||||
void DesktopPlatform::SetResolution(uint32_t width, uint32_t height) {
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
float DesktopPlatform::GetDpiScale() const {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
double DesktopPlatform::GetElapsedTime() const {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
double current = std::chrono::duration<double>(now.time_since_epoch()).count();
|
||||
return current - m_start_time;
|
||||
}
|
||||
|
||||
bool DesktopPlatform::IsMouseButtonDown() const {
|
||||
return false; // Input is handled through RmlUi
|
||||
}
|
||||
|
||||
void DesktopPlatform::GetMousePosition(double& x, double& y) const {
|
||||
x = y = 0; // Input is handled through RmlUi
|
||||
}
|
||||
|
||||
} // namespace mosis::desktop
|
||||
Reference in New Issue
Block a user