Esempio n. 1
0
//----------------------------------------------------------------------------
Ogre::StringVector AngelScriptInterpreter::listFunctions(std::string &section)
{
    Ogre::StringVector ret;

    asUINT n;

    // List the application registered functions
    for( n = 0; n < (asUINT)mEngine->GetGlobalFunctionCount(); n++ )
    {
		asIScriptFunction *func = mEngine->GetGlobalFunctionByIndex(n);

        // Skip the functions that start with _ as these are not meant to be called explicitly by the user
        if( func->GetName()[0] != '_' )
            ret.push_back(" " + std::string(func->GetDeclaration()));
    }

    ret.push_back("I am listing functions:");
    // List the user functions in the module
    asIScriptModule *mod = mEngine->GetModule(section.c_str());
    if( mod )
    {
        ret.push_back("");
        ret.push_back("User functions:");
        for( n = 0; n < mod->GetFunctionCount(); n++ )
        {
            asIScriptFunction *func = mod->GetFunctionByIndex(n);
            ret.push_back(func->GetDeclaration());
        }
    }

    return ret;
}
void darkMainSinglePlayer::buildGUI()
{
	Ogre::StringVector items2;
	items2.push_back("Find the 3 chests.");
	items2.push_back("Then the wall will dissapear");
	items2.push_back("Finaly go home!");

	m_pDetailsPanel2 = OgreFramework::getSingletonPtr()->m_pTrayMgr->createParamsPanel(OgreBites::TL_BOTTOMRIGHT, "DetailsPanel2", 300, items2);
    m_pDetailsPanel2->show();

	Ogre::StringVector items;
	items.push_back("Objectives:");
    items.push_back("1. First Chests Picked");
	items.push_back("2. Second Chests Picked");
	items.push_back("3. Third Chests Picked");
	items.push_back("4. Gate Opened");
	items.push_back("Distance");
	items.push_back("First Chest");
	items.push_back("Second Chest");
	items.push_back("Third Chest");
	items.push_back("Finish");
	OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_BOTTOMRIGHT, "GameLevel1Lb12", "Objectives", 300);
	m_pDetailsPanel = OgreFramework::getSingletonPtr()->m_pTrayMgr->createParamsPanel(OgreBites::TL_BOTTOMLEFT, "DetailsPanel", 300, items);
    m_pDetailsPanel->show();	

	pickup = OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_CENTER, "Pickuplabel", "Pickup", 250);
	pickup->hide();
	
}
Esempio n. 3
0
void SimulationState::setupActiveModeSelection()
{
    Ogre::StringVector items;
    items.push_back("Realtime");
    items.push_back("Record");
    m_pActiveModeSelectMenu = (m_pTrayMgr->createThickSelectMenu(
        TL_TOPRIGHT, "ActiveModeSelectionSimulation", "Simulations Mode", 200, 3, items));
    // Set active in Menu
    m_pActiveModeSelectMenu->selectItem((int)m_eSimulationActiveMode);
}
Esempio n. 4
0
AppFileExplorer::AppFileExplorer(const std::string &initialPath,const std::string &filter,FileExplorerListerner *listener)
{
  
	std::string name = "AppFileExplorer : " + Ogre::StringConverter::toString(AppFileExplorer::numExplorer);
	mExplorerName = name;
	
	AppFileExplorer::numExplorer++;

	mTrayMgr = new OgreBites::SdkTrayManager(name,AppDemo::getSingletonPtr()->mRenderWnd,AppDemo::getSingletonPtr()->mMouse,this);
	
	
	Ogre::StringVector sv;
	sv.push_back("C:\\");
	sv.push_back("D:\\");
	sv.push_back("E:\\");

	OgreBites::TrayLocation tLoc = OgreBites::TL_CENTER;

 	mTrayMgr->createSeparator(tLoc,name + "Line_Two",500);
  	mTrayMgr->createLabel(tLoc,name + "LB_Title","File Explorer",150);
	mTrayMgr->createSeparator(tLoc,name + "Line_Four",600);
 	mTrayMgr->createLongSelectMenu(tLoc,name + "DiskMenu","Disk",450,3,sv);
	mTrayMgr->createSeparator(tLoc,name + "Line_Five",600);
 	mTrayMgr->createLongSelectMenu(tLoc,name + "PathMenu","Path",450,10);
	mTrayMgr->createButton(tLoc,name + "BT_ok","ok",100);
	mTrayMgr->createButton(tLoc,name + "BT_cancel","cancel",100);
	mTrayMgr->createSeparator(tLoc,name + "Line_Six",600); 
	mTrayMgr->hideAll();
	
	mCurrentFilePath.resize(3);

	if(initialPath[0] == 'C' || initialPath[0] == 'c')
		mCurrentFilePath[0] = initialPath;
	else 
		mCurrentFilePath[0] = "C:\\";
	if(initialPath[0] == 'D' || initialPath[0] == 'd')
		mCurrentFilePath[1] = initialPath;
	else 
		mCurrentFilePath[1] = "D:\\";
	if(initialPath[0] == 'E' || initialPath[0] == 'e')
		mCurrentFilePath[2] = initialPath;
	else 
		mCurrentFilePath[2] = "E:\\";

	mInitialFilePath = initialPath;
	mExplorerListener = listener;
	mOldMouseListener = NULL;

	mFilter = filter;
	//updateItems(initialPath);
	
}
//-------------------------------------------------------------------------------------
void BaseApplication::createFrameListener(void)
{
    Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;

    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

    mInputManager = OIS::InputManager::createInputSystem( pl );

    mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));

    mMouse->setEventCallback(this);
    mKeyboard->setEventCallback(this);

    //Set initial mouse clipping size
    windowResized(mWindow);

    //Register as a Window listener
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
    mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    mTrayMgr->showCursor();

    // create a params panel for displaying sample details
    Ogre::StringVector items;
	items.push_back("CAMERA POSITION");
    items.push_back("X");
    items.push_back("Y");
    items.push_back("Z");
    items.push_back("");
	items.push_back("CAMERA ORIENTATION");
    items.push_back("W");
    items.push_back("X");
    items.push_back("Y");
    items.push_back("Z");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->setParamValue(11, "Bilinear");
    mDetailsPanel->setParamValue(12, "Solid");
    mDetailsPanel->hide();

    mRoot->addFrameListener(this);
}
Esempio n. 6
0
void RacquetApp::createFrameListener(void) {
    BaseApplication::createFrameListener();

    Ogre::StringVector items;
    items.push_back("Highscore");
    items.push_back("");
    items.push_back("Last Score");
    items.push_back("Current Score");
    items.push_back("Gravity");

    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->setParamValue(DETAILS_HIGHSCORE, "0");
    mDetailsPanel->setParamValue(DETAILS_LASTSCORE, "0");
    mDetailsPanel->setParamValue(DETAILS_SCORE, "0");
    mDetailsPanel->setParamValue(DETAILS_GRAVITY, "Downwards");
}
Esempio n. 7
0
//----------------------------------------------------------------------------
Ogre::StringVector AngelScriptInterpreter::compileModule(std::string &section, const char *source)
{
    Ogre::StringVector ret;

    int r = mBuilder->StartNewModule(mEngine, section.c_str());
    if( r < 0 )
    {
        return ret;
    }
    r = mBuilder->AddSectionFromMemory(source, "memory");
    if( r < 0 )
    {
        return ret;
    }

    int errpos;

    {
        OGRE_LOCK_AUTO_MUTEX;
        errpos = mBuffer.size();
    }

    r = mBuilder->BuildModule();
    if( r < 0 )
    {
        // An error occurred. Instruct the script writer to fix the
        // compilation errors that were listed in the output stream.
        ret.push_back("Please correct the errors in the script and try again.");
        ret.push_back("Following errors found in script:");

        OGRE_LOCK_AUTO_MUTEX;
        for(unsigned int i = errpos;i < mBuffer.size();i++)
        {
            char buf[1000];
            sprintf(buf,"Row: %d, Col: %d :: %s", mBuffer[i].mRow, mBuffer[i].mCol, mBuffer[i].mMessage.c_str());

            ret.push_back(Ogre::String(buf));
        }

        return ret;
    }

    ret.push_back("Compilation successful!!");

    return ret;
}
AdvancedRenderControls::AdvancedRenderControls(TrayManager* trayMgr, Ogre::Camera* cam)
    : mCamera(cam), mTrayMgr(trayMgr) {
    mRoot = Ogre::Root::getSingletonPtr();

    // create a params panel for displaying sample details
    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
    mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
    items.push_back("RT Shaders");
    items.push_back("Lighting Model");
    items.push_back("Compact Policy");
    items.push_back("Generated VS");
    items.push_back("Generated FS");
#endif

    mDetailsPanel = mTrayMgr->createParamsPanel(TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->hide();

    mDetailsPanel->setParamValue(9, "Bilinear");
    mDetailsPanel->setParamValue(10, "Solid");

#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
    mDetailsPanel->setParamValue(11, "Off");
    if (!mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION)) {
        mDetailsPanel->setParamValue(11, "On");
    }

    mDetailsPanel->setParamValue(12, "Vertex");
    mDetailsPanel->setParamValue(13, "Low");
    mDetailsPanel->setParamValue(14, "0");
    mDetailsPanel->setParamValue(15, "0");
#endif
}
void GameApplication::createGUI(void)
{
	if (mTrayMgr == NULL) return;
	using namespace OgreBites;
	Button* b = mTrayMgr->createButton(TL_TOPRIGHT, "MyButton", "Last position", 120.0);
	b->show();

	//sliders to control velocities and speed
	Slider* xVelocitySlider = mTrayMgr->createThickSlider(TL_BOTTOMRIGHT, "xVelocitySlider", "X Velocity", 250, 80, 0, 0, 0);
	xVelocitySlider->setRange(-10,10,21);
	xVelocitySlider->setValue(0);
	mTrayMgr->sliderMoved(xVelocitySlider);

	Slider* zVelocitySlider = mTrayMgr->createThickSlider(TL_BOTTOMRIGHT, "zVelocitySlider", "Z Velocity", 250, 80, 0, 0, 0);
	zVelocitySlider->setRange(-20,0,21);
	zVelocitySlider->setValue(-10);
	mTrayMgr->sliderMoved(zVelocitySlider);

	Slider* yVelocitySlider = mTrayMgr->createThickSlider(TL_BOTTOMRIGHT, "yVelocitySlider", "Y Velocity", 250, 80, 0, 0, 0);
	yVelocitySlider->setRange(0,15,16);
	yVelocitySlider->setValue(10);
	mTrayMgr->sliderMoved(yVelocitySlider);

	Slider* speedSlider= mTrayMgr->createThickSlider(TL_BOTTOMRIGHT, "speedSlider", "Speeeed", 250, 80, 0, 0, 0);
	speedSlider->setRange(0,10,11);
	speedSlider->setValue(5);
	mTrayMgr->sliderMoved(speedSlider);

	// Lecture 16: Setup parameter panel: Updated in addTime
	Ogre::StringVector items;
	items.push_back("V:");
	mParamsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_BOTTOMLEFT,"Trajectory Velocity",250,items);
	mParamsPanel->setParamValue(0, Ogre::StringConverter::toString(Ogre::Vector3::ZERO));

	// score panel with number of shots fired
	items.clear();
	items.push_back("Score");
	items.push_back("Shots fired");
	items.push_back("Targets remaining");
	mScorePanel = mTrayMgr->createParamsPanel(OgreBites::TL_TOP, "Stats", 250, items);
	
	//mTrayMgr->create
	mTrayMgr->showAll();

}
Esempio n. 10
0
//-----------------------------------------------------------------------------
void Ogitors::COFSSceneSerializer::_upgradeOgsceneFileFrom3To4(TiXmlNode* ogsceneRootNode)
{
    TiXmlElement* element = ogsceneRootNode->FirstChildElement();   

    OFS::OfsPtr& mFile = OgitorsRoot::getSingletonPtr()->GetProjectFile();
    OgitorsSystem *mSystem = OgitorsSystem::getSingletonPtr();

    OFS::FileList list;
    mFile->listFilesRecursive("/", list);

    Ogre::StringVector terFiles;

    for( unsigned int i = 0;i < list.size(); i++ )
    {
        if(list[i].flags && OFS::OFS_FILE)
        {
            if(list[i].name.substr(list[i].name.size() - 4, 4) == ".ogt")
            {
                terFiles.push_back( list[i].name );
            }
        }
    }

    if( terFiles.size() > 0 )
    {
        Ogre::SceneManager *pUpgSM = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "UpgradeSCM");

        for( unsigned int i = 0;i < terFiles.size(); i++ )
        {
            Ogre::String filenameorig = terFiles[i];
            Ogre::String filenamebackup = filenameorig + ".backup";

            mFile->renameFile( filenameorig.c_str(), filenamebackup.c_str() );

            OFS::OFSHANDLE *filebackup = new OFS::OFSHANDLE();
            OFS::OFSHANDLE *fileorig = new OFS::OFSHANDLE();

            mFile->createFile(*fileorig, filenameorig.c_str());
            mFile->openFile(*filebackup, filenamebackup.c_str(), OFS::OFS_READ);

            {
                OgreTerrainConverter conv;

                Ogre::DataStreamPtr stream_in = Ogre::DataStreamPtr(OGRE_NEW OfsDataStream(mFile, filebackup));
                Ogre::DataStreamPtr stream_out = Ogre::DataStreamPtr(OGRE_NEW OfsDataStream(mFile, fileorig));
                Ogre::DataStreamPtr compressStream(OGRE_NEW Ogre::DeflateStream(filenameorig, stream_in));
                Ogre::StreamSerialiser ser_in(compressStream);
                Ogre::StreamSerialiser ser_out(stream_out);

                conv.Upgrade( ser_in, ser_out );
            }
        }

        Ogre::Root::getSingletonPtr()->destroySceneManager(pUpgSM);
    }
}
Esempio n. 11
0
//-------------------------------------------------------------------------------------
void Game::createFrameListener()
{
	BaseApplication::createFrameListener();

	Ogre::StringVector items;
	items.push_back("Spieler am Zug");
	items.push_back("Spielstatus");
	items.push_back("Info");

	mDebugPanel = mTrayMgr->createParamsPanel(OgreBites::TL_TOPLEFT, "DebugPanel", 820, items);

	mDebugPanel->setParamValue(0, "Spieler 1");
	mInfo = "Willkommen zum Muehlespiel";
	mDebugPanel->show();

#ifdef DEBUG_GENERAL
	qDebug() << "--------Start move" << mMoveCount << "--------";
	qDebug() << "Current player is White";
#endif
}
    // Retrieves the current output from the interpreter.
    unsigned int OgitorsScriptConsole::getOutput(unsigned int start, Ogre::StringVector& list)
    {
        list.clear();

        OGRE_LOCK_AUTO_MUTEX
        
        for(unsigned int i = start;i < mOutput.size();i++)
        {
            list.push_back(mOutput[i]);
        }

        return mOutput.size();
    }
