Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2011, 9:47:11 PM (13 years ago)
Author:
landauf
Message:

merged usability branch back to trunk

incomplete summary of the changes in this branch:

  • enhanced keyboard navigation in GUIs
  • implemented new graphics menu and changeable window size at runtime
  • added developer mode
  • HUD shows if game is paused, game pauses if ingame menu is opened
  • removed a few obsolete commands and hid some that are more for internal use
  • numpad works in console and gui
  • faster loading of level info
  • enhanced usage of compositors (Shader class)
  • improved camera handling, configurable FOV and aspect ratio
Location:
code/trunk
Files:
16 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/designtools/ScreenshotManager.cc

    r7284 r8079  
    2525    {
    2626        Ogre::RenderWindow* pRenderWindow = GraphicsManager::getInstance().getRenderWindow();
    27         int gridSize = 3;
    28         std::string fileExtension = ".png";
    29         bool overlayFlag = true;
    3027
    3128        //set file extension for the Screenshot files
    32         mFileExtension   = fileExtension;
     29        this->mFileExtension_  = ".png";
    3330        // the gridsize
    34         mGridSize        = gridSize;
     31        this->mGridSize_ = 3;
    3532        // flag for overlay rendering
    36         mDisableOverlays = overlayFlag;
     33        this->mDisableOverlays_ = true;
    3734        //get current window size
    38         mWindowWidth   = pRenderWindow->getWidth();
    39         mWindowHeight  = pRenderWindow->getHeight();
     35        this->mWindowWidth_   = pRenderWindow->getWidth();
     36        this->mWindowHeight_  = pRenderWindow->getHeight();
    4037        //create temporary texture
    41         mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex",
    42                                                                   Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
    43                                                                     mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET);
     38        this->mTempTex_ = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, this->mWindowWidth_, this->mWindowHeight_, 0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET);
    4439
    4540        //get The current Render Target of the temp Texture
    46         mRT = mTempTex->getBuffer()->getRenderTarget();
     41        this->mRT_ = this->mTempTex_->getBuffer()->getRenderTarget();
    4742
    4843        //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture
    49         mBuffer = mTempTex->getBuffer();
     44        this->mBuffer_ = this->mTempTex_->getBuffer();
    5045
    5146        //create PixelBox
    52             uint8_t* data_ = new uint8_t[(mWindowWidth * mGridSize) * (mWindowHeight * mGridSize) * 3];
    53         mFinalPicturePB = Ogre::PixelBox(mWindowWidth * mGridSize,mWindowHeight * mGridSize,1,Ogre::PF_B8G8R8,data_);
     47        uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
     48        this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
    5449
    5550    }
     
    6358
    6459
    65     /* Creates a screenshot with the given camera.
    66     * @param camera Pointer to the camera "looking at" the scene of interest
    67     * @param fileName the filename of the screenshot file.
     60    /**
     61    @brief
     62        Creates a screenshot with the given camera.
     63    @param camera
     64        Pointer to the camera "looking at" the scene of interest
     65    @param fileName
     66        the filename of the screenshot file.
    6867    */
    6968    void ScreenshotManager::makeScreenshot() const
     
    7372
    7473        //Remove all viewports, so the added Viewport(camera) ist the only
    75         mRT->removeAllViewports();
    76         mRT->addViewport(camera);
     74        mRT_->removeAllViewports();
     75        mRT_->addViewport(camera);
    7776
    7877        //set the viewport settings
    79         Ogre::Viewport *vp = mRT->getViewport(0);
     78        Ogre::Viewport *vp = mRT_->getViewport(0);
    8079        vp->setClearEveryFrame(true);
    8180        vp->setOverlaysEnabled(false);
     
    8584
    8685        // we disable overlay rendering if it is set in config file and the viewport setting is enabled
    87         if(mDisableOverlays && enableOverlayFlag)
     86        if(mDisableOverlays_ && enableOverlayFlag)
    8887            GraphicsManager::getInstance().getViewport()->setOverlaysEnabled(false);
    8988
    90         if(mGridSize <= 1)
     89        if(mGridSize_ <= 1)
    9190        {
    9291            // Simple case where the contents of the screen are taken directly
    9392            // Also used when an invalid value is passed within gridSize (zero or negative grid size)
    94             mRT->update();    //render
     93            mRT_->update();    //render
    9594
    9695            //write the file on the Harddisk
    97             mRT->writeContentsToFile(fileName + "." + mFileExtension);
     96            mRT_->writeContentsToFile(fileName + "." + mFileExtension_);
    9897        }
    9998        else
     
    105104
    106105            // compute the Stepsize for the drid
    107             Ogre::Real frustumGridStepHorizontal  = (originalFrustumRight * 2) / mGridSize;
    108             Ogre::Real frustumGridStepVertical  = (originalFrustumTop * 2) / mGridSize;
     106            Ogre::Real frustumGridStepHorizontal  = (originalFrustumRight * 2) / mGridSize_;
     107            Ogre::Real frustumGridStepVertical  = (originalFrustumTop * 2) / mGridSize_;
    109108
    110109            // process each grid
    111110            Ogre::Real frustumLeft, frustumRight, frustumTop, frustumBottom;
    112             for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++)
     111            for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize_ * mGridSize_; nbScreenshots++)
    113112            {
    114                 int y = nbScreenshots / mGridSize;
    115                 int x = nbScreenshots - y * mGridSize;
     113                int y = nbScreenshots / mGridSize_;
     114                int x = nbScreenshots - y * mGridSize_;
    116115
    117116                // Shoggoth frustum extents setting
     
    127126                // ignore time duration between frames
    128127                Ogre::Root::getSingletonPtr()->clearEventTimes();
    129                 mRT->update();    //render
     128                mRT_->update();    //render
    130129
    131130                //define the current
    132                 Ogre::Box subBox = Ogre::Box(x* mWindowWidth,y * mWindowHeight,x * mWindowWidth + mWindowWidth, y * mWindowHeight + mWindowHeight);
     131                Ogre::Box subBox = Ogre::Box(x* mWindowWidth_,y * mWindowHeight_,x * mWindowWidth_ + mWindowWidth_, y * mWindowHeight_ + mWindowHeight_);
    133132                //copy the content from the temp buffer into the final picture PixelBox
    134133                //Place the tempBuffer content at the right position
    135                 mBuffer->blitToMemory(mFinalPicturePB.getSubVolume(subBox));
     134                mBuffer_->blitToMemory(mFinalPicturePB_.getSubVolume(subBox));
    136135
    137136            }
     
    142141            Ogre::Image finalImage; //declare the final Image Object
    143142            //insert the PixelBox data into the Image Object
    144             finalImage = finalImage.loadDynamicImage(static_cast<unsigned char*>(mFinalPicturePB.data), mFinalPicturePB.getWidth(),mFinalPicturePB.getHeight(),Ogre::PF_B8G8R8);
     143            finalImage = finalImage.loadDynamicImage(static_cast<unsigned char*>(mFinalPicturePB_.data), mFinalPicturePB_.getWidth(), mFinalPicturePB_.getHeight(),Ogre::PF_B8G8R8);
    145144            // Save the Final image to a file
    146             finalImage.save(fileName + "." + mFileExtension);
     145            finalImage.save(fileName + "." + mFileExtension_);
    147146
    148147        }
     
    157156    }
    158157
     158    /**
     159    @brief
     160        Set the size of the grid.
     161    @param size
     162        The size of the grid.
     163    */
     164    void ScreenshotManager::setGridSize(unsigned int size)
     165    {
     166        if(size == this->mGridSize_)
     167            return;
     168
     169        this->mGridSize_ = size;
     170        // New PixelBox for the changed size.
     171        uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
     172        this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
     173    }
     174
     175    /**
     176    @brief
     177        Get a timestamp for the curent time instant.
     178    @return
     179        Returns a string with the timestamp.
     180    */
    159181    std::string ScreenshotManager::getTimestamp()
    160182    {
  • code/trunk/src/modules/designtools/ScreenshotManager.h

    r7163 r8079  
    2020{
    2121
    22 
    23     /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
    24     *  pRenderWindow:    Pointer to the render window.  This could be "mWindow" from the ExampleApplication,
    25     *              the window automatically created obtained when calling
    26     *              Ogre::Root::getSingletonPtr()->initialise(false) and retrieved by calling
    27     *              "Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()", or the manually created
    28     *              window from calling "mRoot->createRenderWindow()".
    29     *  gridSize:      The magnification factor.  A 2 will create a 2x2 grid, doubling the size of the
    30                 screenshot.  A 3 will create a 3x3 grid, tripling the size of the screenshot.
    31     *  fileExtension:    The extension of the screenshot file name, hence the type of graphics file to generate.
    32     *              To generate "MyScreenshot.png" this parameter would contain ".png".
     22    /**
     23    @brief
     24        Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
    3325    */
    3426    class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
     
    3628        friend class Singleton<ScreenshotManager>;
    3729
    38     public:
    39         ScreenshotManager();
    40         ~ScreenshotManager();
     30        public:
     31            ScreenshotManager();
     32            virtual ~ScreenshotManager();
    4133
    42       /* Creates a screenshot with the given camera.
    43         * @param camera Pointer to the camera "looking at" the scene of interest
    44         * @param fileName the filename of the screenshot file.
    45       */
    46         void makeScreenshot() const;
     34            void makeScreenshot() const; //!< Creates a screenshot with the given camera.
    4735
    48         static void makeScreenshot_s()
    49             { getInstance().makeScreenshot(); }
     36            /**
     37            @brief Creates a screenshot with a given size.
     38            @param size Size is factor by which the current screen size is scaled.
     39            */
     40            static void makeScreenshot_s(unsigned int size)
     41                { getInstance().setGridSize(size); getInstance().makeScreenshot(); }
    5042
    51     protected:
    52         static std::string getTimestamp();
     43            void setGridSize(unsigned int size); //!< Set the size of the grid.
    5344
    54         std::string    mFileExtension;
    55         unsigned int   mGridSize, mWindowWidth, mWindowHeight;
    56         bool           mDisableOverlays;
    57         //temp texture with current screensize
    58         Ogre::TexturePtr mTempTex;
    59         Ogre::RenderTexture* mRT;
    60         Ogre::HardwarePixelBufferSharedPtr mBuffer;
    61         //PixelBox for a large Screenshot, if grid size is > 1
    62         Ogre::PixelBox  mFinalPicturePB;
    63         uint8_t* data_;
     45        protected:
     46            static std::string getTimestamp();
    6447
    65         static ScreenshotManager* singletonPtr_s;
     48            std::string mFileExtension_;
     49            unsigned int mGridSize_; //!< The magnification factor.  A 2 will create a 2x2 grid, doubling the size of the screenshot.  A 3 will create a 3x3 grid, tripling the size of the screenshot.
     50            unsigned int mWindowWidth_, mWindowHeight_;
     51            bool mDisableOverlays_;
     52            //! temp texture with current screensize
     53            Ogre::TexturePtr mTempTex_;
     54            Ogre::RenderTexture* mRT_;
     55            Ogre::HardwarePixelBufferSharedPtr mBuffer_;
     56            //! PixelBox for a large Screenshot, if grid size is > 1
     57            Ogre::PixelBox  mFinalPicturePB_;
     58            uint8_t* data_;
     59
     60            static ScreenshotManager* singletonPtr_s;
    6661    };
    6762
  • code/trunk/src/modules/designtools/SkyboxGenerator.cc

    r7284 r8079  
    5959
    6060        this->setConfigValues();
    61         takeScreenshot_ = false;
     61        this->takeScreenshot_ = false;
    6262        this->captionsRemoved_ = false;
    6363    }
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r7552 r8079  
    103103    {
    104104        // Destroys all NotificationQueues that have been registered with the NotificationManager.
    105         for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++)
     105        std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin();
     106        while(it != this->queues_.end())
     107        {
    106108            it->second->destroy(true);
     109            it = this->queues_.begin();
     110        }
    107111
    108112        this->queues_.clear();
     
    298302        }
    299303
     304        COUT(4) << "NotificationListener '" << identifier << "' unregistered with the NotificationManager." << std::endl;
     305
    300306        // Remove the NotificationListener from the list of NotificationListeners.
    301307        this->listenerList_.erase(listener);
    302308        // Remove the Notifications list that was associated with the input NotificationListener.
    303309        this->notificationLists_.erase(identifier);
    304 
    305         COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
    306310    }
    307311
     
    361365    bool NotificationManager::registerQueue(NotificationQueue* queue)
    362366    {
     367        COUT(4) << "NotificationQueue '" << queue->getName() << "' registered with the NotificationManager." << std::endl;
    363368        return this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)).second;
    364369    }
     
    372377    void NotificationManager::unregisterQueue(NotificationQueue* queue)
    373378    {
     379        COUT(4) << "NotificationQueue '" << queue->getName() << "' unregistered with the NotificationManager." << std::endl;
    374380        this->queues_.erase(queue->getName());
    375381    }
  • code/trunk/src/modules/notifications/NotificationQueue.cc

    r7489 r8079  
    137137            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
    138138
     139        COUT(3) << "NotificationQueue '" << this->getName() << "' destroyed." << std::endl;
     140
    139141        this->OrxonoxClass::destroy();
    140142    }
     
    167169            while(it != this->ordering_.upper_bound(&this->timeLimit_))
    168170            {
    169                 std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator temp = it;
    170                 it++;
    171                 this->remove(temp); // Remove the Notifications that have expired.
     171                this->remove(it); // Remove the Notifications that have expired.
     172                it = this->ordering_.begin();
    172173            }
    173174
     
    248249        if(GameMode::showsGraphics())
    249250            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");
     251
     252        COUT(5) << "Notification \"" << notification->getMessage() << "\" pushed to NotificationQueue '" << this->getName() << "'" << endl;
    250253    }
    251254
     
    259262        // Get all the NotificationContainers that were sent the same time the NotificationContainer we want to pop was sent.
    260263        std::pair<std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator, std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator> iterators = this->ordering_.equal_range(container);
     264
    261265        // Iterate through all suspects and remove the container as soon as we find it.
    262266        for(std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = iterators.first; it != iterators.second; it++)
     
    264268            if(container == *it)
    265269            {
     270                COUT(5) << "Notification \"" << (*it)->notification->getMessage() << "\" popped from NotificationQueue '" << this->getName() << "'" << endl;
    266271                this->ordering_.erase(it);
    267272                break;
     
    290295        // Get the index at which the Notification is.
    291296        std::vector<NotificationContainer*>::difference_type index = it - this->notifications_.begin ();
     297
     298        COUT(5) << "Notification \"" << (*it)->notification->getMessage() << "\" removed from NotificationQueue '" << this->getName() << "'" << endl;
     299
    292300        this->ordering_.erase(containerIterator);
    293301        this->notifications_.erase(it);
     
    310318    void NotificationQueue::clear(bool noGraphics)
    311319    {
     320        COUT(4) << "Clearing NotificationQueue " << this->getName() << "." << endl;
    312321        this->ordering_.clear();
    313322        // Delete all NotificationContainers in the list.
     
    372381    /**
    373382    @brief
    374         Produces all targets of the NotificationQueue concatinated as string, with kommas (',') as seperators.
     383        Produces all targets of the NotificationQueue concatinated as string, with commas (',') as seperators.
    375384    @return
    376385        Returns the targets as a string.
  • code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r7601 r8079  
    5454
    5555        this->distance_ = 100.0f;
    56         this->targetName_ = BLANKSTRING;
     56        this->targetName_ = "";
    5757        this->singleTargetMode_ = false;
    5858    }
     
    181181    {
    182182        // If the targetname is no blank string single-target mode is enabled.
    183         if(targetname.compare(BLANKSTRING) != 0)
     183        if(targetname != "")
    184184            this->singleTargetMode_ = true;
    185185        else
  • code/trunk/src/modules/objects/triggers/DistanceTrigger.cc

    r7601 r8079  
    5050    this->distance_ = 100;
    5151    this->targetMask_.exclude(Class(BaseObject));
    52     this->targetName_ = BLANKSTRING;
     52    this->targetName_ = "";
    5353    this->singleTargetMode_ = false;
    5454  }
  • code/trunk/src/modules/objects/triggers/DistanceTrigger.h

    r7601 r8079  
    7070
    7171      inline void setTargetName(const std::string& targetname)
    72         { if(targetname.compare(BLANKSTRING) != 0) this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; }
     72        { if(targetname != "") this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; }
    7373      inline const std::string& getTargetName(void)
    7474        { return this->targetName_; }
  • code/trunk/src/modules/overlays/OverlaysPrereqs.h

    r7655 r8079  
    8989    class KillMessage;
    9090    class LastManStandingInfos;
     91    class PauseNotice;
    9192    class TeamBaseMatchScore;
    9293    class UnderAttackHealthBar;
  • code/trunk/src/modules/overlays/hud/CMakeLists.txt

    r7655 r8079  
    1616  GametypeFadingMessage.cc
    1717  LastManStandingInfos.cc
     18  PauseNotice.cc
    1819)
  • code/trunk/src/modules/pickup/PickupRepresentation.cc

    r7548 r8079  
    156156        {
    157157            COUT(4) << "PickupRepresentation: No spawner representation found." << std::endl;
    158             if(this->spawnerTemplate_ == BLANKSTRING)
     158            if(this->spawnerTemplate_ == "")
    159159            {
    160160                COUT(4) << "PickupRepresentation: Spawner template is empty." << std::endl;
  • code/trunk/src/modules/questsystem/QuestItem.cc

    r7456 r8079  
    8787    void QuestItem::setId(const std::string & id)
    8888    {
    89         if(id.compare(BLANKSTRING) == 0) // Checks whether the id is a valid id.
     89        if(id == "") // Checks whether the id is a valid id.
    9090        {
    9191            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
  • code/trunk/src/modules/questsystem/QuestManager.cc

    r7552 r8079  
    9191    /**
    9292    @brief
    93         Registers a Quest with the QuestManager to make it globally accessable.
     93        Registers a Quest with the QuestManager to make it globally accessible.
    9494        Uses it's id to make sure to be able to be identify and retrieve it later.
    9595    @param quest
     
    129129    /**
    130130    @brief
    131         Registers a QuestHint with the QuestManager to make it globally accessable.
     131        Registers a QuestHint with the QuestManager to make it globally accessible.
    132132        Uses it's id to make sure to be able to be identify and retrieve it later.
    133133    @param hint
     
    178178    Quest* QuestManager::findQuest(const std::string & questId)
    179179    {
    180         if(questId.compare(BLANKSTRING) == 1) // Check vor validity of the given id.
     180        if(questId == "") // Check for validity of the given id.
    181181            ThrowException(Argument, "Invalid questId.");
    182182
     
    207207    QuestHint* QuestManager::findHint(const std::string & hintId)
    208208    {
    209         if(hintId.compare(BLANKSTRING) == 1) // Check vor validity of the given id.
     209        if(hintId == "") // Check for validity of the given id.
    210210            ThrowException(Argument, "Invalid hintId.");
    211211
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.cc

    r7552 r8079  
    8686    bool AddQuestHint::setHintId(const std::string & id)
    8787    {
    88         if(id.compare(BLANKSTRING) == 0)
     88        if(id == "")
    8989        {
    9090            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc

    r7456 r8079  
    8181    bool ChangeQuestStatus::setQuestId(const std::string & id)
    8282    {
    83         if(id.compare(BLANKSTRING) == 0)
     83        if(id == "")
    8484        {
    8585            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.