This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a minimal Odin + Raylib example. | |
Put this file in an empty folder, navigate to that folder using a teriminal | |
and then run this command: | |
odin run . | |
To see all the things available in Raylib, open `raylib.odin` and look around. | |
You'll find it here: | |
<odin_install_directory>/vendor/raylib/raylib.odin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimal Odin + Raylib example that opens window and lets you control a | |
// rectangle using the arrow keys. Beginners can use this as a starting point. | |
// | |
// Copy this into a file called whatever_you_want.odin inside an empty folder. | |
// Use the command prompt to navigate to that folder and run: | |
// odin run . | |
// Note the period, with a space before it! This should run this minimal example. | |
package raylib_minimal | |
import rl "vendor:raylib" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1: Introduction | |
1.1: Why learn Odin? | |
1.2: Overview | |
1.3: Installing the Odin compiler | |
1.4: If you get stuck | |
1.5: Let's go! | |
2: Hellope! A tiny program | |
2.1: Compile and run the code | |
2.2: Line-by-line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package runefun | |
import fmt "core:fmt" | |
import "core:unicode/utf8" | |
main :: proc() { | |
str := "小猫咪" | |
// i is the byte index | |
for r, i in str { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package open_win32_window | |
import win "core:sys/windows" | |
main :: proc() { | |
instance := win.HINSTANCE(win.GetModuleHandleW(nil)) | |
assert(instance != nil, "Failed to fetch current instance") | |
class_name := win.L("Windows Window") | |
cls := win.WNDCLASSW { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// extra things I add to hot reload script to make auto reload work | |
odin build file_version_builder | |
IF %ERRORLEVEL% NEQ 0 exit /b 1 | |
file_version_builder.exe | |
IF %ERRORLEVEL% NEQ 0 exit /b 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rect :: struct { | |
x: f32, | |
y: f32, | |
width: f32, | |
height: f32, | |
} | |
cut_rect_top :: proc(r: ^Rect, y: f32, m: f32) -> Rect { | |
res := r^ | |
res.y += m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
refresh_padded_tileset :: proc() { | |
if g_mem.tileset_padded.id != 0 { | |
rl.UnloadTexture(g_mem.tileset_padded) | |
g_mem.tileset_padded = {} | |
} | |
ts_source := load_image(.Tileset) | |
defer rl.UnloadImage(ts_source) | |
tileset_height := ts_source.height / TileHeight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"folders": | |
[ | |
{ | |
"path": ".", | |
}, | |
], | |
"build_systems": | |
[ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package game | |
import rl "vendor:raylib" | |
import "core:mem" | |
import "core:fmt" | |
import "core:encoding/json" | |
import "core:os" | |
Animation_Name :: enum { | |
Idle, |
NewerOlder