Example #1
0
//--------------------------------------------------------------
void ofxSceneManager::gotoScene(unsigned int index, bool now) {
	if(_scenes.empty() || index >= _scenes.size() ||
	   _sceneChangeTimer.getDiff() < _minChangeTimeMS)
		return;

	ofxScene* s;
	if(_currentScene == (int) index) {
		ofLogWarning("ofxSceneManager") << "ignoring duplicate goto scene change";
		return;
	}

	if(!now) {
	
		// tell current scene to exit
		if(_currentScene > SCENE_NONE) {
			s = _currentScenePtr;
			s->startExiting();
		}

		// tell new scene to enter
		s = getSceneAt(index);
		s->startEntering();
//--------------------- <CAMBIOS MASOTROS> ---------------------//
        _newRunnerScenePtr = _getRunnerSceneAt(index);
//--------------------- </CAMBIOS MASOTROS> ---------------------//
	}
	
	_newScene = index;
	_bChangeNow = now;
    
    ofLogVerbose("ofxSceneManager") << "GOTO SCENE: " << _newScene;
}
Example #2
0
bool World::scenesAreConnected(Scene *scene1, Scene *scene2) {
	if (!scene1 || !scene2)
		return false;

	int x = scene2->_worldX;
	int y = scene2->_worldY;

	for (int dir = 0; dir < 4; dir++)
		if (!scene2->_blocked[dir])
			if (getSceneAt(x + directionsX[dir], y + directionsY[dir]) == scene1)
				return true;

	return false;
}
Example #3
0
// 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> ---------------------//    
}
Example #4
0
std::string ofxSceneManager::getSceneName(unsigned int index) {
	ofxScene* s = getSceneAt(index);
	return s == NULL ? "" : s->getName();
}