You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdegames/kue/interface.h

87 lines
1.9 KiB
C++

#ifndef _INTERFACE_H
#define _INTERFACE_H
#include <tqdatetime.h>
#include <tqobject.h>
#include <tqcolor.h>
#include <tqgl.h>
#include "circle.h"
#include "vector.h"
#include "texture.h"
class table;
class rules;
class TQString;
// Handles user interface functionality
class GLUserInterface : public TQGLWidget {
TQ_OBJECT
public:
GLUserInterface(TQWidget *parent);
~GLUserInterface();
// Rules' functions
void placeBilliard(double cue_line);
void startShot(circle cue_location, TQColor player_color, bool forward_only = false);
void update();
signals:
// Called by the interface when the user has decided on a cue location
void billiardPlaced(point &location);
// Called by the interface when the user is deciding on a cue location
void previewBilliardPlace(point &location);
void shotTaken(vector &velocity);
private:
void initializeGL();
void resizeGL(int widget, int height);
void paintGL();
void mouseMoveEvent(TQMouseEvent *e);
void mousePressEvent(TQMouseEvent *e);
void mouseReleaseEvent(TQMouseEvent *e);
double windowToInternalX(int x);
double windowToInternalY(int y);
void timerEvent( TQTimerEvent * );
void updateView();
double shotPower();
void mouseClicked(double x, double y, int button, int state);
double positionToAngle(double position);
double positionToCuePlacement(double position);
// Are we placing the cue ball?
bool _placing_cue;
double _cue_line;
// Are we shooting?
bool _shooting;
// Can we shoot only in front of the start line?
bool _forward_only;
// Where is the cue? And how big is it?
circle _cue_location;
// Where is the mouse?
point _mouse_location;
// When did the user begin the 'shot' by pressing down the mouse button
bool _shot_started;
TQTime _shot_time;
// Cue texture
KueTexture _cue_texture;
// The current player's color
TQColor _player_color;
table *_table;
};
#endif