Added Odin and Raylib window example

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-04 12:15:26 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-04 12:15:26 +0200
Commit e77a85bde0c76b265f8faa395b1a86144ea0798e (patch)
-rw-r--r-- README.md 57
-rw-r--r-- odin-rl-window/.gitignore 1
-rw-r--r-- odin-rl-window/Makefile 5
-rw-r--r-- odin-rl-window/main.odin 21
4 files changed, 56 insertions, 28 deletions
diff --git a/README.md b/README.md
...
18
> also written in the most explicit way and lacks massively when it
18
> also written in the most explicit way and lacks massively when it
19
> comes to checking of errors etc.
19
> comes to checking of errors etc.
20
  
20
  
21
|                                          | Compiler   | What does it do?                                               |
21
|                                          | Compiler    | What does it do?                                               |
22
|------------------------------------------|------------|----------------------------------------------------------------|
22
|------------------------------------------|-------------|----------------------------------------------------------------|
23
| [c-asm](./c-asm)                         | clang-17   | Calls a function written in ASM from C code.                   |
23
| [c-asm](./c-asm)                         | clang-17    | Calls a function written in ASM from C code.                   |
24
| [c-embed](./c-embed)                     | clang-17   | Embedding external resources in compiled binary.               |
24
| [c-embed](./c-embed)                     | clang-17    | Embedding external resources in compiled binary.               |
25
| [c-signals](./c-signals)                 | clang-17   | Uses SIGUSR1 and SIGUSR2 as IPC mechanism.                     |
25
| [c-signals](./c-signals)                 | clang-17    | Uses SIGUSR1 and SIGUSR2 as IPC mechanism.                     |
26
| [c-structs](./c-structs)                 | clang-17   | Saves and reads structs in/from binary files.                  |
26
| [c-structs](./c-structs)                 | clang-17    | Saves and reads structs in/from binary files.                  |
27
| [c-httpd](./c-httpd)                     | clang-17   | Simple HTTP server with route handling primer in C.            |
27
| [c-httpd](./c-httpd)                     | clang-17    | Simple HTTP server with route handling primer in C.            |
28
| [zig-c-interop](./zig-c-interop)         | zig-0.11.0 | Uses functions written in C from Zig code.                     |
28
| [zig-c-interop](./zig-c-interop)         | zig-0.11.0  | Uses functions written in C from Zig code.                     |
29
| [zig-ppm](./zig-ppm)                     | zig-0.11.0 | Creates an image with random pixels in PPM image format.       |
29
| [zig-ppm](./zig-ppm)                     | zig-0.11.0  | Creates an image with random pixels in PPM image format.       |
30
| [zig-struct-json](./zig-struct-json)     | zig-0.11.0 | Serialization of a struct into JSON and then reading it back.  |
30
| [zig-struct-json](./zig-struct-json)     | zig-0.11.0  | Serialization of a struct into JSON and then reading it back.  |
31
| [zig-telnet](./zig-telnet)               | zig-0.11.0 | Connects to Redis server like it is a basic telnet server.     |
31
| [zig-telnet](./zig-telnet)               | zig-0.11.0  | Connects to Redis server like it is a basic telnet server.     |
32
| [zig-x11](./zig-x11)                     | zig-0.11.0 | Uses X11 to create a basic window without any bindings needed. |
32
| [zig-x11](./zig-x11)                     | zig-0.11.0  | Uses X11 to create a basic window without any bindings needed. |
33
| [zig-http](./zig-http)                   | zig-0.11.0 | Basic example of a HTTP 1.1 server without any routing etc.    |
33
| [zig-http](./zig-http)                   | zig-0.11.0  | Basic example of a HTTP 1.1 server without any routing etc.    |
34
| [zig-x11-box](./zig-x11-box)             | zig-0.11.0 | Move a box around with arrow keys with Xlib and Zig.           |
34
| [zig-x11-box](./zig-x11-box)             | zig-0.11.0  | Move a box around with arrow keys with Xlib and Zig.           |
35
| [zig-kv-store](./zig-kv-store)           | zig-0.11.0 | Simple Key-value store that mimics memcached written in Zig.   |
35
| [zig-kv-store](./zig-kv-store)           | zig-0.11.0  | Simple Key-value store that mimics memcached written in Zig.   |
36
| [zig-wad](./zig-wad)                     | zig-0.11.0 | Reads doom.wad and extracts the identification header.         |
36
| [zig-wad](./zig-wad)                     | zig-0.11.0  | Reads doom.wad and extracts the identification header.         |
37
| [zig-os-props](./zig-os-props)           | zig-0.11.0 | Detects properties of the target operating system.             |
37
| [zig-os-props](./zig-os-props)           | zig-0.11.0  | Detects properties of the target operating system.             |
38
| [zig-tlv-encoding](./zig-tlv-encoding)   | zig-0.13.0 | Naive implementation of TLV encoding in Zig.                   |
38
| [zig-tlv-encoding](./zig-tlv-encoding)   | zig-0.13.0  | Naive implementation of TLV encoding in Zig.                   |
39
| [zig-embed](./zig-embed)                 | zig-0.13.0 | Embedding external resources in compiled binary.               |
39
| [zig-embed](./zig-embed)                 | zig-0.13.0  | Embedding external resources in compiled binary.               |
40
| [zig-struct-bin](./zig-struct-bin)       | zig-0.13.0 | Save a struct into binary file and then reading it back.       |
40
| [zig-struct-bin](./zig-struct-bin)       | zig-0.13.0  | Save a struct into binary file and then reading it back.       |
41
| [zig-elf](./zig-elf)                     | zig-0.14.0 | Read execution header of Elf64 format in Zig.                  |
41
| [zig-elf](./zig-elf)                     | zig-0.14.0  | Read execution header of Elf64 format in Zig.                  |
42
| [c-bluetooth](./c-bluetooth)             | clang-17   | Scans for all Bluetooth devices.                               |
42
| [c-bluetooth](./c-bluetooth)             | clang-17    | Scans for all Bluetooth devices.                               |
43
| [d-x11](./d-x11)                         | dmd-2.110  | Uses X11 to create a basic window without any bindings needed. |
43
| [d-x11](./d-x11)                         | dmd-2.110   | Uses X11 to create a basic window without any bindings needed. |
44
| [d-bmp-header](./d-bmp-header)           | dmd-2.110  | Reads BMP image header and prints the information out.         |
44
| [d-bmp-header](./d-bmp-header)           | dmd-2.110   | Reads BMP image header and prints the information out.         |
45
| [c-luajit](./c-luajit)                   | clang-19   | Testing execution speed of Lua vs Luajit vs embedded Luajit.   |
45
| [c-luajit](./c-luajit)                   | clang-19    | Testing execution speed of Lua vs Luajit vs embedded Luajit.   |
46
| [c-embedding-data](./c-embedding-data)   | clang-19   | Embedding game assets to executable binary (with raylib).      |
46
| [c-embedding-data](./c-embedding-data)   | clang-19    | Embedding game assets to executable binary (with raylib).      |
47
| [c-sqlite-embed-db](./c-sqlite-embed-db) | clang-17   | Embeds SQLite and SQLite database into executable.             |
47
| [c-sqlite-embed-db](./c-sqlite-embed-db) | clang-17    | Embeds SQLite and SQLite database into executable.             |
48
| [c-embed-lua](./c-embed-lua)             | clang-17   | Embeds Lua interpreter and Lua script into executable.         |
48
| [c-embed-lua](./c-embed-lua)             | clang-17    | Embeds Lua interpreter and Lua script into executable.         |
  
