SDL bug: no va el mode de pantalla completa en macos
This commit is contained in:
2
source/external/jail_shader.cpp
vendored
2
source/external/jail_shader.cpp
vendored
@@ -299,7 +299,7 @@ namespace shader
|
|||||||
}
|
}
|
||||||
|
|
||||||
usingOpenGL = true;
|
usingOpenGL = true;
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Sistema de shaders inicializado correctamente.");
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Shader system initialized successfully.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,8 +416,6 @@ void Resource::calculateTotalResources()
|
|||||||
{
|
{
|
||||||
auto list = Asset::get()->getListByType(asset_type);
|
auto list = Asset::get()->getListByType(asset_type);
|
||||||
total += list.size();
|
total += list.size();
|
||||||
std::string log = std::to_string(list.size()) + " - " + std::to_string(total);
|
|
||||||
SDL_Log("%s", log.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loading_count_ = ResourceCount(total);
|
loading_count_ = ResourceCount(total);
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ void Screen::renderScreen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el modo de video
|
// Establece el modo de video
|
||||||
void Screen::setFullscreenMode(bool mode)
|
void Screen::setFullscreenMode()
|
||||||
{
|
{
|
||||||
Options::video.fullscreen = mode;
|
|
||||||
SDL_SetWindowFullscreen(window_, Options::video.fullscreen);
|
SDL_SetWindowFullscreen(window_, Options::video.fullscreen);
|
||||||
initShaders();
|
initShaders();
|
||||||
}
|
}
|
||||||
@@ -270,14 +269,17 @@ void Screen::loadShaders()
|
|||||||
// Inicializa los shaders
|
// Inicializa los shaders
|
||||||
void Screen::initShaders()
|
void Screen::initShaders()
|
||||||
{
|
{
|
||||||
|
if (Options::video.shaders)
|
||||||
|
{
|
||||||
loadShaders();
|
loadShaders();
|
||||||
shader::init(window_, game_canvas_, shader_source_);
|
shader::init(window_, game_canvas_, shader_source_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calcula el tamaño de la ventana
|
// Calcula el tamaño de la ventana
|
||||||
void Screen::adjustWindowSize()
|
void Screen::adjustWindowSize()
|
||||||
{
|
{
|
||||||
// if (!Options::video.fullscreen)
|
if (!Options::video.fullscreen)
|
||||||
{
|
{
|
||||||
// Establece el nuevo tamaño
|
// Establece el nuevo tamaño
|
||||||
const int WIDTH = param.game.width * Options::window.size;
|
const int WIDTH = param.game.width * Options::window.size;
|
||||||
@@ -326,55 +328,63 @@ void Screen::renderAttenuate()
|
|||||||
// Arranca SDL VIDEO y crea la ventana
|
// Arranca SDL VIDEO y crea la ventana
|
||||||
bool Screen::initSDLVideo()
|
bool Screen::initSDLVideo()
|
||||||
{
|
{
|
||||||
// Indicador de éxito
|
// Inicializar SDL
|
||||||
auto success = true;
|
|
||||||
|
|
||||||
// Inicializa SDL
|
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO))
|
if (!SDL_Init(SDL_INIT_VIDEO))
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_VIDEO could not initialize! SDL Error: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
success = false;
|
"FATAL: Failed to initialize SDL_VIDEO! SDL Error: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "\n** SDL_VIDEO: INITIALIZING\n");
|
|
||||||
|
|
||||||
|
// Obtener información de la pantalla
|
||||||
getDisplayInfo();
|
getDisplayInfo();
|
||||||
|
|
||||||
|
// Configurar hint para OpenGL
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
|
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
|
||||||
{
|
{
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Warning: opengl not enabled!");
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Warning: Failed to set OpenGL hint!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea la ventana
|
// Crear ventana
|
||||||
window_ = SDL_CreateWindow(Options::window.caption.c_str(), param.game.width * Options::window.size, param.game.height * Options::window.size, SDL_WINDOW_OPENGL);
|
window_ = SDL_CreateWindow(
|
||||||
|
Options::window.caption.c_str(),
|
||||||
|
param.game.width * Options::window.size,
|
||||||
|
param.game.height * Options::window.size,
|
||||||
|
SDL_WINDOW_OPENGL);
|
||||||
|
|
||||||
if (!window_)
|
if (!window_)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window could not be created! SDL Error: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
success = false;
|
"FATAL: Failed to create window! SDL Error: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
SDL_Quit();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
renderer_ = SDL_CreateRenderer(window_, nullptr);
|
|
||||||
|
|
||||||
|
// Crear renderer
|
||||||
|
renderer_ = SDL_CreateRenderer(window_, nullptr);
|
||||||
if (!renderer_)
|
if (!renderer_)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Renderer could not be created! SDL Error: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
success = false;
|
"FATAL: Failed to create renderer! SDL Error: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
SDL_DestroyWindow(window_);
|
||||||
|
window_ = nullptr;
|
||||||
|
SDL_Quit();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// Configurar renderer
|
||||||
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
|
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
|
||||||
SDL_SetRenderLogicalPresentation(renderer_, param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
SDL_SetRenderLogicalPresentation(renderer_, param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
||||||
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
||||||
SDL_SetRenderVSync(renderer_, Options::video.v_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
SDL_SetRenderVSync(renderer_, Options::video.v_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
||||||
SDL_SetWindowFullscreen(window_, Options::video.fullscreen);
|
SDL_SetWindowFullscreen(window_, Options::video.fullscreen);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "** SDL_VIDEO: INITIALIZATION COMPLETE\n");
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "SDL Video initialized successfully.");
|
||||||
return success;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene información sobre la pantalla
|
// Obtiene información sobre la pantalla
|
||||||
@@ -458,8 +468,8 @@ void Screen::applySettings()
|
|||||||
{
|
{
|
||||||
SDL_SetRenderVSync(renderer_, Options::video.v_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
SDL_SetRenderVSync(renderer_, Options::video.v_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED);
|
||||||
SDL_SetRenderLogicalPresentation(Screen::get()->getRenderer(), param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
SDL_SetRenderLogicalPresentation(Screen::get()->getRenderer(), param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
||||||
setFullscreenMode();
|
|
||||||
adjustWindowSize();
|
adjustWindowSize();
|
||||||
|
setFullscreenMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea el objeto de texto
|
// Crea el objeto de texto
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
void coreRender(); // Vuelca el contenido del renderizador en pantalla exceptuando ciertas partes
|
void coreRender(); // Vuelca el contenido del renderizador en pantalla exceptuando ciertas partes
|
||||||
|
|
||||||
// --- Configuración de ventana y render ---
|
// --- Configuración de ventana y render ---
|
||||||
void setFullscreenMode(bool mode = Options::video.fullscreen); // Establece el modo de video
|
void setFullscreenMode(); // Establece el modo de pantalla completa
|
||||||
void toggleFullscreen(); // Cambia entre pantalla completa y ventana
|
void toggleFullscreen(); // Cambia entre pantalla completa y ventana
|
||||||
void setWindowZoom(int size); // Cambia el tamaño de la ventana
|
void setWindowZoom(int size); // Cambia el tamaño de la ventana
|
||||||
bool decWindowSize(); // Reduce el tamaño de la ventana
|
bool decWindowSize(); // Reduce el tamaño de la ventana
|
||||||
|
|||||||
Reference in New Issue
Block a user