initial commit
[retrobench] / src / rbench.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "rbench.h"
4 #include "treestor.h"
5
6 #define DEF_WIDTH       640
7 #define DEF_HEIGHT      480
8 #define DEF_BPP         24
9
10 struct options opt = {
11         DEF_WIDTH, DEF_HEIGHT, DEF_BPP
12 };
13
14 void redraw(void)
15 {
16 }
17
18 void key_event(int key, int press)
19 {
20 }
21
22 int read_config(const char *fname)
23 {
24         FILE *fp;
25         struct ts_node *ts;
26
27         if(!(fp = fopen(fname, "rb"))) {
28                 return -1;
29         }
30         fclose(fp);
31
32         if(!(ts = ts_load(fname))) {
33                 return -1;
34         }
35
36         opt.width = ts_lookup_int(ts, "rbench.width", DEF_WIDTH);
37         opt.height = ts_lookup_int(ts, "rbench.height", DEF_HEIGHT);
38         opt.bpp = ts_lookup_int(ts, "rbench.bpp", DEF_BPP);
39
40         ts_free_tree(ts);
41         return 0;
42 }