mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
WIP on getting alt text input to layout properly on unminimise
This commit is contained in:
parent
fae4fcbb1a
commit
8da37b0437
@ -119,7 +119,7 @@ static void InventoryScreen_Init(void* screen) {
|
||||
TableWidget_Create(&s->table);
|
||||
s->table.font = &s->font;
|
||||
s->table.blocksPerRow = Game_PureClassic ? 9 : 10;
|
||||
Elem_Init(&s->table);
|
||||
TableWidget_RecreateBlocks(&s->table);
|
||||
|
||||
/* Can't immediately move to selected here, because cursor grabbed */
|
||||
/* status might be toggled after InventoryScreen_Init() is called. */
|
||||
@ -672,8 +672,8 @@ static void HUDScreen_UpdateAltTextY(struct HUDScreen* s) {
|
||||
int height = max(input->height + input->yOffset, HUDScreen_BottomOffset());
|
||||
height += input->yOffset;
|
||||
|
||||
s->altText.tex.Y = Window_Height - (height + s->altText.tex.Height);
|
||||
s->altText.y = s->altText.tex.Y;
|
||||
s->altText.yOffset = height;
|
||||
Widget_Reposition(&s->altText);
|
||||
}
|
||||
|
||||
static String HUDScreen_GetChat(void* obj, int i) {
|
||||
|
@ -578,7 +578,7 @@ static bool TableWidget_RowEmpty(struct TableWidget* w, int start) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void TableWidget_RecreateElements(struct TableWidget* w) {
|
||||
void TableWidget_RecreateBlocks(struct TableWidget* w) {
|
||||
int i, max = Game_UseCPEBlocks ? BLOCK_COUNT : BLOCK_ORIGINAL_COUNT;
|
||||
BlockID block;
|
||||
w->blocksCount = 0;
|
||||
@ -597,12 +597,6 @@ static void TableWidget_RecreateElements(struct TableWidget* w) {
|
||||
Widget_Reposition(w);
|
||||
}
|
||||
|
||||
static void TableWidget_Init(void* widget) {
|
||||
struct TableWidget* w = (struct TableWidget*)widget;
|
||||
TableWidget_RecreateElements(w);
|
||||
Widget_Reposition(w);
|
||||
}
|
||||
|
||||
static void TableWidget_Render(void* widget, double delta) {
|
||||
struct TableWidget* w = (struct TableWidget*)widget;
|
||||
VertexP3fT2fC4b vertices[TABLE_MAX_VERTICES];
|
||||
@ -798,7 +792,7 @@ static bool TableWidget_KeyDown(void* widget, Key key) {
|
||||
}
|
||||
|
||||
static const struct WidgetVTABLE TableWidget_VTABLE = {
|
||||
TableWidget_Init, TableWidget_Render, TableWidget_Free,
|
||||
Widget_NullFunc, TableWidget_Render, TableWidget_Free,
|
||||
TableWidget_KeyDown, Widget_Key,
|
||||
TableWidget_MouseDown, TableWidget_MouseUp, TableWidget_MouseMove, TableWidget_MouseScroll,
|
||||
TableWidget_Reposition
|
||||
@ -832,7 +826,7 @@ void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block) {
|
||||
}
|
||||
|
||||
void TableWidget_OnInventoryChanged(struct TableWidget* w) {
|
||||
TableWidget_RecreateElements(w);
|
||||
TableWidget_RecreateBlocks(w);
|
||||
if (w->selectedIndex >= w->blocksCount) {
|
||||
w->selectedIndex = w->blocksCount - 1;
|
||||
}
|
||||
@ -2700,6 +2694,7 @@ void SpecialInputWidget_Redraw(struct SpecialInputWidget* w) {
|
||||
w->width = w->tex.Width;
|
||||
w->height = w->active ? w->tex.Height : 0;
|
||||
w->pendingRedraw = false;
|
||||
Widget_Reposition(w);
|
||||
}
|
||||
|
||||
static void SpecialInputWidget_Render(void* widget, double delta) {
|
||||
@ -2712,6 +2707,12 @@ static void SpecialInputWidget_Free(void* widget) {
|
||||
Gfx_DeleteTexture(&w->tex.ID);
|
||||
}
|
||||
|
||||
static void SpecialInputWidget_Reposition(void* widget) {
|
||||
struct SpecialInputWidget* w = (struct SpecialInputWidget*)widget;
|
||||
Widget_CalcPosition(w);
|
||||
w->tex.X = w->x; w->tex.Y = w->y;
|
||||
}
|
||||
|
||||
static bool SpecialInputWidget_MouseDown(void* widget, int x, int y, MouseButton btn) {
|
||||
struct SpecialInputWidget* w = (struct SpecialInputWidget*)widget;
|
||||
x -= w->x; y -= w->y;
|
||||
@ -2744,7 +2745,7 @@ static const struct WidgetVTABLE SpecialInputWidget_VTABLE = {
|
||||
Widget_NullFunc, SpecialInputWidget_Render, SpecialInputWidget_Free,
|
||||
Widget_Key, Widget_Key,
|
||||
SpecialInputWidget_MouseDown, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
Widget_CalcPosition
|
||||
SpecialInputWidget_Reposition
|
||||
};
|
||||
void SpecialInputWidget_Create(struct SpecialInputWidget* w, FontDesc* font, struct InputWidget* target) {
|
||||
Widget_Reset(w);
|
||||
|
@ -88,6 +88,7 @@ CC_NOINLINE void TableWidget_Create(struct TableWidget* w);
|
||||
/* Sets the selected block in the table to the given block. */
|
||||
/* Also adjusts scrollbar and moves cursor to be over the given block. */
|
||||
CC_NOINLINE void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block);
|
||||
CC_NOINLINE void TableWidget_RecreateBlocks(struct TableWidget* w);
|
||||
CC_NOINLINE void TableWidget_OnInventoryChanged(struct TableWidget* w);
|
||||
CC_NOINLINE void TableWidget_MakeDescTex(struct TableWidget* w, BlockID block);
|
||||
CC_NOINLINE void TableWidget_Recreate(struct TableWidget* w);
|
||||
|
Loading…
x
Reference in New Issue
Block a user