ruby2d 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/README.md +7 -8
- data/assets/Rakefile +85 -0
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +20 -2
- data/assets/include/SDL2/SDL_audio.h +47 -14
- data/assets/include/SDL2/SDL_bits.h +10 -1
- data/assets/include/SDL2/SDL_blendmode.h +10 -7
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +24 -390
- data/assets/include/SDL2/SDL_config_android.h +182 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
- data/assets/include/SDL2/SDL_config_macosx.h +266 -0
- data/assets/include/SDL2/SDL_config_minimal.h +85 -0
- data/assets/include/SDL2/SDL_config_os2.h +188 -0
- data/assets/include/SDL2/SDL_config_pandora.h +135 -0
- data/assets/include/SDL2/SDL_config_psp.h +165 -0
- data/assets/include/SDL2/SDL_config_windows.h +288 -0
- data/assets/include/SDL2/SDL_config_winrt.h +243 -0
- data/assets/include/SDL2/SDL_config_wiz.h +149 -0
- data/assets/include/SDL2/SDL_copying.h +20 -0
- data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
- data/assets/include/SDL2/SDL_egl.h +4 -1
- data/assets/include/SDL2/SDL_endian.h +6 -3
- data/assets/include/SDL2/SDL_error.h +38 -2
- data/assets/include/SDL2/SDL_events.h +67 -28
- data/assets/include/SDL2/SDL_filesystem.h +1 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
- data/assets/include/SDL2/SDL_gesture.h +1 -1
- data/assets/include/SDL2/SDL_haptic.h +10 -1
- data/assets/include/SDL2/SDL_hints.h +460 -17
- data/assets/include/SDL2/SDL_image.h +2 -2
- data/assets/include/SDL2/SDL_joystick.h +115 -24
- data/assets/include/SDL2/SDL_keyboard.h +1 -1
- data/assets/include/SDL2/SDL_keycode.h +11 -9
- data/assets/include/SDL2/SDL_loadso.h +1 -1
- data/assets/include/SDL2/SDL_locale.h +101 -0
- data/assets/include/SDL2/SDL_log.h +3 -3
- data/assets/include/SDL2/SDL_main.h +28 -16
- data/assets/include/SDL2/SDL_messagebox.h +6 -4
- data/assets/include/SDL2/SDL_metal.h +117 -0
- data/assets/include/SDL2/SDL_misc.h +75 -0
- data/assets/include/SDL2/SDL_mouse.h +1 -1
- data/assets/include/SDL2/SDL_mutex.h +1 -1
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +1 -1
- data/assets/include/SDL2/SDL_pixels.h +27 -18
- data/assets/include/SDL2/SDL_platform.h +1 -1
- data/assets/include/SDL2/SDL_power.h +1 -1
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +29 -3
- data/assets/include/SDL2/SDL_render.h +230 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +51 -22
- data/assets/include/SDL2/SDL_scancode.h +2 -2
- data/assets/include/SDL2/SDL_sensor.h +28 -12
- data/assets/include/SDL2/SDL_shape.h +1 -1
- data/assets/include/SDL2/SDL_stdinc.h +44 -4
- data/assets/include/SDL2/SDL_surface.h +12 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +39 -9
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +1 -1
- data/assets/include/SDL2/SDL_test_common.h +32 -2
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +1 -1
- data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
- data/assets/include/SDL2/SDL_test_harness.h +1 -1
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +3 -3
- data/assets/include/SDL2/SDL_test_random.h +1 -1
- data/assets/include/SDL2/SDL_thread.h +34 -11
- data/assets/include/SDL2/SDL_timer.h +1 -1
- data/assets/include/SDL2/SDL_touch.h +17 -1
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +2 -2
- data/assets/include/SDL2/SDL_video.h +11 -5
- data/assets/include/SDL2/SDL_vulkan.h +9 -11
- data/assets/include/SDL2/begin_code.h +8 -9
- data/assets/include/SDL2/close_code.h +4 -1
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libmpg123.a +0 -0
- data/assets/macos/lib/libogg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libwebp-7.dll +0 -0
- data/assets/mingw/lib/libSDL2.a +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/bin/ruby2d +2 -1
- data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
- data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
- data/ext/ruby2d/extconf.rb +6 -36
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +106 -85
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl2.c +35 -20
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl3.c +146 -58
- data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +41 -26
- data/{assets/linux/simple2d/src → ext/ruby2d}/image.c +16 -16
- data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
- data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
- data/ext/ruby2d/ruby2d.c +427 -290
- data/ext/ruby2d/ruby2d.h +789 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
- data/ext/ruby2d/sound.c +118 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/sprite.c +16 -16
- data/{assets/linux/simple2d/src → ext/ruby2d}/text.c +22 -22
- data/ext/ruby2d/tileset.c +30 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +71 -60
- data/lib/ruby2d.rb +5 -2
- data/lib/ruby2d/circle.rb +18 -2
- data/lib/ruby2d/cli/build.rb +3 -8
- data/lib/ruby2d/cli/colorize.rb +10 -0
- data/lib/ruby2d/dsl.rb +16 -9
- data/lib/ruby2d/entity.rb +17 -0
- data/lib/ruby2d/font.rb +4 -3
- data/lib/ruby2d/image.rb +24 -1
- data/lib/ruby2d/line.rb +20 -0
- data/lib/ruby2d/music.rb +5 -0
- data/lib/ruby2d/pixel.rb +17 -0
- data/lib/ruby2d/quad.rb +18 -0
- data/lib/ruby2d/rectangle.rb +11 -2
- data/lib/ruby2d/renderable.rb +4 -8
- data/lib/ruby2d/sound.rb +5 -0
- data/lib/ruby2d/sprite.rb +35 -3
- data/lib/ruby2d/square.rb +9 -0
- data/lib/ruby2d/text.rb +22 -1
- data/lib/ruby2d/tileset.rb +69 -0
- data/lib/ruby2d/triangle.rb +16 -0
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/window.rb +249 -22
- metadata +41 -27
- data/assets/include/simple2d.h +0 -735
- data/assets/linux/simple2d/Makefile +0 -250
- data/assets/linux/simple2d/bin/simple2d.sh +0 -1249
- data/assets/linux/simple2d/include/simple2d.h +0 -735
- data/assets/linux/simple2d/src/sound.c +0 -56
- data/assets/macos/lib/libsimple2d.a +0 -0
- data/assets/mingw/lib/libsimple2d.a +0 -0
- data/lib/ruby2d/colorize.rb +0 -10
@@ -1,56 +0,0 @@
|
|
1
|
-
// sound.c
|
2
|
-
|
3
|
-
#include "../include/simple2d.h"
|
4
|
-
|
5
|
-
|
6
|
-
/*
|
7
|
-
* Create a sound, given an audio file path
|
8
|
-
*/
|
9
|
-
S2D_Sound *S2D_CreateSound(const char *path) {
|
10
|
-
S2D_Init();
|
11
|
-
|
12
|
-
// Check if sound file exists
|
13
|
-
if (!S2D_FileExists(path)) {
|
14
|
-
S2D_Error("S2D_CreateSound", "Sound file `%s` not found", path);
|
15
|
-
return NULL;
|
16
|
-
}
|
17
|
-
|
18
|
-
// Allocate the sound structure
|
19
|
-
S2D_Sound *snd = (S2D_Sound *) malloc(sizeof(S2D_Sound));
|
20
|
-
if (!snd) {
|
21
|
-
S2D_Error("S2D_CreateSound", "Out of memory!");
|
22
|
-
return NULL;
|
23
|
-
}
|
24
|
-
|
25
|
-
// Load the sound data from file
|
26
|
-
snd->data = Mix_LoadWAV(path);
|
27
|
-
if (!snd->data) {
|
28
|
-
S2D_Error("Mix_LoadWAV", Mix_GetError());
|
29
|
-
free(snd);
|
30
|
-
return NULL;
|
31
|
-
}
|
32
|
-
|
33
|
-
// Initialize values
|
34
|
-
snd->path = path;
|
35
|
-
|
36
|
-
return snd;
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
/*
|
41
|
-
* Play the sound
|
42
|
-
*/
|
43
|
-
void S2D_PlaySound(S2D_Sound *snd) {
|
44
|
-
if (!snd) return;
|
45
|
-
Mix_PlayChannel(-1, snd->data, 0);
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
/*
|
50
|
-
* Free the sound
|
51
|
-
*/
|
52
|
-
void S2D_FreeSound(S2D_Sound *snd) {
|
53
|
-
if (!snd) return;
|
54
|
-
Mix_FreeChunk(snd->data);
|
55
|
-
free(snd);
|
56
|
-
}
|
Binary file
|
Binary file
|
data/lib/ruby2d/colorize.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# String#colorize
|
2
|
-
|
3
|
-
# Extend `String` to include some fancy colors
|
4
|
-
class String
|
5
|
-
def colorize(c); "\e[#{c}m#{self}\e[0m" end
|
6
|
-
def bold; colorize('1') end
|
7
|
-
def info; colorize('1;34') end
|
8
|
-
def warn; colorize('1;33') end
|
9
|
-
def error; colorize('1;31') end
|
10
|
-
end
|