[Orxonox-commit 6763] r11391 - in code/branches/HUD_HS16: data/levels src/modules/pickup

patricwi at orxonox.net patricwi at orxonox.net
Thu Mar 30 16:05:43 CEST 2017


Author: patricwi
Date: 2017-03-30 16:05:43 +0200 (Thu, 30 Mar 2017)
New Revision: 11391

Added:
   code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc
   code/branches/HUD_HS16/src/modules/pickup/DDDialogue.h
Modified:
   code/branches/HUD_HS16/data/levels/events.oxw
   code/branches/HUD_HS16/src/modules/pickup/CMakeLists.txt
Log:
event example added

Modified: code/branches/HUD_HS16/data/levels/events.oxw
===================================================================
--- code/branches/HUD_HS16/data/levels/events.oxw	2017-03-30 14:04:09 UTC (rev 11390)
+++ code/branches/HUD_HS16/data/levels/events.oxw	2017-03-30 14:05:43 UTC (rev 11391)
@@ -73,6 +73,16 @@
       </events>
     </Billboard>
 
+    <!-- HELLO THERE ................................................................ ITS ME -->
+    <DistanceTrigger name="test" position="0,0,0" target="Pawn" distance=25 stayActive="true"/>
+    <Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,0"/>
+    <DDDialogue string="Hello World3" >
+      <events>
+        <execute>
+           <EventListener event="test" />
+        </execute>
+      </events>
+    </DDDialogue>
 
     <!-- orange -->
     <!--

Modified: code/branches/HUD_HS16/src/modules/pickup/CMakeLists.txt
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/CMakeLists.txt	2017-03-30 14:04:09 UTC (rev 11390)
+++ code/branches/HUD_HS16/src/modules/pickup/CMakeLists.txt	2017-03-30 14:05:43 UTC (rev 11391)
@@ -5,6 +5,7 @@
   PickupManager.cc
   PickupRepresentation.cc
   PickupSpawner.cc
+  DDDialogue.cc
 )
 
 ADD_SUBDIRECTORY(items)

Added: code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc	                        (rev 0)
+++ code/branches/HUD_HS16/src/modules/pickup/DDDialogue.cc	2017-03-30 14:05:43 UTC (rev 11391)
@@ -0,0 +1,47 @@
+
+#include "DDDialogue.h"
+#include "core/XMLPort.h"
+
+
+namespace orxonox
+{
+
+    RegisterClass(DDDialogue);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
+    DDDialogue::DDDialogue(Context* context) : BaseObject(context)
+    {
+        RegisterObject(DDDialogue);
+    }
+
+
+    bool DDDialogue::execute(bool bTriggered, BaseObject* trigger)
+    {  
+        if(!bTriggered) return false;
+
+        orxout() << "bTriggered is " << bTriggered;
+        orxout() << " 1 " << mystring << endl;
+        return false;
+    }
+
+    /**
+    @brief
+        Method for creating a Pickup object through XML.
+    */
+    void DDDialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(DDDialogue, XMLPort, xmlelement, mode);
+
+        XMLPortParam(DDDialogue, "string", setString, getString, xmlelement, mode);
+    }
+
+    void DDDialogue::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(DDDialogue, XMLEventPort, xmlelement, mode);
+
+        XMLPortEventSink(DDDialogue, BaseObject, "execute", execute, xmlelement, mode); 
+    }
+}
\ No newline at end of file

Added: code/branches/HUD_HS16/src/modules/pickup/DDDialogue.h
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/DDDialogue.h	                        (rev 0)
+++ code/branches/HUD_HS16/src/modules/pickup/DDDialogue.h	2017-03-30 14:05:43 UTC (rev 11391)
@@ -0,0 +1,32 @@
+#include "core/XMLPort.h"
+#include "core/BaseObject.h"
+#include "core/EventIncludes.h"
+
+
+namespace orxonox
+{
+
+    class DDDialogue: public BaseObject
+    {
+
+        public:
+            DDDialogue(Context* context) ; //!< Constructor.
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual const std::string& getString()
+                { return this->mystring; }
+
+            virtual void setString(std::string s)
+                { this->mystring = s; }
+
+            bool execute(bool bTriggered, BaseObject* trigger);
+
+
+        private:
+
+            std::string mystring;
+    };
+
+}



More information about the Orxonox-commit mailing list