diff --git a/PEOPLES.md b/PEOPLES.md index f5522fa..2542085 100644 --- a/PEOPLES.md +++ b/PEOPLES.md @@ -2,6 +2,7 @@ Programmers: * Issac332 * "Визя" * DepressedTWM +* referr Artists: * Issac332 diff --git a/binding-mri/sunshine-binding.cpp b/binding-mri/sunshine-binding.cpp index b6b4749..4b5ca73 100644 --- a/binding-mri/sunshine-binding.cpp +++ b/binding-mri/sunshine-binding.cpp @@ -1,8 +1,13 @@ +#include #include #include #include #include #include +#include "ruby/backward/cxxanyargs.hpp" +#include "ruby/internal/arithmetic/double.h" +#include "ruby/internal/arithmetic/int.h" +#include "ruby/internal/intern/class.h" #include "security.h" #include "eventthread.h" //Просто на C реализуем методы мне в падлу ебаться со статической линковкой и прочим дерьмом. @@ -43,6 +48,18 @@ static VALUE SetLED(VALUE self, VALUE r, VALUE g, VALUE b) { return Qnil; } +static VALUE Rumble(VALUE self, VALUE low_frequency_rumble, VALUE high_frequency_rumble, VALUE duration_ms) { + Uint16 low_freq = NUM2DBL(low_frequency_rumble) * 65535; + Uint16 high_freq = NUM2DBL(high_frequency_rumble) * 65535; + + if (gc != nullptr) { + SDL_RumbleGamepad(gc, low_freq, high_freq, NUM2INT(duration_ms)); + } else if (js != nullptr) { + SDL_RumbleJoystick(js, low_freq, high_freq, NUM2INT(duration_ms)); + } + return Qnil; +} + void SunshineBindingInit(){ printf("[SunshineBindingInit] Initializing Sunshine binding\n"); VALUE module = rb_define_module("Sunshine"); @@ -52,6 +69,7 @@ void SunshineBindingInit(){ rb_const_set(module, rb_intern("SDLVersion_micro"), INT2NUM(SDL_MICRO_VERSION)); rb_const_set(module, rb_intern("SECURITYSTATE"), rb_str_new_cstr(securitystate)); rb_define_singleton_method(module, "SetLED", SetLED, 3); + rb_define_singleton_method(module, "Vibrate", Rumble, 3); //если методы доступны то просто не перезаписываем их if (!rb_respond_to(rb_cObject, rb_intern("class"))) { rb_define_method(rb_cObject, "class", rb_obj_class, 0); diff --git a/scripts/Main.rb b/scripts/Main.rb index b799f16..ffac9c4 100644 --- a/scripts/Main.rb +++ b/scripts/Main.rb @@ -13,7 +13,7 @@ end begin RPG::Mod.exec_hooks("hooks/Main/start", binding) $console = Graphics.fullscreen - Graphics.frame_rate = 60 + Graphics.frame_rate = 60 Font.default_size = 20 Sunshine.SetLED(0, 255, 0)