- Merged QWidget and QML Qt frontends, just define QT_WIDGET to select the QWidget one
- Coded a resource package download GUI based on QWidget - Removed compilation warning on unused variable - Updated Maemo desktop file to start directly the binary - Updated .pro file - Updated version macros to be able to compose the resource package file - Updated QML interface for Android - Updated QML interface to not contain the name of the resource package - Updated the file downloader class to be able to get the resource package hash from the google code server - Updated the file downloaded class to verify the resource package hash from the remote server at each startup to be able to perform automatic update - Defined several JGE operation as static to clean up the wagic wrapper
This commit is contained in:
@@ -244,7 +244,7 @@ class JGE
|
||||
///
|
||||
/// @return The number of bound keys so far
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
u32 BindKey(LocalKeySym keycode, JButton button);
|
||||
static u32 BindKey(LocalKeySym keycode, JButton button);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Undo a binding.
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
/// @return - User defined JApp instance.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JApp* GetGameApp();
|
||||
static JApp* GetGameApp();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get application name. Mainly for Windows build to setup the name
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
/// @return - Application name.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
char *GetName();
|
||||
static char *GetName();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Get initialization flags.
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/// @return - Initialization flags.
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
u32 GetInitFlags();
|
||||
static u32 GetInitFlags();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#define COREWRAPPER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QElapsedTimer>
|
||||
#ifndef QT_WIDGET
|
||||
#include <QtDeclarative>
|
||||
#include <QGraphicsItem>
|
||||
#endif //QT_WIDGET
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
@@ -11,23 +14,31 @@
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
class WagicCore : public QGLWidget
|
||||
#else
|
||||
class WagicCore : public QDeclarativeItem
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
#ifdef QT_WIDGET
|
||||
typedef QGLWidget super;
|
||||
#else
|
||||
typedef QDeclarativeItem super;
|
||||
#endif //QT_WIDGET
|
||||
|
||||
public:
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int nominalWidth READ getNominalWidth CONSTANT)
|
||||
Q_PROPERTY(int nominalHeight READ getNominalHeight CONSTANT)
|
||||
Q_PROPERTY(float nominalRatio READ getNominalRatio CONSTANT)
|
||||
Q_PROPERTY(bool active READ getActive WRITE setActive NOTIFY activeChanged)
|
||||
|
||||
|
||||
public:
|
||||
explicit WagicCore(QDeclarativeItem *parent = 0);
|
||||
explicit WagicCore(super *parent = 0);
|
||||
virtual ~WagicCore();
|
||||
void initApp();
|
||||
void render(){
|
||||
if(m_engine)
|
||||
m_engine->Render();
|
||||
};
|
||||
|
||||
Q_INVOKABLE void doOK() {
|
||||
doAndEnqueue(JGE_BTN_OK);
|
||||
@@ -60,11 +71,34 @@ public:
|
||||
float getNominalRatio() { return ((float)SCREEN_WIDTH / (float)SCREEN_HEIGHT);};
|
||||
bool getActive() { return m_active; };
|
||||
void setActive(bool active);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
void resize ( const QRectF &rect);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
void initializeGL();
|
||||
void resizeGL(int width, int height);
|
||||
void paintGL();
|
||||
static char* getApplicationName() {
|
||||
return JGameLauncher::GetName();
|
||||
};
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void tapAndHoldTriggered(QTapAndHoldGesture* gesture);
|
||||
void showEvent(QShowEvent *event);
|
||||
void hideEvent(QHideEvent *event);
|
||||
bool gestureEvent(QGestureEvent* event);
|
||||
bool event(QEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
#else
|
||||
void wheelEvent ( QGraphicsSceneWheelEvent * event);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
#endif
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
public slots:
|
||||
void start(int);
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void activeChanged();
|
||||
@@ -90,7 +124,16 @@ private:
|
||||
int m_timerId;
|
||||
bool m_active;
|
||||
QRect m_viewPort;
|
||||
#ifdef QT_WIDGET
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
int mMouseDownX;
|
||||
int mMouseDownY;
|
||||
qint64 mLastFingerDownTime;
|
||||
#endif //Q_WS_MAEMO_5
|
||||
#endif //QT_WIDGET
|
||||
};
|
||||
#ifndef QT_WIDGET
|
||||
QML_DECLARE_TYPE(WagicCore)
|
||||
#endif //QT_WIDGET
|
||||
|
||||
#endif // COREWRAPPER_H
|
||||
|
||||
@@ -6,56 +6,116 @@
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <qdeclarative.h>
|
||||
#include <QTemporaryFile>
|
||||
#ifdef QT_WIDGET
|
||||
#include <QProgressDialog>
|
||||
#else
|
||||
#include <qdeclarative.h>
|
||||
#endif //QT_WIDGET
|
||||
|
||||
|
||||
class FileDownloader : public QObject
|
||||
class FileDownloader :
|
||||
#ifdef QT_WIDGET
|
||||
public QProgressDialog
|
||||
#else
|
||||
public QObject
|
||||
#endif //QT_WIDGET
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qint64 received READ received NOTIFY receivedChanged)
|
||||
Q_PROPERTY(QUrl url READ getDownloadUrl WRITE setDownloadUrl NOTIFY downloadUrlChanged)
|
||||
Q_PROPERTY(QString hash READ getHash NOTIFY hashChanged)
|
||||
Q_PROPERTY(QString status READ getStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(DownloadState state READ getState NOTIFY stateChanged )
|
||||
Q_PROPERTY(QString state_string READ getStateString NOTIFY stateStringChanged )
|
||||
Q_ENUMS(DownloadState)
|
||||
public:
|
||||
explicit FileDownloader(QString localPath, QObject *parent = 0);
|
||||
enum DownloadState {
|
||||
NETWORK_ERROR,
|
||||
DOWNLOADING_HASH,
|
||||
DOWNLOADING_FILE,
|
||||
DOWNLOADED
|
||||
} ;
|
||||
|
||||
explicit FileDownloader(QString localPath, QString targetFile, QObject *parent = 0);
|
||||
virtual ~FileDownloader();
|
||||
qint64 received() const {return m_received;};
|
||||
QUrl getDownloadUrl() {return m_downloadUrl;};
|
||||
QString getHash() {return m_hash;};
|
||||
QString getStatus() {return m_status;};
|
||||
DownloadState getState() {
|
||||
return m_state;
|
||||
};
|
||||
QString getStateString() {
|
||||
if(m_state == DOWNLOADING_HASH )
|
||||
return "DOWNLOADING_HASH";
|
||||
else if(m_state == DOWNLOADING_FILE )
|
||||
return "DOWNLOADING_FILE";
|
||||
else
|
||||
return "DOWNLOADED";
|
||||
}
|
||||
|
||||
signals:
|
||||
void receivedChanged();
|
||||
void downloadUrlChanged();
|
||||
void hashChanged();
|
||||
void receivedChanged(int value);
|
||||
void statusChanged();
|
||||
void stateChanged(DownloadState state);
|
||||
void stateStringChanged();
|
||||
|
||||
private slots:
|
||||
void fileDownloaded(QNetworkReply* pReply){
|
||||
if(m_tmp.write(pReply->readAll()) == -1) return;
|
||||
void fileDownloaded(){
|
||||
if(m_tmp.write(m_downloadReply->readAll()) == -1) return;
|
||||
if(QFile(m_localPath).exists())
|
||||
QFile::remove(m_localPath);
|
||||
|
||||
if(!m_tmp.rename(m_localPath)) return;
|
||||
|
||||
computeHash(m_tmp);
|
||||
computeLocalHash(m_tmp);
|
||||
m_tmp.setAutoRemove(false);
|
||||
m_state = DOWNLOADED;
|
||||
emit stateChanged(m_state);
|
||||
};
|
||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal){
|
||||
if(m_tmp.write(m_downloadReply->readAll()) == -1) return;
|
||||
m_received = bytesReceived*100/bytesTotal;
|
||||
emit receivedChanged();
|
||||
emit receivedChanged(m_received);
|
||||
};
|
||||
void setDownloadUrl(QUrl url);
|
||||
void computeHash(QFile& file);
|
||||
void computeLocalHash(QFile& file);
|
||||
void requestHash(QUrl url);
|
||||
void computeRemoteHash();
|
||||
void handleStateChange(DownloadState state){
|
||||
#ifdef QT_WIDGET
|
||||
switch(state) {
|
||||
case DOWNLOADED:
|
||||
case NETWORK_ERROR:
|
||||
emit finished(0);
|
||||
break;
|
||||
case DOWNLOADING_HASH:
|
||||
break;
|
||||
case DOWNLOADING_FILE:
|
||||
show();
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
emit stateStringChanged();
|
||||
#endif //QT_WIDGET
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DownloadState m_state;
|
||||
QNetworkAccessManager m_WebCtrl;
|
||||
qint64 m_received;
|
||||
QTemporaryFile m_tmp;
|
||||
QString m_targetFile;
|
||||
QString m_localPath;
|
||||
QUrl m_downloadUrl;
|
||||
QString m_hash;
|
||||
QString m_localHash;
|
||||
QString m_remoteHash;
|
||||
bool m_OK;
|
||||
QString m_status;
|
||||
QNetworkReply* m_downloadReply;
|
||||
QNetworkReply* m_hashReply;
|
||||
};
|
||||
#ifndef QT_WIDGET
|
||||
QML_DECLARE_TYPEINFO(FileDownloader, QML_HAS_ATTACHED_PROPERTIES)
|
||||
#endif //QT_WIDGET
|
||||
|
||||
#endif // FILEDOWNLOADER_H
|
||||
|
||||
@@ -2,184 +2,18 @@
|
||||
#include <QtOpenGL>
|
||||
#include <QTime>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QScopedPointer>
|
||||
#ifdef QT_WIDGET
|
||||
#include <QWidget>
|
||||
#else
|
||||
#include <QtDeclarative>
|
||||
#include "qmlapplicationviewer.h"
|
||||
#endif //QT_WIDGET
|
||||
#include "filedownloader.h"
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
#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 Q_WS_MAEMO_5)
|
||||
// For volume buttons support
|
||||
#include <QtGui/QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
// For screen on/off events support
|
||||
#include <mce/dbus-names.h>
|
||||
#include <mce/mode-names.h>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusInterface>
|
||||
#endif //Q_WS_MAEMO_5
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
#undef GL_ES_VERSION_2_0
|
||||
#undef GL_VERSION_2_0
|
||||
#define GL_VERSION_ES_CM_1_1 1
|
||||
#define glOrthof glOrtho
|
||||
#define glClearDepthf glClearDepth
|
||||
#endif
|
||||
|
||||
#include "GameApp.h"
|
||||
#include "corewrapper.h"
|
||||
|
||||
#define ACTUAL_SCREEN_WIDTH (SCREEN_WIDTH)
|
||||
#define ACTUAL_SCREEN_HEIGHT (SCREEN_HEIGHT)
|
||||
#define ACTUAL_RATIO ((GLfloat)ACTUAL_SCREEN_WIDTH / (GLfloat)ACTUAL_SCREEN_HEIGHT)
|
||||
|
||||
// in pixels
|
||||
#define kHitzonePliancy 50
|
||||
|
||||
// tick value equates to ms
|
||||
#define kTapEventTimeout 250
|
||||
|
||||
// swipe duration
|
||||
#define kSwipeEventMinDuration 250
|
||||
// swipe distance in pixel (from top to down)
|
||||
#define kSwipeMinDistance 200
|
||||
|
||||
|
||||
class JGEQtRenderer : public QGLWidget
|
||||
{
|
||||
|
||||
public:
|
||||
JGEQtRenderer(QWidget *parent);
|
||||
virtual ~JGEQtRenderer(){
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
delete dBusInterface;
|
||||
#endif //Q_WS_MAEMO_5
|
||||
};
|
||||
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
public slots:
|
||||
void displayStateChanged(const QDBusMessage &message);
|
||||
#endif //Q_WS_MAEMO_5
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
|
||||
void resizeGL(int w, int h);
|
||||
|
||||
void paintGL();
|
||||
|
||||
void timerEvent( QTimerEvent* );
|
||||
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
void keyReleaseEvent(QKeyEvent *event);
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
|
||||
void showEvent ( QShowEvent * event );
|
||||
|
||||
void hideEvent ( QHideEvent * event );
|
||||
|
||||
bool event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Gesture)
|
||||
return gestureEvent(static_cast<QGestureEvent*>(event));
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
else if (event->type() == QEvent::WindowActivate)
|
||||
{
|
||||
JGE::GetInstance()->Resume();
|
||||
showEvent(NULL);
|
||||
}
|
||||
else if (event->type() == QEvent::WindowDeactivate)
|
||||
{
|
||||
JGE::GetInstance()->Pause();
|
||||
hideEvent(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
return QGLWidget::event(event);
|
||||
}
|
||||
|
||||
bool gestureEvent(QGestureEvent* event)
|
||||
{
|
||||
if (QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture))
|
||||
tapAndHoldTriggered(static_cast<QTapAndHoldGesture *>(tapAndHold));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tapAndHoldTriggered(QTapAndHoldGesture* gesture);
|
||||
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
void grabZoomKeys(bool grab)
|
||||
{
|
||||
if (!winId()) {
|
||||
qWarning("Can't grab keys unless we have a window id");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned long val = (grab) ? 1 : 0;
|
||||
Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
|
||||
if (!atom) {
|
||||
qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM. This example will only work "
|
||||
"on a Maemo 5 device!");
|
||||
return;
|
||||
}
|
||||
|
||||
XChangeProperty (QX11Info::display(),
|
||||
winId(),
|
||||
atom,
|
||||
XA_INTEGER,
|
||||
32,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<unsigned char *>(&val),
|
||||
1);
|
||||
}
|
||||
#endif //Q_WS_MAEMO_5
|
||||
|
||||
protected:
|
||||
int timerId;
|
||||
bool timerStarted;
|
||||
QRect viewPort;
|
||||
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
int mMouseDownX;
|
||||
int mMouseDownY;
|
||||
qint64 mLastFingerDownTime;
|
||||
#endif //Q_WS_MAEMO_5
|
||||
|
||||
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
QDBusConnection dBusConnection;
|
||||
QDBusInterface* dBusInterface;
|
||||
#endif //Q_WS_MAEMO_5
|
||||
};
|
||||
|
||||
QElapsedTimer g_startTimer;
|
||||
qint64 lastTickCount;
|
||||
JGE* g_engine = NULL;
|
||||
JApp* g_app = NULL;
|
||||
JGameLauncher* g_launcher = NULL;
|
||||
QWidget *g_glwidget = NULL;
|
||||
QWidget* g_glwidget = NULL;
|
||||
|
||||
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
|
||||
{
|
||||
@@ -204,7 +38,7 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
|
||||
void JGECreateDefaultBindings()
|
||||
{
|
||||
for (signed int i = sizeof(gDefaultBindings)/sizeof(gDefaultBindings[0]) - 1; i >= 0; --i)
|
||||
g_engine->BindKey(gDefaultBindings[i].keysym, gDefaultBindings[i].keycode);
|
||||
JGE::BindKey(gDefaultBindings[i].keysym, gDefaultBindings[i].keycode);
|
||||
}
|
||||
|
||||
bool JGEToggleFullscreen()
|
||||
@@ -220,417 +54,28 @@ bool JGEToggleFullscreen()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InitGame(void)
|
||||
int JGEGetTime()
|
||||
{
|
||||
g_engine = JGE::GetInstance();
|
||||
g_app = g_launcher->GetGameApp();
|
||||
g_app->Create();
|
||||
g_engine->SetApp(g_app);
|
||||
g_startTimer.start();
|
||||
|
||||
JRenderer::GetInstance()->Enable2D();
|
||||
lastTickCount = g_startTimer.elapsed();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DestroyGame(void)
|
||||
{
|
||||
g_engine->SetApp(NULL);
|
||||
if (g_app)
|
||||
{
|
||||
g_app->Destroy();
|
||||
delete g_app;
|
||||
g_app = NULL;
|
||||
}
|
||||
|
||||
JGE::Destroy();
|
||||
|
||||
g_engine = NULL;
|
||||
}
|
||||
|
||||
|
||||
JGEQtRenderer::JGEQtRenderer(QWidget *parent)
|
||||
: QGLWidget(parent) /* Seems to go faster without double buffering */
|
||||
, timerStarted(false)
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
, dBusConnection(QDBusConnection::systemBus())
|
||||
#endif //Q_WS_MAEMO_5
|
||||
{
|
||||
setWindowTitle(g_launcher->GetName());
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
setAttribute(Qt::WA_Maemo5AutoOrientation);
|
||||
setAttribute(Qt::WA_Maemo5NonComposited);
|
||||
#endif
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
grabZoomKeys(true);
|
||||
#endif
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
// setAttribute(Qt::WA_InputMethodEnabled);
|
||||
setMouseTracking(true);
|
||||
|
||||
grabGesture(Qt::PanGesture);
|
||||
grabGesture(Qt::PinchGesture);
|
||||
grabGesture(Qt::SwipeGesture);
|
||||
grabGesture(Qt::TapAndHoldGesture);
|
||||
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
dBusInterface = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH,
|
||||
MCE_REQUEST_IF, dBusConnection);
|
||||
|
||||
// Handle screen state on / off
|
||||
dBusConnection.connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_IF, MCE_DISPLAY_SIG, this, SLOT(displayStateChanged(const QDBusMessage &)));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef Q_WS_MAEMO_5
|
||||
void JGEQtRenderer::displayStateChanged(const QDBusMessage &message)
|
||||
{
|
||||
QString state = message.arguments().at(0).toString();
|
||||
if (!state.isEmpty()) {
|
||||
if (state == MCE_DISPLAY_ON_STRING) {
|
||||
showEvent(0);
|
||||
}
|
||||
else if (state == MCE_DISPLAY_OFF_STRING) {
|
||||
hideEvent(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void JGEQtRenderer::initializeGL()
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background (yes that's the way fuckers)
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
#if (defined GL_ES_VERSION_2_0)
|
||||
glClearDepthf(1.0f); // Depth Buffer Setup
|
||||
#else
|
||||
glClearDepth(1.0f); // Depth Buffer Setup
|
||||
#endif// (defined GL_ES_VERSION_2_0)
|
||||
|
||||
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing (Less Or Equal)
|
||||
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
|
||||
|
||||
#else
|
||||
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
|
||||
glClearDepthf(1.0f); // Depth Buffer Setup
|
||||
#else
|
||||
glClearDepth(1.0f); // Depth Buffer Setup
|
||||
#endif
|
||||
|
||||
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing (Less Or Equal)
|
||||
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
|
||||
glShadeModel(GL_SMOOTH); // Select Smooth Shading
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Set Perspective Calculations To Most Accurate
|
||||
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // Set Line Antialiasing
|
||||
glEnable(GL_LINE_SMOOTH); // Enable it!
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glEnable(GL_CULL_FACE); // do not calculate inside of poly's
|
||||
glFrontFace(GL_CCW); // counter clock-wise polygons are out
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST); // Enable Clipping
|
||||
}
|
||||
|
||||
void JGEQtRenderer::resizeGL(int width, int height)
|
||||
{
|
||||
if ((GLfloat)width / (GLfloat)height <= ACTUAL_RATIO)
|
||||
{
|
||||
viewPort.setLeft(0);
|
||||
viewPort.setTop(-((width/ACTUAL_RATIO)-height)/2);
|
||||
viewPort.setRight(width);
|
||||
viewPort.setBottom(-((width/ACTUAL_RATIO)-height)/2 + width / ACTUAL_RATIO);
|
||||
}
|
||||
else
|
||||
{
|
||||
viewPort.setLeft(-(height*ACTUAL_RATIO-width)/2);
|
||||
viewPort.setTop(0);
|
||||
viewPort.setRight(-(height*ACTUAL_RATIO-width)/2 + height * ACTUAL_RATIO);
|
||||
viewPort.setBottom(height);
|
||||
}
|
||||
|
||||
glViewport(viewPort.left(), viewPort.top(), viewPort.right()-viewPort.left(), viewPort.bottom()-viewPort.top());
|
||||
|
||||
JRenderer::GetInstance()->SetActualWidth(viewPort.right()-viewPort.left());
|
||||
JRenderer::GetInstance()->SetActualHeight(viewPort.bottom()-viewPort.top());
|
||||
glScissor(0, 0, width, height);
|
||||
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0)
|
||||
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
|
||||
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
|
||||
glOrthof(0.0f, (float) (viewPort.right()-viewPort.left())-1.0f, 0.0f, (float) (viewPort.bottom()-viewPort.top())-1.0f, -1.0f, 1.0f);
|
||||
#else
|
||||
gluOrtho2D(0.0f, (float) (viewPort.right()-viewPort.left())-1.0f, 0.0f, (float) (viewPort.bottom()-viewPort.top())-1.0f);
|
||||
#endif
|
||||
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
#endif
|
||||
}
|
||||
|
||||
void JGEQtRenderer::paintGL()
|
||||
{
|
||||
if(g_engine)
|
||||
g_engine->Render();
|
||||
}
|
||||
|
||||
void JGEQtRenderer::timerEvent( QTimerEvent* )
|
||||
{
|
||||
if(this->isVisible()
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
// This one is funny, this gives us 0% CPU when the app is in background for 1 line of code =)
|
||||
&& this->isActiveWindow()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
static qint64 tickCount;
|
||||
quint32 dt;
|
||||
tickCount = g_startTimer.elapsed();
|
||||
dt = (tickCount - lastTickCount);
|
||||
lastTickCount = tickCount;
|
||||
|
||||
if(g_engine->IsDone()) close();
|
||||
|
||||
//gPrevControllerState = gControllerState;
|
||||
g_engine->SetDelta((float)dt / 1000.0f);
|
||||
g_engine->Update((float)dt / 1000.0f);
|
||||
|
||||
// we stop rendering if the window is hidden
|
||||
if(!isHidden())
|
||||
updateGL();
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::tapAndHoldTriggered(QTapAndHoldGesture* gesture)
|
||||
{
|
||||
if (gesture->state() == Qt::GestureFinished) {
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
QPoint lastPos = event->pos();
|
||||
// this is intended to convert window coordinate into game coordinate.
|
||||
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
|
||||
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
|
||||
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
|
||||
|
||||
if (lastPos.y() >= viewPort.top() &&
|
||||
lastPos.y() <= viewPort.bottom() &&
|
||||
lastPos.x() <= viewPort.right() &&
|
||||
lastPos.x() >= viewPort.left()) {
|
||||
g_engine->LeftClicked(
|
||||
((lastPos.x()-viewPort.left())*SCREEN_WIDTH)/actualWidth,
|
||||
((lastPos.y()-viewPort.top())*SCREEN_HEIGHT)/actualHeight);
|
||||
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID)
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_OK);
|
||||
#else
|
||||
mMouseDownX = lastPos.x();
|
||||
mMouseDownY = lastPos.y();
|
||||
mLastFingerDownTime = g_startTimer.elapsed();
|
||||
#endif
|
||||
} else if(lastPos.y()<viewPort.top()) {
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
|
||||
} else if(lastPos.y()>viewPort.bottom()) {
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_NEXT);
|
||||
}
|
||||
|
||||
// g_engine->LeftClicked((lastPos.x()*SCREEN_WIDTH)/actualWidth, (lastPos.y()*SCREEN_HEIGHT)/actualHeight);
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::RightButton)
|
||||
{ /* next phase please */
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_PREV);
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::MidButton)
|
||||
{ /* interrupt please */
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_SEC);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QGLWidget::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
QPoint lastPos = event->pos();
|
||||
|
||||
if (lastPos.y() >= viewPort.top() &&
|
||||
lastPos.y() <= viewPort.bottom() &&
|
||||
lastPos.x() <= viewPort.right() &&
|
||||
lastPos.x() >= viewPort.left()) {
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout )
|
||||
{
|
||||
if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy &&
|
||||
abs(mMouseDownY - lastPos.y()) < kHitzonePliancy)
|
||||
{
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_OK);
|
||||
}
|
||||
}
|
||||
else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration)
|
||||
{ // Let's swipe
|
||||
g_engine->Scroll(lastPos.x()-mMouseDownX, lastPos.y()-mMouseDownY);
|
||||
}
|
||||
#else
|
||||
//#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN)
|
||||
g_engine->ReleaseKey(JGE_BTN_OK);
|
||||
#endif
|
||||
g_engine->ReleaseKey(JGE_BTN_MENU);
|
||||
} else if(lastPos.y() < viewPort.top()) {
|
||||
g_engine->ReleaseKey(JGE_BTN_MENU);
|
||||
} else if(lastPos.y() > viewPort.bottom()) {
|
||||
g_engine->ReleaseKey(JGE_BTN_NEXT);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::RightButton)
|
||||
{ /* next phase please */
|
||||
g_engine->ReleaseKey(JGE_BTN_PREV);
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::MidButton)
|
||||
{ /* interrupt please */
|
||||
g_engine->ReleaseKey(JGE_BTN_SEC);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QGLWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
|
||||
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
|
||||
|
||||
QPoint lastPos = event->pos();
|
||||
|
||||
if (lastPos.y() >= viewPort.top() &&
|
||||
lastPos.y() <= viewPort.bottom() &&
|
||||
lastPos.x() <= viewPort.right() &&
|
||||
lastPos.x() >= viewPort.left()) {
|
||||
g_engine->LeftClicked(
|
||||
((lastPos.x()-viewPort.left())*SCREEN_WIDTH)/actualWidth,
|
||||
((lastPos.y()-viewPort.top())*SCREEN_HEIGHT)/actualHeight);
|
||||
event->accept();
|
||||
} else {
|
||||
QGLWidget::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if(event->orientation() == Qt::Vertical)
|
||||
g_engine->Scroll(0, 3*event->delta());
|
||||
else
|
||||
g_engine->Scroll(3*event->delta(), 0);
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void JGEQtRenderer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch(event->key())
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
case Qt::Key_F7:
|
||||
/* interrupt please */
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_SEC);
|
||||
break;
|
||||
case Qt::Key_F8:
|
||||
/* next phase please */
|
||||
g_engine->HoldKey_NoRepeat(JGE_BTN_PREV);
|
||||
break;
|
||||
#endif // Q_WS_MAEMO_5
|
||||
case Qt::Key_F:
|
||||
JGEToggleFullscreen();
|
||||
break;
|
||||
default:
|
||||
g_engine->HoldKey_NoRepeat((LocalKeySym)event->key());
|
||||
}
|
||||
event->accept();
|
||||
QWidget::keyPressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
void JGEQtRenderer::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
switch(event->key())
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
case Qt::Key_F7:
|
||||
/* interrupt please */
|
||||
g_engine->ReleaseKey(JGE_BTN_SEC);
|
||||
break;
|
||||
case Qt::Key_F8:
|
||||
/* next phase please */
|
||||
g_engine->ReleaseKey(JGE_BTN_PREV);
|
||||
break;
|
||||
#endif // Q_WS_MAEMO_5
|
||||
default:
|
||||
g_engine->ReleaseKey((LocalKeySym)event->key());
|
||||
}
|
||||
|
||||
event->accept();
|
||||
QWidget::keyReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
void JGEQtRenderer::showEvent ( QShowEvent * event )
|
||||
{
|
||||
if(!timerStarted)
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
// 30 fps max on mobile
|
||||
timerId = startTimer(33);
|
||||
#else
|
||||
// 200 fps max on desktop
|
||||
timerId = startTimer(5);
|
||||
#endif //Q_WS_MAEMO_5
|
||||
timerStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void JGEQtRenderer::hideEvent ( QHideEvent * event )
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
if(timerStarted)
|
||||
{
|
||||
killTimer(timerId);
|
||||
timerStarted = false;
|
||||
}
|
||||
#endif
|
||||
return (int)WagicCore::g_startTimer.elapsed();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QScopedPointer<QApplication> app
|
||||
#ifdef QT_WIDGET
|
||||
(new QApplication(argc, argv));
|
||||
#else
|
||||
(createApplication(argc, argv));
|
||||
|
||||
#endif //QT_WIDGET
|
||||
app->setApplicationName(WagicCore::getApplicationName());
|
||||
FileDownloader fileDownloader(USERDIR, WAGIC_RESOURCE_NAME);
|
||||
#ifdef QT_WIDGET
|
||||
g_glwidget = new WagicCore();
|
||||
g_glwidget->connect(&fileDownloader, SIGNAL(finished(int)), SLOT(start(int)));
|
||||
#else
|
||||
qmlRegisterType<WagicCore>("CustomComponents", 1, 0, "WagicCore");
|
||||
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
app->setApplicationName(g_launcher->GetName());
|
||||
|
||||
FileDownloader fileDownloader(USERDIR);
|
||||
|
||||
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
|
||||
g_glwidget = viewer.data();
|
||||
|
||||
@@ -643,5 +88,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
viewer->showExpanded();
|
||||
viewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
||||
#endif //QT_WIDGET
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <qplatformdefs.h>
|
||||
#include <QtOpenGL>
|
||||
#include "corewrapper.h"
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
#undef GL_ES_VERSION_2_0
|
||||
@@ -19,47 +21,42 @@
|
||||
#define glClearDepthf glClearDepth
|
||||
#endif
|
||||
|
||||
|
||||
#include "corewrapper.h"
|
||||
|
||||
#define ACTUAL_SCREEN_WIDTH (SCREEN_WIDTH)
|
||||
#define ACTUAL_SCREEN_HEIGHT (SCREEN_HEIGHT)
|
||||
#define ACTUAL_RATIO ((GLfloat)ACTUAL_SCREEN_WIDTH / (GLfloat)ACTUAL_SCREEN_HEIGHT)
|
||||
|
||||
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
|
||||
{
|
||||
{ Qt::Key_Enter, JGE_BTN_MENU },
|
||||
{ Qt::Key_Return, JGE_BTN_MENU },
|
||||
{ Qt::Key_Escape, JGE_BTN_MENU },
|
||||
{ Qt::Key_Backspace, JGE_BTN_CTRL },
|
||||
{ Qt::Key_Up, JGE_BTN_UP },
|
||||
{ Qt::Key_Down, JGE_BTN_DOWN },
|
||||
{ Qt::Key_Left, JGE_BTN_LEFT },
|
||||
{ Qt::Key_Right, JGE_BTN_RIGHT },
|
||||
{ Qt::Key_Space, JGE_BTN_OK },
|
||||
{ Qt::Key_Tab, JGE_BTN_CANCEL },
|
||||
{ Qt::Key_J, JGE_BTN_PRI },
|
||||
{ Qt::Key_K, JGE_BTN_SEC },
|
||||
{ Qt::Key_Q, JGE_BTN_PREV },
|
||||
{ Qt::Key_A, JGE_BTN_NEXT },
|
||||
// fullscreen management seems somehow broken in JGE, it works fine with Qt directly
|
||||
// { Qt::Key_F, JGE_BTN_FULLSCREEN },
|
||||
};
|
||||
// in pixels
|
||||
#define kHitzonePliancy 50
|
||||
|
||||
// tick value equates to ms
|
||||
#define kTapEventTimeout 250
|
||||
|
||||
// swipe duration
|
||||
#define kSwipeEventMinDuration 250
|
||||
// swipe distance in pixel (from top to down)
|
||||
#define kSwipeMinDistance 200
|
||||
|
||||
int JGEGetTime()
|
||||
{
|
||||
return (int)WagicCore::g_startTimer.elapsed();
|
||||
}
|
||||
|
||||
QElapsedTimer WagicCore::g_startTimer;
|
||||
|
||||
WagicCore::WagicCore(QDeclarativeItem *parent) :
|
||||
QDeclarativeItem(parent), m_engine(0), m_app(0), m_launcher(0), m_active(false)
|
||||
WagicCore::WagicCore(super *parent) :
|
||||
super(parent), m_engine(0), m_app(0), m_launcher(0), m_active(false)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemHasNoContents, false);
|
||||
#ifdef QT_WIDGET
|
||||
#if (defined Q_WS_MAEMO_5)
|
||||
setAttribute(Qt::WA_Maemo5AutoOrientation);
|
||||
setAttribute(Qt::WA_Maemo5NonComposited);
|
||||
#endif //Q_WS_MAEMO_5
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
// setAttribute(Qt::WA_InputMethodEnabled);
|
||||
setMouseTracking(true);
|
||||
grabGesture(Qt::TapAndHoldGesture);
|
||||
resize(ACTUAL_SCREEN_WIDTH, ACTUAL_SCREEN_HEIGHT);
|
||||
#else
|
||||
setWidth(480);
|
||||
setHeight(272);
|
||||
|
||||
setFlag(QGraphicsItem::ItemHasNoContents, false);
|
||||
#endif //QT_WIDGET
|
||||
g_startTimer.restart();
|
||||
m_lastTickCount = g_startTimer.elapsed();
|
||||
}
|
||||
@@ -75,9 +72,7 @@ void WagicCore::initApp()
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
// BindKey is a static method, m_engine is not even initialized
|
||||
for (signed int i = sizeof(gDefaultBindings)/sizeof(gDefaultBindings[0]) - 1; i >= 0; --i)
|
||||
m_engine->BindKey(gDefaultBindings[i].keysym, gDefaultBindings[i].keycode);
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
m_engine = JGE::GetInstance();
|
||||
m_app = m_launcher->GetGameApp();
|
||||
@@ -165,15 +160,8 @@ void WagicCore::setActive(bool active)
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void WagicCore::initializeGL()
|
||||
{
|
||||
painter->beginNativePainting();
|
||||
|
||||
initApp();
|
||||
|
||||
QRectF rectf = boundingRect();
|
||||
resize ( rectf);
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background (yes that's the way fuckers)
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
#if (defined GL_ES_VERSION_2_0)
|
||||
@@ -209,57 +197,71 @@ void WagicCore::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST); // Enable Clipping
|
||||
}
|
||||
|
||||
render();
|
||||
#ifndef QT_WIDGET
|
||||
void WagicCore::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
painter->beginNativePainting();
|
||||
|
||||
initApp();
|
||||
|
||||
resizeGL ( boundingRect().size().width(), boundingRect().size().height());
|
||||
|
||||
initializeGL();
|
||||
|
||||
paintGL();
|
||||
|
||||
painter->endNativePainting();
|
||||
}
|
||||
#endif //QT_WIDGET
|
||||
|
||||
void WagicCore::resize ( const QRectF &rect)
|
||||
void WagicCore::paintGL()
|
||||
{
|
||||
int width = rect.size().width();
|
||||
int height= rect.size().height();
|
||||
if(width && height)
|
||||
if(m_engine)
|
||||
m_engine->Render();
|
||||
}
|
||||
|
||||
|
||||
void WagicCore::resizeGL(int width, int height)
|
||||
{
|
||||
if ((GLfloat)width / (GLfloat)height <= ACTUAL_RATIO)
|
||||
{
|
||||
if ((GLfloat)width / (GLfloat)height <= ACTUAL_RATIO)
|
||||
{
|
||||
m_viewPort.setLeft(0);
|
||||
m_viewPort.setTop(-((width/ACTUAL_RATIO)-height)/2);
|
||||
m_viewPort.setRight(width);
|
||||
m_viewPort.setBottom(-((width/ACTUAL_RATIO)-height)/2 + width / ACTUAL_RATIO);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_viewPort.setLeft(-(height*ACTUAL_RATIO-width)/2);
|
||||
m_viewPort.setTop(0);
|
||||
m_viewPort.setRight(-(height*ACTUAL_RATIO-width)/2 + height * ACTUAL_RATIO);
|
||||
m_viewPort.setBottom(height);
|
||||
}
|
||||
m_viewPort.setLeft(0);
|
||||
m_viewPort.setTop(-((width/ACTUAL_RATIO)-height)/2);
|
||||
m_viewPort.setRight(width);
|
||||
m_viewPort.setBottom(-((width/ACTUAL_RATIO)-height)/2 + width / ACTUAL_RATIO);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_viewPort.setLeft(-(height*ACTUAL_RATIO-width)/2);
|
||||
m_viewPort.setTop(0);
|
||||
m_viewPort.setRight(-(height*ACTUAL_RATIO-width)/2 + height * ACTUAL_RATIO);
|
||||
m_viewPort.setBottom(height);
|
||||
}
|
||||
|
||||
glViewport(m_viewPort.left(), m_viewPort.top(), m_viewPort.right()-m_viewPort.left(), m_viewPort.bottom()-m_viewPort.top());
|
||||
glViewport(m_viewPort.left(), m_viewPort.top(), m_viewPort.right()-m_viewPort.left(), m_viewPort.bottom()-m_viewPort.top());
|
||||
|
||||
JRenderer::GetInstance()->SetActualWidth(m_viewPort.right()-m_viewPort.left());
|
||||
JRenderer::GetInstance()->SetActualHeight(m_viewPort.bottom()-m_viewPort.top());
|
||||
glScissor(0, 0, width, height);
|
||||
JRenderer::GetInstance()->SetActualWidth(m_viewPort.right()-m_viewPort.left());
|
||||
JRenderer::GetInstance()->SetActualHeight(m_viewPort.bottom()-m_viewPort.top());
|
||||
glScissor(0, 0, width, height);
|
||||
|
||||
#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0)
|
||||
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
|
||||
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
|
||||
glOrthof(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
|
||||
glOrthof(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
|
||||
#else
|
||||
gluOrtho2D(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f);
|
||||
gluOrtho2D(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f);
|
||||
#endif
|
||||
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::keyPressEvent(QKeyEvent *event)
|
||||
@@ -283,8 +285,7 @@ void WagicCore::keyPressEvent(QKeyEvent *event)
|
||||
m_engine->HoldKey_NoRepeat((LocalKeySym)event->key());
|
||||
}
|
||||
event->accept();
|
||||
QGraphicsItem::keyPressEvent(event);
|
||||
return;
|
||||
super::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void WagicCore::keyReleaseEvent(QKeyEvent *event)
|
||||
@@ -306,11 +307,14 @@ void WagicCore::keyReleaseEvent(QKeyEvent *event)
|
||||
}
|
||||
|
||||
event->accept();
|
||||
QGraphicsItem::keyReleaseEvent(event);
|
||||
return;
|
||||
super::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
void WagicCore::wheelEvent(QWheelEvent *event)
|
||||
#else
|
||||
void WagicCore::wheelEvent ( QGraphicsSceneWheelEvent * event)
|
||||
#endif
|
||||
{
|
||||
if(event->orientation() == Qt::Vertical)
|
||||
m_engine->Scroll(0, 3*event->delta());
|
||||
@@ -320,3 +324,177 @@ void WagicCore::wheelEvent ( QGraphicsSceneWheelEvent * event)
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
#ifdef QT_WIDGET
|
||||
void WagicCore::tapAndHoldTriggered(QTapAndHoldGesture* gesture)
|
||||
{
|
||||
if (gesture->state() == Qt::GestureFinished) {
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
QPoint lastPos = event->pos();
|
||||
// this is intended to convert window coordinate into game coordinate.
|
||||
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
|
||||
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
|
||||
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
|
||||
|
||||
if (lastPos.y() >= m_viewPort.top() &&
|
||||
lastPos.y() <= m_viewPort.bottom() &&
|
||||
lastPos.x() <= m_viewPort.right() &&
|
||||
lastPos.x() >= m_viewPort.left()) {
|
||||
m_engine->LeftClicked(
|
||||
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
|
||||
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
|
||||
#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) && (!defined Q_WS_ANDROID)
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
|
||||
#else
|
||||
mMouseDownX = lastPos.x();
|
||||
mMouseDownY = lastPos.y();
|
||||
mLastFingerDownTime = g_startTimer.elapsed();
|
||||
#endif
|
||||
} else if(lastPos.y()<m_viewPort.top()) {
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_MENU);
|
||||
} else if(lastPos.y()>m_viewPort.bottom()) {
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_NEXT);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::RightButton)
|
||||
{ /* next phase please */
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_PREV);
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::MidButton)
|
||||
{ /* interrupt please */
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_SEC);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
super::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
QPoint lastPos = event->pos();
|
||||
|
||||
if (lastPos.y() >= m_viewPort.top() &&
|
||||
lastPos.y() <= m_viewPort.bottom() &&
|
||||
lastPos.x() <= m_viewPort.right() &&
|
||||
lastPos.x() >= m_viewPort.left()) {
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
if(g_startTimer.elapsed() - mLastFingerDownTime <= kTapEventTimeout )
|
||||
{
|
||||
if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy &&
|
||||
abs(mMouseDownY - lastPos.y()) < kHitzonePliancy)
|
||||
{
|
||||
m_engine->HoldKey_NoRepeat(JGE_BTN_OK);
|
||||
}
|
||||
}
|
||||
else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration)
|
||||
{ // Let's swipe
|
||||
m_engine->Scroll(lastPos.x()-mMouseDownX, lastPos.y()-mMouseDownY);
|
||||
}
|
||||
#else
|
||||
//#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN)
|
||||
m_engine->ReleaseKey(JGE_BTN_OK);
|
||||
#endif
|
||||
m_engine->ReleaseKey(JGE_BTN_MENU);
|
||||
} else if(lastPos.y() < m_viewPort.top()) {
|
||||
m_engine->ReleaseKey(JGE_BTN_MENU);
|
||||
} else if(lastPos.y() > m_viewPort.bottom()) {
|
||||
m_engine->ReleaseKey(JGE_BTN_NEXT);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::RightButton)
|
||||
{ /* next phase please */
|
||||
m_engine->ReleaseKey(JGE_BTN_PREV);
|
||||
event->accept();
|
||||
}
|
||||
else if(event->button() == Qt::MidButton)
|
||||
{ /* interrupt please */
|
||||
m_engine->ReleaseKey(JGE_BTN_SEC);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
super::mouseReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth();
|
||||
int actualHeight = (int) JRenderer::GetInstance()->GetActualHeight();
|
||||
|
||||
QPoint lastPos = event->pos();
|
||||
|
||||
if (lastPos.y() >= m_viewPort.top() &&
|
||||
lastPos.y() <= m_viewPort.bottom() &&
|
||||
lastPos.x() <= m_viewPort.right() &&
|
||||
lastPos.x() >= m_viewPort.left()) {
|
||||
m_engine->LeftClicked(
|
||||
((lastPos.x()-m_viewPort.left())*SCREEN_WIDTH)/actualWidth,
|
||||
((lastPos.y()-m_viewPort.top())*SCREEN_HEIGHT)/actualHeight);
|
||||
event->accept();
|
||||
} else {
|
||||
super::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void WagicCore::showEvent ( QShowEvent * event )
|
||||
{
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
void WagicCore::hideEvent ( QHideEvent * event )
|
||||
{
|
||||
setActive(false);
|
||||
}
|
||||
|
||||
bool WagicCore::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Gesture)
|
||||
return gestureEvent(static_cast<QGestureEvent*>(event));
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
else if (event->type() == QEvent::WindowActivate)
|
||||
{
|
||||
showEvent(NULL);
|
||||
}
|
||||
else if (event->type() == QEvent::WindowDeactivate)
|
||||
{
|
||||
hideEvent(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
return QGLWidget::event(event);
|
||||
}
|
||||
|
||||
bool WagicCore::gestureEvent(QGestureEvent* event)
|
||||
{
|
||||
if (QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture))
|
||||
tapAndHoldTriggered(static_cast<QTapAndHoldGesture *>(tapAndHold));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WagicCore::start(int)
|
||||
{
|
||||
#if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) || (defined Q_WS_ANDROID)
|
||||
showFullScreen();
|
||||
#else
|
||||
show();
|
||||
#endif
|
||||
initApp();
|
||||
}
|
||||
|
||||
#endif //QT_WIDGET
|
||||
|
||||
@@ -2,10 +2,21 @@
|
||||
#include <QDir>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
FileDownloader::FileDownloader(QString localPath, QObject *parent) :
|
||||
QObject(parent), m_received(0), m_hash(""), m_OK(false)
|
||||
FileDownloader::FileDownloader(QString localPath, QString targetFile, QObject *parent) :
|
||||
#ifdef QT_WIDGET
|
||||
QProgressDialog("Downloading resources", "", 0, 100, (QWidget*)parent, 0),
|
||||
#else
|
||||
QObject(parent),
|
||||
#endif //QT_WIDGET
|
||||
m_state(NETWORK_ERROR), m_received(0), m_targetFile(targetFile), m_localHash(""), m_OK(false)
|
||||
|
||||
{
|
||||
#ifdef QT_WIDGET
|
||||
setCancelButton(0);
|
||||
#endif //QT_WIDGET
|
||||
connect(this, SIGNAL(receivedChanged(int)), SLOT(setValue(int)));
|
||||
connect(this, SIGNAL(stateChanged(DownloadState)), SLOT(handleStateChange(DownloadState)));
|
||||
|
||||
QDir dir(QDir::homePath());
|
||||
if(!dir.mkpath(localPath))
|
||||
{
|
||||
@@ -17,27 +28,40 @@ FileDownloader::FileDownloader(QString localPath, QObject *parent) :
|
||||
|
||||
QFile local(m_localPath);
|
||||
if(local.exists()) {
|
||||
computeHash(local);
|
||||
/* a file is already present in the local path */
|
||||
computeLocalHash(local);
|
||||
m_state = DOWNLOADED;
|
||||
}
|
||||
|
||||
if(m_WebCtrl.networkAccessible()) {
|
||||
/* Network is OK, we request the remote hash file */
|
||||
m_state = DOWNLOADING_HASH;
|
||||
requestHash(QUrl("http://code.google.com/p/wagic/downloads/detail?name="+m_targetFile));
|
||||
}
|
||||
|
||||
emit stateChanged(m_state);
|
||||
}
|
||||
|
||||
void FileDownloader::setDownloadUrl(QUrl url)
|
||||
{
|
||||
if((!url.isEmpty()) && url.toString() != m_downloadUrl.toString())
|
||||
if((!url.isEmpty()))
|
||||
{
|
||||
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)),
|
||||
SLOT(fileDownloaded(QNetworkReply*)));
|
||||
if(!m_WebCtrl.networkAccessible()) {
|
||||
m_status = "Network not accessible, press retry when the network is accessible.";
|
||||
emit statusChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkRequest request(url);
|
||||
QNetworkReply* reply = m_WebCtrl.get(request);
|
||||
m_downloadReply = m_WebCtrl.get(request);
|
||||
|
||||
connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
connect(m_downloadReply, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64)));
|
||||
|
||||
m_OK = m_tmp.open();
|
||||
connect(m_downloadReply, SIGNAL(finished()), SLOT(fileDownloaded()));
|
||||
m_status = "Downloading Resources";
|
||||
|
||||
m_downloadUrl.setUrl(url.toString());
|
||||
emit downloadUrlChanged();
|
||||
m_OK = m_tmp.open();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,15 +71,39 @@ FileDownloader::~FileDownloader()
|
||||
|
||||
}
|
||||
|
||||
void FileDownloader::computeHash(QFile& file)
|
||||
void FileDownloader::requestHash(QUrl url)
|
||||
{
|
||||
QNetworkRequest request(url);
|
||||
m_hashReply = m_WebCtrl.get(request);
|
||||
|
||||
connect(m_hashReply, SIGNAL(finished()), SLOT(computeRemoteHash()));
|
||||
}
|
||||
|
||||
void FileDownloader::computeRemoteHash()
|
||||
{
|
||||
QString aString = m_hashReply->readAll();
|
||||
|
||||
int index = aString.indexOf("SHA1 Checksum: ");
|
||||
m_remoteHash = aString.mid(index+52, 40);
|
||||
if(m_localHash != m_remoteHash)
|
||||
{ /* We download the real file */
|
||||
m_state = DOWNLOADING_FILE;
|
||||
setDownloadUrl(QUrl("http://wagic.googlecode.com/files/" + m_targetFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = DOWNLOADED;
|
||||
}
|
||||
emit stateChanged(m_state);
|
||||
}
|
||||
|
||||
void FileDownloader::computeLocalHash(QFile& file)
|
||||
{
|
||||
QCryptographicHash crypto(QCryptographicHash::Sha1);
|
||||
file.open(QFile::ReadOnly);
|
||||
while(!file.atEnd()){
|
||||
crypto.addData(file.read(8192));
|
||||
crypto.addData(file.read(8192));
|
||||
}
|
||||
QByteArray hash = crypto.result();
|
||||
|
||||
m_hash = hash.toHex();
|
||||
emit hashChanged();
|
||||
m_localHash = hash.toHex();
|
||||
}
|
||||
|
||||
@@ -32,12 +32,16 @@
|
||||
#define WAGIC_VERSION_MINOR 1
|
||||
|
||||
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
|
||||
#define VERSION(a, b, c) VERSION_DOT(a, b, c)
|
||||
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c
|
||||
#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c)
|
||||
#define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
|
||||
#define VERSION_TOSTRING(a) #a
|
||||
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(a)
|
||||
|
||||
#define WAGIC_VERSION VERSION(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
|
||||
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
|
||||
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
|
||||
#define WAGIC_RESOURCE_NAME "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) ".zip"
|
||||
|
||||
class Rules;
|
||||
class MTGAllCards;
|
||||
|
||||
@@ -5,28 +5,30 @@ Rectangle {
|
||||
id: main
|
||||
width: 480
|
||||
height: 272
|
||||
state: "DOWNLOADING"
|
||||
state: fileDownloader.state_string
|
||||
color: "black"
|
||||
property url resource: "http://wagic.googlecode.com/files/core_017.zip"
|
||||
property string hash: "cc6f9415f747acea500cdce190f0df6ee41db7cb"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "DOWNLOADING"
|
||||
when: (fileDownloader.hash != hash)
|
||||
name: "DOWNLOADING_HASH"
|
||||
PropertyChanges {
|
||||
target: column1; visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: wagic; visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "DOWNLOADING_FILE"
|
||||
PropertyChanges {
|
||||
target: column1; visible: true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: wagic; visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target:fileDownloader; url: resource
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "NORMAL"
|
||||
when: (fileDownloader.hash == hash)
|
||||
name: "DOWNLOADED"
|
||||
PropertyChanges {
|
||||
target: column1; visible: false
|
||||
}
|
||||
|
||||
@@ -102,7 +102,11 @@ QmlApplicationViewer *QmlApplicationViewer::create()
|
||||
void QmlApplicationViewer::setMainQmlFile(const QString &file)
|
||||
{
|
||||
d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
|
||||
#ifndef Q_OS_ANDROID
|
||||
setSource(QUrl::fromLocalFile(d->mainQmlFile));
|
||||
#else
|
||||
setSource(QUrl::fromLocalFile(file));
|
||||
#endif
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::addImportPath(const QString &path)
|
||||
@@ -155,7 +159,7 @@ void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
|
||||
|
||||
void QmlApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
|
||||
#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) || defined(Q_OS_ANDROID)
|
||||
showFullScreen();
|
||||
#elif defined(Q_WS_MAEMO_5)
|
||||
showMaximized();
|
||||
|
||||
@@ -723,7 +723,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
||||
{
|
||||
MTGCardInstance * copy = player->game->putInZone(card, card->currentZone, player->game->stack);
|
||||
copy->alternateCostPaid[alternateCostType] = 1;
|
||||
Spell * spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, alternateCostType, 0);
|
||||
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, alternateCostType, 0);
|
||||
game->targetChooser = NULL;
|
||||
|
||||
if (card->has(Constants::STORM))
|
||||
|
||||
@@ -6,7 +6,7 @@ DEPLOYMENTFOLDERS = folder_01
|
||||
TARGET = wagic
|
||||
|
||||
QT += core gui opengl network
|
||||
!android:QT += phonon
|
||||
!android:!symbian:QT += phonon
|
||||
maemo5:QT += dbus
|
||||
|
||||
TARGET = wagic
|
||||
@@ -20,8 +20,10 @@ windows:DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
unix|macx:DEFINES += LINUX
|
||||
CONFIG(debug, debug|release):DEFINES += _DEBUG
|
||||
DEFINES += QT_CONFIG
|
||||
!android:DEFINES += USE_PHONON
|
||||
DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
!android:!symbian:DEFINES += USE_PHONON
|
||||
android:INCLUDEPATH += $$ANDROID_NDK_ROOT/platforms/android-9/arch-arm/usr/include
|
||||
#DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
DEFINES += QT_WIDGET
|
||||
|
||||
windows:INCLUDEPATH += ../../JGE/Dependencies/include
|
||||
windows:INCLUDEPATH += extra
|
||||
@@ -39,7 +41,7 @@ PRECOMPILED_HEADER = include/PrecompiledHeader.h
|
||||
|
||||
#DEFINES += TESTSUITE
|
||||
#DEFINES += TRACK_OBJECT_USAGE
|
||||
DEFINES += AI_CHANGE_TESTING
|
||||
#DEFINES += AI_CHANGE_TESTING
|
||||
#DEFINES += ACTION_LOGGING_TESTING
|
||||
|
||||
SOURCES += \
|
||||
@@ -365,13 +367,13 @@ HEADERS += \
|
||||
../../JGE/include/vram.h
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
include(qml/qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
qtcAddDeployment()
|
||||
!maemo5:include(qml/qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
!maemo5:qtcAddDeployment()
|
||||
|
||||
# maemo 5 packaging
|
||||
maemo5: {
|
||||
# Variables
|
||||
BINDIR = /opt/wagic
|
||||
BINDIR = /opt/wagic/bin
|
||||
RESDIR = /home/user/wagic/Res
|
||||
USERDIR = MyDocs/.Wagic
|
||||
ICONDIR = /usr/share
|
||||
@@ -381,10 +383,7 @@ maemo5: {
|
||||
|
||||
INSTALLS += target \
|
||||
desktop \
|
||||
icon \
|
||||
restxt \
|
||||
launcher \
|
||||
res \
|
||||
icon
|
||||
|
||||
target.path = $$BINDIR
|
||||
|
||||
@@ -394,16 +393,6 @@ maemo5: {
|
||||
icon.path = $$ICONDIR/icons/hicolor/64x64/apps
|
||||
icon.files += wagic-64x64.png
|
||||
|
||||
res.path = $$RESDIR
|
||||
res.files += bin/Res/*
|
||||
# res.extra = tar -C ../../../../src/projects/mtg/bin -czf Res.tgz Res
|
||||
|
||||
restxt.path = $$BINDIR
|
||||
restxt.files += debian/Res.txt
|
||||
|
||||
launcher.path = $$BINDIR
|
||||
launcher.files += debian/launcher
|
||||
|
||||
# Meego/maemo 6 packaging (no launcher)
|
||||
} else:contains(MEEGO_EDITION,harmattan): {
|
||||
|
||||
@@ -500,7 +489,40 @@ OTHER_FILES += \
|
||||
android/src/org/kde/necessitas/origo/QtApplication.java \
|
||||
android/src/org/kde/necessitas/origo/QtActivity.java \
|
||||
android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl \
|
||||
android/src/org/kde/necessitas/ministro/IMinistro.aidl \
|
||||
android/AndroidManifest.xml \
|
||||
android/res/layout/splash.xml \
|
||||
android/res/values-ru/strings.xml \
|
||||
android/res/values-es/strings.xml \
|
||||
android/res/values-it/strings.xml \
|
||||
android/res/values/strings.xml \
|
||||
android/res/values/libs.xml \
|
||||
android/res/values-id/strings.xml \
|
||||
android/res/values-rs/strings.xml \
|
||||
android/res/values-nl/strings.xml \
|
||||
android/res/values-zh-rCN/strings.xml \
|
||||
android/res/values-ro/strings.xml \
|
||||
android/res/drawable-ldpi/icon.png \
|
||||
android/res/drawable-mdpi/icon.png \
|
||||
android/res/values-et/strings.xml \
|
||||
android/res/values-fr/strings.xml \
|
||||
android/res/values-ja/strings.xml \
|
||||
android/res/values-el/strings.xml \
|
||||
android/res/values-pt-rBR/strings.xml \
|
||||
android/res/values-fa/strings.xml \
|
||||
android/res/drawable/logo.png \
|
||||
android/res/drawable/icon.png \
|
||||
android/res/values-nb/strings.xml \
|
||||
android/res/values-ms/strings.xml \
|
||||
android/res/values-de/strings.xml \
|
||||
android/res/values-zh-rTW/strings.xml \
|
||||
android/res/values-pl/strings.xml \
|
||||
android/res/drawable-hdpi/icon.png \
|
||||
android/src/org/kde/necessitas/origo/QtApplication.java \
|
||||
android/src/org/kde/necessitas/origo/QtActivity.java \
|
||||
android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl \
|
||||
android/src/org/kde/necessitas/ministro/IMinistro.aidl
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Encoding=UTF-8
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Wagic
|
||||
Exec=/opt/wagic/launcher
|
||||
Exec=/opt/wagic/bin/wagic
|
||||
Icon=wagic-64x64
|
||||
StartupWMClass=wagic
|
||||
X-HildonDesk-ShowInToolbar=true
|
||||
|
||||
Reference in New Issue
Block a user