Make CGUIManager register a callback function for hotloading instead of specifically calling it.
This was SVN commit r15482.
This commit is contained in:
parent
30e851ab90
commit
ffd6e10edf
@ -47,16 +47,23 @@ InReaction gui_handler(const SDL_Event_* ev)
|
||||
return g_GUI->HandleEvent(ev);
|
||||
}
|
||||
|
||||
static Status ReloadChangedFileCB(void* param, const VfsPath& path)
|
||||
{
|
||||
return static_cast<CGUIManager*>(param)->ReloadChangedFile(path);
|
||||
}
|
||||
|
||||
CGUIManager::CGUIManager()
|
||||
{
|
||||
m_ScriptRuntime = g_ScriptRuntime;
|
||||
m_ScriptInterface.reset(new ScriptInterface("Engine", "GUIManager", m_ScriptRuntime));
|
||||
m_ScriptInterface->SetCallbackData(this);
|
||||
m_ScriptInterface->LoadGlobalScripts();
|
||||
RegisterFileReloadFunc(ReloadChangedFileCB, this);
|
||||
}
|
||||
|
||||
CGUIManager::~CGUIManager()
|
||||
{
|
||||
UnregisterFileReloadFunc(ReloadChangedFileCB, this);
|
||||
}
|
||||
|
||||
bool CGUIManager::HasPages()
|
||||
@ -259,7 +266,7 @@ void CGUIManager::LoadPage(SGUIPage& page)
|
||||
previousPageScriptInterface.reset();
|
||||
}
|
||||
|
||||
Status CGUIManager::ReloadChangedFiles(const VfsPath& path)
|
||||
Status CGUIManager::ReloadChangedFile(const VfsPath& path)
|
||||
{
|
||||
for (PageStackType::iterator it = m_PageStack.begin(); it != m_PageStack.end(); ++it)
|
||||
{
|
||||
|
@ -88,9 +88,9 @@ public:
|
||||
void DisplayMessageBox(int width, int height, const CStrW& title, const CStrW& message);
|
||||
|
||||
/**
|
||||
* Call when a file has bee modified, to hotload pages if their .xml files changed.
|
||||
* Called when a file has been modified, to hotload changes.
|
||||
*/
|
||||
Status ReloadChangedFiles(const VfsPath& path);
|
||||
Status ReloadChangedFile(const VfsPath& path);
|
||||
|
||||
/**
|
||||
* Pass input events to the currently active GUI page.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -18,7 +18,6 @@
|
||||
#include "precompiled.h"
|
||||
#include "Filesystem.h"
|
||||
|
||||
#include "gui/GUIManager.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Profile.h"
|
||||
|
||||
@ -84,8 +83,6 @@ Status ReloadChangedFiles()
|
||||
|
||||
// Tell each hotloadable system about this file change:
|
||||
|
||||
RETURN_STATUS_IF_ERR(g_GUI->ReloadChangedFiles(pathname));
|
||||
|
||||
for (size_t j = 0; j < g_ReloadFuncs.size(); ++j)
|
||||
g_ReloadFuncs[j].first(g_ReloadFuncs[j].second, pathname);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user