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

  1. #ifndef _graph_h
  2. #define _graph_h
  3.  
  4. #ifndef _object_h
  5. #    include "object.h"
  6. #endif
  7. #ifndef _vec2_h
  8. #    include "vec2.h"
  9. #endif
  10.  
  11. extern double    world_x, world_y;        // Fenstergr÷▀e in Weltkoordinaten
  12. extern int         max_x, max_y;            // Fenstergr÷▀e in Pixelkoordinaten
  13. extern double    w2n;                        // Transformationsfaktor
  14. extern int        wall_click;
  15.  
  16. inline double MaxX()        {    return world_x; }
  17. inline double MaxY()        {    return world_y; }
  18.  
  19. void InitGraphic( double x=100., double y=80. );
  20. void CloseGraphic();
  21.  
  22. void SetBgColor( ColorId col );
  23.  
  24. #define    COLOR_BITS        10
  25. #define    COLOR_MASK        0x000000ffl
  26. #define    BG_MASK            0x00000100l
  27. #define    STAT_MASK        0x00000200l
  28. #define    RAND_SHIFT        20
  29. #define    RAND_MASK        0x00F00000l
  30. #define    MIX_MASK            0x80000000l
  31.  
  32. extern int nbg_cols;
  33. extern unsigned long bg_pix[];
  34. extern int nball_cols;
  35. extern unsigned long ball_pix[];
  36. extern int nball_ids;
  37. extern ColorId            ball_ids[];
  38. extern int nstat_cols;
  39. extern unsigned long stat_pix[];
  40.  
  41. unsigned long GetAllocatedPixel( const char *name );
  42. unsigned long GetAllocatedPixel( ColorId id, int x=0, int y=0 );
  43.  
  44. ColorId    AddBgColor( const char *name );
  45. ColorId    AddBallColor( const char *name );
  46. ColorId    AddStatColor( const char *name );
  47. int        AddShadeColor( const char *name, int mult, int divi );
  48. ColorId    SetMainBgColor( const char *name );
  49. void        SetCursorColor( const char *name );
  50.  
  51. ColorId    CreateColorMix( ColorId c1, ColorId c2, int fact=0 );
  52. void        ResetColor( ColorId col, const char *name );
  53.  
  54. int StoreColor( unsigned );
  55. void StoreColors();
  56. void InitColors();
  57. void AllocColors();
  58. void MapMainWindow();
  59.  
  60. void DrawLine( const Real& x1, const Real& y1, const Real& x2, const Real& y2 );
  61. void DrawArc(const Real& x, const Real& y, const Real& r, const Real& from, const Real& angle );
  62. void DrawCircle( const Real& x, const Real& y, const Real& r );
  63. void FillArc(const Real& x, const Real& y, const Real& r, const Real& from, const Real& angle );
  64. void FillCircle( const Real& x, const Real& y, const Real& r );
  65. void FillRectangle( const Real &x, const Real& y, const Real& width, const Real& height );
  66.  
  67. void FillPoly( int n, Vec2 v[] );
  68. void FillPoly( int n, ... );
  69.  
  70. inline void DrawLine( const Vec2 &p1, const Vec2 &p2 ) {
  71.     DrawLine( p1.X(), p1.Y(), p2.X(), p2.Y() );
  72. }
  73. inline void DrawArc( const Vec2 &p, const Real& r, const Real& from, const Real& angle ) {
  74.     DrawArc( p.X(), p.Y(), r, from, angle );
  75. }
  76. inline void DrawCircle( const Vec2 &p, const Real& r ) {
  77.     DrawCircle( p.X(), p.Y(), r );
  78. }
  79. inline void FillArc( const Vec2 &p, const Real& r, const Real& from, const Real& angle ) {
  80.     FillArc( p.X(), p.Y(), r, from, angle );
  81. }
  82. inline void FillCircle( const Vec2 &p, const Real& r ) {
  83.     FillCircle( p.X(), p.Y(), r );
  84. }
  85. inline void FillRectangle( const Vec2 &p, const Vec2 &s ) {
  86.     FillRectangle( p.X(), p.Y(), s.X(), s.Y() );
  87. }
  88.  
  89.  
  90. void SetClick( int pitch, int percent, int duration );
  91. inline void ClickWall();
  92. inline void ClickBall();
  93. inline void ClickPocket();
  94.  
  95.  
  96. double GetCurrentTime();                        // aktuelle Uhrzeit in Sekunden
  97. char GetKey();
  98.  
  99. void Inside( Vec2 *v );                        // auf Bereich testen
  100. void WarpPointer( const Vec2 &dest );    // Maus verschieben
  101.  
  102.  
  103. #ifdef STATISTICS
  104. typedef enum {
  105.     CycleRate,
  106.     MoveRate,
  107.     PointerInfo,
  108.     OffsetInfo
  109. } StatType;
  110.  
  111. void showinfo( StatType stat, const char *info );
  112. #endif
  113.  
  114.  
  115. #ifndef __TURBOC__
  116. #    ifndef _xgraph_h
  117. #        include "xgraph.h"
  118. #    endif
  119. #else
  120. #    ifndef _dosgraph_h
  121. #        include "dosgraph.h"
  122. #    endif
  123. #endif
  124.  
  125.  
  126. #endif
  127.