gosu 0.15.0 → 1.0.0
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 +1 -1
- 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 +2 -2
- 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/patches.rb +0 -23
- data/lib/gosu/preview.rb +1 -3
- data/lib/gosu/swig_patches.rb +3 -2
- data/lib64/OpenAL32.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +98 -22
- 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 +7 -4
- 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 +2 -1
- data/src/RubyGosu.cxx +912 -172
- data/src/RubyGosu.h +4 -2
- data/src/SampleWrapper.cpp +30 -0
- data/src/SongWrapper.cpp +52 -0
- data/src/TexChunk.cpp +1 -1
- data/src/Text.cpp +1 -0
- data/src/TextBuilder.cpp +3 -1
- 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 -43
- data/Gosu/AutoLink.hpp +0 -14
- data/Gosu/Bitmap.hpp +0 -113
- data/lib/gosu/zen.rb +0 -89
- data/src/AudioToolboxFile.hpp +0 -210
- data/src/OggFile.hpp +0 -92
- data/src/SndFile.hpp +0 -174
- data/src/WinMain.cpp +0 -64
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <Gosu/Channel.h>
|
4
|
+
|
5
|
+
#ifdef __cplusplus
|
6
|
+
extern "C" {
|
7
|
+
#endif
|
8
|
+
|
9
|
+
typedef struct Gosu_Sample Gosu_Sample;
|
10
|
+
|
11
|
+
Gosu_Sample* Gosu_Sample_create(const char* filename);
|
12
|
+
void Gosu_Sample_destroy(Gosu_Sample* sample);
|
13
|
+
|
14
|
+
Gosu_Channel* Gosu_Sample_play(Gosu_Sample *sample, double volume, double speed, bool looping);
|
15
|
+
Gosu_Channel* Gosu_Sample_play_pan(Gosu_Sample *sample, double pan, double volume, double speed, bool looping);
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
}
|
19
|
+
#endif
|
data/include/Gosu/Song.h
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#ifdef __cplusplus
|
4
|
+
extern "C" {
|
5
|
+
#endif
|
6
|
+
|
7
|
+
typedef struct Gosu_Song Gosu_Song;
|
8
|
+
|
9
|
+
Gosu_Song* Gosu_Song_create(const char* filename);
|
10
|
+
void Gosu_Song_destroy(Gosu_Song* song);
|
11
|
+
|
12
|
+
void Gosu_Song_pause(Gosu_Song* song);
|
13
|
+
bool Gosu_Song_paused(Gosu_Song* song);
|
14
|
+
void Gosu_Song_play(Gosu_Song* song, bool looping);
|
15
|
+
bool Gosu_Song_playing(Gosu_Song* song);
|
16
|
+
void Gosu_Song_stop(Gosu_Song* song);
|
17
|
+
double Gosu_Song_volume(Gosu_Song* song);
|
18
|
+
void Gosu_Song_set_volume(Gosu_Song* song, double volume);
|
19
|
+
|
20
|
+
Gosu_Song* Gosu_Song_current_song();
|
21
|
+
|
22
|
+
#ifdef __cplusplus
|
23
|
+
}
|
24
|
+
#endif
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#ifdef __cplusplus
|
4
|
+
extern "C" {
|
5
|
+
#endif
|
6
|
+
|
7
|
+
typedef struct Gosu_TextInput Gosu_TextInput;
|
8
|
+
|
9
|
+
Gosu_TextInput* Gosu_TextInput_create();
|
10
|
+
|
11
|
+
const char* Gosu_TextInput_text(Gosu_TextInput* text_input);
|
12
|
+
void Gosu_TextInput_set_text(Gosu_TextInput* text_input, const char* text);
|
13
|
+
|
14
|
+
unsigned Gosu_TextInput_caret_pos(Gosu_TextInput* text_input);
|
15
|
+
void Gosu_TextInput_set_caret_pos(Gosu_TextInput* text_input, unsigned pos);
|
16
|
+
|
17
|
+
unsigned Gosu_TextInput_selection_start(Gosu_TextInput* text_input);
|
18
|
+
void Gosu_TextInput_set_selection_start(Gosu_TextInput* text_input, unsigned pos);
|
19
|
+
|
20
|
+
void Gosu_TextInput_set_filter(Gosu_TextInput *text_input, void function(void* data, const char* text), void* data);
|
21
|
+
void Gosu_TextInput_set_filter_result(Gosu_TextInput *text_input, const char* result);
|
22
|
+
void Gosu_TextInput_insert_text(Gosu_TextInput *text_input, const char* text);
|
23
|
+
void Gosu_TextInput_delete_backward(Gosu_TextInput *text_input);
|
24
|
+
void Gosu_TextInput_delete_forward(Gosu_TextInput *text_input);
|
25
|
+
|
26
|
+
void Gosu_TextInput_destroy(Gosu_TextInput* text_input);
|
27
|
+
|
28
|
+
#ifdef __cplusplus
|
29
|
+
}
|
30
|
+
#endif
|
File without changes
|
File without changes
|
@@ -1,6 +1,3 @@
|
|
1
|
-
//! \file Utility.hpp
|
2
|
-
//! General purpose utility functions.
|
3
|
-
|
4
1
|
#pragma once
|
5
2
|
|
6
3
|
#include <string>
|
@@ -11,10 +8,24 @@ namespace Gosu
|
|
11
8
|
|
12
9
|
//! Returns true if the filename has the given extension.
|
13
10
|
//! The comparison is case-insensitive, but you must pass the extension in lower case.
|
14
|
-
bool has_extension(
|
11
|
+
bool has_extension(std::string_view filename, std::string_view extension);
|
15
12
|
|
16
13
|
//! Returns the user's preferred language, at the moment of calling the function. Expect return
|
17
14
|
//! values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans'.
|
18
15
|
//! The first two letters will always be a language code.
|
19
16
|
std::string language();
|
17
|
+
|
18
|
+
class Noncopyable
|
19
|
+
{
|
20
|
+
protected:
|
21
|
+
Noncopyable() = default;
|
22
|
+
~Noncopyable() = default;
|
23
|
+
|
24
|
+
public:
|
25
|
+
Noncopyable(const Noncopyable& other) = delete;
|
26
|
+
Noncopyable& operator=(const Noncopyable& other) = delete;
|
27
|
+
|
28
|
+
Noncopyable(Noncopyable&& other) = delete;
|
29
|
+
Noncopyable& operator=(Noncopyable&& other) = delete;
|
30
|
+
};
|
20
31
|
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include <stdbool.h>
|
3
|
+
#include "TextInput.h"
|
4
|
+
|
5
|
+
#ifdef __cplusplus
|
6
|
+
extern "C" {
|
7
|
+
#endif
|
8
|
+
|
9
|
+
typedef struct Gosu_Window Gosu_Window;
|
10
|
+
|
11
|
+
// Constructor
|
12
|
+
Gosu_Window* Gosu_Window_create(int width, int height, bool fullscreen, double update_interval, bool resizable);
|
13
|
+
|
14
|
+
// callbacks
|
15
|
+
void Gosu_Window_set_update(Gosu_Window *window, void function(void *data), void* data);
|
16
|
+
void Gosu_Window_set_draw(Gosu_Window *window, void function(void *data), void* data);
|
17
|
+
void Gosu_Window_set_button_down(Gosu_Window *window, void function(void *data, unsigned btn), void* data);
|
18
|
+
void Gosu_Window_set_button_up(Gosu_Window *window, void function(void *data, unsigned btn), void* data);
|
19
|
+
void Gosu_Window_set_gamepad_connected(Gosu_Window *window, void function(void *data, int id), void* data);
|
20
|
+
void Gosu_Window_set_gamepad_disconnected(Gosu_Window *window, void function(void *data, int id), void* data);
|
21
|
+
void Gosu_Window_set_drop(Gosu_Window *window, void function(void *data, const char *filename), void* data);
|
22
|
+
void Gosu_Window_set_needs_redraw(Gosu_Window *window, bool function(void *data), void* data);
|
23
|
+
void Gosu_Window_set_needs_cursor(Gosu_Window *window, bool function(void *data), void* data);
|
24
|
+
void Gosu_Window_set_close(Gosu_Window *window, void function(void *data), void* data);
|
25
|
+
|
26
|
+
void Gosu_Window_default_button_down(Gosu_Window* window, unsigned btn);
|
27
|
+
|
28
|
+
// Properties
|
29
|
+
int Gosu_Window_width(Gosu_Window* window);
|
30
|
+
int Gosu_Window_height(Gosu_Window* window);
|
31
|
+
bool Gosu_Window_is_fullscreen(Gosu_Window* window);
|
32
|
+
bool Gosu_Window_is_resizable(Gosu_Window* window);
|
33
|
+
double Gosu_Window_update_interval(Gosu_Window* window);
|
34
|
+
const char* Gosu_Window_caption(Gosu_Window* window);
|
35
|
+
|
36
|
+
Gosu_TextInput* Gosu_Window_text_input(Gosu_Window *window);
|
37
|
+
double Gosu_Window_mouse_x(Gosu_Window* window);
|
38
|
+
double Gosu_Window_mouse_y(Gosu_Window* window);
|
39
|
+
int Gosu_Window_is_button_down(Gosu_Window* window, unsigned btn);
|
40
|
+
|
41
|
+
// Setters
|
42
|
+
void Gosu_Window_set_text_input(Gosu_Window *window, Gosu_TextInput *text_input);
|
43
|
+
void Gosu_Window_set_caption(Gosu_Window* window, const char* caption);
|
44
|
+
void Gosu_Window_set_update_interval(Gosu_Window* window, double update_interval);
|
45
|
+
void Gosu_Window_set_mouse_x(Gosu_Window* window, double width);
|
46
|
+
void Gosu_Window_set_mouse_y(Gosu_Window* window, double height);
|
47
|
+
void Gosu_Window_set_width(Gosu_Window* window, int width);
|
48
|
+
void Gosu_Window_set_height(Gosu_Window* window, int height);
|
49
|
+
|
50
|
+
void Gosu_Window_resize(Gosu_Window* window, int width, int height, bool fullscreen);
|
51
|
+
|
52
|
+
// Main Loop
|
53
|
+
void Gosu_Window_show(Gosu_Window* window);
|
54
|
+
void Gosu_Window_close_immediately(Gosu_Window* window);
|
55
|
+
bool Gosu_Window_tick(Gosu_Window* window);
|
56
|
+
|
57
|
+
// Destructor
|
58
|
+
void Gosu_Window_destroy(Gosu_Window* window);
|
59
|
+
|
60
|
+
|
61
|
+
#ifdef __cplusplus
|
62
|
+
}
|
63
|
+
#endif
|
@@ -1,6 +1,3 @@
|
|
1
|
-
//! \file Window.hpp
|
2
|
-
//! Interface of the Window class.
|
3
|
-
|
4
1
|
#pragma once
|
5
2
|
|
6
3
|
#include <Gosu/Fwd.hpp>
|
@@ -9,13 +6,6 @@
|
|
9
6
|
#include <memory>
|
10
7
|
#include <string>
|
11
8
|
|
12
|
-
#ifdef GOSU_IS_WIN
|
13
|
-
#ifndef NOMINMAX
|
14
|
-
#define NOMINMAX
|
15
|
-
#endif
|
16
|
-
#include <windows.h>
|
17
|
-
#endif
|
18
|
-
|
19
9
|
namespace Gosu
|
20
10
|
{
|
21
11
|
//! Convenient all-in-one class that serves as the foundation of a standard Gosu application.
|
@@ -52,7 +42,7 @@ namespace Gosu
|
|
52
42
|
//! Enters a modal loop where the Window is visible on screen and
|
53
43
|
//! receives calls to draw, update etc.
|
54
44
|
virtual void show();
|
55
|
-
|
45
|
+
|
56
46
|
//! EXPERIMENTAL - MAY DISAPPEAR WITHOUT WARNING.
|
57
47
|
//! Performs a single main loop step.
|
58
48
|
//! This method is only useful if you want to integrate Gosu with another library that has
|
@@ -62,7 +52,7 @@ namespace Gosu
|
|
62
52
|
//! If you discard the return value and keep calling tick(), the window will be shown again,
|
63
53
|
//! or keep being shown.
|
64
54
|
virtual bool tick();
|
65
|
-
|
55
|
+
|
66
56
|
//! Closes the window if it is currently shown.
|
67
57
|
//! If you do not want the window to close immediately, you should override this method and
|
68
58
|
//! only call the base implementation (Window::close) when needed.
|
@@ -71,24 +61,24 @@ namespace Gosu
|
|
71
61
|
//! Called every update_interval milliseconds while the window is being shown.
|
72
62
|
//! Your application's main game logic goes here.
|
73
63
|
virtual void update() {}
|
74
|
-
|
64
|
+
|
75
65
|
//! Called after every update and when the OS wants the window to repaint itself.
|
76
66
|
//! Your application's rendering code goes here.
|
77
67
|
virtual void draw() {}
|
78
|
-
|
68
|
+
|
79
69
|
//! Gives the game a chance to say no to being redrawn.
|
80
70
|
//! This is not a definitive answer. The operating system can still force the window to
|
81
71
|
//! redraw itself.
|
82
72
|
//! By default, the window is redrawn all the time.
|
83
73
|
virtual bool needs_redraw() const { return true; }
|
84
74
|
|
85
|
-
//! If this function returns true, the system
|
86
|
-
virtual bool needs_cursor() const { return
|
87
|
-
|
75
|
+
//! If this function returns true, the system cursor will be visible while over the window.
|
76
|
+
virtual bool needs_cursor() const { return true; }
|
77
|
+
|
88
78
|
//! This function is called when the window loses focus on some platforms.
|
89
79
|
//! Most importantly, it is called on the iPhone or iPad when the user locks the screen.
|
90
80
|
virtual void lose_focus() {}
|
91
|
-
|
81
|
+
|
92
82
|
//! This function is called when the operating system's memory is low.
|
93
83
|
//! So far, it is only called in iOS applications.
|
94
84
|
virtual void release_memory() {}
|
@@ -99,10 +89,18 @@ namespace Gosu
|
|
99
89
|
//! To support these shortcuts in your application, make sure to call Window::button_down
|
100
90
|
//! in your implementation.
|
101
91
|
virtual void button_down(Gosu::Button);
|
102
|
-
|
92
|
+
|
103
93
|
//! Same as button_down. Called when the user releases a button.
|
104
94
|
virtual void button_up(Gosu::Button) {}
|
105
95
|
|
96
|
+
//! Called when a gamepad is connected.
|
97
|
+
//! \param index the index of the gamepad slot that the gamepad is in.
|
98
|
+
virtual void gamepad_connected(int index) {}
|
99
|
+
|
100
|
+
//! Called when a gamepad is disconnected.
|
101
|
+
//! \param index the index of the gamepad slot that the gamepad is in. The slot will be freed immediately after this callback.
|
102
|
+
virtual void gamepad_disconnected(int index) {}
|
103
|
+
|
106
104
|
//! Called when a file is dropped onto the window.
|
107
105
|
//! \param filename The filename of the dropped file. When multiple files are dropped, this
|
108
106
|
//! method will be called several times.
|
@@ -115,14 +113,14 @@ namespace Gosu
|
|
115
113
|
virtual void touch_moved(Touch touch) {}
|
116
114
|
virtual void touch_ended(Touch touch) {}
|
117
115
|
virtual void touch_cancelled(Touch touch) {}
|
118
|
-
|
116
|
+
|
119
117
|
const Graphics& graphics() const;
|
120
118
|
Graphics& graphics();
|
121
|
-
|
119
|
+
|
122
120
|
const Input& input() const;
|
123
121
|
Input& input();
|
124
122
|
#endif
|
125
|
-
|
123
|
+
|
126
124
|
#ifdef GOSU_IS_IPHONE
|
127
125
|
void* uikit_window() const;
|
128
126
|
#endif
|
@@ -132,18 +130,18 @@ namespace Gosu
|
|
132
130
|
//! \param window The result describes the screen on which the window is shown, or the
|
133
131
|
//! primary screen if no window is given.
|
134
132
|
unsigned screen_width(Window* window = nullptr);
|
135
|
-
|
133
|
+
|
136
134
|
//! Returns the height (in pixels) of the user's primary screen.
|
137
135
|
//! \param window The result describes the screen on which the window is shown, or the
|
138
136
|
//! primary screen if no window is given.
|
139
137
|
unsigned screen_height(Window* window = nullptr);
|
140
|
-
|
138
|
+
|
141
139
|
//! Returns the maximum width (in 'points') that is available for a non-fullscreen Window.
|
142
140
|
//! All windows larger than this size will automatically be shrunk to fit.
|
143
141
|
//! \param window The result describes the screen on which the window is shown, or the
|
144
142
|
//! primary screen if no window is given.
|
145
143
|
unsigned available_width(Window* window = nullptr);
|
146
|
-
|
144
|
+
|
147
145
|
//! Returns the maximum height (in 'points') that is available for a non-fullscreen Window.
|
148
146
|
//! All windows larger than this size will automatically be shrunk to fit.
|
149
147
|
//! \param window The result describes the screen on which the window is shown, or the
|
data/lib/OpenAL32.dll
ADDED
Binary file
|
data/lib/SDL2.dll
ADDED
Binary file
|
data/lib/gosu.rb
CHANGED
@@ -17,9 +17,6 @@ if RUBY_PLATFORM =~ /mswin$|mingw32|mingw64|win32\-|\-win32/
|
|
17
17
|
path_encoding = ENV["PATH"].encoding
|
18
18
|
ENV["PATH"] = "#{binary_path.encode(path_encoding)};#{ENV["PATH"]}"
|
19
19
|
end
|
20
|
-
|
21
|
-
# Add the correct lib directory for the current version of Ruby (major.minor).
|
22
|
-
$LOAD_PATH.unshift File.join(binary_path, RUBY_VERSION[/^\d+.\d+/])
|
23
20
|
end
|
24
21
|
|
25
22
|
require "gosu.#{RbConfig::CONFIG["DLEXT"]}"
|
data/lib/gosu/patches.rb
CHANGED
@@ -18,26 +18,12 @@ class ::Numeric
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
class Gosu::Font
|
22
|
-
# draw_text will stop parsing markup in Gosu 1.0.
|
23
|
-
alias_method :draw_text, :draw_markup
|
24
|
-
# draw_text_rel will stop parsing markup in Gosu 1.0.
|
25
|
-
alias_method :draw_text_rel, :draw_markup_rel
|
26
|
-
# text_width will stop parsing markup in Gosu 1.0.
|
27
|
-
alias_method :text_width, :markup_width
|
28
|
-
end
|
29
|
-
|
30
21
|
class Gosu::Image
|
31
22
|
BlobHelper = Struct.new(:columns, :rows, :to_blob)
|
32
23
|
|
33
24
|
def self.from_blob(width, height, rgba = "\0\0\0\0" * (width * height))
|
34
25
|
self.new(BlobHelper.new(width, height, rgba))
|
35
26
|
end
|
36
|
-
|
37
|
-
# from_markup will stop parsing markup in Gosu 1.0.
|
38
|
-
def self.from_markup(*args)
|
39
|
-
self.from_text(*args)
|
40
|
-
end
|
41
27
|
end
|
42
28
|
|
43
29
|
# Color constants.
|
@@ -78,12 +64,3 @@ class Gosu::Window
|
|
78
64
|
_tick
|
79
65
|
end
|
80
66
|
end
|
81
|
-
|
82
|
-
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
83
|
-
at_exit do
|
84
|
-
begin
|
85
|
-
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
86
|
-
Gosu._release_all_openal_resources
|
87
|
-
rescue
|
88
|
-
end
|
89
|
-
end
|
data/lib/gosu/preview.rb
CHANGED
@@ -3,8 +3,6 @@ warn "gosu/preview.rb has been removed in Gosu 0.9.0, and Gosu itself \n" +
|
|
3
3
|
"Notable differences:\n" +
|
4
4
|
"• no global $window variable\n" +
|
5
5
|
"• no global Gosu.mouse_x and Gosu.mouse_y functions\n" +
|
6
|
-
"• Image#initialize et.al. use an options hash now
|
7
|
-
"If you cannot update your code base right now, you should require \n" +
|
8
|
-
"Gosu 0.8.x in your Gemfile: gem 'gosu', '~> 0.8.0'";
|
6
|
+
"• Image#initialize et.al. use an options hash now";
|
9
7
|
|
10
8
|
require 'gosu'
|
data/lib/gosu/swig_patches.rb
CHANGED
@@ -19,7 +19,8 @@ class Gosu::Window
|
|
19
19
|
end
|
20
20
|
|
21
21
|
%w(update draw needs_redraw? needs_cursor?
|
22
|
-
lose_focus button_down button_up
|
22
|
+
lose_focus button_down button_up
|
23
|
+
gamepad_connected gamepad_disconnected drop).each do |callback|
|
23
24
|
define_method "protected_#{callback}" do |*args|
|
24
25
|
begin
|
25
26
|
# If there has been an exception, don't do anything as to not make matters worse.
|
@@ -47,7 +48,7 @@ class Gosu::Window
|
|
47
48
|
# doing here.
|
48
49
|
if defined? @_exception
|
49
50
|
if @_exception.backtrace.is_a? Array and not @_exception.backtrace.frozen?
|
50
|
-
@_exception.backtrace.reject! { |line| line.include?
|
51
|
+
@_exception.backtrace.reject! { |line| line.include? "lib/gosu/swig_patches.rb" }
|
51
52
|
end
|
52
53
|
raise @_exception
|
53
54
|
end
|
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
|
@@ -193,14 +218,14 @@ module Gosu
|
|
193
218
|
##
|
194
219
|
# @return [Integer] a 32-bit representation of the color in 0xAARRGGBB format.
|
195
220
|
def argb; end
|
196
|
-
|
221
|
+
|
197
222
|
alias_method :to_i, :argb
|
198
223
|
|
199
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.
|
200
225
|
#
|
201
226
|
# @return [Integer] a 32-bit OpenGL color.
|
202
227
|
def gl; end
|
203
|
-
|
228
|
+
|
204
229
|
# Returns an OpenGL integer constant that identifies the RGBA color format that Gosu uses.
|
205
230
|
GL_FORMAT = :some_integer
|
206
231
|
|
@@ -316,7 +341,7 @@ module Gosu
|
|
316
341
|
# @return [Integer] the width of the text, in pixels.
|
317
342
|
# @param text [String]
|
318
343
|
def text_width(text, scale_x=1); end
|
319
|
-
|
344
|
+
|
320
345
|
##
|
321
346
|
# Like {#text_width}, but supports the following markup tags: `<b>bold</b>`, `<i>italic</i>`, `<c=rrggbb>colors</c>`.
|
322
347
|
def markup_width(markup, scale_x=1); end
|
@@ -420,13 +445,13 @@ module Gosu
|
|
420
445
|
|
421
446
|
##
|
422
447
|
# Returns an image that is a smaller, rectangular view of this {Image}.
|
423
|
-
#
|
448
|
+
#
|
424
449
|
# This is a very fast operation, and no new textures will be allocated.
|
425
450
|
# If you update this {Image} or the {#subimage} using {#insert}, the other {Image} will be affected as well.
|
426
|
-
#
|
451
|
+
#
|
427
452
|
# Caveats:
|
428
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.
|
429
|
-
#
|
454
|
+
#
|
430
455
|
# @return [Image?] an image that represents a portion of the containing image
|
431
456
|
def subimage(left, top, width, height); end
|
432
457
|
|
@@ -450,7 +475,7 @@ module Gosu
|
|
450
475
|
# @see #draw_as_quad
|
451
476
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki
|
452
477
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki
|
453
|
-
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
|
454
479
|
|
455
480
|
##
|
456
481
|
# Draws the image rotated, with its rotational center at (x, y).
|
@@ -464,7 +489,7 @@ module Gosu
|
|
464
489
|
# @see #draw
|
465
490
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki
|
466
491
|
# @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki
|
467
|
-
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
|
468
493
|
|
469
494
|
##
|
470
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.
|
@@ -576,16 +601,16 @@ module Gosu
|
|
576
601
|
# @param [Float]
|
577
602
|
# @return [Float]
|
578
603
|
attr_writer :volume
|
579
|
-
|
604
|
+
|
580
605
|
##
|
581
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.
|
582
|
-
# @param [Float]
|
607
|
+
# @param [Float]
|
583
608
|
# @return [Float]
|
584
609
|
attr_writer :speed
|
585
|
-
|
610
|
+
|
586
611
|
##
|
587
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.
|
588
|
-
# @param [Float]
|
613
|
+
# @param [Float]
|
589
614
|
# @return [Float]
|
590
615
|
attr_writer :pan
|
591
616
|
|
@@ -781,7 +806,7 @@ module Gosu
|
|
781
806
|
##
|
782
807
|
# Toggles between windowed mode and fullscreen.
|
783
808
|
attr_writer :fullscreen
|
784
|
-
|
809
|
+
|
785
810
|
##
|
786
811
|
# @return [true, false] whether this window is resizable.
|
787
812
|
def resizable?; end
|
@@ -795,7 +820,7 @@ module Gosu
|
|
795
820
|
#
|
796
821
|
# Resizable fullscreen windows always use the full desktop resolution.
|
797
822
|
# Windows that are larger than the desktop resolution will be shrunk.
|
798
|
-
#
|
823
|
+
#
|
799
824
|
# @overload initialize(width, height, options = {})
|
800
825
|
# @overload initialize(width, height, fullscreen, update_interval = 16.666666)
|
801
826
|
#
|
@@ -812,18 +837,18 @@ module Gosu
|
|
812
837
|
#
|
813
838
|
# @return [void]
|
814
839
|
def show; end
|
815
|
-
|
840
|
+
|
816
841
|
##
|
817
842
|
# EXPERIMENTAL - MAY DISAPPEAR WITHOUT WARNING.
|
818
|
-
#
|
843
|
+
#
|
819
844
|
# Performs a single step in the main loop.
|
820
845
|
# This can be useful for integrating Gosu with other libraries that have their own main loop, e.g. Ruby/Tk.
|
821
|
-
#
|
846
|
+
#
|
822
847
|
# See: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1218
|
823
|
-
#
|
848
|
+
#
|
824
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.
|
825
850
|
# Thank you!
|
826
|
-
#
|
851
|
+
#
|
827
852
|
# @return [true, false] whether the {Window} should still be shown after this tick
|
828
853
|
def tick; end
|
829
854
|
|
@@ -850,7 +875,7 @@ module Gosu
|
|
850
875
|
def draw; end
|
851
876
|
|
852
877
|
##
|
853
|
-
# 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.
|
854
879
|
#
|
855
880
|
# @return [true, false] whether the window needs to be redrawn.
|
856
881
|
#
|
@@ -858,7 +883,8 @@ module Gosu
|
|
858
883
|
def needs_redraw?; end
|
859
884
|
|
860
885
|
##
|
861
|
-
# 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.
|
862
888
|
#
|
863
889
|
# @return [true, false] whether the system cursor should be shown.
|
864
890
|
def needs_cursor?; end
|
@@ -871,7 +897,7 @@ module Gosu
|
|
871
897
|
#
|
872
898
|
# @return [bool]
|
873
899
|
def close; end
|
874
|
-
|
900
|
+
|
875
901
|
##
|
876
902
|
# This method is called before {#update} if a button is pressed while the window has focus.
|
877
903
|
#
|
@@ -903,6 +929,24 @@ module Gosu
|
|
903
929
|
# @param filename [String] the filename of the dropped file. When multiple files are dropped, this method will be called several times.
|
904
930
|
def drop(filename); end
|
905
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
|
+
|
906
950
|
# @!endgroup
|
907
951
|
end
|
908
952
|
|
@@ -945,6 +989,38 @@ module Gosu
|
|
945
989
|
# @see Window#button_up
|
946
990
|
def button_down?(id); end
|
947
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
|
+
|
948
1024
|
# @!group Drawing primitives
|
949
1025
|
|
950
1026
|
##
|