diff --git a/acs/lithos3.bin b/acs/lithos3.bin index a29a357..66516e1 100644 Binary files a/acs/lithos3.bin and b/acs/lithos3.bin differ diff --git a/classlayout.txt b/classlayout.txt index 152ec4e..c8d20ac 100644 --- a/classlayout.txt +++ b/classlayout.txt @@ -1,5 +1,5 @@ -Lth_Control -| Lth_LayoutControl -| \ Lth_Button -\ Lth_Window +Lth_Rect +\-Lth_Control +| |-Lth_Button +\ \-Lth_Window diff --git a/lithos_c/inc/Lth_button.h b/lithos_c/inc/Lth_button.h index 709000a..6f27e57 100644 --- a/lithos_c/inc/Lth_button.h +++ b/lithos_c/inc/Lth_button.h @@ -35,7 +35,7 @@ enum Lth_ButtonState // typedef struct Lth_Button { - Lth_Inherits(Lth_LayoutControl); + Lth_Inherits(Lth_Control); char *label; int state; } Lth_Button; diff --git a/lithos_c/inc/Lth_context.h b/lithos_c/inc/Lth_context.h index d302c64..5b993a9 100644 --- a/lithos_c/inc/Lth_context.h +++ b/lithos_c/inc/Lth_context.h @@ -13,6 +13,9 @@ #ifndef lithos3__Lth_context_h #define lithos3__Lth_context_h +#include "Lth_types.h" +#include "Lth_font.h" + // Type Definitions ----------------------------------------------------------| @@ -31,6 +34,7 @@ // read-write // hid: HUD ID range // mapspace: space between newly mapped windows that are auto-positioned +// font: default font for drawing // typedef struct Lth_Context { @@ -42,6 +46,7 @@ typedef struct Lth_Context Lth_HIDRange hid; Lth_IVec2 mapspace; + Lth_Font *font; } Lth_Context; diff --git a/lithos_c/inc/Lth_control.h b/lithos_c/inc/Lth_control.h index de2fd00..ea9a474 100644 --- a/lithos_c/inc/Lth_control.h +++ b/lithos_c/inc/Lth_control.h @@ -56,19 +56,6 @@ typedef struct Lth_Control Lth_Mixin(Lth_Rect); } Lth_Control; -// -// Lth_LayoutControl -// -// read-only -// lx: layout x -// ly: layout y -// -typedef struct Lth_LayoutControl -{ - Lth_Inherits(Lth_Control); - int lx, ly; -} Lth_LayoutControl; - // Extern Functions ----------------------------------------------------------| diff --git a/lithos_c/src/control.c b/lithos_c/src/control.c index 773464f..4e28042 100644 --- a/lithos_c/src/control.c +++ b/lithos_c/src/control.c @@ -19,6 +19,27 @@ // Extern Functions ----------------------------------------------------------| +// +// Lth_ControlFont +// +Lth_Font *Lth_ControlFont(void *ctrl_) +{ + Lth_Control *ctrl = ctrl_; + + if(ctrl->font) + return ctrl->font; + else + { + for(Lth_Control *p = ctrl->parent; p; p = p->parent) + { + if(p->font) + return p->font; + } + } + + return ctrl->ctx->font; +} + // // Lth_ControlRun // @@ -27,7 +48,6 @@ void Lth_ControlRun(void *ctrl_) Lth_Control *ctrl = ctrl_; Lth_assert(ctrl != NULL); - Lth_assert(ctrl->ctx != NULL); Lth_ControlCall(ctrl, update, ctrl); Lth_ControlCall(ctrl, draw, ctrl);