Updated the Qt project to work on Desktop/Maemo/Meego/Symbian. Removed all dependencies except Qt and OpenGl.

This commit is contained in:
Xawotihs
2011-07-17 18:18:17 +00:00
parent d81afa93c5
commit 9dccc885d6
10 changed files with 285 additions and 25 deletions

View File

@@ -16,7 +16,7 @@
#include <string.h>
#include <stdarg.h>
#if (!defined IOS) && (!defined ANDROID)
#if (!defined IOS) && (!defined ANDROID) && (!defined QT_CONFIG)
#include <gif_lib.h>
#endif //IOS ANDROID
@@ -569,7 +569,7 @@ private:
bool mVRAM;
};
#if (!defined IOS)
#if (!defined IOS) && (!defined QT_CONFIG)
void LoadJPG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
int LoadPNG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
#if (!defined ANDROID)

View File

@@ -58,7 +58,7 @@ class JMusic
#endif
public:
JMusic();
~JMusic();
~JMusic();
void Update();
int getPlayTime();

View File

@@ -120,10 +120,11 @@ enum {
#undef GL_ES_VERSION_2_0
#undef GL_VERSION_2_0
#define GL_VERSION_ES_CM_1_1 1
#ifndef GL_OES_VERSION_1_1
#define glOrthof glOrtho
#define glClearDepthf glClearDepth
#endif
#endif
#if defined (PSP)

View File

@@ -1,7 +1,7 @@
#ifndef THREADING_H
#define THREADING_H
#if !defined(PSP)
#if !defined(PSP) && !defined(QT_CONFIG)
#include <boost/date_time.hpp>
#ifdef WIN32
@@ -14,7 +14,7 @@
#endif
#include <boost/thread/mutex.hpp>
#else
#elif !defined(QT_CONFIG)
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
@@ -307,6 +307,239 @@ namespace boost
}
}
#elif defined(QT_CONFIG)
#include <QMutex>
#include <QThread>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "../include/DebugRoutines.h"
#include "../include/JLogger.h"
namespace boost
{
template <class Mutex>
struct unique_lock
{
unique_lock(Mutex& inMutex) : mMutex(&inMutex)
{
mMutex->lock();
}
~unique_lock()
{
mMutex->unlock();
}
Mutex* mMutex;
};
class mutex
{
public:
typedef unique_lock<mutex> scoped_lock;
mutex()
: mQMutex()
{
}
~mutex()
{
}
void lock()
{
mQMutex.lock();
}
void unlock()
{
mQMutex.unlock();
}
QMutex mQMutex;
private:
mutex(mutex const&);
mutex& operator=(mutex const&);
};
class recursive_mutex
{
public:
typedef unique_lock<recursive_mutex> scoped_lock;
recursive_mutex() : mQMutex(QMutex::Recursive)
{
}
~recursive_mutex()
{
}
void lock()
{
mQMutex.lock();
}
void unlock()
{
mQMutex.unlock();
}
QMutex mQMutex;
private:
recursive_mutex(recursive_mutex const&);
recursive_mutex& operator=(recursive_mutex const&);
};
/**
** Emulating boost::thread configuration glue, with some shortcuts
** This detail namespace is a distillation of boost's thread.hpp, thread_data.hpp.
*/
namespace detail
{
struct thread_data_base
{
thread_data_base()
{
}
virtual ~thread_data_base()
{
}
virtual void run() = 0;
};
typedef boost::shared_ptr<detail::thread_data_base> thread_data_ptr;
template<typename F>
class thread_data : public detail::thread_data_base
{
public:
thread_data(F f_) : f(f_)
{
}
void run()
{
f();
}
private:
F f;
void operator=(thread_data&);
thread_data(thread_data&);
};
} //namespace detail
class threadImpl : public QThread
{
detail::thread_data_ptr mThreadInfo;
public:
static threadImpl* spThreadImpl;
threadImpl(detail::thread_data_ptr threadInfo) : mThreadInfo(threadInfo)
{
setTerminationEnabled();
spThreadImpl = this;
};
static void mymsleep(unsigned long msecs)
{
spThreadImpl->msleep(msecs);
}
protected:
void run()
{
LOG("Entering thread::run");
mThreadInfo->run();
}
};
threadImpl* threadImpl::spThreadImpl = 0;
/**
** A simplistic implementation of boost::thread, using QThread.
**
*/
class thread
{
/*
** Helper class for sceKernelStartThread, which passes args by value, not by reference
** We use this struct to wrap any pointers that we want to pass to the worker thread.
*/
struct CallbackData
{
CallbackData(detail::thread_data_ptr inThreadInfo)
: mThreadInfo(inThreadInfo)
{
}
detail::thread_data_ptr mThreadInfo;
};
public:
thread()
{
}
template <class F,class A1>
thread(F f, A1 a1) : mThreadInfo(make_thread_info(boost::bind(boost::type<void>(), f, a1)))
{
mpThread = new threadImpl(mThreadInfo);
LOG("Calling start func");
mpThread->start(QThread::LowPriority);
}
~thread()
{
}
void join()
{
mpThread->terminate();
}
private:
template<typename F>
static inline detail::thread_data_ptr make_thread_info(F f)
{
return detail::thread_data_ptr(new detail::thread_data<F>(f));
}
detail::thread_data_ptr mThreadInfo;
threadImpl* mpThread;
};
namespace posix_time
{
typedef unsigned int milliseconds;
}
/**
** boost's platform neutral sleep call.
*/
namespace this_thread
{
inline void sleep(boost::posix_time::milliseconds const& time)
{
threadImpl::mymsleep(time);
}
}
}
#endif
#endif // THREADING_H