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