Utility
The Graphics class contains several useful methods and properties that you may want to utilize in your program.
Graphics.Windows=> Returns aList<Window>with all active windows.Graphics.Screens=> Returns aList<Rect>, representing the width and height of all screens.Graphics.Renderers=> Returns aList<Renderer>with all active renderers.Graphics.MaxTextureSize=> Returns aSizerepresenting the GPU texture size limit.Graphics.ScreenExists(int ScreenIndex)=> Returns whether or not there's a screen at the given index.Graphics.GetWidth(int ScreenIndex OR Window w)=> Returns the width of the given screen, or the screen the given window is on.Graphics.GetHeight(int ScreenIndex OR Window w)=> Returns the height of the given screen, or the screen the given window is on.Graphics.Sleep(long milliseconds)=> Sleeps for the given timespan.
By default, odl only re-renders all its viewports and sprites when it detects that a property on a viewport/sprite/bitmap has changed. No changes, no re-rendering.
Graphics.Update() is comprised of three parts, in the following order:
Graphics.UpdateInput(false)=> Updates keyboard input for methods likeInput.Trigger(), calls theOnTickevent on all windows, and callsOnMousePresswhile the mouse is being pressed.Graphics.UpdateGraphics(false)=> Tells all renderers to re-render if the renderer has been marked "dirty" (i.e. a sprite/viewport/bitmap has been modified in any way that would affect the displayed result). If the argument passed istrue, all renderers will re-render regardless of whether or not they are marked "dirty". If vsync is enabled, this method will block until enough time has passed to be synchronized with the refresh rate of the monitor the window is in.Graphics.UpdateWindows()=> Polls all pending SDL events. This is mouse events, exit events, resize events, etc. If this method is not called, the window will freeze.
Last updated