carb::simplegui::Viewport

Defined in carb/simplegui/SimpleGuiTypes.h

struct Viewport

The viewports created and managed by simplegui.

The role of the platform back-end is to create the platform/OS windows corresponding to each viewport.

Public Functions

inline Viewport()

Constructor.

inline ~Viewport()

Destructor.

Public Members

uint32_t id

Unique identifier.

ViewportFlags flags

Flags describing this viewport.

Float2 pos

Position of viewport both in simplegui space and in OS desktop/native space.

Float2 size

Size of viewport in pixel.

Float2 workOffsetMin

Work Area: Offset from Pos to top-left corner of Work Area. Generally (0,0) or (0,+main_menu_bar_height). Work Area is Full Area but without menu-bars/status-bars (so WorkArea always fit inside Pos/Size!)

Float2 workOffsetMax

Work Area: Offset from Pos+Size to bottom-right corner of Work Area. Generally (0,0) or (0,-status_bar_height).

float dpiScale

1.0f = 96 DPI = No extra scale

DrawData *drawData

The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame().

uint32_t parentViewportId

(Advanced) 0: no parent. Instruct the platform back-end to setup a parent/child relationship between platform windows.

void *rendererUserData

void* to hold custom data structure for the renderer (e.g. swap chain, frame-buffers etc.)

void *platformUserData

void* to hold custom data structure for the platform (e.g. windowing info, render context)

void *platformHandle

void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GlfwWindow*, SDL_Window*)

void *platformHandleRaw

void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*)

bool platformRequestMove

Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position)

bool platformRequestResize

Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size)

bool platformRequestClose

Platform windows requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4)