blob: 0b23ca6a60b2d4993e9bcb5657ac2d39477f589b [file] [log] [blame]
Camilla Berglund3249f812010-09-07 17:34:51 +02001//========================================================================
2// GLFW - An OpenGL framework
3// Platform: Any
Camilla Berglund38b0ccb2010-09-07 17:41:26 +02004// API version: 3.0
Camilla Berglund3249f812010-09-07 17:34:51 +02005// WWW: http://www.glfw.org/
6//------------------------------------------------------------------------
7// Copyright (c) 2002-2006 Marcus Geelnard
8// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
9//
10// This software is provided 'as-is', without any express or implied
11// warranty. In no event will the authors be held liable for any damages
12// arising from the use of this software.
13//
14// Permission is granted to anyone to use this software for any purpose,
15// including commercial applications, and to alter it and redistribute it
16// freely, subject to the following restrictions:
17//
18// 1. The origin of this software must not be misrepresented; you must not
19// claim that you wrote the original software. If you use this software
20// in a product, an acknowledgment in the product documentation would
21// be appreciated but is not required.
22//
23// 2. Altered source versions must be plainly marked as such, and must not
24// be misrepresented as being the original software.
25//
26// 3. This notice may not be removed or altered from any source
27// distribution.
28//
29//========================================================================
30
31#ifndef _internal_h_
32#define _internal_h_
33
34//========================================================================
35// GLFWGLOBAL is a macro that places all global variables in the init.c
36// module (all other modules reference global variables as 'extern')
37//========================================================================
38
39#if defined( _init_c_ )
40#define GLFWGLOBAL
41#else
42#define GLFWGLOBAL extern
43#endif
44
45
46//========================================================================
47// Input handling definitions
48//========================================================================
49
50// Internal key and button state/action definitions
51#define GLFW_STICK 2
52
53
54//========================================================================
55// System independent include files
56//========================================================================
57
58#include <stdlib.h>
59#include <string.h>
60#include <stdio.h>
61
62
63//------------------------------------------------------------------------
64// Window opening hints (set by glfwOpenWindowHint)
65// A bucket of semi-random stuff bunched together for historical reasons
66// This is used only by the platform independent code and only to store
67// parameters passed to us by glfwOpenWindowHint
68//------------------------------------------------------------------------
69typedef struct {
70 int refreshRate;
71 int accumRedBits;
72 int accumGreenBits;
73 int accumBlueBits;
74 int accumAlphaBits;
75 int auxBuffers;
76 int stereo;
77 int windowNoResize;
78 int samples;
79 int glMajor;
80 int glMinor;
81 int glForward;
82 int glDebug;
83 int glProfile;
84} _GLFWhints;
85
86
87//------------------------------------------------------------------------
88// Platform specific definitions goes in platform.h (which also includes
89// glfw.h)
90//------------------------------------------------------------------------
91
92#include "platform.h"
93
94
95//------------------------------------------------------------------------
96// Parameters relating to the creation of the context and window but not
97// directly related to the properties of the framebuffer
98// This is used to pass window and context creation parameters from the
99// platform independent code to the platform specific code
100//------------------------------------------------------------------------
101typedef struct {
102 int mode;
103 int refreshRate;
104 int windowNoResize;
105 int glMajor;
106 int glMinor;
107 int glForward;
108 int glDebug;
109 int glProfile;
110} _GLFWwndconfig;
111
112
113//------------------------------------------------------------------------
114// Framebuffer configuration descriptor, i.e. buffers and their sizes
115// Also a platform specific ID used to map back to the actual backend APIs
116// This is used to pass framebuffer parameters from the platform independent
117// code to the platform specific code, and also to enumerate and select
118// available framebuffer configurations
119//------------------------------------------------------------------------
120typedef struct {
121 int redBits;
122 int greenBits;
123 int blueBits;
124 int alphaBits;
125 int depthBits;
126 int stencilBits;
127 int accumRedBits;
128 int accumGreenBits;
129 int accumBlueBits;
130 int accumAlphaBits;
131 int auxBuffers;
132 int stereo;
133 int samples;
134 GLFWintptr platformID;
135} _GLFWfbconfig;
136
137
138//========================================================================
139// System independent global variables (GLFW internals)
140//========================================================================
141
142// Flag indicating if GLFW has been initialized
143#if defined( _init_c_ )
144int _glfwInitialized = 0;
145#else
146GLFWGLOBAL int _glfwInitialized;
147#endif
148
149
150//========================================================================
151// Prototypes for platform specific implementation functions
152//========================================================================
153
154// Init/terminate
155int _glfwPlatformInit( void );
156int _glfwPlatformTerminate( void );
157
158// Enable/Disable
159void _glfwPlatformEnableSystemKeys( void );
160void _glfwPlatformDisableSystemKeys( void );
161
162// Fullscreen
163int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount );
164void _glfwPlatformGetDesktopMode( GLFWvidmode *mode );
165
166// OpenGL extensions
167int _glfwPlatformExtensionSupported( const char *extension );
168void * _glfwPlatformGetProcAddress( const char *procname );
169
170// Joystick
171int _glfwPlatformGetJoystickParam( int joy, int param );
172int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes );
173int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons, int numbuttons );
174
175// Time
176double _glfwPlatformGetTime( void );
177void _glfwPlatformSetTime( double time );
178
179// Window management
180int _glfwPlatformOpenWindow( int width, int height, const _GLFWwndconfig *wndconfig, const _GLFWfbconfig *fbconfig );
181void _glfwPlatformCloseWindow( void );
182void _glfwPlatformSetWindowTitle( const char *title );
183void _glfwPlatformSetWindowSize( int width, int height );
184void _glfwPlatformSetWindowPos( int x, int y );
185void _glfwPlatformIconifyWindow( void );
186void _glfwPlatformRestoreWindow( void );
187void _glfwPlatformSwapBuffers( void );
188void _glfwPlatformSwapInterval( int interval );
189void _glfwPlatformRefreshWindowParams( void );
190void _glfwPlatformPollEvents( void );
191void _glfwPlatformWaitEvents( void );
192void _glfwPlatformHideMouseCursor( void );
193void _glfwPlatformShowMouseCursor( void );
194void _glfwPlatformSetMouseCursorPos( int x, int y );
195
196
197//========================================================================
198// Prototypes for platform independent internal functions
199//========================================================================
200
201// Window management (window.c)
202void _glfwClearWindowHints( void );
203
204// Input handling (window.c)
205void _glfwClearInput( void );
206void _glfwInputDeactivation( void );
207void _glfwInputKey( int key, int action );
208void _glfwInputChar( int character, int action );
209void _glfwInputMouseClick( int button, int action );
210
211// OpenGL extensions (glext.c)
212void _glfwParseGLVersion( int *major, int *minor, int *rev );
213int _glfwStringInExtensionString( const char *string, const GLubyte *extensions );
214
215// Framebuffer configs
216const _GLFWfbconfig *_glfwChooseFBConfig( const _GLFWfbconfig *desired,
217 const _GLFWfbconfig *alternatives,
218 unsigned int count );
219
220
221#endif // _internal_h_