Init
Init (
app_name: cstring, window_name: cstring, width: i32, height: i32,
backend: GraphicsBackend = .OPEN_GL,
sdl2_debug_verbose: bool = Util.VERBOSE_LOGGING
) -> RenderContext
Creates a new window and SDL2 renderer for drawing on
Parameters:
- app_name: the internal name used by drivers like audio for identification
- window_name: the name displayed in the title bar in ANCI
- width: the width of the window in pixels
- height: the height of the window in pixels
- GraphicsBackend: defaults to OpenGL but can be set to Software on all platforms, Metal on Apple devices, and DirectX3D11 on Windows devices
- sdl2_debug_verbose: flag that tells SDL2 to run in debug mode NOTE: cluters up STDIO use only if MAGMA will not tell you the error
Returns: RenderContext a renderer context for the window you just created
Update
Update (ctx: ^RenderContext)
Updates the renderer with whatever should be rendered to the screen
Parameters:
- cxt: The renderer context for the window you want to update
SetFullscreen
SetFullscreen (ctx: RenderContext, fullscreen: bool)
Controls if the window in the renderer context is fullscreen or not
Parameters:
- cxt: the renderer context of the window you want to toggle fullscreen on
- fullscreen: the flag that sets if the window is fullscreen or not
Shutdown
Shutdown (ctx: RenderContext)
Cleans up the window and renderer then quits SDL2
Parameters:
- cxt: the context to clean up
FPSLimiter
FPSLimiter (target_fps: u32)
Limits the FPS to a specific value
Parameters:
- target_fps: the number for the fps you want to limit to
GetDeltaTime
GetDeltaTime () -> f32
Returns the time in seconds between the current frame and the previous frame. It only updates the previous frame time every second call, effectively measuring delta over two frames.
Returns: delta time in seconds (f32)