migrant a SDL3
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
// IWYU pragma: no_include <bits/chrono.h>
|
||||
#include "director.h"
|
||||
#include <SDL3/SDL.h> // Para SDL_Init, SDL_Quit, SDL_INIT_EV...
|
||||
#include <SDL3/SDL_audio.h> // Para AUDIO_S16
|
||||
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
|
||||
#include <SDL3/SDL_error.h> // Para SDL_GetError
|
||||
#include <SDL3/SDL_events.h> // Para SDL_DISABLE
|
||||
#include <SDL3/SDL.h> // Para SDL_GAMEPAD_BUTTON_B, SDL_CO...
|
||||
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DR...
|
||||
#include <SDL3/SDL_mouse.h> // Para SDL_ShowCursor
|
||||
#include <SDL3/SDL_scancode.h> // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN
|
||||
#include <SDL3/SDL_stdinc.h> // Para Uint32, SDL_bool
|
||||
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOO...
|
||||
#include <stdio.h> // Para printf, perror
|
||||
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU
|
||||
#include <unistd.h> // Para getuid
|
||||
#include <algorithm> // Para min
|
||||
#include <chrono> // Para chrono
|
||||
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, rand
|
||||
#include <iostream> // Para basic_ostream, operator<<, basi...
|
||||
#include <memory> // Para make_unique, unique_ptr
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <string> // Para operator+, char_traits, allocator
|
||||
#include <vector> // Para vector
|
||||
#include "asset.h" // Para Asset, AssetType
|
||||
#include "credits.h" // Para Credits
|
||||
#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_...
|
||||
#include "hiscore_table.h" // Para HiScoreTable
|
||||
#include "input.h" // Para Input, InputAction
|
||||
#include "instructions.h" // Para Instructions
|
||||
#include "intro.h" // Para Intro
|
||||
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV...
|
||||
#include "lang.h" // Para Code, loadFromFile
|
||||
#include "logo.h" // Para Logo
|
||||
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
|
||||
#include "notifier.h" // Para Notifier
|
||||
#include "on_screen_help.h" // Para OnScreenHelp
|
||||
#include "options.h" // Para Options, options, OptionsContro...
|
||||
#include "param.h" // Para Param, ParamGame, param, loadPa...
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen
|
||||
#include "section.h" // Para Name, Options, name, options
|
||||
#include "title.h" // Para Title
|
||||
#include "utils.h" // Para Overrides, overrides
|
||||
#include <SDL3/SDL.h> // Para SDL_Init, SDL_Quit, SDL_INIT_EV...
|
||||
#include <SDL3/SDL_audio.h> // Para AUDIO_S16
|
||||
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
|
||||
#include <SDL3/SDL_error.h> // Para SDL_GetError
|
||||
#include <SDL3/SDL_events.h> // Para SDL_DISABLE
|
||||
#include <SDL3/SDL.h> // Para SDL_GAMEPAD_BUTTON_B, SDL_CO...
|
||||
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DR...
|
||||
#include <SDL3/SDL_mouse.h> // Para SDL_ShowCursor
|
||||
#include <SDL3/SDL_scancode.h> // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN
|
||||
#include <SDL3/SDL_stdinc.h> // Para Uint32, SDL_bool
|
||||
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOO...
|
||||
#include <stdio.h> // Para printf, perror
|
||||
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU
|
||||
#include <unistd.h> // Para getuid
|
||||
#include <algorithm> // Para min
|
||||
#include <chrono> // Para chrono
|
||||
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, rand
|
||||
#include <iostream> // Para basic_ostream, operator<<, basi...
|
||||
#include <memory> // Para make_unique, unique_ptr
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <string> // Para operator+, char_traits, allocator
|
||||
#include <vector> // Para vector
|
||||
#include "asset.h" // Para Asset, AssetType
|
||||
#include "credits.h" // Para Credits
|
||||
#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_...
|
||||
#include "hiscore_table.h" // Para HiScoreTable
|
||||
#include "input.h" // Para Input, InputAction
|
||||
#include "instructions.h" // Para Instructions
|
||||
#include "intro.h" // Para Intro
|
||||
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV...
|
||||
#include "lang.h" // Para Code, loadFromFile
|
||||
#include "logo.h" // Para Logo
|
||||
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
|
||||
#include "notifier.h" // Para Notifier
|
||||
#include "on_screen_help.h" // Para OnScreenHelp
|
||||
#include "options.h" // Para Options, options, OptionsContro...
|
||||
#include "param.h" // Para Param, ParamGame, param, loadPa...
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen
|
||||
#include "section.h" // Para Name, Options, name, options
|
||||
#include "title.h" // Para Title
|
||||
#include "utils.h" // Para Overrides, overrides
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h> // Para getpwuid, passwd
|
||||
@@ -296,7 +296,7 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Obtiene información sobre la pantalla
|
||||
auto DM= SDL_GetCurrentDisplayMode(0);
|
||||
auto DM = SDL_GetCurrentDisplayMode(0);
|
||||
|
||||
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||
options.video.window.max_zoom = std::min(DM->w / param.game.width, DM->h / param.game.height);
|
||||
@@ -327,14 +327,14 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
Uint32 flags = 0;
|
||||
//Uint32 flags = 0;
|
||||
if (options.video.v_sync)
|
||||
{
|
||||
//flags = SDL_RENDERER_PRESENTVSYNC;
|
||||
// flags = SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
|
||||
// La aceleración se activa según el define
|
||||
//flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
||||
// flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
||||
|
||||
renderer_ = SDL_CreateRenderer(window_, nullptr);
|
||||
|
||||
@@ -347,7 +347,7 @@ bool Director::initSDL()
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
|
||||
SDL_SetRenderLogicalPresentation(renderer_, param.game.width, param.game.height, SDL_LOGICAL_PRESENTATION_INTEGER_SCALE);
|
||||
SDL_SetWindowFullscreen(window_, static_cast<Uint32>(options.video.mode));
|
||||
SDL_SetWindowFullscreen(window_, static_cast<Uint32>(options.video.fullscreen));
|
||||
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
}
|
||||
@@ -799,9 +799,9 @@ std::string Director::getLangFile(lang::Code code)
|
||||
|
||||
#ifdef ARCADE
|
||||
// Apaga el sistema
|
||||
void Director::shutdownSystem(bool shouldShutdown)
|
||||
void Director::shutdownSystem(bool should_shutdown)
|
||||
{
|
||||
if (shouldShutdown)
|
||||
if (should_shutdown)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Apaga el sistema en Windows
|
||||
|
||||
Reference in New Issue
Block a user