less compiler warnings

This commit is contained in:
UnknownShadow200 2019-09-01 13:12:25 +10:00
parent 441359e7b5
commit 21b2d9ce70
3 changed files with 20 additions and 20 deletions

View File

@ -58,7 +58,7 @@ void TextWidget_Make(struct TextWidget* w, cc_uint8 horAnchor, cc_uint8 verAncho
Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset); Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset);
} }
void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontDesc* font) { void TextWidget_Set(struct TextWidget* w, const String* text, struct FontDesc* font) {
struct DrawTextArgs args; struct DrawTextArgs args;
Gfx_DeleteTexture(&w->tex.ID); Gfx_DeleteTexture(&w->tex.ID);
@ -78,7 +78,7 @@ void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontD
Widget_Reposition(w); Widget_Reposition(w);
} }
void TextWidget_SetConst(struct TextWidget* w, const char* text, const struct FontDesc* font) { void TextWidget_SetConst(struct TextWidget* w, const char* text, struct FontDesc* font) {
String str = String_FromReadonly(text); String str = String_FromReadonly(text);
TextWidget_Set(w, &str, font); TextWidget_Set(w, &str, font);
} }
@ -161,7 +161,7 @@ void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick on
Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset); Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset);
} }
void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct FontDesc* font) { void ButtonWidget_Set(struct ButtonWidget* w, const String* text, struct FontDesc* font) {
struct DrawTextArgs args; struct DrawTextArgs args;
Gfx_DeleteTexture(&w->tex.ID); Gfx_DeleteTexture(&w->tex.ID);
@ -178,7 +178,7 @@ void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct F
Widget_Reposition(w); Widget_Reposition(w);
} }
void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, const struct FontDesc* font) { void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, struct FontDesc* font) {
String str = String_FromReadonly(text); String str = String_FromReadonly(text);
ButtonWidget_Set(w, &str, font); ButtonWidget_Set(w, &str, font);
} }
@ -2551,7 +2551,7 @@ static void SpecialInputWidget_IntersectsBody(struct SpecialInputWidget* w, int
int i; int i;
y -= w->titleHeight; y -= w->titleHeight;
x /= w->elementSize.Width; y /= w->elementSize.Height; x /= w->elementWidth; y /= w->elementHeight;
i = (x + y * e.itemsPerRow) * e.charsPerItem; i = (x + y * e.itemsPerRow) * e.charsPerItem;
if (i >= e.contents.length) return; if (i >= e.contents.length) return;
@ -2645,12 +2645,12 @@ static Size2D SpecialInputWidget_MeasureContent(struct SpecialInputWidget* w, st
maxWidth = max(maxWidth, size.Width); maxWidth = max(maxWidth, size.Width);
} }
w->elementSize.Width = maxWidth + SPECIAL_CONTENT_SPACING; w->elementWidth = maxWidth + SPECIAL_CONTENT_SPACING;
w->elementSize.Height = size.Height + SPECIAL_CONTENT_SPACING; w->elementHeight = size.Height + SPECIAL_CONTENT_SPACING;
rows = Math_CeilDiv(tab->contents.length / tab->charsPerItem, tab->itemsPerRow); rows = Math_CeilDiv(tab->contents.length / tab->charsPerItem, tab->itemsPerRow);
size.Width = w->elementSize.Width * tab->itemsPerRow; size.Width = w->elementWidth * tab->itemsPerRow;
size.Height = w->elementSize.Height * rows; size.Height = w->elementHeight * rows;
return size; return size;
} }
@ -2666,8 +2666,8 @@ static void SpecialInputWidget_DrawContent(struct SpecialInputWidget* w, struct
args.text.buffer = &tab->contents.buffer[i]; args.text.buffer = &tab->contents.buffer[i];
item = i / tab->charsPerItem; item = i / tab->charsPerItem;
x = (item % wrap) * w->elementSize.Width; x = (item % wrap) * w->elementWidth;
y = (item / wrap) * w->elementSize.Height + yOffset; y = (item / wrap) * w->elementHeight + yOffset;
Drawer2D_DrawText(bmp, &args, x, y); Drawer2D_DrawText(bmp, &args, x, y);
} }
} }

