Añadida información de la pantalla antes de crear la ventana

This commit is contained in:
2024-09-10 08:12:37 +02:00
parent 824bc08077
commit f071b60212
3 changed files with 10 additions and 8 deletions

View File

@@ -45,10 +45,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
#endif
SDL_DisplayMode DM;
SDL_GetCurrentDisplayMode(0, &DM);
displayWidth = DM.w;
displayHeight = DM.h;
displayRefreshRate = DM.refresh_rate;
infoResolution = std::to_string(displayWidth) + " X " + std::to_string(displayHeight) + " AT " + std::to_string(displayRefreshRate) + " HZ";
infoResolution = std::to_string(DM.w) + " X " + std::to_string(DM.h) + " AT " + std::to_string(DM.refresh_rate) + " HZ";
// Crea los objetos
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
@@ -144,7 +141,7 @@ void Screen::blit()
void Screen::setVideoMode(int videoMode)
{
#ifdef ARCADE
videoMode = SCREEN_VIDEO_MODE_WINDOW;
//videoMode = SCREEN_VIDEO_MODE_WINDOW;
#endif
// Si está activo el modo ventana quita el borde

View File

@@ -38,9 +38,6 @@ private:
int fpsCounter; // Contador de frames por segundo
int fps; // Frames calculados en el último segundo
bool showInfo; // Indica si ha de mostrar/ocultar la información de la pantalla
int displayWidth; // Anchura de la pantalla
int displayHeight; // Altura de la pantalla
int displayRefreshRate; // Frecuencia de refresco de la pantalla
std::string infoResolution; // Texto con la informacion de la pantalla
struct effect_t

View File

@@ -207,6 +207,14 @@ bool Director::initSDL()
// Inicia el generador de numeros aleatorios
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
// Muestra información de la pantalla
if (options->console)
{
SDL_DisplayMode DM;
SDL_GetCurrentDisplayMode(0, &DM);
std::cout << "\nDisplay info: " + std::to_string(DM.w) + "x" + std::to_string(DM.h) + " @ " + std::to_string(DM.refresh_rate) + "Hz" << std::endl;
}
// Establece el filtro de la textura
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->video.filter).c_str()))
{