Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

KAsteroidsView Class Reference

#include </home/clem/local/src/opie/noncore/games/qasteroids/view.h>

Collaboration diagram for KAsteroidsView:

Collaboration graph
[legend]
List of all members.

Signals

void shipKilled ()
void rockHit (int size)
void rocksRemoved ()
void updateVitals ()

Public Member Functions

 KAsteroidsView (QWidget *parent=0, const char *name=0)
virtual ~KAsteroidsView ()
void reset ()
void setRockSpeed (double rs)
void addRocks (int num)
void newGame ()
void endGame ()
void newShip ()
void rotateLeft (bool r)
void rotateRight (bool r)
void thrust (bool t)
void shoot (bool s)
void setShield (bool s)
void teleport (bool te)
void brake (bool b)
void pause (bool p)
void showText (const QString &text, const QColor &color, bool scroll=TRUE)
void hideText ()
int shots () const
int hits () const
int power () const
int teleportCount () const
int brakeCount () const
int shieldCount () const
int shootCount () const

Public Attributes

int refreshRate

Protected Member Functions

void readSprites ()
void wrapSprite (QCanvasItem *)
void rockHit (QCanvasItem *)
void reducePower (int val)
void addExhaust (double x, double y, double dx, double dy, int count)
void processMissiles ()
void processShip ()
void processPowerups ()
void processShield ()
double randDouble ()
int randInt (int range)
virtual void resizeEvent (QResizeEvent *event)
virtual void timerEvent (QTimerEvent *)

Private Slots

void hideShield ()

Private Attributes

QCanvas field
QCanvasView view
QIntDict< QCanvasPixmapArray > animation
QPtrList< QCanvasSprite > rocks
QPtrList< KMissilemissiles
QPtrList< KBitbits
QPtrList< KExhaustexhaust
QPtrList< KPoweruppowerups
KShieldshield
QCanvasSprite * ship
QCanvasText * textSprite
bool rotateL
bool rotateR
bool thrustShip
bool shootShip
bool teleportShip
bool brakeShip
bool pauseShip
bool shieldOn
bool vitalsChanged
int shipAngle
int rotateSlow
int rotateRate
int shipPower
int shotsFired
int shotsHit
int shootDelay
int mBrakeCount
int mShieldCount
int mTeleportCount
int mShootCount
double shipDx
double shipDy
int textDy
int mFrameNum
bool mPaused
int mTimerId
double rockSpeed
double powerupSpeed
bool can_destroy_powerups
QTimer * shieldTimer

Constructor & Destructor Documentation

KAsteroidsView::KAsteroidsView QWidget *  parent = 0,
const char *  name = 0
 

Definition at line 85 of file view.cpp.

References bits, can_destroy_powerups, exhaust, FALSE, field, hideShield(), IMG_BACKGROUND, Opie::Core::OResource::loadPixmap(), MAX_POWER_LEVEL, missiles, mPaused, mTimerId, powerups, readSprites(), REFRESH_DELAY, refreshRate, rocks, QPtrCollection::setAutoDelete(), shield, shieldOn, shieldTimer, shipPower, textSprite, TRUE, view, and vitalsChanged.

KAsteroidsView::~KAsteroidsView  )  [virtual]
 

Definition at line 123 of file view.cpp.


Member Function Documentation

void KAsteroidsView::addExhaust double  x,
double  y,
double  dx,
double  dy,
int  count
[protected]
 

Definition at line 521 of file view.cpp.

References animation, QPtrList< type >::append(), exhaust, field, i, ID_EXHAUST, and randDouble().

Referenced by processShip().

void KAsteroidsView::addRocks int  num  ) 
 

Definition at line 270 of file view.cpp.

References animation, QPtrList< type >::append(), field, i, ID_ROCK_MEDIUM, randDouble(), randInt(), rocks, and rockSpeed.

Referenced by KAstTopLevel::slotNewGame(), and KAstTopLevel::slotRocksRemoved().

void KAsteroidsView::brake bool  b  ) 
 

Definition at line 230 of file view.cpp.

References brakeShip, FALSE, mBrakeCount, ROTATE_RATE, rotateL, rotateR, rotateRate, and thrustShip.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

int KAsteroidsView::brakeCount  )  const [inline]
 

Definition at line 73 of file view.h.

