mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
bit more porting status screen to C
This commit is contained in:
parent
200a1ac93b
commit
73d7221ca6
@ -351,8 +351,10 @@ void StatusScreen_ContextRecreated(void) {
|
||||
status.SetText(msg);
|
||||
|
||||
posAtlas = new TextAtlas(game, 16);
|
||||
posAtlas.Pack("0123456789-, ()", font, "Position: ");
|
||||
posAtlas.tex.Y = (short)(status.Height + 2);
|
||||
String chars = String_FromConst("0123456789-, ()");
|
||||
String prefix = String_FromConst("Position: ");
|
||||
TextAtlas_Make(&screen->PosAtlas, &chars, &screen->Font, &prefix);
|
||||
screen->PosAtlas.Tex.Y = (Int16)(status.Height + 2);
|
||||
|
||||
Int32 yOffset = status.Height + posAtlas.tex.Height + 2;
|
||||
hackStates = new TextWidget(game, font)
|
||||
@ -444,13 +446,13 @@ Screen* StatusScreen_MakeInstance(void) {
|
||||
return &screen->Base;
|
||||
}
|
||||
|
||||
void StatusScreen_Reset(void) {
|
||||
void StatusScreen_Ready(void) {
|
||||
GuiElement* elem = &StatusScreen_Instance.Base.Base;
|
||||
elem->Init(elem);
|
||||
}
|
||||
|
||||
IGameComponent StatusScreen_MakeComponent(void) {
|
||||
IGameComponent comp = IGameComponent_MakeEmpty();
|
||||
comp.Reset = StatusScreen_Reset;
|
||||
comp.Ready = StatusScreen_Ready;
|
||||
return comp;
|
||||
}
|
@ -17,6 +17,8 @@ typedef struct ClickableScreen_ {
|
||||
void ClickableScreen_Create(ClickableScreen* screen);
|
||||
|
||||
Screen* InventoryScreen_MakeInstance(void);
|
||||
Screen* StatusScreen_MakeInstance(void);
|
||||
IGameComponent StatusScreen_MakeComponent(void);
|
||||
|
||||
/* Raw pointer to inventory screen. DO NOT USE THIS. Use InventoryScreen_MakeInstance() */
|
||||
extern Screen* InventoryScreen_UNSAFE_RawPointer;
|
||||
|
@ -54,7 +54,7 @@ void TextWidget_Reposition(Widget* elem) {
|
||||
widget->Texture.Y += elem->Y - oldY;
|
||||
}
|
||||
|
||||
void TextWidget_Create(TextWidget* widget, STRING_PURE String* text, FontDesc* font) {
|
||||
void TextWidget_Make(TextWidget* widget, FontDesc* font) {
|
||||
Widget_Init(&widget->Base);
|
||||
PackedCol col = PACKEDCOL_WHITE;
|
||||
widget->Col = col;
|
||||
@ -63,7 +63,10 @@ void TextWidget_Create(TextWidget* widget, STRING_PURE String* text, FontDesc* f
|
||||
widget->Base.Base.Init = TextWidget_Init;
|
||||
widget->Base.Base.Render = TextWidget_Render;
|
||||
widget->Base.Base.Free = TextWidget_Free;
|
||||
}
|
||||
|
||||
void TextWidget_Create(TextWidget* widget, STRING_PURE String* text, FontDesc* font) {
|
||||
TextWidget_Make(widget, font);
|
||||
GuiElement* elem = &widget->Base.Base;
|
||||
elem->Init(elem);
|
||||
TextWidget_SetText(widget, text);
|
||||
|
@ -22,6 +22,7 @@ typedef struct TextWidget_ {
|
||||
PackedCol Col;
|
||||
} TextWidget;
|
||||
|
||||
void TextWidget_Make(TextWidget* widget, FontDesc* font);
|
||||
void TextWidget_Create(TextWidget* widget, STRING_PURE String* text, FontDesc* font);
|
||||
void TextWidget_SetText(TextWidget* widget, STRING_PURE String* text);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user