Niotso
git revision 558726a9f13d7c3423a683dd2f4323589b66c310
The New Implementation of The Sims Online
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Libraries
libgldemo
libgldemo.h
Go to the documentation of this file.
1
/*
2
libgldemo - General-purpose OpenGL demo backend
3
libgldemo.h - Copyright (c) 2012 Niotso Project <http://niotso.org/>
4
Author(s): Fatbag <X-Fi6@phppoll.org>
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
19
#ifdef _MSC_VER
20
#include <windows.h>
21
#endif
22
#include <stdint.h>
23
#include <GL/gl.h>
24
#include <GL/glu.h>
25
#include <GL/glext.h>
26
27
typedef
struct
{
28
const
char
*__restrict
Title
;
29
uint16_t
Width
,
Height
;
30
31
int (*
Startup
)(void);
32
int (*
Shutdown
)(void);
33
int (*
InitGL
)(void);
34
int (*
ResizeScene
)(uint16_t width, uint16_t height);
35
int (*
DrawScene
)(
float
TimeDelta, uint8_t
keys
[256]);
36
}
DemoConfig
;
37
38
#ifdef __cplusplus
39
extern
"C"
{
40
#endif
41
extern
const
DemoConfig
Demo
;
42
#ifdef __cplusplus
43
}
44
#endif
45
46
#ifdef _WIN32
47
#include <windows.h>
48
49
#define DemoMessageBox(x) MessageBox(NULL, x, NULL, MB_OK)
50
#define DemoErrorBox(x) MessageBox(NULL, x, NULL, MB_OK | MB_ICONERROR)
51
52
#define KEY_LEFT VK_LEFT
53
#define KEY_UP VK_UP
54
#define KEY_RIGHT VK_RIGHT
55
#define KEY_DOWN VK_DOWN
56
#else
57
#define POSIX_C_SOURCE 199309L
58
#include <stdio.h>
59
#include <time.h>
60
#include <GL/glx.h>
61
#include <X11/extensions/xf86vmode.h>
62
#include <X11/XKBlib.h>
63
#include <X11/keysym.h>
64
65
#define DemoMessageBox(x) fprintf(stdout, "%s\n", x)
66
#define DemoErrorBox(x) fprintf(stderr, "%s\n", x)
67
68
#define KEY_LEFT 0x25
69
#define KEY_UP 0x26
70
#define KEY_RIGHT 0x27
71
#define KEY_DOWN 0x28
72
#endif
Generated on Sat Jun 15 2013 03:02:15 for Niotso by
1.8.4