diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2a3b61c..b039210 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,11 +8,16 @@ }, "runArgs": [ "--name=jelly-rescue-dev-cont", - "--net=host" + "--net=host", + "--privileged", + "--volume", "/tmp/.X11-unix:/tmp/.X11-unix", + "--env", "DISPLAY=${localEnv:DISPLAY}" ], "workspaceFolder": "/app", "mounts": [ - "source=./src,target=/app/src,type=bind" + "source=./src,target=/app/src,type=bind", + "source=./scripts,target=/app/scripts,type=bind", + "source=./dist,target=/app/dist,type=bind" ], "customizations": { "vscode": { @@ -24,6 +29,4 @@ ] } }, - // "postCreateCommand": "/app/scripts/emsdk_setup.sh", - //"postStartCommand": "/app/scripts/emsdk_activate.sh" } diff --git a/Dockerfile b/Dockerfile index 0628e8f..f07aa5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,6 @@ FROM gcc:latest as base -# RUN apt-get install cmake \ - # && rm -rf /var/cache/apt/* - - FROM base as development -# RUN apt-get update \ -# && apt-get install -y entr \ -# && rm -rf /var/cache/apt/* RUN apt-get update \ && apt-get install -y \ @@ -28,8 +21,8 @@ RUN chown -R dev:dev /app RUN echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev && \ chmod 0440 /etc/sudoers.d/dev -COPY scripts ./scripts -RUN chmod +x /app/scripts/*.sh +# COPY scripts ./scripts +# RUN chmod +x /app/scripts/*.sh USER dev SHELL ["/bin/bash", "-c"] @@ -48,13 +41,11 @@ RUN git clone https://github.com/raysan5/raylib.git raylib \ && mkdir build && cd build \ && cmake -DBUILD_SHARED_LIBS=ON .. \ && make \ - && sudo make install + && sudo make install \ + && cd .. -# RUN git clone https://github.com/raysan5/raylib.git raylib \ -# && cd raylib \ -# && mkdir build && cd build \ -# && cmake -DBUILD_SHARED_LIBS=ON .. \ -# && make \ -# && make install +# RUN mkdir dist + +ENV LD_LIBRARY_PATH=/app/raylib/build/raylib CMD ["bash"] diff --git a/scripts/build_and_run_project.sh b/scripts/build_and_run_project.sh index daa81bf..e2c5247 100755 --- a/scripts/build_and_run_project.sh +++ b/scripts/build_and_run_project.sh @@ -1,4 +1,4 @@ #!/bin/bash clear -g++ src/main.cpp -o dist/websort_cpp -./dist/websort_cpp +g++ src/main.cpp -o dist/jelly_rescue -L$LD_LIBRARY_PATH -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 +./dist/jelly_rescue diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..ef708f7 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,22 @@ +#include "raylib.h" + +int main() { + // Initialize window + InitWindow(800, 600, "Raylib + Emscripten Test"); + + // Main game loop + while (!WindowShouldClose()) { + // Update (empty for now) + + // Draw + BeginDrawing(); + ClearBackground(RAYWHITE); + DrawText("Hello, Raylib on WebAssembly!", 190, 200, 20, DARKGRAY); + EndDrawing(); + } + + // Close window + CloseWindow(); + + return 0; +} \ No newline at end of file