Esempio n. 13
0
//----------------------------------------------------------------------------
Ogre::StringVector AngelScriptInterpreter::execString(std::string &section, std::string &arg)
{
    Ogre::StringVector ret;

    // Wrap the expression in with a call to _grab, which allow us to print the resulting value
    std::string script = arg;//"_grab(" + arg + ")";

    // TODO: Add a time out to the script, so that never ending scripts doesn't freeze the application

    asIScriptContext *ctx = mEngine->CreateContext();
    ctx->SetExceptionCallback(asFUNCTION(ExceptionCallback), this, asCALL_CDECL);
    int r = ExecuteString(mEngine, script.c_str(), mEngine->GetModule(section.c_str()), ctx);
    if( r < 0 )
    {
        ret.push_back("Invalid script statement.");
    }
    else if( r == asEXECUTION_EXCEPTION )
    {
        ret.push_back("A script exception was raised.");
    }

    return ret;
}
Esempio n. 14
0
//----------------------------------------------------------------------------
Ogre::StringVector AngelScriptInterpreter::addFunction(std::string &section, std::string &arg)
{
    Ogre::StringVector ret;

    asIScriptModule *mod = mEngine->GetModule(section.c_str(), asGM_CREATE_IF_NOT_EXISTS);

    asIScriptFunction *func = 0;
    int r = mod->CompileFunction("addfunc", arg.c_str(), 0, asCOMP_ADD_TO_MODULE, &func);
    if( r < 0 )
    {
        // TODO: Add better description of error (invalid declaration, name conflict, etc)
        ret.push_back("Failed to add function.");
    }
    else
    {
        ret.push_back("Function added.");
    }

    // We must release the function object
    if( func )
        func->Release();

    return ret;
}
Esempio n. 15
0
Ogre::StringVector AngelScriptInterpreter::buildString(std::string &section, std::string &arg)
{
    Ogre::StringVector ret;

    mBuilder->StartNewModule(mEngine, section.c_str());
    mBuilder->AddSectionFromMemory(arg.c_str(), section.c_str());
    int r = mBuilder->BuildModule();
    if( r < 0 )
    {
        // An error occurred. Instruct the script writer to fix the
        // compilation errors that were listed in the output stream.
        ret.push_back("Please correct the errors in the script and try again.");
        return ret;
    }

    return ret;
}
Esempio n. 16
0
Ogre::StringVector BaseApplication::getDetailsPanelFields()
{
	Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

	return items;
}
void application::create_frame_listener()
{
    Ogre::LogManager::getSingletonPtr() -> logMessage("Initializing OIS");
    OIS::ParamList pl;
    size_t wndhnd = 0;
    std::ostringstream wndhndstr;

    wnd->getCustomAttribute ("WINDOW", &wndhnd);
    wndhndstr << wndhnd;
    pl.insert (std::make_pair (std::string {"WINDOW"}, wndhndstr.str()));

    input = OIS::InputManager::createInputSystem(pl);

    kbd   = static_cast<OIS::Keyboard*> (input->createInputObject (OIS::OISKeyboard, true));
    mouse = static_cast<OIS::Mouse*>    (input->createInputObject (OIS::OISMouse,    true));

    mouse -> setEventCallback(this);
    kbd   -> setEventCallback(this);

    windowResized(wnd);

    Ogre::WindowEventUtilities::addWindowEventListener (wnd, this);

    OgreBites::InputContext inctx;
    inctx.mMouse    = mouse;
    inctx.mKeyboard = kbd;
    tray_mgr = new OgreBites::SdkTrayManager ("InterfaceName", wnd, inctx, this);
    tray_mgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    tray_mgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    tray_mgr->hideCursor();

    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

    root->addFrameListener(this);
}
Esempio n. 18
0
//-------------------------------------------------------------------------------------
void SpaceLogin::createScene(void)
{
	g_accountName = kbe_getLastAccountName();
	if(g_accountName.size() == 0)
		g_accountName = KBEngine::StringConv::val2str(KBEngine::genUUID64());

	mTrayMgr->createButton(OgreBites::TL_CENTER, "login", "fast login", 120);

	Ogre::StringVector values;
	values.push_back(g_accountName);
	mTrayMgr->createParamsPanel(OgreBites::TL_CENTER, "accountName", 300, values);

	mTrayMgr->showCursor();
	
	mTrayMgr->hideFrameStats();
	mTrayMgr->hideLogo();
	mTrayMgr->hideBackdrop();

	mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);

    // Create the camera
    mActiveCamera = mSceneMgr->createCamera("PlayerCam");

    // Position it at 500 in Z direction
    mActiveCamera->setPosition(Ogre::Vector3(0,0,80));
    // Look back along -Z
    mActiveCamera->lookAt(Ogre::Vector3(0,0,-300));
    mActiveCamera->setNearClipDistance(5);

    mCameraMan = new OgreBites::SdkCameraMan(mActiveCamera);   // create a default camera controller
    mCameraMan->setTopSpeed(7.0f);
	OgreApplication::getSingleton().setCurrCameraMan(mCameraMan);

    // Create one viewport, entire window
    Ogre::Viewport* vp = mWindow->addViewport(mActiveCamera);
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0));

    // Alter the camera aspect ratio to match the viewport
    mActiveCamera->setAspectRatio(
        Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
}
Esempio n. 19
0
void Player::createFrameListener(){
	Ogre::LogManager::getSingletonPtr()->logMessage("*** OIS Initalizing ***");
	OIS::ParamList pl;
	size_t windowHnd = 0;
	std::ostringstream windowHndStr;
	//Get window info
	video.ogreWindow->getCustomAttribute("WINDOW",&windowHnd);
	windowHndStr << windowHnd;
	pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));


	//Start input manager
	mInputManager=OIS::InputManager::createInputSystem(pl);

	mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true));
	mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true));

	mMouse->setEventCallback(this);
	mKeyboard->setEventCallback(this);

	//Set mouse clipping size
	video.windowResized(video.ogreWindow);

	//Set rotation variables
	mRotate = 0.13;
	bRotate = 1.0;
	mMove = 200;
	mDirection = Ogre::Vector3::ZERO;

	//Register window listener
	Ogre::WindowEventUtilities::addWindowEventListener(video.ogreWindow, this);

	if(gui.usingCG == true){

	} else {
		//Set input context for GUI
		inputContex.mMouse = mMouse;
		inputContex.mKeyboard = mKeyboard;
		//Create Interface and show debug info
		video.mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT); //Show FPS
		//Hide cursor
		video.mTrayMgr->hideCursor();
		hideCursor = true;

		// create a params panel for displaying sample details
		Ogre::StringVector items;
		items.push_back("cam.pX");
		items.push_back("cam.pY");
		items.push_back("cam.pZ");
		items.push_back("");
		items.push_back("cam.oW");
		items.push_back("cam.oX");
		items.push_back("cam.oY");
		items.push_back("cam.oZ");
		items.push_back("");
		items.push_back("Filtering");
		items.push_back("Poly Mode");

		video.mDetailsPanel = video.mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
		video.mDetailsPanel->setParamValue(9, "Bilinear");
		video.mDetailsPanel->setParamValue(10, "Solid");
		video.mDetailsPanel->hide();
	}

	video.ogreRoot->addFrameListener(mainListener);

	//Populate camera container
	mCamNode = playerCamera->getParentSceneNode()->getParentSceneNode();
}
//-------------------------------------------------------------------------------------
void BaseApplication::createFrameListener(void)
{
    Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;

    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

    mInputManager = OIS::InputManager::createInputSystem( pl );

    mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));

	//Fix for 1.9
	mInputContext.mKeyboard = mKeyboard;
    mInputContext.mMouse = mMouse;

    mMouse->setEventCallback(this);
    mKeyboard->setEventCallback(this);

    //Set initial mouse clipping size
    windowResized(mWindow);

    //Register as a Window listener
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

	//Fix for 1.9 - take this out:
	/*OgreBites::InputContext inputContext;
	inputContext.mMouse = mMouse; 
	inputContext.mKeyboard = mKeyboard;
	mTrayMgr = new OgreBites::SdkTrayManager("TrayMgr", mWindow, inputContext, this);*/

	/*OgreBites::InputContext input;
	input.mAccelerometer = NULL;
	input.mKeyboard = mKeyboard;
	input.mMouse = mMouse;
	input.mMultiTouch = NULL;
	mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, input, this);*/

	//Fix for 1.9 - put this in:
	mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mInputContext, this);
	//mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
   // mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    //mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    mTrayMgr->hideCursor();

    // create a params panel for displaying sample details
    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->setParamValue(9, "Bilinear");
    mDetailsPanel->setParamValue(10, "Solid");
    mDetailsPanel->hide();

    mRoot->addFrameListener(this);
}
Esempio n. 21
0
	void Framework::setupDetailsPanel()
	{
		// create a params panel for displaying sample details
		Ogre::StringVector items;
		items.push_back("cam.pX");
		items.push_back("cam.pY");
		items.push_back("cam.pZ");
		items.push_back("");
		items.push_back("cam.oW");
		items.push_back("cam.oX");
		items.push_back("cam.oY");
		items.push_back("cam.oZ");
		items.push_back("");
		items.push_back("Filtering");
		items.push_back("Poly Mode");

#ifdef USE_RTSHADER_SYSTEM
		items.push_back("RT Shaders");
		items.push_back("LightingModel");
		items.push_back("CompactPolicy");
		items.push_back("Generated VS");
		items.push_back("Generated FS");														
#endif

		//! 16\17\18
		items.push_back("cam.xaxis");
		items.push_back("cam.yaxis");
		items.push_back("cam.zaxis");														

		mDetailsPanel = mTrayMgr->createParamsPanel(TL_NONE, "DetailsPanel", 150*2, items);
		mDetailsPanel->hide();

		mDetailsPanel->setParamValue(9, "Bilinear");
		mDetailsPanel->setParamValue(10, "Solid");

#ifdef USE_RTSHADER_SYSTEM
		mDetailsPanel->setParamValue(11, "Off");
		mDetailsPanel->setParamValue(12, "Vertex");
		mDetailsPanel->setParamValue(13, "Low");
		mDetailsPanel->setParamValue(14, "0");
		mDetailsPanel->setParamValue(15, "0");															
#endif
		mDetailsPanel->setParamValue(16, "0");
		mDetailsPanel->setParamValue(17, "0");
		mDetailsPanel->setParamValue(18, "0");															

	}
