refactor: restructure the project
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
**/raylib_*
|
**/raylib_*
|
||||||
|
**/demo.gif
|
||||||
demo_gen
|
demo_gen
|
||||||
|
|||||||
4
Makefile
@@ -1,7 +1,7 @@
|
|||||||
# used to generate the demos for all languages
|
# used to generate the demos for all languages
|
||||||
|
|
||||||
demo_gen: _tools/demo_gen.c
|
demo_gen: tools/demo_gen.c
|
||||||
gcc -Wall -Wextra -pedantic -I./_raylib-5.5_linux_amd64/include $^ -o $@ -L./_raylib-5.5_linux_amd64/lib -l:libraylib.a -lm
|
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
|
.PHONY: run
|
||||||
run: demo_gen
|
run: demo_gen
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
6
languages/ada/Makefile
Normal 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
|
||||||
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
2
languages/c/Makefile
Normal 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
|
||||||
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
@@ -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
@@ -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
|
||||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
@@ -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"
|
||||||
@@ -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",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
@@ -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_ = [
|
||||||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
2
languages/rust/Makefile
Normal 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
|
||||||
|
Before Width: | Height: | Size: 16 MiB After Width: | Height: | Size: 16 MiB |
2
languages/zig/Makefile
Normal 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
|
||||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
@@ -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
|
|
||||||
@@ -102,25 +102,12 @@ static void generate_gif(const char *output_gif, const char **logo_paths, int lo
|
|||||||
system(TextFormat("rm -rf '%s'", tmpdir));
|
system(TextFormat("rm -rf '%s'", tmpdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void extract_dir(const char *logo_path, char *out, int maxlen) {
|
|
||||||
const char *slash = strchr(logo_path, '/');
|
|
||||||
if (slash) {
|
|
||||||
int len = (int)(slash - logo_path);
|
|
||||||
if (len >= maxlen) len = maxlen - 1;
|
|
||||||
strncpy(out, logo_path, len);
|
|
||||||
out[len] = '\0';
|
|
||||||
} else {
|
|
||||||
strncpy(out, logo_path, maxlen - 1);
|
|
||||||
out[maxlen - 1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
SetConfigFlags(FLAG_WINDOW_HIDDEN);
|
SetConfigFlags(FLAG_WINDOW_HIDDEN);
|
||||||
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "demo_gen");
|
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "demo_gen");
|
||||||
|
|
||||||
glob_t gl;
|
glob_t gl;
|
||||||
if (glob("*/*_logo.png", 0, NULL, &gl) != 0) {
|
if (glob("languages/*/*_logo.png", 0, NULL, &gl) != 0) {
|
||||||
TraceLog(LOG_ERROR, "No logos found. Run from project root.");
|
TraceLog(LOG_ERROR, "No logos found. Run from project root.");
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
return 1;
|
return 1;
|
||||||
@@ -133,13 +120,9 @@ int main(void) {
|
|||||||
|
|
||||||
// generate languages/**/demo.gif
|
// generate languages/**/demo.gif
|
||||||
for (size_t i = 0; i < gl.gl_pathc; i++) {
|
for (size_t i = 0; i < gl.gl_pathc; i++) {
|
||||||
char dir[256];
|
|
||||||
extract_dir(gl.gl_pathv[i], dir, sizeof(dir));
|
|
||||||
|
|
||||||
const char *path = gl.gl_pathv[i];
|
const char *path = gl.gl_pathv[i];
|
||||||
char* output_path = strdup(TextFormat("%s/demo.gif", dir));
|
char *output_path = strdup(TextFormat("%s/demo.gif", GetDirectoryPath(path)));
|
||||||
generate_gif(output_path, &path, 1, 9999.0f, 4);
|
generate_gif(output_path, &path, 1, 9999.0f, 4);
|
||||||
|
|
||||||
free(output_path);
|
free(output_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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
|
|
||||||