Norx is a Nim wrapper of the ORX game engine library. ORX is written in C99 and highly performant and cross platform. The wrapper basically consists of one Nim module per ORX C header, almost 80 of them.
The only things you need to compile a Nim ORX game is this Nimble module and the ORX dynamic library files (liborx[p|d].so|dll
) in a proper library path.
However, for debugging etc it's more practical to also have the full ORX clone with ORX C sources etc.
First install ORX dlls. At the moment best is to build them from a master git clone of ORX since it is in sync with the wrapper.
This works on my Ubuntu 64 bit (after installing normal C tools needed):
- Clone ORX with
git clone https://github.com/orx/orx.git
. - Run
setup.sh
in top level first, this pulls down more dependencies. - Build with
cd code/build/linux/gmake && make config=release64
(build alsodebug64
andprofile64
to get those extra libraries) - Copy libraries to a library path with for example
cp -a ../../../bin/liborx*.so /usr/lib/
For other platforms, or if you get into trouble, follow official ORX instructions that give much more details!
Easiest is to use Choosenim curl https://nim-lang.org/choosenim/init.sh -sSf | sh
or see Official download.
Install the Norx wrapper by running nimble install
in this directory.
See samples
directory for some samples using it!
This wrapper was created through the following steps:
- Run
convert.nim
in this directory that usescommon.c2nim
. - Modifications to the original header files using
ifdefs
. - Eventually "abandon all hope" and start editing the generated Nim files manually.
Unfortunately this means that at this moment (due to step 3 above), updates to ORX header files does not mean we can just regenerate this wrapper automagically.
These are notes to "self". We track any changes to the include
directory, for example if orxObject.h
changes:
cd headers
cp ../../../include/object/orxObject.h object/orxObject.h
- Using your IDE, reapply modifications that was overwritten :) - this should be handled better of course.
c2nim common.c2nim object/orxObject.h
to reproduceorxObject.nim
- Merge parts into
obj.nim
that should be there usingmeld object/orxObject.nim ../src/norx/obj.nim