View File

@ -20,9 +20,9 @@ struct TextWidget {
CC_NOINLINE void TextWidget_Make(struct TextWidget* w, CC_NOINLINE void TextWidget_Make(struct TextWidget* w,
cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset); cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset);
/* Draws the given text into a texture, then updates the position and size of this widget. */ /* Draws the given text into a texture, then updates the position and size of this widget. */
CC_NOINLINE void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontDesc* font); CC_NOINLINE void TextWidget_Set(struct TextWidget* w, const String* text, struct FontDesc* font);
/* Shorthand for TextWidget_Set using String_FromReadonly */ /* Shorthand for TextWidget_Set using String_FromReadonly */
CC_NOINLINE void TextWidget_SetConst(struct TextWidget* w, const char* text, const struct FontDesc* font); CC_NOINLINE void TextWidget_SetConst(struct TextWidget* w, const char* text, struct FontDesc* font);
typedef void (*Button_Get)(String* raw); typedef void (*Button_Get)(String* raw);
@ -40,9 +40,9 @@ struct ButtonWidget {
CC_NOINLINE void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick onClick, CC_NOINLINE void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick onClick,
cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset); cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset);
/* Draws the given text into a texture, then updates the position and size of this widget. */ /* Draws the given text into a texture, then updates the position and size of this widget. */
CC_NOINLINE void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct FontDesc* font); CC_NOINLINE void ButtonWidget_Set(struct ButtonWidget* w, const String* text, struct FontDesc* font);
/* Shorthand for ButtonWidget_Set using String_FromReadonly */ /* Shorthand for ButtonWidget_Set using String_FromReadonly */
CC_NOINLINE void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, const struct FontDesc* font); CC_NOINLINE void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, struct FontDesc* font);
/* Clickable and draggable scrollbar. */ /* Clickable and draggable scrollbar. */
struct ScrollbarWidget { struct ScrollbarWidget {
@ -259,7 +259,7 @@ struct SpecialInputTab {
struct SpecialInputWidget { struct SpecialInputWidget {
Widget_Layout Widget_Layout
Size2D elementSize; int elementWidth, elementHeight;
int selectedIndex; int selectedIndex;
bool pendingRedraw; bool pendingRedraw;
struct InputWidget* target; struct InputWidget* target;

View File

@ -112,11 +112,11 @@ static void Window_UpdateTouch(long id, int x, int y) {
int i; int i;
for (i = 0; i < touchesCount; i++) { for (i = 0; i < touchesCount; i++) {
if (touches[i].id != id) continue; if (touches[i].id != id) continue;
Mouse_SetPosition(x, y);
if (win_rawMouse) { if (win_rawMouse) {
Event_RaiseMouseMove(&MouseEvents.RawMoved, x - touches[i].x, y - touches[i].y); Event_RaiseMove(&PointerEvents.RawMoved, i, x - touches[i].x, y - touches[i].y);
} }
Mouse_SetPosition(x, y);
touches[i].x = x; touches[i].x = x;
touches[i].y = y; touches[i].y = y;
@ -1418,7 +1418,7 @@ static void X11_MessageBox(const char* title, const char* text, X11Window* w) {
/* However this causes issues as that removes events that */ /* However this causes issues as that removes events that */
/* should have been delivered to the main game window. */ /* should have been delivered to the main game window. */
/* (e.g. breaks initial window resize with i3 WM) */ /* (e.g. breaks initial window resize with i3 WM) */
XIfEvent(dpy, &e, X11_FilterEvent, w->win); XIfEvent(dpy, &e, X11_FilterEvent, (XPointer)w->win);
switch (e.type) switch (e.type)
{ {