Esempio n. 22
0
void
AddEffectInfoDialog::OnInitDialog(wxInitDialogEvent &e)
{
	wxDialog::OnInitDialog(e);

	wxSizer* sizer = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );

	wxComboBox *item2 = new wxComboBox( this, feID_COMBOCTRL_EFFECT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, NULL, wxCB_DROPDOWN );
	item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );

	wxComboBox *item3 = new wxComboBox( this, feID_COMBOCTRL_LOCATOR, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, NULL, wxCB_DROPDOWN );
	item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );

	sizer->Add( item1, 0, wxALIGN_CENTER|wxALL, 10 );

	wxFlexGridSizer *item5 = new wxFlexGridSizer( 2, 0, 0 );

	wxButton *item6 = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	item6->SetDefault();
	item5->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item7 = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );

	sizer->Add( item5, 0, wxALIGN_CENTER|wxALL, 10 );

	this->SetSizer( sizer );
	sizer->SetSizeHints( this );

	Fairy::EffectManager::EffectTemplateIterator it = 
		Fairy::EffectManager::getSingleton().getEffectTemplateIterator();

	while ( it.hasMoreElements() )
	{
		item2->AppendString(it.peekNextKey().c_str());

		it.moveNext();
	}

	item2->SetSelection(0);

	SkillObjectEditor* pEditor= static_cast<SkillObjectEditor*>(this->GetParent());
	if(!pEditor)
		return;
	Fairy::LogicModel *pMbject  = pEditor->GetParentFrame()->GetActorSettingEditor()->GetActorObject();
	assert (pMbject);

	Ogre::StringVector boneNameList;
	for ( unsigned short i=0; i<pMbject->getNumBones(); ++i )
	{
		boneNameList.push_back(pMbject->getBoneName(i));
	}

	Ogre::StringVector locatorNames;
	pMbject->getLocatorNames(locatorNames);

	for ( size_t i=0; i<locatorNames.size(); ++i )
	{
		Fairy::LogicModel::LocatorValue value;
		if(pMbject->getLocatorInfo(locatorNames[i], value))
		{
			if(value.mBoneName != "" )
			{
				for ( int index=0; index<(int)boneNameList.size(); ++index )
				{
					if (boneNameList[index] == value.mBoneName)
					{
						// info of the locator is valid
						item3->Append(locatorNames[i].c_str());
						break;
					}
				}						
			}
		}
	}

	item3->SetSelection(0);
}
Esempio n. 23
0
bool MinimalOgre::go(void)
{
#ifdef _DEBUG
    mResourcesCfg = "resources_d.cfg";
    mPluginsCfg = "plugins_d.cfg";
#else
    mResourcesCfg = "resources.cfg";
    mPluginsCfg = "plugins.cfg";
#endif
 
    // construct Ogre::Root
    mRoot = new Ogre::Root(mPluginsCfg);
 
//-------------------------------------------------------------------------------------
    // setup resources
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);
 
    // Go through all sections & settings in the file
    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
 
    Ogre::String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }
