Windows now compiles with directx; separated out ur and entity methods
This commit is contained in:
@@ -1249,7 +1249,7 @@ JSValue duk_sys_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *ar
|
||||
break;
|
||||
|
||||
case 10:
|
||||
render_dirty = 1;
|
||||
editor_mode = js2bool(argv[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,15 +430,6 @@ void full_2d_pass(struct window *window)
|
||||
//////////// 2D projection
|
||||
cpVect pos = cam_pos();
|
||||
|
||||
#if defined SOKOL_GLCORE33 || defined SOKOL_GLES3
|
||||
projection = HMM_Orthographic_RH_ZO(
|
||||
pos.x - zoom * window->rwidth / 2,
|
||||
pos.x + zoom * window->rwidth / 2,
|
||||
pos.y + zoom * window->rheight / 2,
|
||||
pos.y - zoom * window->rheight / 2, -1.f, 1.f);
|
||||
|
||||
hudproj = HMM_Orthographic_RH_ZO(0, window->width, window->height, 0, -1.f, 1.f);
|
||||
#else
|
||||
projection = HMM_Orthographic_LH_ZO(
|
||||
pos.x - zoom * window->rwidth / 2,
|
||||
pos.x + zoom * window->rwidth / 2,
|
||||
@@ -446,7 +437,6 @@ void full_2d_pass(struct window *window)
|
||||
pos.y + zoom * window->rheight / 2, -1.f, 1.f);
|
||||
|
||||
hudproj = HMM_Orthographic_LH_ZO(0, window->rwidth, 0, window->rheight, -1.f, 1.f);
|
||||
#endif
|
||||
|
||||
sprite_draw_all();
|
||||
call_draw();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#elif __EMSCRIPTEN__
|
||||
#define SOKOL_GLES3
|
||||
#elif __WIN32
|
||||
#define SOKOL_GLCORE33
|
||||
#define SOKOL_D3D11
|
||||
#define SOKOL_WIN32_FORCE_MAIN
|
||||
#elif __APPLE__
|
||||
#define SOKOL_METAL
|
||||
|
||||
@@ -58,7 +58,6 @@ static struct d_prof prof_input;
|
||||
static struct d_prof prof_physics;
|
||||
|
||||
double physlag = 0;
|
||||
int render_dirty = 0;
|
||||
|
||||
double physMS = 1 / 60.f;
|
||||
|
||||
@@ -74,6 +73,8 @@ static float timescale = 1.f;
|
||||
|
||||
static int sim_play = SIM_PLAY;
|
||||
|
||||
static int editor_mode = 0;
|
||||
|
||||
#ifdef __TINYC__
|
||||
int backtrace(void **buffer, int size) {
|
||||
extern uint64_t *__libc_stack_end;
|
||||
@@ -168,25 +169,21 @@ static void process_frame()
|
||||
prof(&prof_physics);
|
||||
}
|
||||
|
||||
if (sim_play == SIM_STEP) {
|
||||
if (sim_play == SIM_STEP)
|
||||
sim_pause();
|
||||
render_dirty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (sim_play == SIM_PLAY || render_dirty) {
|
||||
prof_start(&prof_draw);
|
||||
window_render(&mainwin);
|
||||
prof(&prof_draw);
|
||||
render_dirty = 0;
|
||||
}
|
||||
prof_start(&prof_draw);
|
||||
window_render(&mainwin);
|
||||
prof(&prof_draw);
|
||||
|
||||
|
||||
gameobjects_cleanup();
|
||||
}
|
||||
|
||||
void c_frame()
|
||||
{
|
||||
if (sim_play != SIM_PLAY) return;
|
||||
if (editor_mode) return;
|
||||
process_frame();
|
||||
}
|
||||
|
||||
@@ -196,8 +193,6 @@ void c_clean() {
|
||||
|
||||
void c_event(const sapp_event *e)
|
||||
{
|
||||
render_dirty = 1;
|
||||
|
||||
#ifndef NO_EDITOR
|
||||
snk_handle_event(e);
|
||||
#endif
|
||||
@@ -260,7 +255,7 @@ void c_event(const sapp_event *e)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sim_play != SIM_PLAY)
|
||||
if (editor_mode)
|
||||
process_frame();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,5 @@ extern double appTime;
|
||||
extern double renderMS;
|
||||
extern double physMS;
|
||||
extern double updateMS;
|
||||
extern int render_dirty;
|
||||
|
||||
extern int editor_mode;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user