summaryrefslogtreecommitdiff
path: root/noncore/games/snake/interface.cpp
authordrw <drw>2005-05-20 21:17:24 (UTC)
committer drw <drw>2005-05-20 21:17:24 (UTC)
commit5e7bbe42671f565bef961b44862ddbf68beed774 (patch) (unidiff)
treeccf157157cec64314bae8cbdf846dd9ccefdd4a6 /noncore/games/snake/interface.cpp
parent3394f57eac978fa97ad60fb96bebc67b3783cfc6 (diff)
downloadopie-5e7bbe42671f565bef961b44862ddbf68beed774.zip
opie-5e7bbe42671f565bef961b44862ddbf68beed774.tar.gz
opie-5e7bbe42671f565bef961b44862ddbf68beed774.tar.bz2
Resource -> OResource
Diffstat (limited to 'noncore/games/snake/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/snake/interface.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp
index 9d9550a..1eeb337 100644
--- a/noncore/games/snake/interface.cpp
+++ b/noncore/games/snake/interface.cpp
@@ -11,51 +11,51 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "interface.h" 21#include "interface.h"
22 22
23#include <qpe/resource.h> 23#include <opie2/oresource.h>
24 24
25#include <qtoolbar.h> 25#include <qtoolbar.h>
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27 27
28SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : 28SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) :
29 QMainWindow(parent,name,f), 29 QMainWindow(parent,name,f),
30 canvas(232, 258) 30 canvas(232, 258)
31{ 31{
32 setCaption( tr("Snake") ); 32 setCaption( tr("Snake") );
33 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); 33 QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
34 QPixmap bg = Resource::loadPixmap("snake/grass"); 34 QPixmap bg = Opie::Core::OResource::loadPixmap("snake/grass");
35 canvas.setBackgroundPixmap(bg); 35 canvas.setBackgroundPixmap(bg);
36 canvas.setUpdatePeriod(100); 36 canvas.setUpdatePeriod(100);
37 snake = 0; 37 snake = 0;
38 38
39 cv = new QCanvasView(&canvas, this); 39 cv = new QCanvasView(&canvas, this);
40 40
41 pauseTimer = new QTimer(this); 41 pauseTimer = new QTimer(this);
42 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); 42 connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
43 43
44 setToolBarsMovable( FALSE ); 44 setToolBarsMovable( FALSE );
45 45
46 QToolBar* toolbar = new QToolBar( this); 46 QToolBar* toolbar = new QToolBar( this);
47 toolbar->setHorizontalStretchable( TRUE ); 47 toolbar->setHorizontalStretchable( TRUE );
48 48
49 QPixmap newicon = Resource::loadPixmap("ksnake"); 49 QPixmap newicon = Opie::Core::OResource::loadPixmap("ksnake");
50 setIcon(newicon); 50 setIcon(newicon);
51 (void)new QToolButton(newicon, tr("New Game"), 0, 51 (void)new QToolButton(newicon, tr("New Game"), 0,
52 this, SLOT(newGame()), toolbar, "New Game"); 52 this, SLOT(newGame()), toolbar, "New Game");
53 53
54 scorelabel = new QLabel(toolbar); 54 scorelabel = new QLabel(toolbar);
55 showScore(0); 55 showScore(0);
56 scorelabel->setBackgroundMode( PaletteButton ); 56 scorelabel->setBackgroundMode( PaletteButton );
57 scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); 57 scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs );
58 toolbar->setStretchableWidget( scorelabel ); 58 toolbar->setStretchableWidget( scorelabel );
59 59
60 setFocusPolicy(StrongFocus); 60 setFocusPolicy(StrongFocus);
61 61
@@ -77,25 +77,25 @@ void SnakeGame::resizeEvent(QResizeEvent *)
77 int fw = style().defaultFrameWidth(); 77 int fw = style().defaultFrameWidth();
78 canvas.resize( s.width() - fw - 2, s.height() - fw - 2); 78 canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
79} 79}
80 80
81void SnakeGame::welcomescreen() 81void SnakeGame::welcomescreen()
82{ 82{
83 QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); 83 QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas);
84 title->setColor(yellow); 84 title->setColor(yellow);
85 title->setFont( QFont("times", 18, QFont::Bold) ); 85 title->setFont( QFont("times", 18, QFont::Bold) );
86 int w = title->boundingRect().width(); 86 int w = title->boundingRect().width();
87 title->move(canvas.width()/2 -w/2, canvas.height()/2-110); 87 title->move(canvas.width()/2 -w/2, canvas.height()/2-110);
88 title->show(); 88 title->show();
89 QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title")); 89 QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Opie::Core::OResource::findPixmap("snake/title"));
90 QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); 90 QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas);
91 titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); 91 titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85);
92 titlepic->show(); 92 titlepic->show();
93 QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" 93 QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n"
94 "snake to eat the mouse. You must not\n" 94 "snake to eat the mouse. You must not\n"
95 "crash into the walls, edges or its tail."), 95 "crash into the walls, edges or its tail."),
96 &canvas); 96 &canvas);
97 w = instr->boundingRect().width(); 97 w = instr->boundingRect().width();
98 instr->move(canvas.width()/2-w/2, canvas.height()/2-20); 98 instr->move(canvas.width()/2-w/2, canvas.height()/2-20);
99 instr->setColor(white); 99 instr->setColor(white);
100 instr->show(); 100 instr->show();
101 QCanvasText* cont = new QCanvasText(tr("Press any key to start"), &canvas); 101 QCanvasText* cont = new QCanvasText(tr("Press any key to start"), &canvas);