mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
C+++++++++++++
This commit is contained in:
parent
73e70ebdb4
commit
f142b26df1
4 changed files with 56 additions and 68 deletions
|
|
@ -108,7 +108,7 @@ RB_METHOD(fileIntGetByte)
|
|||
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
|
||||
|
||||
unsigned char byte;
|
||||
size_t result = SDL_RWread(ops, &byte, 1, 1);
|
||||
size_t result = SDL_ReadIO(ops, &byte, 1);
|
||||
|
||||
return (result == 1) ? rb_fix_new(byte) : Qnil;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#define ALUTIL_H
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,6 @@
|
|||
#include <SDL3/SDL_touch.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
|
||||
// #include <al.h>
|
||||
#include <AL/al.h>
|
||||
// #include <alc.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
#include "sharedstate.h"
|
||||
#include "graphics.h"
|
||||
#include "settingsmenu.h"
|
||||
|
|
@ -223,12 +218,9 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Now process the rest */
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_WINDOWEVENT :
|
||||
switch (event.window.event)
|
||||
{
|
||||
//Window events
|
||||
|
||||
switch (event.window.type){
|
||||
//SDL_WINDOWEVENT_SIZE_CHANGED - handle the SDL_EVENT_WINDOW_RESIZED and SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED events instead
|
||||
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED :
|
||||
winW = event.window.data1;
|
||||
|
|
@ -275,17 +267,18 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
resetInputStates();
|
||||
|
||||
break;
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
case SDL_EVENT_WINDOW_MOVED:
|
||||
if (shState != NULL && event.window.data1 && event.window.data2)
|
||||
shState->oneshot().setWindowPos(event.window.data1, event.window.data2);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
case SDL_EVENT_WINDOW_MOVED:
|
||||
if (shState != NULL && event.window.data1 && event.window.data2)
|
||||
shState->oneshot().setWindowPos(event.window.data1, event.window.data2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
/* Now process the rest */
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_EVENT_QUIT :
|
||||
if (rtData.allowExit) {
|
||||
terminate = true;
|
||||
|
|
@ -301,7 +294,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
|
||||
case SDL_EVENT_KEY_DOWN :
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F1)
|
||||
if (event.key.scancode == SDL_SCANCODE_F1)
|
||||
{
|
||||
if (!sMenu)
|
||||
{
|
||||
|
|
@ -312,7 +305,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
sMenu->raise();
|
||||
}
|
||||
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F2)
|
||||
if (event.key.scancode == SDL_SCANCODE_F2)
|
||||
{
|
||||
if (!displayingFPS)
|
||||
{
|
||||
|
|
@ -341,7 +334,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F12)
|
||||
if (event.key.scancode == SDL_SCANCODE_F12)
|
||||
{
|
||||
if (!rtData.config.debugMode)
|
||||
break;
|
||||
|
|
@ -356,19 +349,19 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
}
|
||||
|
||||
if (rtData.acceptingTextInput) {
|
||||
if (event.key.keysym.sym == SDLK_BACKSPACE && rtData.inputText.length() > 0)
|
||||
if (event.key.sym == SDLK_BACKSPACE && rtData.inputText.length() > 0)
|
||||
rtData.inputText.pop_back();
|
||||
else if (event.key.keysym.sym == SDLK_RETURN)
|
||||
else if (event.key.sym == SDLK_RETURN)
|
||||
rtData.acceptingTextInput.clear();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
keyStates[event.key.keysym.scancode] = true;
|
||||
keyStates[event.key.scancode] = true;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_KEY_UP :
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F12)
|
||||
if (event.key.scancode == SDL_SCANCODE_F12)
|
||||
{
|
||||
if (!rtData.config.debugMode)
|
||||
break;
|
||||
|
|
@ -378,7 +371,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
}
|
||||
|
||||
keyStates[event.key.keysym.scancode] = false;
|
||||
keyStates[event.key.scancode] = false;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||
|
|
@ -586,8 +579,8 @@ bool EventThread::eventFilter(void *data, SDL_Event *event)
|
|||
return 0;
|
||||
|
||||
/* Workaround for Windows pausing on drag */
|
||||
case SDL_WINDOWEVENT:
|
||||
if (event->window.event == SDL_EVENT_WINDOW_MOVED)
|
||||
default:
|
||||
if (event->window.event->type == SDL_EVENT_WINDOW_MOVED)
|
||||
{
|
||||
if (shState != NULL && shState->rgssVersion > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -724,7 +724,7 @@ struct SettingsMenuPrivate
|
|||
{
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
desc.type = Key;
|
||||
desc.d.scan = event.key.keysym.scancode;
|
||||
desc.d.scan = event.key.scancode;
|
||||
|
||||
/* Special case aliases */
|
||||
if (desc.d.scan == SDL_SCANCODE_RSHIFT)
|
||||
|
|
@ -1152,10 +1152,35 @@ SettingsMenu::~SettingsMenu()
|
|||
bool SettingsMenu::onEvent(const SDL_Event &event,
|
||||
const std::map<int, SDL_Joystick*> &joysticks)
|
||||
{
|
||||
/* First, check whether this event is for us */
|
||||
switch (event.window.type)
|
||||
{
|
||||
case SDL_EVENT_WINDOW_SHOWN : // SDL is bugged and doesn't give us a first FOCUS_GAINED event
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED :
|
||||
p->hasFocus = true;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_FOCUS_LOST :
|
||||
p->hasFocus = false;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_EXPOSED :
|
||||
SDL_UpdateWindowSurface(p->window);
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||
if (p->hovered)
|
||||
{
|
||||
p->hovered->leave();
|
||||
p->hovered = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||
p->onCancel();
|
||||
}
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_WINDOWEVENT :
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN :
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP :
|
||||
case SDL_EVENT_MOUSE_MOTION :
|
||||
|
|
@ -1190,37 +1215,6 @@ bool SettingsMenu::onEvent(const SDL_Event &event,
|
|||
case SDL_EVENT_MOUSE_BUTTON_UP :
|
||||
case SDL_EVENT_KEY_UP :
|
||||
return true;
|
||||
|
||||
case SDL_WINDOWEVENT :
|
||||
switch (event.window.event)
|
||||
{
|
||||
case SDL_EVENT_WINDOW_SHOWN : // SDL is bugged and doesn't give us a first FOCUS_GAINED event
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED :
|
||||
p->hasFocus = true;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_FOCUS_LOST :
|
||||
p->hasFocus = false;
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_EXPOSED :
|
||||
SDL_UpdateWindowSurface(p->window);
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
|
||||
if (p->hovered)
|
||||
{
|
||||
p->hovered->leave();
|
||||
p->hovered = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||
p->onCancel();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
p->onMotion(event.motion);
|
||||
return true;
|
||||
|
|
@ -1228,9 +1222,9 @@ bool SettingsMenu::onEvent(const SDL_Event &event,
|
|||
case SDL_EVENT_KEY_DOWN:
|
||||
if (p->state != AwaitingInput)
|
||||
{
|
||||
if (event.key.keysym.sym == SDLK_RETURN)
|
||||
if (event.key.sym == SDLK_RETURN)
|
||||
p->onAccept();
|
||||
else if (event.key.keysym.sym == SDLK_ESCAPE)
|
||||
else if (event.key.sym == SDLK_ESCAPE)
|
||||
p->onCancel();
|
||||
|
||||
return true;
|
||||
|
|
@ -1238,7 +1232,7 @@ bool SettingsMenu::onEvent(const SDL_Event &event,
|
|||
|
||||
/* Don't let the user bind keys that trigger
|
||||
* mkxp functions */
|
||||
switch(event.key.keysym.scancode)
|
||||
switch(event.key.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_F1:
|
||||
case SDL_SCANCODE_F2:
|
||||
|
|
|
|||
Loading…
Reference in a new issue