edgophrsfhoip[wrj[iyn53
This commit is contained in:
parent
9b9eb08445
commit
e04cbc061b
|
|
@ -26,8 +26,8 @@
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <SDL_scancode.h>
|
#include <SDL3/SDL_scancode.h>
|
||||||
#include <SDL_mouse.h>
|
#include <SDL3/SDL_mouse.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
||||||
|
|
@ -107,18 +107,18 @@ static elementsN(defaultKbBindings);
|
||||||
|
|
||||||
static const GcBindingData defaultGcBindings[] =
|
static const GcBindingData defaultGcBindings[] =
|
||||||
{
|
{
|
||||||
{ SDL_CONTROLLER_BUTTON_DPAD_LEFT, Input::Left },
|
{ SDL_GAMEPAD_BUTTON_DPAD_LEFT, Input::Left },
|
||||||
{ SDL_CONTROLLER_BUTTON_DPAD_RIGHT, Input::Right },
|
{ SDL_GAMEPAD_BUTTON_DPAD_RIGHT, Input::Right },
|
||||||
{ SDL_CONTROLLER_BUTTON_DPAD_UP, Input::Up },
|
{ SDL_GAMEPAD_BUTTON_DPAD_UP, Input::Up },
|
||||||
{ SDL_CONTROLLER_BUTTON_DPAD_DOWN, Input::Down },
|
{ SDL_GAMEPAD_BUTTON_DPAD_DOWN, Input::Down },
|
||||||
{ SDL_CONTROLLER_BUTTON_A, Input::Action },
|
{ SDL_GAMEPAD_BUTTON_A, Input::Action },
|
||||||
{ SDL_CONTROLLER_BUTTON_B, Input::Cancel },
|
{ SDL_GAMEPAD_BUTTON_B, Input::Cancel },
|
||||||
{ SDL_CONTROLLER_BUTTON_X, Input::Run },
|
{ SDL_GAMEPAD_BUTTON_X, Input::Run },
|
||||||
{ SDL_CONTROLLER_BUTTON_Y, Input::Items },
|
{ SDL_GAMEPAD_BUTTON_Y, Input::Items },
|
||||||
{ SDL_CONTROLLER_BUTTON_START, Input::Menu },
|
{ SDL_GAMEPAD_BUTTON_START, Input::Menu },
|
||||||
{ SDL_CONTROLLER_BUTTON_BACK, Input::Deactivate },
|
{ SDL_GAMEPAD_BUTTON_BACK, Input::Deactivate },
|
||||||
{ SDL_CONTROLLER_BUTTON_LEFTSHOULDER, Input::L },
|
{ SDL_GAMEPAD_BUTTON_LEFTSHOULDER, Input::L },
|
||||||
{ SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, Input::R },
|
{ SDL_GAMEPAD_BUTTON_RIGHTSHOULDER, Input::R },
|
||||||
};
|
};
|
||||||
|
|
||||||
static elementsN(defaultGcBindings);
|
static elementsN(defaultGcBindings);
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#include <SDL_scancode.h>
|
#include <SDL3/SDL_scancode.h>
|
||||||
#include <SDL_joystick.h>
|
#include <SDL3/SDL_joystick.h>
|
||||||
#include <SDL_gamecontroller.h>
|
#include <SDL3/SDL_gamecontroller.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
||||||
36
src/main.cpp
36
src/main.cpp
|
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL_image.h>
|
#include <SDL3_image/SDL_image.h>
|
||||||
#include <SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
#include <SDL_sound.h>
|
#include <SDL3_sound/SDL_sound.h>
|
||||||
#include <physfs.h>
|
#include <physfs.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
@ -107,7 +107,7 @@ int rgssThreadFun(void *userdata)
|
||||||
catch (const Exception &exc)
|
catch (const Exception &exc)
|
||||||
{
|
{
|
||||||
rgssThreadError(threadData, exc.msg);
|
rgssThreadError(threadData, exc.msg);
|
||||||
SDL_GL_DeleteContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +149,7 @@ int rgssThreadFun(void *userdata)
|
||||||
{
|
{
|
||||||
rgssThreadError(threadData, exc.msg);
|
rgssThreadError(threadData, exc.msg);
|
||||||
alcDestroyContext(alcCtx);
|
alcDestroyContext(alcCtx);
|
||||||
SDL_GL_DeleteContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +163,7 @@ int rgssThreadFun(void *userdata)
|
||||||
SharedState::finiInstance();
|
SharedState::finiInstance();
|
||||||
|
|
||||||
alcDestroyContext(alcCtx);
|
alcDestroyContext(alcCtx);
|
||||||
SDL_GL_DeleteContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -171,24 +171,24 @@ int rgssThreadFun(void *userdata)
|
||||||
static void showInitError(const std::string &msg)
|
static void showInitError(const std::string &msg)
|
||||||
{
|
{
|
||||||
Debug() << 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)
|
static void setupWindowIcon(const Config &conf, SDL_Window *win)
|
||||||
{
|
{
|
||||||
SDL_RWops *iconSrc;
|
SDL_IOStream *iconSrc;
|
||||||
|
|
||||||
if (conf.iconPath.empty())
|
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
|
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)
|
if (iconImg)
|
||||||
{
|
{
|
||||||
SDL_SetWindowIcon(win, iconImg);
|
SDL_SetWindowIcon(win, iconImg);
|
||||||
SDL_FreeSurface(iconImg);
|
SDL_DestroySurface(iconImg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,10 +337,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (conf.fullscreen)
|
if (conf.fullscreen)
|
||||||
winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
//SDL_CreateWindow() has been simplified and no longer takes a window position.
|
||||||
win = SDL_CreateWindow(conf.windowTitle.c_str(),
|
win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags);
|
||||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
|
||||||
conf.defScreenW, conf.defScreenH, winFlags);
|
|
||||||
|
|
||||||
if (!win)
|
if (!win)
|
||||||
{
|
{
|
||||||
|
|
@ -382,9 +380,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#ifndef STEAM
|
#ifndef STEAM
|
||||||
/* Add controller bindings from embedded controller DB */
|
/* 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);
|
assets_gamecontrollerdb_txt_len);
|
||||||
SDL_GameControllerAddMappingsFromRW(controllerDB, 1);
|
SDL_AddGamepadMappingsFromIO(controllerDB, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int winW, winH;
|
int winW, winH;
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
#include <SDL3/SDL_image.h>
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL3/SDL_ttf.h>
|
||||||
|
|
||||||
// OS-Specific code
|
// OS-Specific code
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
|
@ -311,6 +311,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
desktopEnv = "kde";
|
desktopEnv = "kde";
|
||||||
} else if (desktop.find("lxde") != std::string::npos) {
|
} else if (desktop.find("lxde") != std::string::npos) {
|
||||||
desktopEnv = "lxde";
|
desktopEnv = "lxde";
|
||||||
|
} else if (desktop.find("lxde") != std::string::npos) {
|
||||||
|
desktopEnv = "lxqt";
|
||||||
} else if (desktop.find("deepin") != std::string::npos) {
|
} else if (desktop.find("deepin") != std::string::npos) {
|
||||||
desktopEnv = "deepin";
|
desktopEnv = "deepin";
|
||||||
}
|
}
|
||||||
|
|
@ -355,6 +357,9 @@ void Oneshot::update()
|
||||||
screenRect.w = 640;
|
screenRect.w = 640;
|
||||||
screenRect.h = 480;
|
screenRect.h = 480;
|
||||||
|
|
||||||
|
int num_displays;
|
||||||
|
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays)
|
||||||
|
|
||||||
//Update obscured map and texture for window portion offscreen
|
//Update obscured map and texture for window portion offscreen
|
||||||
for (int i = 0, max = SDL_GetNumVideoDisplays(); i < max; ++i)
|
for (int i = 0, max = SDL_GetNumVideoDisplays(); i < max; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -363,7 +368,7 @@ void Oneshot::update()
|
||||||
|
|
||||||
//Get intersection of window and the screen
|
//Get intersection of window and the screen
|
||||||
SDL_Rect intersect;
|
SDL_Rect intersect;
|
||||||
if (!SDL_IntersectRect(&screenRect, &bounds, &intersect))
|
if (!SDL_GetRectIntersection(&screenRect, &bounds, &intersect))
|
||||||
continue;
|
continue;
|
||||||
intersect.x -= screenRect.x;
|
intersect.x -= screenRect.x;
|
||||||
intersect.y -= screenRect.y;
|
intersect.y -= screenRect.y;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue