mesh loading
[vrtris] / src / gamescr.c
1 #include "screen.h"
2 #include "cmesh.h"
3
4 static int init(void);
5 static void cleanup(void);
6 static void start(void);
7 static void stop(void);
8 static void update(float dt);
9 static void draw(void);
10 static void reshape(int x, int y);
11 static void keyboard(int key, int pressed);
12 static void mouse(int bn, int pressed, int x, int y);
13 static void motion(int x, int y);
14 static void wheel(int dir);
15
16 struct game_screen game_screen = {
17         "game",
18         1,      /* opaque */
19         0,      /* next */
20         init,
21         cleanup,
22         start,
23         stop,
24         update,
25         draw,
26         reshape,
27         keyboard,
28         mouse,
29         motion,
30         wheel
31 };
32
33 static struct cmesh *blkmesh;
34
35 static int init(void)
36 {
37         if(!(blkmesh = cmesh_alloc())) {
38                 return -1;
39         }
40         if(cmesh_load(blkmesh, "data/noisecube.obj") == -1) {
41                 fprintf(stderr, "failed to load block model\n");
42                 return -1;
43         }
44         return 0;
45 }
46
47 static void cleanup(void)
48 {
49         cmesh_free(blkmesh);
50 }
51
52 static void start(void)
53 {
54 }
55
56 static void stop(void)
57 {
58 }
59
60 static void update(float dt)
61 {
62 }
63
64 static void draw(void)
65 {
66 }
67
68 static void reshape(int x, int y)
69 {
70 }
71
72 static void keyboard(int key, int pressed)
73 {
74 }
75
76 static void mouse(int bn, int pressed, int x, int y)
77 {
78 }
79
80 static void motion(int x, int y)
81 {
82 }
83
84 static void wheel(int dir)
85 {
86 }