Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8309 for code/trunk


Ignore:
Timestamp:
Apr 22, 2011, 11:05:47 PM (14 years ago)
Author:
dafrick
Message:

Replacing toggleVisibility with show, since the OrxonoxOverlay (& OrxonoxOverlayGroup) doesn't know when the GUI is closed, and toggling doesn't work anyway, since we have no regular keybindings when the GUI is showing.

Location:
code/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/data/defaultConfig/keybindings.ini

    r8220 r8309  
    2525KeyEscape="keyESC"
    2626KeyF="scale -1 moveUpDown"
    27 KeyF1="OverlayGroup toggleVisibility Debug"
     27KeyF1="OverlayGroup show Debug"
    2828KeyF10=
    2929KeyF11=
     
    3232KeyF14=
    3333KeyF15=
    34 KeyF2="OverlayGroup toggleVisibility Stats"
     34KeyF2="OverlayGroup show Stats"
    3535KeyF3="OrxonoxOverlay toggleVisibility QuestGUI"
    36 KeyF4="OrxonoxOverlay toggleVisibility PickupInventory"
     36KeyF4="OrxonoxOverlay show PickupInventory"
    3737KeyF5="startchat"
    3838KeyF6=
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r7401 r8309  
    6060    SetConsoleCommand("OrxonoxOverlay", "scrollOverlay",    &OrxonoxOverlay::scrollOverlay);
    6161    SetConsoleCommand("OrxonoxOverlay", "toggleVisibility", &OrxonoxOverlay::toggleVisibility);
     62    SetConsoleCommand("OrxonoxOverlay", "show",     &OrxonoxOverlay::showOverlay);
    6263    SetConsoleCommand("OrxonoxOverlay", "rotateOverlay",    &OrxonoxOverlay::rotateOverlay);
    6364
     
    341342        }
    342343    }
     344   
     345    /**
     346    @brief
     347        Shows Overlay by it's name.
     348    @param name
     349        The name of the overlay defined BaseObject::setName() (usually done with the "name"
     350        attribute in the xml file).
     351    */
     352    /*static*/ void OrxonoxOverlay::showOverlay(const std::string& name)
     353    {
     354        std::map<std::string, OrxonoxOverlay*>::const_iterator it = overlays_s.find(name);
     355        if (it != overlays_s.end())
     356        {
     357            OrxonoxOverlay* overlay= it->second;
     358            if(overlay->isVisible())
     359                overlay->changedVisibility();
     360            else
     361                overlay->show();
     362        }
     363    }
    343364
    344365    /**
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r7401 r8309  
    7777            Describes the rotational state of a an overlay.
    7878            Horizontal means 0/180 degrees, Vertical is 90/270 degrees
    79             and Inbetween is everything else.
     79            and in between is everything else.
    8080        */
    8181        enum RotationState
     
    153153        static void scrollOverlay(const std::string& name, const Vector2& scroll);
    154154        static void toggleVisibility(const std::string& name);
     155        static void showOverlay(const std::string& name);
    155156        //! ConsoleCommand: Accesses the overlay by its name and rotates it.
    156157        static void rotateOverlay(const std::string& name, const Degree& angle);
  • code/trunk/src/orxonox/overlays/OverlayGroup.cc

    r7401 r8309  
    4444
    4545    SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility);
     46    SetConsoleCommand("OverlayGroup", "show", &OverlayGroup::show);
    4647    SetConsoleCommand("OverlayGroup", "scaleGroup",       &OverlayGroup::scaleGroup);
    4748    SetConsoleCommand("OverlayGroup", "scrollGroup",      &OverlayGroup::scrollGroup);
     
    174175        }
    175176    }
     177   
     178    /**
     179    @brief
     180        Shows an overlay group by its name.
     181    @param name
     182        The name of the group defined BaseObject::setName() (usually done with the "name" attribute in the xml file).
     183    */
     184    /*static*/ void OverlayGroup::show(const std::string& name)
     185    {
     186        for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
     187        {
     188            if ((*it)->getName() == name)
     189            {
     190                if((*it)->isVisible())
     191                    (*it)->changedVisibility();
     192                else
     193                    (*it)->setVisible(!((*it)->isVisible()));
     194            }
     195        }
     196    }
    176197
    177198    /**
  • code/trunk/src/orxonox/overlays/OverlayGroup.h

    r7401 r8309  
    6161
    6262        static void toggleVisibility(const std::string& name);
     63        static void show(const std::string& name);
    6364        static void scaleGroup(const std::string& name, float scale);
    6465        static void scrollGroup(const std::string& name, const Vector2& scroll);
Note: See TracChangeset for help on using the changeset viewer.