static int hotKeyShowList( GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf) { GOC_FLAGS f = goc_elementGetFlag(lLista); if ( f & GOC_EFLAGA_PAINTED ) { goc_listClear(lLista); goc_elementIsFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE); //goc_elementSetFlag(lLista, f); goc_systemRepaintUnder(lLista); fflush(stdout); } else { int size = 0; const char **ptr; doAction(ACTION_PLAYLIST_GETSIZE, &size); doAction(ACTION_PLAYLIST_GETTABLE, &ptr); goc_listSetExtTable(lLista, ptr, size); doAction(ACTION_PLAYLIST_GETACTUAL, &size); goc_sellistSelect(lLista, size); goc_listSetCursor(lLista, size); goc_elementOrFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE); goc_systemFocusOn(lLista); } goc_systemSendMsg(lLista, GOC_MSG_PAINT, 0, 0); }
// TODO: Dodanie odswiezenia listy, jesli jest widoczna po dodaniu pliku lub // katalogu z zachowaniem pozycji kursora static int hotKeyAddFolder( GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf) { GOC_FLAGS f = goc_elementGetFlag(pLista); if ( f & GOC_EFLAGA_PAINTED ) { goc_labelRemLines(nStatus); goc_elementIsFlag(pLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE); goc_systemRepaintUnder(pLista); goc_systemRepaintUnder(nStatus); fflush(stdout); } else { goc_elementOrFlag(pLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE); goc_systemFocusOn(pLista); goc_systemSendMsg(pLista, GOC_MSG_PAINT, 0, 0); } return GOC_ERR_OK; }
int main(int argc, char **argv) { int nStartPoints = 0; GOC_Arguments* args = NULL; char *levelChars = "signs"; // TODO: for string use stringCopy to alloc int numberOfStartPoints = 20; char* genSystem = "points"; srand(time(NULL)); memset(&context, 0, sizeof(stContext)); context.configuration.maxx = MAXX; context.configuration.maxy = MAXY; context.configuration.maxz = MAXZ; context.configuration.margines = MARGINES; context.configuration.minLandMass = MINLM; context.configuration.maxLandMass = MAXLM; // ustalanie argumentow args = goc_argumentsAdd(args, "-h", "Print this help", goc_argumentHelpFunction, &args); args = goc_argumentsAdd(args, "--help", "Print this help", goc_argumentHelpFunction, &args); args = goc_argumentsAdd(args, "--xsize", "Set x size of map (int:200)", goc_argumentIntFunction, &context.configuration.maxx); args = goc_argumentsAdd(args, "--ysize", "Set y size of map (int:100)", goc_argumentIntFunction, &context.configuration.maxy); args = goc_argumentsAdd(args, "--level", "Set type of level show (signs/numbers)", goc_argumentStringFunction, &levelChars); args = goc_argumentsAdd(args, "--points", "Number of start points [system:civ/points] (int:20)", goc_argumentIntFunction, &numberOfStartPoints); args = goc_argumentsAdd(args, "--system", "Used generation system (points/civ/rain/bactery/drops)", goc_argumentStringFunction, &genSystem); args = goc_argumentsAdd(args, "--minlandmass", "Minimum land mass of generated land [system:civ/rain] (int:10)", goc_argumentIntFunction, &context.configuration.minLandMass); args = goc_argumentsAdd(args, "--maxlandmass", "Maximum land mass of generated land [system:civ/rain] (int:60)", goc_argumentIntFunction, &context.configuration.maxLandMass); args = goc_argumentsAdd(args, "--margines", "Set margines value of random new points [system:civ/points/rain] (int:10)", goc_argumentIntFunction, &context.configuration.margines); systemDropsAddArgs(args); args = goc_argumentsSetUnknownFunction(args, goc_argumentHelpFunction); if ( goc_argumentsParse(args, argc, argv) ) return -1; context.maska = goc_elementCreate(GOC_ELEMENT_MASK, 1, 1, 0, 0, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE, GOC_WHITE | GOC_FBOLD, GOC_HANDLER_SYSTEM); goc_maskSetRealArea(context.maska, context.configuration.maxx, context.configuration.maxy); context.mapa = goc_elementCreate(GOC_ELEMENT_RAWMAP, 1, 1, context.configuration.maxx, context.configuration.maxy, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE, GOC_WHITE, context.maska); goc_maskAddMap(context.maska, context.mapa); goc_maparawSetBPV(context.mapa, 4); // maskaUstRodzajWartosci(maska, 4, 1); if ( goc_stringEquals(genSystem, "bactery") ) { setUpBiomeModeView(context.maska); } else if ( goc_stringEquals(levelChars, "numbers") ) { setUpNumericModeView(context.maska); } else if ( goc_stringEquals(levelChars, "signs") ) { setUpCharModeView(context.maska); } if ( goc_stringEquals(genSystem, "drops") ) { setUpBiomeModeView(context.maska); } // petlaGrow(maska, 10); // 10 bez lawirowania, tylko opadanie // petlaCount(maska, generateStartPoints(&nStartPoints), &nStartPoints); if ( goc_stringEquals( genSystem, "points" ) ) { goc_hkAdd(GOC_HANDLER_SYSTEM, 'V', GOC_EFLAGA_ENABLE, hotkeyModeView); goc_hkAdd(GOC_HANDLER_SYSTEM, 'v', GOC_EFLAGA_ENABLE, hotkeyModeView); petlaCount(context.mapa, randomStartPoints(&nStartPoints, numberOfStartPoints), &nStartPoints); } else if ( goc_stringEquals( genSystem, "civ" ) ) { goc_hkAdd(GOC_HANDLER_SYSTEM, 'V', GOC_EFLAGA_ENABLE, hotkeyModeView); goc_hkAdd(GOC_HANDLER_SYSTEM, 'v', GOC_EFLAGA_ENABLE, hotkeyModeView); civGeneration(context.mapa, numberOfStartPoints, context.configuration.minLandMass, context.configuration.maxLandMass, 0, 1); } else if ( goc_stringEquals( genSystem, "rain" ) ) { goc_hkAdd(GOC_HANDLER_SYSTEM, 'V', GOC_EFLAGA_ENABLE, hotkeyModeView); goc_hkAdd(GOC_HANDLER_SYSTEM, 'v', GOC_EFLAGA_ENABLE, hotkeyModeView); rainGeneration(context.mapa, numberOfStartPoints); } else if ( goc_stringEquals( genSystem, "bactery" ) ) { goc_hkAdd(GOC_HANDLER_SYSTEM, ' ', GOC_EFLAGA_ENABLE, hotkeyNextTurnBactery); bacteryGeneration(context.mapa, numberOfStartPoints, 9); } else if ( goc_stringEquals( genSystem, "drops" ) ) { initSystemDrops(&context); } goc_systemFocusOn(context.maska); // goc_systemSendMsg(0, GOC_MGS_PAINT, 0, 0); while (goc_systemCheckMsg( NULL )); return 0; }