An open API service indexing awesome lists of open source software.

https://github.com/gilzoide/d-sokol-game

An experimental game made using D + sokol_gfx
https://github.com/gilzoide/d-sokol-game

betterc dlang meson sokol

Last synced: about 2 months ago
JSON representation

An experimental game made using D + sokol_gfx

Awesome Lists containing this project

README

        

# d-sokol-game
An experimental game made using [D](https://dlang.org/) + [sokol_gfx](https://github.com/floooh/sokol).

Currently using [GLFW](https://www.glfw.org/) for windowing with [OpenGL](https://www.opengl.org/) backend
and [Meson](https://mesonbuild.com/) for building.

Available for preview directly in your browser [here](https://gilzoide.github.io/d-sokol-game/).

## Building
First, ensure git submodules are initialized:

$ git submodule update --init

Running `sh tools/setup-all.sh` will setup the following build configurations with Meson:

- **build**: debug build, using GDC because it's currently the only compiler with support
for Makefile-style dependecy files, so incremental rebuilds are done correctly.
- **build/release**: release native build, using LDC with the `betterC` flag and
linking the executable as C, so there is no link-time or runtime dependency on
`libphobos` or `druntime`.
- **build/web**: emscripten powered WebAssembly build, using LDC with the `betterC` flag
for D code. If you encounter a compile error with the message `Error: version identifier WASI is reserved and cannot be set`,
run `sh libs/remove_wasi_version_gambi.sh` for editing some druntime files as a workaround.
- **build/release/web**: release web build, with code optimizations turned on.
- **build/release/win32**: release Windows x32 build cross-compiled using [MinGW](http://mingw.org/).
If you encounter a compile error with the message `../../../libs/druntime/src/core/stdc/stdio.d(1209): Error: undefined identifier FILE`,
run `sh libs/rename_cruntime_microsoft_mingw_gambi.sh` for editing some druntime files as a workaround.
If you encounter a compile error with the message `-m32 and -m64 switches cannot be used together with -march and -mtriple switches`,
run `sh tools/remove_mXX_cross_windows_gambi.sh` for editing the [Ninja](https://ninja-build.org/) build file as a workaround.

For building them:

$ meson compile -C build
$ meson compile -C build/release
$ meson compile -C build/web
$ meson compile -C build/release/web

## Running
For native desktop targets, just run the executable files generated by the builds.

For the web build, open a HTTP server on `build/web` or `build/release/web`, for example with [http-server](https://www.npmjs.com/package/http-server):

$ http-server build/web
$ http-server build/release/web

Then access your server address and open the HTML file.