[Orxonox-commit 3624] r8309 - in code/trunk: data/defaultConfig src/orxonox/overlays
dafrick at orxonox.net
dafrick at orxonox.net
Fri Apr 22 23:05:48 CEST 2011
Author: dafrick
Date: 2011-04-22 23:05:47 +0200 (Fri, 22 Apr 2011)
New Revision: 8309
Modified:
code/trunk/data/defaultConfig/keybindings.ini
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
code/trunk/src/orxonox/overlays/OverlayGroup.cc
code/trunk/src/orxonox/overlays/OverlayGroup.h
Log:
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.
Modified: code/trunk/data/defaultConfig/keybindings.ini
===================================================================
--- code/trunk/data/defaultConfig/keybindings.ini 2011-04-22 20:32:43 UTC (rev 8308)
+++ code/trunk/data/defaultConfig/keybindings.ini 2011-04-22 21:05:47 UTC (rev 8309)
@@ -24,16 +24,16 @@
KeyEquals=
KeyEscape="keyESC"
KeyF="scale -1 moveUpDown"
-KeyF1="OverlayGroup toggleVisibility Debug"
+KeyF1="OverlayGroup show Debug"
KeyF10=
KeyF11=
KeyF12=
KeyF13=
KeyF14=
KeyF15=
-KeyF2="OverlayGroup toggleVisibility Stats"
+KeyF2="OverlayGroup show Stats"
KeyF3="OrxonoxOverlay toggleVisibility QuestGUI"
-KeyF4="OrxonoxOverlay toggleVisibility PickupInventory"
+KeyF4="OrxonoxOverlay show PickupInventory"
KeyF5="startchat"
KeyF6=
KeyF7=
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2011-04-22 20:32:43 UTC (rev 8308)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2011-04-22 21:05:47 UTC (rev 8309)
@@ -59,6 +59,7 @@
SetConsoleCommand("OrxonoxOverlay", "scaleOverlay", &OrxonoxOverlay::scaleOverlay);
SetConsoleCommand("OrxonoxOverlay", "scrollOverlay", &OrxonoxOverlay::scrollOverlay);
SetConsoleCommand("OrxonoxOverlay", "toggleVisibility", &OrxonoxOverlay::toggleVisibility);
+ SetConsoleCommand("OrxonoxOverlay", "show", &OrxonoxOverlay::showOverlay);
SetConsoleCommand("OrxonoxOverlay", "rotateOverlay", &OrxonoxOverlay::rotateOverlay);
OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator)
@@ -340,6 +341,26 @@
}
}
}
+
+ /**
+ @brief
+ Shows Overlay by it's name.
+ @param name
+ The name of the overlay defined BaseObject::setName() (usually done with the "name"
+ attribute in the xml file).
+ */
+ /*static*/ void OrxonoxOverlay::showOverlay(const std::string& name)
+ {
+ std::map<std::string, OrxonoxOverlay*>::const_iterator it = overlays_s.find(name);
+ if (it != overlays_s.end())
+ {
+ OrxonoxOverlay* overlay= it->second;
+ if(overlay->isVisible())
+ overlay->changedVisibility();
+ else
+ overlay->show();
+ }
+ }
/**
@brief
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2011-04-22 20:32:43 UTC (rev 8308)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2011-04-22 21:05:47 UTC (rev 8309)
@@ -76,7 +76,7 @@
@brief
Describes the rotational state of a an overlay.
Horizontal means 0/180 degrees, Vertical is 90/270 degrees
- and Inbetween is everything else.
+ and in between is everything else.
*/
enum RotationState
{
@@ -152,6 +152,7 @@
//! ConsoleCommand: Accesses the overlay by its name and scrolls it.
static void scrollOverlay(const std::string& name, const Vector2& scroll);
static void toggleVisibility(const std::string& name);
+ static void showOverlay(const std::string& name);
//! ConsoleCommand: Accesses the overlay by its name and rotates it.
static void rotateOverlay(const std::string& name, const Degree& angle);
Modified: code/trunk/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.cc 2011-04-22 20:32:43 UTC (rev 8308)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.cc 2011-04-22 21:05:47 UTC (rev 8309)
@@ -43,6 +43,7 @@
CreateFactory(OverlayGroup);
SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility);
+ SetConsoleCommand("OverlayGroup", "show", &OverlayGroup::show);
SetConsoleCommand("OverlayGroup", "scaleGroup", &OverlayGroup::scaleGroup);
SetConsoleCommand("OverlayGroup", "scrollGroup", &OverlayGroup::scrollGroup);
@@ -173,6 +174,26 @@
(*it)->setVisible(!((*it)->isVisible()));
}
}
+
+ /**
+ @brief
+ Shows an overlay group by its name.
+ @param name
+ The name of the group defined BaseObject::setName() (usually done with the "name" attribute in the xml file).
+ */
+ /*static*/ void OverlayGroup::show(const std::string& name)
+ {
+ for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
+ {
+ if ((*it)->getName() == name)
+ {
+ if((*it)->isVisible())
+ (*it)->changedVisibility();
+ else
+ (*it)->setVisible(!((*it)->isVisible()));
+ }
+ }
+ }
/**
@brief
Modified: code/trunk/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.h 2011-04-22 20:32:43 UTC (rev 8308)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.h 2011-04-22 21:05:47 UTC (rev 8309)
@@ -60,6 +60,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
static void toggleVisibility(const std::string& name);
+ static void show(const std::string& name);
static void scaleGroup(const std::string& name, float scale);
static void scrollGroup(const std::string& name, const Vector2& scroll);
More information about the Orxonox-commit
mailing list