libkovan  1
The kovan standard library
graphics.h
Go to the documentation of this file.
1 #ifndef _GRAPHICS_H_
2 #define _GRAPHICS_H_
3 
12 #include "export.h"
13 #include "vtable.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
26 VF EXPORT_SYM int graphics_open(int width, int height);
27 
33 
40 
46 
47 typedef enum Encoding {
48  RGB,
50 } Encoding;
51 
52 
57 VF EXPORT_SYM void graphics_blit(const unsigned char *data, int x, int y, int width, int height);
58 
63 VF EXPORT_SYM void graphics_blit_region(const unsigned char *data, int sx, int sy, int ex, int ey, int width, int height, int dx, int dy);
64 
76 VF EXPORT_SYM void graphics_blit_enc(const unsigned char *data, Encoding enc, int x, int y, int width, int height);
77 
93 VF EXPORT_SYM void graphics_blit_region_enc(const unsigned char *data, Encoding enc, int sx, int sy, int ex, int ey, int width, int height, int dx, int dy);
94 
102 VF EXPORT_SYM void graphics_fill(int r, int g, int b);
103 
111 VF EXPORT_SYM void graphics_pixel(int x, int y, int r, int g, int b);
112 
120 VF EXPORT_SYM void graphics_line(int x1, int y1, int x2, int y2, int r, int g, int b);
121 
129 VF EXPORT_SYM void graphics_circle(int cx, int cy, int radius, int r, int g, int b);
130 
138 VF EXPORT_SYM void graphics_circle_fill(int cx, int cy, int radius, int r, int g, int b);
139 
151 VF EXPORT_SYM void graphics_rectangle(int x1, int y1, int x2, int y2, int r, int g, int b);
152 
164 VF EXPORT_SYM void graphics_rectangle_fill(int x1, int y1, int x2, int y2, int r, int g, int b);
165 
173 VF EXPORT_SYM void graphics_triangle(int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b);
174 
182 VF EXPORT_SYM void graphics_triangle_fill(int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b);
183 
185 {
186  KeyEnter = '\n',
187  KeyBackSpace = '\b',
188  KeyTab = '\t',
189  KeyCancel = 0x03,
190  KeyClear = 0x0C,
191  KeyShift = 0x10,
192  KeyControl = 0x11,
193  KeyAlt = 0x12,
194  KeyPause = 0x13,
195  KeyCapsLock = 0x14,
196  KeyEscape = 0x1B,
197  KeySpace = 0x20,
198  KeyPageUp = 0x21,
199  KeyPageDown = 0x22,
200  KeyEnd = 0x23,
201  KeyHome = 0x24,
202  KeyLeft = 0x25,
203  KeyUp = 0x26,
204  KeyRight = 0x27,
205  KeyDown = 0x28,
206  KeyComma = 0x2C,
207  KeyPeriod = 0x2E,
208  KeySlash = 0x2F,
209  KeyZero = 0x30,
210  KeyOne = 0x31,
211  KeyTwo = 0x32,
212  KeyThree = 0x33,
213  KeyFour = 0x34,
214  KeyFive = 0x35,
215  KeySix = 0x36,
216  KeySeven = 0x37,
217  KeyEight = 0x38,
218  KeyNine = 0x39,
219  KeySemiColon = 0x3B,
220  KeyEquals = 0x3D,
221  KeyA = 0x41,
222  KeyB = 0x42,
223  KeyC = 0x43,
224  KeyD = 0x44,
225  KeyE = 0x45,
226  KeyF = 0x46,
227  KeyG = 0x47,
228  KeyH = 0x48,
229  KeyI = 0x49,
230  KeyJ = 0x4A,
231  KeyK = 0x4B,
232  KeyL = 0x4C,
233  KeyM = 0x4D,
234  KeyN = 0x4E,
235  KeyO = 0x4F,
236  KeyP = 0x50,
237  KeyQ = 0x51,
238  KeyR = 0x52,
239  KeyS = 0x53,
240  KeyT = 0x54,
241  KeyU = 0x55,
242  KeyV = 0x56,
243  KeyW = 0x57,
244  KeyX = 0x58,
245  KeyY = 0x59,
246  KeyZ = 0x5A,
247  KeyOpenBracket = 0x5B,
248  KeyBackSlash = 0x5C,
250  KeyNumPad0 = 0x60,
251  KeyNumPad1 = 0x61,
252  KeyNumPad2 = 0x62,
253  KeyNumPad3 = 0x63,
254  KeyNumPad4 = 0x64,
255  KeyNumPad5 = 0x65,
256  KeyNumPad6 = 0x66,
257  KeyNumPad7 = 0x67,
258  KeyNumPad8 = 0x68,
259  KeyNumPad9 = 0x69,
260  KeyMultiply = 0x6A,
261  KeyAdd = 0x6B,
262  KeySeparator = 0x6C,
263  KeySubtract = 0x6D,
264  KeyDecimal = 0x6E,
265  KeyDivide = 0x6F,
266  KeyF1 = 0x70,
267  KeyF2 = 0x71,
268  KeyF3 = 0x72,
269  KeyF4 = 0x73,
270  KeyF5 = 0x74,
271  KeyF6 = 0x75,
272  KeyF7 = 0x76,
273  KeyF8 = 0x77,
274  KeyF9 = 0x78,
275  KeyF10 = 0x79,
276  KeyF11 = 0x7A,
277  KeyF12 = 0x7B,
278  KeyDelete = 0x7F,
279  KeyNumLock = 0x90,
280  KeyScrollLock = 0x91,
281  KeyPrintScreen = 0x9A,
282  KeyInsert = 0x9B,
283  KeyHelp = 0x9C,
284  KeyMeta = 0x9D,
285  KeyBackQuote = 0xC0,
286  KeyQuote = 0xDE,
287  KeyFinal = 0x18,
288  KeyConvert = 0x1C,
289  KeyNonConvert = 0x1D,
290  KeyAccept = 0x1E,
291  KeyModeChange = 0x1F,
292  KeyKana = 0x15,
293  KeyKanji = 0x19,
295 };
296 
305 VF EXPORT_SYM int get_key_state(enum KeyCode key);
306 
311 VF EXPORT_SYM void get_mouse_position(int *x, int *y);
312 
319 
326 
333 
334 VFL
335 
336 #ifdef __cplusplus
337 }
338 #endif
339 
340 #endif
convert key
Definition: graphics.h:288
multiply key '*'
Definition: graphics.h:260
quote key
Definition: graphics.h:286
back slash key '\'
Definition: graphics.h:248
F6 key.
Definition: graphics.h:271
equals key '='
Definition: graphics.h:220
backspace key
Definition: graphics.h:187
VF EXPORT_SYM void graphics_blit_region(const unsigned char *data, int sx, int sy, int ex, int ey, int width, int height, int dx, int dy)
F1 key.
Definition: graphics.h:266
VF EXPORT_SYM void get_mouse_position(int *x, int *y)
tab key
Definition: graphics.h:188
F8 key.
Definition: graphics.h:273
Definition: graphics.h:48
VF EXPORT_SYM void graphics_line(int x1, int y1, int x2, int y2, int r, int g, int b)
scroll lock key
Definition: graphics.h:280
q key
Definition: graphics.h:237
VF EXPORT_SYM void graphics_pixel(int x, int y, int r, int g, int b)
close bracket key ']'
Definition: graphics.h:249
VF EXPORT_SYM int get_mouse_middle_button()
numpad 2 key
Definition: graphics.h:252
cancel key
Definition: graphics.h:189
decimal key '.'
Definition: graphics.h:264
p key
Definition: graphics.h:236
zero key
Definition: graphics.h:209
add key '+'
Definition: graphics.h:261
insert key
Definition: graphics.h:282
s key
Definition: graphics.h:239
VF EXPORT_SYM void graphics_clear()
VF EXPORT_SYM void graphics_circle(int cx, int cy, int radius, int r, int g, int b)
f key
Definition: graphics.h:226
VF EXPORT_SYM void graphics_rectangle_fill(int x1, int y1, int x2, int y2, int r, int g, int b)
shift key
Definition: graphics.h:191
VF EXPORT_SYM void graphics_fill(int r, int g, int b)
VF EXPORT_SYM int get_key_state(enum KeyCode key)
control key
Definition: graphics.h:192
b key
Definition: graphics.h:222
F9 key.
Definition: graphics.h:274
two key
Definition: graphics.h:211
F7 key.
Definition: graphics.h:272
VF EXPORT_SYM void graphics_blit(const unsigned char *data, int x, int y, int width, int height)
right arrow key
Definition: graphics.h:204
numpad 0 key
Definition: graphics.h:250
k key
Definition: graphics.h:231
backquote key
Definition: graphics.h:285
up arrow key
Definition: graphics.h:203
g key
Definition: graphics.h:227
Encoding
Definition: graphics.h:47
five key
Definition: graphics.h:214
VF EXPORT_SYM void graphics_circle_fill(int cx, int cy, int radius, int r, int g, int b)
F5 key.
Definition: graphics.h:270
F2 key.
Definition: graphics.h:267
j key
Definition: graphics.h:230
KeyCode
Definition: graphics.h:184
z key
Definition: graphics.h:246
home key
Definition: graphics.h:201
Definition: graphics.h:49
mode change key
Definition: graphics.h:291
clear key
Definition: graphics.h:190
period key '.'
Definition: graphics.h:207
four key
Definition: graphics.h:213
d key
Definition: graphics.h:224
space key
Definition: graphics.h:197
numpad 5 key
Definition: graphics.h:255
VF EXPORT_SYM void graphics_close()
VF EXPORT_SYM void graphics_blit_region_enc(const unsigned char *data, Encoding enc, int sx, int sy, int ex, int ey, int width, int height, int dx, int dy)
l key
Definition: graphics.h:232
e key
Definition: graphics.h:225
slash key '/'
Definition: graphics.h:208
F12 key.
Definition: graphics.h:277
six key
Definition: graphics.h:215
semicolon key ';'
Definition: graphics.h:219
enter key
Definition: graphics.h:186
VF EXPORT_SYM void graphics_triangle(int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b)
nine key
Definition: graphics.h:218
F10 key.
Definition: graphics.h:275
c key
Definition: graphics.h:223
undefined key
Definition: graphics.h:294
divide key '/'
Definition: graphics.h:265
numpad 7 key
Definition: graphics.h:257
VF EXPORT_SYM void graphics_update()
VF EXPORT_SYM int get_mouse_right_button()
capslock key
Definition: graphics.h:195
seven key
Definition: graphics.h:216
one key
Definition: graphics.h:210
x key
Definition: graphics.h:244
kanji key
Definition: graphics.h:293
numpad 6 key
Definition: graphics.h:256
numpad 1 key
Definition: graphics.h:251
numlock key
Definition: graphics.h:279
numpad 4 key
Definition: graphics.h:254
left key
Definition: graphics.h:202
VF EXPORT_SYM void graphics_rectangle(int x1, int y1, int x2, int y2, int r, int g, int b)
#define VF
Definition: vtable.h:10
final key
Definition: graphics.h:287
w key
Definition: graphics.h:243
#define VFL
Definition: vtable.h:11
VF EXPORT_SYM void graphics_triangle_fill(int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b)
F4 key.
Definition: graphics.h:269
down arrow key
Definition: graphics.h:205
i key
Definition: graphics.h:229
#define EXPORT_SYM
Definition: export.h:7
u key
Definition: graphics.h:241
page down key
Definition: graphics.h:199
non convert key
Definition: graphics.h:289
v key
Definition: graphics.h:242
end key
Definition: graphics.h:200
escape key
Definition: graphics.h:196
kana key
Definition: graphics.h:292
page up key
Definition: graphics.h:198
subtract key '-'
Definition: graphics.h:263
three key
Definition: graphics.h:212
F3 key.
Definition: graphics.h:268
VF EXPORT_SYM int get_mouse_left_button()
pause key
Definition: graphics.h:194
separator key '-'
Definition: graphics.h:262
alt key
Definition: graphics.h:193
print screen key
Definition: graphics.h:281
meta key
Definition: graphics.h:284
accept key
Definition: graphics.h:290
o key
Definition: graphics.h:235
m key
Definition: graphics.h:233
t key
Definition: graphics.h:240
n key
Definition: graphics.h:234
VF EXPORT_SYM void graphics_blit_enc(const unsigned char *data, Encoding enc, int x, int y, int width, int height)
delete key
Definition: graphics.h:278
help key
Definition: graphics.h:283
y key
Definition: graphics.h:245
eight key
Definition: graphics.h:217
numpad 9 key
Definition: graphics.h:259
h key
Definition: graphics.h:228
open bracket key '['
Definition: graphics.h:247
numpad 8 key
Definition: graphics.h:258
VF EXPORT_SYM int graphics_open(int width, int height)
numpad 3 key
Definition: graphics.h:253
comma key ','
Definition: graphics.h:206
a key
Definition: graphics.h:221
F11 key.
Definition: graphics.h:276
r key
Definition: graphics.h:238