summaryrefslogtreecommitdiffstats
path: root/sdl/platform.h
blob: f9f2a48bed354e7f448ec0582dcd867f7795e15e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _PLATFORM_H_
#define _PLATFORM_H_

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <GL/glew.h>
#include "glframe.h"
#include "luatools.h"

struct client;

/* platform struct */
struct platform
{
    GLFrame camera;

    /* SDL surface, our screen */
    SDL_Surface *screen;

    SDL_TimerID timer_id;
    SDL_Cursor *my_cursor;

    /* Lua */
    lua_State *L;
    struct luat_table_platform config_table;

    /* client */
    struct client *c;
    int (*client_init)(struct client *);
    int (*client_destroy)(struct client *);
};

extern const GLfloat fNoLight[];
extern const GLfloat fLowLight[];
extern const GLfloat fShinyLight[];
extern const GLfloat fBrightLight[];
extern const GLfloat lightPos[];

/* function prototypes */
void platform_init(struct platform *);
void platform_destroy(struct platform *);
int load_config(struct platform *);
void setup_opengl(void);
SDL_Surface *setup_sdl_video(int, int, int, unsigned int);
SDL_Surface *setup_sdl(void);
void setup_glew(void);

#endif