🎉 begin project
This commit is contained in:
commit
8da6ddc689
29 changed files with 1261 additions and 0 deletions
54
Source/Core/Window.cppm
Normal file
54
Source/Core/Window.cppm
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue