Zack Rusin | 544dd4b | 2009-05-01 12:41:38 -0400 | [diff] [blame^] | 1 | #include "eglcommon.h" |
| 2 | |
| 3 | #include <VG/openvg.h> |
| 4 | #include <VG/vgu.h> |
| 5 | #include <stdio.h> |
| 6 | #include <math.h> |
| 7 | #include <stdlib.h> |
| 8 | |
| 9 | #include <X11/keysym.h> |
| 10 | |
| 11 | struct object { |
| 12 | VGPath path; |
| 13 | VGPaint fill; |
| 14 | VGPaint stroke; |
| 15 | VGint draw_mode; |
| 16 | }; |
| 17 | |
| 18 | struct character { |
| 19 | struct object objects[32]; |
| 20 | VGint num_objects; |
| 21 | }; |
| 22 | |
| 23 | struct character cartman; |
| 24 | |
| 25 | static void init_character() |
| 26 | { |
| 27 | struct object object; |
| 28 | VGint num_objects = 0; |
| 29 | |
| 30 | { |
| 31 | const VGint num_segments = 6; |
| 32 | const VGubyte segments[] = {VG_MOVE_TO_ABS, |
| 33 | VG_CUBIC_TO_ABS, |
| 34 | VG_CUBIC_TO_ABS, |
| 35 | VG_CUBIC_TO_ABS, |
| 36 | VG_CUBIC_TO_ABS, |
| 37 | VG_CLOSE_PATH}; |
| 38 | const VGfloat coords[] = {181.83267, 102.60408, |
| 39 | 181.83267,102.60408 185.53793,114.5749 186.5355,115.00243, |
| 40 | 187.53306,115.42996 286.0073,115.00243 286.0073,115.00243, |
| 41 | 286.0073,115.00243 292.70526,103.45914 290.85263,101.03648, |
| 42 | 289.00001,98.61381 181.54765,102.31906 181.83267,102.60408 |
| 43 | }; |
| 44 | VGuint color = 0x7c4e32ff; |
| 45 | object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, |
| 46 | 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); |
| 47 | vgAppendPathData(object.path, num_segments, segments, coords); |
| 48 | |
| 49 | object.fill = vgCreatePaint(); |
| 50 | vgSetColor(object.fill, color); |
| 51 | character.objects[objects.num_objects] = object; |
| 52 | ++objects.num_objects; |
| 53 | } |
| 54 | { |
| 55 | |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | |
| 60 | static void |
| 61 | init(void) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | /* new window size or exposure */ |
| 66 | static void |
| 67 | reshape(int w, int h) |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | int key_press(unsigned key) |
| 72 | { |
| 73 | switch(key) { |
| 74 | case XK_Right: |
| 75 | |
| 76 | break; |
| 77 | case XK_Left: |
| 78 | break; |
| 79 | case XK_Up: |
| 80 | break; |
| 81 | case XK_Down: |
| 82 | break; |
| 83 | case 'a': |
| 84 | break; |
| 85 | case 's': |
| 86 | break; |
| 87 | default: |
| 88 | break; |
| 89 | } |
| 90 | return VG_FALSE; |
| 91 | } |
| 92 | |
| 93 | static void |
| 94 | draw(void) |
| 95 | { |
| 96 | } |
| 97 | |
| 98 | |
| 99 | int main(int argc, char **argv) |
| 100 | { |
| 101 | set_window_size(400, 400); |
| 102 | return run(argc, argv, init, reshape, draw, key_press); |
| 103 | } |