//-------------------------------------------------------------------------------------
    // configure
    // Show the configuration dialog and initialise the system
    // You can skip this and use root.restoreConfig() to load configuration
    // settings if you were sure there are valid ones saved in ogre.cfg
    if(mRoot->restoreConfig() || mRoot->showConfigDialog())
    {
        // If returned true, user clicked OK so initialise
        // Here we choose to let the system create a default rendering window by passing 'true'
        mWindow = mRoot->initialise(true, "MinimalOgre Render Window");
    }
    else
    {
        return false;
    }
    
    //new addition to 1.9, needs to be created for singleton instance.
    overlaySystem = new Ogre::OverlaySystem();
//-------------------------------------------------------------------------------------
    // choose scenemanager
    // Get the SceneManager, in this case a generic one
    mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
    mSceneMgr->addRenderQueueListener(overlaySystem);

//-------------------------------------------------------------------------------------
    // create camera
    // Create the camera
    mCamera = mSceneMgr->createCamera("PlayerCam");
 
    // Position it at 500 in Z direction
    mCamera->setPosition(Ogre::Vector3(0,0,80));
    // Look back along -Z
    mCamera->lookAt(Ogre::Vector3(0,0,-300));
    mCamera->setNearClipDistance(5);
 
    mCameraMan = new OgreBites::SdkCameraMan(mCamera);   // create a default camera controller
//-------------------------------------------------------------------------------------
    // create viewports
    // Create one viewport, entire window
    Ogre::Viewport* vp = mWindow->addViewport(mCamera);
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
 
    // Alter the camera aspect ratio to match the viewport
    mCamera->setAspectRatio(
        Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
//-------------------------------------------------------------------------------------
    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
//-------------------------------------------------------------------------------------
    // Create any resource listeners (for loading screens)
    //createResourceListener();
//-------------------------------------------------------------------------------------
    // load resources
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//-------------------------------------------------------------------------------------
    // Create the scene
    Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "cube.mesh");
 
    //Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    //headNode->attachObject(ogreHead);
 
    // Set ambient light
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
 
    // Create a light
    Ogre::Light* l = mSceneMgr->createLight("MainLight");
    l->setPosition(20,80,50);