References mBrakeCount.

Referenced by KAstTopLevel::slotUpdateVitals().

void KAsteroidsView::endGame  ) 
 

Definition at line 172 of file view.cpp.

Referenced by KAstTopLevel::slotShipKilled().

void KAsteroidsView::hideShield  )  [private, slot]
 

Definition at line 862 of file view.cpp.

References FALSE, mShieldCount, shield, and shieldOn.

Referenced by KAsteroidsView(), and setShield().

void KAsteroidsView::hideText  ) 
 

Definition at line 321 of file view.cpp.

References TEXT_SPEED, and textDy.

Referenced by KAstTopLevel::keyReleaseEvent(), and KAstTopLevel::slotNewGame().

int KAsteroidsView::hits  )  const [inline]
 

Definition at line 69 of file view.h.

References shotsHit.

Referenced by KAstTopLevel::doStats(), processMissiles(), processPowerups(), and processShip().

void KAsteroidsView::newGame  ) 
 

Definition at line 157 of file view.cpp.

References FALSE, mTimerId, REFRESH_DELAY, reset(), shield, shieldOn, and updateVitals().

Referenced by KAstTopLevel::slotNewGame().

void KAsteroidsView::newShip  ) 
 

Definition at line 190 of file view.cpp.

References brakeShip, FALSE, field, MAX_POWER_LEVEL, mBrakeCount, mShieldCount, mShootCount, mTeleportCount, ROTATE_RATE, rotateL, rotateR, rotateRate, rotateSlow, shield, shieldOn, shieldTimer, ship, shipAngle, shipDx, shipDy, shipPower, shootDelay, shootShip, teleportShip, thrustShip, and TRUE.

Referenced by KAstTopLevel::keyReleaseEvent(), and KAstTopLevel::slotNewGame().

void KAsteroidsView::pause bool  p  ) 
 

Definition at line 176 of file view.cpp.

References mPaused, mTimerId, and REFRESH_DELAY.

Referenced by KAstTopLevel::focusInEvent(), KAstTopLevel::focusOutEvent(), KAstTopLevel::hideEvent(), and KAstTopLevel::showEvent().

int KAsteroidsView::power  )  const [inline]
 

Definition at line 70 of file view.h.

References shipPower.

Referenced by KAstTopLevel::slotUpdateVitals().

void KAsteroidsView::processMissiles  )  [protected]
 

Definition at line 534 of file view.cpp.

References QPtrListIterator< type >::current(), KMissile::expired(), KMissile::growOlder(), hits(), ID_ROCK_LARGE, ID_ROCK_SMALL, missiles, QPtrList< type >::removeRef(), rockHit(), shotsHit, TRUE, and wrapSprite().

Referenced by timerEvent().

void KAsteroidsView::processPowerups  )  [protected]
 

Definition at line 787 of file view.cpp.

References can_destroy_powerups, QPtrListIterator< type >::current(), KPowerup::expired(), KPowerup::growOlder(), hits(), ID_BRAKE_POWERUP, ID_ENERGY_POWERUP, ID_MISSILE, ID_SHIELD_POWERUP, ID_SHOOT_POWERUP, ID_TELEPORT_POWERUP, QPtrList< type >::isEmpty(), MAX_BRAKES, MAX_FIREPOWER, MAX_POWER_LEVEL, MAX_SHIELDS, mBrakeCount, mShieldCount, mShootCount, mTeleportCount, powerups, QPtrList< type >::removeRef(), shield, ship, shipPower, TRUE, vitalsChanged, and wrapSprite().

Referenced by timerEvent().

void KAsteroidsView::processShield  )  [protected]
 

void KAsteroidsView::processShip  )  [protected]
 

Definition at line 573 of file view.cpp.

References addExhaust(), animation, QPtrList< type >::append(), bits, BRAKE_ON_COST, brakeShip, QPtrList< type >::count(), fabs(), FALSE, field, hits(), i, ID_BIT, ID_MISSILE, ID_ROCK_LARGE, ID_ROCK_MEDIUM, ID_ROCK_SMALL, M_PI, MAX_SHIP_SPEED, mBrakeCount, MISSILE_SPEED, missiles, mShieldCount, mShootCount, PI_X_2, randDouble(), randInt(), reducePower(), rockHit(), ROTATE_RATE, rotateL, rotateR, rotateRate, rotateSlow, KBit::setDeath(), shield, SHIELD_HIT_COST, SHIELD_ON_COST, shieldOn, ship, SHIP_STEPS, shipAngle, shipDx, shipDy, shipKilled(), shootDelay, shootShip, shotsFired, teleportShip, thrustShip, TRUE, and vitalsChanged.

