mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
fix an improper function pointer conversion in C client, remove some unneeded descriptions from a few menus
This commit is contained in:
parent
1a285e2549
commit
00cff00832
@ -12,7 +12,6 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
base.Init();
|
||||
ContextRecreated();
|
||||
MakeValidators();
|
||||
MakeDescriptions();
|
||||
}
|
||||
|
||||
protected override void ContextRecreated() {
|
||||
@ -27,7 +26,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
MakeOpt(1, -150, "Clickable chat", onClick, GetClickable, SetClickable),
|
||||
MakeOpt(1, -100, "Chat scale", onClick, GetChatScale, SetChatScale),
|
||||
MakeOpt(1, -50, "Chat lines", onClick, GetChatlines, SetChatlines),
|
||||
MakeOpt(1, 0, "Use font", onClick, GetUseFont, SetUseFont),
|
||||
MakeOpt(1, 0, "Use system font", onClick, GetUseFont, SetUseFont),
|
||||
MakeOpt(1, 50, "Font", onClick, GetFont, SetFont),
|
||||
|
||||
MakeBack(false, titleFont, SwitchOptions),
|
||||
@ -121,13 +120,5 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
new StringValidator(),
|
||||
};
|
||||
}
|
||||
|
||||
void MakeDescriptions() {
|
||||
descriptions = new string[widgets.Length][];
|
||||
descriptions[8] = new string[] {
|
||||
"&eWhether a system font is used instead of default.png for drawing text",
|
||||
"&fThe default system font used is Arial.",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -14,14 +14,13 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
base.Init();
|
||||
ContextRecreated();
|
||||
MakeValidators();
|
||||
MakeDescriptions();
|
||||
}
|
||||
|
||||
protected override void ContextRecreated() {
|
||||
bool multi = !game.Server.IsSinglePlayer;
|
||||
ClickHandler onClick = OnWidgetClick;
|
||||
widgets = new Widget[] {
|
||||
multi ? null : MakeOpt(-1, -100, "Click distance", onClick, GetReach, SetReach),
|
||||
multi ? null : MakeOpt(-1, -100, "Reach distance", onClick, GetReach, SetReach),
|
||||
MakeOpt(-1, -50, "Music volume", onClick, GetMusic, SetMusic),
|
||||
MakeOpt(-1, 0, "Sounds volume", onClick, GetSounds, SetSounds),
|
||||
MakeOpt(-1, 50, "View bobbing", onClick, GetViewBob, SetViewBob),
|
||||
@ -87,13 +86,5 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
new IntegerValidator(1, 200),
|
||||
};
|
||||
}
|
||||
|
||||
void MakeDescriptions() {
|
||||
descriptions = new string[widgets.Length][];
|
||||
descriptions[0] = new string[] {
|
||||
"&eSets how far away you can place/delete blocks",
|
||||
"&fThe default click distance is 5 blocks.",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@
|
||||
#include "ModelCache.h"
|
||||
#include "MapGenerator.h"
|
||||
#include "ServerConnection.h"
|
||||
#define LeftOnly(func) { if (btn == MouseButton_Left) { func; } return true; }
|
||||
|
||||
void Screen_FreeWidgets(Widget** widgets, UInt32 widgetsCount) {
|
||||
if (widgets == NULL) return;
|
||||
@ -58,20 +59,14 @@ void Screen_MakeDefaultBack(ButtonWidget* widget, bool toGame, FontDesc* font, G
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_SwitchOptions(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
if (btn == MouseButton_Left) Gui_SetNewScreen(OptionsGroupScreen_MakeInstance());
|
||||
bool Screen_SwitchOptions(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
LeftOnly(Gui_SetNewScreen(OptionsGroupScreen_MakeInstance()));
|
||||
}
|
||||
void Screen_SwitchPause(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
if (btn == MouseButton_Left) Gui_SetNewScreen(PauseScreen_MakeInstance());
|
||||
bool Screen_SwitchPause(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
LeftOnly(Gui_SetNewScreen(PauseScreen_MakeInstance()));
|
||||
}
|
||||
|
||||
|
||||
/* These were sourced by taking a screenshot of vanilla
|
||||
Then using paint to extract the colour components
|
||||
Then using wolfram alpha to solve the glblendfunc equation */
|
||||
PackedCol Menu_TopBackCol = PACKEDCOL_CONST(24, 24, 24, 105);
|
||||
PackedCol Menu_BottomBackCol = PACKEDCOL_CONST(51, 51, 98, 162);
|
||||
|
||||
typedef struct ClickableScreen_ {
|
||||
GuiElement* Elem;
|
||||
Widget** Widgets;
|
||||
@ -81,7 +76,12 @@ typedef struct ClickableScreen_ {
|
||||
} ClickableScreen;
|
||||
|
||||
void ClickableScreen_RenderMenuBounds(void) {
|
||||
GfxCommon_Draw2DGradient(0, 0, Game_Width, Game_Height, Menu_TopBackCol, Menu_BottomBackCol);
|
||||
/* These were sourced by taking a screenshot of vanilla
|
||||
Then using paint to extract the colour components
|
||||
Then using wolfram alpha to solve the glblendfunc equation */
|
||||
PackedCol topCol = PACKEDCOL_CONST(24, 24, 24, 105);
|
||||
PackedCol bottomCol = PACKEDCOL_CONST(51, 51, 98, 162);
|
||||
GfxCommon_Draw2DGradient(0, 0, Game_Width, Game_Height, topCol, bottomCol);
|
||||
}
|
||||
|
||||
void ClickableScreen_DefaultWidgetSelected(GuiElement* elem, Widget* widget) { }
|
||||
@ -558,12 +558,12 @@ void FilesScreen_PageClick(bool forward) {
|
||||
FilesScreen_SetCurrentIndex(screen->CurrentIndex + delta);
|
||||
}
|
||||
|
||||
void FilesScreen_MoveBackwards(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
if (btn == MouseButton_Left) FilesScreen_PageClick(false);
|
||||
bool FilesScreen_MoveBackwards(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
LeftOnly(FilesScreen_PageClick(false));
|
||||
}
|
||||
|
||||
void FilesScreen_MoveForwards(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
if (btn == MouseButton_Left) FilesScreen_PageClick(true);
|
||||
bool FilesScreen_MoveForwards(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
LeftOnly(FilesScreen_PageClick(true));
|
||||
}
|
||||
|
||||
void FilesScreen_ContextLost(void* obj) {
|
||||
@ -667,6 +667,7 @@ Screen* FilesScreen_MakeInstance(void) {
|
||||
return &screen->Base;
|
||||
}
|
||||
|
||||
|
||||
typedef struct LoadingScreen_ {
|
||||
Screen Base;
|
||||
FontDesc Font;
|
||||
|
@ -30,7 +30,7 @@ void TextWidget_SetText(TextWidget* widget, STRING_PURE String* text);
|
||||
|
||||
typedef void (*ButtonWidget_SetValue)(STRING_TRANSIENT String* raw);
|
||||
typedef void (*ButtonWidget_GetValue)(STRING_TRANSIENT String* raw);
|
||||
typedef void (*Gui_MouseHandler)(GuiElement* elem, Int32 x, Int32 y, MouseButton btn);
|
||||
typedef bool (*Gui_MouseHandler)(GuiElement* elem, Int32 x, Int32 y, MouseButton btn);
|
||||
typedef struct ButtonWidget_ {
|
||||
Widget Base;
|
||||
Texture Texture;
|
||||
|
Loading…
x
Reference in New Issue
Block a user