//-------------------------------------------------------------------------------------
    //create FrameListener
    Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;
    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
    //allow debugging in linux
    pl.insert(std::make_pair("x11_keyboard_grab", "false"));
    pl.insert(std::make_pair("x11_mouse_grab", "false"));
 
    mInputManager = OIS::InputManager::createInputSystem( pl );
 
    mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
 
    mMouse->setEventCallback(this);
    mKeyboard->setEventCallback(this);
    
    OgreBites::InputContext input_context;
    input_context.mKeyboard = mKeyboard;
    input_context.mMouse= mMouse;

    //Set initial mouse clipping size
    windowResized(mWindow);
 
    //Register as a Window listener
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
 
    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, input_context, this);
    mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    //mTrayMgr->hideCursor();
 
    // create a params panel for displaying sample details
    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");
 
    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->setParamValue(9, "Bilinear");
    mDetailsPanel->setParamValue(10, "Solid");
    mDetailsPanel->hide();
 
    mRoot->addFrameListener(this);
    Voxelizor *v = new Voxelizor();
    //v->fill();
    v->make_wall();
    v->to_ogre_mesh(*mSceneMgr);
//-------------------------------------------------------------------------------------
    mRoot->startRendering();
 
    
    return true;
}
Esempio n. 24
0
void RenderState::buildGUI()
{

        OgreBites::SdkTrayManager* trayMgr = OgreFramework::getSingletonPtr()->_trayMgr;


        trayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
        // trayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
        // trayMgr->createLabel(OgreBites::TL_TOP, "GameLbl", "Game mode", 250);
        trayMgr->showCursor();

        Ogre::StringVector items;
        items.push_back("cam.pX");
        items.push_back("cam.pY");
        items.push_back("cam.pZ");
        items.push_back("cam.oW");
        items.push_back("cam.oX");
        items.push_back("cam.oY");
        items.push_back("cam.oZ");
        items.push_back("Mode");

        _detailsPanel = trayMgr->createParamsPanel(OgreBites::TL_NONE, 
                                                     "DetailsPanel", 200, items);
        _detailsPanel->hide();

        Ogre::StringVector displayModes;
        displayModes.push_back("Solid mode");
        displayModes.push_back("Wireframe mode");
        displayModes.push_back("Point mode");
        trayMgr->createLongSelectMenu(OgreBites::TL_TOPRIGHT, 
                                      "DisplayModeSelMenu", 
                                      "Display Mode", 200, 3, displayModes);

        lightCheckBox = trayMgr->createCheckBox(OgreBites::TL_TOPLEFT, "light", 
                                                "Moving light", 200);

        tmkSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "tmk", 
                                              "tmk", 200,80,44,0,25,101);

        tmk2Slider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "tmk2", 
                                               "tmk2", 200,80,44,0,70,101);

        mintmSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "minTm", 
                                                "minTm", 200,80,44,0,1,101);

        shininessSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "shininess", 
                                                    "shininess",  200,80,44,0,10,101);

        stepsSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "steps", 
                                                "steps",  200,80,44,16,1024,241);

        ambientSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "ambient", 
                                                  "ambient",  200,80,44,-1,3,61);

        backIllumSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "backIllum", 
                                          "back illumination", 200,80,44,0,3,31);

        shadeCoeffSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "shadeCoeff", 
                                                     "shadeCoeff", 200,80,44,0.1,5,50);

        specCoeffSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "specCoeff", 
                                                     "specCoeff", 200,80,44,0.1,5,50);

        specMultSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "specMult", 
                                                     "specMult", 200,80,44,0.1,8,80);

        glowCoeffSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "glowCoeff", 
                                               "glowCoeff", 200,80,44,0,5,101);

        miscSlider = trayMgr->createLongSlider(OgreBites::TL_TOPLEFT, "misc", 
                                               "misc", 200,80,44,0,10,101);

        // OgreBites::Button* reloadMaterialButton = 
        //         trayMgr->createButton(OgreBites::TL_RIGHT, 
        //                               "ReloadMaterial", 
        //                               "Reload material", 60);

        updateWidgets();
}
Esempio n. 25
0
//-------------------------------------------------------------------------------------
// Create the SDKtray manager
void OGREBase::initSDKTray(void)
{
	mInputContext.mKeyboard = mKeyboard;
    mInputContext.mMouse = mMouse;
    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mInputContext, this);
    mTrayMgr->hideCursor();

    // Create a params panel for displaying sample details
    Ogre::StringVector items;
	items.push_back("Item");
    items.push_back("X");
    items.push_back("Y");
    items.push_back("Z");
    items.push_back("");
    items.push_back("Pitch symball");
	items.push_back("Pitch node");
	items.push_back("");
    items.push_back("Yaw symball");
	items.push_back("Yaw node");
	items.push_back("");
    items.push_back("Roll symball");
	items.push_back("Roll node");//12
    items.push_back("");
	items.push_back("Insertion symball");
    items.push_back("Insertion node");

	//Create details panel
    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
	mSelectedElement = 1;
    mDetailsPanel->hide();

}
Esempio n. 26
0
Ogre::StringVector
StringTokenise(const Ogre::String& str, const Ogre::String& delimiters, const Ogre::String& delimiters_preserve, const Ogre::String& quote, const Ogre::String& esc)
{
    Ogre::StringVector ret;

    Ogre::String::size_type pos = 0; // the current position (char) in the string
    char ch = 0; // buffer for the current character
    char delimiter = 0;	// the buffer for the delimiter char which
                            // will be added to the tokens if the delimiter
                            // is preserved
    char current_quote = 0; // the char of the current open quote
    bool quoted = false; // indicator if there is an open quote
    Ogre::String token;  // string buffer for the token
    bool token_complete = false; // indicates if the current token is
                                 // read to be added to the result vector
    Ogre::String::size_type len = str.length();  // length of the input-string

    // for every char in the input-string
    while(len > pos)
    {
        // get the character of the string and reset the delimiter buffer
        ch = str.at(pos);
        delimiter = 0;

        // assume ch isn't a delimiter
        bool add_char = true;

        // check ...

        // ... if the delimiter is an escaped character
        bool escaped = false; // indicates if the next char is protected
        if(esc.empty() == false) // check if esc-chars are provided
        {
            if(esc.find_first_of(ch) != std::string::npos)
            {
                // get the escaped char
                ++pos;
                if(pos < len) // if there are more chars left
                {
                    // get the next one
                    ch = str.at(pos);

                    // add the escaped character to the token
                    add_char = true;
                }
                else // cannot get any more characters
                {
                    // don't add the esc-char
                    add_char = false;
                }

                // ignore the remaining delimiter checks
                escaped = true;
            }
        }

        // ... if the delimiter is a quote
        if(quote.empty() == false && escaped == false)
        {
            // if quote chars are provided and the char isn't protected
            if(quote.find_first_of(ch) != std::string::npos)
            {
                // if not quoted, set state to open quote and set
                // the quote character
                if(quoted == false)
                {
                    quoted = true;
                    current_quote = ch;

                    // don't add the quote-char to the token
                    add_char = false;
                }
                else // if quote is open already
                {
                    // check if it is the matching character to close it
                    if(current_quote == ch)
                    {
                        // close quote and reset the quote character
                        quoted = false;
                        current_quote = 0;

                        // don't add the quote-char to the token
                        add_char = false;
                    }
                }
            }
        }

        // if the delimiter isn't preserved
        if(delimiters.empty() == false && escaped == false && quoted == false)
        {
            // if a delimiter is provided and the char isn't protected by
            // quote or escape char
            if(delimiters.find_first_of(ch) != std::string::npos)
            {
                // if ch is a delimiter and the token string isn't empty
                // the token is complete
                if(token.empty() == false)
                {
                    token_complete = true;
                }

                // don't add the delimiter to the token
                add_char = false;
            }
        }

        // if the delimiter is preserved - add it as a token
        bool add_delimiter = false;
        if(delimiters_preserve.empty() == false && escaped == false && quoted == false)
        {
            // if a delimiter which will be preserved is provided and the
            // char isn't protected by quote or escape char
            if(delimiters_preserve.find_first_of(ch) != std::string::npos)
            {
                // if ch is a delimiter and the token string isn't empty the token is complete
                if(token.empty() == false)
                {
                    token_complete = true;
                }

                // don't add the delimiter to the token
                add_char = false;

                // add the delimiter
                delimiter = ch;
                add_delimiter = true;
            }
        }

        // add the character to the token
        if(add_char == true)
        {
            // add the current char
            token.push_back(ch);
        }

        // add the token if it is complete
        if(token_complete == true && token.empty() == false)
        {
            // add the token string
            ret.push_back(token);

            // clear the contents
            token.clear();

            // build the next token
            token_complete = false;
        }

        // add the delimiter
        if(add_delimiter == true)
        {
            // the next token is the delimiter
            Ogre::String delim_token;
            delim_token.push_back(delimiter);
            ret.push_back(delim_token);
        }

        // repeat for the next character
        ++pos;
    }

    // add the final token
    if(token.empty() == false)
    {
        ret.push_back(token);
    }

    return ret;
}
Esempio n. 27
0
	// 根据矩形id删除一个矩形
	void CEventAreaEditAction::DeleteRect(int iId)
	{
		SHOW_RECT_MAP::iterator itEventAreaEnd;
		SHOW_RECT_MAP::iterator it;
		SHOW_RECT_MAP::iterator endIt;

		if (!m_bLocalArea)
		{
			it = m_RectShowMap.find(iId);
			endIt = m_RectShowMap.end();
		}
		else
		{
			it = m_LocalRectShowMap.find(iId);
			endIt = m_LocalRectShowMap.end();
		}

		Ogre::Vector3	p1;
		Ogre::Vector3   p2;

		Ogre::StringVector nameVector;
		Ogre::StringVector valueVector;

		int iRectid = 0;
		if(it != endIt)
		{
			CEventAreaInfo* pEventAreaInfo = NULL;
			pEventAreaInfo = it->second;
			if(pEventAreaInfo)
			{
				iRectid = pEventAreaInfo->m_iId;
				p1.x = pEventAreaInfo->m_rect.m_LeftTop.x;
				p1.z = pEventAreaInfo->m_rect.m_LeftTop.y;

				p2.x = pEventAreaInfo->m_rect.m_RightBottom.x;
				p2.z = pEventAreaInfo->m_rect.m_RightBottom.y;

				if (m_bLocalArea)
				{
					for (int i = 0; i<10; ++i)
					{
						Ogre::String paramName = pEventAreaInfo->m_paramsName[i];
						Ogre::String paramValue = pEventAreaInfo->m_paramsValue[i];
						if (!paramName.empty() && !paramValue.empty())
						{
							nameVector.push_back(paramName);
							valueVector.push_back(paramValue);
						}
					}
				}	

				delete pEventAreaInfo;
			}
			
			m_bLocalArea?(m_LocalRectShowMap.erase(it)):(m_RectShowMap.erase(it));

			getSceneManipulator()->_fireDelRect(0, iRectid);

			// 删除redo undo
			CEventAreaEditDelOperator* pDelOperator = NULL;
			pDelOperator = new CEventAreaEditDelOperator;

			pDelOperator->SetAction(this);
			pDelOperator->SetInstanceId(iRectid, m_bLocalArea);
			pDelOperator->SetPosition(p1, p2);//

			for (int index = 0; index<(int)nameVector.size(); ++index)
			{
				pDelOperator->m_paramName.push_back(nameVector[index]);
				pDelOperator->m_paramValue.push_back(valueVector[index]);
			}
			
			getOperatorManager()->addOperator(pDelOperator);//

			m_pCurOperatorRect = NULL;
			
		}

		
	}
