forked from prideout/fluidsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pez.h
115 lines (96 loc) · 2.58 KB
/
pez.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define PEZ_MAINLOOP 1
#define PEZ_MOUSE_HANDLER 1
#define PEZ_DROP_HANDLER 1
#define GL3_PROTOTYPES
#include "gl3.h"
#include <stdbool.h>
#define PEZ_FORWARD_COMPATIBLE_GL 1
typedef struct PezConfigRec
{
const char* Title;
int Width;
int Height;
bool Multisampling;
bool VerticalSync;
} PezConfig;
#ifdef PEZ_MAINLOOP
PezConfig PezGetConfig();
void PezInitialize();
void PezRender();
void PezUpdate(float seconds);
#ifdef PEZ_MOUSE_HANDLER
void PezHandleMouse(int x, int y, int action);
#endif
void PezHandleKey(char c);
#ifdef PEZ_DROP_HANDLER
void PezReceiveDrop(const char* filename);
#endif
#else
void pezSwapBuffers();
#endif
enum {PEZ_DOWN, PEZ_UP, PEZ_MOVE, PEZ_DOUBLECLICK};
#define TwoPi (6.28318531f)
#define Pi (3.14159265f)
#define countof(A) (sizeof(A) / sizeof(A[0]))
void pezPrintString(const char* pStr, ...);
void pezFatal(const char* pStr, ...);
void pezCheck(int condition, ...);
void pezCheckPointer(void* p, ...);
int pezIsPressing(char key);
const char* pezResourcePath();
const char* pezOpenFileDialog();
const char* pezGetDesktopFolder();
const char* pezGetShader(const char* effectKey);
typedef struct PezAttribRec {
const GLchar* Name;
GLint Size;
GLenum Type;
GLsizei Stride;
int FrameCount;
GLvoid* Frames;
} PezAttrib;
typedef struct PezVertsRec {
int AttribCount;
int IndexCount;
int VertexCount;
GLenum IndexType;
GLsizeiptr IndexBufferSize;
PezAttrib* Attribs;
GLvoid* Indices;
void* RawHeader;
} PezVerts;
typedef struct PezPixelsRec {
int FrameCount;
GLsizei Width;
GLsizei Height;
GLsizei Depth;
GLint MipLevels;
GLenum Format;
GLenum InternalFormat;
GLenum Type;
GLsizeiptr BytesPerFrame;
GLvoid* Frames;
void* RawHeader;
} PezPixels;
PezVerts pezLoadVerts(const char* filename);
PezVerts pezGenQuad(float left, float top, float right, float bottom);
void pezFreeVerts(PezVerts verts);
void pezSaveVerts(PezVerts verts, const char* filename);
PezPixels pezLoadPixels(const char* filename);
void pezFreePixels(PezPixels pixels);
void pezSavePixels(PezPixels pixels, const char* filename);
void pezRenderText(PezPixels pixels, const char* message);
PezPixels pezGenNoise(PezPixels desc, float alpha, float beta, int n);
// For internal use, to support pezGetShader:
int pezSwInit(const char* keyPrefix);
int pezSwShutdown();
int pezSwAddPath(const char* pathPrefix, const char* pathSuffix);
const char* pezSwGetError();
int pezSwAddDirective(const char* token, const char* directive);
#ifdef __cplusplus
}
#endif