int main() { MyApplication app; app.Run(); return 0; }
BaseGui * SMPlayer::createGUI(QString gui_name) { BaseGui * gui = 0; #ifdef SKINS if (gui_name.toLower() == "skingui") gui = new SkinGui(0); else #endif if (gui_name.toLower() == "minigui") gui = new MiniGui(0); else #ifdef MPCGUI if (gui_name.toLower() == "mpcgui") gui = new MpcGui(0); else #endif gui = new DefaultGui(0); gui->setForceCloseOnFinish(close_at_end); gui->setForceStartInFullscreen(start_in_fullscreen); connect(gui, SIGNAL(quitSolicited()), qApp, SLOT(quit())); #ifdef GUI_CHANGE_ON_RUNTIME connect(gui, SIGNAL(guiChanged(QString)), this, SLOT(changeGUI(QString))); #endif #if SINGLE_INSTANCE MyApplication * app = MyApplication::instance(); connect(app, SIGNAL(messageReceived(const QString&)), gui, SLOT(handleMessageFromOtherInstances(const QString&))); app->setActivationWindow(gui); #endif return gui; }
int main(void){ MyApplication app; app.startUp(); while( app.keepRunning() ){ app.renderOneFrame(); } return 0; }
int main() { MyApplication myApp; myApp.NewDocument("foo"); myApp.NewDocument("bar"); myApp.ReportDocs(); }
int main() { MyApplication *myApp; myApp = new MyApplication; myApp->Run(); delete (myApp); return (0); }
int main(int argc, char* argv[] ) #endif { MyApplication* App = new MyApplication; App->Create(__TEXT("Application"), true, 1280, 720); while(App->Loop()); return 0; }
//====================================================================================================================== // main = //====================================================================================================================== int main(int /*argc*/, char** /*argv*/) { cout << "Starting..." << endl; //MyApplication* myApp = new MyApplication(200, 200); MyApplication* myApp = new MyApplication(1000, 800); app = myApp; myApp->initAdditionalPhysics(); return app->exec(); }
int main(void) { MyApplication app; // Load up the application resources and stuff :) app.startUp(); // Start the rendering loop while (app.keepRunning()) { app.renderOneFrame(); } return 0; }
int main( void ) { cout << "sIRC 0.03" << endl; cout << "Syllable Internet Relay Chat Client" << endl; cout << "By James Coxon 2006" << endl; cout << "*****@*****.**" << endl; MyApplication *thisApp; thisApp = new MyApplication(); thisApp->Run(); cout << "Quitting" << endl; return( 0 ); }
int main() { MyApplication* myApp = new MyApplication(); if(myApp->Init() == 1) { while(myApp->Update() == true) myApp->Draw(); myApp->Close(); } delete myApp; return 0; }
int main(int argc, char** argv) { MyApplication app; try{ app.go(); } catch(Ogre::Exception& e) { } return 0; }
int main(int argc, char **argv) { OS_SYSTEM_init_keyboard(); MyApplication app (argc, argv); QPushButton button ("Hello world !"); button.show(); app.exec(); W_KeyboardHandlerShutDown(); return 0; }
void mainLoop() { //while (mCurrentTrialTime < mTrialLength) while (true) { Ogre::Real elapsedSimTime = 0; Ogre::Real elapsedRealTime = 0; gEngine.update(elapsedSimTime, elapsedRealTime); handleInput(elapsedRealTime); if (gEngine.quitApp()) { return; } // Update sound effects at 50 Hz. const Ogre::Real soundUpdatePeriod = 0.02; static Ogre::Real soundUpdateTimer = 0; soundUpdateTimer -= elapsedSimTime; if (soundUpdateTimer <= 0) { gRobot->updateSoundEffects(soundUpdatePeriod); gCar->updateSoundEffects(soundUpdatePeriod); soundUpdateTimer = soundUpdatePeriod; } gRobot->updateVisuals(elapsedSimTime); updateOverlay(); gAgentDebugger->updateVisuals(); } //mAvgRewardPerStep = mAvgRewardPerStep * mPhysicsStepSize / // mCurrentTrialTime; //dataFile.storeData("trial", trial, (double)trial); //dataFile.storeData("avg reward per step", trial, // mAvgRewardPerStep); //printTrialAndRunStatus(run, trial, mAvgRewardPerStep); //std::cout << "Agent age = " << mPendulum->getAgent()->getAgeString() // << std::endl; //dataFile.printToFile("./results/pendulum-performance.dat"); }
int main(void) { MyApplication* app = new MyApplication(); app->startup(); MyFrameListener* listener = new MyFrameListener( app->mWindow, app->mLeftCamera, app->mRightCamera, app->mLeftViewport, app->mRightViewport, app->_SinbadNode, app->_SinbadEnt ); listener->setParent( app ); app->_root->addFrameListener( listener ); while( app->keepRunning() ) { app->renderOneFrame(); } delete app; delete listener; return 0; }
SMPlayer::ExitCode SMPlayer::processArgs(QStringList args) { qDebug("SMPlayer::processArgs: arguments: %d", args.count()); for (int n = 0; n < args.count(); n++) { qDebug("SMPlayer::processArgs: %d = %s", n, args[n].toUtf8().data()); } QString action; // Action to be passed to running instance bool show_help = false; if (!pref->gui.isEmpty()) gui_to_use = pref->gui; bool add_to_playlist = false; #ifdef Q_OS_WIN if (args.contains("-uninstall")) { #if USE_ASSOCIATIONS //Called by uninstaller. Will restore old associations. WinFileAssoc RegAssoc; Extensions exts; QStringList regExts; RegAssoc.GetRegisteredExtensions(exts.multimedia(), regExts); RegAssoc.RestoreFileAssociations(regExts); printf("Restored associations\n"); #endif return NoError; } #endif if (args.contains("-delete-config")) { CleanConfig::clean(Paths::configPath()); return NoError; } for (int n = 1; n < args.count(); n++) { QString argument = args[n]; if (argument == "-send-action") { if (n+1 < args.count()) { n++; action = args[n]; } else { printf("Error: expected parameter for -send-action\r\n"); return ErrorArgument; } } else if (argument == "-actions") { if (n+1 < args.count()) { n++; actions_list = args[n]; } else { printf("Error: expected parameter for -actions\r\n"); return ErrorArgument; } } else if (argument == "-sub") { if (n+1 < args.count()) { n++; QString file = args[n]; if (QFile::exists(file)) { subtitle_file = QFileInfo(file).absoluteFilePath(); } else { printf("Error: file '%s' doesn't exists\r\n", file.toUtf8().constData()); } } else { printf("Error: expected parameter for -sub\r\n"); return ErrorArgument; } } else if (argument == "-pos") { if (n+2 < args.count()) { bool ok_x, ok_y; n++; gui_position.setX( args[n].toInt(&ok_x) ); n++; gui_position.setY( args[n].toInt(&ok_y) ); if (ok_x && ok_y) move_gui = true; } else { printf("Error: expected parameter for -pos\r\n"); return ErrorArgument; } } else if (argument == "-size") { if (n+2 < args.count()) { bool ok_width, ok_height; n++; gui_size.setWidth( args[n].toInt(&ok_width) ); n++; gui_size.setHeight( args[n].toInt(&ok_height) ); if (ok_width && ok_height) resize_gui = true; } else { printf("Error: expected parameter for -resize\r\n"); return ErrorArgument; } } else if ((argument == "--help") || (argument == "-help") || (argument == "-h") || (argument == "-?") ) { show_help = true; } else if (argument == "-close-at-end") { close_at_end = 1; } else if (argument == "-no-close-at-end") { close_at_end = 0; } else if (argument == "-fullscreen") { start_in_fullscreen = 1; } else if (argument == "-no-fullscreen") { start_in_fullscreen = 0; } else if (argument == "-add-to-playlist") { add_to_playlist = true; } else if (argument == "-mini" || argument == "-minigui") { gui_to_use = "MiniGUI"; } else if (argument == "-mpcgui") { gui_to_use = "MpcGUI"; } else if (argument == "-defaultgui") { gui_to_use = "DefaultGUI"; } else if (argument == "-ontop") { pref->stay_on_top = Preferences::AlwaysOnTop; } else if (argument == "-no-ontop") { pref->stay_on_top = Preferences::NeverOnTop; } #ifdef SKINS else if (argument == "-skingui") { gui_to_use = "SkinGUI"; } #endif else { // File #if QT_VERSION >= 0x040600 QUrl fUrl = QUrl::fromUserInput(argument); if (fUrl.isValid() && fUrl.scheme().toLower() == "file") { argument = fUrl.toLocalFile(); } #endif if (QFile::exists( argument )) { argument = QFileInfo(argument).absoluteFilePath(); } files_to_play.append( argument ); } } if (show_help) { printf("%s\n", CLHelp::help().toLocal8Bit().data()); return NoError; } qDebug("SMPlayer::processArgs: files_to_play: count: %d", files_to_play.count() ); for (int n=0; n < files_to_play.count(); n++) { qDebug("SMPlayer::processArgs: files_to_play[%d]: '%s'", n, files_to_play[n].toUtf8().data()); } #ifdef SINGLE_INSTANCE if (pref->use_single_instance) { // Single instance MyApplication * a = MyApplication::instance(); if (a->isRunning()) { a->sendMessage("Hello"); if (!action.isEmpty()) { a->sendMessage("action " + action); } else { if (!subtitle_file.isEmpty()) { a->sendMessage("load_sub " + subtitle_file); } if (!files_to_play.isEmpty()) { /* a->sendMessage("open_file " + files_to_play[0]); */ QString command = "open_files"; if (add_to_playlist) command = "add_to_playlist"; a->sendMessage(command +" "+ files_to_play.join(" <<sep>> ")); } } return NoError; } } #endif if (!pref->default_font.isEmpty()) { QFont f; f.fromString(pref->default_font); qApp->setFont(f); } return SMPlayer::NoExit; }
int main(int argc, char* argv[]) { srand((unsigned int)time(NULL)); SDL_Init(SDL_INIT_JOYSTICK); if(SDL_NumJoysticks() > 0) { // Setup the joystick. std::cout << "========================================" << std::endl; std::cout << "Initializing game controller: " << SDL_JoystickName(0) << std::endl; gGamePad = SDL_JoystickOpen(0); std::cout << SDL_JoystickNumAxes(gGamePad) << " axes" << std::endl; std::cout << SDL_JoystickNumBalls(gGamePad) << " trackballs" << std::endl; std::cout << SDL_JoystickNumHats(gGamePad) << " hats" << std::endl; std::cout << SDL_JoystickNumButtons(gGamePad) << " buttons" << std::endl; std::cout << "========================================" << std::endl; } else { std::cout << "========================================" << std::endl; std::cout << "No game controller detected" << std::endl; std::cout << "========================================" << std::endl; } //Ogre::Overlay* trialOverlay; ///// The current amount of elapsed time within a trial. //Ogre::Real mCurrentTrialTime; ///// The length of each trial in seconds. //Ogre::Real mTrialLength; ///// The rewards received during a single trial, in rewards per step. //verve::real mAvgRewardPerStep; if (!gEngine.init()) { return 0; } /* gEngine.setUpdateMode(SimulationEngine::SIMULATE_REAL_TIME_MULTIPLE, 1); */ //// Set to capture frames at 29.97 fps. //engine.setUpdateMode(SIMULATE_CONSTANT_CHUNK, 0.0333667); /* // Use feet for this simulation. gEngine.getSimulator()->setGravity(opal::Vec3r(0, -30, 0)); gEngine.getSimulator()->setStepSize(gPhysicsStepSize); // Make sure we get notified at the end of each step. gEngine.getSimulator()->addPostStepEventHandler(&gPostStepEventHandler); */ // Create the robot. opal::Matrix44r robotTransform; robotTransform.translate(0, 1, 0); gRobot = new Robot(gEngine, 5); gRobot->init("../data/blueprints/robot1.xml", "Plastic/LightBlue", 0.5, robotTransform, 2); gRobot->resetBodyAndCreateNewAgent(); gRobot->resetBodyAndSTM(); gRobot->randomizeState(); gRobot->getFLMotor()->setMaxTorque((opal::real)2); gRobot->getFRMotor()->setMaxTorque((opal::real)2); gRobot->getFLMotor()->setMaxVelocity(1000); gRobot->getFRMotor()->setMaxVelocity(1000); // Create the car. opal::Matrix44r carTransform; carTransform.translate(-12, 2, 4); gCar = new Car(gEngine); gCar->init("../data/blueprints/car1.xml", "Plastic/Blue", 1, carTransform, 1); //DataFile dataFile(mNumTrialsPerRun); //updateOverlayData(trial); //mAvgRewardPerStep = 0; //mCurrentTrialTime = 0; gAgentDebugger = new AgentVisualDebugger(gEngine.getSceneManager()); gAgentDebugger->setAgent(gRobot->getAgent()); gAgentDebugger->setDisplayEnabled(false); /* Ogre::OverlayManager::getSingleton().getByName("Verve/Debug")->hide(); Ogre::OverlayManager::getSingleton().getByName("Core/DebugOverlay")->hide(); // Setup camera. gEngine.getCamera()->setPosition(opal::Point3r(0, 25, 25)); gEngine.getCamera()->lookAt(opal::Point3r(0, (opal::real)0.1, 0)); gEngine.setCameraMoveSpeed(15); */ //setupEnvironment(); gEngine.go(); //mainLoop(); delete gRobot; delete gCar; delete gAgentDebugger; return 0; }
int main (void) { MyApplication app; app.startup(); return 0; }
void handleInput(Ogre::Real elapsedRealTime) { // This variable can be used to keep keys from repeating too fast. static Ogre::Real toggleTimer = 0; if (toggleTimer >= 0) { toggleTimer -= elapsedRealTime; } OIS::Keyboard* keyboard = gEngine.getKeyboard(); if (keyboard->isKeyDown(OIS::KC_W)) { gCar->forward(); } else if (keyboard->isKeyDown(OIS::KC_S)) { gCar->reverse(); } else { gCar->idle(); } if (keyboard->isKeyDown(OIS::KC_A)) { gCar->setSteering(-1); } else if (keyboard->isKeyDown(OIS::KC_D)) { gCar->setSteering(1); } else { gCar->setSteering(0); } // If available, get data from the game controller. if (gGamePad) { // Update the game controller state. SDL_JoystickUpdate(); Ogre::Real joy0X = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 0) / (Ogre::Real)32768; Ogre::Real joy0Y = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 1) / (Ogre::Real)32768; Ogre::Real joy1X = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 4) / (Ogre::Real)32768; Ogre::Real joy1Y = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 3) / (Ogre::Real)32768; if (fabs(joy0Y) > 0.1) { gCar->setThrottle(-joy0Y); } else { gCar->idle(); } if (fabs(joy0X) > 0.1) { gCar->setSteering(joy0X); } else { gCar->setSteering(0); } if (joy1X > 0.2 || joy1X < -0.2) { Ogre::Degree rotAroundY = -Ogre::Degree(joy1X); gEngine.getCamera()->yawRelative(rotAroundY.valueDegrees()); } if (joy1Y > 0.2 || joy1Y < -0.2) { Ogre::Degree rotAroundX = -Ogre::Degree(joy1Y); gEngine.getCamera()->pitchRelative(rotAroundX.valueDegrees()); } } // Toggle GUI. if (keyboard->isKeyDown(OIS::KC_G) && toggleTimer <= 0) { Ogre::Overlay* debugOverlay = Ogre::OverlayManager::getSingleton(). getByName("Verve/Debug"); if (debugOverlay->isVisible()) { debugOverlay->hide(); gAgentDebugger->setDisplayEnabled(false); } else { debugOverlay->show(); gAgentDebugger->setDisplayEnabled(true); } toggleTimer = 0.5; } }
int main(int argc, char* argv[]) { MyApplication app; return app.run(640, 480); }
int main(int argc, char **argv){ MyApplication app; return app.main(argc, argv); }
void setupEnvironment() { // Main static arena. opal::Blueprint arenaBlueprint; opal::loadFile(arenaBlueprint, "../data/blueprints/arena1.xml"); opal::BlueprintInstance arenaBPInstance; gEngine.getSimulator()->instantiateBlueprint(arenaBPInstance, arenaBlueprint, opal::Matrix44r(), 1); gEngine.createPhysicalEntity("staticEnvironment", "Plastic/Gray", arenaBPInstance.getSolid("staticEnvironment")); gEngine.createPhysicalEntity("toy1", "Plastic/Green", arenaBPInstance.getSolid("toy1")); gEngine.createPhysicalEntity("toy2", "Plastic/Green", arenaBPInstance.getSolid("toy2")); gEngine.createPhysicalEntity("toy3", "Plastic/Green", arenaBPInstance.getSolid("toy3")); // Seesaw. opal::Blueprint seesawBP; opal::loadFile(seesawBP, "../data/blueprints/seesaw.xml"); opal::BlueprintInstance seesawBPInstance; opal::Matrix44r seesawTransform; seesawTransform.translate(8, 0, 0); gEngine.getSimulator()->instantiateBlueprint(seesawBPInstance, seesawBP, seesawTransform, 1); gEngine.createPhysicalEntity("seesawSupport", "Plastic/Black", seesawBPInstance.getSolid("seesawSupport")); gEngine.createPhysicalEntity("seesawPanel", "Plastic/Orange", seesawBPInstance.getSolid("seesawPanel")); // Add an initial torque to bring one end of the seesaw to the // ground. seesawBPInstance.getJoint("seesawHinge")->addTorque(0, 100, 0, true); // Merry-go-round. gEngine.createPhysicalEntity("merryGoRound", "Plastic/Yellow", arenaBPInstance.getSolid("merryGoRound")); // Curtains. opal::Blueprint curtainsBP; opal::loadFile(curtainsBP, "../data/blueprints/blockCurtain.xml"); opal::BlueprintInstance curtainsBPInstance; opal::Matrix44r curtainsTransform; curtainsTransform.rotate(45, 0, 1, 0); curtainsTransform.translate(-10, 0, 0); gEngine.getSimulator()->instantiateBlueprint(curtainsBPInstance, curtainsBP, curtainsTransform, 1); gEngine.createPhysicalEntity("curtainBase", "Plastic/Red", curtainsBPInstance.getSolid("curtainBase")); gEngine.createPhysicalEntity("curtainPiece0", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece0")); gEngine.createPhysicalEntity("curtainPiece1", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece1")); gEngine.createPhysicalEntity("curtainPiece2", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece2")); gEngine.createPhysicalEntity("curtainPiece3", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece3")); gEngine.createPhysicalEntity("curtainPiece4", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece4")); gEngine.createPhysicalEntity("curtainPiece5", "Plastic/Black", curtainsBPInstance.getSolid("curtainPiece5")); //// Ragdoll. //opal::Blueprint ragdollBP; //opal::loadFile(ragdollBP, "../data/blueprints/ragdoll.xml"); //opal::BlueprintInstance ragdollBPInstance; //opal::Matrix44r ragdollTransform; //ragdollTransform.translate(10, 5, 0); //gEngine.getSimulator()->instantiateBlueprint(ragdollBPInstance, // ragdollBP, ragdollTransform, 2); //for (unsigned int i = 0; i < ragdollBPInstance.getNumSolids(); ++i) //{ // opal::Solid* s = ragdollBPInstance.getSolid(i); // gEngine.createPhysicalEntity(s->getName(), "Plastic/Red", s); //} //// TESTING: Simple goal box. //opal::Solid* boxSolid = gEngine.getSimulator()->createSolid(); //boxSolid->setStatic(false); //boxSolid->setSleepiness(0); //boxSolid->setPosition(15.5, 10, -7); //opal::BoxShapeData data; //data.dimensions.set(1.5, 1.5, 1.5); //data.material.friction = 0.1; //data.material.density = 0.5; //boxSolid->addShape(data); //gEngine.createPhysicalEntity("goal box", "Plastic/Green", boxSolid); //// TESTING: Make a volume sensor to detect the goal. //opal::VolumeSensorData goalSensorData; //goalSensorData.solid = gRobot->getChassis(); //goalSensorData.transform.makeTranslation(0, 0, -2); //gGoalSensor = gEngine.getSimulator()->createVolumeSensor(); //gGoalSensor->init(goalSensorData); //gGoalSensorVolume = gEngine.getSimulator()->createSolid(); //gGoalSensorVolume->setStatic(true); ////opal::Matrix44r m = gRobot->getChassis()->getTransform(); ////m.translate(0, 0, -2); //opal::Matrix44r m; //m.translate(0, 100, 0); //gGoalSensorVolume->setTransform(m); //opal::BoxShapeData sensorVolumeShape; //sensorVolumeShape.dimensions.set(2, 1, 2); ////gEngine.getSimulator()->setupContactGroup(5, false); ////sensorVolumeShape.contactGroup = 5; //sensorVolumeShape.material.density = 0.01; //gGoalSensorVolume->addShape(sensorVolumeShape); ////gEngine.createPhysicalEntityBox("goal sensor", "Translucent/Blue", boxDim, //// gGoalSensorVolume); //opal::JointData fixedJointData; //fixedJointData.setType(opal::FIXED_JOINT); //fixedJointData.solid0 = gRobot->getChassis(); //fixedJointData.solid1 = gGoalSensorVolume; //opal::Joint* fixedJoint = gEngine.getSimulator()->createJoint(); //fixedJoint->init(fixedJointData); }