Skip to content

Repository files navigation

rectsmash

Simple breakout clone with powerups

Development

Use CMake to set up the project, which also downloads dependencies such as Raylib.

$ cmake --preset debug

Once the project is set up, you can either keep recompiling the game manually after changing the source code, or running the Python script build.py with the argument dev to enable hot-reloading.

$ python3 build.py dev

If you don't have Python installed, or don't need hot reloading, simply build using CMake:

$ cmake --build --preset debug

Release

This project uses CPack to prepare release bundles for the game. To do bundle a release using CPack, you'll need to first make sure to generate the build files using the release preset:

$ cmake --preset release

Once the release preset is set up, simply build the bundle target using CMake -- no need to invoke CPack directly:

$ cmake --build --preset release --target bundle

Web Releases

Releasing for the web requires the use of a specific CMake preset called web-release, and this preset requires you to have Emscripten-related binaries and environment variables on your terminal.

To do this, install emsdk from the following repository: https://github.com/emscripten-core/emsdk/

Then, use the emsdk_env script to load the Emscripten environment variables to your shell session:

Windows - Command Prompt

> path\to\emsdk\emsdk_env.bat

Windows - Powershell

> path\to\emsdk\emsdk_env.ps1

macOS, Linux, BSD

> path/to/emsdk/emsdk_env.sh

Once Emscripten is activated, the rest of the process is the same as native releases.

$ cmake --preset web-release
$ cmake --build --preset web-release

If you wish to bundle it as a zip file instead:

$ cmake --build --preset web-release --target bundle

Running the Web Release

Due to how browsers restrict the loading of local files when an HTML file is being displayed, simply opening the index.html file will not let you play the game.

Instead, you'll have to run a web server capable of serving static files, and host your index.html as well as assets from there.

If you have Python installed, the easiest way to do it would be to use the http.server module to run a local file server.

$ cd bin/web-release

# hosts the file server on port 8000
# after running this command, you can visit http://localhost:8000 to play the game
$ python3 -m http.server 8000

Credits

LLM Use Disclosure

No LLM-generated code was used in this codebase directly, and every single line of code has been hand-written.

However, the assistance of LLMs (mostly Gemini, and very little Claude) were used during the development processs in the following manner:

  • To review and vet hand-written code
  • To consult about whether an approach taken in the codebase is idomatic, and if there are better alternatives
  • To ask for example CMake configurations to use as reference
  • To use as a documentation tool for macOS frameworks such as Cocoa
  • To troubleshoot compilation, build and bundling errors

License

MIT

About

Simple breakout clone with powerups

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages