mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
wheel support :3 (settings will be rewriten soon)
This commit is contained in:
parent
b2043bce59
commit
30ba0b2ae0
7 changed files with 74 additions and 2 deletions
|
|
@ -93,6 +93,22 @@ RB_METHOD(inputMouseY){
|
|||
return rb_fix_new(shState->input().mouseY());
|
||||
}
|
||||
|
||||
// wheel :3
|
||||
RB_METHOD(inputWheelX) {
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_fix_new(shState->input().wheelX());
|
||||
}
|
||||
|
||||
RB_METHOD(inputWheelY) {
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_fix_new(shState->input().wheelY());
|
||||
}
|
||||
|
||||
RB_METHOD(inputWheelFlipped) {
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_bool_new(shState->input().wheelFlipped());
|
||||
}
|
||||
|
||||
RB_METHOD(inputQuit){
|
||||
RB_UNUSED_PARAM;
|
||||
return rb_bool_new(shState->input().hasQuit());
|
||||
|
|
@ -148,6 +164,11 @@ void inputBindingInit(){
|
|||
_rb_define_module_function(module, "mouse_x", inputMouseX);
|
||||
_rb_define_module_function(module, "mouse_y", inputMouseY);
|
||||
|
||||
// wheel support :P
|
||||
_rb_define_module_function(module, "mouse_wheel_x", inputWheelX);
|
||||
_rb_define_module_function(module, "mouse_wheel_y", inputWheelY);
|
||||
_rb_define_module_function(module, "mouse_wheel_flipped", inputWheelFlipped);
|
||||
|
||||
_rb_define_module_function(module, "quit?", inputQuit);
|
||||
|
||||
if (rgssVer >= 3){
|
||||
|
|
|
|||
3
make-oneshot-linux.sh
Normal file → Executable file
3
make-oneshot-linux.sh
Normal file → Executable file
|
|
@ -17,7 +17,7 @@ color_reset="\033[0m" # Reset Colors
|
|||
|
||||
echo -e "${white}Compiling ${bold}SyngleChance v${linux_version} ${white}engine for Linux...${color_reset}\n"
|
||||
|
||||
cmake . -B build/
|
||||
cmake -DZLIB_LIBRARY=/usr/lib/libz.so . -B build/
|
||||
cd build
|
||||
make -j${nproc}
|
||||
cd ..
|
||||
|
|
@ -62,7 +62,6 @@ yes | cp build/oneshot build/bandle/Sunshine
|
|||
|
||||
cp installer/installer.sh build/bandle/
|
||||
cp -r ../SunshineAssets/* build/bandle/Sunshine
|
||||
cp assets/oneshot.png build/bandle/Sunshine
|
||||
|
||||
cd build
|
||||
zip -r OneshotSunshine.zip bandle/*
|
||||
|
|
|
|||
|
|
@ -350,6 +350,15 @@ class Window_Settings
|
|||
end
|
||||
end
|
||||
|
||||
if Input.mouse_wheel_y > 0
|
||||
@index = (@index - 1) % @data.size
|
||||
$game_system.se_play($data_system.cursor_se)
|
||||
end
|
||||
if Input.mouse_wheel_y < 0
|
||||
@index = (@index + 1) % @data.size
|
||||
$game_system.se_play($data_system.cursor_se)
|
||||
end
|
||||
|
||||
if Input.trigger?(Input::UP)
|
||||
@index = (@index - 1) % @data.size
|
||||
$game_system.se_play($data_system.cursor_se)
|
||||
|
|
|
|||
|
|
@ -430,6 +430,15 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
updateCursorState(cursorInWindow, gameScreen);
|
||||
break;
|
||||
|
||||
// more mouse support for sunshine :3c
|
||||
case SDL_EVENT_MOUSE_WHEEL:
|
||||
{
|
||||
mouseState.wheelFlipped = event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED;
|
||||
mouseState.wheelX += event.wheel.integer_x;
|
||||
mouseState.wheelY += event.wheel.integer_y;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_EVENT_FINGER_DOWN :
|
||||
i = event.tfinger.fingerID;
|
||||
touchState.fingers[i].down = true;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ public:
|
|||
int x, y;
|
||||
bool inWindow;
|
||||
bool buttons[32];
|
||||
|
||||
// mouse wheel support for sunshine
|
||||
bool wheelFlipped;
|
||||
int wheelX, wheelY;
|
||||
};
|
||||
|
||||
struct FingerState{
|
||||
|
|
|
|||
|
|
@ -278,6 +278,12 @@ static const Input::ButtonCode otherDirs[4][3] = {
|
|||
{ Input::Left, Input::Right, Input::Up } /* Up */
|
||||
};
|
||||
|
||||
// storing wheel as buffer cause yes.
|
||||
struct MouseFrameState {
|
||||
int wheelX, wheelY;
|
||||
bool wheelFlipped;
|
||||
};
|
||||
|
||||
struct InputPrivate {
|
||||
std::vector<KbBinding> kbStatBindings;
|
||||
std::vector<KbBinding> kbBindings;
|
||||
|
|
@ -310,6 +316,7 @@ struct InputPrivate {
|
|||
int active;
|
||||
} dir8Data;
|
||||
|
||||
MouseFrameState mouseWheelState;
|
||||
|
||||
InputPrivate(const RGSSThreadData &rtData){
|
||||
initStaticKbBindings();
|
||||
|
|
@ -335,6 +342,8 @@ struct InputPrivate {
|
|||
dir8Data.active = 0;
|
||||
|
||||
triedExit = false;
|
||||
|
||||
mouseWheelState = { 0, 0 };
|
||||
}
|
||||
|
||||
inline ButtonState &getStateCheck(int code){
|
||||
|
|
@ -615,6 +624,17 @@ void Input::update(){
|
|||
p->swapBuffers();
|
||||
p->clearBuffer();
|
||||
|
||||
// updating mouse wheel state
|
||||
{
|
||||
p->mouseWheelState.wheelFlipped = EventThread::mouseState.wheelFlipped;
|
||||
p->mouseWheelState.wheelX = EventThread::mouseState.wheelX;
|
||||
p->mouseWheelState.wheelY = EventThread::mouseState.wheelY;
|
||||
|
||||
EventThread::mouseState.wheelFlipped = false;
|
||||
EventThread::mouseState.wheelX = 0;
|
||||
EventThread::mouseState.wheelY = 0;
|
||||
}
|
||||
|
||||
ButtonCode repeatCand = None;
|
||||
|
||||
/* Poll all bindings */
|
||||
|
|
@ -683,6 +703,11 @@ int Input::mouseY(){
|
|||
return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
|
||||
}
|
||||
|
||||
// wheel support :3
|
||||
int Input::wheelX() { return p->mouseWheelState.wheelX; }
|
||||
int Input::wheelY() { return p->mouseWheelState.wheelY; }
|
||||
bool Input::wheelFlipped() { return p->mouseWheelState.wheelFlipped; }
|
||||
|
||||
bool Input::hasQuit(){
|
||||
return p->triedExit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ public:
|
|||
int mouseX();
|
||||
int mouseY();
|
||||
|
||||
// more non-standard extensions
|
||||
int wheelX();
|
||||
int wheelY();
|
||||
bool wheelFlipped();
|
||||
|
||||
bool hasQuit();
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue