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