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
|
*.elf
|
||||||
*.exe
|
*.exe
|
||||||
src/resources/filelist.h
|
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
|
# list of directories containing libraries, this must be the top level
|
||||||
# containing include and lib
|
# 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
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "resources/Resources.h"
|
#include "resources/Resources.h"
|
||||||
#include "gui/sounds/SoundHandler.hpp"
|
#include "gui/sounds/SoundHandler.hpp"
|
||||||
#include "system/memory.h"
|
#include "system/memory.h"
|
||||||
|
#include "system/AsyncDeleter.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
Application *Application::applicationInstance = NULL;
|
Application *Application::applicationInstance = NULL;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <coreinit/time.h>
|
||||||
#include "Pipe.h"
|
#include "Pipe.h"
|
||||||
#include "gui/GuiTrigger.h"
|
#include "gui/GuiTrigger.h"
|
||||||
#include "gui/GuiController.h"
|
#include "gui/GuiController.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "utils/StringTools.h"
|
#include "utils/StringTools.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "resources/Resources.h"
|
#include "resources/Resources.h"
|
||||||
|
#include "system/AsyncDeleter.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(int w, int h)
|
MainWindow::MainWindow(int w, int h)
|
||||||
: width(w)
|
: width(w)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <system/AsyncDeleter.h>
|
#include "AsyncDeleter.h"
|
||||||
|
|
||||||
AsyncDeleter * AsyncDeleter::deleterInstance = NULL;
|
AsyncDeleter * AsyncDeleter::deleterInstance = NULL;
|
||||||
|
|
||||||
@ -28,9 +28,8 @@ AsyncDeleter::~AsyncDeleter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncDeleter::triggerDeleteProcess(void) {
|
void AsyncDeleter::triggerDeleteProcess(void) {
|
||||||
if(!deleterInstance){
|
if(!deleterInstance)
|
||||||
return;
|
deleterInstance = new AsyncDeleter;
|
||||||
}
|
|
||||||
|
|
||||||
//! to trigger the event after GUI process is finished execution
|
//! to trigger the event after GUI process is finished execution
|
||||||
//! this function is used to swap elements from one to next array
|
//! this function is used to swap elements from one to next array
|
||||||
@ -46,13 +45,14 @@ void AsyncDeleter::triggerDeleteProcess(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncDeleter::executeThread(void) {
|
void AsyncDeleter::executeThread(void) {
|
||||||
while(!exitApplication || !realDeleteElements.empty()) {
|
while(!exitApplication) {
|
||||||
if(realDeleteElements.empty()) suspendThread();
|
suspendThread();
|
||||||
|
|
||||||
//! delete elements that require post process deleting
|
//! delete elements that require post process deleting
|
||||||
//! because otherwise they would block or do invalid access on GUI thread
|
//! because otherwise they would block or do invalid access on GUI thread
|
||||||
while(!realDeleteElements.empty()) {
|
while(!realDeleteElements.empty()) {
|
||||||
deleteMutex.lock();
|
deleteMutex.lock();
|
||||||
AsyncDeleter::Element *element = realDeleteElements.front();
|
GuiElement *element = realDeleteElements.front();
|
||||||
realDeleteElements.pop();
|
realDeleteElements.pop();
|
||||||
deleteMutex.unlock();
|
deleteMutex.unlock();
|
||||||
|
|
||||||
|
@ -18,16 +18,15 @@
|
|||||||
#define _ASYNC_DELETER_H
|
#define _ASYNC_DELETER_H
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <gui/gui.h>
|
||||||
#include "CThread.h"
|
#include "CThread.h"
|
||||||
#include "CMutex.h"
|
#include "CMutex.h"
|
||||||
|
|
||||||
class AsyncDeleter : public CThread {
|
class AsyncDeleter : public CThread {
|
||||||
public:
|
public:
|
||||||
static void destroyInstance() {
|
static void destroyInstance() {
|
||||||
if(deleterInstance != NULL) {
|
delete deleterInstance;
|
||||||
delete deleterInstance;
|
deleterInstance = NULL;
|
||||||
deleterInstance = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Element {
|
class Element {
|
||||||
@ -36,27 +35,13 @@ public:
|
|||||||
virtual ~Element() {}
|
virtual ~Element() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pushForDelete(AsyncDeleter::Element *e) {
|
static void pushForDelete(GuiElement *e) {
|
||||||
if(!deleterInstance) {
|
if(!deleterInstance)
|
||||||
deleterInstance = new AsyncDeleter();
|
deleterInstance = new AsyncDeleter;
|
||||||
}
|
|
||||||
deleterInstance->deleteElements.push(e);
|
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);
|
static void triggerDeleteProcess(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -67,9 +52,9 @@ private:
|
|||||||
|
|
||||||
void executeThread(void);
|
void executeThread(void);
|
||||||
|
|
||||||
BOOL exitApplication;
|
bool exitApplication;
|
||||||
std::queue<AsyncDeleter::Element *> deleteElements;
|
std::queue<GuiElement *> deleteElements;
|
||||||
std::queue<AsyncDeleter::Element *> realDeleteElements;
|
std::queue<GuiElement *> realDeleteElements;
|
||||||
CMutex deleteMutex;
|
CMutex deleteMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user