main
Dominik Madarász 2023-12-11 19:05:57 +01:00
parent 0ddc564a09
commit 0e2f086ae5
12 changed files with 67 additions and 82 deletions

View File

@ -2291,7 +2291,7 @@ SCRIPT_DEBUGGER = 2,
char * vfs_read(const char *pathfile); char * vfs_read(const char *pathfile);
char * vfs_load(const char *pathfile, int *size); char * vfs_load(const char *pathfile, int *size);
int vfs_size(const char *pathfile); int vfs_size(const char *pathfile);
void vfs_reload(); void vfs_reload();
const char * vfs_resolve(const char *fuzzyname); const char * vfs_resolve(const char *fuzzyname);
FILE* vfs_handle(const char *pathfile); FILE* vfs_handle(const char *pathfile);
void * cache_insert(const char *key, void *value, int size); void * cache_insert(const char *key, void *value, int size);

View File

@ -24,12 +24,6 @@ int main() {
ui_panel_end(); ui_panel_end();
} }
if (ui_panel("Fonts", 0)) {
ui_font();
ui_panel_end();
}
if (input_down(MOUSE_R)) { if (input_down(MOUSE_R)) {
pos.x = input(MOUSE_X); pos.x = input(MOUSE_X);
pos.y = input(MOUSE_Y); pos.y = input(MOUSE_Y);

View File

@ -16012,7 +16012,7 @@ API char * vfs_read(const char *pathfile);
API char * vfs_load(const char *pathfile, int *size); API char * vfs_load(const char *pathfile, int *size);
API int vfs_size(const char *pathfile); API int vfs_size(const char *pathfile);
API void vfs_reload(); API void vfs_reload();
API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path
//API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs
API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit
@ -16464,7 +16464,7 @@ enum {
}; };
/* errcode and errstr are optional arguments, pass NULL to ignore them, /* errcode and errstr are optional arguments, pass NULL to ignore them,
errstr is filled by va() */ errstr is filled by va() */
API int network_event(const char *msg, int *errcode, char **errstr); API int network_event(const char *msg, int *errcode, char **errstr);
enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server
@ -17397,25 +17397,25 @@ typedef struct mesh_t {
unsigned index_count; unsigned index_count;
unsigned flags; unsigned flags;
array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak
// @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing. // @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing.
union { union {
array(unsigned) in_index; array(unsigned) in_index;
array(vec3i) in_index3; array(vec3i) in_index3;
}; };
union { union {
array(unsigned) out_index; array(unsigned) out_index;
array(vec3i) out_index3; array(vec3i) out_index3;
}; };
union { union {
array(float) in_vertex; array(float) in_vertex;
array(vec3) in_vertex3; array(vec3) in_vertex3;
}; };
union { union {
array(float) out_vertex; array(float) out_vertex;
array(vec3) out_vertex3; array(vec3) out_vertex3;
}; };
} mesh_t; } mesh_t;
API mesh_t mesh(); API mesh_t mesh();
@ -17523,7 +17523,7 @@ typedef struct model_t {
handle *textures; handle *textures;
char **texture_names; char **texture_names;
array(material_t) materials; array(material_t) materials;
texture_t lightmap; texture_t lightmap;
float *lmdata; float *lmdata;
@ -17960,8 +17960,8 @@ API unsigned intern( const char *string );
API const char *quark( unsigned key ); API const char *quark( unsigned key );
typedef struct quarks_db { typedef struct quarks_db {
array(char) blob; array(char) blob;
array(vec2i) entries; array(vec2i) entries;
} quarks_db; } quarks_db;
API unsigned quark_intern( quarks_db*, const char *string ); API unsigned quark_intern( quarks_db*, const char *string );
@ -359985,14 +359985,6 @@ void ui_font() {
for( int i = 0; i < countof(fonts); ++i ) { for( int i = 0; i < countof(fonts); ++i ) {
if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) { if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) {
font_t *f = &fonts[i]; font_t *f = &fonts[i];
// changed = i+1;
// for( int j = 0; j < array_count(a->anims[i].frames); ++j ) {
// if( ui_collapse(va("[%d]",j), va("%p%d.%d", a, a->anims[i].name,j) ) ) {
// ui_unsigned("Frame", &a->anims[i].frames[j]);
// ui_atlas_frame(a->frames + a->anims[i].frames[j]);
// ui_collapse_end();
// }
// }
ui_float("Ascent", &f->ascent); ui_float("Ascent", &f->ascent);
ui_float("Descent", &f->descent); ui_float("Descent", &f->descent);
ui_float("Line Gap", &f->linegap); ui_float("Line Gap", &f->linegap);
@ -378751,6 +378743,10 @@ int ui_engine() {
} }
} }
EDITOR_UI_COLLAPSE(ICON_MD_TEXT_FIELDS " Fonts", "Debug.Fonts") {
ui_font();
}
EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") { EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") {
// @todo // @todo
@ -379430,8 +379426,9 @@ void editor_setmouse(int x, int y) {
vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) { vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
do_once { do_once {
// style: atlas size, unicode ranges and 6 font faces max // style: atlas size, unicode ranges and 6 font faces max
font_face(FONT_FACE2, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048); font_face(FONT_FACE2, "B612-Regular.ttf", 12.f, 0);
font_face(FONT_FACE3, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}}, font_face(FONT_FACE3, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048);
font_face(FONT_FACE4, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}},
// style: 10 colors max // style: 10 colors max
font_color(FONT_COLOR1, WHITE); font_color(FONT_COLOR1, WHITE);
font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY); font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY);
@ -379443,7 +379440,7 @@ vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
font_goto(x,y); font_goto(x,y);
vec2 pos = {x,y}; vec2 pos = {x,y};
const char *sym = codepoint_to_utf8(codepoint); const char *sym = codepoint_to_utf8(codepoint);
return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE3 : FONT_FACE2, sym))); return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE4 : codepoint >= ICON_MD_MIN ? FONT_FACE3 : FONT_FACE2, sym)));
} }
vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) { vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) {

View File

@ -514,8 +514,9 @@ void editor_setmouse(int x, int y) {
vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) { vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
do_once { do_once {
// style: atlas size, unicode ranges and 6 font faces max // style: atlas size, unicode ranges and 6 font faces max
font_face(FONT_FACE2, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048); font_face(FONT_FACE2, "B612-Regular.ttf", 12.f, 0);
font_face(FONT_FACE3, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}}, font_face(FONT_FACE3, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048);
font_face(FONT_FACE4, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}},
// style: 10 colors max // style: 10 colors max
font_color(FONT_COLOR1, WHITE); font_color(FONT_COLOR1, WHITE);
font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY); font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY);
@ -527,7 +528,7 @@ vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
font_goto(x,y); font_goto(x,y);
vec2 pos = {x,y}; vec2 pos = {x,y};
const char *sym = codepoint_to_utf8(codepoint); const char *sym = codepoint_to_utf8(codepoint);
return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE3 : FONT_FACE2, sym))); return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE4 : codepoint >= ICON_MD_MIN ? FONT_FACE3 : FONT_FACE2, sym)));
} }
vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) { vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) {

View File

@ -316,6 +316,10 @@ int ui_engine() {
} }
} }
EDITOR_UI_COLLAPSE(ICON_MD_TEXT_FIELDS " Fonts", "Debug.Fonts") {
ui_font();
}
EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") { EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") {
// @todo // @todo

View File

@ -68,7 +68,7 @@ API char * vfs_read(const char *pathfile);
API char * vfs_load(const char *pathfile, int *size); API char * vfs_load(const char *pathfile, int *size);
API int vfs_size(const char *pathfile); API int vfs_size(const char *pathfile);
API void vfs_reload(); API void vfs_reload();
API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path
//API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs
API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit

View File

@ -1651,14 +1651,6 @@ void ui_font() {
for( int i = 0; i < countof(fonts); ++i ) { for( int i = 0; i < countof(fonts); ++i ) {
if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) { if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) {
font_t *f = &fonts[i]; font_t *f = &fonts[i];
// changed = i+1;
// for( int j = 0; j < array_count(a->anims[i].frames); ++j ) {
// if( ui_collapse(va("[%d]",j), va("%p%d.%d", a, a->anims[i].name,j) ) ) {
// ui_unsigned("Frame", &a->anims[i].frames[j]);
// ui_atlas_frame(a->frames + a->anims[i].frames[j]);
// ui_collapse_end();
// }
// }
ui_float("Ascent", &f->ascent); ui_float("Ascent", &f->ascent);
ui_float("Descent", &f->descent); ui_float("Descent", &f->descent);
ui_float("Line Gap", &f->linegap); ui_float("Line Gap", &f->linegap);

View File

@ -38,7 +38,7 @@ enum {
}; };
/* errcode and errstr are optional arguments, pass NULL to ignore them, /* errcode and errstr are optional arguments, pass NULL to ignore them,
errstr is filled by va() */ errstr is filled by va() */
API int network_event(const char *msg, int *errcode, char **errstr); API int network_event(const char *msg, int *errcode, char **errstr);
enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server

View File

@ -394,25 +394,25 @@ typedef struct mesh_t {
unsigned index_count; unsigned index_count;
unsigned flags; unsigned flags;
array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak
// @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing. // @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing.
union { union {
array(unsigned) in_index; array(unsigned) in_index;
array(vec3i) in_index3; array(vec3i) in_index3;
}; };
union { union {
array(unsigned) out_index; array(unsigned) out_index;
array(vec3i) out_index3; array(vec3i) out_index3;
}; };
union { union {
array(float) in_vertex; array(float) in_vertex;
array(vec3) in_vertex3; array(vec3) in_vertex3;
}; };
union { union {
array(float) out_vertex; array(float) out_vertex;
array(vec3) out_vertex3; array(vec3) out_vertex3;
}; };
} mesh_t; } mesh_t;
API mesh_t mesh(); API mesh_t mesh();
@ -520,7 +520,7 @@ typedef struct model_t {
handle *textures; handle *textures;
char **texture_names; char **texture_names;
array(material_t) materials; array(material_t) materials;
texture_t lightmap; texture_t lightmap;
float *lmdata; float *lmdata;

View File

@ -86,8 +86,8 @@ API unsigned intern( const char *string );
API const char *quark( unsigned key ); API const char *quark( unsigned key );
typedef struct quarks_db { typedef struct quarks_db {
array(char) blob; array(char) blob;
array(vec2i) entries; array(vec2i) entries;
} quarks_db; } quarks_db;
API unsigned quark_intern( quarks_db*, const char *string ); API unsigned quark_intern( quarks_db*, const char *string );

View File

@ -10305,14 +10305,6 @@ void ui_font() {
for( int i = 0; i < countof(fonts); ++i ) { for( int i = 0; i < countof(fonts); ++i ) {
if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) { if( ui_collapse(va("Font %d", i), va("%p%d", &fonts[i], i) ) ) {
font_t *f = &fonts[i]; font_t *f = &fonts[i];
// changed = i+1;
// for( int j = 0; j < array_count(a->anims[i].frames); ++j ) {
// if( ui_collapse(va("[%d]",j), va("%p%d.%d", a, a->anims[i].name,j) ) ) {
// ui_unsigned("Frame", &a->anims[i].frames[j]);
// ui_atlas_frame(a->frames + a->anims[i].frames[j]);
// ui_collapse_end();
// }
// }
ui_float("Ascent", &f->ascent); ui_float("Ascent", &f->ascent);
ui_float("Descent", &f->descent); ui_float("Descent", &f->descent);
ui_float("Line Gap", &f->linegap); ui_float("Line Gap", &f->linegap);
@ -29071,6 +29063,10 @@ int ui_engine() {
} }
} }
EDITOR_UI_COLLAPSE(ICON_MD_TEXT_FIELDS " Fonts", "Debug.Fonts") {
ui_font();
}
EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") { EDITOR_UI_COLLAPSE(ICON_MD_CONTENT_PASTE " Scripts", "Debug.Scripts") {
// @todo // @todo
@ -29750,8 +29746,9 @@ void editor_setmouse(int x, int y) {
vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) { vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
do_once { do_once {
// style: atlas size, unicode ranges and 6 font faces max // style: atlas size, unicode ranges and 6 font faces max
font_face(FONT_FACE2, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048); font_face(FONT_FACE2, "B612-Regular.ttf", 12.f, 0);
font_face(FONT_FACE3, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}}, font_face(FONT_FACE3, "MaterialIconsSharp-Regular.otf", 24.f, FONT_EM|FONT_2048);
font_face(FONT_FACE4, "materialdesignicons-webfont.ttf", 24.f, FONT_EM|FONT_2048); // {0xF68C /*ICON_MDI_MIN*/, 0xF1CC7/*ICON_MDI_MAX*/, 0}},
// style: 10 colors max // style: 10 colors max
font_color(FONT_COLOR1, WHITE); font_color(FONT_COLOR1, WHITE);
font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY); font_color(FONT_COLOR2, RGBX(0xE8F1FF,128)); // GRAY);
@ -29763,7 +29760,7 @@ vec2 editor_glyph(int x, int y, const char *style, unsigned codepoint) {
font_goto(x,y); font_goto(x,y);
vec2 pos = {x,y}; vec2 pos = {x,y};
const char *sym = codepoint_to_utf8(codepoint); const char *sym = codepoint_to_utf8(codepoint);
return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE3 : FONT_FACE2, sym))); return add2(pos, font_print(va("%s%s%s", style ? style : "", codepoint >= ICON_MDI_MIN ? FONT_FACE4 : codepoint >= ICON_MD_MIN ? FONT_FACE3 : FONT_FACE2, sym)));
} }
vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) { vec2 editor_glyphs(int x, int y, const char *style, const char *utf8) {

View File

@ -2079,7 +2079,7 @@ API char * vfs_read(const char *pathfile);
API char * vfs_load(const char *pathfile, int *size); API char * vfs_load(const char *pathfile, int *size);
API int vfs_size(const char *pathfile); API int vfs_size(const char *pathfile);
API void vfs_reload(); API void vfs_reload();
API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path API const char * vfs_resolve(const char *fuzzyname); // guess best match. @todo: fuzzy path
//API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs //API const char*vfs_extract(const char *pathfile); // extracts vfs file into local filesystem (temporary file), so it can be read by foreign/3rd party libs
API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit API FILE* vfs_handle(const char *pathfile); // same as above, but returns file handle instead. preferred way, will clean descriptors at exit
@ -2531,7 +2531,7 @@ enum {
}; };
/* errcode and errstr are optional arguments, pass NULL to ignore them, /* errcode and errstr are optional arguments, pass NULL to ignore them,
errstr is filled by va() */ errstr is filled by va() */
API int network_event(const char *msg, int *errcode, char **errstr); API int network_event(const char *msg, int *errcode, char **errstr);
enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server enum { NETWORK_RANK = 0 }; // [0..N] where 0 is server
@ -3464,25 +3464,25 @@ typedef struct mesh_t {
unsigned index_count; unsigned index_count;
unsigned flags; unsigned flags;
array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak array(int) lod_collapse_map; // to which neighbor each vertex collapses. ie, [10] -> 7 (used by LODs) @leak
// @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing. // @leaks: following members are totally unused. convenient for end-users to keep their custom datas somewhere while processing.
union { union {
array(unsigned) in_index; array(unsigned) in_index;
array(vec3i) in_index3; array(vec3i) in_index3;
}; };
union { union {
array(unsigned) out_index; array(unsigned) out_index;
array(vec3i) out_index3; array(vec3i) out_index3;
}; };
union { union {
array(float) in_vertex; array(float) in_vertex;
array(vec3) in_vertex3; array(vec3) in_vertex3;
}; };
union { union {
array(float) out_vertex; array(float) out_vertex;
array(vec3) out_vertex3; array(vec3) out_vertex3;
}; };
} mesh_t; } mesh_t;
API mesh_t mesh(); API mesh_t mesh();
@ -3590,7 +3590,7 @@ typedef struct model_t {
handle *textures; handle *textures;
char **texture_names; char **texture_names;
array(material_t) materials; array(material_t) materials;
texture_t lightmap; texture_t lightmap;
float *lmdata; float *lmdata;
@ -4027,8 +4027,8 @@ API unsigned intern( const char *string );
API const char *quark( unsigned key ); API const char *quark( unsigned key );
typedef struct quarks_db { typedef struct quarks_db {
array(char) blob; array(char) blob;
array(vec2i) entries; array(vec2i) entries;
} quarks_db; } quarks_db;
API unsigned quark_intern( quarks_db*, const char *string ); API unsigned quark_intern( quarks_db*, const char *string );