Browse Source

Retired GuiTickCtrl

Moved GuiTickCtrl tickable behavior into GuiControl so that every gui control can animate if needed. GuiControls will not process ticks unless they specificly choose to, so this does not tax the system.
Peter Robinson 5 years ago
parent
commit
26546dc4fd

+ 0 - 1
editor/EditorConsole/EditorConsole.cs

@@ -40,7 +40,6 @@ function EditorConsole::create(%this)
 		TabComplete="0";
 		SinkAllKeyEvents="1";
 		UseSiblingScroller="1";
-		Text = "Hello World";
 	};
 	%this.guiPage.add(%this.consoleEntry);
 

+ 0 - 2
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj

@@ -413,7 +413,6 @@
     <ClCompile Include="..\..\source\gui\guiTextEditCtrl.cc" />
     <ClCompile Include="..\..\source\gui\guiTextEditSliderCtrl.cc" />
     <ClCompile Include="..\..\source\gui\guiTextListCtrl.cc" />
-    <ClCompile Include="..\..\source\gui\guiTickCtrl.cc" />
     <ClCompile Include="..\..\source\gui\guiTreeViewCtrl.cc" />
     <ClCompile Include="..\..\source\gui\guiTypes.cc" />
     <ClCompile Include="..\..\source\gui\language\lang.cc" />
@@ -921,7 +920,6 @@
     <ClInclude Include="..\..\source\gui\guiTextEditCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiTextEditSliderCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiTextListCtrl.h" />
-    <ClInclude Include="..\..\source\gui\guiTickCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiTreeViewCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiTypes.h" />
     <ClInclude Include="..\..\source\gui\language\lang.h" />

+ 0 - 6
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj.filters

@@ -843,9 +843,6 @@
     <ClCompile Include="..\..\source\gui\guiTextListCtrl.cc">
       <Filter>gui</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\source\gui\guiTickCtrl.cc">
-      <Filter>gui</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\gui\guiTreeViewCtrl.cc">
       <Filter>gui</Filter>
     </ClCompile>
@@ -2118,9 +2115,6 @@
     <ClInclude Include="..\..\source\gui\guiTextListCtrl.h">
       <Filter>gui</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\source\gui\guiTickCtrl.h">
-      <Filter>gui</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\gui\guiTreeViewCtrl.h">
       <Filter>gui</Filter>
     </ClInclude>

+ 8 - 0
engine/source/2d/gui/guiSpriteCtrl.cc

@@ -152,6 +152,14 @@ void GuiSpriteCtrl::onSleep()
 
 //-----------------------------------------------------------------------------
 
