FIRST STEP WITH ANTIRUINS

API

๐Ÿ› ๏ธ UTILITIES

findFile(filename) Returns a path if the filename is found on the /cd, /rd, /pc and or in the loaded game folder.
getUS() Returns the current microseconds since game as started.
getMS() Returns the current millisecond since game as started.
getFPS() Returns the current frame per seconds.
mountRomdisk(fileName, mountpoint) Mount a romdisk at specified mountpoint. The most common mountpoint is โ€œ/rdโ€
unmountRomdisk(mountpoint) Unmount the specified mountpoint and frees up memory.

๐Ÿ–Œ๏ธ GRAPHICS

graphics.loadTexture(filename) Loads a pow2 .png or .dtex image. Returns a texture.
graphics.freeTexture(texture) Frees the texture data.
graphics.drawTexture(texture, x, y, scaleX, scaleY, angle, uv) Draws a texture at x-y position. scaleX/ycaleY are floats. UV is a table with 4 x 0.0 - 1.0 uv coordinate.
graphics.setDrawColor(r,g,b,a) Set the color (0.0 - 1.0) of future texture, shape, text.
graphics.setClearColor(r,g,b,a) Set the color (0.0 - 1.0) of the background.
graphics.loadFont(filename, col, row, fontSize) Loads a pow2 .png or .dtex image. Returns a font. Read the font documentation
graphics.print(text, x, y, center) Prints text at x-y position. If center is true, the text is centered.
graphics.setFontSize(fontSize)
graphics.drawRect(x, y, w, h, mode) Draws a rectangle. If mode is โ€œcornersโ€, x and y becomes top-left coordinates.
graphics.drawLine(x1, y1, x2, y2, width)
graphics.playVideo(videoFile, x, y, w, h)
graphics.loadPalette(file) Returns a palette from a .dtex.pal file.
graphics.setPalette(texture, palette) Replaces a texture palette with the provided palette
graphics.setPaletteColor(palette, colorNum, r,g,b,a) Set a single color in a specified palette. The โ€˜rโ€™ argument can be a {r,g,b,a} table. **

๐Ÿ”Š AUDIO

audio.load(filename, type) Loads a .wav (audio.SFX or audio.WAV) file. Returns a source. Type must be audio.SFX, audio.WAV or audio.CDDA
audio.play(source, volume, loop) Plays a source at 0-255 volume.
audio.setVolume(source, volume) Sets the volume of a playing source.
audio.free(source) Frees the memory of a loaded source.
audio.isPlaying(source)
audio.pause(source)
audio.stop(source)
audio.setPan(source, pan) Sets pan. 128 is center, 0 is full left, 255 is full right. Only works on .SFX type sound.

๐ŸŽฎ INPUT

input.getButton(button, controllerNumber) Returns true/false is button has been pressed.
input.getButtonDown(button, controllerNumber) Returns true/false is button is being held.
input.getJoystick(controllerNumber) Returns the joystick position as a vector.
input.getTriggers(controllerNumber) Returns both triggers as a vector.

๐Ÿ’พ VMU