gl.init() – Initializes SDL and prepares the library for use.
gl.initwindow(title, width, height, options) – Creates a window and renderer. Options can include fullscreen, resizable, borderless, fullscreen_desktop, opengl.
gl.cleanup() – Destroys the renderer and window, quits SDL.
gl.background(r, g, b, a) – Sets the background color for clearing.
gl.clear() – Clears the screen using the current background color.
gl.setfps(fps) – Sets the target frames per second. Pass 0 to disable FPS limiting.
gl.getdt() – Returns the delta time in seconds since the last frame.
gl.present() – Updates the display, handles events, and calculates delta time.
gl.window_closed() – Returns True if the window was closed.
gl.key_pressed() – Returns the last key pressed as a keycode.
gl.key_hold() – Returns any currently held key as a keycode (first found).
gl.get_holdkeys() – Returns a list of all currently held keys.
gl.mouse_move() – Returns True if the mouse has moved since the last frame.
gl.get_monitorwidth() – Returns the width of the primary monitor.
gl.get_monitorheight() – Returns the height of the primary monitor.
gl.get_pixel(x, y) – Returns the RGBA color of the pixel at (x, y) as a tuple.
gl.get_mousepos() – Returns the position of mouse on window (x, y) as tuple.
Shape Objects
Circle
gl.createcircle() – Creates a circle object.
Methods:
set_pos(x, y) – Set the circle's center position.
set_radius(radius) – Set the circle's radius.
set_background(r, g, b, a) – Set fill color with alpha.
set_border(r, g, b, a, thickness) – Set border color and thickness.
draw() – Draws the circle on the screen.
Line
gl.createline() – Creates a line object.
Methods:
set_points(x1, y1, x2, y2) – Set line endpoints.
set_color(r, g, b, a) – Set line color with alpha.
draw() – Draws the line on the screen.
Rectangle
gl.createrect() – Creates a rectangle object.
Methods:
set_pos(x, y) – Set rectangle position (top-left corner).
set_size(width, height) – Set rectangle size.
set_background(r, g, b, a) – Set fill color with alpha.
set_border(r, g, b, a, thickness) – Set border color and thickness.
draw() – Draws the rectangle on the screen.
Shape Utilities
gl.destroy(shape) – Fills the shape with the background color and marks it as invisible.