Using Odin-lang with Karl2d for 2D game development
Starting with ODIN (lang) is very simple. This tutorial (part of a series) will go through setting up Odin and Karl2D. We then go into Notes about creating a game.
Set-Up
Head over to Odin-Lang and select the download button. This tutorial will assume Windows. Instructions for Linux and Apple-Mac will be linked to in the notes.
The Getting started page gives you detailed instructions.
Windows users go to Official releases, dowload the latest release and unzip into a folder where you keep all your portable apps, i.e. c:\portable and then \odin ~ I usually check the archive if has an odin folder top level, then I just extract to portable. if it is just the files, then I would extract to c:\portable\odin. Anyway make sure you place the folder path in your user path environment variable.
If using Karl2d and not raylib (raylib comes with odin in the vendors folder/package), then download or clone karl2d into the game folder at the same level as the code in its own karl2d folder, keep it lower case.
then when including you may include as karl2d
here is a hello.odin example using karl2d
package hello_world
import k2 "karl2d"
main :: proc() {
k2.init(1280, 720, "Greetings from Karl2D!")
for k2.update() {
k2.clear(k2.LIGHT_BLUE)
k2.draw_text("Hellope!", {50, 50}, 100, k2.DARK_BLUE)
k2.present()
}
k2.shutdown()
}
Thats it for setup. There are a few other libraries etc you can use but that would be an ‘as you need’ kinda thing.