Modificado unLoadMedia por saveConfig

This commit is contained in:
2022-08-09 17:16:12 +02:00
parent d7bd5a8ab1
commit 63bf42880e
2 changed files with 19 additions and 68 deletions

View File

@@ -246,7 +246,7 @@ bool Director::loadConfig()
{
// Indicador de éxito en la carga
bool success = true;
const std::string p = asset->get("config-bin").c_str();
const std::string p = asset->get("config.bin").c_str();
const std::string filename = p.substr(p.find_last_of("\\/") + 1);
// Abre el fichero con la configuracion de las opciones para leer en binario
@@ -297,19 +297,13 @@ bool Director::loadConfig()
return success;
}
// Descrga los recursos necesarios
bool Director::unLoadMedia(Uint8 section)
// Guarda el fichero de configuración
bool Director::saveConfig()
{
// Indicador de éxito en la carga
bool success = true;
std::string p;
switch (section)
{
case GAME_SECTION_INIT:
{
p = asset->get("config-bin");
std::string filename = p.substr(p.find_last_of("\\/") + 1);
const std::string p = asset->get("config.bin");
const std::string filename = p.substr(p.find_last_of("\\/") + 1);
// Abre el fichero de puntuación para escribir
SDL_RWops *file = SDL_RWFromFile(p.c_str(), "w+b");
@@ -329,49 +323,6 @@ bool Director::unLoadMedia(Uint8 section)
{
printf("Error: Unable to save %s file! %s\n", filename.c_str(), SDL_GetError());
}
}
break;
case GAME_SECTION_TITLE:
{
}
break;
case GAME_SECTION_PLAYING:
{
}
break;
case GAME_SECTION_GAME_OVER_SCREEN:
{
}
break;
case GAME_SECTION_INTRO:
{
}
break;
case GAME_SECTION_DEMO:
{
}
break;
case GAME_SECTION_INSTRUCTIONS:
{
}
break;
case GAME_SECTION_LOGO:
{
}
break;
default:
{
}
break;
}
return success;
}

View File

@@ -87,8 +87,8 @@ private:
// Carga el fichero de configuración
bool loadConfig();
// Descrga los recursos necesarios
bool unLoadMedia(Uint8 section);
// Guarda el fichero de configuración
bool saveConfig();
// Obtiene el valor de la variable
Uint8 getGameSection();