gitify last commit
parent
616ade56d7
commit
3008fb5b65
35
bind/v4k.lua
35
bind/v4k.lua
|
@ -1119,15 +1119,15 @@ ffi.cdef([[
|
||||||
//lcpp INF [0000] vec3: macro name but used as C declaration in: poly diamond(vec3 from, vec3 to, float size);
|
//lcpp INF [0000] vec3: macro name but used as C declaration in: poly diamond(vec3 from, vec3 to, float size);
|
||||||
//lcpp INF [0000] vec3: macro name but used as C declaration in: poly diamond(vec3 from, vec3 to, float size);
|
//lcpp INF [0000] vec3: macro name but used as C declaration in: poly diamond(vec3 from, vec3 to, float size);
|
||||||
//lcpp INF [0000] map: macro name but used as C declaration in:typedef struct { map base; struct { pair p; char* key; char* val; } tmp, *ptr; char** tmpval; int (*typed_cmp)(char*, char*); uint64_t (*typed_hash)(char*); } * ini_t;
|
//lcpp INF [0000] map: macro name but used as C declaration in:typedef struct { map base; struct { pair p; char* key; char* val; } tmp, *ptr; char** tmpval; int (*typed_cmp)(char*, char*); uint64_t (*typed_hash)(char*); } * ini_t;
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_xy();
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_xy();
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_xy();
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_xy();
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_xy();
|
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_xy();
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_print(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_print(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_print(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_print(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_print(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_print(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_rect(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_rect(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_rect(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_rect(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_rect(const char *text);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_rect(const char *text);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_highlight(const char *text, const void *colors);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 font_highlight(const char *text, const void *colors);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_highlight(const char *text, const void *colors);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 font_highlight(const char *text, const void *colors);
|
||||||
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_highlight(const char *text, const void *colors);
|
//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 font_highlight(const char *text, const void *colors);
|
||||||
|
@ -2323,15 +2323,22 @@ FONT_TH =2097152,
|
||||||
FONT_VI =4194304,
|
FONT_VI =4194304,
|
||||||
FONT_CJK = FONT_ZH|FONT_JP|FONT_KR,
|
FONT_CJK = FONT_ZH|FONT_JP|FONT_KR,
|
||||||
};
|
};
|
||||||
|
typedef struct font_metrics_t {
|
||||||
|
float ascent;
|
||||||
|
float descent;
|
||||||
|
float linegap;
|
||||||
|
float linedist;
|
||||||
|
} font_metrics_t;
|
||||||
void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
||||||
void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
||||||
void font_scales(const char *face_tag, float h1, float h2, float h3, float h4, float h5, float h6);
|
void font_scales(const char *face_tag, float h1, float h2, float h3, float h4, float h5, float h6);
|
||||||
void font_color(const char *color_tag, uint32_t color);
|
void font_color(const char *color_tag, uint32_t color);
|
||||||
void ui_font();
|
void ui_font();
|
||||||
vec2 font_xy();
|
vec2 font_xy();
|
||||||
void font_goto(float x, float y);
|
void font_goto(float x, float y);
|
||||||
vec2 font_print(const char *text);
|
vec2 font_print(const char *text);
|
||||||
vec2 font_rect(const char *text);
|
vec2 font_rect(const char *text);
|
||||||
|
font_metrics_t font_metrics(const char *text);
|
||||||
void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords);
|
void* font_colorize(const char *text, const char *comma_types, const char *comma_keywords);
|
||||||
vec2 font_highlight(const char *text, const void *colors);
|
vec2 font_highlight(const char *text, const void *colors);
|
||||||
int input_use( int controller_id );
|
int input_use( int controller_id );
|
||||||
|
@ -3342,7 +3349,7 @@ unsigned play;
|
||||||
bool paused;
|
bool paused;
|
||||||
struct atlas_t *a;
|
struct atlas_t *a;
|
||||||
} sprite_t;
|
} sprite_t;
|
||||||
enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3963)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3963)___COUNTER__;;
|
enum { OBJTYPE_sprite_t = 10 }; typedef struct { unsigned static_assert_on_L__LINE__ : !!(10 <= 255); } static_assert_on_Lconcat(_L,3971)___COUNTER__; typedef struct { unsigned static_assert_on_L__LINE__ : !!(sizeof(sprite_t)); } static_assert_on_Lconcat(_L,3971)___COUNTER__;;
|
||||||
void sprite_ctor(sprite_t *s);
|
void sprite_ctor(sprite_t *s);
|
||||||
void sprite_dtor(sprite_t *s);
|
void sprite_dtor(sprite_t *s);
|
||||||
void sprite_tick(sprite_t *s);
|
void sprite_tick(sprite_t *s);
|
||||||
|
|
|
@ -16115,6 +16115,13 @@ enum FONT_FLAGS {
|
||||||
// FONT_DEFAULTS = FONT_512 | FONT_NO_OVERSAMPLE | FONT_ASCII,
|
// FONT_DEFAULTS = FONT_512 | FONT_NO_OVERSAMPLE | FONT_ASCII,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct font_metrics_t {
|
||||||
|
float ascent; // max distance above baseline for all glyphs
|
||||||
|
float descent; // max distance below baseline for all glyphs
|
||||||
|
float linegap; // distance betwen ascent of next line and descent of current line
|
||||||
|
float linedist; // distance between the baseline of two lines (ascent - descent + linegap)
|
||||||
|
} font_metrics_t;
|
||||||
|
|
||||||
// configures
|
// configures
|
||||||
API void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
API void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
||||||
API void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
API void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
||||||
|
@ -16123,10 +16130,11 @@ API void font_color(const char *color_tag, uint32_t color);
|
||||||
API void ui_font();
|
API void ui_font();
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
API vec2 font_xy();
|
API vec2 font_xy();
|
||||||
API void font_goto(float x, float y);
|
API void font_goto(float x, float y);
|
||||||
API vec2 font_print(const char *text);
|
API vec2 font_print(const char *text);
|
||||||
API vec2 font_rect(const char *text);
|
API vec2 font_rect(const char *text);
|
||||||
|
API font_metrics_t font_metrics(const char *text);
|
||||||
// void font_clip(vec2 topleft, vec2 bottomright);
|
// void font_clip(vec2 topleft, vec2 bottomright);
|
||||||
// void font_wrap(vec2 topleft, vec2 bottomright);
|
// void font_wrap(vec2 topleft, vec2 bottomright);
|
||||||
|
|
||||||
|
@ -360722,6 +360730,37 @@ vec2 font_highlight(const char *text, const void *colors) {
|
||||||
vec2 font_rect(const char *str) {
|
vec2 font_rect(const char *str) {
|
||||||
return font_draw_ex(str, gotoxy, NULL, NULL);
|
return font_draw_ex(str, gotoxy, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
font_metrics_t font_metrics(const char *text) {
|
||||||
|
font_metrics_t m={0};
|
||||||
|
int S = 3;
|
||||||
|
font_t *f = &fonts[0];
|
||||||
|
|
||||||
|
// utf8 to utf32
|
||||||
|
array(uint32_t) unicode = string32(text);
|
||||||
|
|
||||||
|
// parse string
|
||||||
|
for( int i = 0, end = array_count(unicode); i < end; ++i ) {
|
||||||
|
uint32_t ch = unicode[i];
|
||||||
|
if( ch >= 1 && ch <= 6 ) {
|
||||||
|
S = ch;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( ch >= 0x1a && ch <= 0x1f ) {
|
||||||
|
if( fonts[ ch - 0x1a ].initialized) {
|
||||||
|
// change face
|
||||||
|
f = &fonts[ ch - 0x1a ];
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.ascent = f->ascent*f->factor*f->scale[S];
|
||||||
|
m.descent = f->descent*f->factor*f->scale[S];
|
||||||
|
m.linegap = f->linegap*f->factor*f->scale[S];
|
||||||
|
m.linedist = f->linedist*f->factor*f->scale[S];
|
||||||
|
return m;
|
||||||
|
}
|
||||||
#line 0
|
#line 0
|
||||||
|
|
||||||
#line 1 "v4k_gui.c"
|
#line 1 "v4k_gui.c"
|
||||||
|
|
|
@ -2396,3 +2396,34 @@ vec2 font_highlight(const char *text, const void *colors) {
|
||||||
vec2 font_rect(const char *str) {
|
vec2 font_rect(const char *str) {
|
||||||
return font_draw_ex(str, gotoxy, NULL, NULL);
|
return font_draw_ex(str, gotoxy, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
font_metrics_t font_metrics(const char *text) {
|
||||||
|
font_metrics_t m={0};
|
||||||
|
int S = 3;
|
||||||
|
font_t *f = &fonts[0];
|
||||||
|
|
||||||
|
// utf8 to utf32
|
||||||
|
array(uint32_t) unicode = string32(text);
|
||||||
|
|
||||||
|
// parse string
|
||||||
|
for( int i = 0, end = array_count(unicode); i < end; ++i ) {
|
||||||
|
uint32_t ch = unicode[i];
|
||||||
|
if( ch >= 1 && ch <= 6 ) {
|
||||||
|
S = ch;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if( ch >= 0x1a && ch <= 0x1f ) {
|
||||||
|
if( fonts[ ch - 0x1a ].initialized) {
|
||||||
|
// change face
|
||||||
|
f = &fonts[ ch - 0x1a ];
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.ascent = f->ascent*f->factor*f->scale[S];
|
||||||
|
m.descent = f->descent*f->factor*f->scale[S];
|
||||||
|
m.linegap = f->linegap*f->factor*f->scale[S];
|
||||||
|
m.linedist = f->linedist*f->factor*f->scale[S];
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,13 @@ enum FONT_FLAGS {
|
||||||
// FONT_DEFAULTS = FONT_512 | FONT_NO_OVERSAMPLE | FONT_ASCII,
|
// FONT_DEFAULTS = FONT_512 | FONT_NO_OVERSAMPLE | FONT_ASCII,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct font_metrics_t {
|
||||||
|
float ascent; // max distance above baseline for all glyphs
|
||||||
|
float descent; // max distance below baseline for all glyphs
|
||||||
|
float linegap; // distance betwen ascent of next line and descent of current line
|
||||||
|
float linedist; // distance between the baseline of two lines (ascent - descent + linegap)
|
||||||
|
} font_metrics_t;
|
||||||
|
|
||||||
// configures
|
// configures
|
||||||
API void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
API void font_face(const char *face_tag, const char *filename_ttf, float font_size, unsigned flags);
|
||||||
API void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
API void font_face_from_mem(const char *tag, const void *ttf_buffer, unsigned ttf_len, float font_size, unsigned flags);
|
||||||
|
@ -78,10 +85,11 @@ API void font_color(const char *color_tag, uint32_t color);
|
||||||
API void ui_font();
|
API void ui_font();
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
API vec2 font_xy();
|
API vec2 font_xy();
|
||||||
API void font_goto(float x, float y);
|
API void font_goto(float x, float y);
|
||||||
API vec2 font_print(const char *text);
|
API vec2 font_print(const char *text);
|
||||||
API vec2 font_rect(const char *text);
|
API vec2 font_rect(const char *text);
|
||||||
|
API font_metrics_t font_metrics(const char *text);
|
||||||
// void font_clip(vec2 topleft, vec2 bottomright);
|
// void font_clip(vec2 topleft, vec2 bottomright);
|
||||||
// void font_wrap(vec2 topleft, vec2 bottomright);
|
// void font_wrap(vec2 topleft, vec2 bottomright);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue