window
window
¶
Window queries and control.
setTitle ¶
proc setTitle(nim2d: Nim2d; title: string)
getWidth ¶
proc getWidth(nim2d: Nim2d): int32
The width of the drawable area in pixels.
Parameters
-
nim2d(Nim2d)
Returns
int32
getHeight ¶
proc getHeight(nim2d: Nim2d): int32
The height of the drawable area in pixels.
Parameters
-
nim2d(Nim2d)
Returns
int32
getSize ¶
proc getSize(nim2d: Nim2d): tuple[w, h: int32]
The size of the drawable area in pixels.
Parameters
-
nim2d(Nim2d)
Returns
tuple[w, h: int32]
setSize ¶
proc setSize(nim2d: Nim2d; width, height: int32)
Resize the window, and the size the engine draws with.
Parameters
-
nim2d(Nim2d) -
width(int32) -
height(int32)
setResizable ¶
proc setResizable(nim2d: Nim2d; resizable: bool)
Allow or stop the user resizing the window.
Parameters
-
nim2d(Nim2d) -
resizable(bool)
setFullscreen ¶
proc setFullscreen(nim2d: Nim2d; fullscreen: bool)
Switch between fullscreen and windowed.
Parameters
-
nim2d(Nim2d) -
fullscreen(bool)
isFullscreen ¶
proc isFullscreen(nim2d: Nim2d): bool
Whether the window is fullscreen.
Parameters
-
nim2d(Nim2d)
Returns
bool
minimize ¶
proc minimize(nim2d: Nim2d)
Minimize the window to the taskbar or dock.
Parameters
-
nim2d(Nim2d)
maximize ¶
proc maximize(nim2d: Nim2d)
restore ¶
proc restore(nim2d: Nim2d)
Restore a minimized or maximized window to its previous size.
Parameters
-
nim2d(Nim2d)
getDesktopDimensions ¶
proc getDesktopDimensions(): tuple[w, h: int32]
The desktop resolution of the primary display.
Returns
tuple[w, h: int32]
setIcon ¶
proc setIcon(nim2d: Nim2d; data: ImageData)
Set the window icon from an ImageData.
Parameters
-
nim2d(Nim2d) -
data(ImageData)
showMessageBox ¶
proc showMessageBox(nim2d: Nim2d; title, message: string)
Show a simple information message box, blocking until it is dismissed.
Parameters
-
nim2d(Nim2d) -
title(string) -
message(string)
setVSync ¶
proc setVSync(nim2d: Nim2d; on: bool)
Turn vertical sync on or off. With it off the frame rate is uncapped, which
is handy for benchmarking. Vsync is always available; if the immediate mode the off state wants is not supported, vsync stays on.
Parameters
-
nim2d(Nim2d) -
on(bool)
getDPIScale ¶
proc getDPIScale(nim2d: Nim2d): float
The ratio of backing pixels to window points. It is 1.0 on a normal display
or when high-DPI is off, and 2.0 on a 2x display with high-DPI enabled.
Parameters
-
nim2d(Nim2d)
Returns
float