home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / flying-6.11 / mover.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  2.4 KB  |  106 lines

  1. #ifndef _mover_h
  2. #define _mover_h
  3.  
  4. //
  5. // Im Model 'mover' wird die Klasse BallMover definiert, die allerdings
  6. // in Wirklichkeit aus den Modulen 'xmover' bzw. 'dosmover' ⁿbernommen wird.
  7. // Die darin definierten Klassen mⁿssen daher folgenden Schnittstelle haben
  8. //
  9. //     BallMover( const Real &r );    // Konstruktor mit Radius
  10. //        ~BallMover();                        // Destruktor
  11. //
  12. //        void Init();                        // Pixmaps anlegen
  13. //        Real GetActRadius();                // aus Pixelgr÷▀e zurⁿckgerechneter Radius
  14. //
  15. //        void DrawBallAt( int x, int y, ColorId col );
  16. //                                                // Ball setzen (und l÷schen)
  17. //        void MoveBallOnScreen( int oldx, int oldy, int newx, int newy, ColorId col );
  18. //                                                // Ball bewegen von ... nach ...
  19. //
  20. // Die Funktionen sind virtuell sein, um Ableitungen zuzulassen !!
  21. // Folgende Ableitungen existieren:
  22. //        DiscMover         - Scheibe (fⁿr Carrom)
  23. //        ShadedBallMover - Ball mit Beleuchtungseffekt (auf XWindows)
  24. //
  25. //    Die Initialisierung des BallMovers geschieht aus der Game-Klasse heraus.
  26. //    Die Bewegung der Objekte geschieht aus der BallState-Klasse heraus, welche
  27. //    auch in diesem Modul definiert wird. Sie ist allerdings unabhΣngig von
  28. //    der Hardware.
  29. //
  30.  
  31.  
  32. #ifndef _real_h
  33. #    include "real.h"
  34. #endif
  35.  
  36. #ifndef _graph_h
  37. #    include "graph.h"
  38. #endif
  39.  
  40.  
  41.  
  42. #ifndef __TURBOC__
  43. #    ifndef _xmover_h
  44. #        include "xmover.h"
  45. #    endif
  46. #else
  47. #    ifndef _dosmover_h
  48. #        include "dosmover.h"
  49. #    endif
  50. #endif
  51.  
  52. class BallStateTop {
  53.     public:
  54.         BallStateTop();
  55.         virtual ~BallStateTop();
  56.  
  57.         virtual void Redraw();
  58.         virtual void Show();
  59.         virtual void MoveTo( const Vec2 &new_pos );
  60.         virtual void Hide();
  61. };
  62.  
  63. class BallState : public BallStateTop {
  64.     public:
  65.         BallState( BallMover *m, ColorId col, const Vec2 &pos );
  66.         virtual ~BallState();
  67.  
  68.         virtual void Redraw();
  69.         virtual void Show();
  70.         virtual void MoveTo( const Vec2 &new_pos );
  71.         virtual void Hide();
  72.  
  73.     protected:
  74.         int                vis;
  75.         int                x,y;        // old position
  76.         BallMover        *m;        // Pointer to Mover
  77.         ColorId            col;
  78.         int                col_x;    // Index in Ball-Farbenliste
  79.  
  80. friend class BallMover;
  81. };
  82.  
  83.  
  84. class HalfBallState : public BallState {
  85.     public:
  86.         HalfBallState( BallMover *m, ColorId col, const Vec2 &pos );
  87.         virtual ~HalfBallState();
  88.  
  89.         virtual void Redraw();
  90.         virtual void Show();
  91.         virtual void MoveTo( const Vec2 &new_pos );
  92.         virtual void Hide();
  93.  
  94.     protected:
  95.         HalfBallMover    *mh;        // Kopie von m - zum leichteren Zugriff
  96.         RingState        st;        // Pol der Kugel
  97.  
  98. friend class HalfBallMover;
  99. #ifdef DEBUG
  100.     friend class TestField;
  101. #endif
  102. };
  103.  
  104.  
  105. #endif
  106.