44 lines
1005 B
C
44 lines
1005 B
C
// =============================================
|
|
// Aster: window.h
|
|
// Copyright (c) 2020-2024 Anish Bhobe
|
|
// =============================================
|
|
|
|
#pragma once
|
|
|
|
#include "global.h"
|
|
#include <EASTL/fixed_string.h>
|
|
|
|
struct Context;
|
|
|
|
struct Window final
|
|
{
|
|
// fields
|
|
Context *m_Context{};
|
|
|
|
GLFWwindow *m_Window = nullptr;
|
|
vk::SurfaceKHR m_Surface;
|
|
eastl::fixed_string<char, 32> m_Name;
|
|
|
|
// Methods
|
|
[[nodiscard]] bool
|
|
Poll() const noexcept
|
|
{
|
|
glfwPollEvents();
|
|
return !glfwWindowShouldClose(m_Window);
|
|
}
|
|
|
|
void SetWindowSize(const vk::Extent2D &extent) const noexcept;
|
|
void SetWindowSize(u32 width, u32 height) const noexcept;
|
|
[[nodiscard]] vk::Extent2D GetSize() const;
|
|
|
|
// Ctor/Dtor
|
|
Window(cstr title, Context *context, vk::Extent2D extent, b8 isFullScreen = false);
|
|
~Window();
|
|
|
|
// Move
|
|
Window(Window &&other) noexcept;
|
|
Window &operator=(Window &&other) noexcept;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Window);
|
|
};
|