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
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/compat.rb
CHANGED
@@ -68,9 +68,14 @@ module Gosu
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
# These were useful for working with Direct3D and the Win32 API a long time ago,
|
72
|
+
# there was never a real reason to have them available in Ruby.
|
73
|
+
Gosu.deprecate Gosu::Color, :bgr, :none
|
74
|
+
Gosu.deprecate Gosu::Color, :abgr, :none
|
75
|
+
|
71
76
|
# No need to pass a Window to Image.
|
72
77
|
class Gosu::Image
|
73
|
-
|
78
|
+
alias_method :initialize_without_window, :initialize
|
74
79
|
|
75
80
|
def initialize(*args)
|
76
81
|
if args[0].is_a? Gosu::Window
|
@@ -86,7 +91,7 @@ class Gosu::Image
|
|
86
91
|
end
|
87
92
|
|
88
93
|
class << self
|
89
|
-
|
94
|
+
alias_method :from_text_without_window, :from_text
|
90
95
|
end
|
91
96
|
|
92
97
|
def self.from_text(*args)
|
@@ -105,7 +110,7 @@ end
|
|
105
110
|
|
106
111
|
# No need to pass a Window to Sample.
|
107
112
|
class Gosu::Sample
|
108
|
-
|
113
|
+
alias_method :initialize_without_window, :initialize
|
109
114
|
|
110
115
|
def initialize(*args)
|
111
116
|
if args.first.is_a? Gosu::Window
|
@@ -118,7 +123,7 @@ end
|
|
118
123
|
|
119
124
|
# No need to pass a Window to Song.
|
120
125
|
class Gosu::Song
|
121
|
-
|
126
|
+
alias_method :initialize_without_window, :initialize
|
122
127
|
|
123
128
|
def initialize(*args)
|
124
129
|
if args.first.is_a? Gosu::Window
|
data/lib/gosu/patches.rb
CHANGED
@@ -28,6 +28,12 @@ class Gosu::Font
|
|
28
28
|
end
|
29
29
|
|
30
30
|
class Gosu::Image
|
31
|
+
BlobHelper = Struct.new(:columns, :rows, :to_blob)
|
32
|
+
|
33
|
+
def self.from_blob(width, height, rgba = "\0\0\0\0" * (width * height))
|
34
|
+
self.new(BlobHelper.new(width, height, rgba))
|
35
|
+
end
|
36
|
+
|
31
37
|
# from_markup will stop parsing markup in Gosu 1.0.
|
32
38
|
def self.from_markup(*args)
|
33
39
|
self.from_text(*args)
|
@@ -54,7 +60,7 @@ module Gosu
|
|
54
60
|
FUCHSIA = Gosu::ImmutableColor.new(0xff_ff00ff)
|
55
61
|
CYAN = Gosu::ImmutableColor.new(0xff_00ffff)
|
56
62
|
|
57
|
-
|
63
|
+
alias_method :hash, :gl
|
58
64
|
def eql?(other)
|
59
65
|
gl == other.gl
|
60
66
|
end
|
@@ -65,19 +71,10 @@ class Gosu::Window
|
|
65
71
|
# Call Thread.pass every tick, which may or may not be necessary for friendly co-existence with
|
66
72
|
# Ruby's Thread class.
|
67
73
|
|
68
|
-
|
74
|
+
alias_method :_tick, :tick
|
69
75
|
|
70
76
|
def tick
|
71
77
|
Thread.pass
|
72
78
|
_tick
|
73
79
|
end
|
74
80
|
end
|
75
|
-
|
76
|
-
# Release OpenAL resources during Ruby's shutdown, not Gosu's.
|
77
|
-
at_exit do
|
78
|
-
begin
|
79
|
-
Gosu::Song.current_song.stop if Gosu::Song.current_song
|
80
|
-
Gosu._release_all_openal_resources
|
81
|
-
rescue
|
82
|
-
end
|
83
|
-
end
|
data/lib/gosu/swig_patches.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# compatible, but I just call protected_update etc. in the Ruby wrapper so I can add this
|
4
4
|
# custom debugging help:
|
5
5
|
class Gosu::Window
|
6
|
-
|
6
|
+
alias_method :initialize_without_hash, :initialize
|
7
7
|
|
8
8
|
def initialize width, height, *args
|
9
9
|
if args.empty? or args.first.is_a? Hash
|
@@ -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.
|
@@ -40,14 +41,14 @@ class Gosu::Window
|
|
40
41
|
$gosu_gl_blocks = nil
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
+
alias_method :show_internal, :show
|
44
45
|
def show
|
45
46
|
show_internal
|
46
47
|
# Try to format the message nicely, without any useless patching that we are
|
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
|
@@ -68,7 +69,13 @@ module Gosu
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
|
-
# SWIG
|
72
|
+
# SWIG somehow maps the instance method "argb" as an overload of the class
|
73
|
+
# method of the same name.
|
74
|
+
class Gosu::Color
|
75
|
+
alias_method :argb, :to_i
|
76
|
+
end
|
77
|
+
|
78
|
+
# SWIG will not let me rename my method to '[]=', so use alias_method here.
|
72
79
|
class Gosu::Font
|
73
|
-
|
80
|
+
alias_method :[]=, :set_image
|
74
81
|
end
|