#ifndef _EIGHTBALL_H #define _EIGHTBALL_H #include #include #include "vector.h" #include "point.h" #include "rules.h" // Forward declarations of our helper classes class TQString; class KuePlayer; class NineBallFactory : KLibFactory { public: TQObject* createObject(TQObject*, const char*, const char*, const TQStringList &); }; class NineBall : public KueRulesEngine { TQ_OBJECT public: NineBall(TQObject *parent, const char *name); ~NineBall(); void start(); protected slots: // Called by physics engine when a billiard is sunk void billiardSunk(unsigned int ball, unsigned int pocket); // Called by physics engine when a billiard is struck (by the cue ball or another billiard) void billiardHit(unsigned int ball1, unsigned int ball2); // Called by the physics engine when all billiards have stopped moving void motionStopped(); void cuePlaced(); void shotTaken(); private: // Ask the interface to start the shot TQString startShotMessage(); // Ask the interface to place the cue ball TQString placeCueBallMessage(); // Is a ball the cue ball? bool ballIsCue(unsigned int number); // Is a ball the magic ball (8)? bool ballIsLowest(unsigned int number); // Handle a player's victory void playerWins(); // Is this shot a scratch? bool _foul; // First ball sunk int _first_sunk; // First ball hit int _first_hit; // The current player KuePlayer *_current_player; // The current team int _current_team; // Have we had a successful break? bool _broke; }; #endif