GameEngine::GameEngine(){ m_window = std::unique_ptr<sf::RenderWindow>(new sf::RenderWindow); m_window->create(sf::VideoMode(640, 480), "Teste"); m_camera = std::unique_ptr<sf::View>(new sf::View); setStepSize(); m_state_machine = StateMachine::INTRO; }
//! Reads attributes of the element void CGUISpinBox::deserializeAttributes(io::IAttributes * in, io::SAttributeReadWriteOptions * options) { IGUIElement::deserializeAttributes(in, options); setRange(in->getAttributeAsFloat("Min"), in->getAttributeAsFloat("Max")); setStepSize(in->getAttributeAsFloat("Step")); setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces")); }
Tree() { // default values setStepSize(0.1); setMaxIterations(1000); setGoalMaxDist(0.1); }
//============================================================================== void GradientDescentSolver::setProperties(const UniqueProperties& _properties) { setStepSize(_properties.mStepSize); setMaxAttempts(_properties.mMaxAttempts); setPerturbationStep(_properties.mPerturbationStep); setMaxPerturbationFactor(_properties.mMaxPerturbationFactor); setDefaultConstraintWeight(_properties.mDefaultConstraintWeight); getEqConstraintWeights() = _properties.mEqConstraintWeights; }
NodeTree(RRTNode* start) { _nodes.push_back(start); _numNodes = 1; setStepSize(0.25); // setGoalBias(0.26); // value between 0 and 1 setMaxIterations(10000); setErrorFactor(1); }
NodeTree() { //default values _numNodes = 1; setStepSize(0.25); // setGoalBias(0.26); // value between 0 and 1 setMaxIterations(10000); setErrorFactor(1); }
Integrator::Integrator( double temperature, double frictionCoeff, double stepSize, const Parameters ¶ms ) : maxEigenvalue( 4.34e5 ), stepsSinceDiagonalize( 0 ), mParameters( params ), mAnalysis( new Analysis ) { setTemperature( temperature ); setFriction( frictionCoeff ); setStepSize( stepSize ); setConstraintTolerance( 1e-4 ); setMinimumLimit( mParameters.minLimit ); setRandomNumberSeed( ( int ) time( 0 ) ); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// setStartValues //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void McmcOptimiser::setStartValues( const RealVectorEnsemble& startValues ) { m_mcmcChains = startValues; m_probOld.resize( m_mcmcChains.size() ); for ( size_t i = 0; i < m_mcmcChains.size(); ++i ) { m_probOld[ i ] = m_objFunc.evaluate( m_mcmcChains[ i ] ); } m_numAccepted.assign( m_mcmcChains.size(), 0 ); setStepSize( 1 ); }
Tree(std::shared_ptr<StateSpace<T>> stateSpace, bool reverse = false) { _stateSpace = stateSpace; _reverse = reverse; // default values setStepSize(0.1); setMaxIterations(1000); setGoalBias(0); setWaypointBias(0); setGoalMaxDist(0.1); }
/* * COMMAND CENTRE */ String Controller::doCommand(String string) { //Log.Debug("Command: %s", string); String s = NULL; int i = (int) stringToTime(string); char command; if (string.length() > 0) { command = string.charAt(0); } else { return s; } switch (command) { case 'A': // status request only break; case 'L': // move left moveLeft(i); break; case 'R': // move right moveRight(i); break; case 'I': // update interval setInterval(i); break; case 'J': // update step size setStepSize(i); break; case 'S': // update start/end/rewind times setTimes(string); break; case 'T': // update date and time setTimestamp(stringToTime(string)); break; default: // returns NULL return s; } s = getStatus(); return s; }
bool MzSpectrogramFFTW::initialise(size_t channels, size_t stepsize, size_t blocksize) { if (channels < getMinChannelCount() || channels > getMaxChannelCount()) { return false; } // step size and block size should never be zero if (stepsize <= 0 || blocksize <= 0) { return false; } setChannelCount(channels); setBlockSize(blocksize); setStepSize(stepsize); mz_minbin = getParameterInt("minbin"); mz_maxbin = getParameterInt("maxbin"); if (mz_minbin >= getBlockSize()/2) { mz_minbin = getBlockSize()/2-1; } if (mz_maxbin >= getBlockSize()/2) { mz_maxbin = getBlockSize()/2-1; } if (mz_maxbin < 0) { mz_maxbin = getBlockSize()/2-1; } if (mz_maxbin < mz_minbin) { std::swap(mz_minbin, mz_maxbin); } // The signal size/transform size are equivalent for this // plugin but the FFTW can handle any size transform. // If the size of the transform is a multiple of small // prime numbers the FFT will be used, otherwise it will // be slow (when block size=1021 for example). mz_transformer.setSize(getBlockSize()); delete [] mz_wind_buff; mz_wind_buff = new double[getBlockSize()]; makeHannWindow(mz_wind_buff, getBlockSize()); return true; }
void VolSkin::init( int width, int height, TetMesh *tm ) { this->width = width; this->height = height; tetMesh = tm; // TEMP initialize volume data cudaExtent volumeSize = make_cudaExtent(128, 128, 128); //cudaExtent volumeSize = make_cudaExtent(256, 256, 256); // generate raw volume data float *h_densityData = (float*)malloc( sizeof(float)*volumeSize.width*volumeSize.height*volumeSize.depth ); math::PerlinNoise pn; pn.setDepth( 4 ); pn.setFrequency(3.0f); //pn.setInflection(true); for( int k=0;k<volumeSize.depth;++k ) for( int j=0;j<volumeSize.height;++j ) for( int i=0;i<volumeSize.width;++i ) { int index = k*volumeSize.width*volumeSize.height + j*volumeSize.width + i; math::Vec3f uvw( (float)(i)/(float)(volumeSize.width), (float)(j)/(float)(volumeSize.height), (float)(k)/(float)(volumeSize.depth)); float t = (float)(j)/(float)(volumeSize.height); //h_densityData[index] = 0.5f; //h_densityData[index] = (1.0f-t)*1.0f; h_densityData[index] = std::max( 0.0f, pn.perlinNoise_3D( uvw.x, uvw.y*2.0, uvw.z ) )*1.0f; // cylinder //h_densityData[index] = std::max( 0.0f, pn.perlinNoise_3D( uvw.x*2.0f, uvw.y*2.0f, uvw.z*2.0f ))*1.0f; // tetraeder //h_densityData[index] = (uvw.getLength() < 0.2f ? 1.0f : 0.0f)*2.0f; } // create 3D array d_densityArray = 0; cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<float>(); cudaMalloc3DArray(&d_densityArray, &channelDesc, volumeSize); // copy data to 3D array cudaMemcpy3DParms copyParams = {0}; copyParams.srcPtr = make_cudaPitchedPtr((void*)h_densityData, volumeSize.width*sizeof(float), volumeSize.width, volumeSize.height); copyParams.dstArray = d_densityArray; copyParams.extent = volumeSize; copyParams.kind = cudaMemcpyHostToDevice; cudaMemcpy3D(©Params); // TMP /* h_debugVec.resize( 1000.0f ); d_debugVec = h_debugVec; h_debugInfo.samples = convertToKernel(d_debugVec); h_debugInfo.numSamples = 0; cudaMemcpyToSymbol( d_debugInfo, &h_debugInfo, sizeof(DebugInfo), 0, cudaMemcpyHostToDevice ); */ // setup lighting m_light0.cam = base::CameraPtr( new base::Camera() ); m_light0.cam->m_aspectRatio = 1.0; //m_light0.cam->m_transform = math::createLookAtMatrix( math::Vec3f( -2.0f, -2.0f, 2.0f ), math::Vec3f( 0.0f, 0.0f, 0.0f ), math::Vec3f( 0.0f, 1.0f, 0.0f ), false ); //m_light0.cam->m_transform = math::Matrix44f::TranslationMatrix( 0.3f, 0.15f, 2.0f ); //m_light0.cam->m_transform = math::Matrix44f::TranslationMatrix( -3.0f, 0.0f, 0.0f ); m_light0.cam->m_transform = math::createLookAtMatrix( math::Vec3f( 4.0f, 0.0f, 0.0f ), math::Vec3f( 0.0f, 0.0f, 0.0f ), math::Vec3f( 0.0f, 1.0f, 0.0f ), false ); m_light0.cam->update(); cudaMalloc( &m_light0.d_dctCoefficients, width*height*sizeof(float)*8 );// 8 floats /6 coefficients // set defaults setTotalCrossSection( 10.0f ); setAlbedo( 1.0f ); setAbsorptionColor( math::Vec3f(0.5f,0.5f, 0.5f) ); setScatteringColor(math::Vec3f(0.5f, 0.5f, 0.5f)); setLight(0, math::Vec3f(1.0f, 1.0f, 1.0f), 0.0f); setTime( 0.0f ); setStepSize( 0.01f ); // get tetmesh onto gpu gpuUploadTetMesh(); }
/* The single externally visible routine. * Future improvements will need to add a couple more arguments to * satisify the needs of the command line version and its options. * Currently, this is used only in customTrack input parsing. */ void wigAsciiToBinary( char *wigAscii, char *wigFile, char *wibFile, double *upperLimit, double *lowerLimit, struct wigEncodeOptions *options) /* given the three file names, read the ascii wigAscii file and produce * the wigFile and wibFile outputs */ { struct lineFile *lf; /* for line file utilities */ char *line = (char *) NULL; /* to receive data input line */ char *words[10]; /* to split data input line */ int wordCount = 0; /* result of split */ int validLines = 0; /* counting only lines with data */ double dataValue = 0.0; /* from data input */ boolean bedData = FALSE; /* in bed format data */ boolean variableStep = FALSE; /* in variableStep data */ boolean fixedStep = FALSE; /* in fixedStep data */ char *prevChromName = (char *)NULL; /* to watch for chrom name changes */ int trackCount = 0; /* We abort if we see more than one track. */ if ((wigAscii == (char *)NULL) || (wigFile == (char *)NULL) || (wibFile == (char *)NULL)) errAbort("wigAsciiToBinary: missing data file names, ascii: %s, wig: %s, wib: %s", wigAscii, wigFile, wibFile); /* need to be careful here and initialize all the global variables */ freez(&wibFileName); /* send this name to the global */ wibFileName = cloneString(wibFile); /* variable for use in output_row() */ lineCount = 0; /* to count all lines */ add_offset = 0; /* to allow "lifting" of the data */ validLines = 0; /* to count only lines with data */ rowCount = 0; /* to count rows output */ bincount = 0; /* to count up to binsize */ binsize = 1024; /* # of data points per table row */ dataSpan = 1; /* default bases spanned per data point */ chromStart = 0; /* for table row data */ previousOffset = 0; /* for data missing detection */ fileOffset = 0; /* current location within binary data file */ fileOffsetBegin = 0;/* location in binary data file where this bin starts*/ freez(&data_values); freez(&validData); data_values = (double *) needMem( (size_t) (binsize * sizeof(double))); validData = (unsigned char *) needMem( (size_t) (binsize * sizeof(unsigned char))); if (options != NULL) { if (options->lift != 0) add_offset = options->lift; if (options->noOverlap) noOverlap = TRUE; if (options->flagOverlapSpanData) flagOverlapSpanData = TRUE; if (options->wibSizeLimit > 0) wibSizeLimit = options->wibSizeLimit; } /* limits for the complete set of data, they must change from these initial defaults during processing */ overallLowerLimit = wigEncodeStartingLowerLimit; overallUpperLimit = wigEncodeStartingUpperLimit; binout = mustOpen(wibFile,"w"); /* binary data file */ wigout = mustOpen(wigFile,"w"); /* table row definition file */ #if defined(DEBUG) /* dbg */ chmod(wibFile, 0666); chmod(wigFile, 0666); #endif lf = lineFileOpen(wigAscii, TRUE); /* input file */ while (lineFileNext(lf, &line, NULL)) { boolean readingFrameSlipped; ++lineCount; if ((wibSizeLimit > 0) && (wibSize >= wibSizeLimit)) errAbort("data size limit of %lld data values has been exceeded. This data can be efficiently displayed with the <A HREF='/goldenPath/help/bigWig.html' TARGET=_blank>bigWig file format</A> in a custom track, or in a <A HREF='/goldenPath/help/hgTrackHubHelp.html' TARGET=_blank>Track Hub</A> for multiple large datasets.", wibSizeLimit); line = skipLeadingSpaces(line); /* ignore blank or comment lines */ if ((line == (char *)NULL) || (line[0] == '\0') || (line[0] == '#')) continue; /* !!! go to next line of input */ wordCount = chopByWhite(line, words, ArraySize(words)); if (sameWord("track",words[0])) { /* Allow (and ignore) one track line, but no more. */ ++trackCount; if (trackCount > 1) errAbort("Multiple tracks seen, second at line %d of %s, can only handle one.", lf->lineIx, lf->fileName); continue; } else if (sameWord("browser", words[0])) { continue; /* ignore browser lines if present */ } else if (sameWord("variableStep",words[0])) { int i; boolean foundChrom = FALSE; /* safest thing to do if we were processing anything is to * output that previous block and start anew * Future improvement could get fancy here and decide if it * is really necessary to start over, although the concept * of a line between data points on one item may use this * block behavior later to define line segments, so don't * get too quick to be fancy here. This line behavior * implies that feature names will need to be specified to * identify the line segments that belong together. */ if (variableStep || bedData || fixedStep) { output_row(); validLines = 0; /* to cause reset for first offset */ } dataSpan = 1; /* default bases spanned per data point */ for(i = 1; i < wordCount; ++i) { if (startsWith("chrom",words[i])) { setChromName(words[i]); foundChrom = TRUE; } else if (startsWith("span",words[i])) setDataSpan(words[i]); else errAbort("illegal specification on variableStep at line %lu: %s", lineCount, words[i]); } if (!foundChrom) errAbort("missing chrom=<name> specification on variableStep declaration at line %lu", lineCount); variableStep = TRUE; bedData = FALSE; fixedStep = FALSE; freez(&prevChromName); prevChromName = cloneString(chromName); continue; /* !!! go to next input line */ } else if (sameWord("fixedStep",words[0])) { boolean foundChrom = FALSE; boolean foundStart = FALSE; int i; /* same comment as above */ if (variableStep || bedData || fixedStep) { output_row(); validLines = 0; /* to cause reset for first offset */ } stepSize = 1; /* default step size */ dataSpan = 0; /* this will match step size if not set*/ for(i = 1; i < wordCount; ++i) { if (startsWith("chrom",words[i])) { setChromName(words[i]); foundChrom = TRUE; } else if (startsWith("start",words[i])) { setFixedStart(words[i]); foundStart = TRUE; } else if (startsWith("step",words[i])) setStepSize(words[i]); else if (startsWith("span",words[i])) setDataSpan(words[i]); else errAbort("illegal specification on variableStep at line %lu: %s", lineCount, words[i]); } if (dataSpan == 0) dataSpan = stepSize; if (!foundChrom) errAbort("missing chrom=<name> specification on fixedStep declaration at line %lu", lineCount); if (!foundStart) errAbort("missing start=<position> specification on fixedStep declaration at line %lu", lineCount); if (noOverlap && validLines && prevChromName) { if (sameWord(prevChromName,chromName) && (fixedStart < chromStart)) errAbort("specified fixedStep chromStart %llu is less than expected next chromStart %llu", fixedStart, chromStart); } variableStep = FALSE; bedData = FALSE; fixedStep = TRUE; freez(&prevChromName); prevChromName = cloneString(chromName); continue; /* !!! go to next input line */ } else if (wordCount == 4) { /* while in bedData, we do not necessarily need to start a new * batch unless the chrom name is changing, since dataSpan * is always 1 for bedData. As above, this may change in * the future if each bed line specification is talking * about a different feature. */ if (variableStep || fixedStep || (bedData && ((prevChromName != (char *)NULL) && differentWord(prevChromName,words[0])))) { output_row(); validLines = 0; /* to cause reset for first offset */ } dataSpan = 1; /* default bases spanned per data point */ variableStep = FALSE; bedData = TRUE; fixedStep = FALSE; freez(&chromName); chromName=cloneString(words[0]); freez(&featureName); featureName=cloneString(words[0]); bedChromStart = sqlLongLong(words[1]); bedChromEnd = sqlLongLong(words[2]); bedDataValue = sqlDouble(words[3]); /* the bed format coordinate system is zero relative, half-open, * hence, no adjustment of bedChromStart is needed here, unlike the * fixed and variable step formats which will subtract one from the * incoming coordinate. */ if (bedChromStart >= bedChromEnd) errAbort("Found chromStart >= chromEnd at line %lu (%llu > %llu)", lineCount, bedChromStart, bedChromEnd); if (bedChromEnd > (bedChromStart + 10000000)) errAbort("Limit of 10,000,000 length specification for bed format at line %lu, found: %llu)", lineCount, bedChromEnd-bedChromStart); if ((validLines > 0) && (bedChromStart < previousOffset)) errAbort("chrom positions not in numerical order at line %lu. previous: %llu > %llu <-current (bed)", lineCount, previousOffset, bedChromStart); freez(&prevChromName); prevChromName = cloneString(chromName); } /* We must be in one of these data formats at this point */ if (!(variableStep || fixedStep || bedData)) errAbort("at the line beginning: %s, variableStep or fixedStep data declaration not found or BED data 4 column format not recognized.", words[0]); if (variableStep && (wordCount != 2)) errAbort("Expecting two words for variableStep data at line %lu, found %d", lineCount, wordCount); if (fixedStep && (wordCount != 1)) errAbort("Expecting one word for fixedStep data at line %lu, found %d", lineCount, wordCount); if (bedData && (wordCount != 4)) errAbort("Expecting four words for bed format data at line %lu, found %d", lineCount, wordCount); ++validLines; /* counting good lines of data input */ /* Offset is the incoming specified position for this value, * fixedStart has already been converted to zero * relative half open */ if (variableStep) { Offset = sqlLongLong(words[0]); Offset = BASE_0(Offset); /* zero relative half open */ dataValue = sqlDouble(words[1]); } else if (fixedStep) { Offset = fixedStart + (stepSize * (validLines - 1)); dataValue = sqlDouble(words[0]); } else if (bedData) { Offset = bedChromStart; dataValue = bedDataValue; } if (dataValue > overallUpperLimit) overallUpperLimit = dataValue; if (dataValue < overallLowerLimit) overallLowerLimit = dataValue; /* see if this is the first time through, establish chromStart */ if (validLines == 1) { chromStart = Offset; verbose(2, "first offset: %llu\n", chromStart); } else if ((validLines > 1) && (Offset <= previousOffset)) errAbort("chrom positions not in numerical order at line %lu. previous: %llu > %llu " "<-current (offset)", lineCount, BASE_1(previousOffset), BASE_1(Offset)); /* if we are working on a zoom level and the data is not exactly * spaced according to the span, then we need to put each value * in its own row in order to keep positioning correct for these * data values. The number of skipped bases has to be an even * multiple of dataSpan */ readingFrameSlipped = FALSE; if ((validLines > 1) && (dataSpan > 1)) { unsigned long long prevEnd = previousOffset + dataSpan; int skippedBases; int spansSkipped; skippedBases = Offset - previousOffset; if (flagOverlapSpanData && (prevEnd > Offset)) errAbort("ERROR: data points overlapping at input line %lu.\n" "previous data point position: %s:%llu-%llu overlaps current: %s:%llu-%llu", lineCount, chromName, BASE_1(previousOffset), prevEnd, chromName, BASE_1(Offset),Offset+dataSpan); spansSkipped = skippedBases / dataSpan; if ((spansSkipped * dataSpan) != skippedBases) readingFrameSlipped = TRUE; } if (readingFrameSlipped) { verbose(2, "data not spanning %llu bases, prev: %llu, this: %llu, at line: %lu\n", dataSpan, previousOffset, Offset, lineCount); output_row(); chromStart = Offset; /* a full reset here */ } /* Check to see if data is being skipped */ else if ( (validLines > 1) && (Offset > (previousOffset + dataSpan)) ) { unsigned long long off; unsigned long long fillSize; /* number of bytes */ verbose(2, "missing data offsets: %llu - %llu\n", BASE_1(previousOffset),BASE_0(Offset)); /* If we are just going to fill the rest of this bin with * no data, then may as well stop here. No need to fill * it with nothing. */ fillSize = (Offset - (previousOffset + dataSpan)) / dataSpan; verbose(2, "filling NO_DATA for %llu bytes\n", fillSize); if (fillSize + bincount >= binsize) { verbose(2, "completing a bin due to NO_DATA for %llu bytes, only %llu - %llu = %llu to go\n", fillSize, binsize, bincount, binsize - bincount); verbose(2, "Offset: %llu, previousOffset: %llu\n", Offset, previousOffset); output_row(); chromStart = Offset; /* a full reset here */ } else { fillSize = 0; /* fill missing data with NO_DATA indication */ for (off = previousOffset + dataSpan; off < Offset; off += dataSpan) { ++fillSize; ++fileOffset; ++bincount; /* count scores in this bin */ if (bincount >= binsize) break; } verbose(2, "filled NO_DATA for %llu bytes\n", fillSize); /* If that finished off this bin, output it * This most likely should not happen here. The * check above: if (fillSize + bincount >= binsize) * should have caught this case already. */ if (bincount >= binsize) { output_row(); chromStart = Offset; /* a full reset here */ } } } /* With perhaps the missing data taken care of, back to the * real data. */ if (bedData) { unsigned long long bedSize = bedChromEnd - bedChromStart; for ( ; bedSize > 0; --bedSize ) { setDataValue(bedDataValue); Offset += 1; } Offset -= 1; /* loop above increments this one too much. * This Offset is supposed to be the last * valid chrom position written, not the * next to be written */ } else { setDataValue(dataValue); } previousOffset = Offset; /* remember position for gap calculations */ } /* reading file input loop end */ /* Done with input file, any data points left in this bin ? */ if (bincount) output_row(); lineFileClose(&lf); fclose(binout); fclose(wigout); freez(&chromName); freez(&featureName); freez(&data_values); freez(&validData); freez(&wibFileName); /* return limits if pointers are given */ if (upperLimit) *upperLimit = overallUpperLimit; if (lowerLimit) *lowerLimit = overallLowerLimit; if (wibSizeLimit > 0) options->wibSizeLimit = wibSize; }
void CMazeGameMenu::init(irr::gui::IGUIEnvironment * const in_guiEnv, const irr::core::recti & in_menuRect) { //TODO: Add cool images as buttons. LOG(DEBUG) << "Initializing menu"; _mainMenuElements.clear(); _gameSettingsElements.clear(); _videoSettingsElements.clear(); _guiEnv = in_guiEnv; auto backgroundImg = in_guiEnv->addImage(irr::core::recti(irr::core::vector2di(0, 0), in_guiEnv->getVideoDriver()->getScreenSize())); backgroundImg->setScaleImage(true); backgroundImg->setColor(irr::video::SColor(150, 255, 255, 255)); backgroundImg->setImage(in_guiEnv->getVideoDriver()->getTexture("../media/p-of-eternity-maze-by-malcolm.jpg")); auto backImg = in_guiEnv->addImage(irr::core::recti( irr::core::vector2di(in_menuRect.UpperLeftCorner.X * (1.0f - ElementSeparationRatio), in_menuRect.UpperLeftCorner.Y * (1.0f - ElementSeparationRatio)), irr::core::dimension2di(in_menuRect.getSize().Width *(1.0f + ElementSeparationRatio), in_menuRect.getSize().Height *(1.0f + ElementSeparationRatio + ElementHeightRatio))), backgroundImg); backImg->setScaleImage(true); backImg->setColor(irr::video::SColor(200, 255, 255, 255)); backImg->setImage(in_guiEnv->getVideoDriver()->getTexture("../media/irrlicht2_up.jpg")); _menuBackground = backgroundImg; in_guiEnv->getSkin()->setFont(in_guiEnv->getFont("../media/fonthaettenschweiler.bmp")); //set the main menu. auto in_videoDriver = in_guiEnv->getVideoDriver(); irr::core::dimension2di elementSize = in_menuRect.getSize(); elementSize.Height *= ElementHeightRatio; int elementSeperation = in_menuRect.getHeight() * ElementSeparationRatio; irr::core::vector2di elementPosition(in_menuRect.UpperLeftCorner); auto button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::BackToGameBtn,L"Back to Game"); //button->setImage(in_videoDriver->getTexture("../media/backToGame.jpg")); _mainMenuElements.push_back(button); elementPosition.Y += elementSeperation + elementSize.Height; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::NewGameBtn, L"New Game"); //button->setImage(in_videoDriver->getTexture("../media/newGame.jpg")); _mainMenuElements.push_back(button); elementPosition.Y += elementSeperation + elementSize.Height; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::GameSettingsBtn, L"Game Settings"); //button->setImage(in_videoDriver->getTexture("../media/gameSettings.jpg")); _mainMenuElements.push_back(button); elementPosition.Y += elementSeperation + elementSize.Height; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::VideoSettingsBtn, L"Video Settings"); //button->setImage(in_videoDriver->getTexture("../media/videoSettings.jpg")); _mainMenuElements.push_back(button); elementPosition.Y += elementSeperation + elementSize.Height; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::QuitBtn, L"Quit"); //button->setImage(in_videoDriver->getTexture("../media/quitGame.jpg")); _mainMenuElements.push_back(button); //set the video settings menu elementPosition.Y = in_menuRect.UpperLeftCorner.Y; auto resImage = in_guiEnv->addImage(irr::core::recti(elementPosition, elementSize)); resImage->setText(L"Select the desired resolution"); //resImage->setImage(in_videoDriver->getTexture("../media/Resolution.jpg")); _videoSettingsElements.push_back(resImage); elementPosition.Y += elementSeperation + elementSize.Height; auto listBox = in_guiEnv->addListBox(irr::core::recti(elementPosition, irr::core::dimension2di(elementSize.Width,in_menuRect.getHeight()- (elementSize.Height + 2.0f * elementSeperation))), nullptr, MenuElement::ResolutionDropDown, true); listBox->addItem(L"800x600"); listBox->addItem(L"1024x768"); listBox->addItem(L"1200x1600"); listBox->setSelected(0); _videoSettingsElements.push_back(listBox); //add buttons at the bottom to both game and setting menu elementPosition.Y = in_menuRect.UpperLeftCorner.Y + in_menuRect.getHeight(); elementSize.Width = (elementSize.Width - elementSeperation) / 2.0f; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::BackToMainMenuBtn, L"Back to Main Menu"); //button->setImage(in_videoDriver->getTexture("../media/backToMainMenu.jpg")); _videoSettingsElements.push_back(button); _gameSettingsElements.push_back(button); elementPosition.X += elementSize.Width + elementSeperation; button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::SetVideoSettingsBtn, L"Apply (restart game)"); //button->setImage(in_videoDriver->getTexture("../media/setVideoSettings.jpg")); _videoSettingsElements.push_back(button); button = in_guiEnv->addButton(irr::core::recti(elementPosition, elementSize), nullptr, MenuElement::SetGameSettingsBtn, L"Apply (restart game)"); //button->setImage(in_videoDriver->getTexture("../media/setGameSettings.jpg")); _gameSettingsElements.push_back(button); //set the game settings menu elementPosition.Y = in_menuRect.UpperLeftCorner.Y; auto spinBox = in_guiEnv->addSpinBox(L"Number of AI players", irr::core::recti(elementPosition, elementSize),true,nullptr,MenuElement::MazeNumOfAI); spinBox->setDecimalPlaces(0); spinBox->setRange(0.0f, 10.0f); spinBox->setValue(3.0f); _gameSettingsElements.push_back(spinBox); elementPosition.Y += elementSeperation + elementSize.Height; spinBox = in_guiEnv->addSpinBox(L"AI level", irr::core::recti(elementPosition, elementSize), true, nullptr, MenuElement::MazeAIDifficultyLevel); spinBox->setDecimalPlaces(0); spinBox->setRange(1.0f, 10.0f); spinBox->setValue(3.0f); _gameSettingsElements.push_back(spinBox); elementPosition.Y += elementSeperation + elementSize.Height; spinBox = in_guiEnv->addSpinBox(L"Maze Width", irr::core::recti(elementPosition, elementSize), true, nullptr, MenuElement::MazeWidth); spinBox->setDecimalPlaces(0); spinBox->setRange(20.0f, 60.0f); spinBox->setStepSize(2.0f); spinBox->setValue(30.0f); _gameSettingsElements.push_back(spinBox); elementPosition.Y += elementSeperation + elementSize.Height; spinBox = in_guiEnv->addSpinBox(L"Maze Height", irr::core::recti(elementPosition, elementSize), true, nullptr, MenuElement::MazeHeight); spinBox->setDecimalPlaces(0); spinBox->setRange(20.0f, 60.0f); spinBox->setStepSize(2.0f); spinBox->setValue(30.0f); _gameSettingsElements.push_back(spinBox); elementPosition = in_menuRect.UpperLeftCorner; _gameSettingsElements.push_back( in_guiEnv->addStaticText(L"Number of AI players:", irr::core::recti(elementPosition, elementSize))); elementPosition.Y += elementSeperation + elementSize.Height; _gameSettingsElements.push_back(in_guiEnv->addStaticText(L"AI Level:", irr::core::recti(elementPosition, elementSize))); elementPosition.Y += elementSeperation + elementSize.Height; _gameSettingsElements.push_back(in_guiEnv->addStaticText(L"Maze Width:", irr::core::recti(elementPosition, elementSize))); elementPosition.Y += elementSeperation + elementSize.Height; _gameSettingsElements.push_back(in_guiEnv->addStaticText(L"Maze Length:", irr::core::recti(elementPosition, elementSize))); elementPosition.Y += elementSeperation + elementSize.Height; //hide all menu elements setMenuEnabled(false, _mainMenuElements); setMenuEnabled(false, _gameSettingsElements); setMenuEnabled(false, _videoSettingsElements); _menuBackground->setVisible(false); _currentMenu = CurrentMenu::None; LOG(DEBUG) << "Finished initializing menu"; }
int QRangeModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: valueChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 1: positionChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 2: stepSizeChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 3: invertedChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: minimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 5: maximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 6: positionAtMinimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 7: positionAtMaximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 8: toMinimum(); break; case 9: toMaximum(); break; case 10: setValue((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 11: setPosition((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 12: { qreal _r = valueForPosition((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; case 13: { qreal _r = positionForValue((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; default: ; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = value(); break; case 1: *reinterpret_cast< qreal*>(_v) = minimum(); break; case 2: *reinterpret_cast< qreal*>(_v) = maximum(); break; case 3: *reinterpret_cast< qreal*>(_v) = stepSize(); break; case 4: *reinterpret_cast< qreal*>(_v) = position(); break; case 5: *reinterpret_cast< qreal*>(_v) = positionAtMinimum(); break; case 6: *reinterpret_cast< qreal*>(_v) = positionAtMaximum(); break; case 7: *reinterpret_cast< bool*>(_v) = inverted(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setValue(*reinterpret_cast< qreal*>(_v)); break; case 1: setMinimum(*reinterpret_cast< qreal*>(_v)); break; case 2: setMaximum(*reinterpret_cast< qreal*>(_v)); break; case 3: setStepSize(*reinterpret_cast< qreal*>(_v)); break; case 4: setPosition(*reinterpret_cast< qreal*>(_v)); break; case 5: setPositionAtMinimum(*reinterpret_cast< qreal*>(_v)); break; case 6: setPositionAtMaximum(*reinterpret_cast< qreal*>(_v)); break; case 7: setInverted(*reinterpret_cast< bool*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }