File: graph.h

package info (click to toggle)
flying 6.20-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 752 kB
  • ctags: 1,873
  • sloc: cpp: 10,966; makefile: 189
file content (128 lines) | stat: -rw-r--r-- 3,511 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _graph_h
#define _graph_h

#ifndef _object_h
#	include "object.h"
#endif
#ifndef _vec2_h
#	include "vec2.h"
#endif

extern double	world_x, world_y;		// Fenstergr��e in Weltkoordinaten
extern int 		max_x, max_y;			// Fenstergr��e in Pixelkoordinaten
extern double	w2n;						// Transformationsfaktor
extern int		wall_click;

inline double MaxX()		{	return world_x; }
inline double MaxY()		{	return world_y; }

void InitGraphic( double x=100., double y=80. );
void UnlockGraphic( void );
void CloseGraphic( void );

void SetBgColor( ColorId col );

#define	COLOR_BITS		10
#define	COLOR_MASK		0x000000ffL
#define	BG_MASK			0x00000100L
#define	STAT_MASK		0x00000200L
#define	RAND_SHIFT		20
#define	RAND_MASK		0x00F00000L
#define	MIX_MASK			0x80000000L

extern int nbg_cols;
extern unsigned long bg_pix[];
extern int nball_cols;
extern unsigned long ball_pix[];
extern int nball_ids;
extern ColorId			ball_ids[];
extern int nstat_cols;
extern unsigned long stat_pix[];

unsigned long GetAllocatedPixel( const char *name );
unsigned long GetAllocatedPixel( ColorId id, int x=0, int y=0 );

ColorId	AddBgColor( const char *name );
ColorId	AddBallColor( const char *name );
ColorId	AddStatColor( const char *name );
int		AddShadeColor( const char *name, int mult, int divi );
ColorId	SetMainBgColor( const char *name );
void		SetCursorColor( const char *name );

ColorId	CreateColorMix( ColorId c1, ColorId c2, int fact=0 );
void		ResetColor( ColorId col, const char *name );

int StoreColor( unsigned );
void StoreColors( void );
void InitColors( void );
void AllocColors( void );
void MapMainWindow( void );

void DrawLine( const Real& x1, const Real& y1, const Real& x2, const Real& y2 );
void DrawArc(const Real& x, const Real& y, const Real& r, const Real& from, const Real& angle );
void DrawCircle( const Real& x, const Real& y, const Real& r );
void FillArc(const Real& x, const Real& y, const Real& r, const Real& from, const Real& angle );
void FillCircle( const Real& x, const Real& y, const Real& r );
void FillRectangle( const Real &x, const Real& y, const Real& width, const Real& height );

void FillPoly( int n, Vec2 v[] );
void FillPoly( int n, ... );

inline void DrawLine( const Vec2 &p1, const Vec2 &p2 ) {
	DrawLine( p1.X(), p1.Y(), p2.X(), p2.Y() );
}
inline void DrawArc( const Vec2 &p, const Real& r, const Real& from, const Real& angle ) {
	DrawArc( p.X(), p.Y(), r, from, angle );
}
inline void DrawCircle( const Vec2 &p, const Real& r ) {
	DrawCircle( p.X(), p.Y(), r );
}
inline void FillArc( const Vec2 &p, const Real& r, const Real& from, const Real& angle ) {
	FillArc( p.X(), p.Y(), r, from, angle );
}
inline void FillCircle( const Vec2 &p, const Real& r ) {
	FillCircle( p.X(), p.Y(), r );
}
inline void FillRectangle( const Vec2 &p, const Vec2 &s ) {
	FillRectangle( p.X(), p.Y(), s.X(), s.Y() );
}


void SetClick( int pitch, int percent, int duration );
inline void ClickWall( void );
inline void ClickBall( void );
inline void ClickPocket( void );


double GetCurrentTime( void );			// aktuelle Uhrzeit in Sekunden
char GetKey( void );

void Inside( Vec2 *v );						// auf Bereich testen
void WarpPointer( const Vec2 &dest );	// Maus verschieben


#ifdef STATISTICS
typedef enum {
	CycleRate,
	MoveRate,
	PointerInfo,
	OffsetInfo
} StatType;

void showinfo( StatType stat, const char *info );
void graphinfo( int value );
#endif


#ifndef __TURBOC__
#	ifndef _xgraph_h
#		include "xgraph.h"
#	endif
#else
#	ifndef _dosgraph_h
#		include "dosgraph.h"
#	endif
#endif


#endif