fix linux opengl render; windows ucrt
This commit is contained in:
parent
33fdd97bdd
commit
b2a45fcfdd
46
Makefile
46
Makefile
|
@ -78,34 +78,27 @@ CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
|
||||||
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
||||||
# default, fast and medium available in game at runtime; best available in editor
|
# default, fast and medium available in game at runtime; best available in editor
|
||||||
|
|
||||||
PKGCMD = tar --directory --exclude="./*.a" --exclude="./obj" -czf $(DISTDIR)/$(DIST) .
|
|
||||||
ZIP = .tar.gz
|
|
||||||
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
|
|
||||||
|
|
||||||
INFO := $(INFO)_$(ARCH)
|
INFO := $(INFO)_$(ARCH)
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT) # then WINDOWS
|
ifeq ($(OS), Windows_NT) # then WINDOWS
|
||||||
PLATFORM := win64
|
PLATFORM := win64
|
||||||
DEPS += resource.o
|
DEPS += resource.o
|
||||||
STEAMAPI := steam_api64
|
STEAMAPI := steam_api64
|
||||||
LDFLAGS += -mwin32 -static
|
LDFLAGS += -mwin32 -static
|
||||||
CPPFLAGS += -mwin32
|
CPPFLAGS += -mwin32
|
||||||
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
|
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
|
||||||
PKGCMD = zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
|
INFO :=$(INFO)_win
|
||||||
ZIP = .zip
|
EXT = .exe
|
||||||
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
|
|
||||||
INFO :=$(INFO)_win
|
|
||||||
EXT = .exe
|
|
||||||
else ifeq ($(OS), IOS)
|
else ifeq ($(OS), IOS)
|
||||||
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
|
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
|
||||||
SDK = iphoneos
|
SDK = iphoneos
|
||||||
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDK).platform/Developer/SDKs/$(SDK).sdk
|
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDK).platform/Developer/SDKs/$(SDK).sdk
|
||||||
CFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
CFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
||||||
LDFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
LDFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
|
||||||
LDFLAGS += -framework Foundation -framework UIKit -framework AudioToolbox -framework Metal -framework MetalKit -framework AVFoundation
|
LDFLAGS += -framework Foundation -framework UIKit -framework AudioToolbox -framework Metal -framework MetalKit -framework AVFoundation
|
||||||
CXXFLAGS += -std=c++11
|
CXXFLAGS += -std=c++11
|
||||||
CFLAGS += -x objective-c -DIOS
|
CFLAGS += -x objective-c -DIOS
|
||||||
INFO :=$(INFO)_ios
|
INFO :=$(INFO)_ios
|
||||||
else ifeq ($(OS), wasm) # Then WEB
|
else ifeq ($(OS), wasm) # Then WEB
|
||||||
OS := Web
|
OS := Web
|
||||||
LDFLAGS += -sUSE_WEBGPU
|
LDFLAGS += -sUSE_WEBGPU
|
||||||
|
@ -131,8 +124,8 @@ else
|
||||||
CFLAGS += -x objective-c
|
CFLAGS += -x objective-c
|
||||||
CXXFLAGS += -std=c++11
|
CXXFLAGS += -std=c++11
|
||||||
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
|
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
|
||||||
INFO :=$(INFO)_macos
|
INFO :=$(INFO)_macos
|
||||||
STEAMAPI := steam_api
|
STEAMAPI := steam_api
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -161,9 +154,11 @@ includeflag := $(addprefix -I, $(includeflag))
|
||||||
|
|
||||||
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
|
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
|
||||||
|
|
||||||
|
# For vanilla compilation, remove _
|
||||||
ifeq ($(INFO),_)
|
ifeq ($(INFO),_)
|
||||||
INFO :=
|
INFO :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
APP = prosperon
|
APP = prosperon
|
||||||
NAME = $(APP)$(INFO)$(EXT)
|
NAME = $(APP)$(INFO)$(EXT)
|
||||||
SEM != git describe --tags --abbrev=0
|
SEM != git describe --tags --abbrev=0
|
||||||
|
@ -183,17 +178,12 @@ all: $(NAME)
|
||||||
|
|
||||||
prereqs: source/engine/core.cdb.h
|
prereqs: source/engine/core.cdb.h
|
||||||
|
|
||||||
DESTDIR ?= ~/.bin
|
|
||||||
install: $(NAME)
|
|
||||||
@echo Copying to destination
|
|
||||||
cp -f $(NAME) $(DESTDIR)/$(APP)
|
|
||||||
|
|
||||||
$(NAME): $(OBJS) $(DEPS)
|
$(NAME): $(OBJS) $(DEPS)
|
||||||
@echo Linking $(NAME)
|
@echo Linking $(NAME)
|
||||||
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
|
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
%$(INFO).o: %.c
|
%$(INFO).o: %.c prereqs
|
||||||
@echo Making C object $@
|
@echo Making C object $@
|
||||||
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
@ -257,7 +247,7 @@ crossmac: Prosperon.icns
|
||||||
cp Prosperon.icns Prosperon.app/Contents/Resources
|
cp Prosperon.icns Prosperon.app/Contents/Resources
|
||||||
|
|
||||||
crosswin:
|
crosswin:
|
||||||
make CROSS=x86_64-w64-mingw32- OS=Windows_NT CC=gcc
|
make CROSS=x86_64-w64-mingw32ucrt- OS=Windows_NT CC=gcc
|
||||||
|
|
||||||
crossweb:
|
crossweb:
|
||||||
make CC=emcc OS=wasm
|
make CC=emcc OS=wasm
|
||||||
|
|
|
@ -269,7 +269,6 @@ global.mixin("scripts/render");
|
||||||
global.mixin("scripts/debug");
|
global.mixin("scripts/debug");
|
||||||
|
|
||||||
var frame_t = profile.secs(profile.now());
|
var frame_t = profile.secs(profile.now());
|
||||||
var phys_step = 1/240;
|
|
||||||
|
|
||||||
var sim = {};
|
var sim = {};
|
||||||
sim.mode = "play";
|
sim.mode = "play";
|
||||||
|
@ -344,11 +343,11 @@ function process()
|
||||||
|
|
||||||
physlag += dt;
|
physlag += dt;
|
||||||
|
|
||||||
while (physlag > phys_step) {
|
while (physlag > physics.delta) {
|
||||||
physlag -= phys_step;
|
physlag -= physics.delta;
|
||||||
var st = profile.now();
|
var st = profile.now();
|
||||||
prosperon.phys2d_step(phys_step*game.timescale);
|
prosperon.phys2d_step(physics.delta*game.timescale);
|
||||||
prosperon.physupdate(phys_step*game.timescale);
|
prosperon.physupdate(physics.delta*game.timescale);
|
||||||
profile.addreport(profcache, "physics step", st);
|
profile.addreport(profcache, "physics step", st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ physics.gravity.strength = 500;
|
||||||
physics.damp = physics.make_damp();
|
physics.damp = physics.make_damp();
|
||||||
physics.damp.mask = ~1;
|
physics.damp.mask = ~1;
|
||||||
|
|
||||||
|
physics.delta = 1/240;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
physics
|
physics
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ render.doc = {
|
||||||
|
|
||||||
var shaderlang = {
|
var shaderlang = {
|
||||||
macos: "metal_macos",
|
macos: "metal_macos",
|
||||||
windows: "hlsl4",
|
windows: "hlsl5",
|
||||||
linux: "glsl430",
|
linux: "glsl430",
|
||||||
web: "wgsl",
|
web: "wgsl",
|
||||||
ios: "metal_ios",
|
ios: "metal_ios",
|
||||||
|
|
|
@ -793,9 +793,9 @@ sg_shader js2shader(JSValue v)
|
||||||
int atin = js_arrlen(attrs);
|
int atin = js_arrlen(attrs);
|
||||||
for (int i = 0; i < atin; i++) {
|
for (int i = 0; i < atin; i++) {
|
||||||
JSValue u = js_getpropidx(attrs, i);
|
JSValue u = js_getpropidx(attrs, i);
|
||||||
desc.attrs[i].name = js2strdup(js_getpropstr(u, "name"));
|
int slot = js2number(js_getpropstr(u, "slot"));
|
||||||
desc.attrs[i].sem_name = js2strdup(js_getpropstr(u,"sem_name"));
|
desc.attrs[slot].sem_name = js2strdup(js_getpropstr(u,"sem_name"));
|
||||||
desc.attrs[i].sem_index = js2number(js_getpropstr(u, "sem_index"));
|
desc.attrs[slot].sem_index = js2number(js_getpropstr(u, "sem_index"));
|
||||||
}
|
}
|
||||||
|
|
||||||
JSValue vsu = js_getpropstr(vs, "uniform_blocks");
|
JSValue vsu = js_getpropstr(vs, "uniform_blocks");
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#define CYAN 36
|
#define CYAN 36
|
||||||
#define WHITE 37
|
#define WHITE 37
|
||||||
|
|
||||||
#define COLOR(TXT, _C) ESC #_C "m" #TXT ESC "0m"
|
#define COLOR(TXT, _C) ESC "22;" #_C "m" #TXT ESC "0m"
|
||||||
|
|
||||||
char *logstr[] = { "spam", "debug", "info", "warn", "error", "panic"};
|
char *logstr[] = { "spam", "debug", "info", "warn", "error", "panic"};
|
||||||
char *logcolor[] = { COLOR(spam,37), COLOR(debug,32), COLOR(info,36), COLOR(warn,33), COLOR(error,31), COLOR(panic,45) };
|
char *logcolor[] = { COLOR(spam,37), COLOR(debug,32), COLOR(info,36), COLOR(warn,33), COLOR(error,31), COLOR(panic,45) };
|
||||||
|
@ -47,7 +47,6 @@ void log_init()
|
||||||
if (!fexists(".prosperon")) {
|
if (!fexists(".prosperon")) {
|
||||||
logout = tmpfile();
|
logout = tmpfile();
|
||||||
dump = tmpfile();
|
dump = tmpfile();
|
||||||
writeout = stdout;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logout = fopen(".prosperon/log.txt", "w");
|
logout = fopen(".prosperon/log.txt", "w");
|
||||||
|
@ -93,7 +92,7 @@ void mYughLog(int category, int priority, int line, const char *file, const char
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priority >= LOG_PANIC) {
|
if (priority >= LOG_ERROR) {
|
||||||
js_stacktrace();
|
js_stacktrace();
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
|
|
Loading…
Reference in a new issue