-
Notifications
You must be signed in to change notification settings - Fork 0
Home
simadude edited this page Feb 21, 2024
·
5 revisions
This wiki is supposed to help a new developers of Obsi to figure out how does the game engine works without having to read the source code itself.
Here are all of the Obsi modules:
- obsi.audio - an 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.keyboard - keyboard module for checking what keys are down.
- obsi.mouse - mouse module for checking when the mouse was last time.
- obsi.time - module for checking the time since the game was launched.
- obsi.system - a module for quickly checking what host is running the game.
- obsi.state - a 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.mousePressed(x: number, y: number, key: integer)
- called when the user presses a mouse button. -
obsi.mouseReleased(x: number, y: number, key: integer)
- called when the user lifts up a mouse button. -
obsi.keyPressed(key: integer)
- called when the user presses a key. -
obsi.keyReleased(key: integer)
- called when the user lifts up the key. -
obsi.windowFlush(window: Window)
- called every frame before drawing the window on the terminal. PassesWindow
object as as first argument. -
obsi.resize(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.quit()
- called when the game engine receives aterminate
event from theos.pullEventRaw
.