mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Fix webclient build
This commit is contained in:
parent
9e2a28dd2a
commit
cbc3d9c05e
@ -736,13 +736,13 @@ String Font_Lookup(const String* fontName, int style) {
|
|||||||
String str = String_FromConst("-----"); return str;
|
String str = String_FromConst("-----"); return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnCode Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
|
ReturnCode Font_Make(struct FontDesc* desc, const String* fontName, int size, int style) {
|
||||||
desc->size = size;
|
desc->size = size;
|
||||||
desc->style = style;
|
desc->style = style;
|
||||||
desc->height = 0;
|
desc->height = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void Font_Free(FontDesc* desc) {
|
void Font_Free(struct FontDesc* desc) {
|
||||||
desc->size = 0;
|
desc->size = 0;
|
||||||
desc->style = 0;
|
desc->style = 0;
|
||||||
}
|
}
|
||||||
|
10
src/Gui.c
10
src/Gui.c
@ -70,6 +70,16 @@ bool Gui_Contains(int recX, int recY, int width, int height, int x, int y) {
|
|||||||
return x >= recX && y >= recY && x < (recX + width) && y < (recY + height);
|
return x >= recX && y >= recY && x < (recX + width) && y < (recY + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Gui_ContainsPointers(int x, int y, int width, int height) {
|
||||||
|
int i, px, py;
|
||||||
|
for (i = 0; i < Pointers_Count; i++) {
|
||||||
|
px = Pointers[i].x; py = Pointers[i].y;
|
||||||
|
|
||||||
|
if (px >= x && py >= y && px < (x + width) && py < (y + height)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Gui_ShowDefault(void) {
|
void Gui_ShowDefault(void) {
|
||||||
StatusScreen_Show();
|
StatusScreen_Show();
|
||||||
HUDScreen_Show();
|
HUDScreen_Show();
|
||||||
|
@ -117,6 +117,8 @@ extern int Gui_ScreensCount;
|
|||||||
int Gui_CalcPos(cc_uint8 anchor, int offset, int size, int axisLen);
|
int Gui_CalcPos(cc_uint8 anchor, int offset, int size, int axisLen);
|
||||||
/* Returns whether the given rectangle contains the given point. */
|
/* Returns whether the given rectangle contains the given point. */
|
||||||
bool Gui_Contains(int recX, int recY, int width, int height, int x, int y);
|
bool Gui_Contains(int recX, int recY, int width, int height, int x, int y);
|
||||||
|
/* Returns whether one or more pointers lie within the given rectangle. */
|
||||||
|
bool Gui_ContainsPointers(int x, int y, int width, int height);
|
||||||
/* Shows HUD and Status screens. */
|
/* Shows HUD and Status screens. */
|
||||||
void Gui_ShowDefault(void);
|
void Gui_ShowDefault(void);
|
||||||
|
|
||||||
|
@ -78,9 +78,7 @@ extern float Mouse_Wheel;
|
|||||||
#define Pointers_Count 1
|
#define Pointers_Count 1
|
||||||
|
|
||||||
/* Data for mouse and touch */
|
/* Data for mouse and touch */
|
||||||
extern struct Pointer {
|
extern struct Pointer { int x, y; } Pointers[INPUT_MAX_POINTERS];
|
||||||
int x, y;
|
|
||||||
} Pointers[INPUT_MAX_POINTERS];
|
|
||||||
/* X and Y coordinates of the mouse. Use Mouse_SetPosition to change. */
|
/* X and Y coordinates of the mouse. Use Mouse_SetPosition to change. */
|
||||||
extern int Mouse_X, Mouse_Y;
|
extern int Mouse_X, Mouse_Y;
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ static void ScrollbarWidget_Render(void* widget, double delta) {
|
|||||||
x += SCROLL_BORDER; y += w->y;
|
x += SCROLL_BORDER; y += w->y;
|
||||||
width -= SCROLL_BORDER * 2;
|
width -= SCROLL_BORDER * 2;
|
||||||
|
|
||||||
hovered = Gui_Contains(x, y, width, height, Mouse_X, Mouse_Y);
|
hovered = Gui_ContainsPointers(x, y, width, height);
|
||||||
barCol = hovered ? Scroll_HoverCol : Scroll_BarCol;
|
barCol = hovered ? Scroll_HoverCol : Scroll_BarCol;
|
||||||
Gfx_Draw2DFlat(x, y, width, height, barCol);
|
Gfx_Draw2DFlat(x, y, width, height, barCol);
|
||||||
|
|
||||||
@ -729,8 +729,8 @@ static bool TableWidget_MouseScroll(void* widget, float delta) {
|
|||||||
struct TableWidget* w = (struct TableWidget*)widget;
|
struct TableWidget* w = (struct TableWidget*)widget;
|
||||||
int origTopRow, index;
|
int origTopRow, index;
|
||||||
|
|
||||||
bool bounds = Gui_Contains(Table_X(w), Table_Y(w),
|
bool bounds = Gui_ContainsPointers(Table_X(w), Table_Y(w),
|
||||||
Table_Width(w) + w->scroll.width, Table_Height(w), Mouse_X, Mouse_Y);
|
Table_Width(w) + w->scroll.width, Table_Height(w));
|
||||||
if (!bounds) return false;
|
if (!bounds) return false;
|
||||||
|
|
||||||
origTopRow = w->scroll.topRow;
|
origTopRow = w->scroll.topRow;
|
||||||
@ -805,7 +805,7 @@ void TableWidget_Create(struct TableWidget* w) {
|
|||||||
|
|
||||||
w->horAnchor = ANCHOR_CENTRE;
|
w->horAnchor = ANCHOR_CENTRE;
|
||||||
w->verAnchor = ANCHOR_CENTRE;
|
w->verAnchor = ANCHOR_CENTRE;
|
||||||
w->lastX = Mouse_X; w->lastY = Mouse_Y;
|
w->lastX = -20; w->lastY = -20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block) {
|
void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block) {
|
||||||
@ -2063,7 +2063,7 @@ static void PlayerListWidget_Render(void* widget, double delta) {
|
|||||||
struct TextWidget* title = &w->title;
|
struct TextWidget* title = &w->title;
|
||||||
struct Texture tex;
|
struct Texture tex;
|
||||||
int offset, height;
|
int offset, height;
|
||||||
int i, selectedI;
|
int i;
|
||||||
PackedCol topCol = PACKEDCOL_CONST( 0, 0, 0, 180);
|
PackedCol topCol = PACKEDCOL_CONST( 0, 0, 0, 180);
|
||||||
PackedCol bottomCol = PACKEDCOL_CONST(50, 50, 50, 205);
|
PackedCol bottomCol = PACKEDCOL_CONST(50, 50, 50, 205);
|
||||||
|
|
||||||
@ -2077,12 +2077,13 @@ static void PlayerListWidget_Render(void* widget, double delta) {
|
|||||||
Widget_Reposition(title);
|
Widget_Reposition(title);
|
||||||
Elem_Render(title, delta);
|
Elem_Render(title, delta);
|
||||||
|
|
||||||
selectedI = PlayerListWidget_HighlightedName(w, Mouse_X, Mouse_Y);
|
|
||||||
for (i = 0; i < w->namesCount; i++) {
|
for (i = 0; i < w->namesCount; i++) {
|
||||||
if (!w->textures[i].ID) continue;
|
if (!w->textures[i].ID) continue;
|
||||||
|
|
||||||
tex = w->textures[i];
|
tex = w->textures[i];
|
||||||
if (i == selectedI) tex.X += 4;
|
|
||||||
|
if (w->ids[i] != GROUP_NAME_ID) {
|
||||||
|
if (Gui_ContainsPointers(tex.X, tex.Y, tex.Width, tex.Height)) tex.X += 4;
|
||||||
|
}
|
||||||
Texture_Render(&tex);
|
Texture_Render(&tex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2731,7 +2731,7 @@ void Window_ProcessEvents(void) { }
|
|||||||
/* Not needed because browser provides relative mouse and touch events */
|
/* Not needed because browser provides relative mouse and touch events */
|
||||||
static void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
|
static void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
|
||||||
/* Not allowed to move cursor from javascript */
|
/* Not allowed to move cursor from javascript */
|
||||||
void Cursor_SetPosition(int x, int y) { Mouse_X = x; Mouse_Y = y; }
|
void Cursor_SetPosition(int x, int y) { }
|
||||||
|
|
||||||
void Cursor_SetVisible(bool visible) {
|
void Cursor_SetVisible(bool visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@ -3026,9 +3026,9 @@ void Window_ProcessEvents(void) {
|
|||||||
JavaCallVoid(env, "processEvents", "()V", NULL);
|
JavaCallVoid(env, "processEvents", "()V", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No actual cursor, so just fake one */
|
/* No actual mouse cursor */
|
||||||
static void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
|
static void Cursor_GetRawPos(int* x, int* y) { *x = 0; *y = 0; }
|
||||||
void Cursor_SetPosition(int x, int y) { Mouse_X = x; Mouse_Y = y; }
|
void Cursor_SetPosition(int x, int y) { }
|
||||||
void Cursor_SetVisible(bool visible) { }
|
void Cursor_SetVisible(bool visible) { }
|
||||||
|
|
||||||
void Window_ShowDialog(const char* title, const char* msg) {
|
void Window_ShowDialog(const char* title, const char* msg) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user