Afegit codi per apagar el sistema al eixir del joc
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <SDL2/SDL_scancode.h> // for SDL_SCANCODE_0, SDL_SCANCODE_DOWN
|
||||
#include <SDL2/SDL_stdinc.h> // for SDL_bool, Uint32
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <cstdlib> // for system
|
||||
#include <errno.h> // for errno, EEXIST, EACCES, ENAMETOO...
|
||||
#include <stdio.h> // for printf, perror
|
||||
#include <string.h> // for strcmp
|
||||
@@ -411,7 +412,7 @@ bool Director::setFileList()
|
||||
Asset::get()->add(prefix + "/data/gfx/game/game_grass.png", AssetType::BITMAP);
|
||||
Asset::get()->add(prefix + "/data/gfx/game/game_power_meter.png", AssetType::BITMAP);
|
||||
Asset::get()->add(prefix + "/data/gfx/game/game_sky_colors.png", AssetType::BITMAP);
|
||||
|
||||
|
||||
Asset::get()->add(prefix + "/data/gfx/game_text/game_text_1000_points.png", AssetType::BITMAP);
|
||||
Asset::get()->add(prefix + "/data/gfx/game_text/game_text_2500_points.png", AssetType::BITMAP);
|
||||
Asset::get()->add(prefix + "/data/gfx/game_text/game_text_5000_points.png", AssetType::BITMAP);
|
||||
@@ -697,6 +698,12 @@ int Director::run()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ARCADE
|
||||
// Comprueba si ha de apagar el sistema
|
||||
if (section::options == section::Options::QUIT_SHUTDOWN)
|
||||
shutdownSystem();
|
||||
#endif
|
||||
|
||||
const int return_code = section::options == section::Options::QUIT_NORMAL ? 0 : 1;
|
||||
return return_code;
|
||||
}
|
||||
@@ -723,4 +730,22 @@ std::string Director::getLangFile(lang::Code code)
|
||||
}
|
||||
|
||||
return Asset::get()->get("en_UK.txt");
|
||||
}
|
||||
|
||||
// Apaga el sistema
|
||||
void shutdownSystem()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Apaga el sistema en Windows
|
||||
system("shutdown /s /t 0");
|
||||
#elif __APPLE__
|
||||
// Apaga el sistema en macOS
|
||||
system("sudo shutdown -h now");
|
||||
#elif __linux__
|
||||
// Apaga el sistema en Linux
|
||||
system("shutdown -h now");
|
||||
#else
|
||||
// Sistema operativo no compatible
|
||||
#error "Sistema operativo no soportado"
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user