Compare commits

..

4 Commits

Author SHA1 Message Date
3824fcc15b chore: update LICENSE 2026-04-11 19:09:28 +02:00
a646dc3650 chore: update docs 2026-04-11 19:07:00 +02:00
d871db2b2f refactor: restructure the project 2026-04-11 18:33:11 +02:00
53649df179 feat: generate demo gifs for all languages 2026-04-11 18:21:34 +02:00
73 changed files with 339 additions and 93 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
**/raylib_* **/raylib_*
demo_gen

View File

@@ -1,4 +1,4 @@
Copyright (c) 2025 Pihkaal <hello@pihkaal.me> Copyright (c) 2025-2026 Pihkaal <hello@pihkaal.me>
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without files (the "Software"), to deal in the Software without

12
Makefile Normal file
View File

@@ -0,0 +1,12 @@
# used to generate the demos for all languages
demo_gen: tools/demo_gen.c
gcc -Wall -Wextra -pedantic -I./third_party/raylib-5.5_linux_amd64/include $^ -o $@ -L./third_party/raylib-5.5_linux_amd64/lib -l:libraylib.a -lm
.PHONY: run
run: demo_gen
./demo_gen
.PHONY: clean
clean:
rm -f ./**/raylib* ./demo_gen

View File

@@ -1,6 +1,24 @@
# raylib speedruns <div align="center">
<h1>Raylib Speedruns</h1>
<img src="./docs/demo.gif" alt="demo" />
</div>
Bouncing logos in different programming languages. Bouncing logos in different programming languages.
Get raylib at https://github.com/raysan5/raylib. Idea stolen from https://tsoding.github.io. Get raylib at https://github.com/raysan5/raylib. Idea stolen from https://tsoding.github.io.
All projects are build using `make`, so all commands you need are inside `Makefile`s. All projects are built using `make`, so all commands you need are inside `Makefile`s.
## Implementations
| | |
|:---------------------------------------------------------:|:-----------------------------|
| <img width="32" src="./languages/ada/ada_logo.png"> | [Ada](./languages/ada) |
| <img width="32" src="./languages/c/c_logo.png"> | [C](./languages/c) |
| <img width="32" src="./languages/csharp/csharp_logo.png"> | [C#](./languages/csharp) |
| <img width="32" src="./languages/d/d_logo.png"> | [D](./languages/d) |
| <img width="32" src="./languages/go/go_logo.png"> | [Go](./languages/go) |
| <img width="32" src="./languages/odin/odin_logo.png"> | [Odin](./languages/odin) |
| <img width="32" src="./languages/python/python_logo.png"> | [Python](./languages/python) |
| <img width="32" src="./languages/rust/rust_logo.png"> | [Rust](./languages/rust) |
| <img width="32" src="./languages/zig/zig_logo.png"> | [Zig](./languages/zig) |

View File

@@ -1,6 +0,0 @@
raylib_ada: main.adb
gnatmake main.adb -o raylib_ada \
-I../_raylib-5.5_linux_amd64/include \
-largs ../_raylib-5.5_linux_amd64/lib/libraylib.a \
-lm
rm -f main.ali main.o

View File

@@ -1,2 +0,0 @@
raylib_c: main.c
gcc main.c -Wall -Wextra -Werror -pedantic -o raylib_c -I../_raylib-5.5_linux_amd64/include -L../_raylib-5.5_linux_amd64/lib -l:libraylib.a -lm

View File

@@ -1,8 +0,0 @@
# Raylib in C
## Quick start
```sh
$ make
$ ./raylib_c
```

View File

@@ -1,14 +0,0 @@
# Raylib in C#
I'm using Mono because i don't like Microsoft.
## Quick start
```shell
$ make
$ mono raylib_csharp.exe
```
## Credits
- Logo: [Wikipedia](https://wikipedia.org/wiki/File:Logo_C_sharp.svg)

View File

@@ -1,3 +0,0 @@
raylib_d: main.d
dmd main.d -of=./raylib_d ../_raylib-5.5_linux_amd64/lib/libraylib.a
rm ./raylib_d.o

View File

@@ -1,8 +0,0 @@
# Raylib in D
## Quick start
```sh
$ make
$ ./raylib_d
```

BIN
docs/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

View File

@@ -1,8 +0,0 @@
# Raylib in Go
## Quick start
```sh
$ make
$ ./raylib_go
```

6
languages/ada/Makefile Normal file
View File

@@ -0,0 +1,6 @@
raylib_ada: main.adb
gnatmake main.adb -o raylib_ada \
-I../raylib-5.5_linux_amd64/include \
-largs ../raylib-5.5_linux_amd64/lib/libraylib.a \
-lm
rm -f main.ali main.o

17
languages/ada/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in Ada</h1>
<img src="./demo.gif" alt="Ada Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_ada
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Ada_horizon_green_logo_with_slogan.svg)

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

BIN
languages/ada/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

2
languages/c/Makefile Normal file
View File

@@ -0,0 +1,2 @@
raylib_c: main.c
gcc main.c -Wall -Wextra -Werror -pedantic -o raylib_c -I../raylib-5.5_linux_amd64/include -L../raylib-5.5_linux_amd64/lib -l:libraylib.a -lm

17
languages/c/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in C</h1>
<img src="./demo.gif" alt="C Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_c
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://upload.wikimedia.org/wikipedia/commons/1/18/C_Programming_Language.svg)

View File

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

BIN
languages/c/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -0,0 +1,19 @@
<div align="center">
<h1>Raylib in C#</h1>
<img src="./demo.gif" alt="C# Raylib demo" />
</div>
I'm using Mono because i don't like Microsoft.
## Quick start
```sh
$ make
$ mono raylib_csharp.exe
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Logo_C_sharp.svg)

View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

BIN
languages/csharp/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

View File

@@ -39,7 +39,7 @@ static class Program
public byte a; public byte a;
} }
private const string RAYLIB = "../_raylib-5.5_linux_amd64/lib/libraylib.so"; private const string RAYLIB = "../raylib-5.5_linux_amd64/lib/libraylib.so";
[DllImport(RAYLIB)] private static extern void InitWindow(int width, int height, string title); [DllImport(RAYLIB)] private static extern void InitWindow(int width, int height, string title);
[DllImport(RAYLIB)] private static extern void CloseWindow(); [DllImport(RAYLIB)] private static extern void CloseWindow();

3
languages/d/Makefile Normal file
View File

@@ -0,0 +1,3 @@
raylib_d: main.d
dmd main.d -of=./raylib_d ../raylib-5.5_linux_amd64/lib/libraylib.a
rm ./raylib_d.o

17
languages/d/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in D</h1>
<img src="./demo.gif" alt="D Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_d
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:D_Programming_Language_logo.svg)

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

BIN
languages/d/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

17
languages/go/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in Go</h1>
<img src="./demo.gif" alt="Go Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_go
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Go_Logo_Blue.svg)

BIN
languages/go/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -1,8 +1,8 @@
package main package main
/* /*
#cgo CFLAGS: -I../_raylib-5.5_linux_amd64/include #cgo CFLAGS: -I../raylib-5.5_linux_amd64/include
#cgo LDFLAGS: -L../_raylib-5.5_linux_amd64/lib -l:libraylib.a -lm #cgo LDFLAGS: -L../raylib-5.5_linux_amd64/lib -l:libraylib.a -lm
#include <raylib.h> #include <raylib.h>
*/ */
import "C" import "C"

17
languages/odin/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in Odin</h1>
<img src="./demo.gif" alt="Odin Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_odin
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:The_odin_programming_language_logo.svg)

BIN
languages/odin/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

View File

@@ -3,7 +3,7 @@ package main
import "core:time" import "core:time"
foreign import raylib { foreign import raylib {
"../_raylib-5.5_linux_amd64/lib/libraylib.a", "../raylib-5.5_linux_amd64/lib/libraylib.a",
"system:m", "system:m",
} }

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -0,0 +1,14 @@
<div align="center">
<h1>Raylib in Python</h1>
<img src="./demo.gif" alt="Python Raylib demo" />
</div>
## Quick start
```sh
$ python ./main.py
```
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Python-logo-notext.svg)

BIN
languages/python/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

View File

@@ -1,7 +1,7 @@
from ctypes import * from ctypes import *
from time import time from time import time
rl = CDLL("../_raylib-5.5_linux_amd64/lib/libraylib.so") rl = CDLL("../raylib-5.5_linux_amd64/lib/libraylib.so")
class Image(Structure): class Image(Structure):
_fields_ = [ _fields_ = [

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

2
languages/rust/Makefile Normal file
View File

@@ -0,0 +1,2 @@
raylib_rust: main.rs
rustc --edition 2021 main.rs -C link-args="-L ../raylib-5.5_linux_amd64/lib -l:libraylib.a -lm" -o raylib_rust

17
languages/rust/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in Rust</h1>
<img src="./demo.gif" alt="Rust Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_rust
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Rust_programming_language_black_logo.svg) (tinted)

BIN
languages/rust/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

View File

Before

Width:  |  Height:  |  Size: 16 MiB

After

Width:  |  Height:  |  Size: 16 MiB

2
languages/zig/Makefile Normal file
View File

@@ -0,0 +1,2 @@
raylib_zig: main.zig
zig build-exe main.zig -I../raylib-5.5_linux_amd64/include ../raylib-5.5_linux_amd64/lib/libraylib.a -lm -femit-bin=raylib_zig

17
languages/zig/README.md Normal file
View File

@@ -0,0 +1,17 @@
<div align="center">
<h1>Raylib in Zig</h1>
<img src="./demo.gif" alt="Zig Raylib demo" />
</div>
## Quick start
```sh
$ make
$ ./raylib_zig
```
Complete command in [Makefile](./Makefile)
## Credits
- Logo: [Wikimedia](https://commons.wikimedia.org/wiki/File:Zig-logomark-2024.svg)

BIN
languages/zig/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -1,8 +0,0 @@
# Raylib in Odin
## Quick start
```sh
$ make
$ ./raylib_odin
```

View File

@@ -1,7 +0,0 @@
# Raylib in Python
## Quick start
```sh
$ python ./main.py
```

View File

@@ -1,2 +0,0 @@
raylib_rust: main.rs
rustc --edition 2021 main.rs -C link-args="-L ../_raylib-5.5_linux_amd64/lib -l:libraylib.a -lm" -o raylib_rust

View File

@@ -1,8 +0,0 @@
# Raylib in Rust
## Quick start
```sh
$ make
$ ./raylib_rust
```

132
tools/demo_gen.c Normal file
View File

@@ -0,0 +1,132 @@
#include <raylib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glob.h>
#include <sys/stat.h>
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
#define LOGO_HEIGHT 64
#define LOGO_SPEED 300.0f
#define GIF_FPS 20
static unsigned int hash_str(const char *s) {
unsigned int h = 5381;
while (*s) h = h * 33 ^ (unsigned char)*s++;
return h;
}
static void generate_gif(const char *output_gif, const char **logo_paths, int logo_count, float switch_secs, int duration_secs) {
if (FileExists(output_gif)) {
TraceLog(LOG_INFO, "Skipping %s (already exists)", output_gif);
return;
}
TraceLog(LOG_INFO, "Generating %s...", output_gif);
char tmpdir[] = "/tmp/demo_gen_XXXXXX";
if (!mkdtemp(tmpdir)) {
perror("mkdtemp");
return;
}
Texture2D *textures = (Texture2D *)malloc(logo_count * sizeof(Texture2D));
for (int i = 0; i < logo_count; i++) {
Image img = LoadImage(logo_paths[i]);
ImageResize(&img, img.width * LOGO_HEIGHT / img.height, LOGO_HEIGHT);
textures[i] = LoadTextureFromImage(img);
UnloadImage(img);
}
RenderTexture2D target = LoadRenderTexture(WINDOW_WIDTH, WINDOW_HEIGHT);
SetRandomSeed(hash_str(output_gif));
int cur_logo = 0;
float x = GetRandomValue(0, WINDOW_WIDTH - textures[cur_logo].width);
float y = GetRandomValue(0, WINDOW_HEIGHT - textures[cur_logo].height);
float vx = LOGO_SPEED * (GetRandomValue(0, 1) ? 1.0f : -1.0f);
float vy = LOGO_SPEED * (GetRandomValue(0, 1) ? 1.0f : -1.0f);
int total_frames = duration_secs * GIF_FPS;
float frame_dt = 1.0f / GIF_FPS;
float logo_timer = 0.0f;
for (int f = 0; f < total_frames; f++) {
Texture2D tex = textures[cur_logo];
x += vx * frame_dt;
y += vy * frame_dt;
if (x < 0 || x + tex.width >= WINDOW_WIDTH) {
vx *= -1.0f;
x += vx * frame_dt;
}
if (y < 0 || y + tex.height >= WINDOW_HEIGHT) {
vy *= -1.0f;
y += vy * frame_dt;
}
logo_timer += frame_dt;
if (logo_timer >= switch_secs) {
logo_timer = 0.0f;
cur_logo = (cur_logo + 1) % logo_count;
}
BeginTextureMode(target);
ClearBackground(BLACK);
DrawTextureV(tex, (Vector2){x, y}, WHITE);
EndTextureMode();
Image frame_img = LoadImageFromTexture(target.texture);
ImageFlipVertical(&frame_img);
ExportImage(frame_img, TextFormat("%s/frame_%04d.png", tmpdir, f));
UnloadImage(frame_img);
TraceLog(LOG_INFO, " frame %d/%d", f + 1, total_frames);
}
UnloadRenderTexture(target);
for (int i = 0; i < logo_count; i++) UnloadTexture(textures[i]);
free(textures);
if (system(TextFormat(
"ffmpeg -y -framerate %d -i '%s/frame_%%04d.png' "
"-vf 'fps=%d,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse' "
"'%s' 2>/dev/null",
GIF_FPS, tmpdir, GIF_FPS, output_gif)) != 0)
TraceLog(LOG_ERROR, "ffmpeg failed for %s", output_gif);
system(TextFormat("rm -rf '%s'", tmpdir));
}
int main(void) {
SetConfigFlags(FLAG_WINDOW_HIDDEN);
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "demo_gen");
glob_t gl;
if (glob("languages/*/*_logo.png", 0, NULL, &gl) != 0) {
TraceLog(LOG_ERROR, "No logos found. Run from project root.");
CloseWindow();
return 1;
}
mkdir("docs", 0755);
// generate docs/demo.gif (cycles all logos)
generate_gif("docs/demo.gif", (const char **)gl.gl_pathv, (int)gl.gl_pathc, 1.0f, (int)gl.gl_pathc);
// generate languages/**/demo.gif
for (size_t i = 0; i < gl.gl_pathc; i++) {
const char *path = gl.gl_pathv[i];
char *output_path = strdup(TextFormat("%s/demo.gif", GetDirectoryPath(path)));
generate_gif(output_path, &path, 1, 9999.0f, 4);
free(output_path);
}
CloseWindow();
globfree(&gl);
return 0;
}

View File

@@ -1,2 +0,0 @@
raylib_zig: main.zig
zig build-exe main.zig -I../_raylib-5.5_linux_amd64/include ../_raylib-5.5_linux_amd64/lib/libraylib.a -lm -femit-bin=raylib_zig

View File

@@ -1,8 +0,0 @@
# Raylib in Zig
## Quick start
```sh
$ make
$ ./raylib_zig
```