mirror of
https://github.com/wiiu-env/Flappy-Bird_GX2.git
synced 2024-11-27 10:04:16 +01:00
Fix compiling with latest libgui version
This commit is contained in:
parent
74158fea6e
commit
e46ca4901a
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ build/
|
||||
*.elf
|
||||
*.exe
|
||||
src/resources/filelist.h
|
||||
*.wbf
|
||||
out/
|
||||
|
2
Makefile
2
Makefile
@ -52,7 +52,7 @@ LIBS := -lgui -lfreetype -lgd -lpng -ljpeg -lz -lmad -lvorbisidec -logg -lbz2 -
|
||||
# list of directories containing libraries, this must be the top level
|
||||
# containing include and lib
|
||||
#-------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
|
||||
LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUT_ROOT)/usr
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "resources/Resources.h"
|
||||
#include "gui/sounds/SoundHandler.hpp"
|
||||
#include "system/memory.h"
|
||||
#include "system/AsyncDeleter.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
Application *Application::applicationInstance = NULL;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <coreinit/time.h>
|
||||
#include "Pipe.h"
|
||||
#include "gui/GuiTrigger.h"
|
||||
#include "gui/GuiController.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "utils/StringTools.h"
|
||||
#include "utils/logger.h"
|
||||
#include "resources/Resources.h"
|
||||
#include "system/AsyncDeleter.h"
|
||||
|
||||
MainWindow::MainWindow(int w, int h)
|
||||
: width(w)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <system/AsyncDeleter.h>
|
||||
#include "AsyncDeleter.h"
|
||||
|
||||
AsyncDeleter * AsyncDeleter::deleterInstance = NULL;
|
||||
|
||||
@ -28,9 +28,8 @@ AsyncDeleter::~AsyncDeleter() {
|
||||
}
|
||||
|
||||
void AsyncDeleter::triggerDeleteProcess(void) {
|
||||
if(!deleterInstance){
|
||||
return;
|
||||
}
|
||||
if(!deleterInstance)
|
||||
deleterInstance = new AsyncDeleter;
|
||||
|
||||
//! to trigger the event after GUI process is finished execution
|
||||
//! this function is used to swap elements from one to next array
|
||||
@ -46,13 +45,14 @@ void AsyncDeleter::triggerDeleteProcess(void) {
|
||||
}
|
||||
|
||||
void AsyncDeleter::executeThread(void) {
|
||||
while(!exitApplication || !realDeleteElements.empty()) {
|
||||
if(realDeleteElements.empty()) suspendThread();
|
||||
while(!exitApplication) {
|
||||
suspendThread();
|
||||
|
||||
//! delete elements that require post process deleting
|
||||
//! because otherwise they would block or do invalid access on GUI thread
|
||||
while(!realDeleteElements.empty()) {
|
||||
deleteMutex.lock();
|
||||
AsyncDeleter::Element *element = realDeleteElements.front();
|
||||
GuiElement *element = realDeleteElements.front();
|
||||
realDeleteElements.pop();
|
||||
deleteMutex.unlock();
|
||||
|
||||
|
@ -18,17 +18,16 @@
|
||||
#define _ASYNC_DELETER_H
|
||||
|
||||
#include <queue>
|
||||
#include <gui/gui.h>
|
||||
#include "CThread.h"
|
||||
#include "CMutex.h"
|
||||
|
||||
class AsyncDeleter : public CThread {
|
||||
public:
|
||||
static void destroyInstance() {
|
||||
if(deleterInstance != NULL) {
|
||||
delete deleterInstance;
|
||||
deleterInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
class Element {
|
||||
public:
|
||||
@ -36,27 +35,13 @@ public:
|
||||
virtual ~Element() {}
|
||||
};
|
||||
|
||||
static void pushForDelete(AsyncDeleter::Element *e) {
|
||||
if(!deleterInstance) {
|
||||
deleterInstance = new AsyncDeleter();
|
||||
}
|
||||
static void pushForDelete(GuiElement *e) {
|
||||
if(!deleterInstance)
|
||||
deleterInstance = new AsyncDeleter;
|
||||
|
||||
deleterInstance->deleteElements.push(e);
|
||||
}
|
||||
|
||||
static BOOL deleteListEmpty() {
|
||||
if(!deleterInstance) {
|
||||
return true;
|
||||
}
|
||||
return deleterInstance->deleteElements.empty();
|
||||
}
|
||||
|
||||
static BOOL realListEmpty() {
|
||||
if(!deleterInstance) {
|
||||
return true;
|
||||
}
|
||||
return deleterInstance->realDeleteElements.empty();
|
||||
}
|
||||
|
||||
static void triggerDeleteProcess(void);
|
||||
|
||||
private:
|
||||
@ -67,9 +52,9 @@ private:
|
||||
|
||||
void executeThread(void);
|
||||
|
||||
BOOL exitApplication;
|
||||
std::queue<AsyncDeleter::Element *> deleteElements;
|
||||
std::queue<AsyncDeleter::Element *> realDeleteElements;
|
||||
bool exitApplication;
|
||||
std::queue<GuiElement *> deleteElements;
|
||||
std::queue<GuiElement *> realDeleteElements;
|
||||
CMutex deleteMutex;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user