Skip to content

A game in simple C (with hot reload and fast compile times)

License

Notifications You must be signed in to change notification settings

TomSmeets/quest-for-nothing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quest For Nothing

Building

Install clang and sdl2, then run the build script.

./build.sh linux

See ./build.sh for more options:

Usage: ./build.sh <action> [args]...

Actions:
  run <main> [args]... Build and run with hot reloading
  watch                Build all targets and rebuild on every change
  all                  Build all targets
  linux                Build for linux
  windows              Build for windows
  web                  Build for web
  serve                Start a simple local python http server for testing the web version
  release              Build all targets in release mode
  asset                Build asset.h
  format               Format code

Examples:
  ./build.sh run src/main.c
  ./build.sh run src/hot.c watch
  ./build.sh build
  ./build.sh release
  ./build.sh asset

Building windows

For cross compiling to windows you need mingw-w64.

./build.sh windows

Running web version

For cross compiling to windows you need wasm-ld which is in the lld package on Arch Linux.

./build.sh web

To run the web version start a simple python http server after building. Then navigate to http://localhost:8000/out.

./build.sh serve

Building Manually

Any executable can be compiled with a single 'clang' call.

Each executable is compiled as a single unit, with the platform automatically detected based on the -target passed to Clang.

  • clang -o ./out/main src/main.c
  • clang -o ./out/build src/build.c

Note that you will need to generate 'asset.h' once using out/build asset when compiling the game.

Hot Reloading

Run ./out/build run src/main.c to launch the game. Edit any file, and the game will reload while preserving its state.

For GDB, launch with gdb --args ./out/build run ./src/main.c and use the dir command to update the source view when needed.

Version 1.0

I'd like to release this someday, so keeping it very simple!

Version 2.0 (ideas)

  • Android
  • Publish on Play Store
  • Time travel effects?
  • Missions: Alien hitman, Show sprite in ui, find and kill in secret.

About

A game in simple C (with hot reload and fast compile times)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages