Compare commits

..

2 commits

Author SHA1 Message Date
John Alanbrook b17e5d3917 Merge branch 'origin/test' 2024-03-24 12:44:38 -05:00
John Alanbrook 3023a12184 Add system command; correct makefile 2024-03-24 12:44:35 -05:00
7 changed files with 41 additions and 11 deletions

16
Info.plist Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Prosperon</string>
<key>CFBundleIdentifier</key>
<string>pockle.world.prosperon</string>
<key>CFBundleName</key>
<string>Prosperon</string>
<key>CFBundleVersion</key>
<string>0.5</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2024 Pockle World. All rights reserved.</string>
</dict>
</plist>

View file

@ -173,6 +173,7 @@ SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
DESTDIR ?= ~/.bin
install: $(NAME)
@echo Copying to destination
cp -f $(NAME) $(DESTDIR)/$(APP)
$(NAME): libengine$(INFO).a libquickjs$(INFO).a $(DEPS)
@ -180,14 +181,15 @@ $(NAME): libengine$(INFO).a libquickjs$(INFO).a $(DEPS)
$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
@echo Finished build
libengine$(INFO).a: $(OBJS)
libengine$(INFO).a: $(OBJS)
@echo Archiving $@
$(AR) rcs $@ $(OBJS)
QUICKJS := source/engine/thirdparty/quickjs
libquickjs$(INFO).a: $(QUICKJS)/libregexp$(INFO).o $(QUICKJS)/quickjs$(INFO).o $(QUICKJS)/libunicode$(INFO).o $(QUICKJS)/cutils$(INFO).o $(QUICKJS)/libbf$(INFO).o
$(AR) rcs $@ $^
%$(INFO).o: %.c $(SHADERS) source/engine/core.cdb.h
%$(INFO).o: %.c $(SHADERS)
@echo Making C object $@
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@ -206,6 +208,10 @@ shaders: $(SHADERS)
@echo Creating shader $^
./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
SCRIPTS := $(shell ls scripts/*.js*)
CORE != (ls icons/* fonts/*)
CORE := $(CORE) $(SCRIPTS)
CDB = source/engine/thirdparty/tinycdb
CDB_C != find $(CDB) -name *.c
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
@ -223,19 +229,15 @@ packer: tools/packer.c tools/libcdb.a
cc $^ -I$(CDB) -o packer
core.cdb: packer $(CORE)
@echo Packing core.cdb
./packer $(CORE)
chmod 644 out.cdb
mv out.cdb core.cdb
source/engine/core.cdb.h: core.cdb
@echo Packing core.cdb.h
@echo Making $@
xxd -i $< > $@
SCRIPTS := $(shell ls scripts/*.js*)
SCRIPT_O := $(addsuffix o, $(SCRIPTS))
CORE != (ls icons/* fonts/*)
CORE := $(CORE) $(SCRIPTS)
jsc: tools/jso.c tools/libquickjs.a
$(CC) $^ -lm -Iquickjs -o $@

View file

@ -37,7 +37,7 @@ qq = 'ms';
}
Object.assign(console, {
say(msg) { console.print(msg + "\n"); },
say(msg) { console.print(msg + "\n"); },
pprint(msg, lvl = 0) {
if (typeof msg === 'object')

View file

@ -37,6 +37,13 @@ os.prefpath = function() {
return otherpath[os.sys()] + "/" + (game.title ? game.title : "Untitled Prosperon Game");
}
os.openurl = function(url) {
if (os.sys() === 'windows')
os.system(`start ${url}`);
else
os.system(`open ${url}`);
}
var projectfile = ".prosperon/project.json";
Resources.is_sound = function(path) {

View file

@ -45,7 +45,7 @@ struct gameobject {
struct shape_cb *shape_cbs;
JSValue ref;
HMM_Mat4 world;
float drawlayer;
float drawlayer;
};
/*

View file

@ -809,11 +809,16 @@ JSC_SCALL(os_make_texture,
JS_SetPropertyStr(js, ret, "path", JS_DupValue(js,argv[0]));
)
JSC_SCALL(os_system,
system(str);
)
static const JSCFunctionListEntry js_os_funcs[] = {
MIST_FUNC_DEF(os,sprite,1),
MIST_FUNC_DEF(os, cwd, 0),
MIST_FUNC_DEF(os, env, 1),
MIST_FUNC_DEF(os, sys, 0),
MIST_FUNC_DEF(os, system, 1),
MIST_FUNC_DEF(os, quit, 0),
MIST_FUNC_DEF(os, reindex_static, 0),
MIST_FUNC_DEF(os, gc, 0),

View file

@ -3,7 +3,7 @@
#include "sokol/sokol_gfx.h"
#include "HandmadeMath.h"
#include "render.h"
#include "render.h"
#define TEX_SPEC 0
#define TEX_NORM 1