Я пойду читать документацию руби

This commit is contained in:
ZakatTeamI2P 2026-04-19 19:07:12 +02:00
parent 17c3f38685
commit 948de95a89
6 changed files with 30 additions and 24 deletions

View file

@ -269,6 +269,7 @@ set(BINDING_SOURCE
binding-mri/module_rpg.cpp binding-mri/module_rpg.cpp
binding-mri/filesystem-binding.cpp binding-mri/filesystem-binding.cpp
binding-mri/oneshot-binding.cpp binding-mri/oneshot-binding.cpp
binding-mri/sunshine-binding.cpp
binding-mri/steam-binding.cpp binding-mri/steam-binding.cpp
binding-mri/wallpaper-binding.cpp binding-mri/wallpaper-binding.cpp
binding-mri/journal-binding.cpp binding-mri/journal-binding.cpp

View file

@ -79,6 +79,7 @@ void wallpaperBindingTerminate();
#endif #endif
void nikoBindingInit(); void nikoBindingInit();
void oneshotBindingInit(); void oneshotBindingInit();
void SunshineBindingInit();
void steamBindingInit(); void steamBindingInit();
void chromaBindingInit(); void chromaBindingInit();
@ -114,6 +115,7 @@ static void mriBindingInit(){
wallpaperBindingInit(); wallpaperBindingInit();
nikoBindingInit(); nikoBindingInit();
oneshotBindingInit(); oneshotBindingInit();
SunshineBindingInit();
steamBindingInit(); steamBindingInit();
chromaBindingInit(); chromaBindingInit();

View file

@ -8,8 +8,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <boost/crc.hpp> #include <boost/crc.hpp>
RB_METHOD(oneshotSetYesNo) RB_METHOD(oneshotSetYesNo){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
const char *yes; const char *yes;
const char *no; const char *no;
@ -18,8 +17,7 @@ RB_METHOD(oneshotSetYesNo)
return Qnil; return Qnil;
} }
RB_METHOD(oneshotMsgBox) RB_METHOD(oneshotMsgBox){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int type; int type;
VALUE body; VALUE body;
@ -30,8 +28,7 @@ RB_METHOD(oneshotMsgBox)
return rb_bool_new(shState->oneshot().msgbox(type, bodyStr.c_str(), titleStr.c_str())); return rb_bool_new(shState->oneshot().msgbox(type, bodyStr.c_str(), titleStr.c_str()));
} }
RB_METHOD(oneshotTextInput) RB_METHOD(oneshotTextInput){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
VALUE prompt; VALUE prompt;
int char_limit = 100; int char_limit = 100;
@ -42,21 +39,18 @@ RB_METHOD(oneshotTextInput)
return rb_str_new2(shState->oneshot().textinput(promptStr.c_str(), char_limit, fontStr.c_str()).c_str()); return rb_str_new2(shState->oneshot().textinput(promptStr.c_str(), char_limit, fontStr.c_str()).c_str());
} }
RB_METHOD(oneshotResetObscured) RB_METHOD(oneshotResetObscured){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
shState->oneshot().resetObscured(); shState->oneshot().resetObscured();
return Qnil; return Qnil;
} }
RB_METHOD(oneshotObscuredCleared) RB_METHOD(oneshotObscuredCleared){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return shState->oneshot().obscuredCleared() ? Qtrue : Qfalse; return shState->oneshot().obscuredCleared() ? Qtrue : Qfalse;
} }
RB_METHOD(oneshotAllowExit) RB_METHOD(oneshotAllowExit){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
bool allowExit; bool allowExit;
rb_get_args(argc, argv, "b", &allowExit RB_ARG_END); rb_get_args(argc, argv, "b", &allowExit RB_ARG_END);
@ -64,8 +58,7 @@ RB_METHOD(oneshotAllowExit)
return Qnil; return Qnil;
} }
RB_METHOD(oneshotExiting) RB_METHOD(oneshotExiting){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
bool exiting; bool exiting;
rb_get_args(argc, argv, "b", &exiting RB_ARG_END); rb_get_args(argc, argv, "b", &exiting RB_ARG_END);
@ -73,8 +66,7 @@ RB_METHOD(oneshotExiting)
return Qnil; return Qnil;
} }
RB_METHOD(oneshotShake) RB_METHOD(oneshotShake){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
int absx, absy; int absx, absy;
SDL_GetWindowPosition(shState->rtData().window, &absx, &absy); SDL_GetWindowPosition(shState->rtData().window, &absx, &absy);
@ -90,8 +82,7 @@ RB_METHOD(oneshotShake)
return Qnil; return Qnil;
} }
RB_METHOD(oneshotCRC32) RB_METHOD(oneshotCRC32){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
VALUE string; VALUE string;
boost::crc_32_type result; boost::crc_32_type result;
@ -101,8 +92,7 @@ RB_METHOD(oneshotCRC32)
return UINT2NUM(result.checksum()); return UINT2NUM(result.checksum());
} }
void oneshotBindingInit() void oneshotBindingInit(){
{
VALUE module = rb_define_module("Oneshot"); VALUE module = rb_define_module("Oneshot");
VALUE msg = rb_define_module_under(module, "Msg"); VALUE msg = rb_define_module_under(module, "Msg");

View file

@ -0,0 +1,15 @@
#include "oneshot.h"
#include "etc.h"
#include "sharedstate.h"
#include "binding-util.h"
#include "binding-types.h"
#include "eventthread.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_version.h>
//for future use
void SunshineBindingInit(){
VALUE module = rb_define_module("Sunshine");
rb_const_set(module, rb_intern("SDLVersion"), static_cast<char>(SDL_VERSION));
}

View file

@ -359,8 +359,7 @@ end:
return Qnil; return Qnil;
} }
RB_METHOD(wallpaperReset) RB_METHOD(wallpaperReset){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
#ifdef _WIN32 #ifdef _WIN32
if (isCached) { if (isCached) {

View file

@ -67,8 +67,7 @@ DEF_PROP_I(Window, BackOpacity)
DEF_PROP_I(Window, ContentsOpacity) DEF_PROP_I(Window, ContentsOpacity)
void void windowBindingInit(){
windowBindingInit(){
VALUE klass = rb_define_class("Window", rb_cObject); VALUE klass = rb_define_class("Window", rb_cObject);
rb_define_alloc_func(klass, classAllocate<&WindowType>); rb_define_alloc_func(klass, classAllocate<&WindowType>);