mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2024-11-05 04:07:12 +02:00
gottet:Tetris clone written in Qt, adapted for Ben
This commit is contained in:
parent
e75033d2e6
commit
325a43c7b5
50
gottet/Makefile
Normal file
50
gottet/Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gottet
|
||||
PKG_VERSION:=1.0.4
|
||||
PKG_RELEASE:=1
|
||||
PKG_REV:=41f066f7801fbf9a10b90ba779076a03eb5353c3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/gottcode/gottet.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
$(call include_mk,qmake.mk)
|
||||
|
||||
define Package/gottet
|
||||
SECTION:=games
|
||||
CATEGORY:=Games
|
||||
TITLE:=Tetris clone, written in Qt
|
||||
DEPENDS:=+qt4 +qt4-gui +dejavu-fonts-ttf
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
(\
|
||||
cd $(PKG_BUILD_DIR); \
|
||||
echo "QMAKE_LIBS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib" >> gottet.pro; \
|
||||
echo "INCLUDEPATH += $(STAGING_DIR)/usr/include/QtGui" >> gottet.pro; \
|
||||
echo "INCLUDEPATH += $(STAGING_DIR)/usr/include/QtCore" >> gottet.pro; \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Qmake,gottet)
|
||||
endef
|
||||
|
||||
define Package/gottet/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/gottet $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,gottet))
|
157
gottet/patches/001-qtopia.patch
Normal file
157
gottet/patches/001-qtopia.patch
Normal file
@ -0,0 +1,157 @@
|
||||
diff --git a/src/board.cpp b/src/board.cpp
|
||||
index 4b1888f..877a7ec 100644
|
||||
--- a/src/board.cpp
|
||||
+++ b/src/board.cpp
|
||||
@@ -54,10 +54,6 @@ Board::Board(QWidget* parent)
|
||||
m_done(false),
|
||||
m_paused(false)
|
||||
{
|
||||
-#if !defined(QTOPIA_PHONE)
|
||||
- setMinimumSize(201, 401);
|
||||
- setFocusPolicy(Qt::StrongFocus);
|
||||
-#endif
|
||||
setFocus();
|
||||
|
||||
m_shift_timer = new QTimer(this);
|
||||
@@ -174,7 +170,7 @@ void Board::pauseGame()
|
||||
}
|
||||
|
||||
update();
|
||||
- emit showMessage(tr("<big><b>Paused</b></big><br>Click to resume playing."));
|
||||
+ emit showMessage(tr("<big><b>Paused</b></big><br>Press P to resume playing."));
|
||||
|
||||
unsetCursor();
|
||||
emit pauseAvailable(false);
|
||||
@@ -402,7 +398,7 @@ void Board::gameOver()
|
||||
m_piece = 0;
|
||||
m_done = true;
|
||||
unsetCursor();
|
||||
- emit showMessage(tr("<big><b>Game Over!</b></big><br>Click to start a new game."));
|
||||
+ emit showMessage(tr("<big><b>Game Over!</b></big><br>Ctrl+N to start a new game."));
|
||||
emit gameOver(m_level, m_removed_lines, m_score);
|
||||
}
|
||||
|
||||
@@ -495,11 +491,7 @@ QPixmap Board::renderPiece(int type) const
|
||||
painter.drawRoundRect(piece[i].x * 20, piece[i].y * 20, 19, 19);
|
||||
}
|
||||
}
|
||||
-
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
result = result.scaled(30,50, Qt::KeepAspectRatio);
|
||||
-#endif
|
||||
-
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git a/src/main.cpp b/src/main.cpp
|
||||
index bc3c73a..4d475ed 100644
|
||||
--- a/src/main.cpp
|
||||
+++ b/src/main.cpp
|
||||
@@ -19,15 +19,11 @@
|
||||
|
||||
#include "window.h"
|
||||
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
-#include <QtopiaApplication>
|
||||
-QTOPIA_ADD_APPLICATION(QTOPIA_TARGET,Window)
|
||||
-QTOPIA_MAIN
|
||||
-#else
|
||||
-
|
||||
#include <QApplication>
|
||||
-#include <QLocale>
|
||||
-#include <QTranslator>
|
||||
+
|
||||
+#if defined(Q_WS_QWS)
|
||||
+#include <QtGui/QWSServer>
|
||||
+#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -35,18 +31,11 @@ int main(int argc, char** argv)
|
||||
app.setApplicationName("Gottet");
|
||||
app.setOrganizationDomain("gottcode.org");
|
||||
app.setOrganizationName("GottCode");
|
||||
-
|
||||
- QTranslator qt_translator;
|
||||
- qt_translator.load("qt_" + QLocale::system().name());
|
||||
- app.installTranslator(&qt_translator);
|
||||
-
|
||||
- QTranslator gottet_translator;
|
||||
- gottet_translator.load("gottet_" + QLocale::system().name());
|
||||
- app.installTranslator(&gottet_translator);
|
||||
-
|
||||
+ #if defined(Q_WS_QWS)
|
||||
+ QWSServer::setCursorVisible(false);
|
||||
+ #endif
|
||||
Window window;
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
-#endif
|
||||
diff --git a/src/window.cpp b/src/window.cpp
|
||||
index c691ae5..f7e970b 100644
|
||||
--- a/src/window.cpp
|
||||
+++ b/src/window.cpp
|
||||
@@ -34,11 +34,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QSettings>
|
||||
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
-#include <QSoftMenuBar>
|
||||
-#else
|
||||
#include <QMenuBar>
|
||||
-#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -53,11 +49,7 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
|
||||
// Create preview
|
||||
m_preview = new QLabel(contents);
|
||||
-#if !defined(QTOPIA_PHONE)
|
||||
- m_preview->setFixedSize(80, 100);
|
||||
-#else
|
||||
- m_preview->setFixedSize(30, 40);
|
||||
-#endif
|
||||
+ m_preview->setFixedSize(40, 40);
|
||||
m_preview->setAutoFillBackground(true);
|
||||
{
|
||||
QPalette palette = m_preview->palette();
|
||||
@@ -99,7 +91,7 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
connect(m_board, SIGNAL(gameStarted()), this, SLOT(newGame()));
|
||||
|
||||
// Create overlay message
|
||||
- QLabel* message = new QLabel(tr("Click to start a new game."), contents);
|
||||
+ QLabel* message = new QLabel(tr("Ctrl+N to start a new game."), contents);
|
||||
message->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
message->setAlignment(Qt::AlignCenter);
|
||||
message->setStyleSheet(
|
||||
@@ -117,19 +109,6 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
connect(m_board, SIGNAL(hideMessage()), message, SLOT(clear()));
|
||||
|
||||
// Create menus
|
||||
-#if defined(QTOPIA_PHONE)
|
||||
- QMenu* menu = QSoftMenuBar::menuFor(this);
|
||||
- menu->addAction(tr("&About"), this, SLOT(about()));
|
||||
- menu->addSeparator();
|
||||
- menu->addAction(tr("&Scores"), m_score_board, SLOT(show()));
|
||||
- menu->addSeparator();
|
||||
- m_resume_action = menu->addAction(tr("&Resume"), m_board, SLOT(resumeGame()));
|
||||
- m_resume_action->setVisible(false);
|
||||
- m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(pauseGame()));
|
||||
- m_pause_action->setEnabled(false);
|
||||
- QAction* action = menu->addAction(tr("&New Game"), m_board, SLOT(newGame()));
|
||||
- connect(action, SIGNAL(triggered(bool)), this, SLOT(newGame()));
|
||||
-#else
|
||||
QMenu* menu = menuBar()->addMenu(tr("&Game"));
|
||||
menu->addAction(tr("&New"), m_board, SLOT(newGame()), tr("Ctrl+N"));
|
||||
m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(pauseGame()), tr("P"));
|
||||
@@ -143,7 +122,6 @@ Window::Window(QWidget *parent, Qt::WindowFlags wf)
|
||||
menu = menuBar()->addMenu(tr("&Help"));
|
||||
menu->addAction(tr("&About"), this, SLOT(about()));
|
||||
menu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
|
||||
-#endif
|
||||
|
||||
// Layout window
|
||||
QGridLayout* layout = new QGridLayout(contents);
|
Loading…
Reference in New Issue
Block a user