From 65a1e437a566b6548df5f84e4226602adddff642 Mon Sep 17 00:00:00 2001 From: rexim Date: Tue, 6 Feb 2024 01:51:13 +0700 Subject: [PATCH] Port core_basic_window to raylib.js --- .gitignore | 1 + Makefile | 4 -- README.md | 2 +- build.sh | 11 +++++ examples/core_basic_window.c | 78 +++++++++++++++++++++++++++++++++++ fonts/LICENSE | 1 + fonts/acme_7_wide_xtnd.woff | Bin 0 -> 22524 bytes game.c | 25 +++++------ index.html | 6 ++- lib/libraylib.a | Bin 0 -> 7643922 bytes raylib.js | 43 +++++++++++++++---- wasm/core_basic_window.wasm | Bin 0 -> 1024 bytes wasm/game.wasm | Bin 1780 -> 1855 bytes 13 files changed, 143 insertions(+), 28 deletions(-) create mode 100644 .gitignore delete mode 100644 Makefile create mode 100755 build.sh create mode 100644 examples/core_basic_window.c create mode 100644 fonts/LICENSE create mode 100644 fonts/acme_7_wide_xtnd.woff create mode 100644 lib/libraylib.a create mode 100755 wasm/core_basic_window.wasm mode change 100644 => 100755 wasm/game.wasm diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 04de4e6..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: wasm/game.wasm - -wasm/game.wasm: game.c - clang --target=wasm32 -I./include --no-standard-libraries -Wl,--no-entry -Wl,--allow-undefined -Wl,--export=game_init -Wl,--export=game_frame -Wl,--export=game_over -o wasm/game.wasm game.c -DPLATFORM_WEB diff --git a/README.md b/README.md index f94ec30..47ef779 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Unofficial Implementation of Subset of [Raylib](https://github.com/raysan5/rayli ## Quick Start ```console -$ make +$ ./build.sh $ python3 -m http.server 6969 $ http://localhost:6969/ ``` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..adbda5e --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -xe + +mkdir -p build/ + +clang -I./include/ -o build/core_basic_window ./examples/core_basic_window.c -L./lib/ -lraylib -lm +clang -I./include/ -o build/game ./game.c -L./lib/ -lraylib -lm + +clang --target=wasm32 -I./include --no-standard-libraries -Wl,--export-table -Wl,--no-entry -Wl,--allow-undefined -Wl,--export=main -o wasm/core_basic_window.wasm ./examples/core_basic_window.c -DPLATFORM_WEB +clang --target=wasm32 -I./include --no-standard-libraries -Wl,--export-table -Wl,--no-entry -Wl,--allow-undefined -Wl,--export=main -o wasm/game.wasm game.c -DPLATFORM_WEB diff --git a/examples/core_basic_window.c b/examples/core_basic_window.c new file mode 100644 index 0000000..2790222 --- /dev/null +++ b/examples/core_basic_window.c @@ -0,0 +1,78 @@ +/******************************************************************************************* +* +* raylib [core] example - Basic window +* +* Welcome to raylib! +* +* To test examples, just press F6 and execute raylib_compile_execute script +* Note that compiled executable is placed in the same folder as .c file +* +* You can find all basic examples on C:\raylib\raylib\examples folder or +* raylib official webpage: www.raylib.com +* +* Enjoy using raylib. :) +* +* Example originally created with raylib 1.0, last time updated with raylib 1.0 +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) +* +********************************************************************************************/ + +#include "raylib.h" + +void raylib_js_set_entry(void (*entry)(void)); + +void GameFrame(void) +{ + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + + EndDrawing(); +} + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + +#ifdef PLATFORM_WEB + raylib_js_set_entry(GameFrame); +#else + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // TODO: Update your variables here + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + GameFrame(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +#endif + + return 0; +} diff --git a/fonts/LICENSE b/fonts/LICENSE new file mode 100644 index 0000000..6be3e74 --- /dev/null +++ b/fonts/LICENSE @@ -0,0 +1 @@ +TODO: add the license of the official Raylib font here \ No newline at end of file diff --git a/fonts/acme_7_wide_xtnd.woff b/fonts/acme_7_wide_xtnd.woff new file mode 100644 index 0000000000000000000000000000000000000000..1244941e045549cae96bceeea3c59ec904cc0d54 GIT binary patch literal 22524 zcmZsCb9^1o_jjB$y0L9Gwrw>wZfqM((%80bJB@8Sy-i~^wtng7`~3Or>veW!&(4`W z^PYp9J9|BpBqhPX!9EYoS1{Cn6&4Lm2`CBY_$|WhJyUGdBH{`Tp4#=RZ0CW{_EaGCz6kpVuUxM1g<-+hJ+v`Y8(` z{>f+j)X$fj7|h?s%-J3cOzBe|0^yT~WeR25ZtDR2l$9_3g#taGD@QoLz9YRH*HL{el~U(SgB(F@Qn;_Y|-_58%9!N-ZNJMsK=4#k)2FyKeKFVOhkikKTC^oOX zilHbgp7Gu=R`CR?q%NHC-;9jFzznhw1wA)n)C#bInGuWY8vxmvnVF&m%Bp8wkI@ws zm2?=nj8<`_w1}P;2JjSVx0y?>&_V|m(`p#%yCSE~w;&}zTw{z)#KbU%Crzs7TIV_U zQ=AK5zt!q4`^>{Fp<5y)3iieHzOdh!Sc`|tG)Q+gYnXkaa|_U!V5Sg6GzXQ>eV_A< zxYkGBuU^vL5-DH-zB_w0R3{k=0}@$K7ynKSIlrfY=%=8CUv7Draa{nUD2czyZ#b_|F0hs$;3Z zBDSXSHi!+e+Lu@On+2OU*6FN2UhHWrxHrx2AO?44eb$en%u$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6FG>Jp5A-E_4$3@@9^P%M=xgq|MSUSXZi5qr<{IN(4PSeWDtWH z!cc}WoDqy<6r&l#SjI7)2~1=XlbOO)rZJrv%w!g`nZsP>QOSIVw2(zCW(iAKMit9h z!Ae%Knl-E?N;Ngq5@Q|f*+3l|*+e~?X`qoNw$Mxqt+cU~ZER-;?d)V1yV=8D_M!3^ z*Yh|xaSD&}1P^l$_i`6^b0&9iC+G2q_$9#UJj5k@!5Lh@x!k~YqHvA`IhBj~iJv9J zrJN;wq)funmm4L*FH$c3q(b`302wHQWUvg8p)yQ{%Lo}Mqhz#)hmD3fHe zOp&QFO{U8XnJKemw#<>aGEXXHzATW1vPc%o5?LzCq)L{{3Rx+uxJ*{d8d)n*sg@e4 zm6)uP^|C?gWTR}7dLjf+2omBQ-sOEhvu;ZJGhV`<|r*(%#)yX=s5*~#A=m0hx1_Q+n@C#rNvToR(meo0D7bp8?K zfOJY)GGd4+Sve><$&1DB{2?}PD02-voi0!4T29OBdCN4+d^noUrd0PBvJJhmGFn@v z?$@2eg34uzYwwrUa=Mv_Ylh_{CL*zHUQe5b>+2J(xw0 zLiKI7eGRs6yB;cb;A_(T%_&o9(UTd~->TZ7VmJP#lz1!~%O7m_PW8mO`GJmtxMV?`lF-tY8Y~e3RsF^ektux%7aLDn(4-`^8Q?T9( zOuJjSt0y4X>=lZ3`YpyiC0@Q2zlM)=2O literal 0 HcmV?d00001 diff --git a/game.c b/game.c index c7a3602..d3f9da1 100644 --- a/game.c +++ b/game.c @@ -7,7 +7,9 @@ static Vector2 ball_position = {0}; static Vector2 ball_velocity = {200, 200}; -void game_frame() +void raylib_js_set_entry(void (*entry)(void)); + +void GameFrame() { BeginDrawing(); ClearBackground((Color){20, 20, 20, 255}); @@ -29,7 +31,7 @@ void game_frame() EndDrawing(); } -void game_init() +int main() { InitWindow(800, 600, "Hello, from WebAssembly"); SetTargetFPS(60); @@ -38,21 +40,14 @@ void game_init() int h = GetScreenHeight(); ball_position.x = w/2; ball_position.y = h/2; -} - -void game_over() -{ - CloseWindow(); -} -#ifndef PLATFORM_WEB -int main() -{ - game_init(); +#ifdef PLATFORM_WEB + raylib_js_set_entry(GameFrame); +#else while (!WindowShouldClose()) { - game_frame(); + GameFrame(); } - game_over(); + CloseWindow(); +#endif return 0; } -#endif diff --git a/index.html b/index.html index 3fa8632..f6bd209 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,10 @@ .not-hosted-msg .important { font-weight: bold; } + @font-face { + font-family: grixel; + src: url(fonts/acme_7_wide_xtnd.woff); + }