void ImportNotes::cmbSearchCategory_indexChanged(int index_) { if (index_==0) { loadAllEvents(); txtSearch_textChanged(ui.txtSearch->text()); } else { loadRescentEvents(); txtSearch_textChanged(ui.txtSearch->text()); } }
bool DataLoader::load(std::string fileName) { FILE *fp; fp = fopen(fileName.c_str(), "rb"); /* lendo o numero magico e verificando se de fato é um número mágico */ int magic_number; fread(&magic_number, 1, sizeof(int), fp); if(magic_number != gameData->MAGIC_NUMBER) { return false; } fread(&gameData->version, 1, sizeof(int), fp); gameData->filePath = fileName; /* lê o nome do jogo */ /* char *nome_jogo; int tamanho_nome_jogo; fread(&tamanho_nome_jogo, 1, sizeof(int), fp); nome_jogo = (char*) calloc(tamanho_nome_jogo + 1, sizeof(char)); nome_jogo[tamanho_nome_jogo] = '\0'; fread(nome_jogo, sizeof(char), tamanho_nome_jogo, fp); */ char *nome_jogo; nome_jogo = loadString(fp); gameData->gameName = new std::string(nome_jogo); /* lê a resolução do jogo */ fread(&gameData->resWidth, 1, sizeof(int), fp); fread(&gameData->resHeight, 1, sizeof(int), fp); fread(&gameData->deathAction, 1, sizeof(int), fp); fread(&gameData->gameOverAction, 1, sizeof(int), fp); fread(&gameData->looseLifes, 1, sizeof(bool), fp); fread(&gameData->totalLives, 1, sizeof(int), fp); loadTilesetList(fp); /* inicio das adicoes - 12 de março - PENDENTES NO RUNTIME -- OK*/ loadAnimationDataList(fp); /* fim */ loadObjectList(fp); loadNpcObjectsToBounce(fp); loadObjectSkills(fp); loadBackgroundList(fp); gameData->mapList = loadMapList(fp); loadAllVariableLists(fp); loadAllEvents(fp); /* lendo os nomes das imagens das telas principais */ gameData->titleScreenData.backgroundFile = std::string(loadString(fp)); gameData->optionsScreenFile = std::string(loadString(fp)); gameData->gameoverScreenFile = std::string(loadString(fp)); /* lendo os nomes das musicas das telas principais */ gameData->titleScreenMusic = std::string(loadString(fp)); gameData->optionsScreenMusic = std::string(loadString(fp)); gameData->gameOverScreenMusic = std::string(loadString(fp)); /* lendo a id do mapa inicial */ fread(&gameData->idFirstMap, 1, sizeof(int), fp); fclose(fp); return true; }
bool GameData::loadFile(std::string fileName) { FILE *fp; if(arg1 != NULL) { fp = fopen(std::string(arg1->c_str()).append(fileName.c_str()).c_str(), "rb"); } else { fp = fopen(fileName.c_str(), "rb"); } std::cout << fileName << std::endl; /* lendo o numero magico e verificando se de fato é um número mágico */ int magic_number; fread(&magic_number, 1, sizeof(int), fp); if(magic_number != MAGIC_NUMBER) { return false; } fread(&version, 1, sizeof(int), fp); gameName = new std::string(loadString(fp)); fread(&resWidth, 1, sizeof(int), fp); fread(&resHeight, 1, sizeof(int), fp); fread(&deathAction, 1, sizeof(int), fp); fread(&gameOverAction, 1, sizeof(int), fp); fread(&looseLifes, 1, sizeof(bool), fp); fread(&totalLives, 1, sizeof(int), fp); loadTileSetList(fp); loadAnimationDataList(fp); loadObjectList(fp); loadNpcObjectsToBounce(fp); loadObjectSkills(fp); loadBackgroundDataList(fp); loadMapList(fp); loadAllVariableLists(fp); loadAllEvents(fp); /* lendo os nomes das imagens das telas principais */ titleScreenFile = std::string(loadString(fp)); optionsScreenFile = std::string(loadString(fp)); gameoverScreenFile = std::string(loadString(fp)); /* lendo os nomes das musicas das telas principais */ titleScreenMusic = std::string(loadString(fp)); optionsScreenMusic = std::string(loadString(fp)); gameOverScreenMusic = std::string(loadString(fp)); /* lendo a id do mapa inicial */ fread(&idFirstMap, 1, sizeof(int), fp); fclose(fp); return true; }