コード例 #1
0
void SoundMenu::enter()
{
    OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering SoundMenu...");

    m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "SoundSceneMgr");
    m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));

    m_pCamera = m_pSceneMgr->createCamera("SoundCam");
    m_pCamera->setPosition(Vector3(0, 25, -50));
    m_pCamera->lookAt(Vector3(0, 0, 0));
    m_pCamera->setNearClipDistance(1);

    m_pCamera->setAspectRatio(Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) /
        Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));

    OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);

    OgreFramework::getSingletonPtr()->m_pTrayMgr->destroyAllWidgets();
    OgreFramework::getSingletonPtr()->m_pTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->showCursor();
	  OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_CENTER, "SoundLbl", "Sound Options", 310);
    OgreBites::Slider *mslider = OgreFramework::getSingletonPtr()->m_pTrayMgr->
      createLongSlider(OgreBites::TL_CENTER, "MusSlider", "Music Volume ", 130, 55, 0, MIX_MAX_VOLUME, 129);
    OgreBites::Slider *sslider = OgreFramework::getSingletonPtr()->m_pTrayMgr->
      createLongSlider(OgreBites::TL_CENTER, "SndSlider", "Sound Volume", 130, 55, 0, MIX_MAX_VOLUME, 129);
    mslider->setValue(SoundManager::GetInstance()->GetMusicVolume());
    sslider->setValue(SoundManager::GetInstance()->GetSoundVolume());
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createButton(OgreBites::TL_CENTER, "BackBtn", "Back", 310);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_TOP, "SoundMenuLbl", "Sound mode", 250);

    createScene();
}
コード例 #2
0
ファイル: TutorialApplication.cpp プロジェクト: damiannz/Loco
void TutorialApplication::createFrameListener(void) {
	BaseApplication::createFrameListener();
	
	
	// create a params panel for displaying sample details
    Ogre::StringVector items;
   // items.push_back("Filtering");
   // items.push_back("Poly Mode");

    mStatusPanel = mTrayMgr->createParamsPanel(OgreBites::TL_BOTTOMRIGHT, "Params", 300, items);
	
	OgreBites::Slider* slider = NULL;

	mTrayMgr->createButton(OgreBites::TL_BOTTOMRIGHT, "Reset pose", "Reset pose");
	mTrayMgr->createButton(OgreBites::TL_BOTTOMRIGHT, "Reload controller", "Reload controller");
	mTrayMgr->createButton(OgreBites::TL_BOTTOMRIGHT, "Go to pose", "Go to pose");
	

	// animations control
	slider = mTrayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "Gravity X", "Gravity X", 400, 150, 50, -9.8, 9.8, 149 );
	slider->setValue(0);
	slider = mTrayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "Gravity Y", "Gravity Y", 400, 150, 50, -9.8, 9.8, 149 );
	slider->setValue(0.0f);
	slider = mTrayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "Gravity Z", "Gravity Z", 400, 150, 50, -9.8, 9.8, 149 );
	slider->setValue(0.0f);
	slider = mTrayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "Time multiplier", "Time multiplier", 400, 150, 50, 0, 1, 1000 );
	slider->setValue(DEFAULT_TIME_MULTIPLIER);
	slider = mTrayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "Animation speed", "Animation speed", 400, 150, 50, 0, 2, 1000 );
	slider->setValue(DEFAULT_ANIMATION_SPEED);
	
	
	// animation selector
	int defaultAnimationIndex = 0;
	Ogre::SkeletonInstance* skel = mFigureEnt->getSkeleton();
	
	Ogre::StringVector animationNames;
	animationNames.push_back("<none>");
	if ( skel ) {
		std::cout << "got skeleton" << std::endl;
		for ( int i=0; i<skel->getNumAnimations(); i++ ) {
			std::string name = skel->getAnimation(i)->getName();
			std::cout << " animation: " << name << std::endl;
			if ( /*i<5 || name == "WalkNew"*/true )
			{
				animationNames.push_back(name);
				if ( name == DEFAULT_ANIMATION ) {
					defaultAnimationIndex = i;
				}
			}
		}
		//mFigureEnt->setDisplaySkeleton(true);
	} else {
		std::cout << "no skeleton" << std::endl;
	}
	mAnimationSelectMenu = mTrayMgr->createThickSelectMenu( OgreBites::TL_TOPLEFT, "Animation", "Animation", 400, animationNames.size());
	if ( animationNames.size() ) {
		mAnimationSelectMenu->setItems(animationNames);
		mAnimationSelectMenu->selectItem(defaultAnimationIndex);
	}
	
	static const int debugDrawStyleCount = 8;
	OgreBites::SelectMenu* select = mTrayMgr->createThickSelectMenu( OgreBites::TL_BOTTOMRIGHT, "Debug draw", "Debug draw", 400, debugDrawStyleCount );
	Ogre::StringVector debugDrawStates;
	const char* debugDrawStateNames[debugDrawStyleCount] =  { "None", "Nodes", "Links", "Faces", "FaceAnchors", "Tetras", "TetraForces", "BadTetras" };
	for ( int i=0; i<debugDrawStyleCount; i++ ) {
		debugDrawStates.push_back(debugDrawStateNames[i]);
	}
	select->setItems(debugDrawStates);
	select->selectItem(0);
	
	
	showControls(false);
	
}