Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
Window System

Description

Creating, modifying and destroying OS windows.

Classes

struct  tz::os::window_info
 Basic customisation of a newly-opened window. More...
 

Function Documentation

◆ open_window()

tz::error_code tz::os::open_window ( window_info winfo = {})

Open a new window.

Returns
- error_code::precondition_failure if you have not yet initialised the engine via tz::initialise.
- error_code::unknown_error if window creation fails for some other reason.
- error_code::partial_success if you opted into window_flags::transparent but your platform/machine does not support it.

Only one window can be open at a time - If you have called this function before but have not since closed the previous window, it will automatically be closed.

◆ close_window()

tz::error_code tz::os::close_window ( )

Close a previously-opened window.

Returns
- error_code::precondition_failure if you have not yet initialised the engine via tz::initialise.
- error_code::precondition_failure if you have not previously opened a window via open_window.
- error_code::unknown_error if window destruction fails for some other reason.

Only one window can be open at a time - If you have called this function before but have not since closed the previous window, it will automatically be closed.

◆ window_is_open()

bool tz::os::window_is_open ( )

Query as to whether a window has been opened that has not yet been closed.

Returns
True if an open window is available, false otherwise.

◆ window_update()

void tz::os::window_update ( )

Poll updates for a window, advancing input events etc.

If an open window does not exist, this function safely does nothing.

◆ get_window_handle()

window_handle tz::os::get_window_handle ( )

Retrieve a opaque handle corresponding to the underlying window native.

  • If you have not previously opened a window, i.e window_is_open() returns false - then this will return nullhand.
  • If you are on windows, you can convert this to a HWND via (HWND)(uintptr_t)handle.peek()
  • TODO: what do on linux?

◆ window_get_width()

unsigned int tz::os::window_get_width ( )

Retrieve the width of the window, in pixels.

Note
If a window is not open, nothing happens.

See window_set_dimensions to programatically resize the window.

◆ window_get_height()

unsigned int tz::os::window_get_height ( )

Retrieve the height of the window, in pixels.

Note
If a window is not open, nothing happens.

See window_set_dimensions to programatically resize the window.

◆ window_set_dimensions()

void tz::os::window_set_dimensions ( unsigned int width,
unsigned int height )

Set a new width and height for the open window.

Note
If a window is not open, nothing happens.

◆ window_get_title()

std::string tz::os::window_get_title ( )

Retrieve the title of the window.

Note
If a window is not open, an empty string is returned.

◆ window_set_title()

void tz::os::window_set_title ( std::string_view title)

Set a new title for the open window.

Note
If a window is not open, nothing happens.

◆ window_maximise()

void tz::os::window_maximise ( )

Maximise the window, causing it to cover the whole screen.

Note
If a window is not open, nothing happens.

◆ window_minimise()

void tz::os::window_minimise ( )

Minimise the window, causing it to no longer be visible until maximised/shown.

Note
If a window is not open, nothing happens.

◆ window_show()

void tz::os::window_show ( )

Show the window as normal, even if it is currently maximised/minimised/fullscreen.

Note
If a window is not open, nothing happens.

◆ window_fullscreen()

void tz::os::window_fullscreen ( )

Display the window in proper fullscreen.

Note
If a window is not open, nothing happens.

Enumeration Type Documentation

◆ window_flags

Optional behaviours/attributes when opening windows.

Enumerator
centered_window 

Ignore the x and y coordinates provided within window_info and position the window approximately in the middle of the screen instead.

maximised 

Ignore the width and height provided within window_info and set set the window as maximised instead.

transparent 

When a pixel of the window's framebuffer is never drawn to, instead of being a clamped colour it is instead fully transparent. Your mileage may vary, depending on your platform.

invisible 

When the window is "opened", it is completely invisible to the user. They won't see the window, nor will it be visible in the OS' taskbar.