gosu 1.3.0 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +104 -70
- data/dependencies/SDL_sound/SDL_sound.h +6 -6
- data/dependencies/SDL_sound/SDL_sound_aiff.c +32 -32
- data/dependencies/SDL_sound/SDL_sound_au.c +14 -14
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +6 -7
- data/dependencies/SDL_sound/SDL_sound_flac.c +28 -30
- data/dependencies/SDL_sound/SDL_sound_internal.h +21 -14
- data/dependencies/SDL_sound/SDL_sound_modplug.c +26 -28
- data/dependencies/SDL_sound/SDL_sound_mp3.c +20 -36
- data/dependencies/SDL_sound/SDL_sound_raw.c +15 -16
- data/dependencies/SDL_sound/SDL_sound_shn.c +11 -10
- data/dependencies/SDL_sound/SDL_sound_voc.c +20 -18
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +11 -9
- data/dependencies/SDL_sound/SDL_sound_wav.c +49 -43
- data/dependencies/SDL_sound/dr_flac.h +10925 -4466
- data/dependencies/SDL_sound/dr_mp3.h +2802 -844
- data/dependencies/SDL_sound/libmodplug/fastmix.c +63 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +12 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +103 -44
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +61 -61
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +94 -58
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -11
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +50 -19
- data/dependencies/SDL_sound/libmodplug/load_okt.c +59 -28
- data/dependencies/SDL_sound/libmodplug/load_psm.c +104 -79
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +4 -3
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +32 -19
- data/dependencies/SDL_sound/libmodplug/sndfile.c +76 -160
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +504 -329
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4848 -0
- data/dependencies/stb/stb_image.h +208 -73
- data/dependencies/stb/stb_image_write.h +57 -23
- data/dependencies/stb/stb_truetype.h +345 -279
- data/dependencies/utf8proc/utf8proc.c +37 -18
- data/dependencies/utf8proc/utf8proc.h +17 -5
- data/dependencies/utf8proc/utf8proc_data.h +12012 -10089
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Buttons.hpp +103 -103
- data/include/Gosu/Color.hpp +19 -11
- data/include/Gosu/Directories.hpp +31 -24
- data/include/Gosu/Font.hpp +42 -44
- data/include/Gosu/Gosu.hpp +5 -8
- data/include/Gosu/Graphics.hpp +58 -71
- data/include/Gosu/GraphicsBase.hpp +26 -33
- data/include/Gosu/IO.hpp +0 -3
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +0 -3
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Timing.hpp +2 -8
- data/include/Gosu/Version.hpp +2 -2
- data/include/Gosu/Window.hpp +71 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +24 -37
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/src/Audio.cpp +88 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.cpp +0 -7
- data/src/AudioImpl.hpp +6 -8
- data/src/BitmapIO.cpp +23 -22
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +12 -9
- data/src/DirectoriesApple.cpp +25 -24
- data/src/DirectoriesUnix.cpp +14 -12
- data/src/DirectoriesWin.cpp +26 -30
- data/src/EmptyImageData.hpp +15 -17
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +59 -54
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +41 -47
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +108 -101
- data/src/LargeImageData.hpp +17 -15
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +11 -39
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +37 -37
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TimingApple.cpp +1 -7
- data/src/TimingUnix.cpp +0 -6
- data/src/TimingWin.cpp +0 -6
- data/src/TrueTypeFont.cpp +107 -107
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +19 -22
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Window.cpp +97 -87
- data/src/WindowUIKit.cpp +46 -49
- metadata +7 -17
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 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
|
@@ -45,6 +45,9 @@ extern "C" {
|
|
45
45
|
#define SDL_RWOPS_JNIFILE 3U /**< Android asset */
|
46
46
|
#define SDL_RWOPS_MEMORY 4U /**< Memory stream */
|
47
47
|
#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */
|
48
|
+
#if defined(__VITA__)
|
49
|
+
#define SDL_RWOPS_VITAFILE 6U /**< Vita file */
|
50
|
+
#endif
|
48
51
|
|
49
52
|
/**
|
50
53
|
* This is the read/write operation structure -- very basic.
|
@@ -110,6 +113,17 @@ typedef struct SDL_RWops
|
|
110
113
|
size_t left;
|
111
114
|
} buffer;
|
112
115
|
} windowsio;
|
116
|
+
#elif defined(__VITA__)
|
117
|
+
struct
|
118
|
+
{
|
119
|
+
int h;
|
120
|
+
struct
|
121
|
+
{
|
122
|
+
void *data;
|
123
|
+
size_t size;
|
124
|
+
size_t left;
|
125
|
+
} buffer;
|
126
|
+
} vitaio;
|
113
127
|
#endif
|
114
128
|
|
115
129
|
#ifdef HAVE_STDIO_H
|
@@ -142,25 +156,228 @@ typedef struct SDL_RWops
|
|
142
156
|
*/
|
143
157
|
/* @{ */
|
144
158
|
|
159
|
+
/**
|
160
|
+
* Use this function to create a new SDL_RWops structure for reading from
|
161
|
+
* and/or writing to a named file.
|
162
|
+
*
|
163
|
+
* The `mode` string is treated roughly the same as in a call to the C
|
164
|
+
* library's fopen(), even if SDL doesn't happen to use fopen() behind the
|
165
|
+
* scenes.
|
166
|
+
*
|
167
|
+
* Available `mode` strings:
|
168
|
+
*
|
169
|
+
* - "r": Open a file for reading. The file must exist.
|
170
|
+
* - "w": Create an empty file for writing. If a file with the same name
|
171
|
+
* already exists its content is erased and the file is treated as a new
|
172
|
+
* empty file.
|
173
|
+
* - "a": Append to a file. Writing operations append data at the end of the
|
174
|
+
* file. The file is created if it does not exist.
|
175
|
+
* - "r+": Open a file for update both reading and writing. The file must
|
176
|
+
* exist.
|
177
|
+
* - "w+": Create an empty file for both reading and writing. If a file with
|
178
|
+
* the same name already exists its content is erased and the file is
|
179
|
+
* treated as a new empty file.
|
180
|
+
* - "a+": Open a file for reading and appending. All writing operations are
|
181
|
+
* performed at the end of the file, protecting the previous content to be
|
182
|
+
* overwritten. You can reposition (fseek, rewind) the internal pointer to
|
183
|
+
* anywhere in the file for reading, but writing operations will move it
|
184
|
+
* back to the end of file. The file is created if it does not exist.
|
185
|
+
*
|
186
|
+
* **NOTE**: In order to open a file as a binary file, a "b" character has to
|
187
|
+
* be included in the `mode` string. This additional "b" character can either
|
188
|
+
* be appended at the end of the string (thus making the following compound
|
189
|
+
* modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the
|
190
|
+
* letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+").
|
191
|
+
* Additional characters may follow the sequence, although they should have no
|
192
|
+
* effect. For example, "t" is sometimes appended to make explicit the file is
|
193
|
+
* a text file.
|
194
|
+
*
|
195
|
+
* This function supports Unicode filenames, but they must be encoded in UTF-8
|
196
|
+
* format, regardless of the underlying operating system.
|
197
|
+
*
|
198
|
+
* As a fallback, SDL_RWFromFile() will transparently open a matching filename
|
199
|
+
* in an Android app's `assets`.
|
200
|
+
*
|
201
|
+
* Closing the SDL_RWops will close the file handle SDL is holding internally.
|
202
|
+
*
|
203
|
+
* \param file a UTF-8 string representing the filename to open
|
204
|
+
* \param mode an ASCII string representing the mode to be used for opening
|
205
|
+
* the file.
|
206
|
+
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
|
207
|
+
* failure; call SDL_GetError() for more information.
|
208
|
+
*
|
209
|
+
* \since This function is available since SDL 2.0.0.
|
210
|
+
*
|
211
|
+
* \sa SDL_RWclose
|
212
|
+
* \sa SDL_RWFromConstMem
|
213
|
+
* \sa SDL_RWFromFP
|
214
|
+
* \sa SDL_RWFromMem
|
215
|
+
* \sa SDL_RWread
|
216
|
+
* \sa SDL_RWseek
|
217
|
+
* \sa SDL_RWtell
|
218
|
+
* \sa SDL_RWwrite
|
219
|
+
*/
|
145
220
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
|
146
221
|
const char *mode);
|
147
222
|
|
148
223
|
#ifdef HAVE_STDIO_H
|
149
|
-
|
150
|
-
|
224
|
+
|
225
|
+
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose);
|
226
|
+
|
151
227
|
#else
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Use this function to create an SDL_RWops structure from a standard I/O file
|
231
|
+
* pointer (stdio.h's `FILE*`).
|
232
|
+
*
|
233
|
+
* This function is not available on Windows, since files opened in an
|
234
|
+
* application on that platform cannot be used by a dynamically linked
|
235
|
+
* library.
|
236
|
+
*
|
237
|
+
* On some platforms, the first parameter is a `void*`, on others, it's a
|
238
|
+
* `FILE*`, depending on what system headers are available to SDL. It is
|
239
|
+
* always intended to be the `FILE*` type from the C runtime's stdio.h.
|
240
|
+
*
|
241
|
+
* \param fp the `FILE*` that feeds the SDL_RWops stream
|
242
|
+
* \param autoclose SDL_TRUE to close the `FILE*` when closing the SDL_RWops,
|
243
|
+
* SDL_FALSE to leave the `FILE*` open when the RWops is
|
244
|
+
* closed
|
245
|
+
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
|
246
|
+
* failure; call SDL_GetError() for more information.
|
247
|
+
*
|
248
|
+
* \since This function is available since SDL 2.0.0.
|
249
|
+
*
|
250
|
+
* \sa SDL_RWclose
|
251
|
+
* \sa SDL_RWFromConstMem
|
252
|
+
* \sa SDL_RWFromFile
|
253
|
+
* \sa SDL_RWFromMem
|
254
|
+
* \sa SDL_RWread
|
255
|
+
* \sa SDL_RWseek
|
256
|
+
* \sa SDL_RWtell
|
257
|
+
* \sa SDL_RWwrite
|
258
|
+
*/
|
152
259
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
|
153
260
|
SDL_bool autoclose);
|
154
261
|
#endif
|
155
262
|
|
263
|
+
/**
|
264
|
+
* Use this function to prepare a read-write memory buffer for use with
|
265
|
+
* SDL_RWops.
|
266
|
+
*
|
267
|
+
* This function sets up an SDL_RWops struct based on a memory area of a
|
268
|
+
* certain size, for both read and write access.
|
269
|
+
*
|
270
|
+
* This memory buffer is not copied by the RWops; the pointer you provide must
|
271
|
+
* remain valid until you close the stream. Closing the stream will not free
|
272
|
+
* the original buffer.
|
273
|
+
*
|
274
|
+
* If you need to make sure the RWops never writes to the memory buffer, you
|
275
|
+
* should use SDL_RWFromConstMem() with a read-only buffer of memory instead.
|
276
|
+
*
|
277
|
+
* \param mem a pointer to a buffer to feed an SDL_RWops stream
|
278
|
+
* \param size the buffer size, in bytes
|
279
|
+
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
280
|
+
* SDL_GetError() for more information.
|
281
|
+
*
|
282
|
+
* \since This function is available since SDL 2.0.0.
|
283
|
+
*
|
284
|
+
* \sa SDL_RWclose
|
285
|
+
* \sa SDL_RWFromConstMem
|
286
|
+
* \sa SDL_RWFromFile
|
287
|
+
* \sa SDL_RWFromFP
|
288
|
+
* \sa SDL_RWFromMem
|
289
|
+
* \sa SDL_RWread
|
290
|
+
* \sa SDL_RWseek
|
291
|
+
* \sa SDL_RWtell
|
292
|
+
* \sa SDL_RWwrite
|
293
|
+
*/
|
156
294
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Use this function to prepare a read-only memory buffer for use with RWops.
|
298
|
+
*
|
299
|
+
* This function sets up an SDL_RWops struct based on a memory area of a
|
300
|
+
* certain size. It assumes the memory area is not writable.
|
301
|
+
*
|
302
|
+
* Attempting to write to this RWops stream will report an error without
|
303
|
+
* writing to the memory buffer.
|
304
|
+
*
|
305
|
+
* This memory buffer is not copied by the RWops; the pointer you provide must
|
306
|
+
* remain valid until you close the stream. Closing the stream will not free
|
307
|
+
* the original buffer.
|
308
|
+
*
|
309
|
+
* If you need to write to a memory buffer, you should use SDL_RWFromMem()
|
310
|
+
* with a writable buffer of memory instead.
|
311
|
+
*
|
312
|
+
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream
|
313
|
+
* \param size the buffer size, in bytes
|
314
|
+
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
|
315
|
+
* SDL_GetError() for more information.
|
316
|
+
*
|
317
|
+
* \since This function is available since SDL 2.0.0.
|
318
|
+
*
|
319
|
+
* \sa SDL_RWclose
|
320
|
+
* \sa SDL_RWFromConstMem
|
321
|
+
* \sa SDL_RWFromFile
|
322
|
+
* \sa SDL_RWFromFP
|
323
|
+
* \sa SDL_RWFromMem
|
324
|
+
* \sa SDL_RWread
|
325
|
+
* \sa SDL_RWseek
|
326
|
+
* \sa SDL_RWtell
|
327
|
+
*/
|
157
328
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
|
158
329
|
int size);
|
159
330
|
|
160
331
|
/* @} *//* RWFrom functions */
|
161
332
|
|
162
333
|
|
334
|
+
/**
|
335
|
+
* Use this function to allocate an empty, unpopulated SDL_RWops structure.
|
336
|
+
*
|
337
|
+
* Applications do not need to use this function unless they are providing
|
338
|
+
* their own SDL_RWops implementation. If you just need a SDL_RWops to
|
339
|
+
* read/write a common data source, you should use the built-in
|
340
|
+
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc.
|
341
|
+
*
|
342
|
+
* You must free the returned pointer with SDL_FreeRW(). Depending on your
|
343
|
+
* operating system and compiler, there may be a difference between the
|
344
|
+
* malloc() and free() your program uses and the versions SDL calls
|
345
|
+
* internally. Trying to mix the two can cause crashing such as segmentation
|
346
|
+
* faults. Since all SDL_RWops must free themselves when their **close**
|
347
|
+
* method is called, all SDL_RWops must be allocated through this function, so
|
348
|
+
* they can all be freed correctly with SDL_FreeRW().
|
349
|
+
*
|
350
|
+
* \returns a pointer to the allocated memory on success, or NULL on failure;
|
351
|
+
* call SDL_GetError() for more information.
|
352
|
+
*
|
353
|
+
* \since This function is available since SDL 2.0.0.
|
354
|
+
*
|
355
|
+
* \sa SDL_FreeRW
|
356
|
+
*/
|
163
357
|
extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
|
358
|
+
|
359
|
+
/**
|
360
|
+
* Use this function to free an SDL_RWops structure allocated by
|
361
|
+
* SDL_AllocRW().
|
362
|
+
*
|
363
|
+
* Applications do not need to use this function unless they are providing
|
364
|
+
* their own SDL_RWops implementation. If you just need a SDL_RWops to
|
365
|
+
* read/write a common data source, you should use the built-in
|
366
|
+
* implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc, and
|
367
|
+
* call the **close** method on those SDL_RWops pointers when you are done
|
368
|
+
* with them.
|
369
|
+
*
|
370
|
+
* Only use SDL_FreeRW() on pointers returned by SDL_AllocRW(). The pointer is
|
371
|
+
* invalid as soon as this function returns. Any extra memory allocated during
|
372
|
+
* creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must
|
373
|
+
* be responsible for managing that memory in their **close** method.
|
374
|
+
*
|
375
|
+
* \param area the SDL_RWops structure to be freed
|
376
|
+
*
|
377
|
+
* \since This function is available since SDL 2.0.0.
|
378
|
+
*
|
379
|
+
* \sa SDL_AllocRW
|
380
|
+
*/
|
164
381
|
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
165
382
|
|
166
383
|
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
@@ -168,77 +385,218 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
|
168
385
|
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
|
169
386
|
|
170
387
|
/**
|
171
|
-
*
|
388
|
+
* Use this function to get the size of the data stream in an SDL_RWops.
|
389
|
+
*
|
390
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
391
|
+
*
|
392
|
+
* \param context the SDL_RWops to get the size of the data stream from
|
393
|
+
* \returns the size of the data stream in the SDL_RWops on success, -1 if
|
394
|
+
* unknown or a negative error code on failure; call SDL_GetError()
|
395
|
+
* for more information.
|
396
|
+
*
|
397
|
+
* \since This function is available since SDL 2.0.10.
|
172
398
|
*/
|
173
399
|
extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
|
174
400
|
|
175
401
|
/**
|
176
|
-
*
|
177
|
-
*
|
402
|
+
* Seek within an SDL_RWops data stream.
|
403
|
+
*
|
404
|
+
* This function seeks to byte `offset`, relative to `whence`.
|
405
|
+
*
|
406
|
+
* `whence` may be any of the following values:
|
407
|
+
*
|
408
|
+
* - `RW_SEEK_SET`: seek from the beginning of data
|
409
|
+
* - `RW_SEEK_CUR`: seek relative to current read point
|
410
|
+
* - `RW_SEEK_END`: seek relative to the end of data
|
411
|
+
*
|
412
|
+
* If this stream can not seek, it will return -1.
|
413
|
+
*
|
414
|
+
* SDL_RWseek() is actually a wrapper function that calls the SDL_RWops's
|
415
|
+
* `seek` method appropriately, to simplify application development.
|
178
416
|
*
|
179
|
-
*
|
417
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
418
|
+
*
|
419
|
+
* \param context a pointer to an SDL_RWops structure
|
420
|
+
* \param offset an offset in bytes, relative to **whence** location; can be
|
421
|
+
* negative
|
422
|
+
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`
|
423
|
+
* \returns the final offset in the data stream after the seek or -1 on error.
|
424
|
+
*
|
425
|
+
* \since This function is available since SDL 2.0.10.
|
426
|
+
*
|
427
|
+
* \sa SDL_RWclose
|
428
|
+
* \sa SDL_RWFromConstMem
|
429
|
+
* \sa SDL_RWFromFile
|
430
|
+
* \sa SDL_RWFromFP
|
431
|
+
* \sa SDL_RWFromMem
|
432
|
+
* \sa SDL_RWread
|
433
|
+
* \sa SDL_RWtell
|
434
|
+
* \sa SDL_RWwrite
|
180
435
|
*/
|
181
436
|
extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
|
182
437
|
Sint64 offset, int whence);
|
183
438
|
|
184
439
|
/**
|
185
|
-
*
|
440
|
+
* Determine the current read/write offset in an SDL_RWops data stream.
|
441
|
+
*
|
442
|
+
* SDL_RWtell is actually a wrapper function that calls the SDL_RWops's `seek`
|
443
|
+
* method, with an offset of 0 bytes from `RW_SEEK_CUR`, to simplify
|
444
|
+
* application development.
|
445
|
+
*
|
446
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
447
|
+
*
|
448
|
+
* \param context a SDL_RWops data stream object from which to get the current
|
449
|
+
* offset
|
450
|
+
* \returns the current offset in the stream, or -1 if the information can not
|
451
|
+
* be determined.
|
452
|
+
*
|
453
|
+
* \since This function is available since SDL 2.0.10.
|
454
|
+
*
|
455
|
+
* \sa SDL_RWclose
|
456
|
+
* \sa SDL_RWFromConstMem
|
457
|
+
* \sa SDL_RWFromFile
|
458
|
+
* \sa SDL_RWFromFP
|
459
|
+
* \sa SDL_RWFromMem
|
460
|
+
* \sa SDL_RWread
|
461
|
+
* \sa SDL_RWseek
|
462
|
+
* \sa SDL_RWwrite
|
186
463
|
*/
|
187
464
|
extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
|
188
465
|
|
189
466
|
/**
|
190
|
-
*
|
191
|
-
*
|
467
|
+
* Read from a data source.
|
468
|
+
*
|
469
|
+
* This function reads up to `maxnum` objects each of size `size` from the
|
470
|
+
* data source to the area pointed at by `ptr`. This function may read less
|
471
|
+
* objects than requested. It will return zero when there has been an error or
|
472
|
+
* the data stream is completely read.
|
473
|
+
*
|
474
|
+
* SDL_RWread() is actually a function wrapper that calls the SDL_RWops's
|
475
|
+
* `read` method appropriately, to simplify application development.
|
476
|
+
*
|
477
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
478
|
+
*
|
479
|
+
* \param context a pointer to an SDL_RWops structure
|
480
|
+
* \param ptr a pointer to a buffer to read data into
|
481
|
+
* \param size the size of each object to read, in bytes
|
482
|
+
* \param maxnum the maximum number of objects to be read
|
483
|
+
* \returns the number of objects read, or 0 at error or end of file; call
|
484
|
+
* SDL_GetError() for more information.
|
192
485
|
*
|
193
|
-
*
|
486
|
+
* \since This function is available since SDL 2.0.10.
|
487
|
+
*
|
488
|
+
* \sa SDL_RWclose
|
489
|
+
* \sa SDL_RWFromConstMem
|
490
|
+
* \sa SDL_RWFromFile
|
491
|
+
* \sa SDL_RWFromFP
|
492
|
+
* \sa SDL_RWFromMem
|
493
|
+
* \sa SDL_RWseek
|
494
|
+
* \sa SDL_RWwrite
|
194
495
|
*/
|
195
496
|
extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
|
196
|
-
void *ptr, size_t size,
|
497
|
+
void *ptr, size_t size,
|
498
|
+
size_t maxnum);
|
197
499
|
|
198
500
|
/**
|
199
|
-
*
|
200
|
-
*
|
501
|
+
* Write to an SDL_RWops data stream.
|
502
|
+
*
|
503
|
+
* This function writes exactly `num` objects each of size `size` from the
|
504
|
+
* area pointed at by `ptr` to the stream. If this fails for any reason, it'll
|
505
|
+
* return less than `num` to demonstrate how far the write progressed. On
|
506
|
+
* success, it returns `num`.
|
507
|
+
*
|
508
|
+
* SDL_RWwrite is actually a function wrapper that calls the SDL_RWops's
|
509
|
+
* `write` method appropriately, to simplify application development.
|
510
|
+
*
|
511
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
512
|
+
*
|
513
|
+
* \param context a pointer to an SDL_RWops structure
|
514
|
+
* \param ptr a pointer to a buffer containing data to write
|
515
|
+
* \param size the size of an object to write, in bytes
|
516
|
+
* \param num the number of objects to write
|
517
|
+
* \returns the number of objects written, which will be less than **num** on
|
518
|
+
* error; call SDL_GetError() for more information.
|
519
|
+
*
|
520
|
+
* \since This function is available since SDL 2.0.10.
|
201
521
|
*
|
202
|
-
*
|
522
|
+
* \sa SDL_RWclose
|
523
|
+
* \sa SDL_RWFromConstMem
|
524
|
+
* \sa SDL_RWFromFile
|
525
|
+
* \sa SDL_RWFromFP
|
526
|
+
* \sa SDL_RWFromMem
|
527
|
+
* \sa SDL_RWread
|
528
|
+
* \sa SDL_RWseek
|
203
529
|
*/
|
204
530
|
extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
|
205
|
-
const void *ptr, size_t size,
|
531
|
+
const void *ptr, size_t size,
|
532
|
+
size_t num);
|
206
533
|
|
207
534
|
/**
|
208
|
-
*
|
535
|
+
* Close and free an allocated SDL_RWops structure.
|
209
536
|
*
|
210
|
-
*
|
537
|
+
* SDL_RWclose() closes and cleans up the SDL_RWops stream. It releases any
|
538
|
+
* resources used by the stream and frees the SDL_RWops itself with
|
539
|
+
* SDL_FreeRW(). This returns 0 on success, or -1 if the stream failed to
|
540
|
+
* flush to its output (e.g. to disk).
|
541
|
+
*
|
542
|
+
* Note that if this fails to flush the stream to disk, this function reports
|
543
|
+
* an error, but the SDL_RWops is still invalid once this function returns.
|
544
|
+
*
|
545
|
+
* Prior to SDL 2.0.10, this function was a macro.
|
546
|
+
*
|
547
|
+
* \param context SDL_RWops structure to close
|
548
|
+
* \returns 0 on success or a negative error code on failure; call
|
549
|
+
* SDL_GetError() for more information.
|
550
|
+
*
|
551
|
+
* \since This function is available since SDL 2.0.10.
|
552
|
+
*
|
553
|
+
* \sa SDL_RWFromConstMem
|
554
|
+
* \sa SDL_RWFromFile
|
555
|
+
* \sa SDL_RWFromFP
|
556
|
+
* \sa SDL_RWFromMem
|
557
|
+
* \sa SDL_RWread
|
558
|
+
* \sa SDL_RWseek
|
559
|
+
* \sa SDL_RWwrite
|
211
560
|
*/
|
212
561
|
extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
|
213
562
|
|
214
563
|
/**
|
215
|
-
*
|
216
|
-
*
|
217
|
-
* The data is allocated with a zero byte at the end (null terminated)
|
564
|
+
* Load all the data from an SDL data stream.
|
218
565
|
*
|
219
|
-
*
|
566
|
+
* The data is allocated with a zero byte at the end (null terminated) for
|
567
|
+
* convenience. This extra byte is not included in the value reported via
|
568
|
+
* `datasize`.
|
220
569
|
*
|
221
|
-
*
|
570
|
+
* The data should be freed with SDL_free().
|
222
571
|
*
|
223
|
-
*
|
572
|
+
* \param src the SDL_RWops to read all available data from
|
573
|
+
* \param datasize if not NULL, will store the number of bytes read
|
574
|
+
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning
|
575
|
+
* \returns the data, or NULL if there was an error.
|
224
576
|
*
|
225
|
-
*
|
577
|
+
* \since This function is available since SDL 2.0.6.
|
226
578
|
*/
|
227
|
-
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *
|
228
|
-
|
579
|
+
extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
|
580
|
+
size_t *datasize,
|
581
|
+
int freesrc);
|
229
582
|
|
230
583
|
/**
|
231
|
-
*
|
584
|
+
* Load all the data from a file path.
|
232
585
|
*
|
233
|
-
*
|
586
|
+
* The data is allocated with a zero byte at the end (null terminated) for
|
587
|
+
* convenience. This extra byte is not included in the value reported via
|
588
|
+
* `datasize`.
|
234
589
|
*
|
235
|
-
*
|
590
|
+
* The data should be freed with SDL_free().
|
236
591
|
*
|
237
|
-
*
|
592
|
+
* Prior to SDL 2.0.10, this function was a macro wrapping around
|
593
|
+
* SDL_LoadFile_RW.
|
238
594
|
*
|
239
|
-
*
|
595
|
+
* \param file the path to read all available data from
|
596
|
+
* \param datasize if not NULL, will store the number of bytes read
|
597
|
+
* \returns the data, or NULL if there was an error.
|
240
598
|
*
|
241
|
-
*
|
599
|
+
* \since This function is available since SDL 2.0.10.
|
242
600
|
*/
|
243
601
|
extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
244
602
|
|
@@ -248,12 +606,114 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
|
|
248
606
|
* Read an item of the specified endianness and return in native format.
|
249
607
|
*/
|
250
608
|
/* @{ */
|
609
|
+
|
610
|
+
/**
|
611
|
+
* Use this function to read a byte from an SDL_RWops.
|
612
|
+
*
|
613
|
+
* \param src the SDL_RWops to read from
|
614
|
+
* \returns the read byte on success or 0 on failure; call SDL_GetError() for
|
615
|
+
* more information.
|
616
|
+
*
|
617
|
+
* \since This function is available since SDL 2.0.0.
|
618
|
+
*
|
619
|
+
* \sa SDL_WriteU8
|
620
|
+
*/
|
251
621
|
extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
|
622
|
+
|
623
|
+
/**
|
624
|
+
* Use this function to read 16 bits of little-endian data from an SDL_RWops
|
625
|
+
* and return in native format.
|
626
|
+
*
|
627
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
628
|
+
* the native byte order.
|
629
|
+
*
|
630
|
+
* \param src the stream from which to read data
|
631
|
+
* \returns 16 bits of data in the native byte order of the platform.
|
632
|
+
*
|
633
|
+
* \since This function is available since SDL 2.0.0.
|
634
|
+
*
|
635
|
+
* \sa SDL_ReadBE16
|
636
|
+
*/
|
252
637
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
|
638
|
+
|
639
|
+
/**
|
640
|
+
* Use this function to read 16 bits of big-endian data from an SDL_RWops and
|
641
|
+
* return in native format.
|
642
|
+
*
|
643
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
644
|
+
* the native byte order.
|
645
|
+
*
|
646
|
+
* \param src the stream from which to read data
|
647
|
+
* \returns 16 bits of data in the native byte order of the platform.
|
648
|
+
*
|
649
|
+
* \since This function is available since SDL 2.0.0.
|
650
|
+
*
|
651
|
+
* \sa SDL_ReadLE16
|
652
|
+
*/
|
253
653
|
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
|
654
|
+
|
655
|
+
/**
|
656
|
+
* Use this function to read 32 bits of little-endian data from an SDL_RWops
|
657
|
+
* and return in native format.
|
658
|
+
*
|
659
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
660
|
+
* the native byte order.
|
661
|
+
*
|
662
|
+
* \param src the stream from which to read data
|
663
|
+
* \returns 32 bits of data in the native byte order of the platform.
|
664
|
+
*
|
665
|
+
* \since This function is available since SDL 2.0.0.
|
666
|
+
*
|
667
|
+
* \sa SDL_ReadBE32
|
668
|
+
*/
|
254
669
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
|
670
|
+
|
671
|
+
/**
|
672
|
+
* Use this function to read 32 bits of big-endian data from an SDL_RWops and
|
673
|
+
* return in native format.
|
674
|
+
*
|
675
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
676
|
+
* the native byte order.
|
677
|
+
*
|
678
|
+
* \param src the stream from which to read data
|
679
|
+
* \returns 32 bits of data in the native byte order of the platform.
|
680
|
+
*
|
681
|
+
* \since This function is available since SDL 2.0.0.
|
682
|
+
*
|
683
|
+
* \sa SDL_ReadLE32
|
684
|
+
*/
|
255
685
|
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
|
686
|
+
|
687
|
+
/**
|
688
|
+
* Use this function to read 64 bits of little-endian data from an SDL_RWops
|
689
|
+
* and return in native format.
|
690
|
+
*
|
691
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
692
|
+
* the native byte order.
|
693
|
+
*
|
694
|
+
* \param src the stream from which to read data
|
695
|
+
* \returns 64 bits of data in the native byte order of the platform.
|
696
|
+
*
|
697
|
+
* \since This function is available since SDL 2.0.0.
|
698
|
+
*
|
699
|
+
* \sa SDL_ReadBE64
|
700
|
+
*/
|
256
701
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
|
702
|
+
|
703
|
+
/**
|
704
|
+
* Use this function to read 64 bits of big-endian data from an SDL_RWops and
|
705
|
+
* return in native format.
|
706
|
+
*
|
707
|
+
* SDL byteswaps the data only if necessary, so the data returned will be in
|
708
|
+
* the native byte order.
|
709
|
+
*
|
710
|
+
* \param src the stream from which to read data
|
711
|
+
* \returns 64 bits of data in the native byte order of the platform.
|
712
|
+
*
|
713
|
+
* \since This function is available since SDL 2.0.0.
|
714
|
+
*
|
715
|
+
* \sa SDL_ReadLE64
|
716
|
+
*/
|
257
717
|
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
258
718
|
/* @} *//* Read endian functions */
|
259
719
|
|
@@ -263,12 +723,124 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
|
|
263
723
|
* Write an item of native format to the specified endianness.
|
264
724
|
*/
|
265
725
|
/* @{ */
|
726
|
+
|
727
|
+
/**
|
728
|
+
* Use this function to write a byte to an SDL_RWops.
|
729
|
+
*
|
730
|
+
* \param dst the SDL_RWops to write to
|
731
|
+
* \param value the byte value to write
|
732
|
+
* \returns 1 on success or 0 on failure; call SDL_GetError() for more
|
733
|
+
* information.
|
734
|
+
*
|
735
|
+
* \since This function is available since SDL 2.0.0.
|
736
|
+
*
|
737
|
+
* \sa SDL_ReadU8
|
738
|
+
*/
|
266
739
|
extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
|
740
|
+
|
741
|
+
/**
|
742
|
+
* Use this function to write 16 bits in native format to a SDL_RWops as
|
743
|
+
* little-endian data.
|
744
|
+
*
|
745
|
+
* SDL byteswaps the data only if necessary, so the application always
|
746
|
+
* specifies native format, and the data written will be in little-endian
|
747
|
+
* format.
|
748
|
+
*
|
749
|
+
* \param dst the stream to which data will be written
|
750
|
+
* \param value the data to be written, in native format
|
751
|
+
* \returns 1 on successful write, 0 on error.
|
752
|
+
*
|
753
|
+
* \since This function is available since SDL 2.0.0.
|
754
|
+
*
|
755
|
+
* \sa SDL_WriteBE16
|
756
|
+
*/
|
267
757
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
|
758
|
+
|
759
|
+
/**
|
760
|
+
* Use this function to write 16 bits in native format to a SDL_RWops as
|
761
|
+
* big-endian data.
|
762
|
+
*
|
763
|
+
* SDL byteswaps the data only if necessary, so the application always
|
764
|
+
* specifies native format, and the data written will be in big-endian format.
|
765
|
+
*
|
766
|
+
* \param dst the stream to which data will be written
|
767
|
+
* \param value the data to be written, in native format
|
768
|
+
* \returns 1 on successful write, 0 on error.
|
769
|
+
*
|
770
|
+
* \since This function is available since SDL 2.0.0.
|
771
|
+
*
|
772
|
+
* \sa SDL_WriteLE16
|
773
|
+
*/
|
268
774
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
|
775
|
+
|
776
|
+
/**
|
777
|
+
* Use this function to write 32 bits in native format to a SDL_RWops as
|
778
|
+
* little-endian data.
|
779
|
+
*
|
780
|
+
* SDL byteswaps the data only if necessary, so the application always
|
781
|
+
* specifies native format, and the data written will be in little-endian
|
782
|
+
* format.
|
783
|
+
*
|
784
|
+
* \param dst the stream to which data will be written
|
785
|
+
* \param value the data to be written, in native format
|
786
|
+
* \returns 1 on successful write, 0 on error.
|
787
|
+
*
|
788
|
+
* \since This function is available since SDL 2.0.0.
|
789
|
+
*
|
790
|
+
* \sa SDL_WriteBE32
|
791
|
+
*/
|
269
792
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
|
793
|
+
|
794
|
+
/**
|
795
|
+
* Use this function to write 32 bits in native format to a SDL_RWops as
|
796
|
+
* big-endian data.
|
797
|
+
*
|
798
|
+
* SDL byteswaps the data only if necessary, so the application always
|
799
|
+
* specifies native format, and the data written will be in big-endian format.
|
800
|
+
*
|
801
|
+
* \param dst the stream to which data will be written
|
802
|
+
* \param value the data to be written, in native format
|
803
|
+
* \returns 1 on successful write, 0 on error.
|
804
|
+
*
|
805
|
+
* \since This function is available since SDL 2.0.0.
|
806
|
+
*
|
807
|
+
* \sa SDL_WriteLE32
|
808
|
+
*/
|
270
809
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
|
810
|
+
|
811
|
+
/**
|
812
|
+
* Use this function to write 64 bits in native format to a SDL_RWops as
|
813
|
+
* little-endian data.
|
814
|
+
*
|
815
|
+
* SDL byteswaps the data only if necessary, so the application always
|
816
|
+
* specifies native format, and the data written will be in little-endian
|
817
|
+
* format.
|
818
|
+
*
|
819
|
+
* \param dst the stream to which data will be written
|
820
|
+
* \param value the data to be written, in native format
|
821
|
+
* \returns 1 on successful write, 0 on error.
|
822
|
+
*
|
823
|
+
* \since This function is available since SDL 2.0.0.
|
824
|
+
*
|
825
|
+
* \sa SDL_WriteBE64
|
826
|
+
*/
|
271
827
|
extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
|
828
|
+
|
829
|
+
/**
|
830
|
+
* Use this function to write 64 bits in native format to a SDL_RWops as
|
831
|
+
* big-endian data.
|
832
|
+
*
|
833
|
+
* SDL byteswaps the data only if necessary, so the application always
|
834
|
+
* specifies native format, and the data written will be in big-endian format.
|
835
|
+
*
|
836
|
+
* \param dst the stream to which data will be written
|
837
|
+
* \param value the data to be written, in native format
|
838
|
+
* \returns 1 on successful write, 0 on error.
|
839
|
+
*
|
840
|
+
* \since This function is available since SDL 2.0.0.
|
841
|
+
*
|
842
|
+
* \sa SDL_WriteLE64
|
843
|
+
*/
|
272
844
|
extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
|
273
845
|
/* @} *//* Write endian functions */
|
274
846
|
|