summaryrefslogtreecommitdiff
path: root/noncore/games/bounce/game.cpp
Unidiff
Diffstat (limited to 'noncore/games/bounce/game.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/bounce/game.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index 1f1f8cd..bbd3d0b 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -1,48 +1,55 @@
1/* 1/*
2 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> 2 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the Free 15 * License along with this program; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19 19
20#include <stdlib.h> 20#include "game.h"
21#include <qtimer.h> 21
22/* OPIE */
23#include <opie2/odebug.h>
22#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25using namespace Opie::Core;
23 26
24#include "game.h" 27/* QT */
28#include <qtimer.h>
29
30/* STD */
31#include <stdlib.h>
25 32
26#define TILE_SIZE 9 33#define TILE_SIZE 9
27 34
28#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2)) 35#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2))
29#define TILE_FREE (TILE_FIRST + 0) 36#define TILE_FREE (TILE_FIRST + 0)
30#define TILE_BORDER (TILE_FIRST + 1) 37#define TILE_BORDER (TILE_FIRST + 1)
31#define TILE_WALLEND (TILE_FIRST + 2) 38#define TILE_WALLEND (TILE_FIRST + 2)
32#define TILE_WALLUP (TILE_FIRST + 3) 39#define TILE_WALLUP (TILE_FIRST + 3)
33#define TILE_WALLDOWN (TILE_FIRST + 4) 40#define TILE_WALLDOWN (TILE_FIRST + 4)
34#define TILE_WALLLEFT (TILE_FIRST + 5) 41#define TILE_WALLLEFT (TILE_FIRST + 5)
35#define TILE_WALLRIGHT (TILE_FIRST + 6) 42#define TILE_WALLRIGHT (TILE_FIRST + 6)
36 43
37#define GAME_DELAY 15 44#define GAME_DELAY 15
38#define BALL_ANIM_DELAY 60 45#define BALL_ANIM_DELAY 60
39#define WALL_DELAY 100 46#define WALL_DELAY 100
40 47
41#define MS2TICKS( ms ) ((ms)/GAME_DELAY) 48#define MS2TICKS( ms ) ((ms)/GAME_DELAY)
42 49
43Arrow::Arrow(QCanvasPixmapArray* array, QCanvas* canvas) 50Arrow::Arrow(QCanvasPixmapArray* array, QCanvas* canvas)
44 : QCanvasSprite( array, canvas ) 51 : QCanvasSprite( array, canvas )
45{ 52{
46 m_vertical = true; 53 m_vertical = true;
47 move(3,3); 54 move(3,3);
48} 55}
@@ -346,49 +353,49 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
346 arrow->show(); 353 arrow->show();
347 354
348 // create text label 355 // create text label
349 m_text = new QCanvasText( m_field ); 356 m_text = new QCanvasText( m_field );
350 357
351 // create game clock 358 // create game clock
352 m_clock = new QTimer( this ); 359 m_clock = new QTimer( this );
353 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) ); 360 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
354 m_clock->start( GAME_DELAY ); 361 m_clock->start( GAME_DELAY );
355 362
356 // setup geometry 363 // setup geometry
357 setFixedSize( m_view->size() ); 364 setFixedSize( m_view->size() );
358} 365}
359 366
360JezzGame::~JezzGame() 367JezzGame::~JezzGame()
361{ 368{
362 m_balls.clear(); 369 m_balls.clear();
363 delete m_view; 370 delete m_view;
364 delete m_field; 371 delete m_field;
365 delete m_ballPixmaps; 372 delete m_ballPixmaps;
366} 373}
367 374
368void JezzGame::display( QString text, int size ) 375void JezzGame::display( QString text, int size )
369{ 376{
370 qDebug("This function \"display\" shouldn't be called!!!"); 377 odebug << "This function \"display\" shouldn't be called!!!" << oendl;
371 if ( !text.isEmpty() ) 378 if ( !text.isEmpty() )
372 { 379 {
373 QFont font( "Helvetica", size, QFont::Bold ); 380 QFont font( "Helvetica", size, QFont::Bold );
374 font.setStyleHint( QFont::Helvetica ); 381 font.setStyleHint( QFont::Helvetica );
375 m_text->setFont( font ); 382 m_text->setFont( font );
376 m_text->setText( text ); 383 m_text->setText( text );
377 384
378 QRect size = m_text->boundingRect(); 385 QRect size = m_text->boundingRect();
379 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, 386 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
380 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); 387 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
381 388
382 m_text->show(); 389 m_text->show();
383 } else 390 } else
384 { 391 {
385 m_text->hide(); 392 m_text->hide();
386 } 393 }
387} 394}
388 395
389void JezzGame::start() 396void JezzGame::start()
390{ 397{
391 m_running = true; 398 m_running = true;
392} 399}
393 400
394void JezzGame::stop() 401void JezzGame::stop()