Obsi 2 is a Lua library that was designed specifically for CC:Tweaked. Originally it was made as a game engine, but I have refactored it into a library for easier packaging.
📖 Wiki: https://github.com/simadude/obsi2/wiki
Improvements in Obsi 2:
- More optimized
obsi.graphics.rectanglefunction - New
obsi.graphics.getPalettefunction! (Yes, it didn't exist before. Also be aware that it creates a new table on every call. Sorry.) - FPS counter that is accessible with
obsi.timer.getFPS() - Module
obsi.filesystemwas renamed toobsi.fs, and moduleobsi.timetoobsi.timer - Rendering APIs
hmonandpareawere renamed tobasicandneat - File extensions are mostly ignored (This is useful for when you have a system for converting
nfpfiles toorlifiles, but don't want to bother with renaming every file in code) - Fixed a crash when the game would play noteblock music in Minecraft
- Licenses from used projects are moved to
LICENSESfolder - Some other changes that I forgot about
There are a few things to look out for when switching to Obsi 2:
- Now you have to include
obsi2as a library - In order for your code to be ran in the loop, you have to put
obsi.init()at the end of your main file - Replace any mentions of
obsi.filesystemwithobsi.fsandobsi.timewithobsi.timer - Move the code from
config.luafile (it is no longer used by obsi) to the config insideobsi2/init.lua - Replace any mentions of
hmonandparearendering apis tobasicandneatrespectively - If the code outside of your
main.luafile is also usingobsi, then require it there as well. (Don't worry,requirecaches any of the packages it loads.)
Code with Obsi:
local img
function obsi.load()
img = obsi.graphics.newImage("coolimg.nfp")
end
function obsi.draw()
obsi.graphics.draw(img, 1, 1)
endSame code with Obsi 2:
local obsi = require("obsi2")
local img
function obsi.load()
img = obsi.graphics.newImage("coolimg.nfp")
end
function obsi.draw()
obsi.graphics.draw(img, 1, 1)
end
obsi.init()Credits:
9551-Dev - For the Pixelbox rendering API.
Xella37 - For the original parsing function for NBS file format.
