Compare commits

...

4 commits

3 changed files with 14 additions and 7 deletions

View file

@ -1,5 +1,7 @@
path:"../myou-engine/libs/packages/"
threads:on
gc:arc
out:"build/game"
@ -35,6 +37,7 @@ out:"build/game"
@if emscripten:
passL:"-o build/web/game.js"
passC:"-DGLFW_KEYMAP"
d:opengl_es
noMain:on
nimcache:"tmp/emscripten"

View file

@ -3,6 +3,7 @@
"""Use instead of `python3 -m http.server` when you need CORS and SharedArrayBuffer"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
import sys
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
@ -12,5 +13,8 @@ class CORSRequestHandler(SimpleHTTPRequestHandler):
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
return super(CORSRequestHandler, self).end_headers()
httpd = HTTPServer(('', 8003), CORSRequestHandler)
port = 8003
if len(sys.argv) > 1:
port = int(sys.argv[1])
httpd = HTTPServer(('', port), CORSRequestHandler)
httpd.serve_forever()

12
scripts/watch.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/bin/sh
# TODO: port this to nimscript
cd "$(dirname $0)/.."
@ -6,9 +6,9 @@ cd "$(dirname $0)/.."
OUT_NAME=game
MAIN_FILE=src/main.nim
MAIN_FILE_NAME=main
JSON="$HOME/.cache/nimskull/$MAIN_FILE_NAME_d/$OUT_NAME.json"
JSON="$HOME/.cache/nimskull/${MAIN_FILE_NAME}_d/$OUT_NAME.json"
function build(){
$NIM c "$MAIN_FILE" && (pkill -9 game; build/game &)
$NIM c "$@" "$MAIN_FILE" && (pkill -9 game; build/game &)
}
function file_list(){
if [ -e $JSON ]; then
@ -17,8 +17,8 @@ function file_list(){
find -iname "*.nim"
find -iname "*.blend"
}
for p in $(file_list);do echo $p;done
build
# for p in $(file_list);do echo $p;done
build "$@"
while inotifywait -e modify $(file_list) ;do
build
build "$@"
done