Window Management
- Function OpenWindow(title$, w, h, fullscreen, vsync)
Opens a graphics window Returns true if window was opened and false if a window could not be opened.
See also
- Function OpenWindowEx(title$, x, y, w, h, mode, aa, stencil_buffer, vsync)
Opens a graphics window.
Returns true if window was opened and false if a window could not be opened:
- WINDOWPOS_CENTERED can be used to center the window.
- w, h - The size of the window.
- mode - Refer to WindowMode() for values that can be set.
- aa - The level of AntiAliasing.
- A value of 0 means no AntiAliasing which can improve performance.
- If the value selected is not supported then a lower value will be selected internally
- stencil_buffer(true / false) - determines whether stencil buffer will be used for shadows.
- vsync - determines if vsync will be enabled for the window.
See also
- Sub CloseWindow()
Closes the graphics window.
See also
- Sub RaiseWindow()
Places the current window on top of the other windows.
- Sub Update()
-
This is the most important function in a graphics window. It must be called every frame.
It performs a few different operations:
- Renders all graphics.
- Checks for every event on the window.
- Keyboard and Mouse Events
- Joystick Events
- Window Control Events (minimize, maximize, close, etc.)
- Updates the physics simulation for 2D and 3D objects if enabled.
- Makes breakfast if you are hungry.
If you have a window open, you should have this function being called in your main render loop every frame.
- Sub Cls()
Clears the back buffer on the window.
- Sub SetClearColor(c)
See also
Sets the color that a canvas is cleared to on ClearCanvas().
- Sub ShowWindow()
Sets the window visible.
- Sub HideWindow()
Sets the window invisible.
See also
- Sub SetWindowTitle(title$)
Sets the title of the window.
- Function WindowTitle$( )
Returns the window title.
See also
- Sub SetWindowPosition(x, y)
Sets the position of the window on the display.
- Sub GetWindowPosition(byref x, byref y)
Gets the window position.
- Sub SetWindowSize(w, h)
Sets the size of a window.
- Sub GetWindowSize(byref w, byref h)
Gets the size of the window.
- Sub SetWindowMinSize(w, h)
Sets the min size for a resizable window.
- Sub GetWindowMinSize(byref w, byref h)
Gets the minimum size of the window.
- Sub SetWindowMaxSize(w, h)
Sets the max size for a resizable window.
- Sub GetWindowMaxSize(byref w, byref h)
Gets the maximum size of a window.
- Function WindowIsFullscreen()
Returns true if the window is fullscreen, otherwise it will return false.
- Function WindowIsVisible()
Returns true if the window is visible, otherwise it returns false.
- Function WindowIsBordered()
Returns true if the window has a border, otherwise it will return false.
- Function WindowIsResizable()
Returns true if the window is resizable, otherwise it will return false.
- Function WindowIsMinimized()
Returns true if the window is minimized, otherwise it will return false.
- Function WindowIsMaximized()
Returns true if the window is maximized, otherwise it will return false.
- Function WindowHasInputFocus()
Returns true if the window has input focus, otherwise it returns false.
- Function WindowHasMouseFocus()
Returns true if the window has mouse focus, otherwise it returns false.
- Sub SetWindowFullscreen(flag)
You will never guess what this does.
- Sub MaximizeWindow()
Maximizes the window.
- Sub MinimizeWindow()
Minimizes the window.
- Sub SetWindowBordered(flag)
Sets whether the window has a border or not.
See also
- Function WindowClip(x, y, w, h)
Returns an image with a portion of the window stored.
See also
- Function WindowExists()
Returns true if the window is open.
- Function WindowEvent_Close()
Returns true if the window close event is called.
- Function WindowEvent_Maximize()
Returns true if the window maximize event is called.
- Function WindowEvent_Minimize()
Returns true if the window minimize event is called.
- Function FPS()
Returns the number of frames being rendered per second.
- Sub SetWindowIcon(img)
Sets the icon that is displayed on the window border.
- Function WindowEvent_Resize()
Returns true if the window resize event is called.
- Sub SetWindowAutoClose(exit_on_close)
Sets whether the close button on the window closes it.
- Sub SetWindowResizable(flag)
Sets whether or not a window is resizable.
- Function WindowMode(visible, fullscreen, resizable, borderless, highDPI)
Returns a bitmask of the combined window flags that can be used in OpenWindow() to set the mode for the window.
Each flag is a boolean that determines whether or not to set that flag in the mask.
Note: For most use cases, one of the following will work.
Window:
mode = WindowMode(1, 0, 0, 0, 0)
Fullscreen:
mode = WindowMode(1, 1, 0, 0, 0)
See also
- Function GetWindowMode()
Returns the flags set on the given window as a bitmask. The mode set with OpenWindow() is part of this mask.
- Sub RestoreWindow()
Restores the window if minimized.
- Sub GrabInput(flag)
Sets whether the currently active window will grab user input.
- Sub SetWindowAlwaysOnTop(flag)
Sets the window as the highest priority on the display.
- Sub SetMouseRelative(flag)
Constrains the mouse to the window.
- Sub SetWindowVSync(flag)
- Function FlashWindow(flag)
Flashes a window to specify an alert.
Returns 0 on success and a negative number on failure.
Possible flag values:
- FLASH_CANCEL
- FLASH_BRIEFLY
- FLASH_UNTIL_FOCUSED
- Function WindowIsGrabbed()
Returns the window that is currently grabbing input. It returns -1 on failure.
- Sub PreUpdate()
Processes physics for sprites and actors.
This is useful if you need to know the post solve positions and rotations prior to drawing them.
See also
- Sub SetFPS(fps_val)