Compare commits
2 Commits
65b8988ba2
...
149e422489
| Author | SHA1 | Date | |
|---|---|---|---|
| 149e422489 | |||
| 4c2528ba93 |
@@ -39,6 +39,7 @@ enum inputs_e
|
||||
input_video_shaders,
|
||||
input_reset,
|
||||
input_mute,
|
||||
input_showfps,
|
||||
|
||||
// Input obligatorio
|
||||
input_number_of_inputs
|
||||
|
||||
@@ -40,6 +40,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
|
||||
fpsTicks = 0;
|
||||
fpsCounter = 0;
|
||||
fps = 0;
|
||||
showFps = false;
|
||||
|
||||
// Crea los objetos
|
||||
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
|
||||
@@ -89,10 +90,14 @@ void Screen::blit()
|
||||
// Pinta las notificaciones
|
||||
notify->render();
|
||||
|
||||
// Pinta el contador de FPS
|
||||
// Actualiza el contador de FPS
|
||||
fpsCounter++;
|
||||
dbg_print(0, 0, std::to_string(fps).c_str(), 255, 255, 255);
|
||||
|
||||
|
||||
// Pinta en pantalla el contador de FPS
|
||||
if (showFps)
|
||||
{
|
||||
dbg_print(0, 0, std::to_string(fps).c_str(), 255, 255, 255);
|
||||
}
|
||||
|
||||
#ifdef NO_SHADERS
|
||||
// Vuelve a dejar el renderizador en modo normal
|
||||
@@ -347,6 +352,11 @@ void Screen::checkInput()
|
||||
const std::string value = options->video.shaders ? "on" : "off";
|
||||
showNotification("Shaders " + value);
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_showfps, DO_NOT_ALLOW_REPEAT))
|
||||
{
|
||||
showFps = !showFps;
|
||||
}
|
||||
}
|
||||
|
||||
// Agita la pantalla
|
||||
|
||||
@@ -39,6 +39,7 @@ private:
|
||||
Uint32 fpsTicks; // Ticks para contar los frames por segundo
|
||||
int fpsCounter; // Contador de frames por segundo
|
||||
int fps; // Frames calculados en el último segundo
|
||||
bool showFps; // Indica si ha de mostrar/ocultar la información de los frames por segundo en pantalla
|
||||
|
||||
struct effect_t
|
||||
{
|
||||
|
||||
@@ -132,6 +132,7 @@ void Director::initInput()
|
||||
input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3);
|
||||
input->bindKey(input_video_shaders, SDL_SCANCODE_F4);
|
||||
input->bindKey(input_mute, SDL_SCANCODE_F5);
|
||||
input->bindKey(input_showfps, SDL_SCANCODE_F6);
|
||||
input->bindKey(input_reset, SDL_SCANCODE_F10);
|
||||
|
||||
const int numGamePads = input->getNumControllers();
|
||||
|
||||
Reference in New Issue
Block a user