rubygl 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +2 -0
- data/README.md +1 -1
- data/Rakefile +17 -9
- data/bin/ffi_code_gen.rb +11 -3
- data/ext/macosx/RubyGL.so +0 -0
- data/ext/macosx/SDL2.framework/Headers/SDL.h +163 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_assert.h +284 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_atomic.h +260 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_audio.h +506 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_bits.h +97 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_blendmode.h +63 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_clipboard.h +71 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_config.h +55 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_config_macosx.h +184 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_copying.h +20 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_cpuinfo.h +156 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_endian.h +239 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_error.h +76 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_events.h +723 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_filesystem.h +136 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_gamecontroller.h +316 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_gesture.h +87 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_haptic.h +1225 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_hints.h +517 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_joystick.h +253 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_keyboard.h +217 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_keycode.h +341 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_loadso.h +81 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_log.h +211 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_main.h +155 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_messagebox.h +144 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_mouse.h +224 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_mutex.h +251 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_name.h +33 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_opengl.h +11126 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_opengles.h +38 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_opengles2.h +2790 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_pixels.h +429 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_platform.h +164 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_power.h +75 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_quit.h +58 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_rect.h +138 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_render.h +870 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_revision.h +2 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_rwops.h +232 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_scancode.h +401 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_shape.h +143 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_stdinc.h +405 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_surface.h +503 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_system.h +191 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_syswm.h +272 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_thread.h +287 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_timer.h +115 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_touch.h +86 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_types.h +29 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_version.h +162 -0
- data/ext/macosx/SDL2.framework/Headers/SDL_video.h +979 -0
- data/ext/macosx/SDL2.framework/Headers/begin_code.h +140 -0
- data/ext/macosx/SDL2.framework/Headers/close_code.h +37 -0
- data/ext/macosx/SDL2.framework/Resources/Info.plist +42 -0
- data/ext/macosx/SDL2.framework/SDL2 +0 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL.h +163 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_assert.h +284 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_atomic.h +260 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_audio.h +506 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_bits.h +97 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_blendmode.h +63 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_clipboard.h +71 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config.h +55 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h +184 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_copying.h +20 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_cpuinfo.h +156 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_endian.h +239 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_error.h +76 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_events.h +723 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_filesystem.h +136 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h +316 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gesture.h +87 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_haptic.h +1225 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_hints.h +517 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_joystick.h +253 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keyboard.h +217 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keycode.h +341 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_loadso.h +81 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_log.h +211 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_main.h +155 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_messagebox.h +144 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mouse.h +224 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mutex.h +251 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_name.h +33 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengl.h +11126 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles.h +38 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles2.h +2790 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_pixels.h +429 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_platform.h +164 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_power.h +75 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_quit.h +58 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rect.h +138 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_render.h +870 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_revision.h +2 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rwops.h +232 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_scancode.h +401 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_shape.h +143 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_stdinc.h +405 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_surface.h +503 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_system.h +191 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_syswm.h +272 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_thread.h +287 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_timer.h +115 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_touch.h +86 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_types.h +29 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_version.h +162 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_video.h +979 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/begin_code.h +140 -0
- data/ext/macosx/SDL2.framework/Versions/A/Headers/close_code.h +37 -0
- data/ext/macosx/SDL2.framework/Versions/A/Resources/Info.plist +42 -0
- data/ext/macosx/SDL2.framework/Versions/A/SDL2 +0 -0
- data/ext/macosx/SDL2.framework/Versions/A/_CodeSignature/CodeResources +331 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL.h +163 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_assert.h +284 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_atomic.h +260 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_audio.h +506 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_bits.h +97 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_blendmode.h +63 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_clipboard.h +71 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config.h +55 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config_macosx.h +184 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_copying.h +20 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_cpuinfo.h +156 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_endian.h +239 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_error.h +76 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_events.h +723 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_filesystem.h +136 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gamecontroller.h +316 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gesture.h +87 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_haptic.h +1225 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_hints.h +517 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_joystick.h +253 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keyboard.h +217 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keycode.h +341 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_loadso.h +81 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_log.h +211 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_main.h +155 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_messagebox.h +144 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mouse.h +224 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mutex.h +251 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_name.h +33 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengl.h +11126 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles.h +38 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles2.h +2790 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_pixels.h +429 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_platform.h +164 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_power.h +75 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_quit.h +58 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rect.h +138 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_render.h +870 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_revision.h +2 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rwops.h +232 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_scancode.h +401 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_shape.h +143 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_stdinc.h +405 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_surface.h +503 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_system.h +191 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_syswm.h +272 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_thread.h +287 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_timer.h +115 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_touch.h +86 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_types.h +29 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_version.h +162 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_video.h +979 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/begin_code.h +140 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Headers/close_code.h +37 -0
- data/ext/macosx/SDL2.framework/Versions/Current/Resources/Info.plist +42 -0
- data/ext/macosx/SDL2.framework/Versions/Current/SDL2 +0 -0
- data/ext/macosx/SDL2.framework/Versions/Current/_CodeSignature/CodeResources +331 -0
- data/ext/windows/RubyGL.so +0 -0
- data/lib/rubygl/native/opengl.rb +1052 -1044
- data/lib/rubygl/setup.rb +7 -4
- data/lib/rubygl.rb +12 -4
- data/rubygl.gemspec +3 -2
- metadata +174 -3
@@ -0,0 +1,155 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
4
|
+
|
5
|
+
This software is provided 'as-is', without any express or implied
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
7
|
+
arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
11
|
+
freely, subject to the following restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
14
|
+
claim that you wrote the original software. If you use this software
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
16
|
+
appreciated but is not required.
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#ifndef _SDL_main_h
|
23
|
+
#define _SDL_main_h
|
24
|
+
|
25
|
+
#include "SDL_stdinc.h"
|
26
|
+
|
27
|
+
/**
|
28
|
+
* \file SDL_main.h
|
29
|
+
*
|
30
|
+
* Redefine main() on some platforms so that it is called by SDL.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifndef SDL_MAIN_HANDLED
|
34
|
+
#if defined(__WIN32__)
|
35
|
+
/* On Windows SDL provides WinMain(), which parses the command line and passes
|
36
|
+
the arguments to your main function.
|
37
|
+
|
38
|
+
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
|
39
|
+
*/
|
40
|
+
#define SDL_MAIN_AVAILABLE
|
41
|
+
|
42
|
+
#elif defined(__WINRT__)
|
43
|
+
/* On WinRT, SDL provides a main function that initializes CoreApplication,
|
44
|
+
creating an instance of IFrameworkView in the process.
|
45
|
+
|
46
|
+
Please note that #include'ing SDL_main.h is not enough to get a main()
|
47
|
+
function working. In non-XAML apps, the file,
|
48
|
+
src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
|
49
|
+
into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
|
50
|
+
called, with a pointer to the Direct3D-hosted XAML control passed in.
|
51
|
+
*/
|
52
|
+
#define SDL_MAIN_NEEDED
|
53
|
+
|
54
|
+
#elif defined(__IPHONEOS__)
|
55
|
+
/* On iOS SDL provides a main function that creates an application delegate
|
56
|
+
and starts the iOS application run loop.
|
57
|
+
|
58
|
+
See src/video/uikit/SDL_uikitappdelegate.m for more details.
|
59
|
+
*/
|
60
|
+
#define SDL_MAIN_NEEDED
|
61
|
+
|
62
|
+
#elif defined(__ANDROID__)
|
63
|
+
/* On Android SDL provides a Java class in SDLActivity.java that is the
|
64
|
+
main activity entry point.
|
65
|
+
|
66
|
+
See README-android.txt for more details on extending that class.
|
67
|
+
*/
|
68
|
+
#define SDL_MAIN_NEEDED
|
69
|
+
|
70
|
+
#endif
|
71
|
+
#endif /* SDL_MAIN_HANDLED */
|
72
|
+
|
73
|
+
#ifdef __cplusplus
|
74
|
+
#define C_LINKAGE "C"
|
75
|
+
#else
|
76
|
+
#define C_LINKAGE
|
77
|
+
#endif /* __cplusplus */
|
78
|
+
|
79
|
+
/**
|
80
|
+
* \file SDL_main.h
|
81
|
+
*
|
82
|
+
* The application's main() function must be called with C linkage,
|
83
|
+
* and should be declared like this:
|
84
|
+
* \code
|
85
|
+
* #ifdef __cplusplus
|
86
|
+
* extern "C"
|
87
|
+
* #endif
|
88
|
+
* int main(int argc, char *argv[])
|
89
|
+
* {
|
90
|
+
* }
|
91
|
+
* \endcode
|
92
|
+
*/
|
93
|
+
|
94
|
+
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
|
95
|
+
#define main SDL_main
|
96
|
+
#endif
|
97
|
+
|
98
|
+
/**
|
99
|
+
* The prototype for the application's main() function
|
100
|
+
*/
|
101
|
+
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
102
|
+
|
103
|
+
|
104
|
+
#include "begin_code.h"
|
105
|
+
#ifdef __cplusplus
|
106
|
+
extern "C" {
|
107
|
+
#endif
|
108
|
+
|
109
|
+
/**
|
110
|
+
* This is called by the real SDL main function to let the rest of the
|
111
|
+
* library know that initialization was done properly.
|
112
|
+
*
|
113
|
+
* Calling this yourself without knowing what you're doing can cause
|
114
|
+
* crashes and hard to diagnose problems with your application.
|
115
|
+
*/
|
116
|
+
extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
117
|
+
|
118
|
+
#ifdef __WIN32__
|
119
|
+
|
120
|
+
/**
|
121
|
+
* This can be called to set the application class at startup
|
122
|
+
*/
|
123
|
+
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
|
124
|
+
void *hInst);
|
125
|
+
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
126
|
+
|
127
|
+
#endif /* __WIN32__ */
|
128
|
+
|
129
|
+
|
130
|
+
#ifdef __WINRT__
|
131
|
+
|
132
|
+
/**
|
133
|
+
* \brief Initializes and launches an SDL/WinRT application.
|
134
|
+
*
|
135
|
+
* \param mainFunction The SDL app's C-style main().
|
136
|
+
* \param xamlBackgroundPanel An optional, XAML-based, background panel.
|
137
|
+
* For Non-XAML apps, this value must be set to NULL. For XAML apps,
|
138
|
+
* pass in a pointer to a SwapChainBackgroundPanel, casted to an
|
139
|
+
* IInspectable (via reinterpret_cast).
|
140
|
+
* \ret 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
|
141
|
+
* information on the failure.
|
142
|
+
*/
|
143
|
+
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel);
|
144
|
+
|
145
|
+
#endif /* __WINRT__ */
|
146
|
+
|
147
|
+
|
148
|
+
#ifdef __cplusplus
|
149
|
+
}
|
150
|
+
#endif
|
151
|
+
#include "close_code.h"
|
152
|
+
|
153
|
+
#endif /* _SDL_main_h */
|
154
|
+
|
155
|
+
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
4
|
+
|
5
|
+
This software is provided 'as-is', without any express or implied
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
7
|
+
arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
11
|
+
freely, subject to the following restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
14
|
+
claim that you wrote the original software. If you use this software
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
16
|
+
appreciated but is not required.
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#ifndef _SDL_messagebox_h
|
23
|
+
#define _SDL_messagebox_h
|
24
|
+
|
25
|
+
#include "SDL_stdinc.h"
|
26
|
+
#include "SDL_video.h" /* For SDL_Window */
|
27
|
+
|
28
|
+
#include "begin_code.h"
|
29
|
+
/* Set up for C function definitions, even when using C++ */
|
30
|
+
#ifdef __cplusplus
|
31
|
+
extern "C" {
|
32
|
+
#endif
|
33
|
+
|
34
|
+
/**
|
35
|
+
* \brief SDL_MessageBox flags. If supported will display warning icon, etc.
|
36
|
+
*/
|
37
|
+
typedef enum
|
38
|
+
{
|
39
|
+
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
40
|
+
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
41
|
+
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
|
42
|
+
} SDL_MessageBoxFlags;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* \brief Flags for SDL_MessageBoxButtonData.
|
46
|
+
*/
|
47
|
+
typedef enum
|
48
|
+
{
|
49
|
+
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
|
50
|
+
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
|
51
|
+
} SDL_MessageBoxButtonFlags;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* \brief Individual button data.
|
55
|
+
*/
|
56
|
+
typedef struct
|
57
|
+
{
|
58
|
+
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
|
59
|
+
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
|
60
|
+
const char * text; /**< The UTF-8 button text */
|
61
|
+
} SDL_MessageBoxButtonData;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* \brief RGB value used in a message box color scheme
|
65
|
+
*/
|
66
|
+
typedef struct
|
67
|
+
{
|
68
|
+
Uint8 r, g, b;
|
69
|
+
} SDL_MessageBoxColor;
|
70
|
+
|
71
|
+
typedef enum
|
72
|
+
{
|
73
|
+
SDL_MESSAGEBOX_COLOR_BACKGROUND,
|
74
|
+
SDL_MESSAGEBOX_COLOR_TEXT,
|
75
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
|
76
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
|
77
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
|
78
|
+
SDL_MESSAGEBOX_COLOR_MAX
|
79
|
+
} SDL_MessageBoxColorType;
|
80
|
+
|
81
|
+
/**
|
82
|
+
* \brief A set of colors to use for message box dialogs
|
83
|
+
*/
|
84
|
+
typedef struct
|
85
|
+
{
|
86
|
+
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
|
87
|
+
} SDL_MessageBoxColorScheme;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* \brief MessageBox structure containing title, text, window, etc.
|
91
|
+
*/
|
92
|
+
typedef struct
|
93
|
+
{
|
94
|
+
Uint32 flags; /**< ::SDL_MessageBoxFlags */
|
95
|
+
SDL_Window *window; /**< Parent window, can be NULL */
|
96
|
+
const char *title; /**< UTF-8 title */
|
97
|
+
const char *message; /**< UTF-8 message text */
|
98
|
+
|
99
|
+
int numbuttons;
|
100
|
+
const SDL_MessageBoxButtonData *buttons;
|
101
|
+
|
102
|
+
const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
|
103
|
+
} SDL_MessageBoxData;
|
104
|
+
|
105
|
+
/**
|
106
|
+
* \brief Create a modal message box.
|
107
|
+
*
|
108
|
+
* \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
|
109
|
+
* \param buttonid The pointer to which user id of hit button should be copied.
|
110
|
+
*
|
111
|
+
* \return -1 on error, otherwise 0 and buttonid contains user id of button
|
112
|
+
* hit or -1 if dialog was closed.
|
113
|
+
*
|
114
|
+
* \note This function should be called on the thread that created the parent
|
115
|
+
* window, or on the main thread if the messagebox has no parent. It will
|
116
|
+
* block execution of that thread until the user clicks a button or
|
117
|
+
* closes the messagebox.
|
118
|
+
*/
|
119
|
+
extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
120
|
+
|
121
|
+
/**
|
122
|
+
* \brief Create a simple modal message box
|
123
|
+
*
|
124
|
+
* \param flags ::SDL_MessageBoxFlags
|
125
|
+
* \param title UTF-8 title text
|
126
|
+
* \param message UTF-8 message text
|
127
|
+
* \param window The parent window, or NULL for no parent
|
128
|
+
*
|
129
|
+
* \return 0 on success, -1 on error
|
130
|
+
*
|
131
|
+
* \sa SDL_ShowMessageBox
|
132
|
+
*/
|
133
|
+
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
|
134
|
+
|
135
|
+
|
136
|
+
/* Ends C function definitions when using C++ */
|
137
|
+
#ifdef __cplusplus
|
138
|
+
}
|
139
|
+
#endif
|
140
|
+
#include "close_code.h"
|
141
|
+
|
142
|
+
#endif /* _SDL_messagebox_h */
|
143
|
+
|
144
|
+
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
4
|
+
|
5
|
+
This software is provided 'as-is', without any express or implied
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
7
|
+
arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
11
|
+
freely, subject to the following restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
14
|
+
claim that you wrote the original software. If you use this software
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
16
|
+
appreciated but is not required.
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
20
|
+
*/
|
21
|
+
|
22
|
+
/**
|
23
|
+
* \file SDL_mouse.h
|
24
|
+
*
|
25
|
+
* Include file for SDL mouse event handling.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef _SDL_mouse_h
|
29
|
+
#define _SDL_mouse_h
|
30
|
+
|
31
|
+
#include "SDL_stdinc.h"
|
32
|
+
#include "SDL_error.h"
|
33
|
+
#include "SDL_video.h"
|
34
|
+
|
35
|
+
#include "begin_code.h"
|
36
|
+
/* Set up for C function definitions, even when using C++ */
|
37
|
+
#ifdef __cplusplus
|
38
|
+
extern "C" {
|
39
|
+
#endif
|
40
|
+
|
41
|
+
typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
|
42
|
+
|
43
|
+
/**
|
44
|
+
* \brief Cursor types for SDL_CreateSystemCursor.
|
45
|
+
*/
|
46
|
+
typedef enum
|
47
|
+
{
|
48
|
+
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
|
49
|
+
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
|
50
|
+
SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
|
51
|
+
SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
|
52
|
+
SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
|
53
|
+
SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
|
54
|
+
SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
|
55
|
+
SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
|
56
|
+
SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
|
57
|
+
SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
|
58
|
+
SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
|
59
|
+
SDL_SYSTEM_CURSOR_HAND, /**< Hand */
|
60
|
+
SDL_NUM_SYSTEM_CURSORS
|
61
|
+
} SDL_SystemCursor;
|
62
|
+
|
63
|
+
/* Function prototypes */
|
64
|
+
|
65
|
+
/**
|
66
|
+
* \brief Get the window which currently has mouse focus.
|
67
|
+
*/
|
68
|
+
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
|
69
|
+
|
70
|
+
/**
|
71
|
+
* \brief Retrieve the current state of the mouse.
|
72
|
+
*
|
73
|
+
* The current button state is returned as a button bitmask, which can
|
74
|
+
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
75
|
+
* mouse cursor position relative to the focus window for the currently
|
76
|
+
* selected mouse. You can pass NULL for either x or y.
|
77
|
+
*/
|
78
|
+
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* \brief Retrieve the relative state of the mouse.
|
82
|
+
*
|
83
|
+
* The current button state is returned as a button bitmask, which can
|
84
|
+
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
85
|
+
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
86
|
+
*/
|
87
|
+
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
88
|
+
|
89
|
+
/**
|
90
|
+
* \brief Moves the mouse to the given position within the window.
|
91
|
+
*
|
92
|
+
* \param window The window to move the mouse into, or NULL for the current mouse focus
|
93
|
+
* \param x The x coordinate within the window
|
94
|
+
* \param y The y coordinate within the window
|
95
|
+
*
|
96
|
+
* \note This function generates a mouse motion event
|
97
|
+
*/
|
98
|
+
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
|
99
|
+
int x, int y);
|
100
|
+
|
101
|
+
/**
|
102
|
+
* \brief Set relative mouse mode.
|
103
|
+
*
|
104
|
+
* \param enabled Whether or not to enable relative mode
|
105
|
+
*
|
106
|
+
* \return 0 on success, or -1 if relative mode is not supported.
|
107
|
+
*
|
108
|
+
* While the mouse is in relative mode, the cursor is hidden, and the
|
109
|
+
* driver will try to report continuous motion in the current window.
|
110
|
+
* Only relative motion events will be delivered, the mouse position
|
111
|
+
* will not change.
|
112
|
+
*
|
113
|
+
* \note This function will flush any pending mouse motion.
|
114
|
+
*
|
115
|
+
* \sa SDL_GetRelativeMouseMode()
|
116
|
+
*/
|
117
|
+
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
|
118
|
+
|
119
|
+
/**
|
120
|
+
* \brief Query whether relative mouse mode is enabled.
|
121
|
+
*
|
122
|
+
* \sa SDL_SetRelativeMouseMode()
|
123
|
+
*/
|
124
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
|
125
|
+
|
126
|
+
/**
|
127
|
+
* \brief Create a cursor, using the specified bitmap data and
|
128
|
+
* mask (in MSB format).
|
129
|
+
*
|
130
|
+
* The cursor width must be a multiple of 8 bits.
|
131
|
+
*
|
132
|
+
* The cursor is created in black and white according to the following:
|
133
|
+
* <table>
|
134
|
+
* <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
|
135
|
+
* <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
|
136
|
+
* <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
|
137
|
+
* <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
|
138
|
+
* <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
|
139
|
+
* if not. </td></tr>
|
140
|
+
* </table>
|
141
|
+
*
|
142
|
+
* \sa SDL_FreeCursor()
|
143
|
+
*/
|
144
|
+
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
|
145
|
+
const Uint8 * mask,
|
146
|
+
int w, int h, int hot_x,
|
147
|
+
int hot_y);
|
148
|
+
|
149
|
+
/**
|
150
|
+
* \brief Create a color cursor.
|
151
|
+
*
|
152
|
+
* \sa SDL_FreeCursor()
|
153
|
+
*/
|
154
|
+
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
|
155
|
+
int hot_x,
|
156
|
+
int hot_y);
|
157
|
+
|
158
|
+
/**
|
159
|
+
* \brief Create a system cursor.
|
160
|
+
*
|
161
|
+
* \sa SDL_FreeCursor()
|
162
|
+
*/
|
163
|
+
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
|
164
|
+
|
165
|
+
/**
|
166
|
+
* \brief Set the active cursor.
|
167
|
+
*/
|
168
|
+
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
|
169
|
+
|
170
|
+
/**
|
171
|
+
* \brief Return the active cursor.
|
172
|
+
*/
|
173
|
+
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* \brief Return the default cursor.
|
177
|
+
*/
|
178
|
+
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
|
179
|
+
|
180
|
+
/**
|
181
|
+
* \brief Frees a cursor created with SDL_CreateCursor().
|
182
|
+
*
|
183
|
+
* \sa SDL_CreateCursor()
|
184
|
+
*/
|
185
|
+
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
|
186
|
+
|
187
|
+
/**
|
188
|
+
* \brief Toggle whether or not the cursor is shown.
|
189
|
+
*
|
190
|
+
* \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current
|
191
|
+
* state.
|
192
|
+
*
|
193
|
+
* \return 1 if the cursor is shown, or 0 if the cursor is hidden.
|
194
|
+
*/
|
195
|
+
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Used as a mask when testing buttons in buttonstate.
|
199
|
+
* - Button 1: Left mouse button
|
200
|
+
* - Button 2: Middle mouse button
|
201
|
+
* - Button 3: Right mouse button
|
202
|
+
*/
|
203
|
+
#define SDL_BUTTON(X) (1 << ((X)-1))
|
204
|
+
#define SDL_BUTTON_LEFT 1
|
205
|
+
#define SDL_BUTTON_MIDDLE 2
|
206
|
+
#define SDL_BUTTON_RIGHT 3
|
207
|
+
#define SDL_BUTTON_X1 4
|
208
|
+
#define SDL_BUTTON_X2 5
|
209
|
+
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
210
|
+
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
211
|
+
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
212
|
+
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
213
|
+
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
214
|
+
|
215
|
+
|
216
|
+
/* Ends C function definitions when using C++ */
|
217
|
+
#ifdef __cplusplus
|
218
|
+
}
|
219
|
+
#endif
|
220
|
+
#include "close_code.h"
|
221
|
+
|
222
|
+
#endif /* _SDL_mouse_h */
|
223
|
+
|
224
|
+
/* vi: set ts=4 sw=4 expandtab: */
|