summaryrefslogtreecommitdiffstats
path: root/progs/openvg/demos/sp.c
blob: d04f252e2ec3d2084a749e5be32aeb106a5d401c (plain)
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
#include "eglcommon.h"

#include <VG/openvg.h>
#include <VG/vgu.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

#include <X11/keysym.h>

struct object {
   VGPath path;
   VGPaint fill;
   VGPaint stroke;
   VGint draw_mode;
};

struct character {
   struct object objects[32];
   VGint num_objects;
};

struct character cartman;

static void init_character()
{
   struct object object;
   VGint num_objects = 0;

   {
      const VGint num_segments = 6;
      const VGubyte segments[] = {VG_MOVE_TO_ABS,
                                  VG_CUBIC_TO_ABS,
                                  VG_CUBIC_TO_ABS,
                                  VG_CUBIC_TO_ABS,
                                  VG_CUBIC_TO_ABS,
                                  VG_CLOSE_PATH};
      const VGfloat coords[] = {181.83267, 102.60408,
                                181.83267,102.60408 185.53793,114.5749 186.5355,115.00243,
                                187.53306,115.42996 286.0073,115.00243 286.0073,115.00243,
                                286.0073,115.00243 292.70526,103.45914 290.85263,101.03648,
                                289.00001,98.61381 181.54765,102.31906 181.83267,102.60408
      };
      VGuint color = 0x7c4e32ff;
      object.path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
                          1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
      vgAppendPathData(object.path, num_segments, segments, coords);

      object.fill = vgCreatePaint();
      vgSetColor(object.fill, color);
      character.objects[objects.num_objects] = object;
      ++objects.num_objects;
   }
   {
      
   }
}


static void
init(void)
{
}

/* new window size or exposure */
static void
reshape(int w, int h)
{
}

int  key_press(unsigned key)
{
    switch(key) {
    case XK_Right:

        break;
    case XK_Left:
        break;
    case XK_Up:
        break;
    case XK_Down:
        break;
    case 'a':
        break;
    case 's':
        break;
    default:
        break;
    }
    return VG_FALSE;
}

static void
draw(void)
{
}


int main(int argc, char **argv)
{
    set_window_size(400, 400);
    return run(argc, argv, init, reshape, draw, key_press);
}