Reset the cursor when opening new GUI pages. Patch by danger89, refs #539.
Remove duplicate cursor image and duplicate hardcoded default paths. This was SVN commit r18933.
This commit is contained in:
parent
29e809f3e9
commit
34ce0f865d
BIN
binaries/data/mods/public/art/textures/cursors/arrow-default.png
(Stored with Git LFS)
BIN
binaries/data/mods/public/art/textures/cursors/arrow-default.png
(Stored with Git LFS)
Binary file not shown.
@ -1 +0,0 @@
|
||||
1 1
|
@ -24,6 +24,5 @@ function cancelOnError(msg)
|
||||
});
|
||||
}
|
||||
|
||||
// Reset cursor
|
||||
Engine.SetCursor("arrow-default");
|
||||
Engine.ResetCursor();
|
||||
}
|
||||
|
@ -52,6 +52,7 @@
|
||||
{"nick": "dan", "name": "Dan Strandberg"},
|
||||
{"name": "Daniel Trevitz"},
|
||||
{"nick": "DanCar", "name": "Daniel Cardenas"},
|
||||
{"nick": "danger89", "name": "Melroy van den Berg"},
|
||||
{"nick": "Dave", "name": "David Protasowski"},
|
||||
{"nick": "dax", "name": "Dacian Fiordean"},
|
||||
{"nick": "deebee", "name": "Deepak Anthony"},
|
||||
|
@ -103,6 +103,5 @@ function reallyStartGame()
|
||||
// Switch GUI from loading screen to game session.
|
||||
Engine.SwitchGuiPage("page_session.xml", g_Data);
|
||||
|
||||
// Restore default cursor.
|
||||
Engine.SetCursor("arrow-default");
|
||||
Engine.ResetCursor();
|
||||
}
|
||||
|
@ -79,7 +79,8 @@ function updateCursorAndTooltip()
|
||||
}
|
||||
|
||||
if (!cursorSet)
|
||||
Engine.SetCursor("arrow-default");
|
||||
Engine.ResetCursor();
|
||||
|
||||
if (!tooltipSet)
|
||||
informationTooltip.hidden = true;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -26,6 +26,7 @@
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
#include "scriptinterface/ScriptRuntime.h"
|
||||
|
||||
@ -97,6 +98,8 @@ void CGUIManager::PushPage(const CStrW& pageName, shared_ptr<ScriptInterface::St
|
||||
m_PageStack.back().name = pageName;
|
||||
m_PageStack.back().initData = initData;
|
||||
LoadPage(m_PageStack.back());
|
||||
|
||||
ResetCursor();
|
||||
}
|
||||
|
||||
void CGUIManager::PopPage()
|
||||
@ -299,6 +302,11 @@ Status CGUIManager::ReloadAllPages()
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
void CGUIManager::ResetCursor()
|
||||
{
|
||||
g_CursorName = g_DefaultCursor;
|
||||
}
|
||||
|
||||
std::string CGUIManager::GetSavedGameData()
|
||||
{
|
||||
shared_ptr<ScriptInterface> scriptInterface = top()->GetScriptInterface();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -92,6 +92,11 @@ public:
|
||||
*/
|
||||
Status ReloadChangedFile(const VfsPath& path);
|
||||
|
||||
/**
|
||||
* Sets the default mouse pointer.
|
||||
*/
|
||||
void ResetCursor();
|
||||
|
||||
/**
|
||||
* Called when we should reload all pages (e.g. translation hotloading update).
|
||||
*/
|
||||
|
@ -113,6 +113,11 @@ void PopGuiPageCB(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue args)
|
||||
g_GUI->PopPageCB(pCxPrivate->pScriptInterface->WriteStructuredClone(args));
|
||||
}
|
||||
|
||||
void ResetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
g_GUI->ResetCursor();
|
||||
}
|
||||
|
||||
JS::Value GuiInterfaceCall(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name, JS::HandleValue data)
|
||||
{
|
||||
if (!g_Game)
|
||||
@ -1016,6 +1021,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<void, &PopGuiPage>("PopGuiPage");
|
||||
scriptInterface.RegisterFunction<void, JS::HandleValue, &PopGuiPageCB>("PopGuiPageCB");
|
||||
scriptInterface.RegisterFunction<JS::Value, CStr, &GetGUIObjectByName>("GetGUIObjectByName");
|
||||
scriptInterface.RegisterFunction<void, &ResetCursor>("ResetCursor");
|
||||
|
||||
// Simulation<->GUI interface functions:
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, JS::HandleValue, &GuiInterfaceCall>("GuiInterfaceCall");
|
||||
|
@ -27,7 +27,9 @@
|
||||
|
||||
// (these variables are documented in the header.)
|
||||
|
||||
CStrW g_CursorName = L"test";
|
||||
const wchar_t g_DefaultCursor[] = L"default-arrow";
|
||||
|
||||
CStrW g_CursorName = g_DefaultCursor;
|
||||
|
||||
bool g_NoGLS3TC = false;
|
||||
bool g_NoGLAutoMipmap = false;
|
||||
|
@ -92,6 +92,7 @@ extern bool g_Quickstart;
|
||||
extern bool g_DisableAudio;
|
||||
|
||||
extern CStrW g_CursorName;
|
||||
extern const wchar_t g_DefaultCursor[];
|
||||
|
||||
class CmdLineArgs;
|
||||
extern void CONFIG_Init(const CmdLineArgs& args);
|
||||
|
Loading…
Reference in New Issue
Block a user