Referenced by timerEvent().

double KAsteroidsView::randDouble  )  [protected]
 

Definition at line 869 of file view.cpp.

References v.

Referenced by addExhaust(), addRocks(), processShip(), and rockHit().

int KAsteroidsView::randInt int  range  )  [protected]
 

Definition at line 875 of file view.cpp.

Referenced by addRocks(), processShip(), and rockHit().

void KAsteroidsView::readSprites  )  [protected]
 

Definition at line 248 of file view.cpp.

References animation, field, i, ID_SHIELD, ID_SHIP, QIntDict< type >::insert(), QPEApplication::qpeDir(), shield, and ship.

Referenced by KAsteroidsView().

void KAsteroidsView::reducePower int  val  )  [protected]
 

Definition at line 505 of file view.cpp.

References FALSE, shield, shieldOn, shipPower, thrustShip, TRUE, and vitalsChanged.

Referenced by processShip().

void KAsteroidsView::reset  ) 
 

Definition at line 129 of file view.cpp.

References bits, QPtrList< type >::clear(), exhaust, FALSE, mFrameNum, missiles, mPaused, powerups, powerupSpeed, rocks, rockSpeed, shield, ship, shotsFired, and shotsHit.

Referenced by newGame().

void KAsteroidsView::resizeEvent QResizeEvent *  event  )  [protected, virtual]
 

Definition at line 328 of file view.cpp.

References field, height, view, and width.

void KAsteroidsView::rockHit QCanvasItem *   )  [protected]
 

Definition at line 416 of file view.cpp.

References animation, QPtrList< type >::append(), QPtrList< type >::count(), field, i, ID_BRAKE_POWERUP, ID_ENERGY_POWERUP, ID_ROCK_LARGE, ID_ROCK_MEDIUM, ID_ROCK_SMALL, ID_SHIELD_POWERUP, ID_SHOOT_POWERUP, MAX_ROCK_SPEED, powerups, randDouble(), randInt(), QPtrList< type >::removeRef(), rockHit(), rocks, rockSpeed, and rocksRemoved().

void KAsteroidsView::rockHit int  size  )  [signal]
 

Referenced by processMissiles(), processShip(), and rockHit().

void KAsteroidsView::rocksRemoved  )  [signal]
 

Referenced by rockHit().

void KAsteroidsView::rotateLeft bool  r  )  [inline]
 

Definition at line 56 of file view.h.

References rotateL, and rotateSlow.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

void KAsteroidsView::rotateRight bool  r  )  [inline]
 

Definition at line 57 of file view.h.

References rotateR, and rotateSlow.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

void KAsteroidsView::setRockSpeed double  rs  )  [inline]
 

Definition at line 50 of file view.h.

References rockSpeed.

Referenced by KAstTopLevel::slotNewGame(), and KAstTopLevel::slotRocksRemoved().

void KAsteroidsView::setShield bool  s  ) 
 

Definition at line 220 of file view.cpp.

References hideShield(), mShieldCount, shieldOn, and shieldTimer.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

int KAsteroidsView::shieldCount  )  const [inline]
 

Definition at line 74 of file view.h.

References mShieldCount.

Referenced by KAstTopLevel::slotUpdateVitals().

void KAsteroidsView::shipKilled  )  [signal]
 

Referenced by processShip().

void KAsteroidsView::shoot bool  s  )  [inline]
 

Definition at line 59 of file view.h.

References shootDelay, and shootShip.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

int KAsteroidsView::shootCount  )  const [inline]
 

Definition at line 75 of file view.h.

References mShootCount.

Referenced by KAstTopLevel::slotUpdateVitals().

int KAsteroidsView::shots  )  const [inline]
 

Definition at line 68 of file view.h.

References shotsFired.

Referenced by KAstTopLevel::doStats().

void KAsteroidsView::showText const QString text,
const QColor &  color,
bool  scroll = TRUE
 

