mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Few less compile errors
This commit is contained in:
parent
59ca55a984
commit
e0433935e6
@ -167,14 +167,25 @@ void Gui_RefreshHud(void) {
|
||||
Gui_HUD->Base.Recreate(&Gui_HUD->Base);
|
||||
}
|
||||
|
||||
void Gui_ShowOverlay(Screen* overlay) {
|
||||
void Gui_ShowOverlay(Screen* overlay, bool atFront) {
|
||||
if (Gui_OverlaysCount == GUI_MAX_OVERLAYS) {
|
||||
ErrorHandler_Fail("Cannot have more than 40 overlays");
|
||||
}
|
||||
bool visible = Game_GetCursorVisible();
|
||||
if (Gui_OverlaysCount == 0) Game_SetCursorVisible(true);
|
||||
|
||||
Gui_Overlays[Gui_OverlaysCount++] = overlay;
|
||||
if (atFront) {
|
||||
Int32 i;
|
||||
/* Insert overlay at start of list */
|
||||
for (i = Gui_OverlaysCount - 1; i > 0; i--) {
|
||||
Gui_Overlays[i] = Gui_Overlays[i - 1];
|
||||
}
|
||||
Gui_Overlays[0] = overlay;
|
||||
} else {
|
||||
Gui_Overlays[Gui_OverlaysCount] = overlay;
|
||||
}
|
||||
Gui_OverlaysCount++;
|
||||
|
||||
if (Gui_OverlaysCount == 1) Game_SetCursorVisible(visible); /* Save cursor visibility state */
|
||||
overlay->Base.Init(&overlay->Base);
|
||||
}
|
||||
@ -260,7 +271,7 @@ void TextAtlas_Add(TextAtlas* atlas, Int32 charI, VertexP3fT2fC4b** vertices) {
|
||||
void TextAtlas_AddInt(TextAtlas* atlas, Int32 value, VertexP3fT2fC4b** vertices) {
|
||||
if (value < 0) TextAtlas_Add(atlas, 10, vertices); /* - sign */
|
||||
|
||||
UInt32 i, count = 0;
|
||||
Int32 i, count = 0;
|
||||
UInt8 digits[STRING_SIZE];
|
||||
/* use a do while loop here, as we still want a '0' digit if input is 0 */
|
||||
do {
|
||||
|
@ -90,7 +90,7 @@ Screen* Gui_GetUnderlyingScreen(void);
|
||||
void Gui_SetScreen(Screen* screen, bool freeOld);
|
||||
void Gui_SetNewScreen(Screen* screen);
|
||||
void Gui_RefreshHud(void);
|
||||
void Gui_ShowOverlay(Screen* overlay);
|
||||
void Gui_ShowOverlay(Screen* overlay, bool atFront);
|
||||
void Gui_RenderGui(Real64 delta);
|
||||
void Gui_OnResize(void);
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "Event.h"
|
||||
#include "Funcs.h"
|
||||
#include "Options.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define Key_Function_Names \
|
||||
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",\
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "InputHandler.h"
|
||||
#include "Utils.h"
|
||||
#include "Hotkeys.h"
|
||||
#include "ServerConnection.h"
|
||||
#include "Game.h"
|
||||
#include "Platform.h"
|
||||
@ -177,7 +176,7 @@ bool InputHandler_HandleCoreKey(Key key) {
|
||||
} else if (GameMode_HandlesKeyDown(key)) {
|
||||
} else if (key == KeyBind_Get(KeyBind_IDOverlay)) {
|
||||
if (Gui_OverlaysCount > 0) return true;
|
||||
Gui_ShowOverlay(new TexIdsOverlay());
|
||||
Gui_ShowOverlay(new TexIdsOverlay(), false);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -1129,15 +1129,6 @@ void ChatScreen_Recreate(TextGroupWidget* group, UInt8 code) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatScreen_OpenUrl(Overlay urlOverlay, bool always) {
|
||||
Platform_StartShell(urlOverlay.Metadata);
|
||||
}
|
||||
|
||||
void ChatScreen_AppendUrl(Overlay urlOverlay, bool always) {
|
||||
if (!Game_ClickableChat) return;
|
||||
input.Append(urlOverlay.Metadata);
|
||||
}
|
||||
|
||||
Int32 ChatScreen_ClampIndex(Int32 index) {
|
||||
Int32 maxIndex = Chat_Log.Count - Game_ChatLines;
|
||||
Int32 minIndex = min(0, maxIndex);
|
||||
@ -1262,15 +1253,8 @@ bool ChatScreen_HandlesMouseDown(GuiElement* elem, Int32 x, Int32 y, MouseButton
|
||||
String_AppendColorless(&url, &text);
|
||||
|
||||
if (Utils_IsUrlPrefix(&url, 0)) {
|
||||
WarningOverlay overlay = new WarningOverlay(game, false, false);
|
||||
overlay.Metadata = url;
|
||||
overlay.SetHandlers(OpenUrl, AppendUrl);
|
||||
overlay.lines[0] = "&eAre you sure you want to open this link?";
|
||||
|
||||
overlay.lines[1] = url;
|
||||
overlay.lines[2] = "Be careful - links from strangers may be websites that";
|
||||
overlay.lines[3] = " have viruses, or things you may not want to open/see.";
|
||||
game.Gui.ShowOverlay(overlay);
|
||||
Overlay overlay = new UrlWarningOverlay(url);
|
||||
Gui_ShowOverlay(overlay, false);
|
||||
} else if (Game_ClickableChat) {
|
||||
InputWidget_AppendString(&screen->Input.Base, &text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user