| |
1 #ifndef __CC_INTERFACE_H__ |
| |
2 #define __CC_INTERFACE_H__ |
| |
3 |
| |
4 #include <gtk/gtk.h> |
| |
5 #include "crazychat.h" |
| |
6 |
| |
7 /* XXX feature encapsulation: still in flux, not stable XXX */ |
| |
8 |
| |
9 //charlie |
| |
10 typedef enum {REMOTE, LOCAL} OUTPUT; |
| |
11 |
| |
12 gboolean configure(GtkWidget *widget, |
| |
13 GdkEventConfigure *event, void *data); |
| |
14 |
| |
15 #ifdef DISABLE_MODELS |
| |
16 #define draw(a, b, c) 1 |
| |
17 #define setupDrawlists(a) |
| |
18 #else |
| |
19 gboolean draw(GtkWidget *widget, GdkEventExpose *event, |
| |
20 void *data); |
| |
21 |
| |
22 void setupDrawlists(OUTPUT output); |
| |
23 #endif |
| |
24 |
| |
25 void init (GtkWidget *widget, void *data); |
| |
26 |
| |
27 void setupLighting(GtkWidget *widget); |
| |
28 |
| |
29 struct cc_features { |
| |
30 guint8 head_size; |
| |
31 guint8 left_eye_open, right_eye_open; /*booleans*/ |
| |
32 guint8 mouth_open; /*percentage*/ |
| |
33 guint8 head_x_rot, head_y_rot, head_z_rot; /* head rotation */ |
| |
34 guint8 x, y; /*center of head*/ |
| |
35 guint8 head_color, appendage_color, lid_color, right_iris_color, left_iris_color; //colors |
| |
36 guint8 mode, kind; |
| |
37 }; |
| |
38 |
| |
39 struct output_instance { |
| |
40 struct cc_features *features; |
| |
41 struct cc_session *session; |
| |
42 float past_y; |
| |
43 OUTPUT my_output; |
| |
44 GtkWidget *widget; |
| |
45 GtkWidget *box; |
| |
46 }; |
| |
47 |
| |
48 struct input_instance { |
| |
49 int timer_id; |
| |
50 struct cc_features face; |
| |
51 GtkWidget *widget; |
| |
52 GtkWidget *box; |
| |
53 GtkWidget *button; |
| |
54 GtkWidget *label; |
| |
55 GtkWidget *model; |
| |
56 GtkWidget *head, *appendage, *lid, *right_iris, *left_iris; |
| |
57 struct output_instance output; |
| |
58 }; |
| |
59 |
| |
60 struct output_handlers { |
| |
61 int (*configure)(GtkWidget *widget, GdkEventConfigure *event, |
| |
62 void *data); |
| |
63 void (*init) (GtkWidget *widget, void *data); |
| |
64 gboolean (*draw) (GtkWidget *widget, GdkEventExpose *event, void *data); |
| |
65 }; |
| |
66 |
| |
67 struct cc_session { |
| |
68 struct crazychat *cc; /**< crazychat global data */ |
| |
69 char *name; /**< session peer */ |
| |
70 guint32 peer_ip; /**< peer's ip addr, nbo */ |
| |
71 guint16 peer_port; /**< peer's port hbo */ |
| |
72 struct sockaddr_in peer; /**< peer udp sock addr */ |
| |
73 CC_STATE state; /**< connection state */ |
| |
74 int timer_id; /**< glib timer callback id */ |
| |
75 int tcp_sock; /**< tcp socket connection */ |
| |
76 int udp_sock; /**< udp socket connection */ |
| |
77 struct cc_features features; /**< network peer features */ |
| |
78 struct output_instance *output; /**< output instance data */ |
| |
79 filter_bank *filter; /**< filter instance */ |
| |
80 }; |
| |
81 |
| |
82 struct crazychat { |
| |
83 guint16 tcp_port; /**< tcp port to bind on */ |
| |
84 guint16 udp_port; /**< udp session data port */ |
| |
85 struct cc_session_node *sessions; /**< list of sessions */ |
| |
86 struct input_instance *input_data; /**< input instance data */ |
| |
87 gboolean features_state; /**< features state on/off */ |
| |
88 }; |
| |
89 |
| |
90 /* --- input feature interface --- */ |
| |
91 |
| |
92 #ifdef _DISABLE_QT_ |
| |
93 #define init_input(a) NULL |
| |
94 #define destroy_input(a) |
| |
95 #else |
| |
96 |
| |
97 /** |
| |
98 * Initializes the input subsystem. |
| |
99 * @param cc global crazychat data structure |
| |
100 * @return pointer to an input instance |
| |
101 */ |
| |
102 struct input_instance *init_input(struct crazychat *cc); |
| |
103 |
| |
104 /** |
| |
105 * Destroys the input subsystem. |
| |
106 * @param instance input instance |
| |
107 */ |
| |
108 void destroy_input(struct input_instance *instance); |
| |
109 |
| |
110 #endif /* _DISABLE_QT_ */ |
| |
111 |
| |
112 /* --- output feature interface --- */ |
| |
113 |
| |
114 /** |
| |
115 * Initializes an output instance. |
| |
116 * @param features pointer to features |
| |
117 * @param session pointer to the crazychat session |
| |
118 * @return pointer to the output instance |
| |
119 */ |
| |
120 struct output_instance *init_output(struct cc_features *features, |
| |
121 struct cc_session *session); |
| |
122 |
| |
123 /** |
| |
124 * Destroys an output instance. |
| |
125 * @param instance output instance |
| |
126 */ |
| |
127 void destroy_output(struct output_instance *instance); |
| |
128 |
| |
129 #endif |