9 /* The general state of the application */
16 /* Having received some kind of input, change state accordingly */
17 static int state_transition(struct ui_event
*e
)
28 ret
= ui_confirm_deny("Quit?");
29 state
= ST_ASKING_QUIT
;
32 state
= ST_SHOULD_QUIT
;
46 state
= ST_SHOULD_QUIT
;
60 state
= ST_SHOULD_QUIT
;
67 int main(int argc
, char **argv
)
70 uint_fast8_t more_evs
= 0;
71 struct ui_event e
= { 0 };
72 struct quiver q
= { 0 };
73 size_t v0
, vinf
, v1
, v2
, v1b
, v2b
, v12
, v21
, v23
, v32
, v30
, v03
, v10
,
78 setlocale(LC_ALL
, "");
80 if ((ret
= ui_init(&q
))) {
85 /* XXX: rem (this is C2 U_{02} C2) */
86 quiver_add_vertex(&q
, &v0
, "0", 1, 0, -170, 0);
87 quiver_add_vertex(&q
, &vinf
, "\u221e", 2, 0, 170, 0);
88 quiver_add_vertex(&q
, &v1
, "1", 2, 100, 100, 0);
89 quiver_add_vertex(&q
, &v2
, "2", 1, 170, -70, 0);
90 quiver_add_vertex(&q
, &v1b
, "1'", 2, -140, 100, 0);
91 quiver_add_vertex(&q
, &v2b
, "2'", 1, -110, -70, 0);
92 quiver_add_vertex(&q
, &v12
, "12", 2, -350, -150, 0);
93 quiver_add_vertex(&q
, &v21
, "21", 1, -150, -350, 0);
94 quiver_add_vertex(&q
, &v32
, "32", 1, 350, -150, 0);
95 quiver_add_vertex(&q
, &v23
, "23", 2, 150, -350, 0);
96 quiver_add_vertex(&q
, &v30
, "30", 2, 350, 150, 0);
97 quiver_add_vertex(&q
, &v03
, "03", 1, 150, 350, 0);
98 quiver_add_vertex(&q
, &v10
, "10", 1, -350, 150, 0);
99 quiver_add_vertex(&q
, &v01
, "01", 2, -150, 350, 0);
101 quiver_add_to_edge(&q
, v12
, v21
, 1, 2, 0);
102 quiver_add_to_edge(&q
, v23
, v32
, 1, 2, 0);
103 quiver_add_to_edge(&q
, v10
, v01
, 1, 2, 0);
104 quiver_add_to_edge(&q
, v30
, v03
, 1, 2, 0);
105 quiver_add_to_edge(&q
, v21
, v2b
, 1, 1, 0);
106 quiver_add_to_edge(&q
, v23
, v1
, 1, 1, 0);
107 quiver_add_to_edge(&q
, v12
, v1b
, 1, 1, 0);
108 quiver_add_to_edge(&q
, v2b
, v12
, 1, 1, 0);
109 quiver_add_to_edge(&q
, v2b
, v0
, 1, 1, 0);
110 quiver_add_to_edge(&q
, v2b
, v10
, 1, 1, 0);
111 quiver_add_to_edge(&q
, v0
, v32
, 1, 1, 0);
112 quiver_add_to_edge(&q
, v0
, v1b
, 1, 1, 0);
113 quiver_add_to_edge(&q
, v32
, v2
, 1, 1, 0);
114 quiver_add_to_edge(&q
, v1b
, vinf
, 1, 1, 0);
115 quiver_add_to_edge(&q
, v1
, v30
, 1, 1, 0);
116 quiver_add_to_edge(&q
, v1
, v2
, 1, 1, 0);
117 quiver_add_to_edge(&q
, v2
, v0
, 1, 1, 0);
118 quiver_add_to_edge(&q
, v2
, v23
, 1, 1, 0);
119 quiver_add_to_edge(&q
, v2
, v03
, 1, 1, 0);
120 quiver_add_to_edge(&q
, v10
, v21
, 1, 1, 0);
121 quiver_add_to_edge(&q
, vinf
, v1
, 1, 1, 0);
122 quiver_add_to_edge(&q
, vinf
, v01
, 1, 1, 0);
123 quiver_add_to_edge(&q
, v30
, vinf
, 1, 1, 0);
124 quiver_add_to_edge(&q
, v01
, v1b
, 1, 1, 0);
125 quiver_add_to_edge(&q
, v03
, v1
, 1, 1, 0);
128 if ((ret
= ui_respond_quiver_change())) {
133 if ((ret
= ui_start_frame())) {
137 while (state
!= ST_SHOULD_QUIT
) {
138 /* includes framelimiting delay */
139 if ((ret
= ui_finish_frame())) {
146 if ((ret
= ui_get_event(&e
, &more_evs
))) {
151 state_transition(&e
);
155 if ((ret
= ui_start_frame())) {