main
Dominik Madarász 2024-02-16 18:41:02 +01:00
parent 77af66bb2b
commit 9337fdfa6e
10 changed files with 70 additions and 45 deletions

View File

@ -681,9 +681,9 @@ typedef struct font_metrics_t {
void font_goto(float x, float y);
vec2 font_print(const char *text);
vec2 font_clip(const char *text, vec4 rect);
const char* font_wrap(const char *text, float max_width);
vec2 font_rect(const char *text);
font_metrics_t font_metrics(const char *text);
const char* font_wrap(const char *text, float max_width);
void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords);
vec2 font_highlight(const char *text, const void *colors);
void ui_font();
@ -2028,7 +2028,6 @@ enum WINDOW_FLAGS {
vec2 window_canvas();
void* window_handle();
char* window_stats();
void window_debug(bool visible);
uint64_t window_frame();
int window_width();
int window_height();
@ -2050,6 +2049,8 @@ enum WINDOW_FLAGS {
int window_has_transparent();
void window_icon(const char *file_icon);
int window_has_icon();
void window_debug(int visible);
int window_has_debug();
double window_aspect();
void window_aspect_lock(unsigned numer, unsigned denom);
void window_aspect_unlock();

View File

@ -60,7 +60,7 @@ int main() {
ddraw_grid(0);
// pan the viewport
if (input(MOUSE_L)) {
if (input(MOUSE_L) && !ui_active()) {
cursor.x += input_diff(MOUSE_X);
cursor.y += input_diff(MOUSE_Y);
}

View File

@ -14064,8 +14064,8 @@ extern "C" {
#define ENABLE_RETAIL 0 // ifdef(retail, 1, 0) ///+
#endif
#ifndef COOK_DISABLED
#define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+
#ifndef ENABLE_COOK
#define ENABLE_COOK ifdef(retail, 0, 1) ///+
#endif
#ifndef ENABLE_RPMALLOC
@ -14158,10 +14158,12 @@ extern "C" {
#define ifdef_retail ifdef_false
#endif
#if COOK_DISABLED
#define ifdef_nocook ifdef_true
#else
#if ENABLE_COOK
#define ifdef_cook ifdef_true
#define ifdef_nocook ifdef_false
#else
#define ifdef_cook ifdef_false
#define ifdef_nocook ifdef_true
#endif
#if defined NDEBUG && NDEBUG >= 3 // we use NDEBUG=[0,1,2,3] to signal the compiler optimization flags O0,O1,O2,O3
@ -16147,12 +16149,10 @@ API vec2 font_xy();
API void font_goto(float x, float y);
API vec2 font_print(const char *text);
API vec2 font_clip(const char *text, vec4 rect);
API const char* font_wrap(const char *text, float max_width);
API vec2 font_rect(const char *text);
API font_metrics_t font_metrics(const char *text);
// utilities
API const char* font_wrap(const char *text, float max_width);
// syntax highlighting
API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result.
API vec2 font_highlight(const char *text, const void *colors);
@ -18681,7 +18681,6 @@ API void window_color(unsigned color);
API vec2 window_canvas();
API void* window_handle();
API char* window_stats();
API void window_debug(bool visible);
API uint64_t window_frame();
API int window_width();
@ -18708,6 +18707,8 @@ API void window_transparent(int enabled);
API int window_has_transparent();
API void window_icon(const char *file_icon);
API int window_has_icon();
API void window_debug(int visible);
API int window_has_debug();
API double window_aspect();
API void window_aspect_lock(unsigned numer, unsigned denom);
@ -359016,10 +359017,14 @@ void collide_demo() { // debug draw collisions // @fixme: fix leaks: poly_free()
// @fixme: leaks (worth?)
// -----------------------------------------------------------------------------
#ifndef COOK_INI_PATHFILE
#define COOK_INI_PATHFILE "tools/cook.ini"
#endif
const char *ART = "art/";
const char *TOOLS = "tools/bin/";
const char *EDITOR = "tools/";
const char *COOK_INI = "tools/cook.ini";
const char *COOK_INI = COOK_INI_PATHFILE;
static unsigned ART_SKIP_ROOT; // number of chars to skip the base root in ART folder
static unsigned ART_LEN; // dupe
@ -359462,7 +359467,7 @@ static cook_worker jobs[JOBS_MAX] = {0};
static volatile bool cook_cancelable = false, cook_cancelling = false, cook_debug = false;
#ifndef COOK_ON_DEMAND
#define COOK_ON_DEMAND flag("--cook-on-demand")
#define COOK_ON_DEMAND ifdef(cook, optioni("--cook-on-demand", 1), false)
#endif
static
@ -379052,7 +379057,7 @@ int fps__timing_thread(void *arg) {
#if is(win32)
timeBeginPeriod(1);
#endif
sleep_ns( (float)tt );
sleep_ns( tt > 0 ? (float)tt : 0.f );
took += time_ns();
ns_excess = took - tt;
if( ns_excess < 0 ) ns_excess = 0;
@ -379782,9 +379787,12 @@ double window_delta() {
return dt;
}
void window_debug(bool visible) {
void window_debug(int visible) {
win_debug_visible = visible;
}
int window_has_debug() {
return win_debug_visible;
}
double window_fps() {
return fps;
@ -380119,7 +380127,7 @@ void window_setclipboard(const char *text) {
static
double window_scale() { // ok? @testme
float xscale=1.0f, yscale=1.0f;
float xscale = 1, yscale = 1;
#if !is(ems) && !is(osx) // @todo: remove silicon mac M1 hack
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
glfwGetMonitorContentScale(monitor, &xscale, &yscale);

View File

@ -33,8 +33,8 @@
#define ENABLE_RETAIL 0 // ifdef(retail, 1, 0) ///+
#endif
#ifndef COOK_DISABLED
#define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+
#ifndef ENABLE_COOK
#define ENABLE_COOK ifdef(retail, 0, 1) ///+
#endif
#ifndef ENABLE_RPMALLOC
@ -127,10 +127,12 @@
#define ifdef_retail ifdef_false
#endif
#if COOK_DISABLED
#define ifdef_nocook ifdef_true
#else
#if ENABLE_COOK
#define ifdef_cook ifdef_true
#define ifdef_nocook ifdef_false
#else
#define ifdef_cook ifdef_false
#define ifdef_nocook ifdef_true
#endif
#if defined NDEBUG && NDEBUG >= 3 // we use NDEBUG=[0,1,2,3] to signal the compiler optimization flags O0,O1,O2,O3

View File

@ -9,10 +9,14 @@
// @fixme: leaks (worth?)
// -----------------------------------------------------------------------------
#ifndef COOK_INI_PATHFILE
#define COOK_INI_PATHFILE "tools/cook.ini"
#endif
const char *ART = "art/";
const char *TOOLS = "tools/bin/";
const char *EDITOR = "tools/";
const char *COOK_INI = "tools/cook.ini";
const char *COOK_INI = COOK_INI_PATHFILE;
static unsigned ART_SKIP_ROOT; // number of chars to skip the base root in ART folder
static unsigned ART_LEN; // dupe
@ -455,7 +459,7 @@ static cook_worker jobs[JOBS_MAX] = {0};
static volatile bool cook_cancelable = false, cook_cancelling = false, cook_debug = false;
#ifndef COOK_ON_DEMAND
#define COOK_ON_DEMAND flag("--cook-on-demand")
#define COOK_ON_DEMAND ifdef(cook, optioni("--cook-on-demand", 1), false)
#endif
static

View File

@ -90,12 +90,10 @@ API vec2 font_xy();
API void font_goto(float x, float y);
API vec2 font_print(const char *text);
API vec2 font_clip(const char *text, vec4 rect);
API const char* font_wrap(const char *text, float max_width);
API vec2 font_rect(const char *text);
API font_metrics_t font_metrics(const char *text);
// utilities
API const char* font_wrap(const char *text, float max_width);
// syntax highlighting
API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result.
API vec2 font_highlight(const char *text, const void *colors);

View File

@ -17,7 +17,7 @@ int fps__timing_thread(void *arg) {
#if is(win32)
timeBeginPeriod(1);
#endif
sleep_ns( (float)tt );
sleep_ns( tt > 0 ? (float)tt : 0.f );
took += time_ns();
ns_excess = took - tt;
if( ns_excess < 0 ) ns_excess = 0;
@ -747,9 +747,12 @@ double window_delta() {
return dt;
}
void window_debug(bool visible) {
void window_debug(int visible) {
win_debug_visible = visible;
}
int window_has_debug() {
return win_debug_visible;
}
double window_fps() {
return fps;
@ -1084,7 +1087,7 @@ void window_setclipboard(const char *text) {
static
double window_scale() { // ok? @testme
float xscale=1.0f, yscale=1.0f;
float xscale = 1, yscale = 1;
#if !is(ems) && !is(osx) // @todo: remove silicon mac M1 hack
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
glfwGetMonitorContentScale(monitor, &xscale, &yscale);

View File

@ -41,7 +41,6 @@ API void window_color(unsigned color);
API vec2 window_canvas();
API void* window_handle();
API char* window_stats();
API void window_debug(bool visible);
API uint64_t window_frame();
API int window_width();
@ -68,6 +67,8 @@ API void window_transparent(int enabled);
API int window_has_transparent();
API void window_icon(const char *file_icon);
API int window_has_icon();
API void window_debug(int visible);
API int window_has_debug();
API double window_aspect();
API void window_aspect_lock(unsigned numer, unsigned denom);

View File

@ -6156,10 +6156,14 @@ void collide_demo() { // debug draw collisions // @fixme: fix leaks: poly_free()
// @fixme: leaks (worth?)
// -----------------------------------------------------------------------------
#ifndef COOK_INI_PATHFILE
#define COOK_INI_PATHFILE "tools/cook.ini"
#endif
const char *ART = "art/";
const char *TOOLS = "tools/bin/";
const char *EDITOR = "tools/";
const char *COOK_INI = "tools/cook.ini";
const char *COOK_INI = COOK_INI_PATHFILE;
static unsigned ART_SKIP_ROOT; // number of chars to skip the base root in ART folder
static unsigned ART_LEN; // dupe
@ -6602,7 +6606,7 @@ static cook_worker jobs[JOBS_MAX] = {0};
static volatile bool cook_cancelable = false, cook_cancelling = false, cook_debug = false;
#ifndef COOK_ON_DEMAND
#define COOK_ON_DEMAND flag("--cook-on-demand")
#define COOK_ON_DEMAND ifdef(cook, optioni("--cook-on-demand", 1), false)
#endif
static
@ -26192,7 +26196,7 @@ int fps__timing_thread(void *arg) {
#if is(win32)
timeBeginPeriod(1);
#endif
sleep_ns( (float)tt );
sleep_ns( tt > 0 ? (float)tt : 0.f );
took += time_ns();
ns_excess = took - tt;
if( ns_excess < 0 ) ns_excess = 0;
@ -26922,9 +26926,12 @@ double window_delta() {
return dt;
}
void window_debug(bool visible) {
void window_debug(int visible) {
win_debug_visible = visible;
}
int window_has_debug() {
return win_debug_visible;
}
double window_fps() {
return fps;
@ -27259,7 +27266,7 @@ void window_setclipboard(const char *text) {
static
double window_scale() { // ok? @testme
float xscale=1.0f, yscale=1.0f;
float xscale = 1, yscale = 1;
#if !is(ems) && !is(osx) // @todo: remove silicon mac M1 hack
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
glfwGetMonitorContentScale(monitor, &xscale, &yscale);

View File

@ -131,8 +131,8 @@ extern "C" {
#define ENABLE_RETAIL 0 // ifdef(retail, 1, 0) ///+
#endif
#ifndef COOK_DISABLED
#define COOK_DISABLED 0 // ifdef(nocook, 1, 0) ///+
#ifndef ENABLE_COOK
#define ENABLE_COOK ifdef(retail, 0, 1) ///+
#endif
#ifndef ENABLE_RPMALLOC
@ -225,10 +225,12 @@ extern "C" {
#define ifdef_retail ifdef_false
#endif
#if COOK_DISABLED
#define ifdef_nocook ifdef_true
#else
#if ENABLE_COOK
#define ifdef_cook ifdef_true
#define ifdef_nocook ifdef_false
#else
#define ifdef_cook ifdef_false
#define ifdef_nocook ifdef_true
#endif
#if defined NDEBUG && NDEBUG >= 3 // we use NDEBUG=[0,1,2,3] to signal the compiler optimization flags O0,O1,O2,O3
@ -2214,12 +2216,10 @@ API vec2 font_xy();
API void font_goto(float x, float y);
API vec2 font_print(const char *text);
API vec2 font_clip(const char *text, vec4 rect);
API const char* font_wrap(const char *text, float max_width);
API vec2 font_rect(const char *text);
API font_metrics_t font_metrics(const char *text);
// utilities
API const char* font_wrap(const char *text, float max_width);
// syntax highlighting
API void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords); // comma separated tokens. expensive, please cache result.
API vec2 font_highlight(const char *text, const void *colors);
@ -4748,7 +4748,6 @@ API void window_color(unsigned color);
API vec2 window_canvas();
API void* window_handle();
API char* window_stats();
API void window_debug(bool visible);
API uint64_t window_frame();
API int window_width();
@ -4775,6 +4774,8 @@ API void window_transparent(int enabled);
API int window_has_transparent();
API void window_icon(const char *file_icon);
API int window_has_icon();
API void window_debug(int visible);
API int window_has_debug();
API double window_aspect();
API void window_aspect_lock(unsigned numer, unsigned denom);