void SceneSaveLoad::play(GameObject * _game_obj)
{
	game_obj = _game_obj;
	
	button_press = menu->verificaEventos(EGL_CLIQUE_ESQ);

	switch(button_press){
		case 0:
			saveSlot(1);
			break;
		case 1:
			loadSlot(1);
			break;
	}

	button_press = panel->verificaEventos(EGL_CLIQUE_ESQ);
	
	switch(button_press){
		case SceneActual::WORKSHOP:
			nextScene(SceneActual::WORKSHOP);
			break;
	}

	if(key[SDLK_ESCAPE]){
        game_obj->exit = true;
    }
}
Beispiel #2
0
void Sensor::update() {
  if (Serial1.available() > 0) {
     input = Serial1.read();
     if( input == 0 || input == 1 ) {
       if (forward = (input == 0)) {
          calcTiming();
          nextFrame();
          frameCounter++; 
        } else {
          frameCounter--;
        } 
     } else if ( input == 2) {
       if (forward) nextSceneCounter++;
       if (nextSceneCounter >= nextSceneThreshold) {
         nextScene();
         nextSceneCounter = 0;
       }
     } else if ( input == 3 ) {
       if (forward) endCounter++; else startCounter++;
       if (endCounter >= endThreshold) {
         endFilm();
         endCounter = startCounter = 0;
       } else if (startCounter >= startThreshold) {
         startFilm();
         endCounter = startCounter = 0;
       } 
     }
  }
}
nsresult
nsSceneTracker::SceneNumberBetweenScenes (
                                      nsIDOMHTMLParagraphElement* aLeftScene,
                                      nsIDOMHTMLParagraphElement* aRightScene,
                                      PRUint32* ioNumberLength,
                                      PRUint32* outNumber,
                                      PRBool* outPropagateChanges) {
  NS_ENSURE_ARG_POINTER(ioNumberLength);
  NS_ENSURE_ARG_POINTER(outNumber);
  NS_ENSURE_ARG_POINTER(outPropagateChanges);
  NS_ENSURE_ARG_MIN(*ioNumberLength, 1);

  nsresult rv;

  nsAutoString leftNumberStr;
  PRUint32 leftNumber[DEFAULT_MAX_SCENE_DEPTH];
  PRUint32 leftNumberLength = DEFAULT_MAX_SCENE_DEPTH;

  nsAutoString rightNumberStr;
  PRUint32 rightNumber[DEFAULT_MAX_SCENE_DEPTH];
  PRUint32 rightNumberLength = DEFAULT_MAX_SCENE_DEPTH;

  NS_NAMED_LITERAL_STRING(kNumberAttr, "scenenumber");

  if (aLeftScene) {
    rv = aLeftScene->GetAttribute(kNumberAttr, leftNumberStr);
    if (NS_FAILED(rv))
      return rv;

    rv = ParseSceneNumber(leftNumberStr, &leftNumberLength, leftNumber);
    if (NS_FAILED(rv))
      return rv;
  }

  // Skip unlocked scenes, since we are allowed to renumber them anyway
  nsCOMPtr<nsIDOMHTMLParagraphElement> nextScene(aRightScene);
  while (nextScene && ! SceneHasLockedNumber(nextScene)) {
    nsCOMPtr<nsIDOMHTMLParagraphElement> tmp(nextScene);
    rv = GetNextNumberedScene(tmp, getter_AddRefs(nextScene));
    if (NS_FAILED(rv))
      return rv;
  }

  if (nextScene) {
    rv = nextScene->GetAttribute(kNumberAttr, rightNumberStr);
    if (NS_FAILED(rv))
      return rv;

    rv = ParseSceneNumber(rightNumberStr, &rightNumberLength, rightNumber);
    if (NS_FAILED(rv))
      return rv;
  }

  rv = mNumberSvc->NumberBetweenNumbers(
    aLeftScene ? leftNumber : nsnull, leftNumberLength,
    nextScene ? rightNumber : nsnull, rightNumberLength,
    outNumber, ioNumberLength, outPropagateChanges);

  return rv;
}
Beispiel #4
0
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Define the vector of Scenes we can walk through
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
void ControlPanel::setSceneWorld( std::vector<Scene*>* allScenes ){
    world = allScenes;

    curSceneIndex = -1;   // initialize to no scene index
    curScene = NULL;

    if ( world->size() > 0 ){
        nextScene();
    }
}
Beispiel #5
0
void testApp::keyPressed(int key){
	if(key==OF_KEY_LEFT) { 
		prevScene(); 
	} else if(key==OF_KEY_RIGHT) { 
		nextScene(); 
	} else if(key=='c') { 
		cameraManager.next(); 
	} else if(key=='w') { 
		cameraManager.toggleWarperGui(); 
	}

}
void Liquidmanager::Update(float beat_help,struct winampVisModule *this_mod,float beat_scaler,bool Tex_on)
{
	g_pFrameTime->update();
	if(m_pCurrentScene != NULL)
	{
		if(m_pCurrentScene->isComplete())
		{
			nextScene();
		}

		if(m_pCurrentScene != NULL)
			m_pCurrentScene->Update(beat_help,this_mod,beat_scaler,Tex_on);
	}
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
	switch (key) {
	case 'f':
		ofToggleFullscreen();
		break;
	case 'c':
		doDrawSmallColour = !doDrawSmallColour;
		break;
	case OF_KEY_LEFT:
		if (mode == MULTIPLE_SCENES) prevScene();
		break;
	case OF_KEY_RIGHT:
		if (mode == MULTIPLE_SCENES) nextScene();
		break;
	default:
		break;
	}
}
Beispiel #8
0
Common::Error MohawkEngine_CSTime::run() {
    MohawkEngine::run();

    _console = new CSTimeConsole(this);
    _gfx = new CSTimeGraphics(this);
    _cursor = new DefaultCursorManager(this, ID_CURS);

    _interface = new CSTimeInterface(this);

    _view = new CSTimeView(this);
    _view->setupView();
    _view->setModule(new CSTimeModule(this));

    while (!shouldQuit()) {
        switch (_state) {
        case kCSTStateStartup:
            // We just jump straight to the case for now.
            _state = kCSTStateNewCase;
            break;

        case kCSTStateNewCase:
            initCase();
            _state = kCSTStateNewScene;
            break;

        case kCSTStateNewScene:
            nextScene();
            _state = kCSTStateNormal;
            break;

        case kCSTStateNormal:
            update();
            break;
        }
    }

    return Common::kNoError;
}
// ofBaseApp
//--------------------------------------------------------------
// need to call ofxScene::RunnerScene::update()
void ofxSceneManager::update() {

	_handleSceneChanges();

	// update the current main scene
	if(!_scenes.empty() && _currentScene >= 0) {
	
		ofxScene* s = _currentScenePtr;

		// call setup if scene is not setup yet
		if(!s->isSetup()) {
			_currentRunnerScenePtr->setup();
		}

		_currentRunnerScenePtr->update();

		// if this scene says it's done, go to the next one
		if(s->isDone() && !_bSignalledAutoChange) {
			nextScene();
			_bSignalledAutoChange = true;
		}
	}
}
// ofBaseApp
//--------------------------------------------------------------
// need to call ofxScene::RunnerScene::update()
void ofxSceneManager::update() {

	_handleSceneChanges();

	// update the current main scene
	if(!_scenes.empty() && _currentScene >= 0) {
        ofxScene* s = _currentScenePtr;
        
		// call setup if scene is not setup yet
		if(!s->isSetup()) {
			_currentRunnerScenePtr->setup();
		}

		_currentRunnerScenePtr->update();

		// if this scene says it's done, go to the next one
		if(s->isDone() && !_bSignalledAutoChange) {
			nextScene();
			_bSignalledAutoChange = true;
		}
	}
    
    
//--------------------- <CAMBIOS MASOTROS> ---------------------//
    // update the new scene, if there is one
    if(_bOverlapTransitions && !_scenes.empty() && _newScene != SCENE_NOCHANGE && _newScene >= 0){
        ofxScene* next_s = getSceneAt(_newScene);
        
        if(!next_s->isSetup()) {
            _newRunnerScenePtr->setup();
		}
        
		_newRunnerScenePtr->update();
    }
//--------------------- </CAMBIOS MASOTROS> ---------------------//    
}
Beispiel #11
0
void BaseScene::update(float dt){
	if (dt <= 0) dt = Director::getInstance()->getAnimationInterval();

	// 入洞检查
	ballInRightHole();

	// 键盘触发
	if (SceneDesigner::balls){
		for (int i = 0; i < SceneDesigner::balls->size(); i++)
			SceneDesigner::balls->at(i)->applyKeepForce(pressed);
	}

	// 控件更新
	score -= dt * 10;
	scoreLabel->setString(MyTool::num2str(int(score)));

	// 电球的引力和斥力作用
	electricBallAreaEffect();

	// physics update
#ifndef NOBOX2D
	world->Step(dt, 8, 3);
#endif

	dealafterContact();

	if (SceneDesigner::balls){
		std::string s = "";
		for (int i = 0; i < int(SceneDesigner::balls->size()); i++){
			auto ball = SceneDesigner::balls->at(i);
			ball->updatePosWithBody();
			ball->getBody()->SetAngularVelocity(ball->getVelocityValue() / RTM_RATIO / 2 /ball->radius);
		
			if (score < 700){
				/*s+= "s : (" + MyTool::num2str(ball->getSprite()->getPosition().x);
				s += " ," + MyTool::num2str(ball->getSprite()->getPosition().y) + ")		";
				s += "b : (" + MyTool::num2str(ball->getBody()->GetPosition().x * 32);
				s += " ," + MyTool::num2str(ball->getBody()->GetPosition().y * 32) + ")";*/
				s += "( e : " + MyTool::num2str(int(ball->enableBox2d)) + ", s : ";
				if(ball->getSprite()) s += "y , b : ";
				else s += "n , b : ";
				if (ball->getBody()) s += "y ";
				else s += "n ";
				s += " )";
			}
		}
		if (score < 700) {
			auto debugger = ((LabelTTF*)getChildByName("debugger"));
			debugger->setString(s);
		}
	}

	if (lock == 0 && checkOver()){ // 检查是否还有球可进
		int targetScore = 0;
		if (score > targetScore) nextScene();
		else gameover();
	}

	// 游戏结束
	if (lock == 0 && score <= 0){
		gameover();
	}
}
Beispiel #12
0
bool Landing::onTouchBegan(Touch *touch, Event *unused_event)
{
    nextScene();
    return true;
}
Beispiel #13
0
//-------------------- protected methods -----------------------------
void ControlPanel::controlChanged( int control_enum_value ){
    switch ( control_enum_value ){
        case LIGHTING_CHECKBOX:
            if( !lighting )
                glDisable( GL_LIGHT0 );
            else
                glEnable( GL_LIGHT0 );
            break;
        case DRAWAXES_CHECKBOX:
            curScene->setDrawAxes( drawAxes );
            break;
        case PREVSCENE_BUTTON:
            prevScene();
            break;
        case NEXTSCENE_BUTTON:
            nextScene();
            break;
        case QUIT_BUTTON:
            exit( 0 );
            break;
        case SET_PROJECTION:
            if( which_projection == 0 )
                world->at( curSceneIndex )->setParallelStatus( true );
            else
                world->at( curSceneIndex )->setParallelStatus( false );
        case LOOKAT:
            updateWorldWithSlider();
            break;
        case PERSPECTIVE:
            world->at( curSceneIndex )->setPerspective( viewAngle,
                                                        aspectRatio,
                                                        near, far );
            break;
        case SET_LOOKAT:
            setLookAtSliders(  );
            break;
        case SET_ADVANCED:
            setAdvancedSliders(  );
            break;
        case ADVANCED:
            updateAdvanced(  );
            break;
        case BOX_BUTTON:
            world->at( curSceneIndex )->addObject( new Box() );
            world->at( curSceneIndex )->redraw();
            break;
        case CLOWN_BUTTON:
            world->at( curSceneIndex )->addObject( new Clown() );
            world->at( curSceneIndex )->redraw();
            break;
        case DONUT_BUTTON:
            world->at( curSceneIndex )->addObject( new Donut() );
            world->at( curSceneIndex )->redraw();
            break;
        case EYE_BUTTON:
            world->at( curSceneIndex )->addObject( new Eye() );
            world->at( curSceneIndex )->redraw();
            break;
        case HAT_BUTTON:
            world->at( curSceneIndex )->addObject( new Hat() );
            world->at( curSceneIndex )->redraw();
            break;
        case HEAD_BUTTON:
            world->at( curSceneIndex )->addObject( new Head() );
            world->at( curSceneIndex )->redraw();
            break;
        case SNOWMAN_BUTTON:
            world->at( curSceneIndex )->addObject( new Snowman() );
            world->at( curSceneIndex )->redraw();
            break;
        case SPHERE_BUTTON:
            world->at( curSceneIndex )->addObject( new Sphere() );
            world->at( curSceneIndex )->redraw();
            break;
    }
}