gosu 0.14.6.pre1 → 1.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/COPYING +1 -1
- data/dependencies/SDL/include/SDL.h +138 -0
- data/dependencies/SDL/include/SDL_assert.h +293 -0
- data/dependencies/SDL/include/SDL_atomic.h +295 -0
- data/dependencies/SDL/include/SDL_audio.h +859 -0
- data/dependencies/SDL/include/SDL_bits.h +121 -0
- data/dependencies/SDL/include/SDL_blendmode.h +123 -0
- data/dependencies/SDL/include/SDL_clipboard.h +71 -0
- data/dependencies/SDL/include/SDL_config.h +55 -0
- data/dependencies/SDL/include/SDL_config_android.h +182 -0
- data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
- data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
- data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
- data/dependencies/SDL/include/SDL_config_os2.h +188 -0
- data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
- data/dependencies/SDL/include/SDL_config_psp.h +165 -0
- data/dependencies/SDL/include/SDL_config_windows.h +288 -0
- data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
- data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
- data/dependencies/SDL/include/SDL_copying.h +20 -0
- data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
- data/dependencies/SDL/include/SDL_egl.h +1676 -0
- data/dependencies/SDL/include/SDL_endian.h +263 -0
- data/dependencies/SDL/include/SDL_error.h +112 -0
- data/dependencies/SDL/include/SDL_events.h +827 -0
- data/dependencies/SDL/include/SDL_filesystem.h +136 -0
- data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
- data/dependencies/SDL/include/SDL_gesture.h +87 -0
- data/dependencies/SDL/include/SDL_haptic.h +1247 -0
- data/dependencies/SDL/include/SDL_hints.h +1578 -0
- data/dependencies/SDL/include/SDL_joystick.h +499 -0
- data/dependencies/SDL/include/SDL_keyboard.h +217 -0
- data/dependencies/SDL/include/SDL_keycode.h +351 -0
- data/dependencies/SDL/include/SDL_loadso.h +81 -0
- data/dependencies/SDL/include/SDL_locale.h +101 -0
- data/dependencies/SDL/include/SDL_log.h +211 -0
- data/dependencies/SDL/include/SDL_main.h +180 -0
- data/dependencies/SDL/include/SDL_messagebox.h +146 -0
- data/dependencies/SDL/include/SDL_metal.h +117 -0
- data/dependencies/SDL/include/SDL_misc.h +75 -0
- data/dependencies/SDL/include/SDL_mouse.h +302 -0
- data/dependencies/SDL/include/SDL_mutex.h +251 -0
- data/dependencies/SDL/include/SDL_name.h +33 -0
- data/dependencies/SDL/include/SDL_opengl.h +2183 -0
- data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
- data/dependencies/SDL/include/SDL_opengles.h +39 -0
- data/dependencies/SDL/include/SDL_opengles2.h +52 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
- data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
- data/dependencies/SDL/include/SDL_pixels.h +479 -0
- data/dependencies/SDL/include/SDL_platform.h +198 -0
- data/dependencies/SDL/include/SDL_power.h +75 -0
- data/dependencies/SDL/include/SDL_quit.h +58 -0
- data/dependencies/SDL/include/SDL_rect.h +174 -0
- data/dependencies/SDL/include/SDL_render.h +1158 -0
- data/dependencies/SDL/include/SDL_revision.h +2 -0
- data/dependencies/SDL/include/SDL_rwops.h +283 -0
- data/dependencies/SDL/include/SDL_scancode.h +413 -0
- data/dependencies/SDL/include/SDL_sensor.h +267 -0
- data/dependencies/SDL/include/SDL_shape.h +144 -0
- data/dependencies/SDL/include/SDL_stdinc.h +647 -0
- data/dependencies/SDL/include/SDL_surface.h +563 -0
- data/dependencies/SDL/include/SDL_system.h +325 -0
- data/dependencies/SDL/include/SDL_syswm.h +354 -0
- data/dependencies/SDL/include/SDL_test.h +69 -0
- data/dependencies/SDL/include/SDL_test_assert.h +105 -0
- data/dependencies/SDL/include/SDL_test_common.h +218 -0
- data/dependencies/SDL/include/SDL_test_compare.h +69 -0
- data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
- data/dependencies/SDL/include/SDL_test_font.h +81 -0
- data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
- data/dependencies/SDL/include/SDL_test_harness.h +134 -0
- data/dependencies/SDL/include/SDL_test_images.h +78 -0
- data/dependencies/SDL/include/SDL_test_log.h +67 -0
- data/dependencies/SDL/include/SDL_test_md5.h +129 -0
- data/dependencies/SDL/include/SDL_test_memory.h +63 -0
- data/dependencies/SDL/include/SDL_test_random.h +115 -0
- data/dependencies/SDL/include/SDL_thread.h +366 -0
- data/dependencies/SDL/include/SDL_timer.h +115 -0
- data/dependencies/SDL/include/SDL_touch.h +102 -0
- data/dependencies/SDL/include/SDL_types.h +29 -0
- data/dependencies/SDL/include/SDL_version.h +162 -0
- data/dependencies/SDL/include/SDL_video.h +1282 -0
- data/dependencies/SDL/include/SDL_vulkan.h +276 -0
- data/dependencies/SDL/include/begin_code.h +166 -0
- data/dependencies/SDL/include/close_code.h +40 -0
- 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 +795 -0
- data/dependencies/SDL_sound/SDL_sound.h +725 -0
- data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
- data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
- data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
- data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
- data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
- data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
- data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
- data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
- data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
- data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
- data/dependencies/SDL_sound/dr_flac.h +5906 -0
- data/dependencies/SDL_sound/dr_mp3.h +2832 -0
- data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
- data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
- data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
- data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
- data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
- data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
- data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
- data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
- data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
- data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
- data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
- data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
- data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
- data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
- data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
- data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
- data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
- data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
- data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
- data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
- data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
- data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
- data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +128 -23
- data/dependencies/al_soft/AL/al.h +655 -0
- data/dependencies/al_soft/AL/alc.h +270 -0
- data/dependencies/al_soft/AL/alext.h +585 -0
- data/dependencies/al_soft/AL/efx-creative.h +3 -0
- data/dependencies/al_soft/AL/efx-presets.h +402 -0
- data/dependencies/al_soft/AL/efx.h +762 -0
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/{src → dependencies/stb}/stb_image.h +476 -176
- data/{src → dependencies/stb}/stb_image_write.h +253 -131
- data/{src → dependencies/stb}/stb_truetype.h +262 -104
- data/{src → dependencies/utf8proc}/utf8proc.c +47 -29
- data/{src → dependencies/utf8proc}/utf8proc.h +46 -24
- data/{src → dependencies/utf8proc}/utf8proc_data.h +10043 -9609
- data/ext/gosu/extconf.rb +53 -39
- data/{Gosu → include/Gosu}/Audio.hpp +6 -8
- data/include/Gosu/Bitmap.hpp +100 -0
- data/{Gosu → include/Gosu}/Buttons.hpp +104 -44
- data/include/Gosu/Channel.h +25 -0
- data/include/Gosu/Color.h +38 -0
- data/{Gosu → include/Gosu}/Color.hpp +0 -0
- data/{Gosu → include/Gosu}/Directories.hpp +0 -0
- data/include/Gosu/Font.h +36 -0
- data/{Gosu → include/Gosu}/Font.hpp +0 -0
- data/{Gosu → include/Gosu}/Fwd.hpp +0 -5
- data/include/Gosu/Gosu.h +82 -0
- data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
- data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
- data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
- data/{Gosu → include/Gosu}/IO.hpp +0 -0
- data/include/Gosu/Image.h +54 -0
- data/{Gosu → include/Gosu}/Image.hpp +7 -6
- data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
- data/{Gosu → include/Gosu}/Input.hpp +39 -51
- data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
- data/{Gosu → include/Gosu}/Math.hpp +0 -0
- data/{Gosu → include/Gosu}/Platform.hpp +0 -0
- data/include/Gosu/Sample.h +19 -0
- data/include/Gosu/Song.h +24 -0
- data/{Gosu → include/Gosu}/Text.hpp +0 -0
- data/include/Gosu/TextInput.h +30 -0
- data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
- data/{Gosu → include/Gosu}/Timing.hpp +0 -0
- data/{Gosu → include/Gosu}/Utility.hpp +15 -4
- data/{Gosu → include/Gosu}/Version.hpp +3 -3
- data/include/Gosu/Window.h +63 -0
- data/{Gosu → include/Gosu}/Window.hpp +23 -25
- data/lib/OpenAL32.dll +0 -0
- data/lib/SDL2.dll +0 -0
- data/lib/gosu.rb +0 -3
- data/lib/gosu/compat.rb +9 -4
- data/lib/gosu/patches.rb +8 -11
- data/lib/gosu/swig_patches.rb +13 -6
- data/lib64/OpenAL32.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +114 -21
- data/src/Audio.cpp +50 -224
- data/src/AudioFile.hpp +20 -37
- data/src/AudioFileAudioToolbox.cpp +237 -0
- data/src/AudioFileSDLSound.cpp +147 -0
- data/src/AudioImpl.cpp +3 -12
- data/src/AudioImpl.hpp +3 -1
- data/src/Bitmap.cpp +85 -83
- data/src/BitmapIO.cpp +52 -58
- data/src/ChannelWrapper.cpp +50 -0
- data/src/ColorWrapper.cpp +126 -0
- data/src/Constants.cpp +338 -0
- data/src/Font.cpp +4 -1
- data/src/FontWrapper.cpp +74 -0
- data/src/GosuWrapper.cpp +251 -0
- data/src/Graphics.cpp +11 -5
- data/src/GraphicsImpl.hpp +0 -1
- data/src/Image.cpp +13 -16
- data/src/ImageWrapper.cpp +168 -0
- data/src/Input.cpp +412 -164
- data/src/LargeImageData.cpp +2 -1
- data/src/MarkupParser.cpp +13 -4
- data/src/RubyGosu.cxx +502 -219
- data/src/RubyGosu.h +4 -2
- data/src/SampleWrapper.cpp +30 -0
- data/src/SongWrapper.cpp +52 -0
- data/src/TexChunk.cpp +29 -19
- data/src/Text.cpp +2 -0
- data/src/TextBuilder.cpp +6 -4
- data/src/TextInputWrapper.cpp +101 -0
- data/src/Texture.cpp +1 -1
- data/src/TrueTypeFont.cpp +2 -1
- data/src/Utility.cpp +11 -7
- data/src/Window.cpp +30 -39
- data/src/WindowWrapper.cpp +317 -0
- metadata +212 -42
- data/Gosu/AutoLink.hpp +0 -14
- data/Gosu/Bitmap.hpp +0 -113
- data/src/AudioToolboxFile.hpp +0 -210
- data/src/OggFile.hpp +0 -92
- data/src/SndFile.hpp +0 -174
- data/src/WinMain.cpp +0 -64
data/lib64/OpenAL32.dll
ADDED
Binary file
|
data/lib64/SDL2.dll
ADDED
Binary file
|
data/rdoc/gosu.rb
CHANGED
@@ -32,6 +32,10 @@ module Gosu
|
|
32
32
|
KB_DOWN = :an_integer
|
33
33
|
KB_END = :an_integer
|
34
34
|
|
35
|
+
KB_PRINT_SCREEN = :an_integer
|
36
|
+
KB_SCROLL_LOCK = :an_integer
|
37
|
+
KB_PAUSE = :an_integer
|
38
|
+
|
35
39
|
##
|
36
40
|
# This is the key on the numpad.
|
37
41
|
KB_ENTER = :an_integer
|
@@ -71,6 +75,7 @@ module Gosu
|
|
71
75
|
KB_RIGHT_SHIFT = :an_integer
|
72
76
|
KB_SEMICOLON = :an_integer
|
73
77
|
KB_SLASH = :an_integer
|
78
|
+
KB_CAPS_LOCK = :an_integer
|
74
79
|
KB_SPACE = :an_integer
|
75
80
|
KB_TAB = :an_integer
|
76
81
|
KB_UP = :an_integer
|
@@ -83,12 +88,32 @@ module Gosu
|
|
83
88
|
MS_OTHER_0…MS_OTHER_7 = :an_integer
|
84
89
|
|
85
90
|
GP_BUTTON_0…GP_BUTTON_15 = :an_integer
|
91
|
+
GP_LEFT_STICK_X_AXIS = :an_integer
|
92
|
+
GP_RIGHT_STICK_X_AXIS = :an_integer
|
93
|
+
GP_LEFT_STICK_Y_AXIS = :an_integer
|
94
|
+
GP_RIGHT_STICK_Y_AXIS = :an_integer
|
95
|
+
GP_LEFT_TRIGGER_AXIS = :an_integer
|
96
|
+
GP_RIGHT_TRIGGER_AXIS = :an_integer
|
97
|
+
GP_DPAD_DOWN = :an_integer
|
98
|
+
GP_DPAD_LEFT = :an_integer
|
99
|
+
GP_DPAD_RIGHT = :an_integer
|
100
|
+
GP_DPAD_UP = :an_integer
|
86
101
|
GP_DOWN = :an_integer
|
87
102
|
GP_LEFT = :an_integer
|
88
103
|
GP_RIGHT = :an_integer
|
89
104
|
GP_UP = :an_integer
|
90
105
|
|
91
106
|
GP_0_BUTTON_0…GP_3_BUTTON_15 = :an_integer
|
107
|
+
GP_0_LEFT_STICK_X_AXIS…GP_3_LEFT_STICK_X_AXIS = :an_integer
|
108
|
+
GP_0_RIGHT_STICK_X_AXIS…GP_3_RIGHT_STICK_X_AXIS = :an_integer
|
109
|
+
GP_0_LEFT_STICK_Y_AXIS…GP_3_LEFT_STICK_Y_AXIS = :an_integer
|
110
|
+
GP_0_RIGHT_STICK_Y_AXIS…GP_3_RIGHT_STICK_Y_AXIS = :an_integer
|
111
|
+
GP_0_LEFT_TRIGGER_AXIS…GP_3_LEFT_TRIGGER_AXIS = :an_integer
|
112
|
+
GP_0_RIGHT_TRIGGER_AXIS…GP_3_RIGHT_TRIGGER_AXIS = :an_integer
|
113
|
+
GP_0_DPAD_DOWN…GP_3_DPAD_DOWN = :an_integer
|
114
|
+
GP_0_DPAD_LEFT…GP_3_DPAD_LEFT = :an_integer
|
115
|
+
GP_0_DPAD_RIGHT…GP_3_DPAD_RIGHT = :an_integer
|
116
|
+
GP_0_DPAD_UP…GP_3_DPAD_UP = :an_integer
|
92
117
|
GP_0_DOWN…GP_3_DOWN = :an_integer
|
93
118
|
GP_0_LEFT…GP_3_LEFT = :an_integer
|
94
119
|
GP_0_RIGHT…GP_3_RIGHT = :an_integer
|
@@ -190,11 +215,20 @@ module Gosu
|
|
190
215
|
|
191
216
|
# @!endgroup
|
192
217
|
|
193
|
-
|
218
|
+
##
|
219
|
+
# @return [Integer] a 32-bit representation of the color in 0xAARRGGBB format.
|
220
|
+
def argb; end
|
221
|
+
|
222
|
+
alias_method :to_i, :argb
|
223
|
+
|
224
|
+
# Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed format in memory and its integer value may vary depending on your system's byte order.
|
194
225
|
#
|
195
226
|
# @return [Integer] a 32-bit OpenGL color.
|
196
227
|
def gl; end
|
197
228
|
|
229
|
+
# Returns an OpenGL integer constant that identifies the RGBA color format that Gosu uses.
|
230
|
+
GL_FORMAT = :some_integer
|
231
|
+
|
198
232
|
##
|
199
233
|
# @return [Color] a copy of the color.
|
200
234
|
def dup; end
|
@@ -307,7 +341,7 @@ module Gosu
|
|
307
341
|
# @return [Integer] the width of the text, in pixels.
|
308
342
|
# @param text [String]
|
309
343
|
def text_width(text, scale_x=1); end
|
310
|
-
|
344
|
+
|
311
345
|
##
|
312
346
|
# Like {#text_width}, but supports the following markup tags: `<b>bold</b>`, `<i>italic</i>`, `<c=rrggbb>colors</c>`.
|
313
347
|
def markup_width(markup, scale_x=1); end
|
@@ -348,6 +382,14 @@ module Gosu
|
|
348
382
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki
|
349
383
|
def initialize(source, options = {}); end
|
350
384
|
|
385
|
+
##
|
386
|
+
# Creates a new image with the given dimensions and RGBA pixel data.
|
387
|
+
#
|
388
|
+
# @param [Integer] width Width of the image in pixels.
|
389
|
+
# @param [Integer] height Height of the image in pixels.
|
390
|
+
# @param [String] rgba A string containing raw binary image data, with either one byte ('uint8') or four bytes ('float') per RGBA component.
|
391
|
+
def self.from_blob(width, height, rgba = "\0\0\0\0" * (width * height)); end
|
392
|
+
|
351
393
|
##
|
352
394
|
# Creates a reusable image from one or more lines of text.
|
353
395
|
#
|
@@ -403,13 +445,13 @@ module Gosu
|
|
403
445
|
|
404
446
|
##
|
405
447
|
# Returns an image that is a smaller, rectangular view of this {Image}.
|
406
|
-
#
|
448
|
+
#
|
407
449
|
# This is a very fast operation, and no new textures will be allocated.
|
408
450
|
# If you update this {Image} or the {#subimage} using {#insert}, the other {Image} will be affected as well.
|
409
|
-
#
|
451
|
+
#
|
410
452
|
# Caveats:
|
411
453
|
# * If you stretch or rotate a {#subimage}, the pixels adjacent to it might bleed into it, as Gosu does not manage the 'tileability' of subimages.
|
412
|
-
#
|
454
|
+
#
|
413
455
|
# @return [Image?] an image that represents a portion of the containing image
|
414
456
|
def subimage(left, top, width, height); end
|
415
457
|
|
@@ -433,7 +475,7 @@ module Gosu
|
|
433
475
|
# @see #draw_as_quad
|
434
476
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki
|
435
477
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki
|
436
|
-
def draw(x, y, z, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end
|
478
|
+
def draw(x, y, z=0, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end
|
437
479
|
|
438
480
|
##
|
439
481
|
# Draws the image rotated, with its rotational center at (x, y).
|
@@ -447,7 +489,7 @@ module Gosu
|
|
447
489
|
# @see #draw
|
448
490
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki
|
449
491
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki
|
450
|
-
def draw_rot(x, y, z, angle, center_x=0.5, center_y=0.5, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end
|
492
|
+
def draw_rot(x, y, z=0, angle=0, center_x=0.5, center_y=0.5, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end
|
451
493
|
|
452
494
|
##
|
453
495
|
# Draws the image as an arbitrary quad. This method can be used for advanced non-rectangular drawing techniques, e.g., faking perspective or isometric projection.
|
@@ -559,16 +601,16 @@ module Gosu
|
|
559
601
|
# @param [Float]
|
560
602
|
# @return [Float]
|
561
603
|
attr_writer :volume
|
562
|
-
|
604
|
+
|
563
605
|
##
|
564
606
|
# Sets the playback speed. A value of 2.0 will play the sample at 200% speed and one octave higher. A value of 0.5 will play the sample at 50% speed and one octave lower. The valid range of this property depends on the operating system, but values up to 8.0 should work.
|
565
|
-
# @param [Float]
|
607
|
+
# @param [Float]
|
566
608
|
# @return [Float]
|
567
609
|
attr_writer :speed
|
568
|
-
|
610
|
+
|
569
611
|
##
|
570
612
|
# Set the amount of panning, i.e. the position of the sound when using stereo speakers. 0.0 is the centre, negative values are to the left, positive values are to the right. If something happens on the edge of the screen, a good value for pan would be ±0.1.
|
571
|
-
# @param [Float]
|
613
|
+
# @param [Float]
|
572
614
|
# @return [Float]
|
573
615
|
attr_writer :pan
|
574
616
|
|
@@ -764,7 +806,7 @@ module Gosu
|
|
764
806
|
##
|
765
807
|
# Toggles between windowed mode and fullscreen.
|
766
808
|
attr_writer :fullscreen
|
767
|
-
|
809
|
+
|
768
810
|
##
|
769
811
|
# @return [true, false] whether this window is resizable.
|
770
812
|
def resizable?; end
|
@@ -778,7 +820,7 @@ module Gosu
|
|
778
820
|
#
|
779
821
|
# Resizable fullscreen windows always use the full desktop resolution.
|
780
822
|
# Windows that are larger than the desktop resolution will be shrunk.
|
781
|
-
#
|
823
|
+
#
|
782
824
|
# @overload initialize(width, height, options = {})
|
783
825
|
# @overload initialize(width, height, fullscreen, update_interval = 16.666666)
|
784
826
|
#
|
@@ -795,18 +837,18 @@ module Gosu
|
|
795
837
|
#
|
796
838
|
# @return [void]
|
797
839
|
def show; end
|
798
|
-
|
840
|
+
|
799
841
|
##
|
800
842
|
# EXPERIMENTAL - MAY DISAPPEAR WITHOUT WARNING.
|
801
|
-
#
|
843
|
+
#
|
802
844
|
# Performs a single step in the main loop.
|
803
845
|
# This can be useful for integrating Gosu with other libraries that have their own main loop, e.g. Ruby/Tk.
|
804
|
-
#
|
846
|
+
#
|
805
847
|
# See: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1218
|
806
|
-
#
|
848
|
+
#
|
807
849
|
# If you find a good way to use {#tick}, please let us know on the forum and we can make this a part of Gosu's stable interface.
|
808
850
|
# Thank you!
|
809
|
-
#
|
851
|
+
#
|
810
852
|
# @return [true, false] whether the {Window} should still be shown after this tick
|
811
853
|
def tick; end
|
812
854
|
|
@@ -833,7 +875,7 @@ module Gosu
|
|
833
875
|
def draw; end
|
834
876
|
|
835
877
|
##
|
836
|
-
# This method can be
|
878
|
+
# This method can be overridden to give the game a chance to opt out of a call to {#draw}; however, the operating system can still force a redraw for any reason.
|
837
879
|
#
|
838
880
|
# @return [true, false] whether the window needs to be redrawn.
|
839
881
|
#
|
@@ -841,7 +883,8 @@ module Gosu
|
|
841
883
|
def needs_redraw?; end
|
842
884
|
|
843
885
|
##
|
844
|
-
# This method can be
|
886
|
+
# This method can be overridden to control the visibility of the system cursor over your window.
|
887
|
+
# The base class implementation returns true.
|
845
888
|
#
|
846
889
|
# @return [true, false] whether the system cursor should be shown.
|
847
890
|
def needs_cursor?; end
|
@@ -854,7 +897,7 @@ module Gosu
|
|
854
897
|
#
|
855
898
|
# @return [bool]
|
856
899
|
def close; end
|
857
|
-
|
900
|
+
|
858
901
|
##
|
859
902
|
# This method is called before {#update} if a button is pressed while the window has focus.
|
860
903
|
#
|
@@ -886,6 +929,24 @@ module Gosu
|
|
886
929
|
# @param filename [String] the filename of the dropped file. When multiple files are dropped, this method will be called several times.
|
887
930
|
def drop(filename); end
|
888
931
|
|
932
|
+
##
|
933
|
+
# Called when a gamepad is connected.
|
934
|
+
# If a gamepad is momentarily disconnected and then reconnected, before another gamepad, it will have the same index.
|
935
|
+
#
|
936
|
+
# @param index [integer] index for looking up gamepad.
|
937
|
+
#
|
938
|
+
# @see Gosu.gamepad_name
|
939
|
+
def gamepad_connected(index); end
|
940
|
+
|
941
|
+
##
|
942
|
+
# Called when a gamepad is disconnected.
|
943
|
+
#
|
944
|
+
# @param index [integer] index for looking up gamepad.
|
945
|
+
#
|
946
|
+
# @see #gamepad_connected
|
947
|
+
# @see Gosu.gamepad_name
|
948
|
+
def gamepad_disconnected(index); end
|
949
|
+
|
889
950
|
# @!endgroup
|
890
951
|
end
|
891
952
|
|
@@ -928,6 +989,38 @@ module Gosu
|
|
928
989
|
# @see Window#button_up
|
929
990
|
def button_down?(id); end
|
930
991
|
|
992
|
+
##
|
993
|
+
# Returns the name of a Gosu::KB_{*} constant. Returns nil if no name is found.
|
994
|
+
#
|
995
|
+
# @example
|
996
|
+
# Gosu.button_name(Gosu::KB_SPACE) #=> "Space"
|
997
|
+
#
|
998
|
+
# @return [String, nil]
|
999
|
+
# @param id [Integer]
|
1000
|
+
#
|
1001
|
+
def button_name(id); end
|
1002
|
+
|
1003
|
+
##
|
1004
|
+
# Returns the name for gamepad at `index` or nil if there is no connected at the specified index.
|
1005
|
+
#
|
1006
|
+
# @example
|
1007
|
+
# Gosu.gamepad_name(0) #=> "PS4 Controller"
|
1008
|
+
#
|
1009
|
+
# @return [String, nil]
|
1010
|
+
# @param index [Integer]
|
1011
|
+
def gamepad_name(index); end
|
1012
|
+
|
1013
|
+
##
|
1014
|
+
# Returns the value for the specified gamepad axis in the range -1.0..1.0 for joysticks and 0.0..1.0 for triggers.
|
1015
|
+
#
|
1016
|
+
# @example
|
1017
|
+
# Gosu.axis(Gosu::GP_0_LEFT_STICK_Y_AXIS) #=> 0.75
|
1018
|
+
#
|
1019
|
+
# @return [Float]
|
1020
|
+
# @param id [Integer]
|
1021
|
+
#
|
1022
|
+
def axis(id); end
|
1023
|
+
|
931
1024
|
# @!group Drawing primitives
|
932
1025
|
|
933
1026
|
##
|
data/src/Audio.cpp
CHANGED
@@ -1,51 +1,25 @@
|
|
1
1
|
#include "AudioImpl.hpp"
|
2
|
-
#include "
|
2
|
+
#include "AudioFile.hpp"
|
3
|
+
|
3
4
|
#include <Gosu/Audio.hpp>
|
4
5
|
#include <Gosu/Math.hpp>
|
5
6
|
#include <Gosu/IO.hpp>
|
6
7
|
#include <Gosu/Platform.hpp>
|
7
8
|
#include <Gosu/Utility.hpp>
|
9
|
+
|
8
10
|
#include <cassert>
|
9
11
|
#include <cstdlib>
|
10
12
|
#include <algorithm>
|
11
|
-
|
12
|
-
#ifdef GOSU_IS_MAC
|
13
|
-
#import <Foundation/Foundation.h>
|
14
|
-
#include "AudioToolboxFile.hpp"
|
15
|
-
#else
|
16
|
-
#include "MPEGFile.hpp"
|
17
|
-
#include "SndFile.hpp"
|
18
|
-
#endif
|
19
|
-
|
20
|
-
#ifdef GOSU_IS_IPHONE
|
21
|
-
#import <AVFoundation/AVFoundation.h>
|
22
|
-
#endif
|
23
|
-
|
24
13
|
using namespace std;
|
25
14
|
|
26
|
-
static bool is_ogg_file(Gosu::Reader reader)
|
27
|
-
{
|
28
|
-
if (reader.resource().size() < 4) return false;
|
29
|
-
|
30
|
-
char bytes[4];
|
31
|
-
reader.read(bytes, 4);
|
32
|
-
return bytes[0] == 'O' && bytes[1] == 'g' && bytes[2] == 'g' && bytes[3] == 'S';
|
33
|
-
}
|
34
|
-
|
35
|
-
static bool is_ogg_file(const string& filename)
|
36
|
-
{
|
37
|
-
Gosu::File file(filename);
|
38
|
-
return is_ogg_file(file.front_reader());
|
39
|
-
}
|
40
|
-
|
41
15
|
static Gosu::Song* cur_song = nullptr;
|
42
16
|
static bool cur_song_looping;
|
43
17
|
|
44
|
-
struct Gosu::Sample::
|
18
|
+
struct Gosu::Sample::Impl
|
45
19
|
{
|
46
20
|
ALuint buffer;
|
47
21
|
|
48
|
-
|
22
|
+
Impl(AudioFile&& audio_file)
|
49
23
|
{
|
50
24
|
al_initialize();
|
51
25
|
alGenBuffers(1, &buffer);
|
@@ -54,7 +28,7 @@ struct Gosu::Sample::SampleData
|
|
54
28
|
audio_file.sample_rate());
|
55
29
|
}
|
56
30
|
|
57
|
-
~
|
31
|
+
~Impl()
|
58
32
|
{
|
59
33
|
// It's hard to free things in the right order in Ruby/Gosu.
|
60
34
|
// Make sure buffer isn't deleted after the context/device are shut down.
|
@@ -70,43 +44,12 @@ Gosu::Sample::Sample()
|
|
70
44
|
|
71
45
|
Gosu::Sample::Sample(const string& filename)
|
72
46
|
{
|
73
|
-
|
74
|
-
File file(filename);
|
75
|
-
data.reset(new SampleData(OggFile(file.front_reader())));
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
|
79
|
-
#ifdef GOSU_IS_MAC
|
80
|
-
File file(filename);
|
81
|
-
data.reset(new SampleData(AudioToolboxFile(file.front_reader())));
|
82
|
-
#else
|
83
|
-
try {
|
84
|
-
data.reset(new SampleData(SndFile(filename)));
|
85
|
-
}
|
86
|
-
catch (const runtime_error& ex) {
|
87
|
-
File file(filename);
|
88
|
-
data.reset(new SampleData(MPEGFile(file.front_reader())));
|
89
|
-
}
|
90
|
-
#endif
|
47
|
+
pimpl.reset(new Impl(AudioFile(filename)));
|
91
48
|
}
|
92
49
|
|
93
50
|
Gosu::Sample::Sample(Gosu::Reader reader)
|
94
51
|
{
|
95
|
-
|
96
|
-
data.reset(new SampleData(OggFile(reader)));
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
|
100
|
-
#ifdef GOSU_IS_MAC
|
101
|
-
data.reset(new SampleData(AudioToolboxFile(reader)));
|
102
|
-
#else
|
103
|
-
try {
|
104
|
-
data.reset(new SampleData(SndFile(reader)));
|
105
|
-
}
|
106
|
-
catch (const runtime_error& ex) {
|
107
|
-
data.reset(new SampleData(MPEGFile(reader)));
|
108
|
-
}
|
109
|
-
#endif
|
52
|
+
pimpl.reset(new Impl(AudioFile(reader)));
|
110
53
|
}
|
111
54
|
|
112
55
|
Gosu::Channel Gosu::Sample::play(double volume, double speed, bool looping) const
|
@@ -116,7 +59,7 @@ Gosu::Channel Gosu::Sample::play(double volume, double speed, bool looping) cons
|
|
116
59
|
|
117
60
|
Gosu::Channel Gosu::Sample::play_pan(double pan, double volume, double speed, bool looping) const
|
118
61
|
{
|
119
|
-
if (!
|
62
|
+
if (!pimpl) return Channel();
|
120
63
|
|
121
64
|
Channel channel = allocate_channel();
|
122
65
|
|
@@ -124,7 +67,7 @@ Gosu::Channel Gosu::Sample::play_pan(double pan, double volume, double speed, bo
|
|
124
67
|
if (channel.current_channel() == NO_CHANNEL) return channel;
|
125
68
|
|
126
69
|
ALuint source = al_source_for_channel(channel.current_channel());
|
127
|
-
alSourcei(source, AL_BUFFER,
|
70
|
+
alSourcei(source, AL_BUFFER, pimpl->buffer);
|
128
71
|
alSource3f(source, AL_POSITION, pan * 10, 0, 0);
|
129
72
|
alSourcef(source, AL_GAIN, max(volume, 0.0));
|
130
73
|
alSourcef(source, AL_PITCH, speed);
|
@@ -133,112 +76,22 @@ Gosu::Channel Gosu::Sample::play_pan(double pan, double volume, double speed, bo
|
|
133
76
|
return channel;
|
134
77
|
}
|
135
78
|
|
136
|
-
class Gosu::Song::BaseData
|
137
|
-
{
|
138
|
-
BaseData(const BaseData&) = delete;
|
139
|
-
BaseData& operator=(const BaseData&) = delete;
|
140
|
-
|
141
|
-
double volume_;
|
142
|
-
|
143
|
-
protected:
|
144
|
-
BaseData() : volume_(1) {}
|
145
|
-
virtual void apply_volume() = 0;
|
146
|
-
|
147
|
-
public:
|
148
|
-
virtual ~BaseData() {}
|
149
|
-
virtual void play(bool looping) = 0;
|
150
|
-
virtual void pause() = 0;
|
151
|
-
virtual void resume() = 0;
|
152
|
-
virtual bool paused() const = 0;
|
153
|
-
virtual void stop() = 0;
|
154
|
-
virtual void update() = 0;
|
155
|
-
|
156
|
-
double volume() const
|
157
|
-
{
|
158
|
-
return volume_;
|
159
|
-
}
|
160
|
-
|
161
|
-
void set_volume(double volume)
|
162
|
-
{
|
163
|
-
volume_ = clamp(volume, 0.0, 1.0);
|
164
|
-
apply_volume();
|
165
|
-
}
|
166
|
-
};
|
167
|
-
|
168
|
-
#ifdef GOSU_IS_IPHONE
|
169
|
-
// AVAudioPlayer impl
|
170
|
-
class Gosu::Song::ModuleData : public BaseData
|
171
|
-
{
|
172
|
-
AVAudioPlayer* player;
|
173
|
-
|
174
|
-
void apply_volume() override
|
175
|
-
{
|
176
|
-
player.volume = volume();
|
177
|
-
}
|
178
|
-
|
179
|
-
public:
|
180
|
-
ModuleData(const string& filename)
|
181
|
-
{
|
182
|
-
NSURL* URL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filename.c_str()]];
|
183
|
-
player = [[AVAudioPlayer alloc] initWithContentsOfURL:URL error:nil];
|
184
|
-
}
|
185
|
-
|
186
|
-
void play(bool looping) override
|
187
|
-
{
|
188
|
-
if (paused()) {
|
189
|
-
stop();
|
190
|
-
}
|
191
|
-
player.numberOfLoops = looping ? -1 : 0;
|
192
|
-
[player play];
|
193
|
-
}
|
194
|
-
|
195
|
-
void pause() override
|
196
|
-
{
|
197
|
-
[player pause];
|
198
|
-
}
|
199
|
-
|
200
|
-
void resume() override
|
201
|
-
{
|
202
|
-
[player play];
|
203
|
-
}
|
204
|
-
|
205
|
-
bool paused() const override
|
206
|
-
{
|
207
|
-
return !player.playing;
|
208
|
-
}
|
209
|
-
|
210
|
-
void stop() override
|
211
|
-
{
|
212
|
-
[player stop];
|
213
|
-
player.currentTime = 0;
|
214
|
-
}
|
215
|
-
|
216
|
-
void update() override
|
217
|
-
{
|
218
|
-
}
|
219
|
-
};
|
220
|
-
#endif
|
221
|
-
|
222
79
|
// AudioFile impl
|
223
|
-
|
80
|
+
struct Gosu::Song::Impl
|
224
81
|
{
|
82
|
+
double volume_ = 1.0;
|
225
83
|
unique_ptr<AudioFile> file;
|
226
84
|
ALuint buffers[2];
|
227
85
|
|
228
|
-
void apply_volume()
|
86
|
+
void apply_volume()
|
229
87
|
{
|
230
88
|
alSourcef(al_source_for_songs(), AL_GAIN, max(volume(), 0.0));
|
231
89
|
}
|
232
90
|
|
233
91
|
bool stream_to_buffer(ALuint buffer)
|
234
92
|
{
|
235
|
-
|
236
|
-
|
237
|
-
#else
|
238
|
-
static const unsigned BUFFER_SIZE = 4096 * 8;
|
239
|
-
#endif
|
240
|
-
char audio_data[BUFFER_SIZE];
|
241
|
-
size_t read_bytes = file->read_data(audio_data, BUFFER_SIZE);
|
93
|
+
char audio_data[4096 * 8];
|
94
|
+
size_t read_bytes = file->read_data(audio_data, sizeof audio_data);
|
242
95
|
if (read_bytes > 0) {
|
243
96
|
alBufferData(buffer, file->format(), audio_data,
|
244
97
|
static_cast<ALsizei>(read_bytes), file->sample_rate());
|
@@ -247,53 +100,23 @@ class Gosu::Song::StreamData : public BaseData
|
|
247
100
|
}
|
248
101
|
|
249
102
|
public:
|
250
|
-
|
103
|
+
explicit Impl(const string& filename)
|
251
104
|
{
|
252
|
-
|
253
|
-
|
254
|
-
file.reset(new OggFile(source_file.front_reader()));
|
255
|
-
}
|
256
|
-
else {
|
257
|
-
#ifdef GOSU_IS_MAC
|
258
|
-
file.reset(new AudioToolboxFile(filename));
|
259
|
-
#else
|
260
|
-
try {
|
261
|
-
file.reset(new SndFile(filename));
|
262
|
-
}
|
263
|
-
catch (const runtime_error& ex) {
|
264
|
-
File source_file(filename);
|
265
|
-
file.reset(new MPEGFile(source_file.front_reader()));
|
266
|
-
}
|
267
|
-
#endif
|
268
|
-
}
|
269
|
-
|
105
|
+
file.reset(new AudioFile(filename));
|
106
|
+
|
270
107
|
al_initialize();
|
271
108
|
alGenBuffers(2, buffers);
|
272
109
|
}
|
273
110
|
|
274
|
-
|
111
|
+
explicit Impl(Reader reader)
|
275
112
|
{
|
276
|
-
|
277
|
-
|
278
|
-
}
|
279
|
-
else {
|
280
|
-
#ifdef GOSU_IS_MAC
|
281
|
-
file.reset(new AudioToolboxFile(reader));
|
282
|
-
#else
|
283
|
-
try {
|
284
|
-
file.reset(new SndFile(reader));
|
285
|
-
}
|
286
|
-
catch (const runtime_error& ex) {
|
287
|
-
file.reset(new MPEGFile(reader));
|
288
|
-
}
|
289
|
-
#endif
|
290
|
-
}
|
291
|
-
|
113
|
+
file.reset(new AudioFile(reader));
|
114
|
+
|
292
115
|
al_initialize();
|
293
116
|
alGenBuffers(2, buffers);
|
294
117
|
}
|
295
118
|
|
296
|
-
~
|
119
|
+
~Impl()
|
297
120
|
{
|
298
121
|
// It's hard to free things in the right order in Ruby/Gosu.
|
299
122
|
// Make sure buffers aren't deleted after the context/device are shut down.
|
@@ -302,7 +125,7 @@ public:
|
|
302
125
|
alDeleteBuffers(2, buffers);
|
303
126
|
}
|
304
127
|
|
305
|
-
void play(bool looping)
|
128
|
+
void play(bool looping)
|
306
129
|
{
|
307
130
|
ALuint source = al_source_for_songs();
|
308
131
|
|
@@ -319,7 +142,7 @@ public:
|
|
319
142
|
alSourcePlay(source);
|
320
143
|
}
|
321
144
|
|
322
|
-
void stop()
|
145
|
+
void stop()
|
323
146
|
{
|
324
147
|
ALuint source = al_source_for_songs();
|
325
148
|
|
@@ -338,24 +161,24 @@ public:
|
|
338
161
|
file->rewind();
|
339
162
|
}
|
340
163
|
|
341
|
-
void pause()
|
164
|
+
void pause()
|
342
165
|
{
|
343
166
|
alSourcePause(al_source_for_songs());
|
344
167
|
}
|
345
168
|
|
346
|
-
void resume()
|
169
|
+
void resume()
|
347
170
|
{
|
348
171
|
alSourcePlay(al_source_for_songs());
|
349
172
|
}
|
350
173
|
|
351
|
-
bool paused() const
|
174
|
+
bool paused() const
|
352
175
|
{
|
353
176
|
ALint state;
|
354
177
|
alGetSourcei(al_source_for_songs(), AL_SOURCE_STATE, &state);
|
355
178
|
return state == AL_PAUSED;
|
356
179
|
}
|
357
180
|
|
358
|
-
void update()
|
181
|
+
void update()
|
359
182
|
{
|
360
183
|
ALuint source = al_source_for_songs();
|
361
184
|
|
@@ -390,24 +213,27 @@ public:
|
|
390
213
|
}
|
391
214
|
}
|
392
215
|
}
|
216
|
+
|
217
|
+
double volume() const
|
218
|
+
{
|
219
|
+
return volume_;
|
220
|
+
}
|
221
|
+
|
222
|
+
void set_volume(double volume)
|
223
|
+
{
|
224
|
+
volume_ = clamp(volume, 0.0, 1.0);
|
225
|
+
apply_volume();
|
226
|
+
}
|
393
227
|
};
|
394
228
|
|
395
229
|
Gosu::Song::Song(const string& filename)
|
396
230
|
{
|
397
|
-
|
398
|
-
if (has_extension(filename, ".mp3") ||
|
399
|
-
has_extension(filename, ".aac") ||
|
400
|
-
has_extension(filename, ".m4a")) {
|
401
|
-
data.reset(new ModuleData(filename));
|
402
|
-
return;
|
403
|
-
}
|
404
|
-
#endif
|
405
|
-
data.reset(new StreamData(filename));
|
231
|
+
pimpl.reset(new Impl(filename));
|
406
232
|
}
|
407
233
|
|
408
234
|
Gosu::Song::Song(Reader reader)
|
409
235
|
{
|
410
|
-
|
236
|
+
pimpl.reset(new Impl(reader));
|
411
237
|
}
|
412
238
|
|
413
239
|
Gosu::Song::~Song()
|
@@ -423,7 +249,7 @@ Gosu::Song* Gosu::Song::current_song()
|
|
423
249
|
void Gosu::Song::play(bool looping)
|
424
250
|
{
|
425
251
|
if (paused()) {
|
426
|
-
|
252
|
+
pimpl->resume();
|
427
253
|
}
|
428
254
|
|
429
255
|
if (cur_song && cur_song != this) {
|
@@ -432,7 +258,7 @@ void Gosu::Song::play(bool looping)
|
|
432
258
|
}
|
433
259
|
|
434
260
|
if (cur_song == nullptr) {
|
435
|
-
|
261
|
+
pimpl->play(looping);
|
436
262
|
}
|
437
263
|
|
438
264
|
cur_song = this;
|
@@ -442,41 +268,41 @@ void Gosu::Song::play(bool looping)
|
|
442
268
|
void Gosu::Song::pause()
|
443
269
|
{
|
444
270
|
if (cur_song == this) {
|
445
|
-
|
271
|
+
pimpl->pause();
|
446
272
|
}
|
447
273
|
}
|
448
274
|
|
449
275
|
bool Gosu::Song::paused() const
|
450
276
|
{
|
451
|
-
return cur_song == this &&
|
277
|
+
return cur_song == this && pimpl->paused();
|
452
278
|
}
|
453
279
|
|
454
280
|
void Gosu::Song::stop()
|
455
281
|
{
|
456
282
|
if (cur_song == this) {
|
457
|
-
|
283
|
+
pimpl->stop();
|
458
284
|
cur_song = nullptr;
|
459
285
|
}
|
460
286
|
}
|
461
287
|
|
462
288
|
bool Gosu::Song::playing() const
|
463
289
|
{
|
464
|
-
return cur_song == this && !
|
290
|
+
return cur_song == this && !pimpl->paused();
|
465
291
|
}
|
466
292
|
|
467
293
|
double Gosu::Song::volume() const
|
468
294
|
{
|
469
|
-
return
|
295
|
+
return pimpl->volume();
|
470
296
|
}
|
471
297
|
|
472
298
|
void Gosu::Song::set_volume(double volume)
|
473
299
|
{
|
474
|
-
|
300
|
+
pimpl->set_volume(volume);
|
475
301
|
}
|
476
302
|
|
477
303
|
void Gosu::Song::update()
|
478
304
|
{
|
479
305
|
if (current_song()) {
|
480
|
-
current_song()->
|
306
|
+
current_song()->pimpl->update();
|
481
307
|
}
|
482
308
|
}
|