• <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>
            隨筆 - 5, 文章 - 0, 評(píng)論 - 24, 引用 - 0
            數(shù)據(jù)加載中……

            linux使用Ogre+SDL進(jìn)行游戲開發(fā)

            我選擇的是ubuntu8.04 + codeblocks8.02的開發(fā)環(huán)境。
            Ogre用的是1.4.5的版本。
            下面是用SDL進(jìn)行的一個(gè)簡單的代碼.
            #include <Ogre.h>
            #include 
            <iostream>
            #include 
            <SDL/SDL.h>
            #include 
            <SDL/SDL_syswm.h>
            #include 
            <SDL/SDL_events.h>

            using namespace std;
            using namespace Ogre;
            class AppListener : public FrameListener
            {
            public:
                AppListener( RenderWindow 
            *_win ) : win( _win )
                {
                }
            public:
                
            bool frameStarted(const FrameEvent& evt)
                {
                    
            if ( !FrameListener::frameStarted( evt ) )
                        
            return false;

                        SDL_PollEvent( 
            &event );
                    
            return true;
                }
                
            bool frameEnded(const FrameEvent& evt)
                {
                    
            if ( !FrameListener::frameEnded( evt ) )
                        
            return false;

                    SDL_PollEvent( 
            &event );
                    
            if ( event.type == SDL_KEYDOWN )
                    {
                        
            if ( event.key.keysym.sym == SDLK_ESCAPE )
                            
            return false;
                    }
                    
            return true;
                }
            private:
                RenderWindow 
            *win;
                SDL_Event 
            event;
            };
            void parseWindowGeometry( Ogre::ConfigOptionMap& config, unsigned int& width, unsigned int& height, bool& fullscreen );
            int main()
            {
                Root 
            *root = new Root( "plugins.cfg" );
                RenderWindow 
            *win;

                
            if ( !root->showConfigDialog() )
                    
            return 0;
                
            if ( SDL_WasInit( SDL_INIT_VIDEO ) == 0 )
                {
                    unsigned 
            int height = 300, width = 400;
                    
            bool fullscreen;
                    parseWindowGeometry( root
            ->getRenderSystem()->getConfigOptions(), width, height, fullscreen );

                    root
            ->initialise( false );

                    SDL_Init( SDL_INIT_VIDEO );
                    SDL_SetVideoMode( width, height 
            / 200 );
                    SDL_WM_SetCaption( 
            "OgreTest""ogretest" );

                    SDL_SysWMinfo info;
                    SDL_VERSION(
            &info.version);

                    SDL_GetWMInfo(
            &info);

                    std::
            string dsp(&(DisplayString(info.info.x11.display)[1]));
                    std::vector
            <Ogre::String> tokens = Ogre::StringUtil::split(dsp, ".");

                    Ogre::NameValuePairList misc;
                    std::
            string s = Ogre::StringConverter::toString((long)info.info.x11.display);
                    s 
            += ":" + tokens[1+":";
                    s 
            += Ogre::StringConverter::toString((long)info.info.x11.window);
                    misc[
            "parentWindowHandle"= s;
                    win 
            = root->createRenderWindow("ogre", width, height, fullscreen, &misc);

                    
            ///we need to set the window to be active by ourselves, since GLX by default sets it to false, but then activates it upon recieving some X event (which it will never recieve since we'll use SDL).
                    
            ///see OgreGLXWindow.cpp
                    win->setActive(true);
                    win
            ->setAutoUpdated(true);
                }
                
            else
                {
                    win 
            = root->initialise( true );
                }

                root
            ->addFrameListener( new AppListener( win ) );
                root
            ->startRendering();
                
            return 0;
            }

            void parseWindowGeometry( Ogre::ConfigOptionMap& config, unsigned int& width, unsigned int& height, bool& fullscreen )
            {
                Ogre::ConfigOptionMap::iterator opt 
            = config.find( "Video Mode" );
                
            if ( opt != config.end() )
                {
                    Ogre::String val 
            = opt->second.currentValue;
                    Ogre::String::size_type pos 
            = val.find( 'x' );
                    
            if ( pos != Ogre::String::npos )
                    {
                        width 
            = Ogre::StringConverter::parseUnsignedInt( val.substr( 0, pos ) );
                        height 
            = Ogre::StringConverter::parseUnsignedInt( val.substr( pos + 1 ) );
                    }

                    opt 
            = config.find( "Full Screen" );
                    
            if ( opt != config.end() )
                    {
                        fullscreen 
            = ( opt->second.currentValue == "Yes" );
                    }
                }
            }
            原理很簡單。
            圖:


            posted on 2008-10-19 17:11 brilyf 閱讀(2813) 評(píng)論(8)  編輯 收藏 引用

            評(píng)論

            # re: linux使用Ogre+SDL進(jìn)行游戲開發(fā)  回復(fù)  更多評(píng)論   

            因?yàn)樽罱黽indows要黑屏的說法,所以才決定去linux下開發(fā)。
            2008-10-19 17:13 | brilyf

            # re: linux使用Ogre+SDL進(jìn)行游戲開發(fā)  回復(fù)  更多評(píng)論   

            It's prominent for you to remember though, you need to <a href="http://www.essaysprofessors.com">buy term paper</a> or <a href="http://www.essaysprofessors.com">buy research papers</a> just because a school isn't the best at everything doesn't mean it can't be the finest at a lot things. Essays blogs can bring more usefull for your creation you can also buy essay. But first of all, my indebtedness to this article, it has a expert instigation.
            2010-06-15 01:32 | Cynthia34HARRISON

            # re: linux使用Ogre+SDL進(jìn)行游戲開發(fā)  回復(fù)  更多評(píng)論   

            Yeah doubtless very
            important for the primer it was pleasant to read about this good topic! If you need to get a great job firstofall you need resume writing. Study and don't forget - if you have to work and study at the same time, there arehotshots who are ready to aid you with your resume when you under time burden and looking for a great job.
            2010-09-05 06:42 | resume service

            # re: linux使用Ogre+SDL進(jìn)行游戲開發(fā)  回復(fù)  更多評(píng)論   

            I had a dream to make my own company, but I didn't have enough amount of money to do this. Thank heaven my close friend told to utilize the home loans (goodfinance-blog.com). Therefore I used the auto loan and made real my dream.
            2012-06-09 10:44 | credit loans

            # re: linux使用Ogre+SDL進(jìn)行游戲開發(fā)  回復(fù)  更多評(píng)論   

            When I want to make my weekly schedule not so tight, I phone agenicies that deal with paper writing and cooperate with expertpaper writer.
            2012-08-17 22:52 | academic essays buy

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


            久久亚洲国产午夜精品理论片| 久久香综合精品久久伊人| 99久久国语露脸精品国产| 精品无码久久久久久午夜| 久久夜色精品国产噜噜麻豆| 国产成人无码精品久久久免费| 久久久久久久综合日本| 亚洲成色WWW久久网站| 日本免费久久久久久久网站| 久久免费视频1| 久久精品国产亚洲网站| 亚洲国产日韩欧美久久| 久久久九九有精品国产| 久久人人爽人人爽人人片av麻烦| 国产精品久久久久AV福利动漫| 欧美伊人久久大香线蕉综合69| 婷婷伊人久久大香线蕉AV| 久久久精品人妻无码专区不卡| 久久精品一本到99热免费| 欧美色综合久久久久久| 日韩一区二区久久久久久| 久久精品国产亚洲AV忘忧草18| 国产精品一区二区久久精品无码 | 久久精品国产只有精品66| 亚洲AV成人无码久久精品老人| 久久青青国产| 久久久久久av无码免费看大片| 久久精品国产99国产精偷| 日韩乱码人妻无码中文字幕久久| 日韩欧美亚洲综合久久影院Ds | 精品国产91久久久久久久| 亚洲综合日韩久久成人AV| 欧美激情精品久久久久久久| 国产综合免费精品久久久| 国产精品一久久香蕉国产线看观看 | 国产精品美女久久久久久2018| 久久天天躁夜夜躁狠狠躁2022| 伊人久久大香线蕉综合5g| 久久久久无码精品国产app| 女同久久| 伊人久久无码中文字幕|