Esempio n. 28
0
//-------------------------------------------------------------------------------------
void BaseApplication::createFrameListener(void)
{
    Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;

    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

    mInputManager = OIS::InputManager::createInputSystem( pl );

    mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));

    mMouse->setEventCallback(this);
    mKeyboard->setEventCallback(this);

    //Set initial mouse clipping size
 	 windowResized(mWindow);	

    //Register as a Window listener
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
    //mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    //mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
	Button_All[0] = mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Start","Start",200);
	Button_All[1] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"About","About",200);
	Button_All[2] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Exit","Exit",200);
	Button_All[3] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Back_toMain","Back",200);
	Button_All[4] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Unlimit","Unlimit",200);
	Button_All[5] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit","TimeLimit",200);
	Button_All[6] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect","Collect",200);
	Button_All[7] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Restart","Restart",200);
	Button_All[8] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Exit_toMain","Exit",200);
	Button_All[9] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Resume_Game","Resume Game",200);
	Button_All[10] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_Most","Collect Most",200);
	Button_All[11] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_Collect","Collect in time",200);
	Button_All[12] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_state_1","State1",200);
	Button_All[13] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_state_2","State2",200);
	Button_All[14] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_state_3","State3",200);
	Button_All[15] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_state_4","State4",200);
	Button_All[16] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"TimeLimit_state_5","State5",200);
	Button_All[17] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect_state_1","State1",200);
	Button_All[18] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect_state_2","State2",200);
	Button_All[19] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect_state_3","State3",200);
	Button_All[20] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect_state_4","State4",200);
	Button_All[21] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"Collect_state_5","State5",200);
	Button_All[22] =mTrayMgr->createButton(OgreBites::TL_BOTTOMLEFT,"AI_type","AI type",200);

	mTrayMgr->removeWidgetFromTray("Back_toMain");
	mTrayMgr->removeWidgetFromTray("Unlimit");
	mTrayMgr->removeWidgetFromTray("TimeLimit");
	mTrayMgr->removeWidgetFromTray("Collect");
	mTrayMgr->removeWidgetFromTray("Restart");
	mTrayMgr->removeWidgetFromTray("Exit_toMain");
	mTrayMgr->removeWidgetFromTray("Resume_Game");
	mTrayMgr->removeWidgetFromTray("TimeLimit_Most");
	mTrayMgr->removeWidgetFromTray("TimeLimit_Collect");
	mTrayMgr->removeWidgetFromTray("TimeLimit_state_1");
	mTrayMgr->removeWidgetFromTray("TimeLimit_state_2");
	mTrayMgr->removeWidgetFromTray("TimeLimit_state_3");
	mTrayMgr->removeWidgetFromTray("TimeLimit_state_4");
	mTrayMgr->removeWidgetFromTray("TimeLimit_state_5");
	mTrayMgr->removeWidgetFromTray("Collect_state_1");
	mTrayMgr->removeWidgetFromTray("Collect_state_2");
	mTrayMgr->removeWidgetFromTray("Collect_state_3");
	mTrayMgr->removeWidgetFromTray("Collect_state_4");
	mTrayMgr->removeWidgetFromTray("Collect_state_5");
	mTrayMgr->removeWidgetFromTray("AI_type");


	for(int i=3;i<23;i++){
		Button_All[i]->hide();
	}

	About_Text = mTrayMgr->createTextBox(OgreBites::TL_TOPLEFT,"About_Textbox","About",250,208);
	Time_Show = mTrayMgr->createLabel(OgreBites::TL_TOPLEFT,"Time_Show_Label","Time",240);
	Time_Value_Show =  mTrayMgr->createLabel(OgreBites::TL_TOPLEFT,"Time_Value_Label","",240);
	Score_Show = mTrayMgr->createLabel(OgreBites::TL_TOPLEFT,"Score_Show_Label","Score",240);
	Score_Value_Show =  mTrayMgr->createLabel(OgreBites::TL_TOPLEFT,"Score_Value_Label","",240);
	mTrayMgr->removeWidgetFromTray("About_Textbox");
	mTrayMgr->removeWidgetFromTray("Time_Show_Label");
	mTrayMgr->removeWidgetFromTray("Time_Value_Label");
	mTrayMgr->removeWidgetFromTray("Score_Show_Label");
	mTrayMgr->removeWidgetFromTray("Score_Value_Label");
	About_Text->hide();
	Time_Show->hide();
	Time_Value_Show->hide();
	Score_Show->hide();
	Score_Value_Show->hide();
    //mTrayMgr->hideCursor();

    // create a params panel for displaying sample details
    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

    mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
    mDetailsPanel->setParamValue(9, "Bilinear");
    mDetailsPanel->setParamValue(10, "Solid");
    mDetailsPanel->hide();

    mRoot->addFrameListener(this);
}
Esempio n. 29
0
//--------------------------------------------------------------------------------
void CMultiSelEditor::_createModifyList()
{
    mWorldAABB = Ogre::AxisAlignedBox::BOX_NULL;
    mModifyList.clear();
    NameObjectPairList::const_iterator it = mSelectedObjects.begin();
    while(it != mSelectedObjects.end())
    {
        CBaseEditor *add = it->second;
        Ogre::AxisAlignedBox box = add->getWorldAABB();
        mWorldAABB.merge(box);

        Ogre::String name = add->getName();
        if(mModifyList.find(name) == mModifyList.end()) 
            mModifyList.insert(NameObjectPairList::value_type(add->getName(), add));

        it++;
    }
    
    Ogre::String remname;
    Ogre::StringVector removeList;
    removeList.clear();


    it = mModifyList.begin();
    while(it != mModifyList.end())
    {
        remname = it->second->getParent()->getName();

        if(mModifyList.find(remname) != mModifyList.end()) 
            removeList.push_back(it->first);

        it++;
    }

    for(unsigned int x = 0;x < removeList.size(); x++)
    {
        mModifyList.erase(mModifyList.find(removeList[x]));
    }

    Ogre::Vector3 xTot = Ogre::Vector3::ZERO;
    Ogre::Vector3 yTot = Ogre::Vector3::ZERO;
    Ogre::Vector3 zTot = Ogre::Vector3::ZERO;
    int count = 0;

    it = mModifyList.begin();
    while(it != mModifyList.end())
    {
        xTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_X;
        yTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_Y;
        zTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_Z;
        count++;
        it++;
    }

    if(count)
    {
        xTot /= ((float)count);
        yTot /= ((float)count);
        zTot /= ((float)count);
        Ogre::Vector3 normal = Ogre::Vector3::UNIT_Z;
        Ogre::Quaternion q;
        q.FromAxes(xTot,yTot,zTot);

        mNode->setPosition(mWorldAABB.getCenter());
        mNode->setOrientation(q);
    }
    else
    {
        mNode->setPosition(Ogre::Vector3::ZERO);
        mNode->setOrientation(Ogre::Quaternion::IDENTITY);
    }
    mNode->setScale(1,1,1);

    if(mSelectedObjects.size() == 0)
    {
        mSystem->SelectTreeItem(mOgitorsRoot->GetRootEditor());
        mSystem->PresentPropertiesView(0);
    }
    else if(mSelectedObjects.size() == 1)
    {
        mSystem->SelectTreeItem(mSelectedObjects.begin()->second);
        mSystem->PresentPropertiesView(mSelectedObjects.begin()->second);
    }
    else
    {
        mSystem->SelectTreeItem(this);
        mSystem->PresentPropertiesView(this);
    }

    SelectionChangeEvent evt(this);
    EventManager::getSingletonPtr()->sendEvent(this, 0, &evt);
}
Esempio n. 30
0
int COFSSceneSerializer::Import(Ogre::String importfile)
{
    OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr();
    OgitorsSystem *mSystem = OgitorsSystem::getSingletonPtr();
    OFS::OfsPtr& mFile = OgitorsRoot::getSingletonPtr()->GetProjectFile();

    if(importfile == "")
    {
        UTFStringVector extlist;
        extlist.push_back(OTR("Ogitor File System File"));
        extlist.push_back("*.ofs");
        extlist.push_back(OTR("Ogitor Scene File"));
        extlist.push_back("*" + Globals::OGSCENE_FORMAT_EXTENSION);

        importfile = mSystem->GetSetting("system", "oldOpenPath", "");
        importfile = mSystem->DisplayOpenDialog(OTR("Open"), extlist, importfile);
        if(importfile == "") 
            return SCF_CANCEL;

        mSystem->SetSetting("system", "oldOpenPath", importfile);
    }

    importfile = OgitorsUtils::QualifyPath(importfile);

    Ogre::String filePath = OgitorsUtils::ExtractFilePath(importfile);
    Ogre::String fileName = OgitorsUtils::ExtractFileName(importfile);

    bool testpassed = false;
    try
    {
        std::ofstream test((filePath + "test.dat").c_str());
        if(test.is_open())
            testpassed = true;
        test.close();
        mSystem->DeleteFile(filePath + "test.dat");
    }
    catch(...)
    {
        testpassed = false;
    }

    if(!testpassed)
    {
        mSystem->DisplayMessageDialog("The path is read-only. Ogitor can not work with read-only project paths!", DLGTYPE_OK);
        return SCF_CANCEL;
    }

    Ogre::UTFString loadmsg = "";

    int typepos = importfile.find_last_of(".");
    if(typepos != -1 && (importfile.substr(typepos, 4) != ".ofs"))
        importfile = filePath;
    

    OFS::OfsResult oRet;
    if((oRet = mFile.mount(importfile.c_str(), OFS::OFS_MOUNT_OPEN | OFS::OFS_MOUNT_RECOVER)) != OFS::OFS_OK)
    {
        if(oRet == OFS::OFS_PREVIOUS_VERSION)
        {
            mSystem->DisplayMessageDialog("The OFS file is a previous version, please use qtOFS to upgrade it to new file version.", DLGTYPE_OK);
        }

        loadmsg = mSystem->Translate("Please load a Scene File...");
        mSystem->UpdateLoadProgress(-1, loadmsg);
        return SCF_ERRPARSE;
    }

    OFS::FileSystemStats fsStats;

    mFile->getFileSystemStats(fsStats);

    PROJECTOPTIONS *pOpt = ogRoot->GetProjectOptions();
    pOpt->CreatedIn = "";

    pOpt->ProjectDir = filePath;
    typepos = fileName.find_last_of(".");
    if(typepos != -1)
        fileName.erase(typepos, fileName.length() - typepos);
    pOpt->ProjectName = fileName;

    fileName += Globals::OGSCENE_FORMAT_EXTENSION;

    OFS::ofs64 file_size = 0;

    if(mFile->getFileSize(fileName.c_str(), file_size) != OFS::OFS_OK)
	{		
        // OGSCENE file name needs to match OFS container file name. If the later was renamed, we 
        // need to automatically adapt the OGSCENE file name now.
        OFS::FileList files = mFile->listFiles("/", OFS::OFS_FILE);
        unsigned int ogsceneFileExtensionLength = strlen(Globals::OGSCENE_FORMAT_EXTENSION.c_str());

		for(OFS::FileList::iterator iter = files.begin(); iter != files.end(); iter++)
		{
			// Filter out too short names
            if(iter->name.size() <= ogsceneFileExtensionLength) 
                continue;

			if(stricmp(iter->name.c_str() + (iter->name.size() - (ogsceneFileExtensionLength)), Globals::OGSCENE_FORMAT_EXTENSION.c_str()) == 0)
			{
				mFile->renameFile(iter->name.c_str(), fileName.c_str());
				break;
			}
		}

		if(mFile->getFileSize(fileName.c_str(), file_size) != OFS::OFS_OK)
			return SCF_ERRFILE;
	}

    char *file_data = new char[(unsigned int)file_size + 1];

    OFS::OFSHANDLE projHandle;

    if(mFile->openFile(projHandle, fileName.c_str(), OFS::OFS_READ) != OFS::OFS_OK)
    {
        delete [] file_data;
        return SCF_ERRFILE;
    }

    mFile->read(projHandle, file_data, file_size);
    mFile->closeFile(projHandle);

    TiXmlDocument docImport;

    if(!docImport.LoadFromMemory(file_data, file_size))
    {
        delete [] file_data;
        return SCF_ERRFILE;
    }

    delete [] file_data;

    loadmsg = mSystem->Translate("Parsing Scene File");
    mSystem->UpdateLoadProgress(1, loadmsg);

    TiXmlNode* ogitorSceneNode = 0;
    TiXmlNode* projectNode;
    TiXmlElement* element = 0;
    bool upgradeExecuted = false;
    ogitorSceneNode = docImport.FirstChild("OGITORSCENE");

    if(!ogitorSceneNode)
        return SCF_ERRPARSE;

    element = ogitorSceneNode->ToElement();

    // Old OGSCENE version check and attempt to fix/update
    int version = Ogre::StringConverter::parseInt(ValidAttr(element->Attribute("version"), "0"));    
    if(Ogre::StringConverter::toString(version) < Globals::OGSCENE_FORMAT_VERSION)
    {
        mSystem->DisplayMessageDialog(mSystem->Translate("Old OGSCENE file version detected. Ogitor will now attempt to upgrade the format and will also create a backup version of your OFS file."), DLGTYPE_OK);

        loadmsg = mSystem->Translate("Upgrading OGSCENE file.");
        mSystem->UpdateLoadProgress(10, loadmsg);

        if(version == 0)
        {
            mSystem->DisplayMessageDialog(mSystem->Translate("OGSCENE files contains no version number set and therefore cannot be loaded."), DLGTYPE_OK);
            return SCF_ERRPARSE;
        }
        else if(version == 1)
        {
            mSystem->DisplayMessageDialog(mSystem->Translate("OGSCENE files with version 1 cannot be upgraded automatically. Please contact the Ogitor team for further details."), DLGTYPE_OK);
            return SCF_ERRPARSE;
        }

        if(version > 1)
        {
            if((mFile->getFileSystemType() == OFS::OFS_PACKED) && (!mSystem->CopyFile(importfile, importfile + ".backup")))
                mSystem->DisplayMessageDialog(mSystem->Translate("Error while trying to create backup file."), DLGTYPE_OK);
        }
        switch(version)
        {
         case 2:
            _upgradeOgsceneFileFrom2To3(ogitorSceneNode);
            _upgradeOgsceneFileFrom3To4(ogitorSceneNode);
            break;
         case 3:
            _upgradeOgsceneFileFrom3To4(ogitorSceneNode);
            break;
        }

        upgradeExecuted = true;
    }  

    projectNode = ogitorSceneNode->FirstChild("PROJECT");

    if(projectNode)
    {
        loadmsg = mSystem->Translate("Parsing project options");
        mSystem->UpdateLoadProgress(5, loadmsg);
        ogRoot->LoadProjectOptions(projectNode->ToElement());
        ogRoot->PrepareProjectResources();
    }

    element = ogitorSceneNode->FirstChildElement();

    loadmsg = mSystem->Translate("Creating scene objects");
    mSystem->UpdateLoadProgress(10, loadmsg);

    unsigned int obj_count = 0;
    Ogre::String objecttype;
    OgitorsPropertyValueMap params;
    OgitorsPropertyValue tmpPropVal;
    Ogre::String objAttValue;
    Ogre::String elementName;
    TiXmlElement* properties = 0;
    Ogre::String attID;
    Ogre::String attValue;
    CBaseEditor* result = 0;
    TiXmlElement* customprop = 0;
    Ogre::StringVector invalidEditorTypes;

    do
    {
        // Make sure its NON-ZERO
        if(pOpt->ObjectCount)
        {
            ++obj_count;
            mSystem->UpdateLoadProgress(10 + ((obj_count * 70) / pOpt->ObjectCount), loadmsg);
        }

        params.clear();       

        objAttValue = ValidAttr(element->Attribute("object_id"), "");
        if(objAttValue != "")
        {
            tmpPropVal.propType = PROP_UNSIGNED_INT;
            tmpPropVal.val = Ogre::Any(Ogre::StringConverter::parseUnsignedInt(objAttValue));
            params.insert(OgitorsPropertyValueMap::value_type("object_id", tmpPropVal));
        }

        objAttValue = ValidAttr(element->Attribute("parentnode"), "");
        if(objAttValue != "")
        {
            tmpPropVal.propType = PROP_STRING;
            tmpPropVal.val = Ogre::Any(objAttValue);
            params.insert(OgitorsPropertyValueMap::value_type("parentnode", tmpPropVal));
        }

        objAttValue = ValidAttr(element->Attribute("name"), "");
        if(objAttValue != "")
        {
            tmpPropVal.propType = PROP_STRING;
            tmpPropVal.val = Ogre::Any(objAttValue);
            params.insert(OgitorsPropertyValueMap::value_type("name", tmpPropVal));
        }
        else
            continue;

        objAttValue = ValidAttr(element->Attribute("typename"), "");
        if(objAttValue != "")
        {
            tmpPropVal.propType = PROP_STRING;
            tmpPropVal.val = Ogre::Any(objAttValue);
            params.insert(OgitorsPropertyValueMap::value_type("typename", tmpPropVal));
        }
        else
            continue;

        properties = element->FirstChildElement();
        if(properties)
        {            
            do
            {
                elementName = properties->Value();
                if(elementName != "PROPERTY")
                    continue;

                attID = ValidAttr(properties->Attribute("id"), "");
                int attType = Ogre::StringConverter::parseInt(ValidAttr(properties->Attribute("type"), ""));
                attValue = ValidAttr(properties->Attribute("value"), "");

                params.insert(OgitorsPropertyValueMap::value_type(attID, OgitorsPropertyValue::createFromString((OgitorsPropertyType)attType, attValue)));
            } while(properties = properties->NextSiblingElement());
        }

        objecttype = Ogre::any_cast<Ogre::String>(params["typename"].val);
        result = ogRoot->CreateEditorObject(0, objecttype, params, false, false);
        if(result)
        {
            customprop = element->FirstChildElement("CUSTOMPROPERTIES");
            if(customprop) 
            {
                OgitorsUtils::ReadCustomPropertySet(customprop, result->getCustomProperties());
            }
        }
        else
            invalidEditorTypes.push_back(objecttype);

    } while(element = element->NextSiblingElement());

    // Print out invalid/unsupported editor types (= types where no factory could be found)
    if(invalidEditorTypes.size() > 0)
    {
        std::sort(invalidEditorTypes.begin(), invalidEditorTypes.end());
        invalidEditorTypes.erase(std::unique(invalidEditorTypes.begin(), invalidEditorTypes.end()), invalidEditorTypes.end());
        Ogre::String invalidTypesResultString;
        for(unsigned int i = 0; i < invalidEditorTypes.size(); i++)
        {
            invalidTypesResultString += invalidEditorTypes.at(i) + "\n";
        }
        mSystem->DisplayMessageDialog(mSystem->Translate("Could not create objects of types:\n" + invalidTypesResultString), DLGTYPE_OK);
    }

    //// Save directly after upgrade
    //if(upgradeExecuted)
    //    Export(false, importfile);

    ogRoot->AfterLoadScene();

    return SCF_OK;
}