]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/timmy/dat.h
add games/mus midi converter (by qu7uux)
[plan9front.git] / sys / src / games / timmy / dat.h
1 typedef struct Hinge Hinge;
2 typedef struct ObjT ObjT;
3 typedef struct Obj Obj;
4 typedef struct Poly Poly;
5 typedef struct Vec Vec;
6
7 struct Vec {
8         double x, y;
9 };
10
11 struct Poly {
12         int nvert;
13         Vec *vert;
14         double invI;
15 };
16
17 struct Hinge {
18         Vec p;
19         Vec p0;
20         Obj *o;
21         Hinge *onext;
22         Hinge *cnext, *cprev;
23         Hinge *anext;
24 };
25
26 struct ObjT {
27         int flags;
28         Poly *poly;
29         Hinge *hinge;
30         Image *line, *fill;
31         double imass;
32         void (*draw)(Obj *, Image *);
33         void (*move)(Obj *, double, double, double);
34         void (*init)(Obj *);
35 };
36
37 struct Obj {
38         ObjT *tab;
39         Vec p, v;
40         double θ, ω;
41         Rectangle bbox;
42         Poly *poly;
43         Hinge *hinge;
44         Obj *next, *prev;
45         int idx;
46 };
47
48 enum {
49         TrayH = 100,
50         TraySpc = 20,
51 };
52
53 #define DEG 0.01745329251994330
54 #define Slop 0.5
55
56 #define HingeSep 4.0