Cursor types

const (
	cursorDefault* = 0		// Default system cursor
	cursorArrow*			// Normal cursor; Arrow cursor
	cursorIBeam*			// 'I' text cursor; I-Beam
	cursorCrosshair*		// '+' cursor; Select region cursor
	cursorFinger*			// Index finger pointing cursor; Click cursor
	cursorSizeEW*			// '<->' cursor; Resize width cursor; Resize horizontally cursor; East-West resize cursor
	cursorSizeNS*			// Resize height cursor; Resize vertically cursor; North-South resize cursor
	cursorSizeNWSE*			// Resize width and height from the right side cursor; Northwest-Southeast resize cursor
	cursorSizeSWNE*			// Resize width and height from the left side cursor; Southwest-Northeast resize cursor
	cursorSizeAll*			// Resize all cursor; Move cursor
	cursorNo*			// '(/)' cursor; Disabled cursor; Disallowed cursor

Window dimensions

var (
	w*, h*: int32

Viewport size

var wp*: th.Vf2

signal OnFrame

var onFrame*: signal.Signal

signal OnDestroy

var onDestroy*: signal.Signal

fn setViewport

fn setViewport*(dm: th.Vf2) {

Sets the dimensions of the viewport. The dimensions are saved in the wp variable.

dm : dimension of the viewport

fn isDpiEnabled

fn isDpiEnabled*(): bool {

Returns true if DPI awareness was enabled

fn getDpiScaleFactor

fn getDpiScaleFactor*(): th.fu {

Returns the DPI scaling of the current window. If dpiAware was not enabled in window setup, this function will return 1.0 (default scaling).

fn setup

fn setup*(title: str = "tophat game", width: int = 400, height: int32 = 400) {

Sets up the engine and opens a window.

fn cycle

fn cycle(delta: real) {

Cycle needs to be called every cycle for the window to work. If the window was closed, it returns false.

fn setFullscreen

fn setFullscreen*(fullscreen: bool) {

Makes window go full screen

fn isFullscreen

fn isFullscreen*(): bool {

Returns true if window is fullscreen

fn getDims

fn getDims*(): th.Vf2 {

Returns dimensions of the window in screen pixels.

fn setTargetFps

fn setTargetFps*(fps: int) {

Sets the fps limit.

fps : amount of fps the limit should be set to

fn setDims

fn setDims*(dm: th.Vf2) {

Sets the dimensions of the window.

dm : the target dimensions in screen pixels

fn setIcon

fn setIcon*(img: image.Image) {

Sets the window icon.

fn showCursor

fn showCursor*(show: bool) {

Show or hide the cursor, linux only.

fn freezeCursor

fn freezeCursor*(freeze: bool) {

Freezes the cursor in place. input.getMouseDelta will still report mouse movements. The cursor will be automatically hidden.

fn setCursor

fn setCursor*(cursor: int) {

Allows you to set the displaying cursor. Refer to the cursors section for available cursors.

fn quit

fn quit*() {

Exits the application. Use this instead of umka's default exit.

fn setClipboard

fn setClipboard*(s: str) {

Puts a string to the system clipboard.

fn getClipboard

fn getClipboard*(): str {

Gets a string from the system clipboard.

fn setViewportOffset

fn setViewportOffset*(s: th.Vf2) {

Sets the offset of the viewport.

fn getViewportOffset

Gets the offset of the viewport (as set by setViewportShift)