+void GuiSpriteCtrl::processTick(void)
+{
+	// Update using tick period.
+	update(Tickable::smTickSec);
+}
+
+//-----------------------------------------------------------------------------
+
 bool GuiSpriteCtrl::setImage( const char* pImageAssetId, const U32 frame )
 {
     // Sanity!

+ 3 - 0
engine/source/2d/gui/guiSpriteCtrl.h

@@ -67,6 +67,9 @@ public:
 
 protected:
     virtual void onAnimationEnd( void );
+	virtual void processTick();
+	virtual void interpolateTick(F32 delta) {};
+	virtual void advanceTime(F32 timeDelta) {};
 
 protected:
     static bool setImage(void* obj, const char* data) { static_cast<GuiSpriteCtrl*>(obj)->setImage( data ); return false; }

+ 2 - 6
engine/source/gui/containers/guiAutoScrollCtrl.h

@@ -26,14 +26,10 @@
 #include "gui/guiControl.h"
 #endif
 
-#ifndef _GUITICKCTRL_H_
-#include "gui/guiTickCtrl.h"
-#endif
-
-class GuiAutoScrollCtrl : public GuiTickCtrl
+class GuiAutoScrollCtrl : public GuiControl
 {
 private:
-   typedef GuiTickCtrl Parent;
+   typedef GuiControl Parent;
    bool mScrolling;
    F32 mCurrentTime;
    F32 mStartDelay;

+ 1 - 5
engine/source/gui/containers/guiRolloutCtrl.h

@@ -34,11 +34,7 @@
 #include "gui/guiDefaultControlRender.h"
 #endif
 
-#ifndef _GUITICKCTRL_H_
-#include "gui/guiTickCtrl.h"
-#endif
-
-class GuiRolloutCtrl : public GuiTickCtrl
+class GuiRolloutCtrl : public GuiControl
 {
 private:
    typedef GuiControl Parent;

+ 0 - 4
engine/source/gui/editor/guiInspector.h

@@ -42,10 +42,6 @@
 #include "gui/guiDefaultControlRender.h"
 #endif
 
-#ifndef _GUITICKCTRL_H_
-#include "gui/guiTickCtrl.h"
-#endif
-
 #ifndef _GUISCROLLCTRL_H_
 #include "gui/containers/guiScrollCtrl.h"
 #endif

+ 2 - 5
engine/source/gui/editor/guiMenuBar.h

@@ -26,9 +26,6 @@
 #ifndef _GUITEXTLISTCTRL_H_
 #include "gui/guiTextListCtrl.h"
 #endif
-#ifndef _GUITICKCTRL_H_
-#include "gui/guiTickCtrl.h"
-#endif
 
 class GuiMenuBar;
 class GuiMenuTextListCtrl;
@@ -84,9 +81,9 @@ class GuiMenuTextListCtrl : public GuiTextListCtrl
 
 //------------------------------------------------------------------------------
 
-class GuiMenuBar : public GuiTickCtrl // DAW: Was: GuiControl
+class GuiMenuBar : public GuiControl
 {
-   typedef GuiTickCtrl Parent; // DAW: Was: GuiControl Parent;
+   typedef GuiControl Parent;
 public:
 
     struct Menu;

+ 29 - 1
engine/source/gui/guiControl.h

@@ -51,6 +51,11 @@
 #ifndef _LANG_H_
 #include "gui/language/lang.h"
 #endif
+
+#ifndef _TICKABLE_H_
+#include "platform/Tickable.h"
+#endif
+
 class GuiCanvas;
 class GuiEditCtrl;
 
@@ -87,10 +92,28 @@ class GuiEditCtrl;
 ///
 /// @ref GUI has an overview of the GUI system.
 ///
+/// Tickable Information - taken from guiTickCtrl now retired.
+/// This Gui Control is designed to recieve update ticks at a constant interval.
+/// It was created to be the Parent class of a control which used a DynamicTexture
+/// along with a VectorField to create warping effects much like the ones found
+/// in visualization displays for iTunes or Winamp. Those displays are updated
+/// at the framerate frequency. This works fine for those effects, however for
+/// an application of the same type of effects for things like Gui transitions
+/// the framerate-driven update frequency is not desireable because it does not
+/// allow the developer to be able to have any idea of a consistant user-experience.
+///
+/// Enter the Tickable interface. This lets the Gui control, in this case, update
+/// the dynamic texture at a constant rate of once per tick, even though it gets
+/// rendered every frame, thus creating a framerate-independant update frequency
+/// so that the effects are at a consistant speed regardless of the specifics
+/// of the system the user is on. This means that the screen-transitions will
+/// occur in the same time on a machine getting 300fps in the Gui shell as a
+/// machine which gets 150fps in the Gui shell.
+/// @see Tickable
 ///
 /// @ingroup gui_group Gui System
 /// @{
-class GuiControl : public SimGroup
+class GuiControl : public SimGroup, public virtual Tickable
 {
 private:
    typedef SimGroup Parent;
@@ -696,6 +719,11 @@ public:
 
     void inspectPostApply();
     void inspectPreApply();
+
+protected:
+	virtual void interpolateTick(F32 delta) {};
+	virtual void processTick() {};
+	virtual void advanceTime(F32 timeDelta) {};
 };
 /// @}
 

+ 0 - 36
engine/source/gui/guiTickCtrl.cc

@@ -1,36 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#include "guiTickCtrl.h"
-
-IMPLEMENT_CONOBJECT( GuiTickCtrl );
-
-//------------------------------------------------------------------------------
-
-ConsoleMethod( GuiTickCtrl, setProcessTicks, void, 2, 3, "( [tick = true] ) - This will set this object to either be processing ticks or not\n"
-              "@return No return value." )
-{
-   if( argc == 3 )
-      object->setProcessTicks( dAtob( argv[2] ) );
-   else
-      object->setProcessTicks();
-}

+ 0 - 65
engine/source/gui/guiTickCtrl.h

@@ -1,65 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUITICKCTRL_H_
-#define _GUITICKCTRL_H_
-
-#include "guiControl.h"
-#include "platform/Tickable.h"
-
-/// This Gui Control is designed to be subclassed and let people create controls
-/// which want to recieve update ticks at a constant interval. This class was
-/// created to be the Parent class of a control which used a DynamicTexture
-/// along with a VectorField to create warping effects much like the ones found
-/// in visualization displays for iTunes or Winamp. Those displays are updated
-/// at the framerate frequency. This works fine for those effects, however for
-/// an application of the same type of effects for things like Gui transitions
-/// the framerate-driven update frequency is not desireable because it does not
-/// allow the developer to be able to have any idea of a consistant user-experience.
-///
-/// Enter the Tickable interface. This lets the Gui control, in this case, update
-/// the dynamic texture at a constant rate of once per tick, even though it gets
-/// rendered every frame, thus creating a framerate-independant update frequency
-/// so that the effects are at a consistant speed regardless of the specifics
-/// of the system the user is on. This means that the screen-transitions will
-/// occur in the same time on a machine getting 300fps in the Gui shell as a
-/// machine which gets 150fps in the Gui shell.
-/// @see Tickable
-class GuiTickCtrl : public GuiControl, public virtual Tickable
-{
-   typedef GuiControl Parent;
-
-private:
-
-protected:
-
-   // So this can be instantiated and not be a pure virtual class
-   virtual void interpolateTick( F32 delta ) {};
-   virtual void processTick() {};
-   virtual void advanceTime( F32 timeDelta ) {};
-
-public:
-   DECLARE_CONOBJECT( GuiTickCtrl );
-};
-
-
-#endif

+ 0 - 6
engine/source/platform/Tickable.h

@@ -77,12 +77,6 @@
 /// This is used to interpolate between 32ms ticks. The argument passed to
 /// interpolateTick is the time since the last call to processTick.
 ///
-/// This is an extremely powerful interface when used properly. An example of a class
-/// that properly uses this interface is GuiTickCtrl. The documentation for that
-/// class describes why it was created and why it was important that it use
-/// a consistant update frequency for its effects.
-/// @see GuiTickCtrl
-///
 /// @todo Support processBefore/After and move the GameBase processing over to use Tickable
 class Tickable
 {