void Starfield::handle_input() { static boost::format speed_format("Speed %1%: %|2$.2f|"); if (newkey) { switch (lastkey_sym) { case SDLK_PAGEDOWN: nextPattern(); displayMessage(pattern->title(), "patternName"); break; case SDLK_PAGEUP: prevPattern(); displayMessage(pattern->title(), "patternName"); break; case SDLK_END: speed += 0.05f; displayMessage((speed_format % 1 % speed).str(), "speed1"); break; case SDLK_DELETE: speed -= 0.05f; displayMessage((speed_format % 1 % speed).str(), "speed1"); break; case SDLK_HOME: speed2 += 0.05f; displayMessage((speed_format % 2 % speed2).str(), "speed2"); break; case SDLK_INSERT: speed2 -= 0.05f; displayMessage((speed_format % 2 % speed2).str(), "speed2"); break; case SDLK_F1: showHelp = !showHelp; break; default: break; } } }
int OSSex::cyclePattern() { return nextPattern(); }
void loadDataFromFile(StorageCacheImpl* cache) { bool structIsCorrect = true; char* name = NULL; unsigned int nameLen; unsigned int numExtra; unsigned int curFunc = 0; unsigned int curPatt = 0; unsigned int func; unsigned int patt; HfInfo file; if ( hfOpenRead(&file, cache->fpath) == FILE_NOT_FOUND ) { cache->isPopulate = false; return; } // Read file Header loadHeader(&file); // Read pattern header structIsCorrect &= loadPatternDataFromFile(&file, &name, &nameLen, &numExtra); while (structIsCorrect) { unsigned int func = curFunc; unsigned int patt = curPatt; bool ret; BlasPatternInfo* bPatt = getPatternInfo(cache, func, patt); while (bPatt != NULL && memcmp(name, bPatt->name, nameLen) != 0 ) { nextPattern(cache, &func, &patt); bPatt = getPatternInfo(cache, func, patt); } if (bPatt != NULL) { bPatt->sstatus = SS_CORRECT_DATA; // Read pattern data ret = readPatternData(&file, bPatt, numExtra); // go to next pattern nextPattern(cache, &func, &patt); // if the pattern is read witch error or not completely if (!ret) { bPatt = getPatternInfo(cache, func, patt); hfJump(&file, bPatt->offset); } curFunc = func; curPatt = patt; } free(name); name = NULL; structIsCorrect &= loadPatternDataFromFile(&file, &name, &nameLen, &numExtra ); } for (func =0; func < BLAS_FUNCTIONS_NUMBER; ++ func) { BlasFunctionInfo* bFunc = &cache->functionInfo[func]; for (patt =0; patt < bFunc->numPatterns; ++ patt){ BlasPatternInfo* bPatt = &bFunc->pattInfo[patt]; if (bPatt->sstatus == SS_NOLOAD) { POSFILE ret = findPattern(&file, bPatt->name); if (ret != 0) { loadPatternDataFromFile(&file, &name, &nameLen, &numExtra ); readPatternData(&file, bPatt, numExtra); } } } } free(name); cache->isPopulate = true; hfClose(&file); checkOffset(cache->functionInfo); }