• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>


            ////mem probs without this next one
            #include <CEGUI/elements/CEGUIPushButton.h>
            #include <CEGUI/elements/CEGUICombobox.h>
            #include <CEGUI/elements/CEGUIListbox.h>
            #include <CEGUI/elements/CEGUIListboxTextItem.h>
            #include <cegui/elements/CEGUIPopupMenu.h>
            #include <OgreNoMemoryMacros.h>
            #include <CEGUI/CEGUIImageset.h>
            #include <CEGUI/CEGUISystem.h>
            #include <CEGUI/CEGUILogger.h>
            #include <CEGUI/CEGUISchemeManager.h>
            #include <CEGUI/CEGUIWindowManager.h>
            #include <CEGUI/CEGUIWindow.h>
            #include "OgreCEGUIRenderer.h"
            #include "OgreCEGUIResourceProvider.h"
            //regular mem handler
            #include <OgreMemoryMacros.h>

            #include "ExampleApplication.h"
            CEGUI::MouseButton convertOgreButtonToCegui(int buttonID)
            {
            ?switch (buttonID)
            ?{
            ?case MouseEvent::BUTTON0_MASK:
            ??return CEGUI::LeftButton;
            ?case MouseEvent::BUTTON1_MASK:
            ??return CEGUI::RightButton;
            ?case MouseEvent::BUTTON2_MASK:
            ??return CEGUI::MiddleButton;
            ?case MouseEvent::BUTTON3_MASK:
            ??return CEGUI::X1Button;
            ?default:
            ??return CEGUI::LeftButton;
            ?}
            }

            class GuiFrameListener : public ExampleFrameListener, public MouseMotionListener, public MouseListener
            {
            private:
            ?CEGUI::Renderer* mGUIRenderer;
            ?bool mShutdownRequested;

            public:
            ?// NB using buffered input
            ?GuiFrameListener(RenderWindow* win, Camera* cam, CEGUI::Renderer* renderer)
            ??: ExampleFrameListener(win, cam, true, true),
            ??mGUIRenderer(renderer),
            ??mShutdownRequested(false)
            ?{
            ??mEventProcessor->addMouseMotionListener(this);
            ??mEventProcessor->addMouseListener(this);
            ??mEventProcessor->addKeyListener(this);
            ?}

            ?// Tell the frame listener to exit at the end of the next frame
            ?void requestShutdown(void)
            ?{
            ??mShutdownRequested = true;
            ?}

            ?bool frameEnded(const FrameEvent& evt)
            ?{
            ??if (mShutdownRequested)
            ???return false;
            ??else
            ???return ExampleFrameListener::frameEnded(evt);
            ?}

            ?void mouseMoved (MouseEvent *e)
            ?{
            ??CEGUI::System::getSingleton().injectMouseMove(
            ???e->getRelX() * mGUIRenderer->getWidth(),
            ???e->getRelY() * mGUIRenderer->getHeight());
            ??e->consume();
            ?}

            ?void mouseDragged (MouseEvent *e)
            ?{
            ??mouseMoved(e);
            ?}

            ?void mousePressed (MouseEvent *e)
            ?{
            ??CEGUI::System::getSingleton().injectMouseButtonDown(
            ???convertOgreButtonToCegui(e->getButtonID()));
            ??e->consume();
            ?}

            ?void mouseReleased (MouseEvent *e)
            ?{
            ??CEGUI::System::getSingleton().injectMouseButtonUp(
            ???convertOgreButtonToCegui(e->getButtonID()));
            ??e->consume();
            ?}

            ?void mouseClicked(MouseEvent* e) {}
            ?void mouseEntered(MouseEvent* e) {}
            ?void mouseExited(MouseEvent* e) {}

            ?void keyPressed(KeyEvent* e)
            ?{
            ??if(e->getKey() == KC_ESCAPE)
            ??{
            ???mShutdownRequested = true;
            ???e->consume();
            ???return;
            ??}

            ??CEGUI::System::getSingleton().injectKeyDown(e->getKey());
            ??CEGUI::System::getSingleton().injectChar(e->getKeyChar());
            ??e->consume();
            ?}

            ?void keyReleased(KeyEvent* e)
            ?{
            ??CEGUI::System::getSingleton().injectKeyUp(e->getKey());
            ??e->consume();
            ?}

            ?void keyClicked(KeyEvent* e)
            ?{
            ??// Do nothing
            ??e->consume();
            ?}
            };

            class TutorialApplication : public ExampleApplication
            {
            private:
            ?CEGUI::OgreCEGUIRenderer* mGUIRenderer;
            ?CEGUI::System* mGUISystem;
            ?CEGUI::Window* mEditorGuiSheet;
            ?bool mButtonQuitBuild;
            ?CEGUI::PopupMenu*?? popupMenu;
            public:
            ?TutorialApplication()
            ??: mGUIRenderer(0),
            ??mGUISystem(0),
            ??mEditorGuiSheet(0),mButtonQuitBuild(false),popupMenu(0)
            ?{
            ??????
            ?}

            ?~TutorialApplication()
            ?{
            ??if(mEditorGuiSheet)
            ??{
            ???CEGUI::WindowManager::getSingleton().destroyWindow(mEditorGuiSheet);
            ???
            ??}
            ??if(popupMenu)
            ??{
            ???CEGUI::WindowManager::getSingleton().destroyWindow(popupMenu);
            ??}
            ??if(mGUISystem)
            ??{
            ???delete mGUISystem;
            ???mGUISystem = 0;
            ??}
            ??if(mGUIRenderer)
            ??{
            ???delete mGUIRenderer;
            ???mGUIRenderer = 0;
            ??}
            ?}
            ?void setupEventHandlers(void)
            ?{
            ??CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
            ??wmgr.getWindow((CEGUI::utf8*)"MyButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TutorialApplication::handlePopMenu, this));
            ?}
            ???
            ?bool handlePopMenu(const CEGUI::EventArgs& e)
            ?{
            ??
            ??if(!popupMenu)
            ??{????? CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
            ???
            ???
            ???? CEGUI::ItemEntry* menuItemOne=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemOne");
            ??????? menuItemOne->setText((CEGUI::utf8*)"飛機(jī)");
            ???? CEGUI::ItemEntry* menuItemTwo=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemTwo");
            ???? menuItemTwo->setText((CEGUI::utf8*)"汽車");
            ???? CEGUI::ItemEntry* menuItemThree=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemThree");
            ???? menuItemThree->setText((CEGUI::utf8*)"輪船");
            ???? CEGUI::ItemEntry* menuItemFour=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemFour");
            ???? menuItemFour->setText((CEGUI::utf8*)"自行車");


            ???? CEGUI::ItemEntry* menuItemSubItemOne=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemFive");
            ???? menuItemSubItemOne->setText((CEGUI::utf8*)"紅色");
            ???? CEGUI::ItemEntry* menuItemSubItemTwo=(CEGUI::ItemEntry*)wmgr.createWindow("TaharezLook/MenuItem",(CEGUI::utf8*)"MenuItemSix");
            ???? menuItemSubItemTwo->setText((CEGUI::utf8*)"綠色");
            ???? CEGUI::PopupMenu*?? subPopupMenu=(CEGUI::PopupMenu*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/PopupMenu", (CEGUI::utf8*)"SubPopMenu");
            ??????????
            ??????? subPopupMenu->setAlwaysOnTop(true);
            ???? subPopupMenu->addItem(menuItemSubItemOne);
            ???? subPopupMenu->addItem(menuItemSubItemTwo);
            ????????????? menuItemSubItemOne->setAlwaysOnTop(true);
            ???? menuItemSubItemTwo->setAlwaysOnTop(true);
            ???? menuItemSubItemTwo->subscribeEvent(CEGUI::ItemEntry::EventMouseClick,CEGUI::Event::Subscriber(&TutorialApplication::handleQuit, this));
            ????
            ????
            ???? popupMenu=(CEGUI::PopupMenu*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/PopupMenu", (CEGUI::utf8*)"PopMenu");
            ???? popupMenu->setText("Option");
            ???? popupMenu->setAlwaysOnTop(true);
            ??????? popupMenu->addItem(menuItemOne);
            ???? popupMenu->addItem(menuItemTwo);
            ???? popupMenu->addItem(menuItemThree);
            ???? popupMenu->addItem(menuItemFour);

            ???
            ???? menuItemOne->setAlwaysOnTop(true);
            ???? menuItemTwo->setAlwaysOnTop(true);
            ???? menuItemThree->setAlwaysOnTop(true);
            ???? menuItemFour->setAlwaysOnTop(true);
            ????

            ????????????? menuItemTwo->addChildWindow(subPopupMenu);
            ???? popupMenu->show();

            ???? popupMenu->setPosition(CEGUI::Point(0.65,0.45));
            ???
            ??? //subPopupMenu->show();

            ??? //popupMenu->openPopupMenu();
            ???? //CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
            ???? wmgr.getWindow((CEGUI::utf8*)"Root")->addChildWindow(popupMenu);
            ??????? return true;
            ??}

            ?

            ???? //將editbox中的內(nèi)容送到listbox
            ??CEGUI::Window* myEditBox = CEGUI::WindowManager::getSingleton().getWindow("MyEditbox");
            ??CEGUI::ListboxTextItem *listboxitem =
            ???new CEGUI::ListboxTextItem (myEditBox->getText());
            ??listboxitem->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush");
            ??//listboxitem->setSelected(mList->getItemCount() == 0);
            ??//listboxitem->setSelectionColours(mPreview->getImageColours());
            ??CEGUI::Listbox*myListBox=(CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().getWindow("MyListBox");
            ???myListBox->addItem(listboxitem);

            ??return true;
            ?}

            ?bool handleQuit(const CEGUI::EventArgs& e)
            ?{
            ??if(!mButtonQuitBuild)
            ??{
            ???/*static_cast<GuiFrameListener*>(mFrameListener)->requestShutdown();*/
            ???CEGUI::PushButton* quitButton = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button", (CEGUI::utf8*)"Quit");
            ???CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
            ???wmgr.getWindow((CEGUI::utf8*)"MyFrameWindow")->addChildWindow(quitButton);
            ???//mEditorGuiSheet->addChildWindow(quitButton);
            ???quitButton->setPosition(CEGUI::Point(0.65f, 0.25f));
            ???quitButton->setSize(CEGUI::Size(0.3f, 0.06f));
            ???quitButton->setText((CEGUI::utf8*)"退出");
            ???mButtonQuitBuild=true;
            ???return true;
            ??}
            ??return true;
            ?}

            protected:
            ?void createScene(void)
            ?{
            ??// Set ambient light
            ??mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
            ??// Set up GUI system
            ??mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
            ??mGUISystem = new CEGUI::System(mGUIRenderer);
            ??CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
            ??CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
            ??mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
            ??CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseMoveCursor");
            ??mGUISystem->setDefaultFont((CEGUI::utf8*)"SimHei-12");

            ??
            ??//////////////////////////////////////////////////////////////////////////
            ??mEditorGuiSheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"My2.xml");
            ??mGUISystem->setGUISheet(mEditorGuiSheet);
            ??//CEGUI::PushButton* quitButton = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"MyButton");
            ??//////////////////////////////////////////////////////////////////////////


            ??

            ??CEGUI::Combobox* objectComboBox = (CEGUI::Combobox*)CEGUI::WindowManager::getSingleton().getWindow("MyComboBox");
            ??CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"飛機(jī)", 0);
            ??objectComboBox->addItem(item);
            ??item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"汽車", 1);
            ??objectComboBox->addItem(item);
            ??item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"輪船", 2);
            ??objectComboBox->addItem(item);
            ??item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"StaticText", 3);
            ??objectComboBox->addItem(item);
            ??item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"StaticImage", 4);
            ??objectComboBox->addItem(item);
            ??item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Render to Texture", 5);
            ??objectComboBox->addItem(item);

            ??//////////////////////////////////////////////////////////////////////////
            ??setupEventHandlers();


            ?}
            ?void createFrameListener(void)
            ?{
            ??mFrameListener = new GuiFrameListener(mWindow, mCamera, mGUIRenderer);
            ??mRoot->addFrameListener(mFrameListener);
            ?}
            };

            #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            #define WIN32_LEAN_AND_MEAN
            #include "windows.h"

            INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
            #else
            int main(int argc, char **argv)
            #endif
            {
            ?// Create application object
            ?TutorialApplication app;

            ?try {
            ??app.go();
            ?} catch( Exception& e ) {
            #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
            ??MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
            #else
            ??fprintf(stderr, "An exception has occured: %s\n",
            ???e.getFullDescription().c_str());
            #endif
            ?}

            ?return 0;
            }

            ?

            posted on 2006-10-19 17:16 清源游民 閱讀(3008) 評(píng)論(1)  編輯 收藏 引用

            FeedBack:
            # ugqpndup
            2007-12-25 21:42 | ugqpndup
            [URL=http://vjpicxic.com]fyukkshj[/URL] hmudomnv http://bcjkzpdi.com wyclnfww tvqvanvg <a href="http://tcxwuvyf.com">yiynryyd</a>   回復(fù)  更多評(píng)論
              

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2009年8月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            留言簿(35)

            隨筆分類(78)

            隨筆檔案(74)

            文章檔案(5)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            亚洲人成无码www久久久| 久久亚洲国产成人影院网站| 久久天天躁夜夜躁狠狠躁2022| 久久综合久久伊人| 久久久久亚洲Av无码专| 久久777国产线看观看精品| 久久精品二区| 久久久久AV综合网成人| 久久播电影网| 99久久免费国产精品热| 中文字幕无码久久久| 精品一区二区久久| 99久久国产综合精品女同图片 | 天天做夜夜做久久做狠狠| 久久国产欧美日韩精品| 久久人人爽人人爽人人片AV高清| 91超碰碰碰碰久久久久久综合| 一本色道久久88综合日韩精品 | 久久精品国产久精国产思思| 久久综合久久伊人| 精品久久久久久无码中文字幕| 日韩精品久久无码人妻中文字幕| 久久天天躁狠狠躁夜夜2020老熟妇| 久久精品天天中文字幕人妻| 国内精品伊人久久久久妇| 久久嫩草影院免费看夜色| 99久久国产亚洲高清观看2024| 蜜臀久久99精品久久久久久小说| 亚洲另类欧美综合久久图片区| 久久精品二区| 久久久久国产一级毛片高清板| 99久久综合狠狠综合久久| 91精品日韩人妻无码久久不卡| 久久噜噜电影你懂的| 国产韩国精品一区二区三区久久| 麻豆成人久久精品二区三区免费| 午夜精品久久久久成人| 中文字幕久久亚洲一区| 久久这里的只有是精品23| 久久久久久久波多野结衣高潮| 香蕉99久久国产综合精品宅男自 |