edgophrsfhoip[wrj[iyn53

This commit is contained in:
ZakatTeamI2P 2026-03-30 20:11:38 +04:00
parent 9b9eb08445
commit e04cbc061b
5 changed files with 43 additions and 40 deletions

View file

@ -26,8 +26,8 @@
#include "exception.h"
#include "util.h"
#include <SDL_scancode.h>
#include <SDL_mouse.h>
#include <SDL3/SDL_scancode.h>
#include <SDL3/SDL_mouse.h>
#include <vector>
#include <string.h>

View file

@ -107,18 +107,18 @@ static elementsN(defaultKbBindings);
static const GcBindingData defaultGcBindings[] =
{
{ SDL_CONTROLLER_BUTTON_DPAD_LEFT, Input::Left },
{ SDL_CONTROLLER_BUTTON_DPAD_RIGHT, Input::Right },
{ SDL_CONTROLLER_BUTTON_DPAD_UP, Input::Up },
{ SDL_CONTROLLER_BUTTON_DPAD_DOWN, Input::Down },
{ SDL_CONTROLLER_BUTTON_A, Input::Action },
{ SDL_CONTROLLER_BUTTON_B, Input::Cancel },
{ SDL_CONTROLLER_BUTTON_X, Input::Run },
{ SDL_CONTROLLER_BUTTON_Y, Input::Items },
{ SDL_CONTROLLER_BUTTON_START, Input::Menu },
{ SDL_CONTROLLER_BUTTON_BACK, Input::Deactivate },
{ SDL_CONTROLLER_BUTTON_LEFTSHOULDER, Input::L },
{ SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, Input::R },
{ SDL_GAMEPAD_BUTTON_DPAD_LEFT, Input::Left },
{ SDL_GAMEPAD_BUTTON_DPAD_RIGHT, Input::Right },
{ SDL_GAMEPAD_BUTTON_DPAD_UP, Input::Up },
{ SDL_GAMEPAD_BUTTON_DPAD_DOWN, Input::Down },
{ SDL_GAMEPAD_BUTTON_A, Input::Action },
{ SDL_GAMEPAD_BUTTON_B, Input::Cancel },
{ SDL_GAMEPAD_BUTTON_X, Input::Run },
{ SDL_GAMEPAD_BUTTON_Y, Input::Items },
{ SDL_GAMEPAD_BUTTON_START, Input::Menu },
{ SDL_GAMEPAD_BUTTON_BACK, Input::Deactivate },
{ SDL_GAMEPAD_BUTTON_LEFTSHOULDER, Input::L },
{ SDL_GAMEPAD_BUTTON_RIGHTSHOULDER, Input::R },
};
static elementsN(defaultGcBindings);

View file

@ -24,9 +24,9 @@
#include "input.h"
#include <SDL_scancode.h>
#include <SDL_joystick.h>
#include <SDL_gamecontroller.h>
#include <SDL3/SDL_scancode.h>
#include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_gamecontroller.h>
#include <stdint.h>
#include <assert.h>
#include <vector>

View file

@ -21,10 +21,10 @@
#include <alc.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_sound.h>
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3_sound/SDL_sound.h>
#include <physfs.h>
#ifdef _MSC_VER
@ -107,7 +107,7 @@ int rgssThreadFun(void *userdata)
catch (const Exception &exc)
{
rgssThreadError(threadData, exc.msg);
SDL_GL_DeleteContext(glCtx);
SDL_GL_DestroyContext(glCtx);
return 0;
}
@ -149,7 +149,7 @@ int rgssThreadFun(void *userdata)
{
rgssThreadError(threadData, exc.msg);
alcDestroyContext(alcCtx);
SDL_GL_DeleteContext(glCtx);
SDL_GL_DestroyContext(glCtx);
return 0;
}
@ -163,7 +163,7 @@ int rgssThreadFun(void *userdata)
SharedState::finiInstance();
alcDestroyContext(alcCtx);
SDL_GL_DeleteContext(glCtx);
SDL_GL_DestroyContext(glCtx);
return 0;
}
@ -171,24 +171,24 @@ int rgssThreadFun(void *userdata)
static void showInitError(const std::string &msg)
{
Debug() << msg;
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OneShot", msg.c_str(), 0);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OneShot: sunshine", msg.c_str(), 0);
}
static void setupWindowIcon(const Config &conf, SDL_Window *win)
{
SDL_RWops *iconSrc;
SDL_IOStream *iconSrc;
if (conf.iconPath.empty())
iconSrc = SDL_RWFromConstMem(assets_icon_png, assets_icon_png_len);
iconSrc = SDL_IOFromConstMem(assets_icon_png, assets_icon_png_len);
else
iconSrc = SDL_RWFromFile(conf.iconPath.c_str(), "rb");
iconSrc = SDL_IOFromFile(conf.iconPath.c_str(), "rb");
SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE);
SDL_Surface *iconImg = IMG_Load_IO(iconSrc, true);
if (iconImg)
{
SDL_SetWindowIcon(win, iconImg);
SDL_FreeSurface(iconImg);
SDL_DestroySurface(iconImg);
}
}
@ -337,10 +337,8 @@ int main(int argc, char *argv[])
if (conf.fullscreen)
winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
win = SDL_CreateWindow(conf.windowTitle.c_str(),
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
conf.defScreenW, conf.defScreenH, winFlags);
//SDL_CreateWindow() has been simplified and no longer takes a window position.
win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags);
if (!win)
{
@ -382,9 +380,9 @@ int main(int argc, char *argv[])
#ifndef STEAM
/* Add controller bindings from embedded controller DB */
SDL_RWops *controllerDB = SDL_RWFromConstMem(assets_gamecontrollerdb_txt,
SDL_IOStream *controllerDB = SDL_IOFromConstMem(assets_gamecontrollerdb_txt,
assets_gamecontrollerdb_txt_len);
SDL_GameControllerAddMappingsFromRW(controllerDB, 1);
SDL_AddGamepadMappingsFromIO(controllerDB, 1);
#endif
int winW, winH;

View file

@ -9,9 +9,9 @@
#include "bitmap.h"
#include "font.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <SDL3/SDL.h>
#include <SDL3/SDL_image.h>
#include <SDL3/SDL_ttf.h>
// OS-Specific code
#if defined _WIN32
@ -311,6 +311,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
desktopEnv = "kde";
} else if (desktop.find("lxde") != std::string::npos) {
desktopEnv = "lxde";
} else if (desktop.find("lxde") != std::string::npos) {
desktopEnv = "lxqt";
} else if (desktop.find("deepin") != std::string::npos) {
desktopEnv = "deepin";
}
@ -355,6 +357,9 @@ void Oneshot::update()
screenRect.w = 640;
screenRect.h = 480;
int num_displays;
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays)
//Update obscured map and texture for window portion offscreen
for (int i = 0, max = SDL_GetNumVideoDisplays(); i < max; ++i)
{
@ -363,7 +368,7 @@ void Oneshot::update()
//Get intersection of window and the screen
SDL_Rect intersect;
if (!SDL_IntersectRect(&screenRect, &bounds, &intersect))
if (!SDL_GetRectIntersection(&screenRect, &bounds, &intersect))
continue;
intersect.x -= screenRect.x;
intersect.y -= screenRect.y;