Changed gDjuiFonts to an array of pointers (possible Mac compilation fix
This commit is contained in:
parent
0b819c01e9
commit
c18413ed2a
|
@ -92,7 +92,7 @@ static const struct DjuiFont sDjuiFontTitle = {
|
|||
// font list //
|
||||
///////////////
|
||||
|
||||
struct DjuiFont gDjuiFonts[] = {
|
||||
sDjuiFontNormal,
|
||||
sDjuiFontTitle,
|
||||
const struct DjuiFont* gDjuiFonts[] = {
|
||||
&sDjuiFontNormal,
|
||||
&sDjuiFontTitle,
|
||||
};
|
|
@ -14,4 +14,4 @@ struct DjuiFont {
|
|||
f32 (*char_width)(char);
|
||||
};
|
||||
|
||||
extern struct DjuiFont gDjuiFonts[];
|
||||
extern const struct DjuiFont* gDjuiFonts[];
|
|
@ -68,8 +68,8 @@ static void djui_inputbox_on_hover_end(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
static u16 djui_inputbox_get_cursor_index(struct DjuiInputbox* inputbox) {
|
||||
struct DjuiBaseRect* comp = &inputbox->base.comp;
|
||||
struct DjuiFont* font = &gDjuiFonts[0];
|
||||
struct DjuiBaseRect* comp = &inputbox->base.comp;
|
||||
const struct DjuiFont* font = gDjuiFonts[0];
|
||||
|
||||
f32 cX = (gCursorX - (comp->x + inputbox->viewX)) / font->defaultFontScale;
|
||||
f32 x = 0;
|
||||
|
@ -364,8 +364,8 @@ static void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
|
|||
}
|
||||
|
||||
static void djui_inputbox_render_char(struct DjuiInputbox* inputbox, char c, f32* drawX, f32* additionalShift) {
|
||||
struct DjuiBaseRect* comp = &inputbox->base.comp;
|
||||
struct DjuiFont* font = &gDjuiFonts[0];
|
||||
struct DjuiBaseRect* comp = &inputbox->base.comp;
|
||||
const struct DjuiFont* font = gDjuiFonts[0];
|
||||
f32 dX = comp->x + *drawX;
|
||||
f32 dY = comp->y + DJUI_INPUTBOX_YOFF;
|
||||
f32 dW = font->charWidth * font->defaultFontScale;
|
||||
|
@ -385,7 +385,7 @@ static void djui_inputbox_render_char(struct DjuiInputbox* inputbox, char c, f32
|
|||
}
|
||||
|
||||
static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
|
||||
struct DjuiFont* font = &gDjuiFonts[0];
|
||||
const struct DjuiFont* font = gDjuiFonts[0];
|
||||
|
||||
// make selection well formed
|
||||
u16 selection[2] = { 0 };
|
||||
|
@ -448,7 +448,7 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
|
|||
}
|
||||
|
||||
static void djui_inputbox_keep_selection_in_view(struct DjuiInputbox* inputbox) {
|
||||
struct DjuiFont* font = &gDjuiFonts[0];
|
||||
const struct DjuiFont* font = gDjuiFonts[0];
|
||||
|
||||
// calculate where our cursor is
|
||||
f32 cursorX = inputbox->viewX;
|
||||
|
@ -468,7 +468,7 @@ static void djui_inputbox_keep_selection_in_view(struct DjuiInputbox* inputbox)
|
|||
static void djui_inputbox_render(struct DjuiBase* base) {
|
||||
struct DjuiInputbox* inputbox = (struct DjuiInputbox*)base;
|
||||
struct DjuiBaseRect* comp = &base->comp;
|
||||
struct DjuiFont* font = &gDjuiFonts[0];
|
||||
const struct DjuiFont* font = gDjuiFonts[0];
|
||||
djui_rect_render(base);
|
||||
|
||||
// shift the viewing window to keep the selection in view
|
||||
|
|
|
@ -51,7 +51,7 @@ void djui_panel_debug_create(void) {
|
|||
djui_base_set_color(&sDjuiText2->base, 255, 255, 255, 255);
|
||||
djui_text_set_drop_shadow(sDjuiText2, 255, 0, 0, 255);
|
||||
djui_text_set_alignment(sDjuiText2, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
djui_text_set_font(sDjuiText2, &gDjuiFonts[1]);
|
||||
djui_text_set_font(sDjuiText2, gDjuiFonts[1]);
|
||||
|
||||
struct DjuiText* alphabet = djui_text_create(&gDjuiRoot->base, "abcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n01234567890\nthe quick brown fox jumps over the lazy dog\ngeqkbnfjsortelydg\nTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG\nGEQKBNFJSORTELYDG");
|
||||
djui_base_set_location(&alphabet->base, 0, 0);
|
||||
|
@ -61,6 +61,6 @@ void djui_panel_debug_create(void) {
|
|||
djui_base_set_color(&alphabet->base, 255, 255, 255, 255);
|
||||
djui_text_set_drop_shadow(alphabet, 255, 0, 0, 255);
|
||||
djui_text_set_alignment(alphabet, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(alphabet, &gDjuiFonts[1]);
|
||||
djui_text_set_font(alphabet, gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(alphabet, 64);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ struct DjuiThreePanel* djui_panel_menu_create(f32 bodyHeight, char* headerText)
|
|||
djui_base_set_color(&header->base, 255, 8, 0, 255);
|
||||
djui_base_set_location(&header->base, 0, DJUI_PANEL_HEADER_OFFSET);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
djui_text_set_font(header, gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1]->defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
|
|
|
@ -23,7 +23,7 @@ void djui_text_set_text(struct DjuiText* text, const char* message) {
|
|||
memcpy(text->message, message, sizeof(char) * (messageLen + 1));
|
||||
}
|
||||
|
||||
void djui_text_set_font(struct DjuiText* text, struct DjuiFont* font) {
|
||||
void djui_text_set_font(struct DjuiText* text, const struct DjuiFont* font) {
|
||||
text->font = font;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ struct DjuiText* djui_text_create(struct DjuiBase* parent, const char* message)
|
|||
djui_base_init(parent, base, djui_text_render, djui_text_destroy);
|
||||
|
||||
text->message = NULL;
|
||||
djui_text_set_font(text, &gDjuiFonts[0]);
|
||||
djui_text_set_font(text, gDjuiFonts[0]);
|
||||
djui_text_set_font_scale(text, text->font->defaultFontScale);
|
||||
djui_text_set_text(text, message);
|
||||
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
struct DjuiText {
|
||||
struct DjuiBase base;
|
||||
char* message;
|
||||
struct DjuiFont* font;
|
||||
const struct DjuiFont* font;
|
||||
f32 fontScale;
|
||||
struct DjuiColor dropShadow;
|
||||
enum DjuiHAlign textHAlign;
|
||||
|
@ -13,7 +13,7 @@ struct DjuiText {
|
|||
};
|
||||
|
||||
void djui_text_set_text(struct DjuiText* text, const char* message);
|
||||
void djui_text_set_font(struct DjuiText* text, struct DjuiFont* font);
|
||||
void djui_text_set_font(struct DjuiText* text, const struct DjuiFont* font);
|
||||
void djui_text_set_font_scale(struct DjuiText* text, f32 fontScale);
|
||||
void djui_text_set_drop_shadow(struct DjuiText* text, f32 r, f32 g, f32 b, f32 a);
|
||||
void djui_text_set_alignment(struct DjuiText* text, enum DjuiHAlign hAlign, enum DjuiVAlign vAlign);
|
||||
|
|
Loading…
Reference in New Issue