Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
bicameral::Window Class Reference

#include <window.h>

Public Types

using MessageHook = std::function<bool(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)>

Public Member Functions

 ~Window ()
 Window (const Window &)=delete
Window & operator= (const Window &)=delete
 Window (Window &&)=delete
Window & operator= (Window &&)=delete
bool PumpMessages ()
HWND Handle () const
uint32_t ClientWidth () const
uint32_t ClientHeight () const
bool IsMinimized () const
bool TakeResized ()
std::vector< InputEvent > TakeInputEvents ()
void SetMessageHook (MessageHook hook)

Static Public Member Functions

static std::expected< std::unique_ptr< Window >, std::string > Create (std::wstring_view title, uint32_t clientWidth, uint32_t clientHeight)

Private Member Functions

 Window ()=default
LRESULT HandleMessage (UINT message, WPARAM wParam, LPARAM lParam)
void AddButton (InputKind kind, PointerButton button, LPARAM lParam)
void AddWheel (WPARAM wParam)

Static Private Member Functions

static LRESULT CALLBACK WindowProcedure (HWND handle, UINT message, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND m_handle = nullptr
MessageHook m_messageHook
uint32_t m_clientWidth = 0
uint32_t m_clientHeight = 0
bool m_resized = false
bool m_closed = false
std::vector< InputEvent > m_inputEvents
int32_t m_wheelRemainder = 0
uint32_t m_heldButtons = 0

Detailed Description

Definition at line 21 of file window.h.

Member Typedef Documentation

◆ MessageHook

using bicameral::Window::MessageHook = std::function<bool(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)>

Definition at line 49 of file window.h.

Constructor & Destructor Documentation

◆ ~Window()

bicameral::Window::~Window ( )

Definition at line 59 of file window.cpp.

References m_handle.

◆ Window() [1/3]

bicameral::Window::Window ( const Window & )
delete

References Window().

Referenced by operator=(), operator=(), Window(), Window(), and WindowProcedure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Window() [2/3]

bicameral::Window::Window ( Window && )
delete

References Window().

Here is the call graph for this function:

◆ Window() [3/3]

bicameral::Window::Window ( )
privatedefault

Referenced by Create().

Here is the caller graph for this function:

Member Function Documentation

◆ AddButton()

void bicameral::Window::AddButton ( InputKind kind,
PointerButton button,
LPARAM lParam )
private

Definition at line 97 of file window.cpp.

References bicameral::ButtonDown, m_handle, m_heldButtons, and m_inputEvents.

Referenced by HandleMessage().

Here is the caller graph for this function:

◆ AddWheel()

void bicameral::Window::AddWheel ( WPARAM wParam)
private

Definition at line 113 of file window.cpp.

References m_inputEvents, m_wheelRemainder, and bicameral::Wheel.

Referenced by HandleMessage().

Here is the caller graph for this function:

◆ ClientHeight()

uint32_t bicameral::Window::ClientHeight ( ) const
inlinenodiscard

Definition at line 38 of file window.h.

References m_clientHeight.

◆ ClientWidth()

uint32_t bicameral::Window::ClientWidth ( ) const
inlinenodiscard

Definition at line 37 of file window.h.

References m_clientWidth.

◆ Create()

std::expected< std::unique_ptr< Window >, std::string > bicameral::Window::Create ( std::wstring_view title,
uint32_t clientWidth,
uint32_t clientHeight )
staticnodiscard

Definition at line 32 of file window.cpp.

References bicameral::DescribeHresult(), Window(), and WindowProcedure().

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::CreateWindowForLoop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Handle()

HWND bicameral::Window::Handle ( ) const
inlinenodiscard

Definition at line 36 of file window.h.

References m_handle.

◆ HandleMessage()

LRESULT bicameral::Window::HandleMessage ( UINT message,
WPARAM wParam,
LPARAM lParam )
private

Definition at line 143 of file window.cpp.

References AddButton(), AddWheel(), bicameral::ButtonDown, bicameral::ButtonUp, bicameral::KeyDown, bicameral::Left, m_clientHeight, m_clientWidth, m_closed, m_handle, m_heldButtons, m_inputEvents, m_messageHook, m_resized, bicameral::Middle, bicameral::PointerMove, and bicameral::Right.

Here is the call graph for this function:

◆ IsMinimized()

bool bicameral::Window::IsMinimized ( ) const
inlinenodiscard

Definition at line 39 of file window.h.

References m_clientHeight, and m_clientWidth.

◆ operator=() [1/2]

Window & bicameral::Window::operator= ( const Window & )
delete

References Window().

Here is the call graph for this function:

◆ operator=() [2/2]

Window & bicameral::Window::operator= ( Window && )
delete

References Window().

Here is the call graph for this function:

◆ PumpMessages()

bool bicameral::Window::PumpMessages ( )

Definition at line 64 of file window.cpp.

References m_closed.

◆ SetMessageHook()

void bicameral::Window::SetMessageHook ( MessageHook hook)
inline

Definition at line 50 of file window.h.

References m_messageHook.

Referenced by bicameral::editor::EditorOverlay::Create().

Here is the caller graph for this function:

◆ TakeInputEvents()

std::vector< InputEvent > bicameral::Window::TakeInputEvents ( )
nodiscard

Definition at line 81 of file window.cpp.

References m_inputEvents.

◆ TakeResized()

bool bicameral::Window::TakeResized ( )
nodiscard

Definition at line 77 of file window.cpp.

References m_resized.

◆ WindowProcedure()

LRESULT CALLBACK bicameral::Window::WindowProcedure ( HWND handle,
UINT message,
WPARAM wParam,
LPARAM lParam )
staticprivate

Definition at line 125 of file window.cpp.

References Window().

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_clientHeight

uint32_t bicameral::Window::m_clientHeight = 0
private

Definition at line 68 of file window.h.

Referenced by ClientHeight(), HandleMessage(), and IsMinimized().

◆ m_clientWidth

uint32_t bicameral::Window::m_clientWidth = 0
private

Definition at line 67 of file window.h.

Referenced by ClientWidth(), HandleMessage(), and IsMinimized().

◆ m_closed

bool bicameral::Window::m_closed = false
private

Definition at line 70 of file window.h.

Referenced by HandleMessage(), and PumpMessages().

◆ m_handle

HWND bicameral::Window::m_handle = nullptr
private

Definition at line 63 of file window.h.

Referenced by AddButton(), Handle(), HandleMessage(), and ~Window().

◆ m_heldButtons

uint32_t bicameral::Window::m_heldButtons = 0
private

Definition at line 75 of file window.h.

Referenced by AddButton(), and HandleMessage().

◆ m_inputEvents

std::vector<InputEvent> bicameral::Window::m_inputEvents
private

Definition at line 73 of file window.h.

Referenced by AddButton(), AddWheel(), HandleMessage(), and TakeInputEvents().

◆ m_messageHook

MessageHook bicameral::Window::m_messageHook
private

Definition at line 64 of file window.h.

Referenced by HandleMessage(), and SetMessageHook().

◆ m_resized

bool bicameral::Window::m_resized = false
private

Definition at line 69 of file window.h.

Referenced by HandleMessage(), and TakeResized().

◆ m_wheelRemainder

int32_t bicameral::Window::m_wheelRemainder = 0
private

Definition at line 74 of file window.h.

Referenced by AddWheel().


The documentation for this class was generated from the following files: