54 lines
No EOL
1.3 KiB
C++
54 lines
No EOL
1.3 KiB
C++
module;
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "../PlatformDetection.h"
|
|
|
|
export module VUI:Window;
|
|
|
|
import :Ref;
|
|
import :Geometry;
|
|
import :Input;
|
|
|
|
namespace VUI {
|
|
struct WindowManager;
|
|
std::uint64_t s_Handle = 0;
|
|
|
|
export struct WindowSpecification {
|
|
uint32_t width{1280};
|
|
uint32_t height{720};
|
|
std::string title{"vui"};
|
|
};
|
|
|
|
export struct Window : RefCounted {
|
|
virtual void pullEvents() = 0;
|
|
virtual void close() = 0;
|
|
|
|
virtual void resize(uint32_t width, uint32_t height) = 0;
|
|
virtual void updateTitle(const std::string &title) = 0;
|
|
|
|
bool isOpen() const { return m_IsOpen; }
|
|
[[nodiscard]] uint32_t getWidth() const { return m_Specification.width; }
|
|
[[nodiscard]] uint32_t getHeight() const { return m_Specification.height; }
|
|
[[nodiscard]] std::string getTitle() const { return m_Specification.title; }
|
|
[[nodiscard]] uint64_t getHandle() const { return m_WindowHandle; }
|
|
|
|
protected:
|
|
static void UpdateKey(uint32_t key, bool isDown);
|
|
virtual void createWindow() = 0;
|
|
bool m_IsOpen{false};
|
|
std::uint64_t m_WindowHandle{0};
|
|
WindowSpecification m_Specification{};
|
|
|
|
UPoint m_WindowPosition{};
|
|
|
|
Window() = default;
|
|
friend Ref;
|
|
friend WindowManager;
|
|
};
|
|
|
|
void Window::UpdateKey(const uint32_t key, const bool isDown) {
|
|
Input::UpdateKey(key, isDown);
|
|
}
|
|
} // namespace VUI
|