[go: up one dir, main page]

Menu

[57f700]: / c / vipgfx.h  Maximize  Restore  History

Download this file

369 lines (293 with data), 14.5 kB

  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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#pragma once
#ifdef _WIN32
#define importdecl __declspec(dllimport)
#define ref &
#else
#define importdecl
#define ref
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define gfxDeviceBest 0
#define gfxDeviceGUI 1
#define gfxDeviceDDraw 2
#define gfxDeviceOpenGL 3
#define gfxDeviceSVGAlib 4
#define gfxDeviceCanvas 5
#define gfxDeviceOpenGLcontext 6
#define gfxDeviceOpenGLStretch 7
#define gfxDeviceGUIStretch 8
#define gfxDeviceXCB 9
extern importdecl int gfxDeviceMode;
extern importdecl bool gfxCenterWindow;
extern importdecl int gfxWindowPosX;
extern importdecl int gfxWindowPosY;
extern importdecl bool gfxUsingThreads;
extern importdecl int gfxPixelSizeX;
extern importdecl int gfxPixelSizeY;
extern void InitGFXsystem(unsigned int width, unsigned int height, bool fullscreen);
extern void FinishGFXsystem();
extern void UpdateGFXsystem();
extern importdecl float gfxFPS;
extern void StartFPScounter();
extern void ReturnFPSstring();
extern void updateTimer();
extern importdecl unsigned int gfxRealScreenWidth;
extern importdecl unsigned int gfxRealScreenHeight;
extern importdecl bool gfxWindowMinimized;
extern importdecl bool gfxFullScreen;
extern importdecl bool gfxDone;
extern void openGLcontext(unsigned int width, unsigned int height, bool fullscreen);
extern void closeGLcontext();
extern void FlipScreen();
extern void UpdateInternals();
extern void SwitchFullScreen();
extern void SwitchWindowed();
extern void MinimizeGFXwindow();
extern void RestoreGFXwindow();
extern void SetGFXwindowCaption(const char* name);
extern void SetGFXwindowPos(unsigned int x, unsigned int y);
extern void GetGFXwindowPos(unsigned int &x, unsigned int &y);
extern void GetDesktopResolution(unsigned int &x, unsigned int &y);
typedef struct gfxImage {
void* data;
unsigned int width;
unsigned int height;
} gfxImage;
typedef struct gfxColor {
char b;
char g;
char r;
char a;
} gfxColor;
extern importdecl gfxImage vscreen;
#define KEY_A 1
#define KEY_S 2
#define KEY_D 3
#define KEY_F 4
#define KEY_H 5
#define KEY_G 6
#define KEY_Z 7
#define KEY_X 8
#define KEY_C 9
#define KEY_V 10
#define KEY_B 11
#define KEY_Q 12
#define KEY_W 13
#define KEY_E 14
#define KEY_R 15
#define KEY_Y 16
#define KEY_T 17
#define KEY_O 18
#define KEY_U 19
#define KEY_I 20
#define KEY_P 21
#define KEY_L 22
#define KEY_J 23
#define KEY_K 24
#define KEY_N 25
#define KEY_M 26
#define KEY_1 27
#define KEY_2 28
#define KEY_3 29
#define KEY_4 30
#define KEY_5 31
#define KEY_6 32
#define KEY_7 33
#define KEY_8 34
#define KEY_9 35
#define KEY_0 36
#define KEY_F1 37
#define KEY_F2 38
#define KEY_F3 39
#define KEY_F4 40
#define KEY_F5 41
#define KEY_F6 42
#define KEY_F7 43
#define KEY_F8 44
#define KEY_F9 45
#define KEY_F10 46
#define KEY_F11 47
#define KEY_F12 48
#define KEY_RETURN 49
#define KEY_TAB 50
#define KEY_SPACE 51
#define KEY_BACKSPACE 52
#define KEY_ESCAPE 53
#define KEY_CAPSLOCK 54
#define KEY_PRINTSCREEN 55
#define KEY_SCROLLLOCK 56
#define KEY_PAUSE 57
#define KEY_RGUI 58
#define KEY_LGUI 59
#define KEY_RSHIFT 60
#define KEY_LSHIFT 61
#define KEY_RALT 62
#define KEY_LALT 63
#define KEY_RCONTROL 64
#define KEY_LCONTROL 65
#define KEY_NUMPAD_NUMLOCK 66
#define KEY_NUMPAD_MUL 67
#define KEY_NUMPAD_ADD 68
#define KEY_NUMPAD_DIV 69
#define KEY_NUMPAD_SUB 70
#define KEY_NUMPAD_ENTER 71
#define KEY_NUMPAD_0 72
#define KEY_NUMPAD_1 73
#define KEY_NUMPAD_2 74
#define KEY_NUMPAD_3 75
#define KEY_NUMPAD_4 76
#define KEY_NUMPAD_5 77
#define KEY_NUMPAD_6 78
#define KEY_NUMPAD_7 79
#define KEY_NUMPAD_8 80
#define KEY_NUMPAD_9 81
#define KEY_NUMPAD_DECIMAL 82
#define KEY_INSERT 83
#define KEY_DELETE 84
#define KEY_HOME 85
#define KEY_END 86
#define KEY_PAGEUP 87
#define KEY_PAGEDOWN 88
#define KEY_LEFT 89
#define KEY_RIGHT 90
#define KEY_DOWN 91
#define KEY_UP 92
#define KEY_RAW_1 93 // de = ^ en = ~
#define KEY_RAW_2 94 // de = ß en = -
#define KEY_RAW_3 95 // de = ´ en = =
#define KEY_RAW_4 96 // de = ü en = [
#define KEY_RAW_5 97 // de = + en = ]
#define KEY_RAW_6 98 // de = ö en = ;
#define KEY_RAW_7 99 // de = ä en = '
#define KEY_RAW_8 100 // de = # en = \
#define KEY_RAW_9 101 // de = < en = <
#define KEY_RAW_10 102 // de = , en = ,
#define KEY_RAW_11 103 // de = . en = .
#define KEY_RAW_12 104 // de = - en = /
#define keyboardlayout_english 0
#define keyboardlayout_german 1
extern importdecl bool keyboard[256];
extern importdecl int keyboardlayout;
extern const char* doReadKey();
extern bool KeyPressed();
extern void SetNumLock(bool state);
extern void SetCapsLock(bool state);
extern void SetScrollLock(bool state);
extern importdecl unsigned int gfxMouseClickDelay;
extern importdecl int mouseX;
extern importdecl int mouseY;
extern importdecl bool mouseL;
extern importdecl bool mouseM;
extern importdecl bool mouseR;
extern importdecl int mouseWheel;
extern importdecl int mouse2X;
extern importdecl int mouse2X;
extern void SetMouseCursor(bool show);
extern void SetMousePos(unsigned int x, unsigned int y);
extern void DelayMouse();
extern bool mouseClickable();
extern bool mouseLclick();
extern bool mouseRclick();
extern bool mouseLDoubleClick();
extern void AllocImage(gfxImage &pic, unsigned int width, unsigned int height);
extern void FreeImage(gfxImage &pic);
extern void FastMove(void* src, void* dist, unsigned int size);
extern void FastFill(void *src, unsigned int size, unsigned int what);
extern unsigned int getPixel(const gfxImage ref where, unsigned int x, unsigned int y);
extern unsigned int getPixelClip(const gfxImage ref where, int x, int y);
extern gfxColor getPixelColor(const gfxImage ref where, unsigned int x, unsigned int y);
extern gfxColor getPixelColorClip(const gfxImage ref where, int x, int y);
extern void getPixelRGBA(const gfxImage ref where, unsigned int x, unsigned int y, char &r, char &g, char &b, char &a);
extern void getPixelRGBAClip(const gfxImage ref where, int x, int y, char &r, char &g, char &b, char &a);
extern void putPixel(const gfxImage ref where, unsigned int x, unsigned int y, unsigned int color);
extern void putPixelClip(const gfxImage where, int x, int y, unsigned int color);
extern void putPixelColor(const gfxImage where, unsigned int x, unsigned int y, const gfxColor ref color);
extern void putPixelColorClip(const gfxImage ref where, int x, int y, const gfxColor ref color);
extern void putPixelRGBA(const gfxImage ref where, unsigned int x, unsigned int y, char r, char g, char b, char a);
extern void putPixelRGBAClip(const gfxImage ref where, int x, int y, char r, char g, char b, char a);
extern unsigned int RGBA(char r, char g, char b, char a);
extern void getRGBA(unsigned int color, char &r, char &g, char &b, char &a);
extern char getRed(unsigned int color);
extern char getGreen(unsigned int color);
extern char getBlue(unsigned int color);
extern char getAlpha(unsigned int color);
extern unsigned int Average(unsigned int color1, unsigned int color2);
extern unsigned int SaturatedAdd(unsigned int color1, unsigned int color2);
extern unsigned int SaturatedSub(unsigned int color1, unsigned int color2);
extern bool pngLoad(gfxImage &pic, const char* name);
extern bool jpegLoad(gfxImage &pic, const char* name);
extern bool bmpLoad(gfxImage &pic, const char* name);
extern bool pcxLoad(gfxImage &pic, const char* name);
extern bool imLoad(gfxImage &pic, const char* name);
extern void putImage(const gfxImage ref where, unsigned int x, int y, const gfxImage ref what);
extern void putImageClip(const gfxImage ref where, int x, int y, const gfxImage ref what);
extern void putSprite(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what, unsigned int mask);
extern void putSpriteClip(const gfxImage ref where, int x, int y, const gfxImage ref what, unsigned int mask);
extern void putSpriteAlphaValue(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what, char alphaVal);
extern void putSpriteAlphaValueClip(const gfxImage ref where, int x, int y, const gfxImage ref what, char alphaVal);
extern void putSpriteAlpha(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what);
extern void putSpriteAlphaClip(const gfxImage ref where, int x, int y, const gfxImage ref what);
extern void putSpriteAverage(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what);
extern void putSpriteAverageClip(const gfxImage ref where, int x, int y, const gfxImage ref what);
extern void putSpriteSaturatedAdd(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what);
extern void putSpriteSaturatedAddClip(const gfxImage ref where, int x, int y, const gfxImage ref what);
extern void putSpriteSaturatedSub(const gfxImage ref where, unsigned int x, unsigned int y, const gfxImage ref what);
extern void putSpriteSaturatedSubClip(const gfxImage ref where, int x, int y, const gfxImage ref what);
extern void getImage(const gfxImage ref sprite, unsigned int x, unsigned int y, const gfxImage ref where);
extern void ScaleImage(const gfxImage ref where, int x1, int y1, int x2, int y2, const gfxImage ref sprite);
extern void ScaleSprite(const gfxImage ref where, int x1, int y1, int x2, int y2, unsigned int mask, const gfxImage ref sprite);
extern void ScaleSpriteAlphaValue(const gfxImage ref where, int x1, int y1, int x2, int y2, char alphaVal, const gfxImage ref sprite);
extern void ScaleSpriteAlpha(const gfxImage ref where, int x1, int y1, int x2, int y2, const gfxImage ref sprite);
extern void ScaleSpriteAverage(const gfxImage ref where, int x1, int y1, int x2, int y2, const gfxImage ref sprite);
extern void ScaleSpriteSaturatedAdd( gfxImage ref where, int x1, int y1, int x2, int y2, const gfxImage ref sprite);
extern void ScaleSpriteSaturatedSub( gfxImage ref where, int x1, int y1, int x2, int y2, const gfxImage ref sprite);
extern void RotateImage(const gfxImage ref where, int x, int y, int angle, const gfxImage ref what);
extern void RotateSprite(const gfxImage ref where, int x, int y, int angle, unsigned int mask, const gfxImage ref what);
extern void RotateSpriteAlpha(const gfxImage ref where, int x, int y, int angle, const gfxImage ref what);
extern void RotateSpriteAlphaValue(const gfxImage ref where, int x, int y, int angle, char alphaVal, const gfxImage ref what);
extern void RotateSpriteAverage(const gfxImage ref where, int x, int y, int angle, const gfxImage ref what);
extern void RotateSpriteSaturatedAdd(const gfxImage ref where, int x, int y, int angle, const gfxImage ref what);
extern void RotateSpriteSaturatedSub(const gfxImage ref where, int x, int y, int angle, const gfxImage ref what);
extern void DrawLine(const gfxImage ref where, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color);
extern void DrawLineClip(const gfxImage ref where, int x1, int y1, int x2, int y2, unsigned int color);
extern void DrawCircle(const gfxImage ref where, unsigned int x, unsigned int y, unsigned int r, unsigned int color);
extern void DrawCircleClip(const gfxImage ref where, int x, int y, int r, unsigned int color);
extern void DrawFilledCircle(const gfxImage ref where, unsigned int x, unsigned int y, unsigned int r, unsigned int color);
extern void DrawFilledCircleClip(const gfxImage ref where, int x, int y, int r, unsigned int color);
extern void DrawFilledTriangle(const gfxImage ref where, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int x3, unsigned int y3, unsigned int color);
extern void DrawFilledTriangleClip(const gfxImage ref where, int x1, int y1, int x2, int y2, int x3, int y3, unsigned int color);
extern void DrawHLine(const gfxImage ref where, unsigned int x1, unsigned int x2, unsigned int y, unsigned int color);
extern void DrawHLineClip(const gfxImage ref where, int x1, int x2, int y, unsigned int color);
extern void DrawVLine(const gfxImage ref where, unsigned int y1, unsigned int y2, unsigned int x, unsigned int color);
extern void DrawVLineClip(const gfxImage ref where, int y1, int y2, int x, unsigned int color);
extern void DrawRectangle(const gfxImage ref where, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color);
extern void DrawRectangleClip(const gfxImage ref where, int x1, int y1, int x2, int y2, unsigned int color);
extern void DrawBar(const gfxImage ref where, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color);
extern void DrawBarClip(const gfxImage ref where, int x1, int y1, int x2, int y2, unsigned int color);
extern void RGB2HSV(char r, char g, char b, char &h, char &s, char &v);
extern void HSV2RGB(char h, char s, char v, char &r, char &g, char &b);
extern void RGB2CYM(char r, char g, char b, char &c, char &y, char &m);
extern void CYM2RGB(char c, char y, char m, char &r, char &g, char &b);
extern void RGB2CYMK(char r, char g, char b, char &c, char &y, char &m, char &k);
extern void CYMK2RGB(char c, char y, char m, char k, char &r, char &g, char &b);
extern unsigned int AlphaValue(unsigned int Color1, unsigned int Color2, char AlphaVal);
extern unsigned int Alpha(unsigned int Color1, unsigned int Color2);
extern void FadeOutImage(const gfxImage ref where, char fade);
extern void AlphaImage(const gfxImage ref where, const gfxImage ref pic1, const gfxImage ref pic2, char alphaVal);
extern void CreateAlphaFromImage(const gfxImage ref where, const gfxImage ref alphapic);
extern void RotoZoomImage(const gfxImage ref where, const gfxImage ref pic, float rotangle, float zoom);
extern void RotoZoomImageNoRepeat(const gfxImage ref where, const gfxImage ref pic, float rotangle, float zoom);
//extern unsigned int CosineInterpolate(var o : array of dword; x, y : single) : dword;
extern void SubPlasmaImage(const gfxImage ref where, int dist, int seed, int amplitude, bool rgb);
extern void ParticleImage(const gfxImage ref where, float f);
extern void SinePlasmaImage(const gfxImage ref where, float dx, float dy, float amplitude);
extern void InvertImageColors(const gfxImage ref where);
extern void AverageImage(const gfxImage ref where, const gfxImage ref pic1, const gfxImage ref pic2);
extern void SaturatedImageAdd(const gfxImage ref where, const gfxImage ref pic1, const gfxImage ref pic2);
extern void SaturatedImageSub(const gfxImage ref where, const gfxImage ref pic1, const gfxImage ref pic2);
extern void BlurImage(const gfxImage &where);
#ifdef __cplusplus
}
#endif