-
Notifications
You must be signed in to change notification settings - Fork 1
Home
simadude edited this page May 16, 2025
·
5 revisions
This wiki is supposed to help a new developers of Obsi 2 to figure out how this library works without having to read an entire source code.
Here are all of the Obsi modules:
- obsi.audio - audio module for obsi that includes most of the things you need to manually control the audio stuff.
- obsi.graphics - a 2D graphics module for drawing things on the screen, manipulating the screen offset and changing the palette.
- obsi.fs - filesystem module for easily accessing files within the game directory.
- obsi.keyboard - keyboard module for checking what keys are down.
- obsi.mouse - mouse module for checking when the mouse was last time.
- obsi.timer - module for checking the time since the game was launched.
- obsi.system - module for quickly checking what host is running the game.
Warning
Deprecated and removed since v2.2.0: obsi.state - module for managing scenes and the state of the running game.
Some of the user-defined functions, all of them are called by obsi internally:
-
obsi.load()
- is called when the game is just launched. -
obsi.update(dt: number)
- is called for a fixed time update (it can be ran multiple times before theobsi.draw
). -
obsi.draw(dt: number)
- is called for drawing things onto the screen. -
obsi.onMousePress(x: number, y: number, key: integer)
- 8000 called when the user presses a mouse button. -
obsi.onMouseRelease(x: number, y: number, key: integer)
- called when the user lifts up a mouse button. -
obsi.onMouseMove(x: number, y: number)
- ONLY FOR CRAFTOS-PC. Called when the user moves the mouse. -
obsi.onKeyPress(key: integer)
- called when the user presses a key. -
obsi.onKeyRelease(key: integer)
- called when the user lifts up the key. -
obsi.onWindowFlush(window: Window)
- called every frame before drawing the window on the terminal. PassesWindow
object as as first argument. -
obsi.onResize(w: number, h: number)
- called when recieved "term_resize" event. -
obsi.onEvent(eventData: table)
- called on every event the game engine receives, except for theterminate
event. -
obsi.onQuit()
- called when the game engine receives aterminate
event from theos.pullEventRaw
, or when the frame finishes after callingobsi.quit()
.