Commit para seguir en otro ordenador
This commit is contained in:
@@ -50,7 +50,7 @@ Director::Director(std::string path)
|
||||
initSDL();
|
||||
|
||||
// Crea el objeto para dibujar en pantalla (Requiere initSDL)
|
||||
mScreen = new Screen(mWindow, mRenderer, mOptions->screenWidth, mOptions->screenHeight, mOptions->integerScale);
|
||||
mScreen = new Screen(mWindow, mRenderer, mOptions);
|
||||
|
||||
// Inicializa JailAudio
|
||||
initJailAudio();
|
||||
@@ -361,15 +361,15 @@ bool Director::loadConfigFile()
|
||||
{
|
||||
// Pone unos valores por defecto
|
||||
mOptions->fullScreenMode = 0;
|
||||
mOptions->windowSize = 1;
|
||||
mOptions->windowSize = 3;
|
||||
mOptions->language = en_UK;
|
||||
mOptions->difficulty = DIFFICULTY_NORMAL;
|
||||
mOptions->input[0].deviceType = INPUT_USE_KEYBOARD;
|
||||
mOptions->input[1].deviceType = INPUT_USE_GAMECONTROLLER;
|
||||
mOptions->filter = FILTER_NEAREST;
|
||||
mOptions->vSync = true;
|
||||
mOptions->screenWidth = 544;
|
||||
mOptions->screenHeight = 834;
|
||||
mOptions->screenWidth = 2560/4;
|
||||
mOptions->screenHeight = 1600/4;
|
||||
mOptions->integerScale = false;
|
||||
|
||||
// Indicador de éxito en la carga
|
||||
|
||||
@@ -2,22 +2,36 @@
|
||||
#include "const.h"
|
||||
|
||||
// Constructor
|
||||
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, int screenWidth, int screenHeight, bool integerScale)
|
||||
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options)
|
||||
{
|
||||
// Inicializa variables
|
||||
mWindow = window;
|
||||
mRenderer = renderer;
|
||||
mOptions = options;
|
||||
|
||||
mScreenWidth = screenWidth;
|
||||
mScreenHeight = screenHeight;
|
||||
mScreenWidth = mOptions->screenWidth;
|
||||
mScreenHeight = mOptions->screenHeight;
|
||||
mGameCanvasWidth = SCREEN_WIDTH;
|
||||
mGameCanvasHeight = SCREEN_HEIGHT;
|
||||
|
||||
mDest.x = (mScreenWidth - mGameCanvasWidth) / 2;
|
||||
mDest.y = (mScreenHeight - mGameCanvasHeight) / 2;
|
||||
mIntegerScale = integerScale;
|
||||
mIntegerScale = mOptions->integerScale;
|
||||
//mIntegerScale = true;
|
||||
|
||||
/*
|
||||
|
||||
Si el juego es en pantalla completa, calcular la resolución del escritorio y ponerla a las variables
|
||||
con un método nuevo.
|
||||
|
||||
Si el juego es en ventana, se aplica el gamecanvas multiplicado por el window size, para jugar
|
||||
sin bordes
|
||||
|
||||
Hacer método setRes(w,h)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Calcula el tamaño de la escala máxima
|
||||
int scale = 0;
|
||||
while (((mGameCanvasWidth * (scale + 1)) <= mScreenWidth) && ((mGameCanvasHeight * (scale + 1)) <= mScreenHeight))
|
||||
@@ -29,8 +43,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, int screenWidth, int
|
||||
{
|
||||
mDest.w = mGameCanvasWidth * scale;
|
||||
mDest.h = mGameCanvasHeight * scale;
|
||||
mDest.x = (mScreenWidth - mGameCanvasWidth) / 2;
|
||||
mDest.y = (mScreenHeight - mGameCanvasHeight) / 2;
|
||||
mDest.x = (mScreenWidth - mDest.w) / 2;
|
||||
mDest.y = (mScreenHeight - mDest.h) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -39,6 +53,12 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, int screenWidth, int
|
||||
mDest.x = mDest.y = 0;
|
||||
}
|
||||
|
||||
if (mOptions->fullScreenMode == 0)
|
||||
{
|
||||
mOptions->screenWidth = mScreenWidth = mGameCanvasWidth;
|
||||
mOptions->screenHeight = mScreenHeight = mGameCanvasHeight;
|
||||
}
|
||||
|
||||
mBorderColor = {0x27, 0x27, 0x36};
|
||||
mBorderColor = {0x00, 0x00, 0x00};
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
class Screen
|
||||
{
|
||||
private:
|
||||
SDL_Window *mWindow; // Ventana de la aplicación
|
||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
||||
SDL_Texture *mGameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
|
||||
SDL_Window *mWindow; // Ventana de la aplicación
|
||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
||||
SDL_Texture *mGameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
|
||||
options_t *mOptions; // Variable con todas las opciones del programa
|
||||
|
||||
int mScreenWidth; // Ancho de la pantalla
|
||||
int mScreenHeight; // Alto de la pantalla
|
||||
@@ -23,7 +24,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Screen(SDL_Window *windows, SDL_Renderer *renderer, int screenWidth, int screenHeight, bool integerScale = false);
|
||||
Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options);
|
||||
|
||||
// Destructor
|
||||
~Screen();
|
||||
|
||||
@@ -517,7 +517,10 @@ void Title::updateMenuLabels()
|
||||
void Title::applyOptions()
|
||||
{
|
||||
SDL_SetWindowFullscreen(mWindow, mOptions->fullScreenMode);
|
||||
SDL_SetWindowSize(mWindow, mOptions->screenWidth * mOptions->windowSize, mOptions->screenHeight * mOptions->windowSize);
|
||||
if (mOptions->fullScreenMode == 0)
|
||||
SDL_SetWindowSize(mWindow, mOptions->screenWidth * mOptions->windowSize, mOptions->screenHeight * mOptions->windowSize);
|
||||
//SDL_RenderSetLogicalSize(mRenderer, mOptions->screenWidth, mOptions->screenHeight);
|
||||
|
||||
mLang->setLang(mOptions->language);
|
||||
|
||||
updateMenuLabels();
|
||||
|
||||
Reference in New Issue
Block a user