Definition at line 301 of file view.cpp.

References field, TEXT_SPEED, textDy, and textSprite.

Referenced by KAstTopLevel::doStats(), and KAstTopLevel::slotShipKilled().

void KAsteroidsView::teleport bool  te  )  [inline]
 

Definition at line 61 of file view.h.

References mTeleportCount, and teleportShip.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

int KAsteroidsView::teleportCount  )  const [inline]
 

Definition at line 72 of file view.h.

References mTeleportCount.

void KAsteroidsView::thrust bool  t  )  [inline]
 

Definition at line 58 of file view.h.

References shipPower, and thrustShip.

Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().

void KAsteroidsView::timerEvent QTimerEvent *   )  [protected, virtual]
 

Definition at line 337 of file view.cpp.

References bits, exhaust, FALSE, field, QPtrList< type >::first(), mFrameNum, QPtrList< type >::next(), processMissiles(), processPowerups(), processShip(), QPtrList< type >::removeRef(), rocks, ship, textDy, textSprite, updateVitals(), vitalsChanged, and wrapSprite().

void KAsteroidsView::updateVitals  )  [signal]
 

Referenced by newGame(), and timerEvent().

void KAsteroidsView::wrapSprite QCanvasItem *   )  [protected]
 

Definition at line 398 of file view.cpp.

References field, Opie::MM::x, and Opie::MM::y.

Referenced by processMissiles(), processPowerups(), and timerEvent().


Member Data Documentation

QIntDict<QCanvasPixmapArray> KAsteroidsView::animation [private]
 

Definition at line 105 of file view.h.

Referenced by addExhaust(), addRocks(), processShip(), readSprites(), and rockHit().

QPtrList<KBit> KAsteroidsView::bits [private]
 

Definition at line 108 of file view.h.

Referenced by KAsteroidsView(), processShip(), reset(), and timerEvent().

bool KAsteroidsView::brakeShip [private]
 

Definition at line 120 of file view.h.

Referenced by brake(), newShip(), and processShip().

bool KAsteroidsView::can_destroy_powerups [private]
 

Definition at line 151 of file view.h.

Referenced by KAsteroidsView(), and processPowerups().

QPtrList<KExhaust> KAsteroidsView::exhaust [private]
 

Definition at line 109 of file view.h.

Referenced by addExhaust(), KAsteroidsView(), reset(), and timerEvent().

QCanvas KAsteroidsView::field [private]
 

Definition at line 103 of file view.h.

Referenced by addExhaust(), addRocks(), KAsteroidsView(), newShip(), processShip(), readSprites(), resizeEvent(), rockHit(), showText(), timerEvent(), and wrapSprite().

int KAsteroidsView::mBrakeCount [private]
 

Definition at line 135 of file view.h.

Referenced by brake(), brakeCount(), newShip(), processPowerups(), and processShip().

int KAsteroidsView::mFrameNum [private]
 

Definition at line 144 of file view.h.

Referenced by reset(), and timerEvent().

QPtrList<KMissile> KAsteroidsView::missiles [private]
 

Definition at line 107 of file view.h.

Referenced by KAsteroidsView(), processMissiles(), processShip(), and reset().

bool KAsteroidsView::mPaused [private]
 

Definition at line 145 of file view.h.

Referenced by KAsteroidsView(), pause(), and reset().

int KAsteroidsView::mShieldCount [private]
 

Definition at line 136 of file view.h.

Referenced by hideShield(), newShip(), processPowerups(), processShip(), setShield(), and shieldCount().

int KAsteroidsView::mShootCount [private]
 

Definition at line 138 of file view.h.

Referenced by newShip(), processPowerups(), processShip(), and shootCount().

int KAsteroidsView::mTeleportCount [private]
 

Definition at line 137 of file view.h.

Referenced by newShip(), processPowerups(), teleport(), and teleportCount().

int KAsteroidsView::mTimerId [private]
 

Definition at line 146 of file view.h.

Referenced by KAsteroidsView(), newGame(), and pause().

bool KAsteroidsView::pauseShip [private]
 

Definition at line 121 of file view.h.

QPtrList<KPowerup> KAsteroidsView::powerups [private]
 

Definition at line 110 of file view.h.

Referenced by KAsteroidsView(), processPowerups(), reset(), and rockHit().

