diff --git a/.gitignore b/.gitignore index c7f6825..5e0b191 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,5 @@ tags # Persistent undo [._]*.un~ +# Executable name +pialarm diff --git a/build-and-run.sh b/build-and-run.sh new file mode 100755 index 0000000..d4e3a63 --- /dev/null +++ b/build-and-run.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +set -ex + +gcc -o pialarm src/main.c -Wall -Wno-missing-braces -Wunused-result -O2 \ + -I. -I/usr/local/include \ + -Iraylib-5.5/src -Iraylib-5.5/src/external \ + -Iclay \ + -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -latomic \ + -L. -Lraylib-5.5/src -L/usr/local/lib \ + -D_DEFAULT_SOURCE \ + -DPLATFORM_DESKTOP -DPLATFORM_DESKTOP_GLFW + +./pialarm diff --git a/build-raylib.sh b/build-raylib.sh new file mode 100755 index 0000000..7b62c11 --- /dev/null +++ b/build-raylib.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +set -ex + +pushd "raylib-5.5/src" +make clean +make +popd + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..46d33e5 --- /dev/null +++ b/src/main.c @@ -0,0 +1,35 @@ +#define CLAY_IMPLEMENTATION +#include "clay.h" +#include "renderers/raylib/clay_renderer_raylib.c" + +int main(void) +{ + uint64_t clayRequiredMemory = Clay_MinMemorySize(); + Clay_Arena clayMemory = (Clay_Arena) { + .label = CLAY_STRING("Clay Memory Arena"), + .memory = malloc(clayRequiredMemory), + .capacity = clayRequiredMemory + }; + Clay_Initialize(clayMemory, (Clay_Dimensions) { (float)GetScreenWidth(), (float)GetScreenHeight() }); + Clay_Raylib_Initialize(GetScreenWidth(), GetScreenHeight(), "PiAlarm", FLAG_FULLSCREEN_MODE); + while (!WindowShouldClose()) { + Clay_BeginLayout(); + CLAY( + CLAY_RECTANGLE({ .color = {255, 0, 0, 255} }), + CLAY_LAYOUT({ + .sizing = { + .width = 720, + .height = 720 + } + }) + ) {} + Clay_RenderCommandArray renderCommands = Clay_EndLayout(); + + BeginDrawing(); + ClearBackground(BLACK); + Clay_Raylib_Render(renderCommands); + EndDrawing(); + } + CloseWindow(); + return 0; +}