49
| [odin-rl-window](./odin-rl-window)       | dev-2025-07 | Simple Raylib window with Odin.                                |
49
  
50
  
50
## License
51
## License
51
  
52
  
...
diff --git a/odin-rl-window/.gitignore b/odin-rl-window/.gitignore
  
1
odin-rl-window
diff --git a/odin-rl-window/Makefile b/odin-rl-window/Makefile
  
1
run:
  
2
	odin run .
  
3
  
  
4
build:
  
5
	odin build .
diff --git a/odin-rl-window/main.odin b/odin-rl-window/main.odin
  
1
package main
  
2
  
  
3
import "core:fmt"
  
4
import rl "vendor:raylib"
  
5
  
  
6
main :: proc() {
  
7
	rl.SetConfigFlags({.VSYNC_HINT, .WINDOW_RESIZABLE, .WINDOW_HIGHDPI})
  
8
	rl.InitWindow(1280, 720, "Raylib Window")
  
9
  
  
10
	rl.SetTargetFPS(500)
  
11
  
  
12
	for !rl.WindowShouldClose() {
  
13
		rl.BeginDrawing()
  
14
		rl.ClearBackground(rl.DARKBLUE)
  
15
		rl.DrawRectangleV(rl.Vector2{ 200, 200 }, rl.Vector2{ 200, 200 }, rl.WHITE)
  
16
		rl.DrawFPS(rl.GetScreenWidth() - 100, 20);
  
17
		rl.EndDrawing()
  
18
	}
  
19
  
  
20
	rl.CloseWindow()
  
21
}