double KAsteroidsView::powerupSpeed [private]
 

Definition at line 149 of file view.h.

Referenced by reset().

int KAsteroidsView::refreshRate
 

Definition at line 47 of file view.h.

Referenced by KAsteroidsView().

QPtrList<QCanvasSprite> KAsteroidsView::rocks [private]
 

Definition at line 106 of file view.h.

Referenced by addRocks(), KAsteroidsView(), reset(), rockHit(), and timerEvent().

double KAsteroidsView::rockSpeed [private]
 

Definition at line 148 of file view.h.

Referenced by addRocks(), reset(), rockHit(), and setRockSpeed().

bool KAsteroidsView::rotateL [private]
 

Definition at line 115 of file view.h.

Referenced by brake(), newShip(), processShip(), and rotateLeft().

bool KAsteroidsView::rotateR [private]
 

Definition at line 116 of file view.h.

Referenced by brake(), newShip(), processShip(), and rotateRight().

int KAsteroidsView::rotateRate [private]
 

Definition at line 128 of file view.h.

Referenced by brake(), newShip(), and processShip().

int KAsteroidsView::rotateSlow [private]
 

Definition at line 127 of file view.h.

Referenced by newShip(), processShip(), rotateLeft(), and rotateRight().

KShield* KAsteroidsView::shield [private]
 

Definition at line 111 of file view.h.

Referenced by hideShield(), KAsteroidsView(), newGame(), newShip(), processPowerups(), processShip(), readSprites(), reducePower(), and reset().

bool KAsteroidsView::shieldOn [private]
 

Definition at line 122 of file view.h.

Referenced by hideShield(), KAsteroidsView(), newGame(), newShip(), processShip(), reducePower(), and setShield().

QTimer* KAsteroidsView::shieldTimer [private]
 

Definition at line 153 of file view.h.

Referenced by KAsteroidsView(), newShip(), and setShield().

QCanvasSprite* KAsteroidsView::ship [private]
 

Definition at line 112 of file view.h.

Referenced by newShip(), processPowerups(), processShip(), readSprites(), reset(), and timerEvent().

int KAsteroidsView::shipAngle [private]
 

Definition at line 126 of file view.h.

Referenced by newShip(), and processShip().

double KAsteroidsView::shipDx [private]
 

Definition at line 140 of file view.h.

Referenced by newShip(), and processShip().

double KAsteroidsView::shipDy [private]
 

Definition at line 141 of file view.h.

Referenced by newShip(), and processShip().

int KAsteroidsView::shipPower [private]
 

Definition at line 129 of file view.h.

Referenced by KAsteroidsView(), newShip(), power(), processPowerups(), reducePower(), and thrust().

int KAsteroidsView::shootDelay [private]
 

Definition at line 133 of file view.h.

Referenced by newShip(), processShip(), and shoot().

bool KAsteroidsView::shootShip [private]
 

Definition at line 118 of file view.h.

Referenced by newShip(), processShip(), and shoot().

int KAsteroidsView::shotsFired [private]
 

Definition at line 131 of file view.h.

Referenced by processShip(), reset(), and shots().

int KAsteroidsView::shotsHit [private]
 

Definition at line 132 of file view.h.

Referenced by hits(), processMissiles(), and reset().

bool KAsteroidsView::teleportShip [private]
 

Definition at line 119 of file view.h.

Referenced by newShip(), processShip(), and teleport().

int KAsteroidsView::textDy [private]
 

Definition at line 143 of file view.h.

Referenced by hideText(), showText(), and timerEvent().

QCanvasText* KAsteroidsView::textSprite [private]
 

Definition at line 113 of file view.h.

Referenced by KAsteroidsView(), showText(), and timerEvent().

bool KAsteroidsView::thrustShip [private]
 

Definition at line 117 of file view.h.

Referenced by brake(), newShip(), processShip(), reducePower(), and thrust().

QCanvasView KAsteroidsView::view [private]
 

Definition at line 104 of file view.h.

Referenced by KAsteroidsView(), and resizeEvent().

bool KAsteroidsView::vitalsChanged [private]
 

Definition at line 124 of file view.h.

Referenced by KAsteroidsView(), processPowerups(), processShip(), reducePower(), and timerEvent().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:37:09 2005 for OPIE by  doxygen 1.4.2