ruby2d 0.9.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/README.md +7 -9
- data/assets/Rakefile +85 -0
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +20 -2
- data/assets/include/SDL2/SDL_audio.h +47 -14
- data/assets/include/SDL2/SDL_bits.h +10 -1
- data/assets/include/SDL2/SDL_blendmode.h +10 -7
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +24 -390
- data/assets/include/SDL2/SDL_config_android.h +182 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
- data/assets/include/SDL2/SDL_config_macosx.h +266 -0
- data/assets/include/SDL2/SDL_config_minimal.h +85 -0
- data/assets/include/SDL2/SDL_config_os2.h +188 -0
- data/assets/include/SDL2/SDL_config_pandora.h +135 -0
- data/assets/include/SDL2/SDL_config_psp.h +165 -0
- data/assets/include/SDL2/SDL_config_windows.h +288 -0
- data/assets/include/SDL2/SDL_config_winrt.h +243 -0
- data/assets/include/SDL2/SDL_config_wiz.h +149 -0
- data/assets/include/SDL2/SDL_copying.h +20 -0
- data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
- data/assets/include/SDL2/SDL_egl.h +4 -1
- data/assets/include/SDL2/SDL_endian.h +6 -3
- data/assets/include/SDL2/SDL_error.h +38 -2
- data/assets/include/SDL2/SDL_events.h +67 -28
- data/assets/include/SDL2/SDL_filesystem.h +1 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
- data/assets/include/SDL2/SDL_gesture.h +1 -1
- data/assets/include/SDL2/SDL_haptic.h +10 -1
- data/assets/include/SDL2/SDL_hints.h +460 -17
- data/assets/include/SDL2/SDL_image.h +2 -2
- data/assets/include/SDL2/SDL_joystick.h +115 -24
- data/assets/include/SDL2/SDL_keyboard.h +1 -1
- data/assets/include/SDL2/SDL_keycode.h +11 -9
- data/assets/include/SDL2/SDL_loadso.h +1 -1
- data/assets/include/SDL2/SDL_locale.h +101 -0
- data/assets/include/SDL2/SDL_log.h +3 -3
- data/assets/include/SDL2/SDL_main.h +28 -16
- data/assets/include/SDL2/SDL_messagebox.h +6 -4
- data/assets/include/SDL2/SDL_metal.h +117 -0
- data/assets/include/SDL2/SDL_misc.h +75 -0
- data/assets/include/SDL2/SDL_mouse.h +1 -1
- data/assets/include/SDL2/SDL_mutex.h +1 -1
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +1 -1
- data/assets/include/SDL2/SDL_pixels.h +27 -18
- data/assets/include/SDL2/SDL_platform.h +1 -1
- data/assets/include/SDL2/SDL_power.h +1 -1
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +29 -3
- data/assets/include/SDL2/SDL_render.h +230 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +51 -22
- data/assets/include/SDL2/SDL_scancode.h +2 -2
- data/assets/include/SDL2/SDL_sensor.h +28 -12
- data/assets/include/SDL2/SDL_shape.h +1 -1
- data/assets/include/SDL2/SDL_stdinc.h +44 -4
- data/assets/include/SDL2/SDL_surface.h +12 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +39 -9
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +1 -1
- data/assets/include/SDL2/SDL_test_common.h +32 -2
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +1 -1
- data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
- data/assets/include/SDL2/SDL_test_harness.h +1 -1
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +3 -3
- data/assets/include/SDL2/SDL_test_random.h +1 -1
- data/assets/include/SDL2/SDL_thread.h +34 -11
- data/assets/include/SDL2/SDL_timer.h +1 -1
- data/assets/include/SDL2/SDL_touch.h +17 -1
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +2 -2
- data/assets/include/SDL2/SDL_video.h +11 -5
- data/assets/include/SDL2/SDL_vulkan.h +9 -11
- data/assets/include/SDL2/begin_code.h +8 -9
- data/assets/include/SDL2/close_code.h +4 -1
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libmpg123.a +0 -0
- data/assets/macos/lib/libogg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libwebp-7.dll +0 -0
- data/assets/mingw/lib/libSDL2.a +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/bin/ruby2d +1 -0
- data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
- data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
- data/ext/ruby2d/extconf.rb +36 -58
- data/ext/ruby2d/font.c +35 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +72 -100
- data/ext/ruby2d/gl2.c +86 -0
- data/ext/ruby2d/gl3.c +305 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +22 -81
- data/ext/ruby2d/image.c +58 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
- data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
- data/ext/ruby2d/ruby2d.c +449 -439
- data/ext/ruby2d/ruby2d.h +652 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
- data/ext/ruby2d/sound.c +118 -0
- data/ext/ruby2d/text.c +22 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +73 -62
- data/lib/ruby2d/circle.rb +21 -3
- data/lib/ruby2d/cli/build.rb +4 -7
- data/lib/ruby2d/dsl.rb +16 -9
- data/lib/ruby2d/entity.rb +17 -0
- data/lib/ruby2d/font.rb +23 -3
- data/lib/ruby2d/image.rb +35 -7
- data/lib/ruby2d/line.rb +23 -1
- data/lib/ruby2d/music.rb +5 -0
- data/lib/ruby2d/pixel.rb +17 -0
- data/lib/ruby2d/quad.rb +21 -1
- data/lib/ruby2d/rectangle.rb +12 -3
- data/lib/ruby2d/renderable.rb +4 -20
- data/lib/ruby2d/sound.rb +30 -0
- data/lib/ruby2d/sprite.rb +57 -75
- data/lib/ruby2d/square.rb +10 -1
- data/lib/ruby2d/text.rb +55 -12
- data/lib/ruby2d/texture.rb +28 -0
- data/lib/ruby2d/tileset.rb +87 -0
- data/lib/ruby2d/triangle.rb +19 -1
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +84 -0
- data/lib/ruby2d/window.rb +259 -22
- data/lib/ruby2d.rb +6 -1
- metadata +41 -26
- data/assets/include/simple2d.h +0 -735
- data/assets/linux/simple2d/Makefile +0 -257
- data/assets/linux/simple2d/bin/simple2d.sh +0 -1312
- data/assets/linux/simple2d/include/simple2d.h +0 -735
- data/assets/linux/simple2d/src/gl2.c +0 -146
- data/assets/linux/simple2d/src/gl3.c +0 -275
- data/assets/linux/simple2d/src/image.c +0 -138
- data/assets/linux/simple2d/src/sound.c +0 -56
- data/assets/linux/simple2d/src/sprite.c +0 -147
- data/assets/linux/simple2d/src/text.c +0 -129
- data/assets/macos/lib/libsimple2d.a +0 -0
- data/assets/mingw/lib/libsimple2d.a +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -61,7 +61,7 @@ extern "C" {
|
|
61
61
|
* at the VERBOSE level and all other categories are enabled at the
|
62
62
|
* CRITICAL level.
|
63
63
|
*/
|
64
|
-
enum
|
64
|
+
typedef enum
|
65
65
|
{
|
66
66
|
SDL_LOG_CATEGORY_APPLICATION,
|
67
67
|
SDL_LOG_CATEGORY_ERROR,
|
@@ -94,7 +94,7 @@ enum
|
|
94
94
|
};
|
95
95
|
*/
|
96
96
|
SDL_LOG_CATEGORY_CUSTOM
|
97
|
-
};
|
97
|
+
} SDL_LogCategory;
|
98
98
|
|
99
99
|
/**
|
100
100
|
* \brief The predefined log priorities
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -55,6 +55,10 @@
|
|
55
55
|
/* On iOS SDL provides a main function that creates an application delegate
|
56
56
|
and starts the iOS application run loop.
|
57
57
|
|
58
|
+
If you link with SDL dynamically on iOS, the main function can't be in a
|
59
|
+
shared library, so you need to link with libSDLmain.a, which includes a
|
60
|
+
stub main function that calls into the shared library to start execution.
|
61
|
+
|
58
62
|
See src/video/uikit/SDL_uikitappdelegate.m for more details.
|
59
63
|
*/
|
60
64
|
#define SDL_MAIN_NEEDED
|
@@ -82,12 +86,6 @@
|
|
82
86
|
#endif
|
83
87
|
#endif /* SDL_MAIN_HANDLED */
|
84
88
|
|
85
|
-
#ifdef __cplusplus
|
86
|
-
#define C_LINKAGE "C"
|
87
|
-
#else
|
88
|
-
#define C_LINKAGE
|
89
|
-
#endif /* __cplusplus */
|
90
|
-
|
91
89
|
#ifndef SDLMAIN_DECLSPEC
|
92
90
|
#define SDLMAIN_DECLSPEC
|
93
91
|
#endif
|
@@ -111,17 +109,18 @@
|
|
111
109
|
#define main SDL_main
|
112
110
|
#endif
|
113
111
|
|
114
|
-
/**
|
115
|
-
* The prototype for the application's main() function
|
116
|
-
*/
|
117
|
-
extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
|
118
|
-
|
119
|
-
|
120
112
|
#include "begin_code.h"
|
121
113
|
#ifdef __cplusplus
|
122
114
|
extern "C" {
|
123
115
|
#endif
|
124
116
|
|
117
|
+
/**
|
118
|
+
* The prototype for the application's main() function
|
119
|
+
*/
|
120
|
+
typedef int (*SDL_main_func)(int argc, char *argv[]);
|
121
|
+
extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
|
122
|
+
|
123
|
+
|
125
124
|
/**
|
126
125
|
* This is called by the real SDL main function to let the rest of the
|
127
126
|
* library know that initialization was done properly.
|
@@ -136,8 +135,7 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
|
|
136
135
|
/**
|
137
136
|
* This can be called to set the application class at startup
|
138
137
|
*/
|
139
|
-
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
|
140
|
-
void *hInst);
|
138
|
+
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
141
139
|
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
142
140
|
|
143
141
|
#endif /* __WIN32__ */
|
@@ -153,10 +151,24 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
|
153
151
|
* \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
|
154
152
|
* information on the failure.
|
155
153
|
*/
|
156
|
-
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(
|
154
|
+
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
|
157
155
|
|
158
156
|
#endif /* __WINRT__ */
|
159
157
|
|
158
|
+
#if defined(__IPHONEOS__)
|
159
|
+
|
160
|
+
/**
|
161
|
+
* \brief Initializes and launches an SDL application.
|
162
|
+
*
|
163
|
+
* \param argc The argc parameter from the application's main() function
|
164
|
+
* \param argv The argv parameter from the application's main() function
|
165
|
+
* \param mainFunction The SDL app's C-style main().
|
166
|
+
* \return the return value from mainFunction
|
167
|
+
*/
|
168
|
+
extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
|
169
|
+
|
170
|
+
#endif /* __IPHONEOS__ */
|
171
|
+
|
160
172
|
|
161
173
|
#ifdef __cplusplus
|
162
174
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -36,9 +36,11 @@ extern "C" {
|
|
36
36
|
*/
|
37
37
|
typedef enum
|
38
38
|
{
|
39
|
-
SDL_MESSAGEBOX_ERROR
|
40
|
-
SDL_MESSAGEBOX_WARNING
|
41
|
-
SDL_MESSAGEBOX_INFORMATION
|
39
|
+
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
|
40
|
+
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
|
41
|
+
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
|
42
|
+
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
|
43
|
+
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
|
42
44
|
} SDL_MessageBoxFlags;
|
43
45
|
|
44
46
|
/**
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2020 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_metal.h
|
24
|
+
*
|
25
|
+
* Header file for functions to creating Metal layers and views on SDL windows.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef SDL_metal_h_
|
29
|
+
#define SDL_metal_h_
|
30
|
+
|
31
|
+
#include "SDL_video.h"
|
32
|
+
|
33
|
+
#include "begin_code.h"
|
34
|
+
/* Set up for C function definitions, even when using C++ */
|
35
|
+
#ifdef __cplusplus
|
36
|
+
extern "C" {
|
37
|
+
#endif
|
38
|
+
|
39
|
+
/**
|
40
|
+
* \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
|
41
|
+
*
|
42
|
+
* \note This can be cast directly to an NSView or UIView.
|
43
|
+
*/
|
44
|
+
typedef void *SDL_MetalView;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* \name Metal support functions
|
48
|
+
*/
|
49
|
+
/* @{ */
|
50
|
+
|
51
|
+
/**
|
52
|
+
* \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
|
53
|
+
* specified window.
|
54
|
+
*
|
55
|
+
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
|
56
|
+
* own. It is up to user code to do that.
|
57
|
+
*
|
58
|
+
* The returned handle can be casted directly to a NSView or UIView.
|
59
|
+
* To access the backing CAMetalLayer, call SDL_Metal_GetLayer().
|
60
|
+
*
|
61
|
+
* \note \a window must be created with the SDL_WINDOW_METAL flag.
|
62
|
+
*
|
63
|
+
* \sa SDL_Metal_DestroyView
|
64
|
+
* \sa SDL_Metal_GetLayer
|
65
|
+
*/
|
66
|
+
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
|
67
|
+
|
68
|
+
/**
|
69
|
+
* \brief Destroy an existing SDL_MetalView object.
|
70
|
+
*
|
71
|
+
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
|
72
|
+
* called after SDL_CreateWindow.
|
73
|
+
*
|
74
|
+
* \sa SDL_Metal_CreateView
|
75
|
+
*/
|
76
|
+
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
|
77
|
+
|
78
|
+
/**
|
79
|
+
* \brief Get a pointer to the backing CAMetalLayer for the given view.
|
80
|
+
*
|
81
|
+
* \sa SDL_MetalCreateView
|
82
|
+
*/
|
83
|
+
extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
|
84
|
+
|
85
|
+
/**
|
86
|
+
* \brief Get the size of a window's underlying drawable in pixels (for use
|
87
|
+
* with setting viewport, scissor & etc).
|
88
|
+
*
|
89
|
+
* \param window SDL_Window from which the drawable size should be queried
|
90
|
+
* \param w Pointer to variable for storing the width in pixels,
|
91
|
+
* may be NULL
|
92
|
+
* \param h Pointer to variable for storing the height in pixels,
|
93
|
+
* may be NULL
|
94
|
+
*
|
95
|
+
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
|
96
|
+
* drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
|
97
|
+
* platform with high-DPI support (Apple calls this "Retina"), and not disabled
|
98
|
+
* by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
|
99
|
+
*
|
100
|
+
* \note On macOS high-DPI support must be enabled for an application by
|
101
|
+
* setting NSHighResolutionCapable to true in its Info.plist.
|
102
|
+
*
|
103
|
+
* \sa SDL_GetWindowSize()
|
104
|
+
* \sa SDL_CreateWindow()
|
105
|
+
*/
|
106
|
+
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
|
107
|
+
int *h);
|
108
|
+
|
109
|
+
/* @} *//* Metal support functions */
|
110
|
+
|
111
|
+
/* Ends C function definitions when using C++ */
|
112
|
+
#ifdef __cplusplus
|
113
|
+
}
|
114
|
+
#endif
|
115
|
+
#include "close_code.h"
|
116
|
+
|
117
|
+
#endif /* SDL_metal_h_ */
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2020 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_misc.h
|
24
|
+
*
|
25
|
+
* \brief Include file for SDL API functions that don't fit elsewhere.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef SDL_misc_h_
|
29
|
+
#define SDL_misc_h_
|
30
|
+
|
31
|
+
#include "SDL_stdinc.h"
|
32
|
+
|
33
|
+
#include "begin_code.h"
|
34
|
+
|
35
|
+
/* Set up for C function definitions, even when using C++ */
|
36
|
+
#ifdef __cplusplus
|
37
|
+
extern "C" {
|
38
|
+
#endif
|
39
|
+
|
40
|
+
/**
|
41
|
+
* \brief Open an URL / URI in the browser or other
|
42
|
+
*
|
43
|
+
* Open a URL in a separate, system-provided application. How this works will
|
44
|
+
* vary wildly depending on the platform. This will likely launch what
|
45
|
+
* makes sense to handle a specific URL's protocol (a web browser for http://,
|
46
|
+
* etc), but it might also be able to launch file managers for directories
|
47
|
+
* and other things.
|
48
|
+
*
|
49
|
+
* What happens when you open a URL varies wildly as well: your game window
|
50
|
+
* may lose focus (and may or may not lose focus if your game was fullscreen
|
51
|
+
* or grabbing input at the time). On mobile devices, your app will likely
|
52
|
+
* move to the background or your process might be paused. Any given platform
|
53
|
+
* may or may not handle a given URL.
|
54
|
+
*
|
55
|
+
* If this is unimplemented (or simply unavailable) for a platform, this will
|
56
|
+
* fail with an error. A successful result does not mean the URL loaded, just
|
57
|
+
* that we launched something to handle it (or at least believe we did).
|
58
|
+
*
|
59
|
+
* All this to say: this function can be useful, but you should definitely
|
60
|
+
* test it on every platform you target.
|
61
|
+
*
|
62
|
+
* \param url A valid URL to open.
|
63
|
+
* \return 0 on success, or -1 on error.
|
64
|
+
*/
|
65
|
+
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
66
|
+
|
67
|
+
/* Ends C function definitions when using C++ */
|
68
|
+
#ifdef __cplusplus
|
69
|
+
}
|
70
|
+
#endif
|
71
|
+
#include "close_code.h"
|
72
|
+
|
73
|
+
#endif /* SDL_misc_h_ */
|
74
|
+
|
75
|
+
/* vi: set ts=4 sw=4 expandtab: */
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -48,7 +48,7 @@ extern "C" {
|
|
48
48
|
/* @} */
|
49
49
|
|
50
50
|
/** Pixel type. */
|
51
|
-
enum
|
51
|
+
typedef enum
|
52
52
|
{
|
53
53
|
SDL_PIXELTYPE_UNKNOWN,
|
54
54
|
SDL_PIXELTYPE_INDEX1,
|
@@ -62,18 +62,18 @@ enum
|
|
62
62
|
SDL_PIXELTYPE_ARRAYU32,
|
63
63
|
SDL_PIXELTYPE_ARRAYF16,
|
64
64
|
SDL_PIXELTYPE_ARRAYF32
|
65
|
-
};
|
65
|
+
} SDL_PixelType;
|
66
66
|
|
67
67
|
/** Bitmap pixel order, high bit -> low bit. */
|
68
|
-
enum
|
68
|
+
typedef enum
|
69
69
|
{
|
70
70
|
SDL_BITMAPORDER_NONE,
|
71
71
|
SDL_BITMAPORDER_4321,
|
72
72
|
SDL_BITMAPORDER_1234
|
73
|
-
};
|
73
|
+
} SDL_BitmapOrder;
|
74
74
|
|
75
75
|
/** Packed component order, high bit -> low bit. */
|
76
|
-
enum
|
76
|
+
typedef enum
|
77
77
|
{
|
78
78
|
SDL_PACKEDORDER_NONE,
|
79
79
|
SDL_PACKEDORDER_XRGB,
|
@@ -84,12 +84,12 @@ enum
|
|
84
84
|
SDL_PACKEDORDER_BGRX,
|
85
85
|
SDL_PACKEDORDER_ABGR,
|
86
86
|
SDL_PACKEDORDER_BGRA
|
87
|
-
};
|
87
|
+
} SDL_PackedOrder;
|
88
88
|
|
89
89
|
/** Array component order, low byte -> high byte. */
|
90
90
|
/* !!! FIXME: in 2.1, make these not overlap differently with
|
91
91
|
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
|
92
|
-
enum
|
92
|
+
typedef enum
|
93
93
|
{
|
94
94
|
SDL_ARRAYORDER_NONE,
|
95
95
|
SDL_ARRAYORDER_RGB,
|
@@ -98,10 +98,10 @@ enum
|
|
98
98
|
SDL_ARRAYORDER_BGR,
|
99
99
|
SDL_ARRAYORDER_BGRA,
|
100
100
|
SDL_ARRAYORDER_ABGR
|
101
|
-
};
|
101
|
+
} SDL_ArrayOrder;
|
102
102
|
|
103
103
|
/** Packed component layout. */
|
104
|
-
enum
|
104
|
+
typedef enum
|
105
105
|
{
|
106
106
|
SDL_PACKEDLAYOUT_NONE,
|
107
107
|
SDL_PACKEDLAYOUT_332,
|
@@ -112,7 +112,7 @@ enum
|
|
112
112
|
SDL_PACKEDLAYOUT_8888,
|
113
113
|
SDL_PACKEDLAYOUT_2101010,
|
114
114
|
SDL_PACKEDLAYOUT_1010102
|
115
|
-
};
|
115
|
+
} SDL_PackedLayout;
|
116
116
|
|
117
117
|
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
|
118
118
|
|
@@ -168,7 +168,7 @@ enum
|
|
168
168
|
((format) && (SDL_PIXELFLAG(format) != 1))
|
169
169
|
|
170
170
|
/* Note: If you modify this list, update SDL_GetPixelFormatName() */
|
171
|
-
enum
|
171
|
+
typedef enum
|
172
172
|
{
|
173
173
|
SDL_PIXELFORMAT_UNKNOWN,
|
174
174
|
SDL_PIXELFORMAT_INDEX1LSB =
|
@@ -188,15 +188,22 @@ enum
|
|
188
188
|
SDL_PIXELFORMAT_RGB332 =
|
189
189
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
|
190
190
|
SDL_PACKEDLAYOUT_332, 8, 1),
|
191
|
-
|
191
|
+
SDL_PIXELFORMAT_XRGB4444 =
|
192
192
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
193
193
|
SDL_PACKEDLAYOUT_4444, 12, 2),
|
194
|
-
|
194
|
+
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
|
195
|
+
SDL_PIXELFORMAT_XBGR4444 =
|
196
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
197
|
+
SDL_PACKEDLAYOUT_4444, 12, 2),
|
198
|
+
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
|
199
|
+
SDL_PIXELFORMAT_XRGB1555 =
|
195
200
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
196
201
|
SDL_PACKEDLAYOUT_1555, 15, 2),
|
197
|
-
|
202
|
+
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
|
203
|
+
SDL_PIXELFORMAT_XBGR1555 =
|
198
204
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
199
205
|
SDL_PACKEDLAYOUT_1555, 15, 2),
|
206
|
+
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
|
200
207
|
SDL_PIXELFORMAT_ARGB4444 =
|
201
208
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
|
202
209
|
SDL_PACKEDLAYOUT_4444, 16, 2),
|
@@ -233,15 +240,17 @@ enum
|
|
233
240
|
SDL_PIXELFORMAT_BGR24 =
|
234
241
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
|
235
242
|
24, 3),
|
236
|
-
|
243
|
+
SDL_PIXELFORMAT_XRGB8888 =
|
237
244
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
|
238
245
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
246
|
+
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
|
239
247
|
SDL_PIXELFORMAT_RGBX8888 =
|
240
248
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
|
241
249
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
242
|
-
|
250
|
+
SDL_PIXELFORMAT_XBGR8888 =
|
243
251
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
|
244
252
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
253
|
+
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
|
245
254
|
SDL_PIXELFORMAT_BGRX8888 =
|
246
255
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
|
247
256
|
SDL_PACKEDLAYOUT_8888, 24, 4),
|
@@ -290,7 +299,7 @@ enum
|
|
290
299
|
SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
|
291
300
|
SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
|
292
301
|
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
293
|
-
};
|
302
|
+
} SDL_PixelFormatEnum;
|
294
303
|
|
295
304
|
typedef struct SDL_Color
|
296
305
|
{
|