# /home/samy/kbilliards/src/ball.h

    00001 /***************************************************************************
    00002                           ball.h  -  description
    00003                              -------------------
    00004     begin                : Mon Jan 14 2002
    00005     copyright            : (C) 2002 by Samuele Catuzzi
    00006     email                : samuele_catuzzi@yahoo.it
    00007  ***************************************************************************/
    00008
    00009 /***************************************************************************
    00010  *                                                                         *
    00011  *   This program is free software; you can redistribute it and/or modify  *
    00012  *   it under the terms of the GNU General Public License as published by  *
    00013  *   the Free Software Foundation; either version 2 of the License, or     *
    00014  *   (at your option) any later version.                                   *
    00015  *                                                                         *
    00016  ***************************************************************************/
    00017
    00018 #ifndef BALL_H
    00019 #define BALL_H
    00020
    00021 #include <qcanvas.h>
    00022 #include "samuele.h"
    00023 #include "kbilliards.h"
    00024 #include "edgeobject.h"
    00025 #include "graphicvector.h"
    00026
    00030 class Kbilliards;
    00031 class EdgeObject;
    00032
    00033 class  Ball_Physics
    00034 {
    00035  public:
    00036     Ball_Physics();
    00037
    00038  public:
    00039     static const double mass = 1;
    00040     static const double diameter = 20;
    00041
    00043     samuele::Vector vect_Pos;
    00045     samuele::Vector vect_Vel;
    00046 };
    00047
    00048 class Ball : public QCanvasSprite, public Ball_Physics {
    00049 public:
    00050         Ball(QCanvasPixmapArray *,QCanvas *,Kbilliards *,int,int Z = 10 );
    00051         ~Ball();
    00053   void advance(int);
    00055   int rtti() const;
    00057   void setPosition(double ,double );
    00059   void setVelocity(double ,double );
    00061   double xVelocity();
    00063   double yVelocity();
    00065   double xcenter();
    00067   double ycenter();
    00069   bool stopped();
    00071   double BallCPrediction(Ball *);
    00073   void DoBallCollision(Ball * );
    00075   void DoEdgeCollision(EdgeObject * );
    00077   void setAnimateL(bool);
    00078 public: // Public attributes
    00080   QCanvasPixmapArray * images;
    00082   GraphicVector * graphicvector;
    00084   double deceleration ;
    00086   int ballnumber;
    00088   double hitedgedecel;
    00090   double hitballdecel;
    00092   bool light;
    00093 private: // Private attributes
    00095   Kbilliards * application;
    00097   int anim_speed;
    00099   int framespeed;
    00100 };
    00101
    00102 #endif