86 lines
2.4 KiB
Markdown
86 lines
2.4 KiB
Markdown
|
|
||
|
# Template project for Myou Engine
|
||
|
|
||
|
## Features
|
||
|
|
||
|
* A `nim.cfg` ready to compile to desktop, Android, iOS, and web through
|
||
|
Emscripten.
|
||
|
* Helper scripts for using the C files for Android and iOS (in Android Studio
|
||
|
and XCode respectively).
|
||
|
* A `game.html` file with just a canvas that fills the whole window.
|
||
|
* A simple python server that supports CORS (so you can load assets remotely),
|
||
|
and COOP/COEP (so multithreaded Emscripten builds can work).
|
||
|
* An empty `example.blend` that is just a default cube saved in Blender 4.1.
|
||
|
|
||
|
## How to use
|
||
|
|
||
|
* Have the code of Myou Engine somewhere. In this example it expects it to be in
|
||
|
`../myou-engine` (that is, in the parent folder of this project).
|
||
|
|
||
|
* If you have the engine somewhere other than `../myou-engine`, change the path
|
||
|
in `nim.cfg`. For example, if you have it in `./libs/myou_engine`, then change
|
||
|
this:
|
||
|
|
||
|
`path:"../myou-engine/libs/packages"`
|
||
|
|
||
|
by this:
|
||
|
|
||
|
`path:"./libs/myou_engine/libs/packages"`
|
||
|
|
||
|
Note that we add `/libs/packages` so that the engine can use all of its
|
||
|
dependencies without relying on a package manager.
|
||
|
|
||
|
* Have [Nimskull](https://github.com/nim-works/nimskull) installed in your path
|
||
|
(here we'll assume it's just `nim`). In the future it will work with Nim (and
|
||
|
other languages as well) through a built version of the engine.
|
||
|
|
||
|
### Desktop version
|
||
|
|
||
|
* To compile and run for desktop just run
|
||
|
|
||
|
`nim c -r src/main.nim`
|
||
|
|
||
|
The output will be in `build/game.exe` or `build/game`.
|
||
|
|
||
|
* To compile a Windows version from Linux or MacOS, run:
|
||
|
|
||
|
`nim c -d:mingw src/main.nim`
|
||
|
|
||
|
You can add `-r` to run it, it will try to use Wine if you have it
|
||
|
installed.
|
||
|
|
||
|
### Web version
|
||
|
|
||
|
* To compile a web version with Emscripten, run:
|
||
|
|
||
|
`nim c -d:emscripten src/main.nim`
|
||
|
|
||
|
Output files will be in `build/web/`
|
||
|
|
||
|
* Run `python scripts/simple.server.py`
|
||
|
|
||
|
* Open http://localhost:8003/build/web/game.html
|
||
|
|
||
|
### Mobile version
|
||
|
|
||
|
* To compile it for Android:
|
||
|
|
||
|
`nim c --os:android --cpu:arm64 src/main.nim`
|
||
|
|
||
|
Output C files will be in `tmp/android/`
|
||
|
|
||
|
_(TODO: instructions on how to use files in Android Studio)_
|
||
|
|
||
|
* To compile it for iOS:
|
||
|
|
||
|
`nim c --os:ios src/main.nim`
|
||
|
|
||
|
Output C files will be in `tmp/android/`
|
||
|
|
||
|
_(TODO: instructions on how to use files in XCode)_
|
||
|
|
||
|
## License
|
||
|
|
||
|
Add your own license and replace this text. Until then you can consider this
|
||
|
CC0. You can use the files in this repository for any purpose whatsoever.
|