Bunch of improvements - #6
Open
siddharthroy12 wants to merge 6 commits into
Open
Conversation
siddharthroy12
commented
Jul 23, 2026
- Uses cmake instead of make
- Uses raylib submodule instead of storing binary in the repo.
- Can compile to Mac, Linux and Windows.
- Fixed rendering issue on Mac.
- Added support for web.
- Added CI/CD pipeline to build the project for web, mac, linux, and windows.
Replace the vendored raylib static libraries and headers with a git submodule (external/raylib, pinned to tag 6.0), and build the project with CMake instead of the hand-written Makefile. - Add CMakeLists.txt that builds raylib from the submodule and links it into cTetris; preserves the release/debug flags and the Windows resource/icon + -mwindows handling from the old Makefile. - Add cmake/toolchain-mingw64.cmake for cross-compiling Windows builds. - Add run.sh to configure, build, and launch in one step. - Remove lib/, lib_win/, and the vendored raylib.h/raymath.h/rlgl.h. - Update README build instructions for CMake + submodule, .clangd for the new header path, and add .gitignore for build dirs. Also make the game window resizable and lay the UI out against the true drawable size, which fixes the UI being clipped on HiDPI (Retina) displays: - Set FLAG_WINDOW_RESIZABLE and recompute the whole layout (reloading fonts at the new sizes) whenever the window is resized, preserving game and score state. - Issue a one-shot startup resize a few frames in so the framebuffer resize event fires and the GL viewport gets corrected, so the layout fills the window correctly on first launch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Build for the browser with `emcmake cmake -B build-web && cmake --build build-web`, producing cTetris.html/.js/.wasm. raylib is compiled for PLATFORM_WEB automatically under emcmake. - CMakeLists.txt: on Emscripten, output an .html page via a custom shell, enable ALLOW_MEMORY_GROWTH, use gnu C mode (raylib's miniaudio needs EM_ASM), and drop the `-s` strip flag (a settings prefix under emcc). - main.c: drive the loop with emscripten_set_main_loop() on the web (the browser owns the loop) and persist the high score whenever it improves, since the web loop never returns to save at exit. - score.c: store the high score in localStorage on the web instead of the (non-persistent) virtual filesystem. - renderer.c: skip SetTargetFPS() and WindowShouldClose() on the web; both call emscripten_sleep(), which would require ASYNCIFY. The browser drives the frame rate via requestAnimationFrame instead. - web/shell.html: minimal self-contained page hosting the canvas. - README: web build/run instructions and prerequisites. Verified in-browser: renders correctly and takes keyboard input. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- desktop-linux: native build on ubuntu-latest (installs the raylib X11/OpenGL deps), uploads build/cTetris as an artifact. - web: WebAssembly build via emscripten (setup-emsdk), uploads the cTetris.html/.js/.wasm bundle. - deploy-pages: publishes the web build to GitHub Pages on the default branch. The raylib submodule is fetched via actions/checkout submodules: recursive. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- desktop-macos: native build on macos-latest, uploads cTetris. - desktop-windows: cross-compiled from Linux with mingw-w64 using the cmake/toolchain-mingw64.cmake toolchain file, uploads cTetris.exe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
raylib's CMakeLists enables the C++ language, so CMake was falling back to the host's /usr/bin/c++ for the CXX compiler test and failing when it hit mingw's Windows link flags. Point CMAKE_CXX_COMPILER at x86_64-w64-mingw32-g++ in the toolchain file, and install g++-mingw-w64-x86-64 in the CI job. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tmpstpdwn
reviewed
Jul 23, 2026
Author
2026-07-23.18-43-38.mov |
Owner
|
Thanks for the PR. I don't intend to change the build system or merge most of the proposed changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.