Browse Source

Clang-Tidy - modernize-use-auto.

Yao Wei Tjong 姚伟忠 8 years ago
parent
commit
ca97fd9b9b
100 changed files with 1294 additions and 1294 deletions
  1. 1 1
      Source/Samples/01_HelloWorld/HelloWorld.cpp
  2. 16 16
      Source/Samples/02_HelloGUI/HelloGUI.cpp
  3. 9 9
      Source/Samples/03_Sprites/Sprites.cpp
  4. 9 9
      Source/Samples/04_StaticScene/StaticScene.cpp
  5. 11 11
      Source/Samples/05_AnimatingScene/AnimatingScene.cpp
  6. 1 1
      Source/Samples/06_SkeletalAnimation/Mover.cpp
  7. 13 13
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp
  8. 14 14
      Source/Samples/07_Billboards/Billboards.cpp
  9. 20 20
      Source/Samples/08_Decals/Decals.cpp
  10. 15 15
      Source/Samples/09_MultipleViewports/MultipleViewports.cpp
  11. 17 17
      Source/Samples/10_RenderToTexture/RenderToTexture.cpp
  12. 19 19
      Source/Samples/11_Physics/Physics.cpp
  13. 20 20
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp
  14. 5 5
      Source/Samples/13_Ragdolls/CreateRagdoll.cpp
  15. 19 19
      Source/Samples/13_Ragdolls/Ragdolls.cpp
  16. 17 17
      Source/Samples/14_SoundEffects/SoundEffects.cpp
  17. 28 28
      Source/Samples/15_Navigation/Navigation.cpp
  18. 15 15
      Source/Samples/16_Chat/Chat.cpp
  19. 33 33
      Source/Samples/17_SceneReplication/SceneReplication.cpp
  20. 2 2
      Source/Samples/18_CharacterDemo/Character.cpp
  21. 25 25
      Source/Samples/18_CharacterDemo/CharacterDemo.cpp
  22. 1 1
      Source/Samples/18_CharacterDemo/Touch.cpp
  23. 8 8
      Source/Samples/19_VehicleDemo/Vehicle.cpp
  24. 17 17
      Source/Samples/19_VehicleDemo/VehicleDemo.cpp
  25. 11 11
      Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp
  26. 11 11
      Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.cpp
  27. 12 12
      Source/Samples/22_LuaIntegration/LuaIntegration.cpp
  28. 19 19
      Source/Samples/23_Water/Water.cpp
  29. 15 15
      Source/Samples/24_Urho2DSprite/Urho2DSprite.cpp
  30. 17 17
      Source/Samples/25_Urho2DParticle/Urho2DParticle.cpp
  31. 1 1
      Source/Samples/26_ConsoleInput/ConsoleInput.cpp
  32. 18 18
      Source/Samples/27_Urho2DPhysics/Urho2DPhysics.cpp
  33. 17 17
      Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.cpp
  34. 5 5
      Source/Samples/29_SoundSynthesis/SoundSynthesis.cpp
  35. 12 12
      Source/Samples/30_LightAnimation/LightAnimation.cpp
  36. 10 10
      Source/Samples/31_MaterialAnimation/MaterialAnimation.cpp
  37. 59 59
      Source/Samples/32_Urho2DConstraints/Urho2DConstraints.cpp
  38. 13 13
      Source/Samples/33_Urho2DSpriterAnimation/Urho2DSpriterAnimation.cpp
  39. 15 15
      Source/Samples/34_DynamicGeometry/DynamicGeometry.cpp
  40. 10 10
      Source/Samples/35_SignedDistanceFieldText/SignedDistanceFieldText.cpp
  41. 18 18
      Source/Samples/36_Urho2DTileMap/Urho2DTileMap.cpp
  42. 17 17
      Source/Samples/37_UIDrag/UIDrag.cpp
  43. 9 9
      Source/Samples/38_SceneAndUILoad/SceneAndUILoad.cpp
  44. 42 42
      Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp
  45. 21 21
      Source/Samples/40_Localization/L10n.cpp
  46. 2 2
      Source/Samples/41_DatabaseDemo/DatabaseDemo.cpp
  47. 16 16
      Source/Samples/42_PBRMaterials/PBRMaterials.cpp
  48. 2 2
      Source/Samples/43_HttpRequestDemo/HttpRequestDemo.cpp
  49. 16 16
      Source/Samples/44_RibbonTrailDemo/RibbonTrailDemo.cpp
  50. 11 11
      Source/Samples/45_InverseKinematics/InverseKinematics.cpp
  51. 18 18
      Source/Samples/46_RaycastVehicle/RaycastVehicleDemo.cpp
  52. 14 14
      Source/Samples/46_RaycastVehicle/Vehicle.cpp
  53. 13 13
      Source/Samples/47_Typography/Typography.cpp
  54. 25 25
      Source/Samples/48_Hello3DUI/Hello3DUI.cpp
  55. 23 23
      Source/Samples/49_Urho2DIsometricDemo/Character2D.cpp
  56. 24 24
      Source/Samples/49_Urho2DIsometricDemo/Urho2DIsometricDemo.cpp
  57. 11 11
      Source/Samples/50_Urho2DPlatformer/Character2D.cpp
  58. 23 23
      Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.cpp
  59. 1 1
      Source/Samples/Utilities2D/Mover.cpp
  60. 59 59
      Source/Samples/Utilities2D/Sample2D.cpp
  61. 20 20
      Source/Tools/AssetImporter/AssetImporter.cpp
  62. 1 1
      Source/Tools/PackageTool/PackageTool.cpp
  63. 2 2
      Source/Tools/ScriptCompiler/ScriptCompiler.cpp
  64. 2 2
      Source/Tools/SpritePacker/SpritePacker.cpp
  65. 3 3
      Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp
  66. 2 2
      Source/Urho3D/AngelScript/APITemplates.h
  67. 26 26
      Source/Urho3D/AngelScript/Addons.cpp
  68. 1 1
      Source/Urho3D/AngelScript/CoreAPI.cpp
  69. 3 3
      Source/Urho3D/AngelScript/Script.cpp
  70. 5 5
      Source/Urho3D/AngelScript/ScriptAPI.cpp
  71. 40 40
      Source/Urho3D/AngelScript/ScriptAPIDump.cpp
  72. 11 11
      Source/Urho3D/AngelScript/ScriptFile.cpp
  73. 5 5
      Source/Urho3D/AngelScript/ScriptInstance.cpp
  74. 2 2
      Source/Urho3D/Audio/Audio.cpp
  75. 6 6
      Source/Urho3D/Audio/OggVorbisSoundStream.cpp
  76. 1 1
      Source/Urho3D/Audio/Sound.cpp
  77. 63 63
      Source/Urho3D/Audio/SoundSource.cpp
  78. 7 7
      Source/Urho3D/Container/Allocator.cpp
  79. 2 2
      Source/Urho3D/Container/Allocator.h
  80. 2 2
      Source/Urho3D/Container/HashBase.cpp
  81. 8 8
      Source/Urho3D/Container/HashMap.h
  82. 8 8
      Source/Urho3D/Container/HashSet.h
  83. 5 5
      Source/Urho3D/Container/List.h
  84. 16 16
      Source/Urho3D/Container/Str.cpp
  85. 17 17
      Source/Urho3D/Container/Vector.h
  86. 4 4
      Source/Urho3D/Core/Condition.cpp
  87. 2 2
      Source/Urho3D/Core/Context.cpp
  88. 2 2
      Source/Urho3D/Core/EventProfiler.h
  89. 2 2
      Source/Urho3D/Core/Mutex.cpp
  90. 1 1
      Source/Urho3D/Core/Object.h
  91. 1 1
      Source/Urho3D/Core/Profiler.h
  92. 1 1
      Source/Urho3D/Core/Spline.cpp
  93. 22 22
      Source/Urho3D/Core/StringUtils.cpp
  94. 3 3
      Source/Urho3D/Core/Thread.cpp
  95. 2 2
      Source/Urho3D/Core/Timer.cpp
  96. 1 1
      Source/Urho3D/Database/SQLite/SQLiteConnection.cpp
  97. 6 6
      Source/Urho3D/Engine/Console.cpp
  98. 7 7
      Source/Urho3D/Engine/DebugHud.cpp
  99. 20 20
      Source/Urho3D/Engine/Engine.cpp
  100. 17 17
      Source/Urho3D/Graphics/AnimatedModel.cpp

+ 1 - 1
Source/Samples/01_HelloWorld/HelloWorld.cpp

@@ -58,7 +58,7 @@ void HelloWorld::Start()
 
 void HelloWorld::CreateText()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Construct new Text object
     SharedPtr<Text> helloText(new Text(context_));

+ 16 - 16
Source/Samples/02_HelloGUI/HelloGUI.cpp

@@ -57,8 +57,8 @@ void HelloGUI::Start()
     GetSubsystem<Input>()->SetMouseVisible(true);
 
     // Load XML file containing default UI style sheet
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
 
     // Set the loaded style as default style
     uiRoot_->SetDefaultStyle(style);
@@ -79,16 +79,16 @@ void HelloGUI::Start()
 void HelloGUI::InitControls()
 {
     // Create a CheckBox
-    CheckBox* checkBox = new CheckBox(context_);
+    auto* checkBox = new CheckBox(context_);
     checkBox->SetName("CheckBox");
 
     // Create a Button
-    Button* button = new Button(context_);
+    auto* button = new Button(context_);
     button->SetName("Button");
     button->SetMinHeight(24);
 
     // Create a LineEdit
-    LineEdit* lineEdit = new LineEdit(context_);
+    auto* lineEdit = new LineEdit(context_);
     lineEdit->SetName("LineEdit");
     lineEdit->SetMinHeight(24);
 
@@ -116,18 +116,18 @@ void HelloGUI::InitWindow()
     window_->SetName("Window");
 
     // Create Window 'titlebar' container
-    UIElement* titleBar = new UIElement(context_);
+    auto* titleBar = new UIElement(context_);
     titleBar->SetMinSize(0, 24);
     titleBar->SetVerticalAlignment(VA_TOP);
     titleBar->SetLayoutMode(LM_HORIZONTAL);
 
     // Create the Window title Text
-    Text* windowTitle = new Text(context_);
+    auto* windowTitle = new Text(context_);
     windowTitle->SetName("WindowTitle");
     windowTitle->SetText("Hello GUI!");
 
     // Create the Window's close button
-    Button* buttonClose = new Button(context_);
+    auto* buttonClose = new Button(context_);
     buttonClose->SetName("CloseButton");
 
     // Add the controls to the title bar
@@ -151,11 +151,11 @@ void HelloGUI::InitWindow()
 
 void HelloGUI::CreateDraggableFish()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* graphics = GetSubsystem<Graphics>();
 
     // Create a draggable Fish button
-    Button* draggableFish = new Button(context_);
+    auto* draggableFish = new Button(context_);
     draggableFish->SetTexture(cache->GetResource<Texture2D>("Textures/UrhoDecal.dds")); // Set texture
     draggableFish->SetBlendMode(BLEND_ADD);
     draggableFish->SetSize(128, 128);
@@ -164,13 +164,13 @@ void HelloGUI::CreateDraggableFish()
     uiRoot_->AddChild(draggableFish);
 
     // Add a tooltip to Fish button
-    ToolTip* toolTip = new ToolTip(context_);
+    auto* toolTip = new ToolTip(context_);
     draggableFish->AddChild(toolTip);
     toolTip->SetPosition(IntVector2(draggableFish->GetWidth() + 5, draggableFish->GetWidth() / 2)); // slightly offset from close button
-    BorderImage* textHolder = new BorderImage(context_);
+    auto* textHolder = new BorderImage(context_);
     toolTip->AddChild(textHolder);
     textHolder->SetStyle("ToolTipBorderImage");
-    Text* toolTipText = new Text(context_);
+    auto* toolTipText = new Text(context_);
     textHolder->AddChild(toolTipText);
     toolTipText->SetStyle("ToolTipText");
     toolTipText->SetText("Please drag me!");
@@ -208,10 +208,10 @@ void HelloGUI::HandleClosePressed(StringHash eventType, VariantMap& eventData)
 void HelloGUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
 {
     // Get the Text control acting as the Window's title
-    Text* windowTitle = window_->GetChildStaticCast<Text>("WindowTitle", true);
+    auto* windowTitle = window_->GetChildStaticCast<Text>("WindowTitle", true);
 
     // Get control that was clicked
-    UIElement* clicked = static_cast<UIElement*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
+    auto* clicked = static_cast<UIElement*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
 
     String name = "...?";
     if (clicked)

+ 9 - 9
Source/Samples/03_Sprites/Sprites.cpp

@@ -61,16 +61,16 @@ void Sprites::Start()
 
 void Sprites::CreateSprites()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* ui = GetSubsystem<UI>();
 
     // Get rendering window size as floats
-    float width = (float)graphics->GetWidth();
-    float height = (float)graphics->GetHeight();
+    auto width = (float)graphics->GetWidth();
+    auto height = (float)graphics->GetHeight();
 
     // Get the Urho3D fish texture
-    Texture2D* decalTex = cache->GetResource<Texture2D>("Textures/UrhoDecal.dds");
+    auto* decalTex = cache->GetResource<Texture2D>("Textures/UrhoDecal.dds");
 
     for (unsigned i = 0; i < NUM_SPRITES; ++i)
     {
@@ -106,9 +106,9 @@ void Sprites::CreateSprites()
 
 void Sprites::MoveSprites(float timeStep)
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
-    float width = (float)graphics->GetWidth();
-    float height = (float)graphics->GetHeight();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto width = (float)graphics->GetWidth();
+    auto height = (float)graphics->GetHeight();
 
     // Go through all sprites
     for (unsigned i = 0; i < sprites_.Size(); ++i)

+ 9 - 9
Source/Samples/04_StaticScene/StaticScene.cpp

@@ -70,7 +70,7 @@ void StaticScene::Start()
 
 void StaticScene::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -85,7 +85,7 @@ void StaticScene::CreateScene()
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
@@ -94,7 +94,7 @@ void StaticScene::CreateScene()
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
@@ -110,7 +110,7 @@ void StaticScene::CreateScene()
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     }
@@ -126,11 +126,11 @@ void StaticScene::CreateScene()
 
 void StaticScene::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -142,7 +142,7 @@ void StaticScene::CreateInstructions()
 
 void StaticScene::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -157,7 +157,7 @@ void StaticScene::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 11 - 11
Source/Samples/05_AnimatingScene/AnimatingScene.cpp

@@ -74,7 +74,7 @@ void AnimatingScene::Start()
 
 void AnimatingScene::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -86,7 +86,7 @@ void AnimatingScene::CreateScene()
     // it also defines its volume with a bounding box, but can be rotated (so it does not need to be aligned to the world X, Y
     // and Z axes.) Drawable objects "pick up" the zone they belong to and use it when rendering; several zones can exist
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
@@ -102,7 +102,7 @@ void AnimatingScene::CreateScene()
         boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
@@ -111,29 +111,29 @@ void AnimatingScene::CreateScene()
         // to the various update events, and forward them to virtual functions that can be implemented by subclasses. This way
         // writing logic/update components in C++ becomes similar to scripting.
         // Now we simply set same rotation speed for all objects
-        Rotator* rotator = boxNode->CreateComponent<Rotator>();
+        auto* rotator = boxNode->CreateComponent<Rotator>();
         rotator->SetRotationSpeed(Vector3(10.0f, 20.0f, 30.0f));
     }
 
     // Create the camera. Let the starting position be at the world origin. As the fog limits maximum visible distance, we can
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
 
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
 }
 
 void AnimatingScene::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -145,7 +145,7 @@ void AnimatingScene::CreateInstructions()
 
 void AnimatingScene::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -164,7 +164,7 @@ void AnimatingScene::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 1 - 1
Source/Samples/06_SkeletalAnimation/Mover.cpp

@@ -55,7 +55,7 @@ void Mover::Update(float timeStep)
 
     // Get the model's first (only) animation state and advance its time. Note the convenience accessor to other components
     // in the same scene node
-    AnimatedModel* model = node_->GetComponent<AnimatedModel>(true);
+    auto* model = node_->GetComponent<AnimatedModel>(true);
     if (model->GetNumAnimationStates())
     {
         AnimationState* state = model->GetAnimationStates()[0];

+ 13 - 13
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp

@@ -78,7 +78,7 @@ void SkeletalAnimation::Start()
 
 void SkeletalAnimation::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -90,13 +90,13 @@ void SkeletalAnimation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(50.0f, 1.0f, 50.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
@@ -106,7 +106,7 @@ void SkeletalAnimation::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetColor(Color(0.5f, 0.5f, 0.5f));
@@ -126,7 +126,7 @@ void SkeletalAnimation::CreateScene()
         modelNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 0.0f, Random(40.0f) - 20.0f));
         modelNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
 
-        AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>();
+        auto* modelObject = modelNode->CreateComponent<AnimatedModel>();
         modelObject->SetModel(cache->GetResource<Model>("Models/Kachujin/Kachujin.mdl"));
         modelObject->SetMaterial(cache->GetResource<Material>("Models/Kachujin/Materials/Kachujin.xml"));
         modelObject->SetCastShadows(true);
@@ -134,7 +134,7 @@ void SkeletalAnimation::CreateScene()
         // Create an AnimationState for a walk animation. Its time position will need to be manually updated to advance the
         // animation, The alternative would be to use an AnimationController component which updates the animation automatically,
         // but we need to update the model's position manually in any case
-        Animation* walkAnimation = cache->GetResource<Animation>("Models/Kachujin/Kachujin_Walk.ani");
+        auto* walkAnimation = cache->GetResource<Animation>("Models/Kachujin/Kachujin_Walk.ani");
 
         AnimationState* state = modelObject->AddAnimationState(walkAnimation);
         // The state would fail to create (return null) if the animation was not found
@@ -147,13 +147,13 @@ void SkeletalAnimation::CreateScene()
         }
 
         // Create our custom Mover component that will move & animate the model during each frame's update
-        Mover* mover = modelNode->CreateComponent<Mover>();
+        auto* mover = modelNode->CreateComponent<Mover>();
         mover->SetParameters(MODEL_MOVE_SPEED, MODEL_ROTATE_SPEED, bounds);
     }
 
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane
@@ -162,11 +162,11 @@ void SkeletalAnimation::CreateScene()
 
 void SkeletalAnimation::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle debug geometry"
@@ -183,7 +183,7 @@ void SkeletalAnimation::CreateInstructions()
 
 void SkeletalAnimation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -207,7 +207,7 @@ void SkeletalAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 14 - 14
Source/Samples/07_Billboards/Billboards.cpp

@@ -75,7 +75,7 @@ void Billboards::Start()
 
 void Billboards::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -86,7 +86,7 @@ void Billboards::CreateScene()
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetFogStart(100.0f);
@@ -95,7 +95,7 @@ void Billboards::CreateScene()
     // Create a directional light without shadows
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetSpecularIntensity(1.0f);
@@ -108,7 +108,7 @@ void Billboards::CreateScene()
             Node* floorNode = scene_->CreateChild("FloorTile");
             floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
             floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
-            StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+            auto* floorObject = floorNode->CreateComponent<StaticModel>();
             floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         }
@@ -130,7 +130,7 @@ void Billboards::CreateScene()
             mushroomNode->SetPosition(Vector3(Random(25.0f) - 12.5f, 0.0f, Random(25.0f) - 12.5f));
             mushroomNode->SetRotation(Quaternion(0.0f, Random() * 360.0f, 0.0f));
             mushroomNode->SetScale(1.0f + Random() * 4.0f);
-            StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+            auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
             mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetCastShadows(true);
@@ -146,7 +146,7 @@ void Billboards::CreateScene()
         Node* smokeNode = scene_->CreateChild("Smoke");
         smokeNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(20.0f) + 10.0f, Random(200.0f) - 100.0f));
 
-        BillboardSet* billboardObject = smokeNode->CreateComponent<BillboardSet>();
+        auto* billboardObject = smokeNode->CreateComponent<BillboardSet>();
         billboardObject->SetNumBillboards(NUM_BILLBOARDS);
         billboardObject->SetMaterial(cache->GetResource<Material>("Materials/LitSmoke.xml"));
         billboardObject->SetSorted(true);
@@ -170,7 +170,7 @@ void Billboards::CreateScene()
     for (unsigned i = 0; i < NUM_LIGHTS; ++i)
     {
         Node* lightNode = scene_->CreateChild("SpotLight");
-        Light* light = lightNode->CreateComponent<Light>();
+        auto* light = lightNode->CreateComponent<Light>();
 
         float angle = 0.0f;
 
@@ -202,7 +202,7 @@ void Billboards::CreateScene()
 
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane
@@ -211,11 +211,11 @@ void Billboards::CreateScene()
 
 void Billboards::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle debug geometry"
@@ -232,7 +232,7 @@ void Billboards::CreateInstructions()
 
 void Billboards::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -255,7 +255,7 @@ void Billboards::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -304,7 +304,7 @@ void Billboards::AnimateScene(float timeStep)
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (unsigned i = 0; i < billboardNodes.Size(); ++i)
     {
-        BillboardSet* billboardObject = billboardNodes[i]->GetComponent<BillboardSet>();
+        auto* billboardObject = billboardNodes[i]->GetComponent<BillboardSet>();
 
         for (unsigned j = 0; j < billboardObject->GetNumBillboards(); ++j)
         {

+ 20 - 20
Source/Samples/08_Decals/Decals.cpp

@@ -75,7 +75,7 @@ void Decals::Start()
 
 void Decals::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -87,13 +87,13 @@ void Decals::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -103,7 +103,7 @@ void Decals::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -118,7 +118,7 @@ void Decals::CreateScene()
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetCastShadows(true);
@@ -133,7 +133,7 @@ void Decals::CreateScene()
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
@@ -143,7 +143,7 @@ void Decals::CreateScene()
 
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane
@@ -152,21 +152,21 @@ void Decals::CreateScene()
 
 void Decals::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
     // control the camera, and when visible, it will point the raycast target
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys to move\n"
         "LMB to paint decals, RMB to rotate view\n"
@@ -185,7 +185,7 @@ void Decals::CreateUI()
 
 void Decals::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -205,8 +205,8 @@ void Decals::SubscribeToEvents()
 void Decals::MoveCamera(float timeStep)
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Do not move if the UI has a focused element (the console)
@@ -259,10 +259,10 @@ void Decals::PaintDecal()
     {
         // Check if target scene node already has a DecalSet component. If not, create now
         Node* targetNode = hitDrawable->GetNode();
-        DecalSet* decal = targetNode->GetComponent<DecalSet>();
+        auto* decal = targetNode->GetComponent<DecalSet>();
         if (!decal)
         {
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
+            auto* cache = GetSubsystem<ResourceCache>();
 
             decal = targetNode->CreateComponent<DecalSet>();
             decal->SetMaterial(cache->GetResource<Material>("Materials/UrhoDecal.xml"));
@@ -280,14 +280,14 @@ bool Decals::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
 {
     hitDrawable = nullptr;
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
 
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* camera = cameraNode_->GetComponent<Camera>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* camera = cameraNode_->GetComponent<Camera>();
     Ray cameraRay = camera->GetScreenRay((float)pos.x_ / graphics->GetWidth(), (float)pos.y_ / graphics->GetHeight());
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;

+ 15 - 15
Source/Samples/09_MultipleViewports/MultipleViewports.cpp

@@ -75,7 +75,7 @@ void MultipleViewports::Start()
 
 void MultipleViewports::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -87,13 +87,13 @@ void MultipleViewports::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -103,7 +103,7 @@ void MultipleViewports::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -118,7 +118,7 @@ void MultipleViewports::CreateScene()
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetCastShadows(true);
@@ -132,7 +132,7 @@ void MultipleViewports::CreateScene()
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
@@ -142,14 +142,14 @@ void MultipleViewports::CreateScene()
 
     // Create the cameras. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Parent the rear camera node to the front camera node and turn it 180 degrees to face backward
     // Here, we use the angle-axis constructor for Quaternion instead of the usual Euler angles
     rearCameraNode_ = cameraNode_->CreateChild("RearCamera");
     rearCameraNode_->Rotate(Quaternion(180.0f, Vector3::UP));
-    Camera* rearCamera = rearCameraNode_->CreateComponent<Camera>();
+    auto* rearCamera = rearCameraNode_->CreateComponent<Camera>();
     rearCamera->SetFarClip(300.0f);
     // Because the rear viewport is rather small, disable occlusion culling from it. Use the camera's
     // "view override flags" for this. We could also disable eg. shadows or force low material quality
@@ -162,11 +162,11 @@ void MultipleViewports::CreateScene()
 
 void MultipleViewports::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "B to toggle bloom, F to toggle FXAA\n"
@@ -184,8 +184,8 @@ void MultipleViewports::CreateInstructions()
 
 void MultipleViewports::SetupViewports()
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     renderer->SetNumViewports(2);
 
@@ -197,7 +197,7 @@ void MultipleViewports::SetupViewports()
     // bloom and FXAA post process effects to the front viewport. Render path commands can be tagged
     // for example with the effect name to allow easy toggling on and off. We start with the effects
     // disabled.
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SharedPtr<RenderPath> effectRenderPath = viewport->GetRenderPath()->Clone();
     effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/Bloom.xml"));
     effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/FXAA2.xml"));
@@ -230,7 +230,7 @@ void MultipleViewports::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 17 - 17
Source/Samples/10_RenderToTexture/RenderToTexture.cpp

@@ -77,7 +77,7 @@ void RenderToTexture::Start()
 
 void RenderToTexture::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     {
         // Create the scene which will be rendered to a texture
@@ -88,7 +88,7 @@ void RenderToTexture::CreateScene()
 
         // Create a Zone for ambient light & fog control
         Node* zoneNode = rttScene_->CreateChild("Zone");
-        Zone* zone = zoneNode->CreateComponent<Zone>();
+        auto* zone = zoneNode->CreateComponent<Zone>();
         // Set same volume as the Octree, set a close bluish fog and some ambient light
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
@@ -104,23 +104,23 @@ void RenderToTexture::CreateScene()
             boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
             // Orient using random pitch, yaw and roll Euler angles
             boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+            auto* boxObject = boxNode->CreateComponent<StaticModel>();
             boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
             // Add our custom Rotator component which will rotate the scene node each frame, when the scene sends its update event.
             // Simply set same rotation speed for all objects
-            Rotator* rotator = boxNode->CreateComponent<Rotator>();
+            auto* rotator = boxNode->CreateComponent<Rotator>();
             rotator->SetRotationSpeed(Vector3(10.0f, 20.0f, 30.0f));
         }
 
         // Create a camera for the render-to-texture scene. Simply leave it at the world origin and let it observe the scene
         rttCameraNode_ = rttScene_->CreateChild("Camera");
-        Camera* camera = rttCameraNode_->CreateComponent<Camera>();
+        auto* camera = rttCameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(100.0f);
 
         // Create a point light to the camera scene node
-        Light* light = rttCameraNode_->CreateComponent<Light>();
+        auto* light = rttCameraNode_->CreateComponent<Light>();
         light->SetLightType(LIGHT_POINT);
         light->SetRange(30.0f);
     }
@@ -134,7 +134,7 @@ void RenderToTexture::CreateScene()
 
         // Create a Zone component for ambient lighting & fog control
         Node* zoneNode = scene_->CreateChild("Zone");
-        Zone* zone = zoneNode->CreateComponent<Zone>();
+        auto* zone = zoneNode->CreateComponent<Zone>();
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
         zone->SetFogStart(100.0f);
@@ -143,7 +143,7 @@ void RenderToTexture::CreateScene()
         // Create a directional light without shadows
         Node* lightNode = scene_->CreateChild("DirectionalLight");
         lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-        Light* light = lightNode->CreateComponent<Light>();
+        auto* light = lightNode->CreateComponent<Light>();
         light->SetLightType(LIGHT_DIRECTIONAL);
         light->SetColor(Color(0.2f, 0.2f, 0.2f));
         light->SetSpecularIntensity(1.0f);
@@ -156,7 +156,7 @@ void RenderToTexture::CreateScene()
                 Node* floorNode = scene_->CreateChild("FloorTile");
                 floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
                 floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
-                StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+                auto* floorObject = floorNode->CreateComponent<StaticModel>();
                 floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             }
@@ -168,7 +168,7 @@ void RenderToTexture::CreateScene()
             Node* boxNode = scene_->CreateChild("ScreenBox");
             boxNode->SetPosition(Vector3(0.0f, 10.0f, 0.0f));
             boxNode->SetScale(Vector3(21.0f, 16.0f, 0.5f));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+            auto* boxObject = boxNode->CreateComponent<StaticModel>();
             boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
@@ -176,7 +176,7 @@ void RenderToTexture::CreateScene()
             screenNode->SetPosition(Vector3(0.0f, 10.0f, -0.27f));
             screenNode->SetRotation(Quaternion(-90.0f, 0.0f, 0.0f));
             screenNode->SetScale(Vector3(20.0f, 0.0f, 15.0f));
-            StaticModel* screenObject = screenNode->CreateComponent<StaticModel>();
+            auto* screenObject = screenNode->CreateComponent<StaticModel>();
             screenObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
 
             // Create a renderable texture (1024x768, RGB format), enable bilinear filtering on it
@@ -205,7 +205,7 @@ void RenderToTexture::CreateScene()
 
         // Create the camera which we will move around. Limit far clip distance to match the fog
         cameraNode_ = scene_->CreateChild("Camera");
-        Camera* camera = cameraNode_->CreateComponent<Camera>();
+        auto* camera = cameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(300.0f);
 
         // Set an initial position for the camera scene node above the plane
@@ -215,11 +215,11 @@ void RenderToTexture::CreateScene()
 
 void RenderToTexture::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -231,7 +231,7 @@ void RenderToTexture::CreateInstructions()
 
 void RenderToTexture::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -244,7 +244,7 @@ void RenderToTexture::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 19 - 19
Source/Samples/11_Physics/Physics.cpp

@@ -79,7 +79,7 @@ void Physics::Start()
 
 void Physics::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -93,7 +93,7 @@ void Physics::CreateScene()
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(1.0f, 1.0f, 1.0f));
@@ -103,7 +103,7 @@ void Physics::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -115,7 +115,7 @@ void Physics::CreateScene()
     // generate the necessary 3D texture coordinates for cube mapping
     Node* skyNode = scene_->CreateChild("Sky");
     skyNode->SetScale(500.0f); // The scale actually does not matter
-    Skybox* skybox = skyNode->CreateComponent<Skybox>();
+    auto* skybox = skyNode->CreateComponent<Skybox>();
     skybox->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     skybox->SetMaterial(cache->GetResource<Material>("Materials/Skybox.xml"));
 
@@ -124,7 +124,7 @@ void Physics::CreateScene()
         Node* floorNode = scene_->CreateChild("Floor");
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetScale(Vector3(1000.0f, 1.0f, 1000.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+        auto* floorObject = floorNode->CreateComponent<StaticModel>();
         floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
@@ -132,7 +132,7 @@ void Physics::CreateScene()
         // parameters make the object static (zero mass.) Note that a CollisionShape by itself will not participate
         // in the physics simulation
         /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+        auto* shape = floorNode->CreateComponent<CollisionShape>();
         // Set a box shape of size 1 x 1 x 1 for collision. The shape will be scaled with the scene node scale, so the
         // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.)
         shape->SetBox(Vector3::ONE);
@@ -146,7 +146,7 @@ void Physics::CreateScene()
             {
                 Node* boxNode = scene_->CreateChild("Box");
                 boxNode->SetPosition(Vector3((float)x, -(float)y + 8.0f, 0.0f));
-                StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+                auto* boxObject = boxNode->CreateComponent<StaticModel>();
                 boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
                 boxObject->SetCastShadows(true);
@@ -154,10 +154,10 @@ void Physics::CreateScene()
                 // Create RigidBody and CollisionShape components like above. Give the RigidBody mass to make it movable
                 // and also adjust friction. The actual mass is not important; only the mass ratios between colliding
                 // objects are significant
-                RigidBody* body = boxNode->CreateComponent<RigidBody>();
+                auto* body = boxNode->CreateComponent<RigidBody>();
                 body->SetMass(1.0f);
                 body->SetFriction(0.75f);
-                CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+                auto* shape = boxNode->CreateComponent<CollisionShape>();
                 shape->SetBox(Vector3::ONE);
             }
         }
@@ -166,7 +166,7 @@ void Physics::CreateScene()
     // Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside the scene, because
     // we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(500.0f);
 
     // Set an initial position for the camera scene node above the floor
@@ -175,11 +175,11 @@ void Physics::CreateScene()
 
 void Physics::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "LMB to spawn physics objects\n"
@@ -198,7 +198,7 @@ void Physics::CreateInstructions()
 
 void Physics::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -221,7 +221,7 @@ void Physics::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -271,23 +271,23 @@ void Physics::MoveCamera(float timeStep)
 
 void Physics::SpawnObject()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create a smaller box at camera position
     Node* boxNode = scene_->CreateChild("SmallBox");
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+    auto* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
     boxObject->SetCastShadows(true);
 
     // Create physics components, use a smaller mass also
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
+    auto* body = boxNode->CreateComponent<RigidBody>();
     body->SetMass(0.25f);
     body->SetFriction(0.75f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+    auto* shape = boxNode->CreateComponent<CollisionShape>();
     shape->SetBox(Vector3::ONE);
 
     const float OBJECT_VELOCITY = 10.0f;

+ 20 - 20
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp

@@ -79,7 +79,7 @@ void PhysicsStressTest::Start()
 
 void PhysicsStressTest::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -93,7 +93,7 @@ void PhysicsStressTest::CreateScene()
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -103,7 +103,7 @@ void PhysicsStressTest::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -115,13 +115,13 @@ void PhysicsStressTest::CreateScene()
         Node* floorNode = scene_->CreateChild("Floor");
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetScale(Vector3(500.0f, 1.0f, 500.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+        auto* floorObject = floorNode->CreateComponent<StaticModel>();
         floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
         // Make the floor physical by adding RigidBody and CollisionShape components
         /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+        auto* shape = floorNode->CreateComponent<CollisionShape>();
         shape->SetBox(Vector3::ONE);
     }
 
@@ -134,13 +134,13 @@ void PhysicsStressTest::CreateScene()
             mushroomNode->SetPosition(Vector3(Random(400.0f) - 200.0f, 0.0f, Random(400.0f) - 200.0f));
             mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
             mushroomNode->SetScale(5.0f + Random(5.0f));
-            StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+            auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
             mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetCastShadows(true);
 
             /*RigidBody* body = */mushroomNode->CreateComponent<RigidBody>();
-            CollisionShape* shape = mushroomNode->CreateComponent<CollisionShape>();
+            auto* shape = mushroomNode->CreateComponent<CollisionShape>();
             // By default the highest LOD level will be used, the LOD level can be passed as an optional parameter
             shape->SetTriangleMesh(mushroomObject->GetModel());
         }
@@ -153,18 +153,18 @@ void PhysicsStressTest::CreateScene()
         {
             Node* boxNode = scene_->CreateChild("Box");
             boxNode->SetPosition(Vector3(0.0f, i * 2.0f + 100.0f, 0.0f));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+            auto* boxObject = boxNode->CreateComponent<StaticModel>();
             boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
             boxObject->SetCastShadows(true);
 
             // Give the RigidBody mass to make it movable and also adjust friction
-            RigidBody* body = boxNode->CreateComponent<RigidBody>();
+            auto* body = boxNode->CreateComponent<RigidBody>();
             body->SetMass(1.0f);
             body->SetFriction(1.0f);
             // Disable collision event signaling to reduce CPU load of the physics simulation
             body->SetCollisionEventMode(COLLISION_NEVER);
-            CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+            auto* shape = boxNode->CreateComponent<CollisionShape>();
             shape->SetBox(Vector3::ONE);
         }
     }
@@ -172,7 +172,7 @@ void PhysicsStressTest::CreateScene()
     // Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the floor
@@ -181,11 +181,11 @@ void PhysicsStressTest::CreateScene()
 
 void PhysicsStressTest::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "LMB to spawn physics objects\n"
@@ -204,7 +204,7 @@ void PhysicsStressTest::CreateInstructions()
 
 void PhysicsStressTest::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -227,7 +227,7 @@ void PhysicsStressTest::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -276,23 +276,23 @@ void PhysicsStressTest::MoveCamera(float timeStep)
 
 void PhysicsStressTest::SpawnObject()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create a smaller box at camera position
     Node* boxNode = scene_->CreateChild("SmallBox");
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+    auto* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetCastShadows(true);
 
     // Create physics components, use a smaller mass also
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
+    auto* body = boxNode->CreateComponent<RigidBody>();
     body->SetMass(0.25f);
     body->SetFriction(0.75f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+    auto* shape = boxNode->CreateComponent<CollisionShape>();
     shape->SetBox(Vector3::ONE);
 
     const float OBJECT_VELOCITY = 10.0f;

+ 5 - 5
Source/Samples/13_Ragdolls/CreateRagdoll.cpp

@@ -47,7 +47,7 @@ void CreateRagdoll::HandleNodeCollision(StringHash eventType, VariantMap& eventD
     using namespace NodeCollision;
 
     // Get the other colliding body, make sure it is moving (has nonzero mass)
-    RigidBody* otherBody = static_cast<RigidBody*>(eventData[P_OTHERBODY].GetPtr());
+    auto* otherBody = static_cast<RigidBody*>(eventData[P_OTHERBODY].GetPtr());
 
     if (otherBody->GetMass() > 0.0f)
     {
@@ -102,7 +102,7 @@ void CreateRagdoll::HandleNodeCollision(StringHash eventType, VariantMap& eventD
             Vector2(90.0f, 0.0f), Vector2::ZERO);
 
         // Disable keyframe animation from all bones so that they will not interfere with the ragdoll
-        AnimatedModel* model = GetComponent<AnimatedModel>();
+        auto* model = GetComponent<AnimatedModel>();
         Skeleton& skeleton = model->GetSkeleton();
         for (unsigned i = 0; i < skeleton.GetNumBones(); ++i)
             skeleton.GetBone(i)->animated_ = false;
@@ -123,7 +123,7 @@ void CreateRagdoll::CreateRagdollBone(const String& boneName, ShapeType type, co
         return;
     }
 
-    RigidBody* body = boneNode->CreateComponent<RigidBody>();
+    auto* body = boneNode->CreateComponent<RigidBody>();
     // Set mass to make movable
     body->SetMass(1.0f);
     // Set damping parameters to smooth out the motion
@@ -133,7 +133,7 @@ void CreateRagdoll::CreateRagdollBone(const String& boneName, ShapeType type, co
     body->SetLinearRestThreshold(1.5f);
     body->SetAngularRestThreshold(2.5f);
 
-    CollisionShape* shape = boneNode->CreateComponent<CollisionShape>();
+    auto* shape = boneNode->CreateComponent<CollisionShape>();
     // We use either a box or a capsule shape for all of the bones
     if (type == SHAPE_BOX)
         shape->SetBox(size, position, rotation);
@@ -158,7 +158,7 @@ void CreateRagdoll::CreateRagdollConstraint(const String& boneName, const String
         return;
     }
 
-    Constraint* constraint = boneNode->CreateComponent<Constraint>();
+    auto* constraint = boneNode->CreateComponent<Constraint>();
     constraint->SetConstraintType(type);
     // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
     constraint->SetDisableCollision(disableCollision);

+ 19 - 19
Source/Samples/13_Ragdolls/Ragdolls.cpp

@@ -81,7 +81,7 @@ void Ragdolls::Start()
 
 void Ragdolls::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -95,7 +95,7 @@ void Ragdolls::CreateScene()
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -105,7 +105,7 @@ void Ragdolls::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -117,16 +117,16 @@ void Ragdolls::CreateScene()
         Node* floorNode = scene_->CreateChild("Floor");
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetScale(Vector3(500.0f, 1.0f, 500.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+        auto* floorObject = floorNode->CreateComponent<StaticModel>();
         floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
         // Make the floor physical by adding RigidBody and CollisionShape components
-        RigidBody* body = floorNode->CreateComponent<RigidBody>();
+        auto* body = floorNode->CreateComponent<RigidBody>();
         // We will be spawning spherical objects in this sample. The ground also needs non-zero rolling friction so that
         // the spheres will eventually come to rest
         body->SetRollingFriction(0.15f);
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+        auto* shape = floorNode->CreateComponent<CollisionShape>();
         // Set a box shape of size 1 x 1 x 1 for collision. The shape will be scaled with the scene node scale, so the
         // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.)
         shape->SetBox(Vector3::ONE);
@@ -140,7 +140,7 @@ void Ragdolls::CreateScene()
             Node* modelNode = scene_->CreateChild("Jack");
             modelNode->SetPosition(Vector3(x * 5.0f, 0.0f, z * 5.0f));
             modelNode->SetRotation(Quaternion(0.0f, 180.0f, 0.0f));
-            AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>();
+            auto* modelObject = modelNode->CreateComponent<AnimatedModel>();
             modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
             modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
             modelObject->SetCastShadows(true);
@@ -150,11 +150,11 @@ void Ragdolls::CreateScene()
 
             // Create a rigid body and a collision shape. These will act as a trigger for transforming the
             // model into a ragdoll when hit by a moving object
-            RigidBody* body = modelNode->CreateComponent<RigidBody>();
+            auto* body = modelNode->CreateComponent<RigidBody>();
             // The Trigger mode makes the rigid body only detect collisions, but impart no forces on the
             // colliding objects
             body->SetTrigger(true);
-            CollisionShape* shape = modelNode->CreateComponent<CollisionShape>();
+            auto* shape = modelNode->CreateComponent<CollisionShape>();
             // Create the capsule shape with an offset so that it is correctly aligned with the model, which
             // has its origin at the feet
             shape->SetCapsule(0.7f, 2.0f, Vector3(0.0f, 1.0f, 0.0f));
@@ -167,7 +167,7 @@ void Ragdolls::CreateScene()
     // Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the floor
@@ -176,11 +176,11 @@ void Ragdolls::CreateScene()
 
 void Ragdolls::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "LMB to spawn physics objects\n"
@@ -199,7 +199,7 @@ void Ragdolls::CreateInstructions()
 
 void Ragdolls::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -212,7 +212,7 @@ void Ragdolls::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -261,21 +261,21 @@ void Ragdolls::MoveCamera(float timeStep)
 
 void Ragdolls::SpawnObject()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     Node* boxNode = scene_->CreateChild("Sphere");
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+    auto* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetCastShadows(true);
 
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
+    auto* body = boxNode->CreateComponent<RigidBody>();
     body->SetMass(1.0f);
     body->SetRollingFriction(0.15f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+    auto* shape = boxNode->CreateComponent<CollisionShape>();
     shape->SetSphere(1.0f);
 
     const float OBJECT_VELOCITY = 10.0f;

+ 17 - 17
Source/Samples/14_SoundEffects/SoundEffects.cpp

@@ -97,8 +97,8 @@ void SoundEffects::Start()
 void SoundEffects::CreateUI()
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
 
@@ -118,7 +118,7 @@ void SoundEffects::CreateUI()
     button = CreateButton(160, 80, 120, 40, "Stop Music");
     SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(SoundEffects, HandleStopMusic));
 
-    Audio* audio = GetSubsystem<Audio>();
+    auto* audio = GetSubsystem<Audio>();
 
     // Create sliders for controlling sound and music master volume
     Slider* slider = CreateSlider(20, 140, 200, 20, "Sound Volume");
@@ -133,16 +133,16 @@ void SoundEffects::CreateUI()
 Button* SoundEffects::CreateButton(int x, int y, int xSize, int ySize, const String& text)
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
 
     // Create the button and center the text onto it
-    Button* button = root->CreateChild<Button>();
+    auto* button = root->CreateChild<Button>();
     button->SetStyleAuto();
     button->SetPosition(x, y);
     button->SetSize(xSize, ySize);
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetFont(font, 12);
     buttonText->SetText(text);
@@ -153,16 +153,16 @@ Button* SoundEffects::CreateButton(int x, int y, int xSize, int ySize, const Str
 Slider* SoundEffects::CreateSlider(int x, int y, int xSize, int ySize, const String& text)
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
 
     // Create text and slider below it
-    Text* sliderText = root->CreateChild<Text>();
+    auto* sliderText = root->CreateChild<Text>();
     sliderText->SetPosition(x, y);
     sliderText->SetFont(font, 12);
     sliderText->SetText(text);
 
-    Slider* slider = root->CreateChild<Slider>();
+    auto* slider = root->CreateChild<Slider>();
     slider->SetStyleAuto();
     slider->SetPosition(x, y + 20);
     slider->SetSize(xSize, ySize);
@@ -174,19 +174,19 @@ Slider* SoundEffects::CreateSlider(int x, int y, int xSize, int ySize, const Str
 
 void SoundEffects::HandlePlaySound(StringHash eventType, VariantMap& eventData)
 {
-    Button* button = static_cast<Button*>(GetEventSender());
+    auto* button = static_cast<Button*>(GetEventSender());
     const String& soundResourceName = button->GetVar(VAR_SOUNDRESOURCE).GetString();
 
     // Get the sound resource
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sound* sound = cache->GetResource<Sound>(soundResourceName);
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* sound = cache->GetResource<Sound>(soundResourceName);
 
     if (sound)
     {
         // Create a SoundSource component for playing the sound. The SoundSource component plays
         // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the
         // SoundSource3D component would be used instead
-        SoundSource* soundSource = scene_->CreateComponent<SoundSource>();
+        auto* soundSource = scene_->CreateComponent<SoundSource>();
         // Component will automatically remove itself when the sound finished playing
         soundSource->SetAutoRemoveMode(REMOVE_COMPONENT);
         soundSource->Play(sound);
@@ -197,8 +197,8 @@ void SoundEffects::HandlePlaySound(StringHash eventType, VariantMap& eventData)
 
 void SoundEffects::HandlePlayMusic(StringHash eventType, VariantMap& eventData)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sound* music = cache->GetResource<Sound>("Music/Ninja Gods.ogg");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* music = cache->GetResource<Sound>("Music/Ninja Gods.ogg");
     // Set the song to loop
     music->SetLooped(true);
 

+ 28 - 28
Source/Samples/15_Navigation/Navigation.cpp

@@ -77,7 +77,7 @@ void Navigation::Start()
 
 void Navigation::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -89,13 +89,13 @@ void Navigation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -105,7 +105,7 @@ void Navigation::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -125,7 +125,7 @@ void Navigation::CreateScene()
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
@@ -136,13 +136,13 @@ void Navigation::CreateScene()
     // Create Jack node that will follow the path
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_->SetPosition(Vector3(-5.0f, 0.0f, 20.0f));
-    AnimatedModel* modelObject = jackNode_->CreateComponent<AnimatedModel>();
+    auto* modelObject = jackNode_->CreateComponent<AnimatedModel>();
     modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetCastShadows(true);
 
     // Create a NavigationMesh component to the scene root
-    NavigationMesh* navMesh = scene_->CreateComponent<NavigationMesh>();
+    auto* navMesh = scene_->CreateComponent<NavigationMesh>();
     // Set small tiles to show navigation mesh streaming
     navMesh->SetTileSize(32);
     // Create a Navigable component to the scene root. This tags all of the geometry in the scene as being part of the
@@ -158,7 +158,7 @@ void Navigation::CreateScene()
 
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane and looking down
@@ -169,22 +169,22 @@ void Navigation::CreateScene()
 
 void Navigation::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
     // control the camera, and when visible, it will point the raycast target
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
 
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
@@ -204,7 +204,7 @@ void Navigation::CreateUI()
 
 void Navigation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -224,8 +224,8 @@ void Navigation::SubscribeToEvents()
 void Navigation::MoveCamera(float timeStep)
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Do not move if the UI has a focused element (the console)
@@ -276,7 +276,7 @@ void Navigation::SetPathPoint()
 {
     Vector3 hitPos;
     Drawable* hitDrawable;
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
 
     if (Raycast(250.0f, hitPos, hitDrawable))
     {
@@ -323,7 +323,7 @@ void Navigation::AddOrRemoveObject()
         }
 
         // Rebuild part of the navigation mesh, then recalculate path if applicable
-        NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+        auto* navMesh = scene_->GetComponent<NavigationMesh>();
         navMesh->Build(updateBox);
         if (currentPath_.Size())
             navMesh->FindPath(currentPath_, jackNode_->GetPosition(), endPos_);
@@ -332,13 +332,13 @@ void Navigation::AddOrRemoveObject()
 
 Node* Navigation::CreateMushroom(const Vector3& pos)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     mushroomNode->SetPosition(pos);
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetScale(2.0f + Random(0.5f));
-    StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+    auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
     mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetCastShadows(true);
@@ -350,14 +350,14 @@ bool Navigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawa
 {
     hitDrawable = nullptr;
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
 
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* camera = cameraNode_->GetComponent<Camera>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* camera = cameraNode_->GetComponent<Camera>();
     Ray cameraRay = camera->GetScreenRay((float)pos.x_ / graphics->GetWidth(), (float)pos.y_ / graphics->GetHeight());
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;
@@ -397,7 +397,7 @@ void Navigation::FollowPath(float timeStep)
 
 void Navigation::ToggleStreaming(bool enabled)
 {
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
     if (enabled)
     {
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
@@ -412,7 +412,7 @@ void Navigation::ToggleStreaming(bool enabled)
 void Navigation::UpdateStreaming()
 {
     // Center the navigation mesh at the jack
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
     const IntVector2 jackTile = navMesh->GetTileIndex(jackNode_->GetWorldPosition());
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
@@ -446,7 +446,7 @@ void Navigation::UpdateStreaming()
 
 void Navigation::SaveNavigationData()
 {
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
     tileData_.Clear();
     addedTiles_.Clear();
     const IntVector2 numTiles = navMesh->GetNumTiles();
@@ -472,7 +472,7 @@ void Navigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
     FollowPath(timeStep);
 
     // Update streaming
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_TAB))
     {
         useStreaming_ = !useStreaming_;
@@ -491,7 +491,7 @@ void Navigation::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventD
     if (currentPath_.Size())
     {
         // Visualize the current calculated path
-        DebugRenderer* debug = scene_->GetComponent<DebugRenderer>();
+        auto* debug = scene_->GetComponent<DebugRenderer>();
         debug->AddBoundingBox(BoundingBox(endPos_ - Vector3(0.1f, 0.1f, 0.1f), endPos_ + Vector3(0.1f, 0.1f, 0.1f)),
             Color(1.0f, 1.0f, 1.0f));
 

+ 15 - 15
Source/Samples/16_Chat/Chat.cpp

@@ -84,14 +84,14 @@ void Chat::CreateUI()
 {
     SetLogoVisible(false); // We need the full rendering window
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
 
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
     chatHistoryText_ = root->CreateChild<Text>();
     chatHistoryText_->SetFont(font, 12);
 
@@ -140,14 +140,14 @@ void Chat::SubscribeToEvents()
 
 Button* Chat::CreateButton(const String& text, int width)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
 
-    Button* button = buttonContainer_->CreateChild<Button>();
+    auto* button = buttonContainer_->CreateChild<Button>();
     button->SetStyleAuto();
     button->SetFixedWidth(width);
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetFont(font, 12);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetText(text);
@@ -170,7 +170,7 @@ void Chat::ShowChatText(const String& row)
 
 void Chat::UpdateButtons()
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     bool serverRunning = network->IsServerRunning();
 
@@ -194,7 +194,7 @@ void Chat::HandleSend(StringHash eventType, VariantMap& eventData)
     if (text.Empty())
         return; // Do not send an empty message
 
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
 
     if (serverConnection)
@@ -211,7 +211,7 @@ void Chat::HandleSend(StringHash eventType, VariantMap& eventData)
 
 void Chat::HandleConnect(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     String address = textEdit_->GetText().Trimmed();
     if (address.Empty())
         address = "localhost"; // Use localhost to connect if nothing else specified
@@ -228,7 +228,7 @@ void Chat::HandleConnect(StringHash eventType, VariantMap& eventData)
 
 void Chat::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     // If we were connected to server, disconnect
     if (serverConnection)
@@ -242,7 +242,7 @@ void Chat::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 
 void Chat::HandleStartServer(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     network->StartServer(CHAT_SERVER_PORT);
 
     UpdateButtons();
@@ -250,7 +250,7 @@ void Chat::HandleStartServer(StringHash eventType, VariantMap& eventData)
 
 void Chat::HandleNetworkMessage(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
 
     using namespace NetworkMessage;
 
@@ -266,7 +266,7 @@ void Chat::HandleNetworkMessage(StringHash eventType, VariantMap& eventData)
         // If we are a client, just display the message
         if (network->IsServerRunning())
         {
-            Connection* sender = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
+            auto* sender = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
 
             text = sender->ToString() + " " + text;
 

+ 33 - 33
Source/Samples/17_SceneReplication/SceneReplication.cpp

@@ -99,7 +99,7 @@ void SceneReplication::CreateScene()
 {
     scene_ = new Scene(context_);
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create octree and physics world with default settings. Create them as local so that they are not needlessly replicated
     // when a client connects
@@ -109,7 +109,7 @@ void SceneReplication::CreateScene()
     // All static scene content and the camera are also created as local, so that they are unaffected by scene replication and are
     // not removed from the client upon connection. Create a Zone component first for ambient lighting & fog control.
     Node* zoneNode = scene_->CreateChild("Zone", LOCAL);
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetFogStart(100.0f);
@@ -118,7 +118,7 @@ void SceneReplication::CreateScene()
     // Create a directional light without shadows
     Node* lightNode = scene_->CreateChild("DirectionalLight", LOCAL);
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetSpecularIntensity(1.0f);
@@ -131,13 +131,13 @@ void SceneReplication::CreateScene()
             Node* floorNode = scene_->CreateChild("FloorTile", LOCAL);
             floorNode->SetPosition(Vector3(x * 20.2f, -0.5f, y * 20.2f));
             floorNode->SetScale(Vector3(20.0f, 1.0f, 20.0f));
-            StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
+            auto* floorObject = floorNode->CreateComponent<StaticModel>();
             floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
-            RigidBody* body = floorNode->CreateComponent<RigidBody>();
+            auto* body = floorNode->CreateComponent<RigidBody>();
             body->SetFriction(1.0f);
-            CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+            auto* shape = floorNode->CreateComponent<CollisionShape>();
             shape->SetBox(Vector3::ONE);
         }
     }
@@ -148,7 +148,7 @@ void SceneReplication::CreateScene()
     // the screen would become blank if the camera node was replicated (as only the locally created camera is assigned to a
     // viewport in SetupViewports() below)
     cameraNode_ = scene_->CreateChild("Camera", LOCAL);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane
@@ -157,10 +157,10 @@ void SceneReplication::CreateScene()
 
 void SceneReplication::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* root = ui->GetRoot();
-    XMLFile* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
 
@@ -170,7 +170,7 @@ void SceneReplication::CreateUI()
     cursor->SetStyleAuto(uiStyle);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     // Construct the instructions text element
@@ -203,7 +203,7 @@ void SceneReplication::CreateUI()
 
 void SceneReplication::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -239,14 +239,14 @@ void SceneReplication::SubscribeToEvents()
 
 Button* SceneReplication::CreateButton(const String& text, int width)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
 
-    Button* button = buttonContainer_->CreateChild<Button>();
+    auto* button = buttonContainer_->CreateChild<Button>();
     button->SetStyleAuto();
     button->SetFixedWidth(width);
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetFont(font, 12);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetText(text);
@@ -256,7 +256,7 @@ Button* SceneReplication::CreateButton(const String& text, int width)
 
 void SceneReplication::UpdateButtons()
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     bool serverRunning = network->IsServerRunning();
 
@@ -269,28 +269,28 @@ void SceneReplication::UpdateButtons()
 
 Node* SceneReplication::CreateControllableObject()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create the scene node & visual representation. This will be a replicated object
     Node* ballNode = scene_->CreateChild("Ball");
     ballNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 5.0f, Random(40.0f) - 20.0f));
     ballNode->SetScale(0.5f);
-    StaticModel* ballObject = ballNode->CreateComponent<StaticModel>();
+    auto* ballObject = ballNode->CreateComponent<StaticModel>();
     ballObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     ballObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
 
     // Create the physics components
-    RigidBody* body = ballNode->CreateComponent<RigidBody>();
+    auto* body = ballNode->CreateComponent<RigidBody>();
     body->SetMass(1.0f);
     body->SetFriction(1.0f);
     // In addition to friction, use motion damping so that the ball can not accelerate limitlessly
     body->SetLinearDamping(0.5f);
     body->SetAngularDamping(0.5f);
-    CollisionShape* shape = ballNode->CreateComponent<CollisionShape>();
+    auto* shape = ballNode->CreateComponent<CollisionShape>();
     shape->SetSphere(1.0f);
 
     // Create a random colored point light at the ball so that can see better where is going
-    Light* light = ballNode->CreateComponent<Light>();
+    auto* light = ballNode->CreateComponent<Light>();
     light->SetRange(3.0f);
     light->SetColor(Color(0.5f + (Rand() & 1) * 0.5f, 0.5f + (Rand() & 1) * 0.5f, 0.5f + (Rand() & 1) * 0.5f));
 
@@ -300,8 +300,8 @@ Node* SceneReplication::CreateControllableObject()
 void SceneReplication::MoveCamera()
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Mouse sensitivity as degrees per pixel
@@ -349,14 +349,14 @@ void SceneReplication::HandlePhysicsPreStep(StringHash eventType, VariantMap& ev
     // This function is different on the client and server. The client collects controls (WASD controls + yaw angle)
     // and sets them to its server connection object, so that they will be sent to the server automatically at a
     // fixed rate, by default 30 FPS. The server will actually apply the controls (authoritative simulation.)
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
 
     // Client: collect controls
     if (serverConnection)
     {
-        UI* ui = GetSubsystem<UI>();
-        Input* input = GetSubsystem<Input>();
+        auto* ui = GetSubsystem<UI>();
+        auto* input = GetSubsystem<Input>();
         Controls controls;
 
         // Copy mouse yaw
@@ -389,7 +389,7 @@ void SceneReplication::HandlePhysicsPreStep(StringHash eventType, VariantMap& ev
             if (!ballNode)
                 continue;
 
-            RigidBody* body = ballNode->GetComponent<RigidBody>();
+            auto* body = ballNode->GetComponent<RigidBody>();
 
             // Get the last controls sent by the client
             const Controls& controls = connection->GetControls();
@@ -415,7 +415,7 @@ void SceneReplication::HandlePhysicsPreStep(StringHash eventType, VariantMap& ev
 
 void SceneReplication::HandleConnect(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     String address = textEdit_->GetText().Trimmed();
     if (address.Empty())
         address = "localhost"; // Use localhost to connect if nothing else specified
@@ -429,7 +429,7 @@ void SceneReplication::HandleConnect(StringHash eventType, VariantMap& eventData
 
 void SceneReplication::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     // If we were connected to server, disconnect. Or if we were running a server, stop it. In both cases clear the
     // scene of all replicated content, but let the local nodes & components (the static world + camera) stay
@@ -451,7 +451,7 @@ void SceneReplication::HandleDisconnect(StringHash eventType, VariantMap& eventD
 
 void SceneReplication::HandleStartServer(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     network->StartServer(SERVER_PORT);
 
     UpdateButtons();
@@ -467,7 +467,7 @@ void SceneReplication::HandleClientConnected(StringHash eventType, VariantMap& e
     using namespace ClientConnected;
 
     // When a client connects, assign to scene to begin scene replication
-    Connection* newConnection = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
+    auto* newConnection = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
     newConnection->SetScene(scene_);
 
     // Then create a controllable object for that client
@@ -485,7 +485,7 @@ void SceneReplication::HandleClientDisconnected(StringHash eventType, VariantMap
     using namespace ClientConnected;
 
     // When a client disconnects, remove the controlled object
-    Connection* connection = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
+    auto* connection = static_cast<Connection*>(eventData[P_CONNECTION].GetPtr());
     Node* object = serverObjects_[connection];
     if (object)
         object->Remove();

+ 2 - 2
Source/Samples/18_CharacterDemo/Character.cpp

@@ -63,8 +63,8 @@ void Character::Start()
 void Character::FixedUpdate(float timeStep)
 {
     /// \todo Could cache the components for faster access instead of finding them each frame
-    RigidBody* body = GetComponent<RigidBody>();
-    AnimationController* animCtrl = node_->GetComponent<AnimationController>(true);
+    auto* body = GetComponent<RigidBody>();
+    auto* animCtrl = node_->GetComponent<AnimationController>(true);
 
     // Update the in air timer. Reset if grounded
     if (!onGround_)

+ 25 - 25
Source/Samples/18_CharacterDemo/CharacterDemo.cpp

@@ -88,7 +88,7 @@ void CharacterDemo::Start()
 
 void CharacterDemo::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -99,13 +99,13 @@ void CharacterDemo::CreateScene()
     // Create camera and define viewport. We will be doing load / save, so it's convenient to create the camera outside the scene,
     // so that it won't be destroyed and recreated, and we don't have to redefine the viewport on load
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     GetSubsystem<Renderer>()->SetViewport(0, new Viewport(context_, scene_, camera));
 
     // Create static scene content. First create a zone for ambient lighting and fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     zone->SetFogStart(100.0f);
@@ -115,7 +115,7 @@ void CharacterDemo::CreateScene()
     // Create a directional light with cascaded shadow mapping
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.3f, -0.5f, 0.425f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -126,15 +126,15 @@ void CharacterDemo::CreateScene()
     Node* floorNode = scene_->CreateChild("Floor");
     floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
     floorNode->SetScale(Vector3(200.0f, 1.0f, 200.0f));
-    StaticModel* object = floorNode->CreateComponent<StaticModel>();
+    auto* object = floorNode->CreateComponent<StaticModel>();
     object->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     object->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
-    RigidBody* body = floorNode->CreateComponent<RigidBody>();
+    auto* body = floorNode->CreateComponent<RigidBody>();
     // Use collision layer bit 2 to mark world scenery. This is what we will raycast against to prevent camera from going
     // inside geometry
     body->SetCollisionLayer(2);
-    CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+    auto* shape = floorNode->CreateComponent<CollisionShape>();
     shape->SetBox(Vector3::ONE);
 
     // Create mushrooms of varying sizes
@@ -145,14 +145,14 @@ void CharacterDemo::CreateScene()
         objectNode->SetPosition(Vector3(Random(180.0f) - 90.0f, 0.0f, Random(180.0f) - 90.0f));
         objectNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         objectNode->SetScale(2.0f + Random(5.0f));
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         object->SetCastShadows(true);
 
-        RigidBody* body = objectNode->CreateComponent<RigidBody>();
+        auto* body = objectNode->CreateComponent<RigidBody>();
         body->SetCollisionLayer(2);
-        CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+        auto* shape = objectNode->CreateComponent<CollisionShape>();
         shape->SetTriangleMesh(object->GetModel(), 0);
     }
 
@@ -166,23 +166,23 @@ void CharacterDemo::CreateScene()
         objectNode->SetPosition(Vector3(Random(180.0f) - 90.0f, Random(10.0f) + 10.0f, Random(180.0f) - 90.0f));
         objectNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
         objectNode->SetScale(scale);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         object->SetCastShadows(true);
 
-        RigidBody* body = objectNode->CreateComponent<RigidBody>();
+        auto* body = objectNode->CreateComponent<RigidBody>();
         body->SetCollisionLayer(2);
         // Bigger boxes will be heavier and harder to move
         body->SetMass(scale * 2.0f);
-        CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+        auto* shape = objectNode->CreateComponent<CollisionShape>();
         shape->SetBox(Vector3::ONE);
     }
 }
 
 void CharacterDemo::CreateCharacter()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     Node* objectNode = scene_->CreateChild("Jack");
     objectNode->SetPosition(Vector3(0.0f, 1.0f, 0.0f));
@@ -190,9 +190,9 @@ void CharacterDemo::CreateCharacter()
     // spin node
     Node* adjustNode = objectNode->CreateChild("AdjNode");
     adjustNode->SetRotation( Quaternion(180, Vector3(0,1,0) ) );
-    
+
     // Create the rendering component + animation controller
-    AnimatedModel* object = adjustNode->CreateComponent<AnimatedModel>();
+    auto* object = adjustNode->CreateComponent<AnimatedModel>();
     object->SetModel(cache->GetResource<Model>("Models/Mutant/Mutant.mdl"));
     object->SetMaterial(cache->GetResource<Material>("Models/Mutant/Materials/mutant_M.xml"));
     object->SetCastShadows(true);
@@ -202,7 +202,7 @@ void CharacterDemo::CreateCharacter()
     object->GetSkeleton().GetBone("Mutant:Head")->animated_ = false;
 
     // Create rigidbody, and set non-zero mass so that the body becomes dynamic
-    RigidBody* body = objectNode->CreateComponent<RigidBody>();
+    auto* body = objectNode->CreateComponent<RigidBody>();
     body->SetCollisionLayer(1);
     body->SetMass(1.0f);
 
@@ -214,7 +214,7 @@ void CharacterDemo::CreateCharacter()
     body->SetCollisionEventMode(COLLISION_ALWAYS);
 
     // Set a capsule shape for collision
-    CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+    auto* shape = objectNode->CreateComponent<CollisionShape>();
     shape->SetCapsule(0.7f, 1.8f, Vector3(0.0f, 0.9f, 0.0f));
 
     // Create the character logic component, which takes care of steering the rigidbody
@@ -225,11 +225,11 @@ void CharacterDemo::CreateCharacter()
 
 void CharacterDemo::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Space to jump, F to toggle 1st/3rd person\n"
@@ -261,7 +261,7 @@ void CharacterDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     using namespace Update;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     if (character_)
     {
@@ -273,7 +273,7 @@ void CharacterDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
             touch_->UpdateTouches(character_->controls_);
 
         // Update controls using keys
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         if (!ui->GetFocusElement())
         {
             if (!touch_ || !touch_->useGyroscope_)
@@ -293,11 +293,11 @@ void CharacterDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
                     TouchState* state = input->GetTouch(i);
                     if (!state->touchedElement_)    // Touch on empty space
                     {
-                        Camera* camera = cameraNode_->GetComponent<Camera>();
+                        auto* camera = cameraNode_->GetComponent<Camera>();
                         if (!camera)
                             return;
 
-                        Graphics* graphics = GetSubsystem<Graphics>();
+                        auto* graphics = GetSubsystem<Graphics>();
                         character_->controls_.yaw_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.x_;
                         character_->controls_.pitch_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.y_;
                     }

+ 1 - 1
Source/Samples/18_CharacterDemo/Touch.cpp

@@ -47,7 +47,7 @@ void Touch::UpdateTouches(Controls& controls) // Called from HandleUpdate
 {
     zoom_ = false; // reset bool
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Zoom in/out
     if (input->GetNumTouches() == 2)

+ 8 - 8
Source/Samples/19_VehicleDemo/Vehicle.cpp

@@ -122,11 +122,11 @@ void Vehicle::FixedUpdate(float timeStep)
 void Vehicle::Init()
 {
     // This function is called only from the main program when initially creating the vehicle, not on scene load
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
-    StaticModel* hullObject = node_->CreateComponent<StaticModel>();
+    auto* hullObject = node_->CreateComponent<StaticModel>();
     hullBody_ = node_->CreateComponent<RigidBody>();
-    CollisionShape* hullShape = node_->CreateComponent<CollisionShape>();
+    auto* hullShape = node_->CreateComponent<CollisionShape>();
 
     node_->SetScale(Vector3(1.5f, 1.0f, 3.0f));
     hullObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
@@ -148,7 +148,7 @@ void Vehicle::Init()
 
 void Vehicle::InitWheel(const String& name, const Vector3& offset, WeakPtr<Node>& wheelNode, unsigned& wheelNodeID)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Note: do not parent the wheel to the hull scene node. Instead create it on the root level and let the physics
     // constraint keep it together
@@ -160,10 +160,10 @@ void Vehicle::InitWheel(const String& name, const Vector3& offset, WeakPtr<Node>
     // Remember the ID for serialization
     wheelNodeID = wheelNode->GetID();
 
-    StaticModel* wheelObject = wheelNode->CreateComponent<StaticModel>();
-    RigidBody* wheelBody = wheelNode->CreateComponent<RigidBody>();
-    CollisionShape* wheelShape = wheelNode->CreateComponent<CollisionShape>();
-    Constraint* wheelConstraint = wheelNode->CreateComponent<Constraint>();
+    auto* wheelObject = wheelNode->CreateComponent<StaticModel>();
+    auto* wheelBody = wheelNode->CreateComponent<RigidBody>();
+    auto* wheelShape = wheelNode->CreateComponent<CollisionShape>();
+    auto* wheelConstraint = wheelNode->CreateComponent<Constraint>();
 
     wheelObject->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
     wheelObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));

+ 17 - 17
Source/Samples/19_VehicleDemo/VehicleDemo.cpp

@@ -83,7 +83,7 @@ void VehicleDemo::Start()
 
 void VehicleDemo::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -94,13 +94,13 @@ void VehicleDemo::CreateScene()
     // Create camera and define viewport. We will be doing load / save, so it's convenient to create the camera outside the scene,
     // so that it won't be destroyed and recreated, and we don't have to redefine the viewport on load
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(500.0f);
     GetSubsystem<Renderer>()->SetViewport(0, new Viewport(context_, scene_, camera));
 
     // Create static scene content. First create a zone for ambient lighting and fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     zone->SetFogStart(300.0f);
@@ -110,7 +110,7 @@ void VehicleDemo::CreateScene()
     // Create a directional light with cascaded shadow mapping
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.3f, -0.5f, 0.425f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -120,7 +120,7 @@ void VehicleDemo::CreateScene()
     // Create heightmap terrain with collision
     Node* terrainNode = scene_->CreateChild("Terrain");
     terrainNode->SetPosition(Vector3::ZERO);
-    Terrain* terrain = terrainNode->CreateComponent<Terrain>();
+    auto* terrain = terrainNode->CreateComponent<Terrain>();
     terrain->SetPatchSize(64);
     terrain->SetSpacing(Vector3(2.0f, 0.1f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSmoothing(true);
@@ -130,9 +130,9 @@ void VehicleDemo::CreateScene()
     // terrain patches and other objects behind it
     terrain->SetOccluder(true);
 
-    RigidBody* body = terrainNode->CreateComponent<RigidBody>();
+    auto* body = terrainNode->CreateComponent<RigidBody>();
     body->SetCollisionLayer(2); // Use layer bitmask 2 for static geometry
-    CollisionShape* shape = terrainNode->CreateComponent<CollisionShape>();
+    auto* shape = terrainNode->CreateComponent<CollisionShape>();
     shape->SetTerrain();
 
     // Create 1000 mushrooms in the terrain. Always face outward along the terrain normal
@@ -146,14 +146,14 @@ void VehicleDemo::CreateScene()
         // Create a rotation quaternion from up vector to terrain normal
         objectNode->SetRotation(Quaternion(Vector3::UP, terrain->GetNormal(position)));
         objectNode->SetScale(3.0f);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         object->SetCastShadows(true);
 
-        RigidBody* body = objectNode->CreateComponent<RigidBody>();
+        auto* body = objectNode->CreateComponent<RigidBody>();
         body->SetCollisionLayer(2);
-        CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+        auto* shape = objectNode->CreateComponent<CollisionShape>();
         shape->SetTriangleMesh(object->GetModel(), 0);
     }
 }
@@ -171,11 +171,11 @@ void VehicleDemo::CreateVehicle()
 
 void VehicleDemo::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys to drive, mouse/touch to rotate camera\n"
         "F5 to save scene, F7 to load"
@@ -206,11 +206,11 @@ void VehicleDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     using namespace Update;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     if (vehicle_)
     {
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
 
         // Get movement controls and assign them to the vehicle component. If UI has a focused element, clear controls
         if (!ui->GetFocusElement())
@@ -228,11 +228,11 @@ void VehicleDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
                     TouchState* state = input->GetTouch(i);
                     if (!state->touchedElement_)    // Touch on empty space
                     {
-                        Camera* camera = cameraNode_->GetComponent<Camera>();
+                        auto* camera = cameraNode_->GetComponent<Camera>();
                         if (!camera)
                             return;
 
-                        Graphics* graphics = GetSubsystem<Graphics>();
+                        auto* graphics = GetSubsystem<Graphics>();
                         vehicle_->controls_.yaw_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.x_;
                         vehicle_->controls_.pitch_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.y_;
                     }

+ 11 - 11
Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp

@@ -74,7 +74,7 @@ void HugeObjectCount::Start()
 
 void HugeObjectCount::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     if (!scene_)
         scene_ = new Scene(context_);
@@ -90,7 +90,7 @@ void HugeObjectCount::CreateScene()
 
     // Create a Zone for ambient light & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogStart(200.0f);
@@ -99,7 +99,7 @@ void HugeObjectCount::CreateScene()
     // Create a directional light
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(-0.6f, -1.0f, -0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
 
     if (!useGroups_)
@@ -114,7 +114,7 @@ void HugeObjectCount::CreateScene()
                 Node* boxNode = scene_->CreateChild("Box");
                 boxNode->SetPosition(Vector3(x * 0.3f, 0.0f, y * 0.3f));
                 boxNode->SetScale(0.25f);
-                StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+                auto* boxObject = boxNode->CreateComponent<StaticModel>();
                 boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 boxNodes_.Push(SharedPtr<Node>(boxNode));
             }
@@ -156,18 +156,18 @@ void HugeObjectCount::CreateScene()
     {
         cameraNode_ = new Node(context_);
         cameraNode_->SetPosition(Vector3(0.0f, 10.0f, -100.0f));
-        Camera* camera = cameraNode_->CreateComponent<Camera>();
+        auto* camera = cameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(300.0f);
     }
 }
 
 void HugeObjectCount::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle animation\n"
@@ -185,7 +185,7 @@ void HugeObjectCount::CreateInstructions()
 
 void HugeObjectCount::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -204,7 +204,7 @@ void HugeObjectCount::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -251,7 +251,7 @@ void HugeObjectCount::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
     // Toggle animation with space
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_SPACE))
         animate_ = !animate_;
 

+ 11 - 11
Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.cpp

@@ -76,7 +76,7 @@ void AngelScriptIntegration::Start()
 
 void AngelScriptIntegration::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -88,7 +88,7 @@ void AngelScriptIntegration::CreateScene()
     // it also defines its volume with a bounding box, but can be rotated (so it does not need to be aligned to the world X, Y
     // and Z axes.) Drawable objects "pick up" the zone they belong to and use it when rendering; several zones can exist
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
@@ -104,13 +104,13 @@ void AngelScriptIntegration::CreateScene()
         boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
         // Add our custom Rotator script object (using the ScriptInstance C++ component to instantiate / store it) which will
         // rotate the scene node each frame, when the scene sends its update event
-        ScriptInstance* instance = boxNode->CreateComponent<ScriptInstance>();
+        auto* instance = boxNode->CreateComponent<ScriptInstance>();
         instance->CreateObject(cache->GetResource<ScriptFile>("Scripts/Utilities/Rotator.as"), "Rotator");
         // Call the script object's "SetRotationSpeed" function. Function arguments need to be passed in a VariantVector
         VariantVector parameters;
@@ -121,22 +121,22 @@ void AngelScriptIntegration::CreateScene()
     // Create the camera. Let the starting position be at the world origin. As the fog limits maximum visible distance, we can
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
 
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
 }
 
 void AngelScriptIntegration::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -148,7 +148,7 @@ void AngelScriptIntegration::CreateInstructions()
 
 void AngelScriptIntegration::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -167,7 +167,7 @@ void AngelScriptIntegration::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 12 - 12
Source/Samples/22_LuaIntegration/LuaIntegration.cpp

@@ -77,7 +77,7 @@ void LuaIntegration::Start()
 
 void LuaIntegration::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -89,7 +89,7 @@ void LuaIntegration::CreateScene()
     // it also defines its volume with a bounding box, but can be rotated (so it does not need to be aligned to the world X, Y
     // and Z axes.) Drawable objects "pick up" the zone they belong to and use it when rendering; several zones can exist
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
@@ -97,7 +97,7 @@ void LuaIntegration::CreateScene()
     zone->SetFogStart(10.0f);
     zone->SetFogEnd(100.0f);
 
-    LuaFile* scriptFile = cache->GetResource<LuaFile>("LuaScripts/Utilities/Rotator.lua");
+    auto* scriptFile = cache->GetResource<LuaFile>("LuaScripts/Utilities/Rotator.lua");
     if (!scriptFile)
         return;
 
@@ -109,13 +109,13 @@ void LuaIntegration::CreateScene()
         boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
         // Add our custom Rotator script object (using the LuaScriptInstance C++ component to instantiate / store it) which will
         // rotate the scene node each frame, when the scene sends its update event
-        LuaScriptInstance* instance = boxNode->CreateComponent<LuaScriptInstance>();
+        auto* instance = boxNode->CreateComponent<LuaScriptInstance>();
         instance->CreateObject(scriptFile, "Rotator");
 
         // Call the script object's "SetRotationSpeed" function.
@@ -130,22 +130,22 @@ void LuaIntegration::CreateScene()
     // Create the camera. Let the starting position be at the world origin. As the fog limits maximum visible distance, we can
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
 
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
 }
 
 void LuaIntegration::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -157,7 +157,7 @@ void LuaIntegration::CreateInstructions()
 
 void LuaIntegration::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -176,7 +176,7 @@ void LuaIntegration::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 19 - 19
Source/Samples/23_Water/Water.cpp

@@ -77,7 +77,7 @@ void Water::Start()
 
 void Water::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -86,7 +86,7 @@ void Water::CreateScene()
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(1.0f, 1.0f, 1.0f));
@@ -96,7 +96,7 @@ void Water::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -110,14 +110,14 @@ void Water::CreateScene()
     // generate the necessary 3D texture coordinates for cube mapping
     Node* skyNode = scene_->CreateChild("Sky");
     skyNode->SetScale(500.0f); // The scale actually does not matter
-    Skybox* skybox = skyNode->CreateComponent<Skybox>();
+    auto* skybox = skyNode->CreateComponent<Skybox>();
     skybox->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     skybox->SetMaterial(cache->GetResource<Material>("Materials/Skybox.xml"));
 
     // Create heightmap terrain
     Node* terrainNode = scene_->CreateChild("Terrain");
     terrainNode->SetPosition(Vector3(0.0f, 0.0f, 0.0f));
-    Terrain* terrain = terrainNode->CreateComponent<Terrain>();
+    auto* terrain = terrainNode->CreateComponent<Terrain>();
     terrain->SetPatchSize(64);
     terrain->SetSpacing(Vector3(2.0f, 0.5f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSmoothing(true);
@@ -138,7 +138,7 @@ void Water::CreateScene()
         // Create a rotation quaternion from up vector to terrain normal
         objectNode->SetRotation(Quaternion(Vector3(0.0f, 1.0f, 0.0f), terrain->GetNormal(position)));
         objectNode->SetScale(5.0f);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         object->SetCastShadows(true);
@@ -148,7 +148,7 @@ void Water::CreateScene()
     waterNode_ = scene_->CreateChild("Water");
     waterNode_->SetScale(Vector3(2048.0f, 1.0f, 2048.0f));
     waterNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-    StaticModel* water = waterNode_->CreateComponent<StaticModel>();
+    auto* water = waterNode_->CreateComponent<StaticModel>();
     water->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     water->SetMaterial(cache->GetResource<Material>("Materials/Water.xml"));
     // Set a different viewmask on the water plane to be able to hide it from the reflection camera
@@ -157,7 +157,7 @@ void Water::CreateScene()
     // Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(750.0f);
 
     // Set an initial position for the camera scene node above the ground
@@ -166,11 +166,11 @@ void Water::CreateScene()
 
 void Water::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER);
@@ -183,9 +183,9 @@ void Water::CreateInstructions()
 
 void Water::SetupViewport()
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Renderer* renderer = GetSubsystem<Renderer>();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* renderer = GetSubsystem<Renderer>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -201,7 +201,7 @@ void Water::SetupViewport()
     // It will have the same farclip and position as the main viewport camera, but uses a reflection plane to modify
     // its position when rendering
     reflectionCameraNode_ = cameraNode_->CreateChild();
-    Camera* reflectionCamera = reflectionCameraNode_->CreateComponent<Camera>();
+    auto* reflectionCamera = reflectionCameraNode_->CreateComponent<Camera>();
     reflectionCamera->SetFarClip(750.0);
     reflectionCamera->SetViewMask(0x7fffffff); // Hide objects with only bit 31 in the viewmask (the water plane)
     reflectionCamera->SetAutoAspectRatio(false);
@@ -223,7 +223,7 @@ void Water::SetupViewport()
     RenderSurface* surface = renderTexture->GetRenderSurface();
     SharedPtr<Viewport> rttViewport(new Viewport(context_, scene_, reflectionCamera));
     surface->SetViewport(0, rttViewport);
-    Material* waterMat = cache->GetResource<Material>("Materials/Water.xml");
+    auto* waterMat = cache->GetResource<Material>("Materials/Water.xml");
     waterMat->SetTexture(TU_DIFFUSE, renderTexture);
 }
 
@@ -239,7 +239,7 @@ void Water::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -266,8 +266,8 @@ void Water::MoveCamera(float timeStep)
         cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 
     // In case resolution has changed, adjust the reflection camera aspect ratio
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* reflectionCamera = reflectionCameraNode_->GetComponent<Camera>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* reflectionCamera = reflectionCameraNode_->GetComponent<Camera>();
     reflectionCamera->SetAspectRatio((float)graphics->GetWidth() / (float)graphics->GetHeight());
 }
 

+ 15 - 15
Source/Samples/24_Urho2DSprite/Urho2DSprite.cpp

@@ -84,15 +84,15 @@ void Urho2DSprite::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     // Get sprite
-    Sprite2D* sprite = cache->GetResource<Sprite2D>("Urho2D/Aster.png");
+    auto* sprite = cache->GetResource<Sprite2D>("Urho2D/Aster.png");
     if (!sprite)
         return;
 
@@ -104,7 +104,7 @@ void Urho2DSprite::CreateScene()
         SharedPtr<Node> spriteNode(scene_->CreateChild("StaticSprite2D"));
         spriteNode->SetPosition(Vector3(Random(-halfWidth, halfWidth), Random(-halfHeight, halfHeight), 0.0f));
 
-        StaticSprite2D* staticSprite = spriteNode->CreateComponent<StaticSprite2D>();
+        auto* staticSprite = spriteNode->CreateComponent<StaticSprite2D>();
         // Set random color
         staticSprite->SetColor(Color(Random(1.0f), Random(1.0f), Random(1.0f), 1.0f));
         // Set blend mode
@@ -122,14 +122,14 @@ void Urho2DSprite::CreateScene()
     }
 
     // Get animation set
-    AnimationSet2D* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
+    auto* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
     if (!animationSet)
         return;
 
     SharedPtr<Node> spriteNode(scene_->CreateChild("AnimatedSprite2D"));
     spriteNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
 
-    AnimatedSprite2D* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
+    auto* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
     // Set animation
     animatedSprite->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("idle");
@@ -137,11 +137,11 @@ void Urho2DSprite::CreateScene()
 
 void Urho2DSprite::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys to move, use PageUp PageDown keys to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -153,7 +153,7 @@ void Urho2DSprite::CreateInstructions()
 
 void Urho2DSprite::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -166,7 +166,7 @@ void Urho2DSprite::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -183,13 +183,13 @@ void Urho2DSprite::MoveCamera(float timeStep)
 
     if (input->GetKeyDown(KEY_PAGEUP))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
 }
@@ -213,7 +213,7 @@ void Urho2DSprite::HandleUpdate(StringHash eventType, VariantMap& eventData)
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     float halfWidth = (float)graphics->GetWidth() * 0.5f * PIXEL_SIZE;
     float halfHeight = (float)graphics->GetHeight() * 0.5f * PIXEL_SIZE;
 

+ 17 - 17
Source/Samples/25_Urho2DParticle/Urho2DParticle.cpp

@@ -52,7 +52,7 @@ void Urho2DParticle::Start()
     Sample::Start();
 
     // Set mouse visible
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
 
     // Create the scene content
@@ -66,7 +66,7 @@ void Urho2DParticle::Start()
 
     // Hook up to the frame update events
     SubscribeToEvents();
-    
+
     // Set the mouse mode to use in the sample
     Sample::InitMouseMode(MM_FREE);
 }
@@ -81,38 +81,38 @@ void Urho2DParticle::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(1.2f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.2) is set for full visibility at 1280x800 resolution)
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    ParticleEffect2D* particleEffect = cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* particleEffect = cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex");
     if (!particleEffect)
         return;
 
     particleNode_ = scene_->CreateChild("ParticleEmitter2D");
-    ParticleEmitter2D* particleEmitter = particleNode_->CreateComponent<ParticleEmitter2D>();
+    auto* particleEmitter = particleNode_->CreateComponent<ParticleEmitter2D>();
     particleEmitter->SetEffect(particleEffect);
 
-    ParticleEffect2D* greenSpiralEffect = cache->GetResource<ParticleEffect2D>("Urho2D/greenspiral.pex");
+    auto* greenSpiralEffect = cache->GetResource<ParticleEffect2D>("Urho2D/greenspiral.pex");
     if (!greenSpiralEffect)
         return;
 
     Node* greenSpiralNode = scene_->CreateChild("GreenSpiral");
-    ParticleEmitter2D* greenSpiralEmitter = greenSpiralNode->CreateComponent<ParticleEmitter2D>();
+    auto* greenSpiralEmitter = greenSpiralNode->CreateComponent<ParticleEmitter2D>();
     greenSpiralEmitter->SetEffect(greenSpiralEffect);
 }
 
 void Urho2DParticle::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use mouse/touch to move the particle.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -124,7 +124,7 @@ void Urho2DParticle::CreateInstructions()
 
 void Urho2DParticle::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -146,10 +146,10 @@ void Urho2DParticle::HandleMouseMove(StringHash eventType, VariantMap& eventData
     if (particleNode_)
     {
         using namespace MouseMove;
-        float x = (float)eventData[P_X].GetInt();
-        float y = (float)eventData[P_Y].GetInt();
-        Graphics* graphics = GetSubsystem<Graphics>();
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto x = (float)eventData[P_X].GetInt();
+        auto y = (float)eventData[P_Y].GetInt();
+        auto* graphics = GetSubsystem<Graphics>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         particleNode_->SetPosition(camera->ScreenToWorldPoint(Vector3(x / graphics->GetWidth(), y / graphics->GetHeight(), 10.0f)));
     }
 }

+ 1 - 1
Source/Samples/26_ConsoleInput/ConsoleInput.cpp

@@ -77,7 +77,7 @@ void ConsoleInput::Start()
 
     // Show the console by default, make it large. Console will show the text edit field when there is at least one
     // subscriber for the console command event
-    Console* console = GetSubsystem<Console>();
+    auto* console = GetSubsystem<Console>();
     console->SetNumRows(GetSubsystem<Graphics>()->GetHeight() / 16);
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetCommandInterpreter(GetTypeName());

+ 18 - 18
Source/Samples/27_Urho2DPhysics/Urho2DPhysics.cpp

@@ -85,19 +85,19 @@ void Urho2DPhysics::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(1.2f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.2) is set for full visibility at 1280x800 resolution)
 
     // Create 2D physics world component
     /*PhysicsWorld2D* physicsWorld = */scene_->CreateComponent<PhysicsWorld2D>();
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sprite2D* boxSprite = cache->GetResource<Sprite2D>("Urho2D/Box.png");
-    Sprite2D* ballSprite = cache->GetResource<Sprite2D>("Urho2D/Ball.png");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* boxSprite = cache->GetResource<Sprite2D>("Urho2D/Box.png");
+    auto* ballSprite = cache->GetResource<Sprite2D>("Urho2D/Ball.png");
 
     // Create ground.
     Node* groundNode = scene_->CreateChild("Ground");
@@ -107,11 +107,11 @@ void Urho2DPhysics::CreateScene()
     // Create 2D rigid body for gound
     /*RigidBody2D* groundBody = */groundNode->CreateComponent<RigidBody2D>();
 
-    StaticSprite2D* groundSprite = groundNode->CreateComponent<StaticSprite2D>();
+    auto* groundSprite = groundNode->CreateComponent<StaticSprite2D>();
     groundSprite->SetSprite(boxSprite);
 
     // Create box collider for ground
-    CollisionBox2D* groundShape = groundNode->CreateComponent<CollisionBox2D>();
+    auto* groundShape = groundNode->CreateComponent<CollisionBox2D>();
     // Set box size
     groundShape->SetSize(Vector2(0.32f, 0.32f));
     // Set friction
@@ -123,17 +123,17 @@ void Urho2DPhysics::CreateScene()
         node->SetPosition(Vector3(Random(-0.1f, 0.1f), 5.0f + i * 0.4f, 0.0f));
 
         // Create rigid body
-        RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+        auto* body = node->CreateComponent<RigidBody2D>();
         body->SetBodyType(BT_DYNAMIC);
 
-        StaticSprite2D* staticSprite = node->CreateComponent<StaticSprite2D>();
+        auto* staticSprite = node->CreateComponent<StaticSprite2D>();
 
         if (i % 2 == 0)
         {
             staticSprite->SetSprite(boxSprite);
 
             // Create box
-            CollisionBox2D* box = node->CreateComponent<CollisionBox2D>();
+            auto* box = node->CreateComponent<CollisionBox2D>();
             // Set size
             box->SetSize(Vector2(0.32f, 0.32f));
             // Set density
@@ -148,7 +148,7 @@ void Urho2DPhysics::CreateScene()
             staticSprite->SetSprite(ballSprite);
 
             // Create circle
-            CollisionCircle2D* circle = node->CreateComponent<CollisionCircle2D>();
+            auto* circle = node->CreateComponent<CollisionCircle2D>();
             // Set radius
             circle->SetRadius(0.16f);
             // Set density
@@ -163,11 +163,11 @@ void Urho2DPhysics::CreateScene()
 
 void Urho2DPhysics::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys to move, use PageUp PageDown keys to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -179,7 +179,7 @@ void Urho2DPhysics::CreateInstructions()
 
 void Urho2DPhysics::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -192,7 +192,7 @@ void Urho2DPhysics::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -209,13 +209,13 @@ void Urho2DPhysics::MoveCamera(float timeStep)
 
     if (input->GetKeyDown(KEY_PAGEUP))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
 }

+ 17 - 17
Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.cpp

@@ -83,23 +83,23 @@ void Urho2DPhysicsRope::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 5.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * 0.05f);
     camera->SetZoom(1.5f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.5) is set for full visibility at 1280x800 resolution)
 
     // Create 2D physics world component
-    PhysicsWorld2D* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
     physicsWorld->SetDrawJoint(true);
 
     // Create ground
     Node* groundNode = scene_->CreateChild("Ground");
     // Create 2D rigid body for gound
-    RigidBody2D* groundBody = groundNode->CreateComponent<RigidBody2D>();
+    auto* groundBody = groundNode->CreateComponent<RigidBody2D>();
     // Create edge collider for ground
-    CollisionEdge2D* groundShape = groundNode->CreateComponent<CollisionEdge2D>();
+    auto* groundShape = groundNode->CreateComponent<CollisionEdge2D>();
     groundShape->SetVertices(Vector2(-40.0f, 0.0f), Vector2(40.0f, 0.0f));
 
     const float y = 15.0f;
@@ -110,11 +110,11 @@ void Urho2DPhysicsRope::CreateScene()
         Node* node  = scene_->CreateChild("RigidBody");
 
         // Create rigid body
-        RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+        auto* body = node->CreateComponent<RigidBody2D>();
         body->SetBodyType(BT_DYNAMIC);
 
         // Create box
-        CollisionBox2D* box = node->CreateComponent<CollisionBox2D>();
+        auto* box = node->CreateComponent<CollisionBox2D>();
         // Set friction
         box->SetFriction(0.2f);
         // Set mask bits.
@@ -136,7 +136,7 @@ void Urho2DPhysicsRope::CreateScene()
             box->SetCategoryBits(0x0001);
         }
 
-        ConstraintRevolute2D* joint = node->CreateComponent<ConstraintRevolute2D>();
+        auto* joint = node->CreateComponent<ConstraintRevolute2D>();
         joint->SetOtherBody(prevBody);
         joint->SetAnchor(Vector2(float(i), y));
         joint->SetCollideConnected(false);
@@ -144,7 +144,7 @@ void Urho2DPhysicsRope::CreateScene()
         prevBody = body;
     }
 
-    ConstraintRope2D* constraintRope = groundNode->CreateComponent<ConstraintRope2D>();
+    auto* constraintRope = groundNode->CreateComponent<ConstraintRope2D>();
     constraintRope->SetOtherBody(prevBody);
     constraintRope->SetOwnerBodyAnchor(Vector2(0.0f, y));
     constraintRope->SetMaxLength(NUM_OBJECTS - 1.0f + 0.01f);
@@ -152,11 +152,11 @@ void Urho2DPhysicsRope::CreateScene()
 
 void Urho2DPhysicsRope::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move, Use PageUp PageDown to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -168,7 +168,7 @@ void Urho2DPhysicsRope::CreateInstructions()
 
 void Urho2DPhysicsRope::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -181,7 +181,7 @@ void Urho2DPhysicsRope::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -198,13 +198,13 @@ void Urho2DPhysicsRope::MoveCamera(float timeStep)
 
     if (input->GetKeyDown(KEY_PAGEUP))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
 }
@@ -228,6 +228,6 @@ void Urho2DPhysicsRope::HandleUpdate(StringHash eventType, VariantMap& eventData
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
 
-    PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
     physicsWorld->DrawDebugGeometry();
 }

+ 5 - 5
Source/Samples/29_SoundSynthesis/SoundSynthesis.cpp

@@ -76,7 +76,7 @@ void SoundSynthesis::CreateSound()
 {
     // Sound source needs a node so that it is considered enabled
     node_ = new Node(context_);
-    SoundSource* source = node_->CreateComponent<SoundSource>();
+    auto* source = node_->CreateComponent<SoundSource>();
 
     soundStream_ = new BufferedSoundStream();
     // Set format: 44100 Hz, sixteen bit, mono
@@ -95,7 +95,7 @@ void SoundSynthesis::UpdateSound()
     if (requiredLength < 0.0f)
         return;
 
-    unsigned numSamples = (unsigned)(soundStream_->GetFrequency() * requiredLength);
+    auto numSamples = (unsigned)(soundStream_->GetFrequency() * requiredLength);
     if (!numSamples)
         return;
 
@@ -118,8 +118,8 @@ void SoundSynthesis::UpdateSound()
 
 void SoundSynthesis::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
     instructionText_ = ui->GetRoot()->CreateChild<Text>();
@@ -147,7 +147,7 @@ void SoundSynthesis::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
     // Use keys to control the filter constant
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyDown(KEY_UP))
         filter_ += timeStep * 0.5f;
     if (input->GetKeyDown(KEY_DOWN))

+ 12 - 12
Source/Samples/30_LightAnimation/LightAnimation.cpp

@@ -73,7 +73,7 @@ void LightAnimation::Start()
 
 void LightAnimation::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -88,13 +88,13 @@ void LightAnimation::CreateScene()
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a point light to the world so that we can see something.
     Node* lightNode = scene_->CreateChild("PointLight");
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetRange(10.0f);
 
@@ -161,7 +161,7 @@ void LightAnimation::CreateScene()
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     }
@@ -177,13 +177,13 @@ void LightAnimation::CreateScene()
 
 void LightAnimation::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
     instructionText->SetFont(font, 15);
 
     // Position the text relative to the screen center
@@ -192,21 +192,21 @@ void LightAnimation::CreateInstructions()
     instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
 
     // Animating text
-    Text* text = ui->GetRoot()->CreateChild<Text>("animatingText");
+    auto* text = ui->GetRoot()->CreateChild<Text>("animatingText");
     text->SetFont(font, 15);
     text->SetHorizontalAlignment(HA_CENTER);
     text->SetVerticalAlignment(VA_CENTER);
     text->SetPosition(0, ui->GetRoot()->GetHeight() / 4 + 20);
 
     // Animating sprite in the top left corner
-    Sprite* sprite = ui->GetRoot()->CreateChild<Sprite>("animatingSprite");
+    auto* sprite = ui->GetRoot()->CreateChild<Sprite>("animatingSprite");
     sprite->SetPosition(8, 8);
     sprite->SetSize(64, 64);
 }
 
 void LightAnimation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -221,7 +221,7 @@ void LightAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 10 - 10
Source/Samples/31_MaterialAnimation/MaterialAnimation.cpp

@@ -71,7 +71,7 @@ void MaterialAnimation::Start()
 
 void MaterialAnimation::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -86,7 +86,7 @@ void MaterialAnimation::CreateScene()
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
@@ -95,7 +95,7 @@ void MaterialAnimation::CreateScene()
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
@@ -104,7 +104,7 @@ void MaterialAnimation::CreateScene()
     // see the model get simpler as it moves further away). Finally, rendering a large number of the same object with the
     // same material allows instancing to be used, if the GPU supports it. This reduces the amount of CPU work in rendering the
     // scene.
-    Material* mushroomMat = cache->GetResource<Material>("Materials/Mushroom.xml");
+    auto* mushroomMat = cache->GetResource<Material>("Materials/Mushroom.xml");
     // Apply shader parameter animation to material
     SharedPtr<ValueAnimation> specColorAnimation(new ValueAnimation(context_));
     specColorAnimation->SetKeyFrame(0.0f, Color(0.1f, 0.1f, 0.1f, 16.0f));
@@ -122,7 +122,7 @@ void MaterialAnimation::CreateScene()
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(mushroomMat);
     }
@@ -138,11 +138,11 @@ void MaterialAnimation::CreateScene()
 
 void MaterialAnimation::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -154,7 +154,7 @@ void MaterialAnimation::CreateInstructions()
 
 void MaterialAnimation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -169,7 +169,7 @@ void MaterialAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 59 - 59
Source/Samples/32_Urho2DConstraints/Urho2DConstraints.cpp

@@ -98,7 +98,7 @@ void Urho2DConstraints::CreateScene()
     scene_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<DebugRenderer>();
-    PhysicsWorld2D* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>(); // Create 2D physics world component
+    auto* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>(); // Create 2D physics world component
     physicsWorld->SetDrawJoint(true); // Display the joints (Note that DrawDebugGeometry() must be set to true to acually draw the joints)
     drawDebug_ = true; // Set DrawDebugGeometry() to true
 
@@ -110,13 +110,13 @@ void Urho2DConstraints::CreateScene()
     camera_ = cameraNode_->CreateComponent<Camera>();
     camera_->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera_->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera_->SetZoom(1.2f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.2) is set for full visibility at 1280x800 resolution)
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera_));
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     renderer->SetViewport(0, viewport);
 
     Zone* zone = renderer->GetDefaultZone();
@@ -126,10 +126,10 @@ void Urho2DConstraints::CreateScene()
     for (unsigned i = 0; i<5; ++i)
     {
         Node* edgeNode = scene_->CreateChild("VerticalEdge");
-        RigidBody2D* edgeBody = edgeNode->CreateComponent<RigidBody2D>();
+        auto* edgeBody = edgeNode->CreateComponent<RigidBody2D>();
         if (!dummyBody)
             dummyBody = edgeBody; // Mark first edge as dummy body (used by mouse pick)
-        CollisionEdge2D* edgeShape = edgeNode->CreateComponent<CollisionEdge2D>();
+        auto* edgeShape = edgeNode->CreateComponent<CollisionEdge2D>();
         edgeShape->SetVertices(Vector2(i*2.5f -5.0f, -3.0f), Vector2(i*2.5f -5.0f, 3.0f));
         edgeShape->SetFriction(0.5f); // Set friction
     }
@@ -138,23 +138,23 @@ void Urho2DConstraints::CreateScene()
     {
         Node* edgeNode = scene_->CreateChild("HorizontalEdge");
         /*RigidBody2D* edgeBody = */edgeNode->CreateComponent<RigidBody2D>();
-        CollisionEdge2D* edgeShape = edgeNode->CreateComponent<CollisionEdge2D>();
+        auto* edgeShape = edgeNode->CreateComponent<CollisionEdge2D>();
         edgeShape->SetVertices(Vector2(-5.0f, j*2.0f -3.0f), Vector2(5.0f, j*2.0f -3.0f));
         edgeShape->SetFriction(0.5f); // Set friction
     }
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create a box (will be cloned later)
     Node* box  = scene_->CreateChild("Box");
     box->SetPosition(Vector3(0.8f, -2.0f, 0.0f));
-    StaticSprite2D* boxSprite = box->CreateComponent<StaticSprite2D>();
+    auto* boxSprite = box->CreateComponent<StaticSprite2D>();
     boxSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Box.png"));
-    RigidBody2D* boxBody = box->CreateComponent<RigidBody2D>();
+    auto* boxBody = box->CreateComponent<RigidBody2D>();
     boxBody->SetBodyType(BT_DYNAMIC);
     boxBody->SetLinearDamping(0.0f);
     boxBody->SetAngularDamping(0.0f);
-    CollisionBox2D* shape = box->CreateComponent<CollisionBox2D>(); // Create box shape
+    auto* shape = box->CreateComponent<CollisionBox2D>(); // Create box shape
     shape->SetSize(Vector2(0.32f, 0.32f)); // Set size
     shape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     shape->SetFriction(0.5f); // Set friction
@@ -163,13 +163,13 @@ void Urho2DConstraints::CreateScene()
     // Create a ball (will be cloned later)
     Node* ball  = scene_->CreateChild("Ball");
     ball->SetPosition(Vector3(1.8f, -2.0f, 0.0f));
-    StaticSprite2D* ballSprite = ball->CreateComponent<StaticSprite2D>();
+    auto* ballSprite = ball->CreateComponent<StaticSprite2D>();
     ballSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Ball.png"));
-    RigidBody2D* ballBody = ball->CreateComponent<RigidBody2D>();
+    auto* ballBody = ball->CreateComponent<RigidBody2D>();
     ballBody->SetBodyType(BT_DYNAMIC);
     ballBody->SetLinearDamping(0.0f);
     ballBody->SetAngularDamping(0.0f);
-    CollisionCircle2D* ballShape = ball->CreateComponent<CollisionCircle2D>(); // Create circle shape
+    auto* ballShape = ball->CreateComponent<CollisionCircle2D>(); // Create circle shape
     ballShape->SetRadius(0.16f); // Set radius
     ballShape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     ballShape->SetFriction(0.5f); // Set friction
@@ -179,11 +179,11 @@ void Urho2DConstraints::CreateScene()
     Node* polygon = scene_->CreateChild("Polygon");
     polygon->SetPosition(Vector3(1.6f, -2.0f, 0.0f));
     polygon->SetScale(0.7f);
-    StaticSprite2D* polygonSprite = polygon->CreateComponent<StaticSprite2D>();
+    auto* polygonSprite = polygon->CreateComponent<StaticSprite2D>();
     polygonSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
-    RigidBody2D* polygonBody = polygon->CreateComponent<RigidBody2D>();
+    auto* polygonBody = polygon->CreateComponent<RigidBody2D>();
     polygonBody->SetBodyType(BT_DYNAMIC);
-    CollisionPolygon2D* polygonShape = polygon->CreateComponent<CollisionPolygon2D>();
+    auto* polygonShape = polygon->CreateComponent<CollisionPolygon2D>();
     // TODO: create from PODVector<Vector2> using SetVertices()
     polygonShape->SetVertexCount(6); // Set number of vertices (mandatory when using SetVertex())
     polygonShape->SetVertex(0, Vector2(-0.8f, -0.3f));
@@ -200,11 +200,11 @@ void Urho2DConstraints::CreateScene()
     CreateFlag("ConstraintDistance2D", -4.97f, 3.0f); // Display Text3D flag
     Node* boxDistanceNode = box->Clone();
     Node* ballDistanceNode = ball->Clone();
-    RigidBody2D* ballDistanceBody = ballDistanceNode->GetComponent<RigidBody2D>();
+    auto* ballDistanceBody = ballDistanceNode->GetComponent<RigidBody2D>();
     boxDistanceNode->SetPosition(Vector3(-4.5f, 2.0f, 0.0f));
     ballDistanceNode->SetPosition(Vector3(-3.0f, 2.0f, 0.0f));
 
-    ConstraintDistance2D* constraintDistance = boxDistanceNode->CreateComponent<ConstraintDistance2D>(); // Apply ConstraintDistance2D to box
+    auto* constraintDistance = boxDistanceNode->CreateComponent<ConstraintDistance2D>(); // Apply ConstraintDistance2D to box
     constraintDistance->SetOtherBody(ballDistanceBody); // Constrain ball to box
     constraintDistance->SetOwnerBodyAnchor(boxDistanceNode->GetPosition2D());
     constraintDistance->SetOtherBodyAnchor(ballDistanceNode->GetPosition2D());
@@ -219,7 +219,7 @@ void Urho2DConstraints::CreateScene()
     boxFrictionNode->SetPosition(Vector3(0.5f, 0.0f, 0.0f));
     ballFrictionNode->SetPosition(Vector3(1.5f, 0.0f, 0.0f));
 
-    ConstraintFriction2D* constraintFriction = boxFrictionNode->CreateComponent<ConstraintFriction2D>(); // Apply ConstraintDistance2D to box
+    auto* constraintFriction = boxFrictionNode->CreateComponent<ConstraintFriction2D>(); // Apply ConstraintDistance2D to box
     constraintFriction->SetOtherBody(ballFrictionNode->GetComponent<RigidBody2D>()); // Constraint ball to box
     //constraintFriction->SetOwnerBodyAnchor(boxNode->GetPosition2D());
     //constraintFriction->SetOtherBodyAnchor(ballNode->GetPosition2D());
@@ -229,24 +229,24 @@ void Urho2DConstraints::CreateScene()
     // Create a ConstraintGear2D
     CreateFlag("ConstraintGear2D", -4.97f, -1.0f); // Display Text3D flag
     Node* baseNode = box->Clone();
-    RigidBody2D* tempBody = baseNode->GetComponent<RigidBody2D>(); // Get body to make it static
+    auto* tempBody = baseNode->GetComponent<RigidBody2D>(); // Get body to make it static
     tempBody->SetBodyType(BT_STATIC);
     baseNode->SetPosition(Vector3(-3.7f, -2.5f, 0.0f));
     Node* ball1Node = ball->Clone();
     ball1Node->SetPosition(Vector3(-4.5f, -2.0f, 0.0f));
-    RigidBody2D* ball1Body = ball1Node->GetComponent<RigidBody2D>();
+    auto* ball1Body = ball1Node->GetComponent<RigidBody2D>();
     Node* ball2Node = ball->Clone();
     ball2Node->SetPosition(Vector3(-3.0f, -2.0f, 0.0f));
-    RigidBody2D* ball2Body = ball2Node->GetComponent<RigidBody2D>();
+    auto* ball2Body = ball2Node->GetComponent<RigidBody2D>();
 
-    ConstraintRevolute2D* gear1 = baseNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to baseBox
+    auto* gear1 = baseNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to baseBox
     gear1->SetOtherBody(ball1Body); // Constrain ball1 to baseBox
     gear1->SetAnchor(ball1Node->GetPosition2D());
-    ConstraintRevolute2D* gear2 = baseNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to baseBox
+    auto* gear2 = baseNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to baseBox
     gear2->SetOtherBody(ball2Body); // Constrain ball2 to baseBox
     gear2->SetAnchor(ball2Node->GetPosition2D());
 
-    ConstraintGear2D* constraintGear = ball1Node->CreateComponent<ConstraintGear2D>(); // Apply constraint to ball1
+    auto* constraintGear = ball1Node->CreateComponent<ConstraintGear2D>(); // Apply constraint to ball1
     constraintGear->SetOtherBody(ball2Body); // Constrain ball2 to ball1
     constraintGear->SetOwnerConstraint(gear1);
     constraintGear->SetOtherConstraint(gear2);
@@ -259,14 +259,14 @@ void Urho2DConstraints::CreateScene()
     Node* car = box->Clone();
     car->SetScale(Vector3(4.0f, 1.0f, 0.0f));
     car->SetPosition(Vector3(-1.2f, -2.3f, 0.0f));
-    StaticSprite2D* tempSprite = car->GetComponent<StaticSprite2D>(); // Get car Sprite in order to draw it on top
+    auto* tempSprite = car->GetComponent<StaticSprite2D>(); // Get car Sprite in order to draw it on top
     tempSprite->SetOrderInLayer(0); // Draw car on top of the wheels (set to -1 to draw below)
     Node* ball1WheelNode = ball->Clone();
     ball1WheelNode->SetPosition(Vector3(-1.6f, -2.5f, 0.0f));
     Node* ball2WheelNode = ball->Clone();
     ball2WheelNode->SetPosition(Vector3(-0.8f, -2.5f, 0.0f));
 
-    ConstraintWheel2D* wheel1 = car->CreateComponent<ConstraintWheel2D>();
+    auto* wheel1 = car->CreateComponent<ConstraintWheel2D>();
     wheel1->SetOtherBody(ball1WheelNode->GetComponent<RigidBody2D>());
     wheel1->SetAnchor(ball1WheelNode->GetPosition2D());
     wheel1->SetAxis(Vector2(0.0f, 1.0f));
@@ -274,7 +274,7 @@ void Urho2DConstraints::CreateScene()
     wheel1->SetFrequencyHz(4.0f);
     wheel1->SetDampingRatio(0.4f);
 
-    ConstraintWheel2D* wheel2 = car->CreateComponent<ConstraintWheel2D>();
+    auto* wheel2 = car->CreateComponent<ConstraintWheel2D>();
     wheel2->SetOtherBody(ball2WheelNode->GetComponent<RigidBody2D>());
     wheel2->SetAnchor(ball2WheelNode->GetPosition2D());
     wheel2->SetAxis(Vector2(0.0f, 1.0f));
@@ -291,7 +291,7 @@ void Urho2DConstraints::CreateScene()
     boxMotorNode->SetPosition(Vector3(3.8f, -2.1f, 0.0f));
     ballMotorNode->SetPosition(Vector3(3.8f, -1.5f, 0.0f));
 
-    ConstraintMotor2D* constraintMotor = boxMotorNode->CreateComponent<ConstraintMotor2D>();
+    auto* constraintMotor = boxMotorNode->CreateComponent<ConstraintMotor2D>();
     constraintMotor->SetOtherBody(ballMotorNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintMotor->SetLinearOffset(Vector2(0.0f, 0.8f)); // Set ballNode position relative to boxNode position = (0,0)
     constraintMotor->SetAngularOffset(0.1f);
@@ -312,7 +312,7 @@ void Urho2DConstraints::CreateScene()
     boxPrismaticNode->SetPosition(Vector3(3.3f, 2.5f, 0.0f));
     ballPrismaticNode->SetPosition(Vector3(4.3f, 2.0f, 0.0f));
 
-    ConstraintPrismatic2D* constraintPrismatic = boxPrismaticNode->CreateComponent<ConstraintPrismatic2D>();
+    auto* constraintPrismatic = boxPrismaticNode->CreateComponent<ConstraintPrismatic2D>();
     constraintPrismatic->SetOtherBody(ballPrismaticNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintPrismatic->SetAxis(Vector2(1.0f, 1.0f)); // Slide from [0,0] to [1,1]
     constraintPrismatic->SetAnchor(Vector2(4.0f, 2.0f));
@@ -329,7 +329,7 @@ void Urho2DConstraints::CreateScene()
     boxPulleyNode->SetPosition(Vector3(0.5f, 2.0f, 0.0f));
     ballPulleyNode->SetPosition(Vector3(2.0f, 2.0f, 0.0f));
 
-    ConstraintPulley2D* constraintPulley = boxPulleyNode->CreateComponent<ConstraintPulley2D>(); // Apply constraint to box
+    auto* constraintPulley = boxPulleyNode->CreateComponent<ConstraintPulley2D>(); // Apply constraint to box
     constraintPulley->SetOtherBody(ballPulleyNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintPulley->SetOwnerBodyAnchor(boxPulleyNode->GetPosition2D());
     constraintPulley->SetOtherBodyAnchor(ballPulleyNode->GetPosition2D());
@@ -346,7 +346,7 @@ void Urho2DConstraints::CreateScene()
     boxRevoluteNode->SetPosition(Vector3(-2.0f, 1.5f, 0.0f));
     ballRevoluteNode->SetPosition(Vector3(-1.0f, 2.0f, 0.0f));
 
-    ConstraintRevolute2D* constraintRevolute = boxRevoluteNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to box
+    auto* constraintRevolute = boxRevoluteNode->CreateComponent<ConstraintRevolute2D>(); // Apply constraint to box
     constraintRevolute->SetOtherBody(ballRevoluteNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintRevolute->SetAnchor(Vector2(-1.0f, 1.5f));
     constraintRevolute->SetLowerAngle(-1.0f); // In radians
@@ -365,7 +365,7 @@ void Urho2DConstraints::CreateScene()
     boxRopeNode->SetPosition(Vector3(-3.7f, 0.7f, 0.0f));
     ballRopeNode->SetPosition(Vector3(-4.5f, 0.0f, 0.0f));
 
-    ConstraintRope2D* constraintRope = boxRopeNode->CreateComponent<ConstraintRope2D>();
+    auto* constraintRope = boxRopeNode->CreateComponent<ConstraintRope2D>();
     constraintRope->SetOtherBody(ballRopeNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintRope->SetOwnerBodyAnchor(Vector2(0.0f, -0.5f)); // Offset from box (OwnerBody) : the rope is rigid from OwnerBody center to this ownerBodyAnchor
     constraintRope->SetMaxLength(0.9f); // Rope length
@@ -378,7 +378,7 @@ void Urho2DConstraints::CreateScene()
     boxWeldNode->SetPosition(Vector3(-0.5f, 0.0f, 0.0f));
     ballWeldNode->SetPosition(Vector3(-2.0f, 0.0f, 0.0f));
 
-    ConstraintWeld2D* constraintWeld = boxWeldNode->CreateComponent<ConstraintWeld2D>();
+    auto* constraintWeld = boxWeldNode->CreateComponent<ConstraintWeld2D>();
     constraintWeld->SetOtherBody(ballWeldNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintWeld->SetAnchor(boxWeldNode->GetPosition2D());
     constraintWeld->SetFrequencyHz(4.0f);
@@ -391,7 +391,7 @@ void Urho2DConstraints::CreateScene()
     boxWheelNode->SetPosition(Vector3(3.8f, 0.0f, 0.0f));
     ballWheelNode->SetPosition(Vector3(3.8f, 0.9f, 0.0f));
 
-    ConstraintWheel2D* constraintWheel = boxWheelNode->CreateComponent<ConstraintWheel2D>();
+    auto* constraintWheel = boxWheelNode->CreateComponent<ConstraintWheel2D>();
     constraintWheel->SetOtherBody(ballWheelNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintWheel->SetAnchor(ballWheelNode->GetPosition2D());
     constraintWheel->SetAxis(Vector2(0.0f, 1.0f));
@@ -407,19 +407,19 @@ void Urho2DConstraints::CreateFlag(const String& text, float x, float y) // Used
 {
     Node* flagNode = scene_->CreateChild("Flag");
     flagNode->SetPosition(Vector3(x, y, 0.0f));
-    Text3D* flag3D = flagNode->CreateComponent<Text3D>(); // We use Text3D in order to make the text affected by zoom (so that it sticks to 2D)
+    auto* flag3D = flagNode->CreateComponent<Text3D>(); // We use Text3D in order to make the text affected by zoom (so that it sticks to 2D)
     flag3D->SetText(text);
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     flag3D->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 }
 
 void Urho2DConstraints::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse to move, Use PageUp PageDown to zoom.\n Space to toggle debug geometry and joints - F5 to save the scene.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
@@ -436,7 +436,7 @@ void Urho2DConstraints::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -486,7 +486,7 @@ void Urho2DConstraints::HandleUpdate(StringHash eventType, VariantMap& eventData
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Toggle physics debug geometry with space
     if (input->GetKeyPress(KEY_SPACE))
@@ -502,24 +502,24 @@ void Urho2DConstraints::HandleUpdate(StringHash eventType, VariantMap& eventData
 
 void Urho2DConstraints::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
 {
-    PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
     if (drawDebug_) physicsWorld->DrawDebugGeometry();
 }
 
 void Urho2DConstraints::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 {
-    Input* input = GetSubsystem<Input>();
-    PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+    auto* input = GetSubsystem<Input>();
+    auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
     RigidBody2D* rigidBody = physicsWorld->GetRigidBody(input->GetMousePosition().x_, input->GetMousePosition().y_); // Raycast for RigidBody2Ds to pick
     if (rigidBody)
     {
         pickedNode = rigidBody->GetNode();
         //log.Info(pickedNode.name);
-        StaticSprite2D* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
+        auto* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
         staticSprite->SetColor(Color(1.0f, 0.0f, 0.0f, 1.0f)); // Temporary modify color of the picked sprite
 
         // Create a ConstraintMouse2D - Temporary apply this constraint to the pickedNode to allow grasping and moving with the mouse
-        ConstraintMouse2D* constraintMouse = pickedNode->CreateComponent<ConstraintMouse2D>();
+        auto* constraintMouse = pickedNode->CreateComponent<ConstraintMouse2D>();
         constraintMouse->SetTarget(GetMousePositionXY());
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
         constraintMouse->SetCollideConnected(true);
@@ -533,7 +533,7 @@ void Urho2DConstraints::HandleMouseButtonUp(StringHash eventType, VariantMap& ev
 {
     if (pickedNode)
     {
-        StaticSprite2D* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
+        auto* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
@@ -545,8 +545,8 @@ void Urho2DConstraints::HandleMouseButtonUp(StringHash eventType, VariantMap& ev
 
 Vector2 Urho2DConstraints::GetMousePositionXY()
 {
-    Input* input = GetSubsystem<Input>();
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* input = GetSubsystem<Input>();
+    auto* graphics = GetSubsystem<Graphics>();
     Vector3 screenPoint = Vector3((float)input->GetMousePosition().x_ / graphics->GetWidth(), (float)input->GetMousePosition().y_ / graphics->GetHeight(), 0.0f);
     Vector3 worldPoint = camera_->ScreenToWorldPoint(screenPoint);
     return Vector2(worldPoint.x_, worldPoint.y_);
@@ -556,26 +556,26 @@ void Urho2DConstraints::HandleMouseMove(StringHash eventType, VariantMap& eventD
 {
     if (pickedNode)
     {
-        ConstraintMouse2D* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
+        auto* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
         constraintMouse->SetTarget(GetMousePositionXY());
     }
 }
 
 void Urho2DConstraints::HandleTouchBegin3(StringHash eventType, VariantMap& eventData)
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
-    PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
     using namespace TouchBegin;
     RigidBody2D* rigidBody = physicsWorld->GetRigidBody(eventData[P_X].GetInt(), eventData[P_Y].GetInt()); // Raycast for RigidBody2Ds to pick
     if (rigidBody)
     {
         pickedNode = rigidBody->GetNode();
-        StaticSprite2D* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
+        auto* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
         staticSprite->SetColor(Color(1.0f, 0.0f, 0.0f, 1.0f)); // Temporary modify color of the picked sprite
-        RigidBody2D* rigidBody = pickedNode->GetComponent<RigidBody2D>();
+        auto* rigidBody = pickedNode->GetComponent<RigidBody2D>();
 
         // Create a ConstraintMouse2D - Temporary apply this constraint to the pickedNode to allow grasping and moving with touch
-        ConstraintMouse2D* constraintMouse = pickedNode->CreateComponent<ConstraintMouse2D>();
+        auto* constraintMouse = pickedNode->CreateComponent<ConstraintMouse2D>();
         Vector3 pos = camera_->ScreenToWorldPoint(Vector3((float)eventData[P_X].GetInt() / graphics->GetWidth(), (float)eventData[P_Y].GetInt() / graphics->GetHeight(), 0.0f));
         constraintMouse->SetTarget(Vector2(pos.x_, pos.y_));
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
@@ -591,8 +591,8 @@ void Urho2DConstraints::HandleTouchMove3(StringHash eventType, VariantMap& event
 {
     if (pickedNode)
     {
-        Graphics* graphics = GetSubsystem<Graphics>();
-        ConstraintMouse2D* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
+        auto* graphics = GetSubsystem<Graphics>();
+        auto* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
         using namespace TouchMove;
         Vector3 pos = camera_->ScreenToWorldPoint(Vector3(float(eventData[P_X].GetInt()) / graphics->GetWidth(), float(eventData[P_Y].GetInt()) / graphics->GetHeight(), 0.0f));
         constraintMouse->SetTarget(Vector2(pos.x_, pos.y_));
@@ -603,7 +603,7 @@ void Urho2DConstraints::HandleTouchEnd3(StringHash eventType, VariantMap& eventD
 {
     if (pickedNode)
     {
-        StaticSprite2D* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
+        auto* staticSprite = pickedNode->GetComponent<StaticSprite2D>();
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint

+ 13 - 13
Source/Samples/33_Urho2DSpriterAnimation/Urho2DSpriterAnimation.cpp

@@ -78,31 +78,31 @@ void Urho2DSpriterAnimation::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(1.5f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.5) is set for full visibility at 1280x800 resolution)
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    AnimationSet2D* spriterAnimationSet = cache->GetResource<AnimationSet2D>("Urho2D/imp/imp.scml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* spriterAnimationSet = cache->GetResource<AnimationSet2D>("Urho2D/imp/imp.scml");
     if (!spriterAnimationSet)
         return;
 
     spriterNode_ = scene_->CreateChild("SpriterAnimation");
-    AnimatedSprite2D* spriterAnimatedSprite = spriterNode_->CreateComponent<AnimatedSprite2D>();
+    auto* spriterAnimatedSprite = spriterNode_->CreateComponent<AnimatedSprite2D>();
     spriterAnimatedSprite->SetAnimationSet(spriterAnimationSet);
     spriterAnimatedSprite->SetAnimation(spriterAnimationSet->GetAnimation(spriterAnimationIndex_));
 }
 
 void Urho2DSpriterAnimation::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Mouse click to play next animation, \nUse WASD keys to move, use PageUp PageDown keys to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
@@ -115,7 +115,7 @@ void Urho2DSpriterAnimation::CreateInstructions()
 
 void Urho2DSpriterAnimation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -128,7 +128,7 @@ void Urho2DSpriterAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -145,13 +145,13 @@ void Urho2DSpriterAnimation::MoveCamera(float timeStep)
 
     if (input->GetKeyDown(KEY_PAGEUP))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
 }
@@ -179,7 +179,7 @@ void Urho2DSpriterAnimation::HandleUpdate(StringHash eventType, VariantMap& even
 
 void Urho2DSpriterAnimation::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 {
-    AnimatedSprite2D* spriterAnimatedSprite = spriterNode_->GetComponent<AnimatedSprite2D>();
+    auto* spriterAnimatedSprite = spriterNode_->GetComponent<AnimatedSprite2D>();
     AnimationSet2D* spriterAnimationSet = spriterAnimatedSprite->GetAnimationSet();
     spriterAnimationIndex_ = (spriterAnimationIndex_ + 1) % spriterAnimationSet->GetNumAnimations();
     spriterAnimatedSprite->SetAnimation(spriterAnimationSet->GetAnimation(spriterAnimationIndex_), LM_FORCE_LOOPED);

+ 15 - 15
Source/Samples/34_DynamicGeometry/DynamicGeometry.cpp

@@ -78,7 +78,7 @@ void DynamicGeometry::Start()
 
 void DynamicGeometry::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -88,7 +88,7 @@ void DynamicGeometry::CreateScene()
 
     // Create a Zone for ambient light & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogStart(200.0f);
@@ -97,13 +97,13 @@ void DynamicGeometry::CreateScene()
     // Create a directional light
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(-0.6f, -1.0f, -0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.4f, 1.0f, 0.4f));
     light->SetSpecularIntensity(1.5f);
 
     // Get the original model and its unmodified vertices, which are used as source data for the animation
-    Model* originalModel = cache->GetResource<Model>("Models/Box.mdl");
+    auto* originalModel = cache->GetResource<Model>("Models/Box.mdl");
     if (!originalModel)
     {
         URHO3D_LOGERROR("Model not found, cannot initialize example scene");
@@ -111,7 +111,7 @@ void DynamicGeometry::CreateScene()
     }
     // Get the vertex buffer from the first geometry's first LOD level
     VertexBuffer* buffer = originalModel->GetGeometry(0, 0)->GetVertexBuffer(0);
-    const unsigned char* vertexData = (const unsigned char*)buffer->Lock(0, buffer->GetVertexCount());
+    const auto* vertexData = (const unsigned char*)buffer->Lock(0, buffer->GetVertexCount());
     if (vertexData)
     {
         unsigned numVertices = buffer->GetVertexCount();
@@ -152,7 +152,7 @@ void DynamicGeometry::CreateScene()
         {
             Node* node = scene_->CreateChild("Object");
             node->SetPosition(Vector3(x * 2.0f, 0.0f, y * 2.0f));
-            StaticModel* object = node->CreateComponent<StaticModel>();
+            auto* object = node->CreateComponent<StaticModel>();
             SharedPtr<Model> cloneModel = originalModel->Clone();
             object->SetModel(cloneModel);
             // Store the cloned vertex buffer that we will modify when animating
@@ -258,24 +258,24 @@ void DynamicGeometry::CreateScene()
 
         Node* node = scene_->CreateChild("FromScratchObject");
         node->SetPosition(Vector3(0.0f, 3.0f, 0.0f));
-        StaticModel* object = node->CreateComponent<StaticModel>();
+        auto* object = node->CreateComponent<StaticModel>();
         object->SetModel(fromScratchModel);
     }
 
     // Create the camera
     cameraNode_ = new Node(context_);
     cameraNode_->SetPosition(Vector3(0.0f, 2.0f, -20.0f));
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 }
 
 void DynamicGeometry::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle animation"
@@ -292,7 +292,7 @@ void DynamicGeometry::CreateInstructions()
 
 void DynamicGeometry::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -311,7 +311,7 @@ void DynamicGeometry::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
@@ -352,7 +352,7 @@ void DynamicGeometry::AnimateObjects(float timeStep)
 
         // Lock the vertex buffer for update and rewrite positions with sine wave modulated ones
         // Cannot use discard lock as there is other data (normals, UVs) that we are not overwriting
-        unsigned char* vertexData = (unsigned char*)buffer->Lock(0, buffer->GetVertexCount());
+        auto* vertexData = (unsigned char*)buffer->Lock(0, buffer->GetVertexCount());
         if (vertexData)
         {
             unsigned vertexSize = buffer->GetVertexSize();
@@ -381,7 +381,7 @@ void DynamicGeometry::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
     // Toggle animation with space
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_SPACE))
         animate_ = !animate_;
 

+ 10 - 10
Source/Samples/35_SignedDistanceFieldText/SignedDistanceFieldText.cpp

@@ -71,7 +71,7 @@ void SignedDistanceFieldText::Start()
 
 void SignedDistanceFieldText::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -86,7 +86,7 @@ void SignedDistanceFieldText::CreateScene()
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
@@ -95,7 +95,7 @@ void SignedDistanceFieldText::CreateScene()
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
@@ -110,13 +110,13 @@ void SignedDistanceFieldText::CreateScene()
         Node* mushroomNode = scene_->CreateChild("Mushroom");
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+        auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
         mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
 
         Node* mushroomTitleNode = mushroomNode->CreateChild("MushroomTitle");
         mushroomTitleNode->SetPosition(Vector3(0.0f, 1.2f, 0.0f));
-        Text3D* mushroomTitleText = mushroomTitleNode->CreateComponent<Text3D>();
+        auto* mushroomTitleText = mushroomTitleNode->CreateComponent<Text3D>();
         mushroomTitleText->SetText("Mushroom " + String(i));
         mushroomTitleText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
@@ -149,11 +149,11 @@ void SignedDistanceFieldText::CreateScene()
 
 void SignedDistanceFieldText::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -165,7 +165,7 @@ void SignedDistanceFieldText::CreateInstructions()
 
 void SignedDistanceFieldText::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -180,7 +180,7 @@ void SignedDistanceFieldText::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 18 - 18
Source/Samples/36_Urho2DTileMap/Urho2DTileMap.cpp

@@ -81,23 +81,23 @@ void Urho2DTileMap::CreateScene()
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(1.0f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (1.0) is set for full visibility at 1280x800 resolution)
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     // Get tmx file
-    TmxFile2D* tmxFile = cache->GetResource<TmxFile2D>("Urho2D/isometric_grass_and_water.tmx");
+    auto* tmxFile = cache->GetResource<TmxFile2D>("Urho2D/isometric_grass_and_water.tmx");
     if (!tmxFile)
         return;
 
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
     tileMapNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
 
-    TileMap2D* tileMap = tileMapNode->CreateComponent<TileMap2D>();
+    auto* tileMap = tileMapNode->CreateComponent<TileMap2D>();
     // Set animation
     tileMap->SetTmxFile(tmxFile);
 
@@ -110,11 +110,11 @@ void Urho2DTileMap::CreateScene()
 
 void Urho2DTileMap::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys to move, use PageUp PageDown keys to zoom.\n LMB to remove a tile, RMB to swap grass and water.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -126,7 +126,7 @@ void Urho2DTileMap::CreateInstructions()
 
 void Urho2DTileMap::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -139,7 +139,7 @@ void Urho2DTileMap::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
@@ -156,13 +156,13 @@ void Urho2DTileMap::MoveCamera(float timeStep)
 
     if (input->GetKeyDown(KEY_PAGEUP))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
 }
@@ -192,10 +192,10 @@ void Urho2DTileMap::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 {
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     Node* tileMapNode = scene_->GetChild("TileMap", true);
-    TileMap2D* map = tileMapNode->GetComponent<TileMap2D>();
+    auto* map = tileMapNode->GetComponent<TileMap2D>();
     TileMapLayer2D* layer = map->GetLayer(0);
 
     Vector2 pos = GetMousePositionXY();
@@ -206,7 +206,7 @@ void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& even
         Node* n = layer->GetTileNode(x, y);
         if (!n)
             return;
-        StaticSprite2D* sprite = n->GetComponent<StaticSprite2D>();
+        auto* sprite = n->GetComponent<StaticSprite2D>();
 
         if (input->GetMouseButtonDown(MOUSEB_RIGHT))
         {
@@ -221,9 +221,9 @@ void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& even
 
 Vector2 Urho2DTileMap::GetMousePositionXY()
 {
-    Input* input = GetSubsystem<Input>();
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* camera = cameraNode_->GetComponent<Camera>();
+    auto* input = GetSubsystem<Input>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* camera = cameraNode_->GetComponent<Camera>();
     Vector3 screenPoint = Vector3((float)input->GetMousePosition().x_ / graphics->GetWidth(), (float)input->GetMousePosition().y_ / graphics->GetHeight(), 10.0f);
     Vector3 worldPoint = camera->ScreenToWorldPoint(screenPoint);
     return Vector2(worldPoint.x_, worldPoint.y_);

+ 17 - 17
Source/Samples/37_UIDrag/UIDrag.cpp

@@ -60,8 +60,8 @@ void UIDrag::Start()
 
 void UIDrag::CreateGUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     UIElement* root = ui->GetRoot();
     // Load the style sheet from xml
@@ -69,7 +69,7 @@ void UIDrag::CreateGUI()
 
     for (int i=0; i < 10; i++)
     {
-        Button* b = new Button(context_);
+        auto* b = new Button(context_);
         root->AddChild(b);
         // Reference a style from the style sheet loaded earlier:
         b->SetStyle("Button");
@@ -85,7 +85,7 @@ void UIDrag::CreateGUI()
         SubscribeToEvent(b, E_DRAGEND, URHO3D_HANDLER(UIDrag, HandleDragEnd));
 
         {
-            Text* t = new Text(context_);
+            auto* t = new Text(context_);
             b->AddChild(t);
             t->SetStyle("Text");
             t->SetHorizontalAlignment(HA_CENTER);
@@ -94,7 +94,7 @@ void UIDrag::CreateGUI()
         }
 
         {
-            Text* t = new Text(context_);
+            auto* t = new Text(context_);
             b->AddChild(t);
             t->SetStyle("Text");
             t->SetName("Event Touch");
@@ -103,7 +103,7 @@ void UIDrag::CreateGUI()
         }
 
         {
-            Text* t = new Text(context_);
+            auto* t = new Text(context_);
             b->AddChild(t);
             t->SetStyle("Text");
             t->SetName("Num Touch");
@@ -114,7 +114,7 @@ void UIDrag::CreateGUI()
 
     for (int i = 0; i < 10; i++)
     {
-        Text* t = new Text(context_);
+        auto* t = new Text(context_);
         root->AddChild(t);
         t->SetStyle("Text");
         t->SetName("Touch "+ String(i));
@@ -124,11 +124,11 @@ void UIDrag::CreateGUI()
 
 void UIDrag::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Drag on the buttons to move them around.\n"
                              "Touch input allows also multi-drag.\n"
                              "Press SPACE to show/hide tagged UI elements.");
@@ -149,7 +149,7 @@ void UIDrag::SubscribeToEvents()
 void UIDrag::HandleDragBegin(StringHash eventType, VariantMap& eventData)
 {
     using namespace DragBegin;
-    Button* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
+    auto* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
 
     int lx = eventData[P_X].GetInt();
     int ly = eventData[P_Y].GetInt();
@@ -171,7 +171,7 @@ void UIDrag::HandleDragBegin(StringHash eventType, VariantMap& eventData)
 void UIDrag::HandleDragMove(StringHash eventType, VariantMap& eventData)
 {
     using namespace DragBegin;
-    Button* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
+    auto* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
     int buttons = eventData[P_BUTTONS].GetInt();
     IntVector2 d = element->GetVar("DELTA").GetIntVector2();
     int X = eventData[P_X].GetInt() + d.x_;
@@ -188,7 +188,7 @@ void UIDrag::HandleDragMove(StringHash eventType, VariantMap& eventData)
 void UIDrag::HandleDragCancel(StringHash eventType, VariantMap& eventData)
 {
     using namespace DragBegin;
-    Button* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
+    auto* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
     IntVector2 P = element->GetVar("START").GetIntVector2();
     element->SetPosition(P);
 }
@@ -196,15 +196,15 @@ void UIDrag::HandleDragCancel(StringHash eventType, VariantMap& eventData)
 void UIDrag::HandleDragEnd(StringHash eventType, VariantMap& eventData)
 {
     using namespace DragBegin;
-    Button* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
+    auto* element = (Button*)eventData[P_ELEMENT].GetVoidPtr();
 }
 
 void UIDrag::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* root = ui->GetRoot();
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     unsigned n = input->GetNumTouches();
     for (unsigned i = 0; i < n; i++)
@@ -225,7 +225,7 @@ void UIDrag::HandleUpdate(StringHash eventType, VariantMap& eventData)
         Text* t = (Text*)root->GetChild("Touch " + String(i));
         t->SetVisible(false);
     }
-    
+
     if (input->GetKeyPress(KEY_SPACE))
     {
         PODVector<UIElement*> elements;

+ 9 - 9
Source/Samples/38_SceneAndUILoad/SceneAndUILoad.cpp

@@ -65,7 +65,7 @@ void SceneAndUILoad::Start()
 
 void SceneAndUILoad::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -84,11 +84,11 @@ void SceneAndUILoad::CreateScene()
 
 void SceneAndUILoad::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Set up global UI style into the root UI element
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     ui->GetRoot()->SetDefaultStyle(style);
 
     // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
@@ -97,7 +97,7 @@ void SceneAndUILoad::CreateUI()
     cursor->SetStyleAuto();
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     // Load UI content prepared in the editor and add to the UI hierarchy
@@ -105,7 +105,7 @@ void SceneAndUILoad::CreateUI()
     ui->GetRoot()->AddChild(layoutRoot);
 
     // Subscribe to button actions (toggle scene lights when pressed then released)
-    Button* button = layoutRoot->GetChildStaticCast<Button>("ToggleLight1", true);
+    auto* button = layoutRoot->GetChildStaticCast<Button>("ToggleLight1", true);
     if (button)
         SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(SceneAndUILoad, ToggleLight1));
     button = layoutRoot->GetChildStaticCast<Button>("ToggleLight2", true);
@@ -115,7 +115,7 @@ void SceneAndUILoad::CreateUI()
 
 void SceneAndUILoad::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -131,8 +131,8 @@ void SceneAndUILoad::SubscribeToEvents()
 void SceneAndUILoad::MoveCamera(float timeStep)
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Do not move if the UI has a focused element

+ 42 - 42
Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp

@@ -83,7 +83,7 @@ void CrowdNavigation::Start()
 
 void CrowdNavigation::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -95,13 +95,13 @@ void CrowdNavigation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
@@ -111,7 +111,7 @@ void CrowdNavigation::CreateScene()
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -126,7 +126,7 @@ void CrowdNavigation::CreateScene()
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
@@ -135,7 +135,7 @@ void CrowdNavigation::CreateScene()
     }
 
     // Create a DynamicNavigationMesh component to the scene root
-    DynamicNavigationMesh* navMesh = scene_->CreateComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->CreateComponent<DynamicNavigationMesh>();
     // Set small tiles to show navigation mesh streaming
     navMesh->SetTileSize(32);
     // Enable drawing debug geometry for obstacles and off-mesh connections
@@ -166,7 +166,7 @@ void CrowdNavigation::CreateScene()
         CreateMushroom(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
 
     // Create a CrowdManager component to the scene root
-    CrowdManager* crowdManager = scene_->CreateComponent<CrowdManager>();
+    auto* crowdManager = scene_->CreateComponent<CrowdManager>();
     CrowdObstacleAvoidanceParams params = crowdManager->GetObstacleAvoidanceParams(0);
     // Set the params to "High (66)" setting
     params.velBias = 0.5f;
@@ -184,7 +184,7 @@ void CrowdNavigation::CreateScene()
     // Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside the scene, because
     // we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
 
     // Set an initial position for the camera scene node above the plane and looking down
@@ -195,22 +195,22 @@ void CrowdNavigation::CreateScene()
 
 void CrowdNavigation::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
     // control the camera, and when visible, it will point the raycast target
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
 
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>(INSTRUCTION);
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>(INSTRUCTION);
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
@@ -232,7 +232,7 @@ void CrowdNavigation::CreateUI()
 
 void CrowdNavigation::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -260,17 +260,17 @@ void CrowdNavigation::SubscribeToEvents()
 
 void CrowdNavigation::SpawnJack(const Vector3& pos, Node* jackGroup)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SharedPtr<Node> jackNode(jackGroup->CreateChild("Jack"));
     jackNode->SetPosition(pos);
-    AnimatedModel* modelObject = jackNode->CreateComponent<AnimatedModel>();
+    auto* modelObject = jackNode->CreateComponent<AnimatedModel>();
     modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetCastShadows(true);
     jackNode->CreateComponent<AnimationController>();
 
     // Create a CrowdAgent component and set its height and realistic max speed/acceleration. Use default radius
-    CrowdAgent* agent = jackNode->CreateComponent<CrowdAgent>();
+    auto* agent = jackNode->CreateComponent<CrowdAgent>();
     agent->SetHeight(2.0f);
     agent->SetMaxSpeed(3.0f);
     agent->SetMaxAccel(5.0f);
@@ -278,19 +278,19 @@ void CrowdNavigation::SpawnJack(const Vector3& pos, Node* jackGroup)
 
 void CrowdNavigation::CreateMushroom(const Vector3& pos)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     mushroomNode->SetPosition(pos);
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetScale(2.0f + Random(0.5f));
-    StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
+    auto* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
     mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetCastShadows(true);
 
     // Create the navigation Obstacle component and set its height & radius proportional to scale
-    Obstacle* obstacle = mushroomNode->CreateComponent<Obstacle>();
+    auto* obstacle = mushroomNode->CreateComponent<Obstacle>();
     obstacle->SetRadius(mushroomNode->GetScale().x_);
     obstacle->SetHeight(mushroomNode->GetScale().y_);
 }
@@ -311,18 +311,18 @@ void CrowdNavigation::CreateBoxOffMeshConnections(DynamicNavigationMesh* navMesh
         connectionEnd->SetWorldPosition(navMesh->FindNearestPoint(boxPos + Vector3(boxHalfSize, boxHalfSize, 0))); // Top of box
 
         // Create the OffMeshConnection component to one node and link the other node
-        OffMeshConnection* connection = connectionStart->CreateComponent<OffMeshConnection>();
+        auto* connection = connectionStart->CreateComponent<OffMeshConnection>();
         connection->SetEndPoint(connectionEnd);
     }
 }
 
 void CrowdNavigation::CreateMovingBarrels(DynamicNavigationMesh* navMesh)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* barrel = scene_->CreateChild("Barrel");
-    StaticModel* model = barrel->CreateComponent<StaticModel>();
+    auto* model = barrel->CreateComponent<StaticModel>();
     model->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
-    Material* material = cache->GetResource<Material>("Materials/StoneTiled.xml");
+    auto* material = cache->GetResource<Material>("Materials/StoneTiled.xml");
     model->SetMaterial(material);
     material->SetTexture(TU_DIFFUSE, cache->GetResource<Texture2D>("Textures/TerrainDetail2.dds"));
     model->SetCastShadows(true);
@@ -332,7 +332,7 @@ void CrowdNavigation::CreateMovingBarrels(DynamicNavigationMesh* navMesh)
         float size = 0.5f + Random(1.0f);
         clone->SetScale(Vector3(size / 1.5f, size * 2.0f, size / 1.5f));
         clone->SetPosition(navMesh->FindNearestPoint(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f)));
-        CrowdAgent* agent = clone->CreateComponent<CrowdAgent>();
+        auto* agent = clone->CreateComponent<CrowdAgent>();
         agent->SetRadius(clone->GetScale().x_ * 0.5f);
         agent->SetHeight(size);
         agent->SetNavigationQuality(NAVIGATIONQUALITY_LOW);
@@ -347,7 +347,7 @@ void CrowdNavigation::SetPathPoint(bool spawning)
 
     if (Raycast(250.0f, hitPos, hitDrawable))
     {
-        DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+        auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
         Vector3 pathPos = navMesh->FindNearestPoint(hitPos, Vector3(1.0f, 1.0f, 1.0f));
         Node* jackGroup = scene_->GetChild("Jacks");
         if (spawning)
@@ -383,14 +383,14 @@ bool CrowdNavigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hit
 {
     hitDrawable = nullptr;
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
 
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* camera = cameraNode_->GetComponent<Camera>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* camera = cameraNode_->GetComponent<Camera>();
     Ray cameraRay = camera->GetScreenRay((float)pos.x_ / graphics->GetWidth(), (float)pos.y_ / graphics->GetHeight());
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;
@@ -410,8 +410,8 @@ bool CrowdNavigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hit
 void CrowdNavigation::MoveCamera(float timeStep)
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Do not move if the UI has a focused element (the console)
@@ -479,7 +479,7 @@ void CrowdNavigation::MoveCamera(float timeStep)
 
 void CrowdNavigation::ToggleStreaming(bool enabled)
 {
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     if (enabled)
     {
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
@@ -504,7 +504,7 @@ void CrowdNavigation::UpdateStreaming()
     }
 
     // Compute currently loaded area
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     const IntVector2 jackTile = navMesh->GetTileIndex(averageJackPosition);
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
@@ -538,7 +538,7 @@ void CrowdNavigation::UpdateStreaming()
 
 void CrowdNavigation::SaveNavigationData()
 {
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     tileData_.Clear();
     addedTiles_.Clear();
     const IntVector2 numTiles = navMesh->GetNumTiles();
@@ -561,7 +561,7 @@ void CrowdNavigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
     MoveCamera(timeStep);
 
     // Update streaming
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_TAB))
     {
         useStreaming_ = !useStreaming_;
@@ -587,8 +587,8 @@ void CrowdNavigation::HandleCrowdAgentFailure(StringHash eventType, VariantMap&
 {
     using namespace CrowdAgentFailure;
 
-    Node* node = static_cast<Node*>(eventData[P_NODE].GetPtr());
-    CrowdAgentState agentState = (CrowdAgentState)eventData[P_CROWD_AGENT_STATE].GetInt();
+    auto* node = static_cast<Node*>(eventData[P_NODE].GetPtr());
+    auto agentState = (CrowdAgentState)eventData[P_CROWD_AGENT_STATE].GetInt();
 
     // If the agent's state is invalid, likely from spawning on the side of a box, find a point in a larger area
     if (agentState == CA_STATE_INVALID)
@@ -606,13 +606,13 @@ void CrowdNavigation::HandleCrowdAgentReposition(StringHash eventType, VariantMa
 
     using namespace CrowdAgentReposition;
 
-    Node* node = static_cast<Node*>(eventData[P_NODE].GetPtr());
-    CrowdAgent* agent = static_cast<CrowdAgent*>(eventData[P_CROWD_AGENT].GetPtr());
+    auto* node = static_cast<Node*>(eventData[P_NODE].GetPtr());
+    auto* agent = static_cast<CrowdAgent*>(eventData[P_CROWD_AGENT].GetPtr());
     Vector3 velocity = eventData[P_VELOCITY].GetVector3();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
     // Only Jack agent has animation controller
-    AnimationController* animCtrl = node->GetComponent<AnimationController>();
+    auto* animCtrl = node->GetComponent<AnimationController>();
     if (animCtrl)
     {
         float speed = velocity.Length();
@@ -644,8 +644,8 @@ void CrowdNavigation::HandleCrowdAgentFormation(StringHash eventType, VariantMap
     // The first agent will always move to the exact position, all other agents will select a random point nearby
     if (index)
     {
-        CrowdManager* crowdManager = static_cast<CrowdManager*>(GetEventSender());
-        CrowdAgent* agent = static_cast<CrowdAgent*>(eventData[P_CROWD_AGENT].GetPtr());
+        auto* crowdManager = static_cast<CrowdManager*>(GetEventSender());
+        auto* agent = static_cast<CrowdAgent*>(eventData[P_CROWD_AGENT].GetPtr());
         eventData[P_POSITION] = crowdManager->GetRandomPointInCircle(position, agent->GetRadius(), agent->GetQueryFilterType());
     }
 }

+ 21 - 21
Source/Samples/40_Localization/L10n.cpp

@@ -52,7 +52,7 @@ void L10n::Start()
     Sample::Start();
 
     // Enable and center OS cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->CenterMousePosition();
 
@@ -71,7 +71,7 @@ void L10n::Start()
 
 void L10n::InitLocalizationSystem()
 {
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
     // JSON files must be in UTF8 encoding without BOM
     // The first found language will be set as current
     l10n->LoadJSONFile("StringsEnRu.json");
@@ -84,20 +84,20 @@ void L10n::InitLocalizationSystem()
 void L10n::CreateGUI()
 {
     // Get localization subsystem
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     root->SetDefaultStyle(cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
 
-    Window* window = new Window(context_);
+    auto* window = new Window(context_);
     root->AddChild(window);
     window->SetMinSize(384, 192);
     window->SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6));
     window->SetAlignment(HA_CENTER, VA_CENTER);
     window->SetStyleAuto();
 
-    Text* windowTitle = new Text(context_);
+    auto* windowTitle = new Text(context_);
     windowTitle->SetName("WindowTitle");
     windowTitle->SetStyleAuto();
     window->AddChild(windowTitle);
@@ -113,12 +113,12 @@ void L10n::CreateGUI()
 
     windowTitle->SetText(localizedString + " (" + String(langIndex) + " " + langName + ")");
 
-    Button* b = new Button(context_);
+    auto* b = new Button(context_);
     window->AddChild(b);
     b->SetStyle("Button");
     b->SetMinHeight(24);
 
-    Text* t = b->CreateChild<Text>("ButtonTextChangeLang");
+    auto* t = b->CreateChild<Text>("ButtonTextChangeLang");
     // The showing text value will automatically change when language is changed
     t->SetAutoLocalizable(true);
     // The text value used as a string identifier in this mode.
@@ -146,13 +146,13 @@ void L10n::CreateGUI()
 void L10n::CreateScene()
 {
     // Get localization subsystem
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     scene_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
 
-    Zone* zone = scene_->CreateComponent<Zone>();
+    auto* zone = scene_->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
@@ -161,13 +161,13 @@ void L10n::CreateScene()
 
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(300.0f, 1.0f, 300.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.8f, 0.8f, 0.8f));
 
@@ -177,7 +177,7 @@ void L10n::CreateScene()
 
     Node* text3DNode = scene_->CreateChild("Text3D");
     text3DNode->SetPosition(Vector3(0.0f, 0.1f, 30.0f));
-    Text3D* text3D = text3DNode->CreateComponent<Text3D>();
+    auto* text3D = text3DNode->CreateComponent<Text3D>();
 
     // Manually set text in the current language.
     text3D->SetText(l10n->Get("lang"));
@@ -187,7 +187,7 @@ void L10n::CreateScene()
     text3D->SetAlignment(HA_CENTER, VA_BOTTOM);
     text3DNode->SetScale(15);
 
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
     renderer->SetViewport(0, viewport);
 
@@ -198,7 +198,7 @@ void L10n::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     using namespace Update;
     float timeStep = eventData[P_TIMESTEP].GetFloat();
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     const float MOUSE_SENSITIVITY = 0.1f;
     IntVector2 mouseMove = input->GetMouseMove();
     yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
@@ -209,7 +209,7 @@ void L10n::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 void L10n::HandleChangeLangButtonPressed(StringHash eventType, VariantMap& eventData)
 {
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
     // Languages are numbered in the loading order
     int lang = l10n->GetLanguageIndex();
     lang++;
@@ -227,16 +227,16 @@ void L10n::HandleQuitButtonPressed(StringHash eventType, VariantMap& eventData)
 // You can manually change texts, sprites and other aspects of the game when language is changed
 void L10n::HandleChangeLanguage(StringHash eventType, VariantMap& eventData)
 {
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
     UIElement* uiRoot = GetSubsystem<UI>()->GetRoot();
 
-    Text* windowTitle = uiRoot->GetChildStaticCast<Text>("WindowTitle", true);
+    auto* windowTitle = uiRoot->GetChildStaticCast<Text>("WindowTitle", true);
     windowTitle->SetText(l10n->Get("title") + " (" + String(l10n->GetLanguageIndex()) + " " + l10n->GetLanguage() + ")");
 
-    Text* buttonText = uiRoot->GetChildStaticCast<Text>("ButtonTextQuit", true);
+    auto* buttonText = uiRoot->GetChildStaticCast<Text>("ButtonTextQuit", true);
     buttonText->SetText(l10n->Get("quit"));
 
-    Text3D* text3D = scene_->GetChild("Text3D")->GetComponent<Text3D>();
+    auto* text3D = scene_->GetChild("Text3D")->GetComponent<Text3D>();
     text3D->SetText(l10n->Get("lang"));
 
     // A text on the button "Press this button" changes automatically

+ 2 - 2
Source/Samples/41_DatabaseDemo/DatabaseDemo.cpp

@@ -69,7 +69,7 @@ void DatabaseDemo::Start()
 
     // Show the console by default, make it large. Console will show the text edit field when there is at least one
     // subscriber for the console command event
-    Console* console = GetSubsystem<Console>();
+    auto* console = GetSubsystem<Console>();
     console->SetNumRows((unsigned)(GetSubsystem<Graphics>()->GetHeight() / 16));
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetCommandInterpreter(GetTypeName());
@@ -182,7 +182,7 @@ void DatabaseDemo::HandleInput(const String& input)
             else if (setting == "connstr")
             {
                 String newConnectionString(input.Substring(input.Find(" ", input.Find("connstr")) + 1));
-                Database* database = GetSubsystem<Database>();
+                auto* database = GetSubsystem<Database>();
                 DbConnection* newConnection = database->Connect(newConnectionString);
                 if (newConnection)
                 {

+ 16 - 16
Source/Samples/42_PBRMaterials/PBRMaterials.cpp

@@ -76,11 +76,11 @@ void PBRMaterials::Start()
 
 void PBRMaterials::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use sliders to change Roughness and Metallic\n"
         "Hold RMB and use WASD keys and mouse to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
@@ -94,7 +94,7 @@ void PBRMaterials::CreateInstructions()
 
 void PBRMaterials::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 #ifdef URHO3D_ANGELSCRIPT
     // The scene uses an AngelScript component for animation. Instantiate the subsystem if possible
@@ -109,7 +109,7 @@ void PBRMaterials::CreateScene()
     scene_->LoadXML(*file);
 
     Node* sphereWithDynamicMatNode = scene_->GetChild("SphereWithDynamicMat");
-    StaticModel* staticModel = sphereWithDynamicMatNode->GetComponent<StaticModel>();
+    auto* staticModel = sphereWithDynamicMatNode->GetComponent<StaticModel>();
     dynamicMaterial_ = staticModel->GetMaterial(0);
 
     Node* zoneNode = scene_->GetChild("Zone");
@@ -127,11 +127,11 @@ void PBRMaterials::CreateScene()
 
 void PBRMaterials::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Set up global UI style into the root UI element
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
     ui->GetRoot()->SetDefaultStyle(style);
 
     // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
@@ -140,7 +140,7 @@ void PBRMaterials::CreateUI()
     cursor->SetStyleAuto();
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
     roughnessLabel_ = ui->GetRoot()->CreateChild<Text>();
@@ -158,7 +158,7 @@ void PBRMaterials::CreateUI()
     ambientLabel_->SetPosition(370, 150);
     ambientLabel_->SetTextEffect(TE_SHADOW);
 
-    Slider* roughnessSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* roughnessSlider = ui->GetRoot()->CreateChild<Slider>();
     roughnessSlider->SetStyleAuto();
     roughnessSlider->SetPosition(50, 50);
     roughnessSlider->SetSize(300, 20);
@@ -166,7 +166,7 @@ void PBRMaterials::CreateUI()
     SubscribeToEvent(roughnessSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleRoughnessSliderChanged));
     roughnessSlider->SetValue(0.5f);
 
-    Slider* metallicSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* metallicSlider = ui->GetRoot()->CreateChild<Slider>();
     metallicSlider->SetStyleAuto();
     metallicSlider->SetPosition(50, 100);
     metallicSlider->SetSize(300, 20);
@@ -174,7 +174,7 @@ void PBRMaterials::CreateUI()
     SubscribeToEvent(metallicSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleMetallicSliderChanged));
     metallicSlider->SetValue(0.5f);
 
-    Slider* ambientSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* ambientSlider = ui->GetRoot()->CreateChild<Slider>();
     ambientSlider->SetStyleAuto();
     ambientSlider->SetPosition(50, 150);
     ambientSlider->SetSize(300, 20);
@@ -207,8 +207,8 @@ void PBRMaterials::HandleAmbientSliderChanged(StringHash eventType, VariantMap&
 
 void PBRMaterials::SetupViewport()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     renderer->SetHDRRendering(true);
 
@@ -235,8 +235,8 @@ void PBRMaterials::SubscribeToEvents()
 void PBRMaterials::MoveCamera(float timeStep)
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
     // Do not move if the UI has a focused element

+ 2 - 2
Source/Samples/43_HttpRequestDemo/HttpRequestDemo.cpp

@@ -57,7 +57,7 @@ void HttpRequestDemo::Start()
 
 void HttpRequestDemo::CreateUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Construct new Text object
     text_ = new Text(context_);
@@ -82,7 +82,7 @@ void HttpRequestDemo::SubscribeToEvents()
 
 void HttpRequestDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
 
     if (httpRequest_.Null())
         httpRequest_ = network->MakeHttpRequest("http://httpbin.org/ip");

+ 16 - 16
Source/Samples/44_RibbonTrailDemo/RibbonTrailDemo.cpp

@@ -75,7 +75,7 @@ void RibbonTrailDemo::Start()
 
 void RibbonTrailDemo::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -85,14 +85,14 @@ void RibbonTrailDemo::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
+    auto* planeObject = planeNode->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Create a directional light to the world.
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00005f, 0.5f));
@@ -101,10 +101,10 @@ void RibbonTrailDemo::CreateScene()
 
     // Create first box for face camera trail demo with 1 column.
     boxNode1_ = scene_->CreateChild("Box1");
-    StaticModel* box1 = boxNode1_->CreateComponent<StaticModel>();
+    auto* box1 = boxNode1_->CreateComponent<StaticModel>();
     box1->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box1->SetCastShadows(true);
-    RibbonTrail* boxTrail1 = boxNode1_->CreateComponent<RibbonTrail>();
+    auto* boxTrail1 = boxNode1_->CreateComponent<RibbonTrail>();
     boxTrail1->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail1->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail1->SetEndColor(Color(1.0f, 1.0f, 0.0f, 0.0f));
@@ -114,10 +114,10 @@ void RibbonTrailDemo::CreateScene()
     // Create second box for face camera trail demo with 4 column.
     // This will produce less distortion than first trail.
     boxNode2_ = scene_->CreateChild("Box2");
-    StaticModel* box2 = boxNode2_->CreateComponent<StaticModel>();
+    auto* box2 = boxNode2_->CreateComponent<StaticModel>();
     box2->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box2->SetCastShadows(true);
-    RibbonTrail* boxTrail2 = boxNode2_->CreateComponent<RibbonTrail>();
+    auto* boxTrail2 = boxNode2_->CreateComponent<RibbonTrail>();
     boxTrail2->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail2->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail2->SetEndColor(Color(1.0f, 1.0f, 0.0f, 0.0f));
@@ -129,7 +129,7 @@ void RibbonTrailDemo::CreateScene()
     Node* ninjaNode = scene_->CreateChild("Ninja");
     ninjaNode->SetPosition(Vector3(5.0f, 0.0f, 0.0f));
     ninjaNode->SetRotation(Quaternion(0.0f, 180.0f, 0.0f));
-    AnimatedModel* ninja = ninjaNode->CreateComponent<AnimatedModel>();
+    auto* ninja = ninjaNode->CreateComponent<AnimatedModel>();
     ninja->SetModel(cache->GetResource<Model>("Models/NinjaSnowWar/Ninja.mdl"));
     ninja->SetMaterial(cache->GetResource<Material>("Materials/NinjaSnowWar/Ninja.xml"));
     ninja->SetCastShadows(true);
@@ -154,19 +154,19 @@ void RibbonTrailDemo::CreateScene()
     // Add floating text for info.
     Node* boxTextNode1 = scene_->CreateChild("BoxText1");
     boxTextNode1->SetPosition(Vector3(-1.0f, 2.0f, 0.0f));
-    Text3D* boxText1 = boxTextNode1->CreateComponent<Text3D>();
+    auto* boxText1 = boxTextNode1->CreateComponent<Text3D>();
     boxText1->SetText(String("Face Camera Trail (4 Column)"));
     boxText1->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
     Node* boxTextNode2 = scene_->CreateChild("BoxText2");
     boxTextNode2->SetPosition(Vector3(-6.0f, 2.0f, 0.0f));
-    Text3D* boxText2 = boxTextNode2->CreateComponent<Text3D>();
+    auto* boxText2 = boxTextNode2->CreateComponent<Text3D>();
     boxText2->SetText(String("Face Camera Trail (1 Column)"));
     boxText2->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
     Node* ninjaTextNode2 = scene_->CreateChild("NinjaText");
     ninjaTextNode2->SetPosition(Vector3(4.0f, 2.5f, 0.0f));
-    Text3D* ninjaText = ninjaTextNode2->CreateComponent<Text3D>();
+    auto* ninjaText = ninjaTextNode2->CreateComponent<Text3D>();
     ninjaText->SetText(String("Bone Trail (4 Column)"));
     ninjaText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
@@ -180,11 +180,11 @@ void RibbonTrailDemo::CreateScene()
 
 void RibbonTrailDemo::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -196,7 +196,7 @@ void RibbonTrailDemo::CreateInstructions()
 
 void RibbonTrailDemo::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -211,7 +211,7 @@ void RibbonTrailDemo::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;

+ 11 - 11
Source/Samples/45_InverseKinematics/InverseKinematics.cpp

@@ -81,7 +81,7 @@ void InverseKinematics::Start()
 
 void InverseKinematics::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
 
@@ -93,19 +93,19 @@ void InverseKinematics::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     floorNode_ = scene_->CreateChild("Plane");
     floorNode_->SetScale(Vector3(50.0f, 1.0f, 50.0f));
-    StaticModel* planeObject = floorNode_->CreateComponent<StaticModel>();
+    auto* planeObject = floorNode_->CreateComponent<StaticModel>();
     planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
     // Set up collision, we need to raycast to determine foot height
     floorNode_->CreateComponent<RigidBody>();
-    CollisionShape* col = floorNode_->CreateComponent<CollisionShape>();
+    auto* col = floorNode_->CreateComponent<CollisionShape>();
     col->SetBox(Vector3(1, 0, 1));
 
     // Create a directional light to the world.
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00005f, 0.5f));
@@ -115,7 +115,7 @@ void InverseKinematics::CreateScene()
     // Load Jack model
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_->SetRotation(Quaternion(0.0f, 270.0f, 0.0f));
-    AnimatedModel* jack = jackNode_->CreateComponent<AnimatedModel>();
+    auto* jack = jackNode_->CreateComponent<AnimatedModel>();
     jack->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     jack->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     jack->SetCastShadows(true);
@@ -167,11 +167,11 @@ void InverseKinematics::CreateScene()
 
 void InverseKinematics::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText("Left-Click and drag to look around\nRight-Click and drag to change incline\nPress space to reset floor\nPress D to draw debug geometry");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
@@ -183,7 +183,7 @@ void InverseKinematics::CreateInstructions()
 
 void InverseKinematics::SetupViewport()
 {
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
 
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
@@ -198,7 +198,7 @@ void InverseKinematics::UpdateCameraAndFloor(float /*timeStep*/)
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Mouse sensitivity as degrees per pixel
     const float MOUSE_SENSITIVITY = 0.1f;
@@ -267,7 +267,7 @@ void InverseKinematics::HandlePostRenderUpdate(StringHash /*eventType*/, Variant
 
 void InverseKinematics::HandleSceneDrawableUpdateFinished(StringHash /*eventType*/, VariantMap& eventData)
 {
-    PhysicsWorld* phyWorld = scene_->GetComponent<PhysicsWorld>();
+    auto* phyWorld = scene_->GetComponent<PhysicsWorld>();
     Vector3 leftFootPosition = leftFoot_->GetWorldPosition();
     Vector3 rightFootPosition = rightFoot_->GetWorldPosition();
 

+ 18 - 18
Source/Samples/46_RaycastVehicle/RaycastVehicleDemo.cpp

@@ -79,7 +79,7 @@ void RaycastVehicleDemo::Start()
 
 void RaycastVehicleDemo::CreateScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     scene_ = new Scene(context_);
     // Create scene subsystem components
     scene_->CreateComponent<Octree>();
@@ -87,12 +87,12 @@ void RaycastVehicleDemo::CreateScene()
     // Create camera and define viewport. We will be doing load / save, so it's convenient to create the camera outside the scene,
     // so that it won't be destroyed and recreated, and we don't have to redefine the viewport on load
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(500.0f);
     GetSubsystem<Renderer>()->SetViewport(0, new Viewport(context_, scene_, camera));
     // Create static scene content. First create a zone for ambient lighting and fog control
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     zone->SetFogStart(300.0f);
@@ -101,7 +101,7 @@ void RaycastVehicleDemo::CreateScene()
     // Create a directional light with cascaded shadow mapping
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.3f, -0.5f, 0.425f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -110,7 +110,7 @@ void RaycastVehicleDemo::CreateScene()
     // Create heightmap terrain with collision
     Node* terrainNode = scene_->CreateChild("Terrain");
     terrainNode->SetPosition(Vector3::ZERO);
-    Terrain* terrain = terrainNode->CreateComponent<Terrain>();
+    auto* terrain = terrainNode->CreateComponent<Terrain>();
     terrain->SetPatchSize(64);
     terrain->SetSpacing(Vector3(3.0f, 0.1f, 3.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSmoothing(true);
@@ -119,9 +119,9 @@ void RaycastVehicleDemo::CreateScene()
     // The terrain consists of large triangles, which fits well for occlusion rendering, as a hill can occlude all
     // terrain patches and other objects behind it
     terrain->SetOccluder(true);
-    RigidBody* body = terrainNode->CreateComponent<RigidBody>();
+    auto* body = terrainNode->CreateComponent<RigidBody>();
     body->SetCollisionLayer(2); // Use layer bitmask 2 for static geometry
-    CollisionShape* shape =
+    auto* shape =
         terrainNode->CreateComponent<CollisionShape>();
     shape->SetTerrain();
     // Create 1000 mushrooms in the terrain. Always face outward along the terrain normal
@@ -135,13 +135,13 @@ void RaycastVehicleDemo::CreateScene()
         // Create a rotation quaternion from up vector to terrain normal
         objectNode->SetRotation(Quaternion(Vector3::UP, terrain->GetNormal(position)));
         objectNode->SetScale(3.0f);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         object->SetCastShadows(true);
-        RigidBody* body = objectNode->CreateComponent<RigidBody>();
+        auto* body = objectNode->CreateComponent<RigidBody>();
         body->SetCollisionLayer(2);
-        CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+        auto* shape = objectNode->CreateComponent<CollisionShape>();
         shape->SetTriangleMesh(object->GetModel(), 0);
     }
 }
@@ -158,10 +158,10 @@ void RaycastVehicleDemo::CreateVehicle()
 
 void RaycastVehicleDemo::CreateInstructions()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
     // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>();
     instructionText->SetText(
         "Use WASD keys to drive, F to brake, mouse/touch to rotate camera\n"
         "F5 to save scene, F7 to load");
@@ -191,10 +191,10 @@ void RaycastVehicleDemo::HandleUpdate(StringHash eventType,
                                  VariantMap& eventData)
 {
     using namespace Update;
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (vehicle_)
     {
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         // Get movement controls and assign them to the vehicle component. If UI has a focused element, clear controls
         if (!ui->GetFocusElement())
         {
@@ -211,12 +211,12 @@ void RaycastVehicleDemo::HandleUpdate(StringHash eventType,
                     TouchState* state = input->GetTouch(i);
                     if (!state->touchedElement_) // Touch on empty space
                     {
-                        Camera* camera = cameraNode_->GetComponent<Camera>();
+                        auto* camera = cameraNode_->GetComponent<Camera>();
                         if (!camera)
                         {
                             return;
                         }
-                        Graphics* graphics = GetSubsystem<Graphics>();
+                        auto* graphics = GetSubsystem<Graphics>();
                         vehicle_->controls_.yaw_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.x_;
                         vehicle_->controls_.pitch_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.y_;
                     }
@@ -232,7 +232,7 @@ void RaycastVehicleDemo::HandleUpdate(StringHash eventType,
             // Check for loading / saving the scene
             if (input->GetKeyPress(KEY_F5))
             {
-                File saveFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/RaycastVehicleDemo.xml", 
+                File saveFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/RaycastVehicleDemo.xml",
                               FILE_WRITE);
                 scene_->SaveXML(saveFile);
             }

+ 14 - 14
Source/Samples/46_RaycastVehicle/Vehicle.cpp

@@ -58,18 +58,18 @@ Vehicle::~Vehicle()
 
 void Vehicle::Init()
 {
-    RaycastVehicle* vehicle = node_->CreateComponent<RaycastVehicle>();
+    auto* vehicle = node_->CreateComponent<RaycastVehicle>();
     vehicle->Init();
-    RigidBody* hullBody = node_->GetComponent<RigidBody>();
+    auto* hullBody = node_->GetComponent<RigidBody>();
     hullBody->SetMass(800.0f);
     hullBody->SetLinearDamping(0.2f); // Some air resistance
     hullBody->SetAngularDamping(0.5f);
     hullBody->SetCollisionLayer(1);
     // This function is called only from the main program when initially creating the vehicle, not on scene load
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    StaticModel* hullObject = node_->CreateComponent<StaticModel>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* hullObject = node_->CreateComponent<StaticModel>();
     // Setting-up collision shape
-    CollisionShape* hullColShape = node_->CreateComponent<CollisionShape>();
+    auto* hullColShape = node_->CreateComponent<CollisionShape>();
     Vector3 v3BoxExtents = Vector3::ONE;
     hullColShape->SetBox(v3BoxExtents);
     node_->SetScale(Vector3(2.3f, 1.0f, 4.0f));
@@ -110,7 +110,7 @@ void Vehicle::Init()
         vehicle->SetWheelFrictionSlip(id, wheelFriction_);
         vehicle->SetWheelRollInfluence(id, rollInfluence_);
         wheelNode->SetScale(Vector3(1.0f, 0.65f, 1.0f));
-        StaticModel* pWheel = wheelNode->CreateComponent<StaticModel>();
+        auto* pWheel = wheelNode->CreateComponent<StaticModel>();
         pWheel->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
         pWheel->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         pWheel->SetCastShadows(true);
@@ -122,10 +122,10 @@ void Vehicle::Init()
 
 void Vehicle::CreateEmitter(Vector3 place)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* emitter = GetScene()->CreateChild();
     emitter->SetWorldPosition(node_->GetWorldPosition() + node_->GetWorldRotation() * place + Vector3(0, -wheelRadius_, 0));
-    ParticleEmitter* particleEmitter = emitter->CreateComponent<ParticleEmitter>();
+    auto* particleEmitter = emitter->CreateComponent<ParticleEmitter>();
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect>("Particle/Dust.xml"));
     particleEmitter->SetEmitting(false);
     particleEmitterNodeList_.Push(emitter);
@@ -135,7 +135,7 @@ void Vehicle::CreateEmitter(Vector3 place)
 /// Applying attributes
 void Vehicle::ApplyAttributes()
 {
-    RaycastVehicle* vehicle = node_->GetOrCreateComponent<RaycastVehicle>();
+    auto* vehicle = node_->GetOrCreateComponent<RaycastVehicle>();
     if (emittersCreated)
         return;
     for (int i = 0; i < 4; i++)
@@ -150,7 +150,7 @@ void Vehicle::FixedUpdate(float timeStep)
     float newSteering = 0.0f;
     float accelerator = 0.0f;
     bool brake = false;
-    RaycastVehicle* vehicle = node_->GetComponent<RaycastVehicle>();
+    auto* vehicle = node_->GetComponent<RaycastVehicle>();
     // Read controls
     if (controls_.buttons_ & CTRL_LEFT)
     {
@@ -207,16 +207,16 @@ void Vehicle::FixedUpdate(float timeStep)
 
 void Vehicle::PostUpdate(float timeStep)
 {
-    RaycastVehicle* vehicle = node_->GetComponent<RaycastVehicle>();
-    RigidBody* vehicleBody = node_->GetComponent<RigidBody>();
+    auto* vehicle = node_->GetComponent<RaycastVehicle>();
+    auto* vehicleBody = node_->GetComponent<RigidBody>();
     Vector3 velocity = vehicleBody->GetLinearVelocity();
     Vector3 accel = (velocity - prevVelocity_) / timeStep;
     float planeAccel = Vector3(accel.x_, 0.0f, accel.z_).Length();
     for (int i = 0; i < vehicle->GetNumWheels(); i++)
     {
         Node* emitter = particleEmitterNodeList_[i];
-        ParticleEmitter* particleEmitter = emitter->GetComponent<ParticleEmitter>();
-        if (vehicle->WheelIsGrounded(i) && (vehicle->GetWheelSkidInfoCumulative(i) < 0.9f || vehicle->GetBrake(i) > 2.0f || 
+        auto* particleEmitter = emitter->GetComponent<ParticleEmitter>();
+        if (vehicle->WheelIsGrounded(i) && (vehicle->GetWheelSkidInfoCumulative(i) < 0.9f || vehicle->GetBrake(i) > 2.0f ||
             planeAccel > 15.0f))
         {
             particleEmitterNodeList_[i]->SetWorldPosition(vehicle->GetContactPosition(i));

+ 13 - 13
Source/Samples/47_Typography/Typography.cpp

@@ -59,11 +59,11 @@ void Typography::Start()
     GetSubsystem<Input>()->SetMouseVisible(true);
 
     // Load XML file containing default UI style sheet
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
 
     // Set the loaded style as default style
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* root = ui->GetRoot();
     root->SetDefaultStyle(style);
 
@@ -143,8 +143,8 @@ void Typography::CreateText()
     container->SetLayout(LM_VERTICAL);
     uielement_->AddChild(container);
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/BlueHighway.ttf");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* font = cache->GetResource<Font>("Fonts/BlueHighway.ttf");
 
     for (float size = 1; size <= 18; size += 0.5)
     {
@@ -212,13 +212,13 @@ SharedPtr<DropDownList> Typography::CreateMenu(const String& label, const char**
 
 void Typography::HandleWhiteBackground(StringHash eventType, VariantMap& eventData)
 {
-    CheckBox* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
     bool checked = box->IsChecked();
 
     Color fg = checked ? Color::BLACK : Color::WHITE;
     Color bg = checked ? Color::WHITE : Color::BLACK;
 
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     Zone* zone = renderer->GetDefaultZone();
     zone->SetFogColor(bg);
 
@@ -231,17 +231,17 @@ void Typography::HandleWhiteBackground(StringHash eventType, VariantMap& eventDa
 
 void Typography::HandleForceAutoHint(StringHash eventType, VariantMap& eventData)
 {
-    CheckBox* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
     bool checked = box->IsChecked();
     GetSubsystem<UI>()->SetForceAutoHint(checked);
 }
 
 void Typography::HandleSRGB(StringHash eventType, VariantMap& eventData)
 {
-    CheckBox* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
     bool checked = box->IsChecked();
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (graphics->GetSRGBWriteSupport())
     {
         graphics->SetSRGB(checked);
@@ -257,21 +257,21 @@ void Typography::HandleSRGB(StringHash eventType, VariantMap& eventData)
 
 void Typography::HandleFontHintLevel(StringHash eventType, VariantMap& eventData)
 {
-    DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontHintLevel((FontHintLevel)i);
 }
 
 void Typography::HandleFontSubpixel(StringHash eventType, VariantMap& eventData)
 {
-    DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontSubpixelThreshold(i * 3);
 }
 
 void Typography::HandleFontOversampling(StringHash eventType, VariantMap& eventData)
 {
-    DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    auto* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontOversampling(i + 1);
 }

+ 25 - 25
Source/Samples/48_Hello3DUI/Hello3DUI.cpp

@@ -67,8 +67,8 @@ void Hello3DUI::Start()
     GetSubsystem<Input>()->SetMouseVisible(true);
 
     // Load XML file containing default UI style sheet
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
 
     // Set the loaded style as default style
     uiRoot_->SetDefaultStyle(style);
@@ -95,16 +95,16 @@ void Hello3DUI::Start()
 void Hello3DUI::InitControls()
 {
     // Create a CheckBox
-    CheckBox* checkBox = new CheckBox(context_);
+    auto* checkBox = new CheckBox(context_);
     checkBox->SetName("CheckBox");
 
     // Create a Button
-    Button* button = new Button(context_);
+    auto* button = new Button(context_);
     button->SetName("Button");
     button->SetMinHeight(24);
 
     // Create a LineEdit
-    LineEdit* lineEdit = new LineEdit(context_);
+    auto* lineEdit = new LineEdit(context_);
     lineEdit->SetName("LineEdit");
     lineEdit->SetMinHeight(24);
 
@@ -138,18 +138,18 @@ void Hello3DUI::InitWindow()
     window_->SetName("Window");
 
     // Create Window 'titlebar' container
-    UIElement* titleBar = new UIElement(context_);
+    auto* titleBar = new UIElement(context_);
     titleBar->SetMinSize(0, 24);
     titleBar->SetVerticalAlignment(VA_TOP);
     titleBar->SetLayoutMode(LM_HORIZONTAL);
 
     // Create the Window title Text
-    Text* windowTitle = new Text(context_);
+    auto* windowTitle = new Text(context_);
     windowTitle->SetName("WindowTitle");
     windowTitle->SetText("Hello GUI!");
 
     // Create the Window's close button
-    Button* buttonClose = new Button(context_);
+    auto* buttonClose = new Button(context_);
     buttonClose->SetName("CloseButton");
 
     // Add the controls to the title bar
@@ -160,14 +160,14 @@ void Hello3DUI::InitWindow()
     window_->AddChild(titleBar);
 
     // Create a list.
-    ListView* list = window_->CreateChild<ListView>();
+    auto* list = window_->CreateChild<ListView>();
     list->SetSelectOnClickEnd(true);
     list->SetHighlightMode(HM_ALWAYS);
     list->SetMinHeight(200);
 
     for (int i = 0; i < 32; i++)
     {
-        Text* text = new Text(context_);
+        auto* text = new Text(context_);
         text->SetStyleAuto();
         text->SetText(ToString("List item %d", i));
         text->SetName(ToString("Item %d", i));
@@ -189,11 +189,11 @@ void Hello3DUI::InitWindow()
 
 void Hello3DUI::InitScene()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     scene_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
-    Zone* zone = scene_->CreateComponent<Zone>();
+    auto* zone = scene_->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color::GRAY);
     zone->SetFogStart(100.0f);
@@ -205,7 +205,7 @@ void Hello3DUI::InitScene()
     boxNode->SetRotation(Quaternion(90, Vector3::LEFT));
 
     // Create a box model and hide it initially.
-    StaticModel* boxModel = boxNode->CreateComponent<StaticModel>();
+    auto* boxModel = boxNode->CreateComponent<StaticModel>();
     boxModel->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxNode->SetEnabled(false);
 
@@ -217,7 +217,7 @@ void Hello3DUI::InitScene()
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
     // Set up a viewport so 3D scene can be visible.
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
     renderer->SetViewport(0, viewport);
 
@@ -227,11 +227,11 @@ void Hello3DUI::InitScene()
 
 void Hello3DUI::CreateDraggableFish()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* graphics = GetSubsystem<Graphics>();
 
     // Create a draggable Fish button
-    Button* draggableFish = new Button(context_);
+    auto* draggableFish = new Button(context_);
     draggableFish->SetTexture(cache->GetResource<Texture2D>("Textures/UrhoDecal.dds")); // Set texture
     draggableFish->SetBlendMode(BLEND_ADD);
     draggableFish->SetSize(128, 128);
@@ -240,13 +240,13 @@ void Hello3DUI::CreateDraggableFish()
     uiRoot_->AddChild(draggableFish);
 
     // Add a tooltip to Fish button
-    ToolTip* toolTip = new ToolTip(context_);
+    auto* toolTip = new ToolTip(context_);
     draggableFish->AddChild(toolTip);
     toolTip->SetPosition(IntVector2(draggableFish->GetWidth() + 5, draggableFish->GetWidth() / 2)); // slightly offset from close button
-    BorderImage* textHolder = new BorderImage(context_);
+    auto* textHolder = new BorderImage(context_);
     toolTip->AddChild(textHolder);
     textHolder->SetStyle("ToolTipBorderImage");
-    Text* toolTipText = new Text(context_);
+    auto* toolTipText = new Text(context_);
     textHolder->AddChild(toolTipText);
     toolTipText->SetStyle("ToolTipText");
     toolTipText->SetText("Please drag me!");
@@ -284,10 +284,10 @@ void Hello3DUI::HandleClosePressed(StringHash eventType, VariantMap& eventData)
 void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
 {
     // Get the Text control acting as the Window's title
-    Text* windowTitle = window_->GetChildStaticCast<Text>("WindowTitle", true);
+    auto* windowTitle = window_->GetChildStaticCast<Text>("WindowTitle", true);
 
     // Get control that was clicked
-    UIElement* clicked = static_cast<UIElement*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
+    auto* clicked = static_cast<UIElement*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
 
     String name = "...?";
     if (clicked)
@@ -302,12 +302,12 @@ void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData
 
 void Hello3DUI::Init3DUI()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Node that will get UI rendered on it.
     Node* boxNode = scene_->GetChild("Box");
     // Create a component that sets up UI rendering. It sets material to StaticModel of the node.
-    UIComponent* component = boxNode->CreateComponent<UIComponent>();
+    auto* component = boxNode->CreateComponent<UIComponent>();
     // Optionally modify material. Technique is changed so object is visible without any lights.
     component->GetMaterial()->SetTechnique(0, cache->GetResource<Technique>("Techniques/DiffUnlit.xml"));
     // Save root element of texture UI for later use.
@@ -320,7 +320,7 @@ void Hello3DUI::HandleUpdate(StringHash, VariantMap& eventData)
 {
     using namespace Update;
     float timeStep = eventData[P_TIMESTEP].GetFloat();
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     Node* node = scene_->GetChild("Box");
 
     if (current_.NotNull() && drawDebug_)

+ 23 - 23
Source/Samples/49_Urho2DIsometricDemo/Character2D.cpp

@@ -68,15 +68,15 @@ void Character2D::Update(float timeStep)
     // Handle wounded/killed states
     if (killed_)
         return;
-    
+
     if (wounded_)
     {
         HandleWoundedState(timeStep);
         return;
     }
 
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
-    Input* input = GetSubsystem<Input>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* input = GetSubsystem<Input>();
 
     // Set direction
     Vector3 moveDir = Vector3::ZERO; // Reset
@@ -125,45 +125,45 @@ void Character2D::Update(float timeStep)
 
 void Character2D::HandleWoundedState(float timeStep)
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
-    
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
+
     // Play "hit" animation in loop
     if (animatedSprite->GetAnimation() != "hit")
         animatedSprite->SetAnimation("hit", LM_FORCE_LOOPED);
-    
+
     // Update timer
     timer_ += timeStep;
-    
+
     if (timer_ > 2.0f)
     {
         // Reset timer
         timer_ = 0.0f;
-        
+
         // Clear forces (should be performed by setting linear velocity to zero, but currently doesn't work)
         body->SetLinearVelocity(Vector2::ZERO);
         body->SetAwake(false);
         body->SetAwake(true);
-        
+
         // Remove particle emitter
         node_->GetChild("Emitter", true)->Remove();
-        
+
         // Update lifes UI and counter
         remainingLifes_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
-        
+
         // Reset wounded state
         wounded_ = false;
-        
+
         // Handle death
         if (remainingLifes_ == 0)
         {
             HandleDeath();
             return;
         }
-        
+
         // Re-position the character to the nearest point
         if (node_->GetPosition().x_ < 15.0f)
             node_->SetPosition(Vector3(-5.0f, 11.0f, 0.0f));
@@ -174,27 +174,27 @@ void Character2D::HandleWoundedState(float timeStep)
 
 void Character2D::HandleDeath()
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
-    
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
+
     // Set state to 'killed'
     killed_ = true;
-    
+
     // Update UI elements
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     instructions->SetText("!!! GAME OVER !!!");
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
 
     // Show mouse cursor so that we can click
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
-    
+
     // Put character outside of the scene and magnify him
     node_->SetPosition(Vector3(-20.0f, 0.0f, 0.0f));
     node_->SetScale(1.2f);
-    
+
     // Play death animation once
     if (animatedSprite->GetAnimation() != "dead")
         animatedSprite->SetAnimation("dead");

+ 24 - 24
Source/Samples/49_Urho2DIsometricDemo/Urho2DIsometricDemo.cpp

@@ -92,7 +92,7 @@ void Urho2DIsometricDemo::Start()
 
     // Create the UI content
     sample2D_->CreateUIContent("ISOMETRIC 2.5D DEMO", character2D_->remainingLifes_, character2D_->remainingCoins_);
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Button* playButton = static_cast<Button*>(ui->GetRoot()->GetChild("PlayButton", true));
     SubscribeToEvent(playButton, E_RELEASED, URHO3D_HANDLER(Urho2DIsometricDemo, HandlePlayButton));
 
@@ -108,29 +108,29 @@ void Urho2DIsometricDemo::CreateScene()
     // Create the Octree, DebugRenderer and PhysicsWorld2D components to the scene
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<DebugRenderer>();
-    PhysicsWorld2D* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
     physicsWorld->SetGravity(Vector2(0.0f, 0.0f)); // Neutralize gravity as the character will always be grounded
 
     // Create camera
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(2.0f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (2.0) is set for full visibility at 1280x800 resolution)
 
     // Setup the viewport for displaying the scene
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera));
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     renderer->SetViewport(0, viewport);
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     // Create tile map from tmx file
-    TmxFile2D* tmxFile = cache->GetResource<TmxFile2D>("Urho2D/Tilesets/atrium.tmx");
+    auto* tmxFile = cache->GetResource<TmxFile2D>("Urho2D/Tilesets/atrium.tmx");
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
-    TileMap2D* tileMap = tileMapNode->CreateComponent<TileMap2D>();
+    auto* tileMap = tileMapNode->CreateComponent<TileMap2D>();
     tileMap->SetTmxFile(tmxFile);
     const TileMapInfo2D& info = tileMap->GetInfo();
 
@@ -151,11 +151,11 @@ void Urho2DIsometricDemo::CreateScene()
     // Instantiate coins to pick at each placeholder of "Coins" layer (placeholders for coins are Rectangle objects)
     TileMapLayer2D* coinsLayer = tileMap->GetLayer(tileMap->GetNumLayers() - 3);
     sample2D_->PopulateCoins(coinsLayer);
-    
+
     // Init coins counters
     character2D_->remainingCoins_ = coinsLayer->GetNumObjects();
     character2D_->maxCoins_ = coinsLayer->GetNumObjects();
-    
+
     // Check when scene is rendered
     SubscribeToEvent(E_ENDRENDERING, URHO3D_HANDLER(Urho2DIsometricDemo, HandleSceneRendered));
 }
@@ -163,18 +163,18 @@ void Urho2DIsometricDemo::CreateScene()
 void Urho2DIsometricDemo::HandleCollisionBegin(StringHash eventType, VariantMap& eventData)
 {
     // Get colliding node
-    Node* hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEA].GetPtr());
+    auto* hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEA].GetPtr());
     if (hitNode->GetName() == "Imp")
         hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEB].GetPtr());
     String nodeName = hitNode->GetName();
     Node* character2DNode = scene_->GetChild("Imp", true);
-    
+
     // Handle coins picking
     if (nodeName == "Coin")
     {
         hitNode->Remove();
         character2D_->remainingCoins_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         if (character2D_->remainingCoins_ == 0)
         {
             Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
@@ -184,13 +184,13 @@ void Urho2DIsometricDemo::HandleCollisionBegin(StringHash eventType, VariantMap&
         coinsText->SetText(String(character2D_->remainingCoins_)); // Update coins UI counter
         sample2D_->PlaySoundEffect("Powerup.wav");
     }
-    
+
     // Handle interactions with enemies
     if (nodeName == "Orc")
     {
-        AnimatedSprite2D* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
+        auto* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
         float deltaX = character2DNode->GetPosition().x_ - hitNode->GetPosition().x_;
-        
+
         // Orc killed if character is fighting in its direction when the contact occurs
         if (animatedSprite->GetAnimation() == "attack" && (deltaX < 0 == animatedSprite->GetFlipX()))
         {
@@ -210,7 +210,7 @@ void Urho2DIsometricDemo::HandleCollisionBegin(StringHash eventType, VariantMap&
                 character2D_->wounded_ = true;
                 if (nodeName == "Orc")
                 {
-                    Mover* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
+                    auto* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
                     orc->fightTimer_ = 1;
                 }
                 sample2D_->SpawnEffect(character2DNode);
@@ -242,7 +242,7 @@ void Urho2DIsometricDemo::SubscribeToEvents()
 
     // Unsubscribe the SceneUpdate event from base class to prevent camera pitch and yaw in 2D sample
     UnsubscribeFromEvent(E_SCENEUPDATE);
-    
+
     // Subscribe to Box2D contact listeners
     SubscribeToEvent(E_PHYSICSBEGINCONTACT2D, URHO3D_HANDLER(Urho2DIsometricDemo, HandleCollisionBegin));
 }
@@ -255,7 +255,7 @@ void Urho2DIsometricDemo::HandleUpdate(StringHash eventType, VariantMap& eventDa
     if (cameraNode_)
         sample2D_->Zoom(cameraNode_->GetComponent<Camera>());
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Toggle debug geometry with 'Z' key
     if (input->GetKeyPress(KEY_Z))
@@ -282,11 +282,11 @@ void Urho2DIsometricDemo::HandlePostRenderUpdate(StringHash eventType, VariantMa
 {
     if (drawDebug_)
     {
-        PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+        auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
         physicsWorld->DrawDebugGeometry();
 
         Node* tileMapNode = scene_->GetChild("TileMap", true);
-        TileMap2D* map = tileMapNode->GetComponent<TileMap2D>();
+        auto* map = tileMapNode->GetComponent<TileMap2D>();
         map->DrawDebugGeometry(scene_->GetComponent<DebugRenderer>(), false);
     }
 }
@@ -315,7 +315,7 @@ void Urho2DIsometricDemo::ReloadScene(bool reInit)
     }
 
     // Update lifes UI
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
     lifeText->SetText(String(lifes));
 
@@ -327,7 +327,7 @@ void Urho2DIsometricDemo::ReloadScene(bool reInit)
 void Urho2DIsometricDemo::HandlePlayButton(StringHash eventType, VariantMap& eventData)
 {
     // Remove fullscreen UI and unfreeze the scene
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     if (static_cast<Text*>(ui->GetRoot()->GetChild("FullUI", true)))
     {
         ui->GetRoot()->GetChild("FullUI", true)->Remove();
@@ -346,7 +346,7 @@ void Urho2DIsometricDemo::HandlePlayButton(StringHash eventType, VariantMap& eve
     playButton->SetVisible(false);
 
     // Hide mouse cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(false);
 }
 

+ 11 - 11
Source/Samples/50_Urho2DPlatformer/Character2D.cpp

@@ -85,15 +85,15 @@ void Character2D::Update(float timeStep)
     }
 
     // Set temporary variables
-    Input* input = GetSubsystem<Input>();
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* input = GetSubsystem<Input>();
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
     bool onGround = false;
     bool jump = false;
 
     // Collision detection (AABB query)
     Vector2 characterHalfSize = Vector2(0.16f, 0.16f);
-    PhysicsWorld2D* physicsWorld = GetScene()->GetComponent<PhysicsWorld2D>();
+    auto* physicsWorld = GetScene()->GetComponent<PhysicsWorld2D>();
     PODVector<RigidBody2D*> collidingBodies;
     physicsWorld->GetRigidBodies(collidingBodies, Rect(node_->GetWorldPosition2D() - characterHalfSize - Vector2(0.0f, 0.1f), node_->GetWorldPosition2D() + characterHalfSize));
 
@@ -161,8 +161,8 @@ void Character2D::Update(float timeStep)
 
 void Character2D::HandleWoundedState(float timeStep)
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
 
     // Play "hit" animation in loop
     if (animatedSprite->GetAnimation() != "hit")
@@ -186,7 +186,7 @@ void Character2D::HandleWoundedState(float timeStep)
 
         // Update lifes UI and counter
         remainingLifes_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
 
@@ -210,21 +210,21 @@ void Character2D::HandleWoundedState(float timeStep)
 
 void Character2D::HandleDeath()
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
 
     // Set state to 'killed'
     killed_ = true;
 
     // Update UI elements
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     instructions->SetText("!!! GAME OVER !!!");
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
 
     // Show mouse cursor so that we can click
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
 
     // Put character outside of the scene and magnify him

+ 23 - 23
Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.cpp

@@ -97,7 +97,7 @@ void Urho2DPlatformer::Start()
 
     // Create the UI content
     sample2D_->CreateUIContent("PLATFORMER 2D DEMO", character2D_->remainingLifes_, character2D_->remainingCoins_);
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Button* playButton = static_cast<Button*>(ui->GetRoot()->GetChild("PlayButton", true));
     SubscribeToEvent(playButton, E_RELEASED, URHO3D_HANDLER(Urho2DPlatformer, HandlePlayButton));
 
@@ -113,20 +113,20 @@ void Urho2DPlatformer::CreateScene()
     // Create the Octree, DebugRenderer and PhysicsWorld2D components to the scene
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<DebugRenderer>();
-    /*PhysicsWorld2D* physicsWorld =*/ scene_->CreateComponent<PhysicsWorld2D>(); 
+    /*PhysicsWorld2D* physicsWorld =*/ scene_->CreateComponent<PhysicsWorld2D>();
 
     // Create camera
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetZoom(2.0f * Min((float)graphics->GetWidth() / 1280.0f, (float)graphics->GetHeight() / 800.0f)); // Set zoom according to user's resolution to ensure full visibility (initial zoom (2.0) is set for full visibility at 1280x800 resolution)
 
     // Setup the viewport for displaying the scene
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera));
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     renderer->SetViewport(0, viewport);
 
     // Set background color for the scene
@@ -134,9 +134,9 @@ void Urho2DPlatformer::CreateScene()
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
 
     // Create tile map from tmx file
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
-    TileMap2D* tileMap = tileMapNode->CreateComponent<TileMap2D>();
+    auto* tileMap = tileMapNode->CreateComponent<TileMap2D>();
     tileMap->SetTmxFile(cache->GetResource<TmxFile2D>("Urho2D/Tilesets/Ortho.tmx"));
     const TileMapInfo2D& info = tileMap->GetInfo();
 
@@ -200,7 +200,7 @@ void Urho2DPlatformer::SubscribeToEvents()
 void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& eventData)
 {
     // Get colliding node
-    Node* hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEA].GetPtr());
+    auto* hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEA].GetPtr());
     if (hitNode->GetName() == "Imp")
         hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEB].GetPtr());
     String nodeName = hitNode->GetName();
@@ -214,7 +214,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
         else
         {
             character2D_->isClimbing_ = true;
-            RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+            auto* body = character2DNode->GetComponent<RigidBody2D>();
             body->SetGravityScale(0.0f); // Override gravity so that the character doesn't fall
             // Clear forces so that the character stops (should be performed by setting linear velocity to zero, but currently doesn't work)
             body->SetLinearVelocity(Vector2(0.0f, 0.0f));
@@ -231,7 +231,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     {
         hitNode->Remove();
         character2D_->remainingCoins_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         if (character2D_->remainingCoins_ == 0)
         {
             Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
@@ -245,7 +245,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     // Handle interactions with enemies
     if (nodeName == "Enemy" || nodeName == "Orc")
     {
-        AnimatedSprite2D* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
+        auto* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
         float deltaX = character2DNode->GetPosition().x_ - hitNode->GetPosition().x_;
 
         // Orc killed if character is fighting in its direction when the contact occurs (flowers are not destroyable)
@@ -267,7 +267,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
                 character2D_->wounded_ = true;
                 if (nodeName == "Orc")
                 {
-                    Mover* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
+                    auto* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
                     orc->fightTimer_ = 1;
                 }
                 sample2D_->SpawnEffect(character2DNode);
@@ -280,7 +280,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     if (nodeName == "Exit" && character2D_->remainingCoins_ == 0)
     {
         // Update UI
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
         instructions->SetText("!!! WELL DONE !!!");
         instructions->SetPosition(IntVector2(0, 0));
@@ -292,7 +292,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     // Handle falling into lava
     if (nodeName == "Lava")
     {
-        RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+        auto* body = character2DNode->GetComponent<RigidBody2D>();
         body->ApplyForceToCenter(Vector2(0.0f, 1000.0f), true);
         if (!character2DNode->GetChild("Emitter", true))
         {
@@ -310,7 +310,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
 void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& eventData)
 {
     // Get colliding node
-    Node* hitNode = static_cast<Node*>(eventData[PhysicsEndContact2D::P_NODEA].GetPtr());
+    auto* hitNode = static_cast<Node*>(eventData[PhysicsEndContact2D::P_NODEA].GetPtr());
     if (hitNode->GetName() == "Imp")
         hitNode = static_cast<Node*>(eventData[PhysicsEndContact2D::P_NODEB].GetPtr());
     String nodeName = hitNode->GetName();
@@ -324,7 +324,7 @@ void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& even
         else
         {
             character2D_->isClimbing_ = false;
-            RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+            auto* body = character2DNode->GetComponent<RigidBody2D>();
             body->SetGravityScale(1.0f); // Restore gravity
         }
     }
@@ -337,7 +337,7 @@ void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& even
     {
         character2D_->onSlope_ = false;
         // Clear forces (should be performed by setting linear velocity to zero, but currently doesn't work)
-        RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+        auto* body = character2DNode->GetComponent<RigidBody2D>();
         body->SetLinearVelocity(Vector2::ZERO);
         body->SetAwake(false);
         body->SetAwake(true);
@@ -352,7 +352,7 @@ void Urho2DPlatformer::HandleUpdate(StringHash eventType, VariantMap& eventData)
     if (cameraNode_)
         sample2D_->Zoom(cameraNode_->GetComponent<Camera>());
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
     // Toggle debug geometry with 'Z' key
     if (input->GetKeyPress(KEY_Z))
@@ -378,11 +378,11 @@ void Urho2DPlatformer::HandlePostRenderUpdate(StringHash eventType, VariantMap&
 {
     if (drawDebug_)
     {
-        PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+        auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
         physicsWorld->DrawDebugGeometry();
 
         Node* tileMapNode = scene_->GetChild("TileMap", true);
-        TileMap2D* map = tileMapNode->GetComponent<TileMap2D>();
+        auto* map = tileMapNode->GetComponent<TileMap2D>();
         map->DrawDebugGeometry(scene_->GetComponent<DebugRenderer>(), false);
     }
 }
@@ -411,7 +411,7 @@ void Urho2DPlatformer::ReloadScene(bool reInit)
     }
 
     // Update lifes UI
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
     lifeText->SetText(String(lifes));
 
@@ -423,7 +423,7 @@ void Urho2DPlatformer::ReloadScene(bool reInit)
 void Urho2DPlatformer::HandlePlayButton(StringHash eventType, VariantMap& eventData)
 {
     // Remove fullscreen UI and unfreeze the scene
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     if (static_cast<Text*>(ui->GetRoot()->GetChild("FullUI", true)))
     {
         ui->GetRoot()->GetChild("FullUI", true)->Remove();
@@ -442,6 +442,6 @@ void Urho2DPlatformer::HandlePlayButton(StringHash eventType, VariantMap& eventD
     playButton->SetVisible(false);
 
     // Hide mouse cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(false);
 }

+ 1 - 1
Source/Samples/Utilities2D/Mover.cpp

@@ -87,7 +87,7 @@ void Mover::Update(float timeStep)
     // Handle Orc states (idle/wounded/fighting)
     if (node_->GetName() == "Orc")
     {
-        AnimatedSprite2D* animatedSprite = node_->GetComponent<AnimatedSprite2D>();
+        auto* animatedSprite = node_->GetComponent<AnimatedSprite2D>();
         String anim = "run";
 
         // Handle wounded state

+ 59 - 59
Source/Samples/Utilities2D/Sample2D.cpp

@@ -73,7 +73,7 @@ Sample2D::~Sample2D()
 void Sample2D::CreateCollisionShapesFromTMXObjects(Node* tileMapNode, TileMapLayer2D* tileMapLayer, TileMapInfo2D info)
 {
     // Create rigid body to the root node
-    RigidBody2D* body = tileMapNode->CreateComponent<RigidBody2D>();
+    auto* body = tileMapNode->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
 
     // Generate physics collision shapes and rigid bodies from the tmx file's objects located in "Physics" layer
@@ -113,7 +113,7 @@ void Sample2D::CreateCollisionShapesFromTMXObjects(Node* tileMapNode, TileMapLay
 
 CollisionBox2D* Sample2D::CreateRectangleShape(Node* node, TileMapObject2D* object, Vector2 size, TileMapInfo2D info)
 {
-    CollisionBox2D* shape = node->CreateComponent<CollisionBox2D>();
+    auto* shape = node->CreateComponent<CollisionBox2D>();
     shape->SetSize(size);
     if (info.orientation_ == O_ORTHOGONAL)
         shape->SetCenter(object->GetPosition() + size / 2);
@@ -130,7 +130,7 @@ CollisionBox2D* Sample2D::CreateRectangleShape(Node* node, TileMapObject2D* obje
 
 CollisionCircle2D* Sample2D::CreateCircleShape(Node* node, TileMapObject2D* object, float radius, TileMapInfo2D info)
 {
-    CollisionCircle2D* shape = node->CreateComponent<CollisionCircle2D>();
+    auto* shape = node->CreateComponent<CollisionCircle2D>();
     Vector2 size = object->GetSize();
     if (info.orientation_ == O_ORTHOGONAL)
         shape->SetCenter(object->GetPosition() + size / 2);
@@ -148,7 +148,7 @@ CollisionCircle2D* Sample2D::CreateCircleShape(Node* node, TileMapObject2D* obje
 
 CollisionPolygon2D* Sample2D::CreatePolygonShape(Node* node, TileMapObject2D* object)
 {
-    CollisionPolygon2D* shape = node->CreateComponent<CollisionPolygon2D>();
+    auto* shape = node->CreateComponent<CollisionPolygon2D>();
     int numVertices = object->GetNumPoints();
     shape->SetVertexCount(numVertices);
     for (int i = 0; i < numVertices; ++i)
@@ -161,7 +161,7 @@ CollisionPolygon2D* Sample2D::CreatePolygonShape(Node* node, TileMapObject2D* ob
 
 CollisionChain2D* Sample2D::CreatePolyLineShape(Node* node, TileMapObject2D* object)
 {
-    CollisionChain2D* shape = node->CreateComponent<CollisionChain2D>();
+    auto* shape = node->CreateComponent<CollisionChain2D>();
     int numVertices = object->GetNumPoints();
     shape->SetVertexCount(numVertices);
     for (int i = 0; i < numVertices; ++i)
@@ -174,20 +174,20 @@ CollisionChain2D* Sample2D::CreatePolyLineShape(Node* node, TileMapObject2D* obj
 
 Node* Sample2D::CreateCharacter(TileMapInfo2D info, float friction, Vector3 position, float scale)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* spriteNode = scene_->CreateChild("Imp");
     spriteNode->SetPosition(position);
     spriteNode->SetScale(scale);
-    AnimatedSprite2D* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
+    auto* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
     // Get scml file and Play "idle" anim
-    AnimationSet2D* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/imp/imp.scml");
+    auto* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/imp/imp.scml");
     animatedSprite->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetLayer(3); // Put character over tile map (which is on layer 0) and over Orcs (which are on layer 2)
-    RigidBody2D* impBody = spriteNode->CreateComponent<RigidBody2D>();
+    auto* impBody = spriteNode->CreateComponent<RigidBody2D>();
     impBody->SetBodyType(BT_DYNAMIC);
     impBody->SetAllowSleep(false);
-    CollisionCircle2D* shape = spriteNode->CreateComponent<CollisionCircle2D>();
+    auto* shape = spriteNode->CreateComponent<CollisionCircle2D>();
     shape->SetRadius(1.1f); // Set shape size
     shape->SetFriction(friction); // Set friction
     shape->SetRestitution(0.1f); // Bounce
@@ -198,38 +198,38 @@ Node* Sample2D::CreateCharacter(TileMapInfo2D info, float friction, Vector3 posi
 Node* Sample2D::CreateTrigger()
 {
     Node* node = scene_->CreateChild(); // Clones will be renamed according to object type
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
-    CollisionBox2D* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
+    auto* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
     shape->SetTrigger(true);
     return node;
 }
 
 Node* Sample2D::CreateEnemy()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Enemy");
-    StaticSprite2D* staticSprite = node->CreateComponent<StaticSprite2D>();
+    auto* staticSprite = node->CreateComponent<StaticSprite2D>();
     staticSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
-    CollisionCircle2D* shape = node->CreateComponent<CollisionCircle2D>(); // Create circle shape
+    auto* shape = node->CreateComponent<CollisionCircle2D>(); // Create circle shape
     shape->SetRadius(0.25f); // Set radius
     return node;
 }
 
 Node* Sample2D::CreateOrc()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Orc");
     node->SetScale(scene_->GetChild("Imp", true)->GetScale());
-    AnimatedSprite2D* animatedSprite = node->CreateComponent<AnimatedSprite2D>();
-    AnimationSet2D* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/Orc/Orc.scml");
+    auto* animatedSprite = node->CreateComponent<AnimatedSprite2D>();
+    auto* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/Orc/Orc.scml");
     animatedSprite->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("run"); // Get scml file and Play "run" anim
     animatedSprite->SetLayer(2); // Make orc always visible
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
-    CollisionCircle2D* shape = node->CreateComponent<CollisionCircle2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
+    auto* shape = node->CreateComponent<CollisionCircle2D>();
     shape->SetRadius(1.3f); // Set shape size
     shape->SetTrigger(true);
     return node;
@@ -237,17 +237,17 @@ Node* Sample2D::CreateOrc()
 
 Node* Sample2D::CreateCoin()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Coin");
     node->SetScale(0.5);
-    AnimatedSprite2D* animatedSprite = node->CreateComponent<AnimatedSprite2D>();
-    AnimationSet2D* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
+    auto* animatedSprite = node->CreateComponent<AnimatedSprite2D>();
+    auto* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
     animatedSprite->SetAnimationSet(animationSet); // Get scml file and Play "idle" anim
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetLayer(4);
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
-    CollisionCircle2D* shape = node->CreateComponent<CollisionCircle2D>(); // Create circle shape
+    auto* shape = node->CreateComponent<CollisionCircle2D>(); // Create circle shape
     shape->SetRadius(0.32f); // Set radius
     shape->SetTrigger(true);
     return node;
@@ -255,14 +255,14 @@ Node* Sample2D::CreateCoin()
 
 Node* Sample2D::CreateMovingPlatform()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("MovingPlatform");
     node->SetScale(Vector3(3.0f, 1.0f, 0.0f));
-    StaticSprite2D* staticSprite = node->CreateComponent<StaticSprite2D>();
+    auto* staticSprite = node->CreateComponent<StaticSprite2D>();
     staticSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Box.png"));
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
-    CollisionBox2D* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
+    auto* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
     shape->SetSize(Vector2(0.32f, 0.32f)); // Set box size
     shape->SetFriction(0.8f); // Set friction
     return node;
@@ -299,7 +299,7 @@ void Sample2D::PopulateMovingEntities(TileMapLayer2D* movingEntitiesLayer)
             movingClone->SetPosition2D(movingObject->GetPoint(0) + offset);
 
             // Create script object that handles entity translation along its path
-            Mover* mover = movingClone->CreateComponent<Mover>();
+            auto* mover = movingClone->CreateComponent<Mover>();
 
             // Set path from points
             PODVector<Vector2> path = CreatePathFromPoints(movingObject, offset);
@@ -328,7 +328,7 @@ void Sample2D::PopulateCoins(TileMapLayer2D* coinsLayer)
         TileMapObject2D* coinObject = coinsLayer->GetObject(i); // Get placeholder object
         Node* coinClone = coinNode->Clone();
         coinClone->SetPosition2D(coinObject->GetPosition() + coinObject->GetSize() / 2 + Vector2(0.0f, 0.16f));
-        
+
     }
 
     // Remove node used for cloning purpose
@@ -348,7 +348,7 @@ void Sample2D::PopulateTriggers(TileMapLayer2D* triggersLayer)
         {
             Node* triggerClone = triggerNode->Clone();
             triggerClone->SetName(triggerObject->GetType());
-            CollisionBox2D* shape = triggerClone->GetComponent<CollisionBox2D>();
+            auto* shape = triggerClone->GetComponent<CollisionBox2D>();
             shape->SetSize(triggerObject->GetSize());
             triggerClone->SetPosition2D(triggerObject->GetPosition() + triggerObject->GetSize() / 2);
         }
@@ -357,7 +357,7 @@ void Sample2D::PopulateTriggers(TileMapLayer2D* triggersLayer)
 
 float Sample2D::Zoom(Camera* camera)
 {
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     float zoom_ = camera->GetZoom();
 
     if (input->GetMouseMoveWheel() != 0)
@@ -389,92 +389,92 @@ PODVector<Vector2> Sample2D::CreatePathFromPoints(TileMapObject2D* object, Vecto
 
 void Sample2D::CreateUIContent(String demoTitle, int remainingLifes, int remainingCoins)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
 
     // Set the default UI style and font
     ui->GetRoot()->SetDefaultStyle(cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
+    auto* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
 
     // We create in-game UIs (coins and lifes) first so that they are hidden by the fullscreen UI (we could also temporary hide them using SetVisible)
 
     // Create the UI for displaying the remaining coins
-    BorderImage* coinsUI = ui->GetRoot()->CreateChild<BorderImage>("Coins");
+    auto* coinsUI = ui->GetRoot()->CreateChild<BorderImage>("Coins");
     coinsUI->SetTexture(cache->GetResource<Texture2D>("Urho2D/GoldIcon.png"));
     coinsUI->SetSize(50, 50);
     coinsUI->SetImageRect(IntRect(0, 64, 60, 128));
     coinsUI->SetAlignment(HA_LEFT, VA_TOP);
     coinsUI->SetPosition(5, 5);
-    Text* coinsText = coinsUI->CreateChild<Text>("CoinsText");
+    auto* coinsText = coinsUI->CreateChild<Text>("CoinsText");
     coinsText->SetAlignment(HA_CENTER, VA_CENTER);
     coinsText->SetFont(font, 24);
     coinsText->SetTextEffect(TE_SHADOW);
     coinsText->SetText(String(remainingCoins));
 
     // Create the UI for displaying the remaining lifes
-    BorderImage* lifeUI = ui->GetRoot()->CreateChild<BorderImage>("Life");
+    auto* lifeUI = ui->GetRoot()->CreateChild<BorderImage>("Life");
     lifeUI->SetTexture(cache->GetResource<Texture2D>("Urho2D/imp/imp_all.png"));
     lifeUI->SetSize(70, 80);
     lifeUI->SetAlignment(HA_RIGHT, VA_TOP);
     lifeUI->SetPosition(-5, 5);
-    Text* lifeText = lifeUI->CreateChild<Text>("LifeText");
+    auto* lifeText = lifeUI->CreateChild<Text>("LifeText");
     lifeText->SetAlignment(HA_CENTER, VA_CENTER);
     lifeText->SetFont(font, 24);
     lifeText->SetTextEffect(TE_SHADOW);
     lifeText->SetText(String(remainingLifes));
 
     // Create the fullscreen UI for start/end
-    Window* fullUI = ui->GetRoot()->CreateChild<Window>("FullUI");
+    auto* fullUI = ui->GetRoot()->CreateChild<Window>("FullUI");
     fullUI->SetStyleAuto();
     fullUI->SetSize(ui->GetRoot()->GetWidth(), ui->GetRoot()->GetHeight());
     fullUI->SetEnabled(false); // Do not react to input, only the 'Exit' and 'Play' buttons will
 
     // Create the title
-    BorderImage* title = fullUI->CreateChild<BorderImage>("Title");
+    auto* title = fullUI->CreateChild<BorderImage>("Title");
     title->SetMinSize(fullUI->GetWidth(), 50);
     title->SetTexture(cache->GetResource<Texture2D>("Textures/HeightMap.png"));
     title->SetFullImageRect();
     title->SetAlignment(HA_CENTER, VA_TOP);
-    Text* titleText = title->CreateChild<Text>("TitleText");
+    auto* titleText = title->CreateChild<Text>("TitleText");
     titleText->SetAlignment(HA_CENTER, VA_CENTER);
     titleText->SetFont(font, 24);
     titleText->SetText(demoTitle);
 
     // Create the image
-    BorderImage* spriteUI = fullUI->CreateChild<BorderImage>("Sprite");
+    auto* spriteUI = fullUI->CreateChild<BorderImage>("Sprite");
     spriteUI->SetTexture(cache->GetResource<Texture2D>("Urho2D/imp/imp_all.png"));
     spriteUI->SetSize(238, 271);
     spriteUI->SetAlignment(HA_CENTER, VA_CENTER);
     spriteUI->SetPosition(0, - ui->GetRoot()->GetHeight() / 4);
 
     // Create the 'EXIT' button
-    Button* exitButton = ui->GetRoot()->CreateChild<Button>("ExitButton");
+    auto* exitButton = ui->GetRoot()->CreateChild<Button>("ExitButton");
     exitButton->SetStyleAuto();
     exitButton->SetFocusMode(FM_RESETFOCUS);
     exitButton->SetSize(100, 50);
     exitButton->SetAlignment(HA_CENTER, VA_CENTER);
     exitButton->SetPosition(-100, 0);
-    Text* exitText = exitButton->CreateChild<Text>("ExitText");
+    auto* exitText = exitButton->CreateChild<Text>("ExitText");
     exitText->SetAlignment(HA_CENTER, VA_CENTER);
     exitText->SetFont(font, 24);
     exitText->SetText("EXIT");
     SubscribeToEvent(exitButton, E_RELEASED, URHO3D_HANDLER(Sample2D, HandleExitButton));
 
     // Create the 'PLAY' button
-    Button* playButton = ui->GetRoot()->CreateChild<Button>("PlayButton");
+    auto* playButton = ui->GetRoot()->CreateChild<Button>("PlayButton");
     playButton->SetStyleAuto();
     playButton->SetFocusMode(FM_RESETFOCUS);
     playButton->SetSize(100, 50);
     playButton->SetAlignment(HA_CENTER, VA_CENTER);
     playButton->SetPosition(100, 0);
-    Text* playText = playButton->CreateChild<Text>("PlayText");
+    auto* playText = playButton->CreateChild<Text>("PlayText");
     playText->SetAlignment(HA_CENTER, VA_CENTER);
     playText->SetFont(font, 24);
     playText->SetText("PLAY");
 //  SubscribeToEvent(playButton, E_RELEASED, HANDLER(Urho2DPlatformer, HandlePlayButton));
 
     // Create the instructions
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>("Instructions");
+    auto* instructionText = ui->GetRoot()->CreateChild<Text>("Instructions");
     instructionText->SetText("Use WASD keys or Arrows to move\nPageUp/PageDown/MouseWheel to zoom\nF5/F7 to save/reload scene\n'Z' to toggle debug geometry\nSpace to fight");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
@@ -482,13 +482,13 @@ void Sample2D::CreateUIContent(String demoTitle, int remainingLifes, int remaini
     instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
 
     // Show mouse cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
 }
 
 void Sample2D::HandleExitButton(StringHash eventType, VariantMap& eventData)
 {
-    Engine* engine = GetSubsystem<Engine>();
+    auto* engine = GetSubsystem<Engine>();
     engine->Exit();
 }
 
@@ -503,11 +503,11 @@ void Sample2D::SaveScene(bool initial)
 
 void Sample2D::CreateBackgroundSprite(TileMapInfo2D info, float scale, String texture, bool animate)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Background");
     node->SetPosition(Vector3(info.GetMapWidth(), info.GetMapHeight(), 0) / 2);
     node->SetScale(scale);
-    StaticSprite2D* sprite = node->CreateComponent<StaticSprite2D>();
+    auto* sprite = node->CreateComponent<StaticSprite2D>();
     sprite->SetSprite(cache->GetResource<Sprite2D>(texture));
     SetRandomSeed(Time::GetSystemTime()); // Randomize from system clock
     sprite->SetColor(Color(Random(0.0f, 1.0f), Random(0.0f, 1.0f), Random(0.0f, 1.0f), 1.0f));
@@ -525,19 +525,19 @@ void Sample2D::CreateBackgroundSprite(TileMapInfo2D info, float scale, String te
 
 void Sample2D::SpawnEffect(Node* node)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* particleNode = node->CreateChild("Emitter");
     particleNode->SetScale(0.5 / node->GetScale().x_);
-    ParticleEmitter2D* particleEmitter = particleNode->CreateComponent<ParticleEmitter2D>();
+    auto* particleEmitter = particleNode->CreateComponent<ParticleEmitter2D>();
     particleEmitter->SetLayer(2);
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex"));
 }
 
 void Sample2D::PlaySoundEffect(String soundName)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    SoundSource* source = scene_->CreateComponent<SoundSource>();
-    Sound* sound = cache->GetResource<Sound>("Sounds/" + soundName);
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* source = scene_->CreateComponent<SoundSource>();
+    auto* sound = cache->GetResource<Sound>("Sounds/" + soundName);
     if (sound != NULL) {
         source->SetAutoRemoveMode(REMOVE_COMPONENT);
         source->Play(sound);

+ 20 - 20
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -685,7 +685,7 @@ void ExportAnimation(const String& outName, bool animationOnly)
     if (!noAnimations_)
     {
         // Most fbx animation files contain only a skeleton and no skinned mesh.
-        // Assume the scene node contains the model's bone definition and, 
+        // Assume the scene node contains the model's bone definition and,
         // transfer the info to the model.
         if (suppressFbxPivotNodes_ && model.bones_.Size() == 0)
             CollectSceneNodesAsBones(model, rootNode_);
@@ -1131,7 +1131,7 @@ void BuildAndSaveModel(OutModel& model)
         if (model.bones_.Size())
             GetBlendData(model, mesh, model.meshNodes_[i], boneMappings, blendIndices, blendWeights);
 
-        float* dest = (float*)((unsigned char*)vertexData + startVertexOffset * vb->GetVertexSize());
+        auto* dest = (float*)((unsigned char*)vertexData + startVertexOffset * vb->GetVertexSize());
         for (unsigned j = 0; j < mesh->mNumVertices; ++j)
             WriteVertex(dest, mesh, j, isSkinned, box, vertexTransform, normalTransform, blendIndices, blendWeights);
 
@@ -1257,7 +1257,7 @@ void BuildAndSaveAnimations(OutModel* model)
     {
         aiAnimation* anim = animations[i];
 
-        float duration = (float)anim->mDuration;
+        auto duration = (float)anim->mDuration;
         String animName = FromAIString(anim->mName);
         String animOutName;
 
@@ -1275,7 +1275,7 @@ void BuildAndSaveAnimations(OutModel* model)
         else
             animOutName = outPath_ + GetFileName(outName_) + "_" + SanitateAssetName(animName) + ".ani";
 
-        float ticksPerSecond = (float)anim->mTicksPerSecond;
+        auto ticksPerSecond = (float)anim->mTicksPerSecond;
         // If ticks per second not specified, it's probably a .X file. In this case use the default tick rate
         if (ticksPerSecond < M_EPSILON)
             ticksPerSecond = defaultTicksPerSecond_;
@@ -1655,7 +1655,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
         if (createZone_)
         {
             Node* zoneNode = outScene->CreateChild("Zone", localIDs_ ? LOCAL : REPLICATED);
-            Zone* zone = zoneNode->CreateComponent<Zone>();
+            auto* zone = zoneNode->CreateComponent<Zone>();
             zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.f));
             zone->SetAmbientColor(Color(0.25f, 0.25f, 0.25f));
 
@@ -1663,14 +1663,14 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
             if (!scene_->HasLights())
             {
                 Node* lightNode = outScene->CreateChild("GlobalLight", localIDs_ ? LOCAL : REPLICATED);
-                Light* light = lightNode->CreateComponent<Light>();
+                auto* light = lightNode->CreateComponent<Light>();
                 light->SetLightType(LIGHT_DIRECTIONAL);
                 lightNode->SetRotation(Quaternion(60.0f, 30.0f, 0.0f));
             }
         }
     }
 
-    ResourceCache* cache = context_->GetSubsystem<ResourceCache>();
+    auto* cache = context_->GetSubsystem<ResourceCache>();
 
     HashMap<aiNode*, Node*> nodeMapping;
 
@@ -1701,7 +1701,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
         String modelName = (useSubdirs_ ? "Models/" : "") + GetFileNameAndExtension(model.outName_);
         if (!cache->Exists(modelName))
         {
-            Model* dummyModel = new Model(context_);
+            auto* dummyModel = new Model(context_);
             dummyModel->SetName(modelName);
             dummyModel->SetNumGeometries(model.meshes_.Size());
             cache->AddManualResource(dummyModel);
@@ -1715,7 +1715,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
             // Create a dummy material so that the reference can be stored
             if (!cache->Exists(matName))
             {
-                Material* dummyMat = new Material(context_);
+                auto* dummyMat = new Material(context_);
                 dummyMat->SetName(matName);
                 cache->AddManualResource(dummyMat);
             }
@@ -1745,7 +1745,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
                 outNode->SetDirection(lightAdjustDirection);
             }
 
-            Light* outLight = outNode->CreateComponent<Light>();
+            auto* outLight = outNode->CreateComponent<Light>();
             outLight->SetColor(Color(light->mColorDiffuse.r, light->mColorDiffuse.g, light->mColorDiffuse.b));
 
             switch (light->mType)
@@ -1955,7 +1955,7 @@ void BuildAndSaveMaterial(aiMaterial* material, HashSet<String>& usedTextures)
         shadowCullElem.SetString("value", "none");
     }
 
-    FileSystem* fileSystem = context_->GetSubsystem<FileSystem>();
+    auto* fileSystem = context_->GetSubsystem<FileSystem>();
 
     String outFileName = resourcePath_ + (useSubdirs_ ? "Materials/" : "" ) + matName + ".xml";
     if (noOverwriteMaterial_ && fileSystem->FileExists(outFileName))
@@ -1974,7 +1974,7 @@ void BuildAndSaveMaterial(aiMaterial* material, HashSet<String>& usedTextures)
 
 void CopyTextures(const HashSet<String>& usedTextures, const String& sourcePath)
 {
-    FileSystem* fileSystem = context_->GetSubsystem<FileSystem>();
+    auto* fileSystem = context_->GetSubsystem<FileSystem>();
 
     if (useSubdirs_)
         fileSystem->CreateDir(resourcePath_ + "Textures");
@@ -2451,7 +2451,7 @@ void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, bool isSkinned, Bou
             mesh->mColors[i][index].a).ToUInt();
         ++dest;
     }
-    
+
     for (unsigned i = 0; i < mesh->GetNumUVChannels() && i < MAX_CHANNELS; ++i)
     {
         Vector3 texCoord = ToVector3(mesh->mTextureCoords[i][index]);
@@ -2484,8 +2484,8 @@ void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, bool isSkinned, Bou
             else
                 *dest++ = 0.0f;
         }
-    
-        unsigned char* destBytes = (unsigned char*)dest;
+
+        auto* destBytes = (unsigned char*)dest;
         ++dest;
         for (unsigned i = 0; i < 4; ++i)
         {
@@ -2665,7 +2665,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     unsigned int poskeyFrames = channel->mNumPositionKeys;
     unsigned int rotkeyFrames = channel->mNumRotationKeys;
     unsigned int scalekeyFrames = channel->mNumScalingKeys;
-    
+
     // Get max key frames
     for (unsigned i = 0; i < TransformationComp_MAXIMUM; ++i)
     {
@@ -2685,7 +2685,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     // Resize and init vector key array
     if (poskeyFrames > channel->mNumPositionKeys)
     {
-        aiVectorKey* newKeys  = new aiVectorKey[poskeyFrames];
+        auto* newKeys  = new aiVectorKey[poskeyFrames];
         for (unsigned i = 0; i < poskeyFrames; ++i)
         {
             if (i < channel->mNumPositionKeys )
@@ -2699,7 +2699,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     }
     if (rotkeyFrames > channel->mNumRotationKeys)
     {
-        aiQuatKey* newKeys  = new aiQuatKey[rotkeyFrames];
+        auto* newKeys  = new aiQuatKey[rotkeyFrames];
         for (unsigned i = 0; i < rotkeyFrames; ++i)
         {
             if (i < channel->mNumRotationKeys)
@@ -2713,7 +2713,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     }
     if (scalekeyFrames > channel->mNumScalingKeys)
     {
-        aiVectorKey* newKeys  = new aiVectorKey[scalekeyFrames];
+        auto* newKeys  = new aiVectorKey[scalekeyFrames];
         for (unsigned i = 0; i < scalekeyFrames; ++i)
         {
             if ( i < channel->mNumScalingKeys)
@@ -2778,7 +2778,7 @@ void CreatePivotlessFbxBoneStruct(OutModel &model)
             finalTransform = finalTransform * chain[j];
 
         // New bone node
-        aiNode *pnode = new aiNode;
+        auto*pnode = new aiNode;
         pnode->mName = model.bones_[i]->mName;
         pnode->mTransformation = finalTransform * model.bones_[i]->mTransformation;
 

+ 1 - 1
Source/Tools/PackageTool/PackageTool.cpp

@@ -286,7 +286,7 @@ void WritePackageFile(const String& fileName, const String& rootDir)
                 if (pos + unpackedSize > dataSize)
                     unpackedSize = dataSize - pos;
 
-                unsigned packedSize = (unsigned)LZ4_compress_HC((const char*)&buffer[pos], (char*)compressBuffer.Get(), unpackedSize, LZ4_compressBound(unpackedSize), 0);
+                auto packedSize = (unsigned)LZ4_compress_HC((const char*)&buffer[pos], (char*)compressBuffer.Get(), unpackedSize, LZ4_compressBound(unpackedSize), 0);
                 if (!packedSize)
                     ErrorExit("LZ4 compression failed for file " + entries_[i].name_ + " at offset " + String(pos));
 

+ 2 - 2
Source/Tools/ScriptCompiler/ScriptCompiler.cpp

@@ -97,7 +97,7 @@ int main(int argc, char** argv)
     #endif
     }
 
-    Log* log = context->GetSubsystem<Log>();
+    auto* log = context->GetSubsystem<Log>();
     // Register Log subsystem manually if compiled without logging support
     if (!log)
     {
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
         String path, file, extension;
         SplitPath(outputFile, path, file, extension);
 
-        ResourceCache* cache = context->GetSubsystem<ResourceCache>();
+        auto* cache = context->GetSubsystem<ResourceCache>();
 
         // Add resource path to be able to resolve includes
         if (arguments.Size() > 1)

+ 2 - 2
Source/Tools/SpritePacker/SpritePacker.cpp

@@ -121,7 +121,7 @@ void Run(Vector<String>& arguments)
     SharedPtr<Context> context(new Context());
     context->RegisterSubsystem(new FileSystem(context));
     context->RegisterSubsystem(new Log(context));
-    FileSystem* fileSystem = context->GetSubsystem<FileSystem>();
+    auto* fileSystem = context->GetSubsystem<FileSystem>();
 
     Vector<String> inputFiles;
     String outputFile;
@@ -276,7 +276,7 @@ void Run(Vector<String>& arguments)
         }
 
         // load rectangles
-        stbrp_rect* packerRects = new stbrp_rect[packerInfos.Size()];
+        auto* packerRects = new stbrp_rect[packerInfos.Size()];
         for (unsigned i = 0; i < packerInfos.Size(); ++i)
         {
             PackerInfo* packerInfo = packerInfos[i];

+ 3 - 3
Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp

@@ -55,7 +55,7 @@ void Urho3DPlayer::Setup()
     // Read command line from a file if no arguments given. This is primarily intended for mobile platforms.
     // Note that the command file name uses a hardcoded path that does not utilize the resource system
     // properly (including resource path prefix), as the resource system is not yet initialized at this point
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
+    auto* filesystem = GetSubsystem<FileSystem>();
     const String commandFileName = filesystem->GetProgramDir() + "Data/CommandLine.txt";
     if (GetArguments().Empty() && filesystem->FileExists(commandFileName))
     {
@@ -201,7 +201,7 @@ void Urho3DPlayer::Start()
     {
 #ifdef URHO3D_LUA
         // Instantiate and register the Lua script subsystem
-        LuaScript* luaScript = new LuaScript(context_);
+        auto* luaScript = new LuaScript(context_);
         context_->RegisterSubsystem(luaScript);
 
         // If script loading is successful, proceed to main loop
@@ -238,7 +238,7 @@ void Urho3DPlayer::Stop()
 #ifdef URHO3D_LUA
     else
     {
-        LuaScript* luaScript = GetSubsystem<LuaScript>();
+        auto* luaScript = GetSubsystem<LuaScript>();
         if (luaScript && luaScript->GetFunction("Stop", true))
             luaScript->ExecuteFunction("Stop");
     }

+ 2 - 2
Source/Urho3D/AngelScript/APITemplates.h

@@ -380,14 +380,14 @@ template <class T> void RegisterObject(asIScriptEngine* engine, const char* clas
 
 template <class T> T* ConstructObject()
 {
-    T* object = new T(GetScriptContext());
+    auto* object = new T(GetScriptContext());
     object->AddRef();
     return object;
 }
 
 template <class T> T* ConstructNamedObject(const String& name)
 {
-    T* object = new T(GetScriptContext());
+    auto* object = new T(GetScriptContext());
     object->AddRef();
     object->SetName(name);
     return object;

+ 26 - 26
Source/Urho3D/AngelScript/Addons.cpp

@@ -73,7 +73,7 @@ const asPWORD ARRAY_CACHE = 1000;
 
 static void CleanupTypeInfoArrayCache(asITypeInfo *type)
 {
-    SArrayCache *cache = reinterpret_cast<SArrayCache*>(type->GetUserData(ARRAY_CACHE));
+    auto*cache = reinterpret_cast<SArrayCache*>(type->GetUserData(ARRAY_CACHE));
     if (cache)
     {
         cache->~SArrayCache();
@@ -96,7 +96,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length)
     }
 
     // Initialize the object
-    CScriptArray *a = new(mem) CScriptArray(length, ot);
+    auto*a = new(mem) CScriptArray(length, ot);
 
     // It's possible the constructor raised a script exception, in which case we
     // need to free the memory and return null instead, else we get a memory leak.
@@ -124,7 +124,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, void *initList)
     }
 
     // Initialize the object
-    CScriptArray *a = new(mem) CScriptArray(ot, initList);
+    auto*a = new(mem) CScriptArray(ot, initList);
 
     // It's possible the constructor raised a script exception, in which case we
     // need to free the memory and return null instead, else we get a memory leak.
@@ -152,7 +152,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length, void *defVal)
     }
 
     // Initialize the object
-    CScriptArray *a = new(mem) CScriptArray(length, defVal, ot);
+    auto*a = new(mem) CScriptArray(length, defVal, ot);
 
     // It's possible the constructor raised a script exception, in which case we
     // need to free the memory and return null instead, else we get a memory leak.
@@ -382,7 +382,7 @@ CScriptArray::CScriptArray(asITypeInfo *ot, void *buf)
         for( asUINT n = 0; n < length; n++ )
         {
             void *obj = At(n);
-            asBYTE *srcObj = (asBYTE*)buf;
+            auto*srcObj = (asBYTE*)buf;
             srcObj += 4 + n*ot->GetSubType()->GetSize();
             engine->AssignScriptObject(obj, srcObj, ot->GetSubType());
         }
@@ -554,7 +554,7 @@ void CScriptArray::Reserve(asUINT maxElements)
         return;
 
     // Allocate memory for the buffer
-    SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*maxElements));
+    auto*newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*maxElements));
     if( newBuffer )
     {
         newBuffer->numElements = buffer->numElements;
@@ -613,7 +613,7 @@ void CScriptArray::Resize(int delta, asUINT at)
     if( buffer->maxElements < buffer->numElements + delta )
     {
         // Allocate memory for the buffer
-        SArrayBuffer *newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*(buffer->numElements + delta)));
+        auto*newBuffer = reinterpret_cast<SArrayBuffer*>(userAlloc(sizeof(SArrayBuffer)-1 + elementSize*(buffer->numElements + delta)));
         if( newBuffer )
         {
             newBuffer->numElements = buffer->numElements + delta;
@@ -802,8 +802,8 @@ void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
     if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
     {
         // Create an object using the default constructor/factory for each element
-        void **max = (void**)(buf->data + end * sizeof(void*));
-        void **d = (void**)(buf->data + start * sizeof(void*));
+        auto**max = (void**)(buf->data + end * sizeof(void*));
+        auto**d = (void**)(buf->data + start * sizeof(void*));
 
         asIScriptEngine *engine = objType->GetEngine();
         asITypeInfo *subType = objType->GetSubType();
@@ -826,7 +826,7 @@ void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
     else
     {
         // Set all elements to zero whether they are handles or primitives
-        void *d = (void*)(buf->data + start * elementSize);
+        auto*d = (void*)(buf->data + start * elementSize);
         memset(d, 0, (end-start)*elementSize);
     }
 }
@@ -838,8 +838,8 @@ void CScriptArray::Destruct(SArrayBuffer *buf, asUINT start, asUINT end)
     {
         asIScriptEngine *engine = objType->GetEngine();
 
-        void **max = (void**)(buf->data + end * sizeof(void*));
-        void **d   = (void**)(buf->data + start * sizeof(void*));
+        auto**max = (void**)(buf->data + end * sizeof(void*));
+        auto**d   = (void**)(buf->data + start * sizeof(void*));
 
         for( ; d < max; d++ )
         {
@@ -970,7 +970,7 @@ bool CScriptArray::operator==(const CScriptArray &other) const
 
     // Check if all elements are equal
     bool isEqual = true;
-    SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+    auto*cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
     for( asUINT n = 0; n < GetSize(); n++ )
         if( !Equals(At(n), other.At(n), cmpContext, cache) )
         {
@@ -1280,7 +1280,7 @@ void CScriptArray::SortDesc(asUINT startAt, asUINT count)
 void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
 {
     // Subtype isn't primitive and doesn't have opCmp
-    SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+    auto*cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
     {
         if( !cache || cache->cmpFunc == nullptr )
@@ -1401,9 +1401,9 @@ void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src)
         {
             int count = dst->numElements > src->numElements ? src->numElements : dst->numElements;
 
-            void **max = (void**)(dst->data + count * sizeof(void*));
-            void **d   = (void**)dst->data;
-            void **s   = (void**)src->data;
+            auto**max = (void**)(dst->data + count * sizeof(void*));
+            auto**d   = (void**)dst->data;
+            auto**s   = (void**)src->data;
 
             for( ; d < max; d++, s++ )
             {
@@ -1425,9 +1425,9 @@ void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src)
             if( subTypeId & asTYPEID_MASK_OBJECT )
             {
                 // Call the assignment operator on all of the objects
-                void **max = (void**)(dst->data + count * sizeof(void*));
-                void **d   = (void**)dst->data;
-                void **s   = (void**)src->data;
+                auto**max = (void**)(dst->data + count * sizeof(void*));
+                auto**d   = (void**)dst->data;
+                auto**s   = (void**)src->data;
 
                 asITypeInfo *subType = objType->GetSubType();
                 for( ; d < max; d++, s++ )
@@ -1457,7 +1457,7 @@ void CScriptArray::Precache()
     // methods is quite time consuming if a lot of array objects are created.
 
     // First check if a cache already exists for this array type
-    SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
+    auto*cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
     if( cache ) return;
 
     // We need to make sure the cache is created only once, even
@@ -1567,7 +1567,7 @@ void CScriptArray::EnumReferences(asIScriptEngine *engine)
     // If the array is holding handles, then we need to notify the GC of them
     if( subTypeId & asTYPEID_MASK_OBJECT )
     {
-        void **d = (void**)buffer->data;
+        auto**d = (void**)buffer->data;
         for( asUINT n = 0; n < buffer->numElements; n++ )
         {
             if( d[n] )
@@ -1668,7 +1668,7 @@ void RegisterArray(asIScriptEngine* engine)
 CScriptDictionary *CScriptDictionary::Create(asIScriptEngine *engine)
 {
     // Use the custom memory routine from AngelScript to allow application to better control how much memory is used
-    CScriptDictionary *obj = (CScriptDictionary*)asAllocMem(sizeof(CScriptDictionary));
+    auto*obj = (CScriptDictionary*)asAllocMem(sizeof(CScriptDictionary));
     new(obj) CScriptDictionary(engine);
     return obj;
 }
@@ -1676,7 +1676,7 @@ CScriptDictionary *CScriptDictionary::Create(asIScriptEngine *engine)
 CScriptDictionary *CScriptDictionary::Create(asBYTE *buffer)
 {
     // Use the custom memory routine from AngelScript to allow application to better control how much memory is used
-    CScriptDictionary *obj = (CScriptDictionary*)asAllocMem(sizeof(CScriptDictionary));
+    auto*obj = (CScriptDictionary*)asAllocMem(sizeof(CScriptDictionary));
     new(obj) CScriptDictionary(buffer);
     return obj;
 }
@@ -1738,7 +1738,7 @@ CScriptDictionary::CScriptDictionary(asBYTE *buffer)
         buffer += sizeof(int);
 
         // Depending on the type id, the value will inline in the buffer or a pointer
-        void *ref = (void*)buffer;
+        auto*ref = (void*)buffer;
 
         if( typeId >= asTYPEID_INT8 && typeId <= asTYPEID_DOUBLE )
         {
@@ -2039,7 +2039,7 @@ void ScriptDictionaryFactory_Generic(asIScriptGeneric *gen)
 
 void ScriptDictionaryListFactory_Generic(asIScriptGeneric *gen)
 {
-    asBYTE *buffer = (asBYTE*)gen->GetArgAddress(0);
+    auto*buffer = (asBYTE*)gen->GetArgAddress(0);
     *(CScriptDictionary**)gen->GetAddressOfReturnLocation() = CScriptDictionary::Create(buffer);
 }
 

+ 1 - 1
Source/Urho3D/AngelScript/CoreAPI.cpp

@@ -383,7 +383,7 @@ static CScriptArray* VariantGetStringVector(Variant* ptr)
 
 static asIScriptObject* VariantGetScriptObject(Variant* ptr)
 {
-    asIScriptObject* object = static_cast<asIScriptObject*>(ptr->GetVoidPtr());
+    auto* object = static_cast<asIScriptObject*>(ptr->GetVoidPtr());
     if (!object)
         return nullptr;
 

+ 3 - 3
Source/Urho3D/AngelScript/Script.cpp

@@ -58,7 +58,7 @@ class ScriptResourceRouter : public ResourceRouter
             String replaced = ReplaceExtension(name, ".asc");
             // Note: ResourceCache prevents recursive calls to the resource routers so this is OK, the nested Exists()
             // check does not go through the router again
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
+            auto* cache = GetSubsystem<ResourceCache>();
             if (!cache->Exists(name) && cache->Exists(replaced))
                 name = replaced;
         }
@@ -145,7 +145,7 @@ Script::Script(Context* context) :
     SetExecuteConsoleCommands(true);
 
     // Create and register resource router for checking for compiled AngelScript files
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     if (cache)
     {
         router_ = new ScriptResourceRouter(context_);
@@ -170,7 +170,7 @@ Script::~Script()
         scriptEngine_ = nullptr;
     }
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     if (cache)
         cache->RemoveResourceRouter(router_);
 }

+ 5 - 5
Source/Urho3D/AngelScript/ScriptAPI.cpp

@@ -69,7 +69,7 @@ static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const S
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             asIScriptObject* object = instance->GetScriptObject();
             if (!object)
             {
@@ -79,7 +79,7 @@ static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const S
         }
     }
     // Then create a new component if not found
-    ScriptInstance* instance = ptr->CreateComponent<ScriptInstance>(mode);
+    auto* instance = ptr->CreateComponent<ScriptInstance>(mode);
     instance->CreateObject(file, className);
     return instance->GetScriptObject();
 }
@@ -96,7 +96,7 @@ static void RegisterScriptFile(asIScriptEngine* engine)
 
 static asIScriptObject* NodeCreateScriptObject(const String& scriptFileName, const String& className, CreateMode mode, Node* ptr)
 {
-    ResourceCache* cache = GetScriptContext()->GetSubsystem<ResourceCache>();
+    auto* cache = GetScriptContext()->GetSubsystem<ResourceCache>();
     return NodeCreateScriptObjectWithFile(cache->GetResource<ScriptFile>(scriptFileName), className, mode, ptr);
 }
 
@@ -108,7 +108,7 @@ asIScriptObject* NodeGetScriptObject(Node* ptr)
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             asIScriptObject* object = instance->GetScriptObject();
             if (object)
                 return object;
@@ -125,7 +125,7 @@ asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             if (instance->IsA(className))
             {
                 asIScriptObject* object = instance->GetScriptObject();

+ 40 - 40
Source/Urho3D/AngelScript/ScriptAPIDump.cpp

@@ -203,7 +203,7 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
     {
         Log::WriteRaw("namespace Urho3D\n{\n\n/**\n");
 
-        FileSystem* fileSystem = GetSubsystem<FileSystem>();
+        auto* fileSystem = GetSubsystem<FileSystem>();
         Vector<String> headerFileNames;
         String path = AddTrailingSlash(sourceTree);
         if (!path.Empty())
@@ -329,14 +329,14 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
                 "#define uint16 unsigned short\n"
                 "#define uint64 unsigned long\n"
                 "#define null 0\n"
-                "#define in\n"
-                "#define out\n"
-                "#define inout\n"
-                "#define is ==\n"
-                "#define interface struct\n"
-                "#define class struct\n"
-                "#define cast reinterpret_cast\n"
-                "#define mixin\n"
+                "#define in\n"
+                "#define out\n"
+                "#define inout\n"
+                "#define is ==\n"
+                "#define interface struct\n"
+                "#define class struct\n"
+                "#define cast reinterpret_cast\n"
+                "#define mixin\n"
                 "#define funcdef\n"
             );
 
@@ -414,30 +414,30 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
             }
             else if (mode == C_HEADER)
             {
-                if (type->GetFlags() & asOBJ_TEMPLATE) {
-                    String str = "\ntemplate <";
-                    for (asUINT tt = 0, ttm = type->GetSubTypeCount(); tt < ttm; tt++) {
-                        asITypeInfo* pSubType = type->GetSubType(tt);
-                        str += String("class ") + pSubType->GetName() + (tt < ttm - 1 ? ", " : ">");
-                    }
-                    Log::WriteRaw(str);
-                }
+                if (type->GetFlags() & asOBJ_TEMPLATE) {
+                    String str = "\ntemplate <";
+                    for (asUINT tt = 0, ttm = type->GetSubTypeCount(); tt < ttm; tt++) {
+                        asITypeInfo* pSubType = type->GetSubType(tt);
+                        str += String("class ") + pSubType->GetName() + (tt < ttm - 1 ? ", " : ">");
+                    }
+                    Log::WriteRaw(str);
+                }
                 Log::WriteRaw("\nclass " + typeName + "\n{\npublic:\n");
-                for (asUINT m = 0, mc = type->GetBehaviourCount(); m < mc; m++) {
-                    asEBehaviours bh;
-                    asIScriptFunction* pM = type->GetBehaviourByIndex(m, &bh);
-                    if (bh == asBEHAVE_CONSTRUCT || bh == asBEHAVE_DESTRUCT)
-                        Log::WriteRaw(String(pM->GetDeclaration(false, false, true)) + ";\n");
-                }
-                for (asUINT m = 0, mc = type->GetFactoryCount(); m < mc; m++) {
-                    asIScriptFunction* pM = type->GetFactoryByIndex(m);
-                    String declaration(pM->GetDeclaration(false, false, true));
-                    declaration = declaration.Substring(declaration.Find(' ') + 1);
-                    declaration.Replace("@", "&");
-                    Log::WriteRaw(declaration + ";\n");
-                }
-                if (typeName == "String")
-                    Log::WriteRaw("String(const char*);\n");
+                for (asUINT m = 0, mc = type->GetBehaviourCount(); m < mc; m++) {
+                    asEBehaviours bh;
+                    asIScriptFunction* pM = type->GetBehaviourByIndex(m, &bh);
+                    if (bh == asBEHAVE_CONSTRUCT || bh == asBEHAVE_DESTRUCT)
+                        Log::WriteRaw(String(pM->GetDeclaration(false, false, true)) + ";\n");
+                }
+                for (asUINT m = 0, mc = type->GetFactoryCount(); m < mc; m++) {
+                    asIScriptFunction* pM = type->GetFactoryByIndex(m);
+                    String declaration(pM->GetDeclaration(false, false, true));
+                    declaration = declaration.Substring(declaration.Find(' ') + 1);
+                    declaration.Replace("@", "&");
+                    Log::WriteRaw(declaration + ";\n");
+                }
+                if (typeName == "String")
+                    Log::WriteRaw("String(const char*);\n");
             }
 
             unsigned methods = type->GetMethodCount();
@@ -455,14 +455,14 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
                 else
                 {
                     // Sanitate the method name. For some operators fix name
-                    if (declaration.Contains("::op")) {
-                        declaration.Replace("::opEquals(", "::operator==(");
-                        declaration.Replace("::opAssign(", "::operator=(");
-                        declaration.Replace("::opAddAssign(", "::operator+=(");
-                        declaration.Replace("::opAdd(", "::operator+(");
-                        declaration.Replace("::opCmp(", "::operator<(");
-                        declaration.Replace("::opPreInc(", "::operator++(");
-                        declaration.Replace("::opPostInc()", "::operator++(int)");
+                    if (declaration.Contains("::op")) {
+                        declaration.Replace("::opEquals(", "::operator==(");
+                        declaration.Replace("::opAssign(", "::operator=(");
+                        declaration.Replace("::opAddAssign(", "::operator+=(");
+                        declaration.Replace("::opAdd(", "::operator+(");
+                        declaration.Replace("::opCmp(", "::operator<(");
+                        declaration.Replace("::opPreInc(", "::operator++(");
+                        declaration.Replace("::opPostInc()", "::operator++(int)");
                     }
                     if (!declaration.Contains("::op"))
                     {

+ 11 - 11
Source/Urho3D/AngelScript/ScriptFile.cpp

@@ -212,7 +212,7 @@ void ScriptFile::AddEventHandler(Object* sender, StringHash eventType, const Str
 
 void ScriptFile::RemoveEventHandler(StringHash eventType)
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     {
@@ -225,7 +225,7 @@ void ScriptFile::RemoveEventHandler(StringHash eventType)
 
 void ScriptFile::RemoveEventHandler(Object* sender, StringHash eventType)
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     {
@@ -237,7 +237,7 @@ void ScriptFile::RemoveEventHandler(Object* sender, StringHash eventType)
 
 void ScriptFile::RemoveEventHandlers(Object* sender)
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     {
@@ -249,7 +249,7 @@ void ScriptFile::RemoveEventHandlers(Object* sender)
 
 void ScriptFile::RemoveEventHandlers()
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     {
@@ -261,7 +261,7 @@ void ScriptFile::RemoveEventHandlers()
 
 void ScriptFile::RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions)
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     {
@@ -273,7 +273,7 @@ void ScriptFile::RemoveEventHandlersExcept(const PODVector<StringHash>& exceptio
 
 bool ScriptFile::HasEventHandler(StringHash eventType) const
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::ConstIterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
         return i->second_->HasSubscribedToEvent(eventType);
@@ -283,7 +283,7 @@ bool ScriptFile::HasEventHandler(StringHash eventType) const
 
 bool ScriptFile::HasEventHandler(Object* sender, StringHash eventType) const
 {
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::ConstIterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
         return i->second_->HasSubscribedToEvent(sender, eventType);
@@ -541,7 +541,7 @@ void ScriptFile::AddEventHandlerInternal(Object* sender, StringHash eventType, c
 {
     String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
     asIScriptFunction* function = nullptr;
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
 
     if (receiver)
         function = GetMethod(receiver, declaration);
@@ -587,7 +587,7 @@ void ScriptFile::AddEventHandlerInternal(Object* sender, StringHash eventType, c
 
 bool ScriptFile::AddScriptSection(asIScriptEngine* engine, Deserializer& source)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
     unsigned dataSize = source.GetSize();
     SharedArrayPtr<char> buffer(new char[dataSize]);
@@ -857,7 +857,7 @@ void ScriptFile::ReleaseModule()
         compiled_ = false;
         SetMemoryUse(0);
 
-        ResourceCache* cache = GetSubsystem<ResourceCache>();
+        auto* cache = GetSubsystem<ResourceCache>();
         if (cache)
             cache->ResetDependencies(this);
     }
@@ -935,7 +935,7 @@ void ScriptEventInvoker::HandleScriptEvent(StringHash eventType, VariantMap& eve
     if (!file_->IsCompiled())
         return;
 
-    asIScriptFunction* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
+    auto* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
 
     if (object_ && !IsObjectAlive())
     {

+ 5 - 5
Source/Urho3D/AngelScript/ScriptInstance.cpp

@@ -107,7 +107,7 @@ void ScriptInstance::OnSetAttribute(const AttributeInfo& attr, const Variant& sr
     {
         // The component / node to which the ID refers to may not be in the scene yet, and furthermore the ID must go through the
         // SceneResolver first. Delay searching for the object to ApplyAttributes
-        AttributeInfo* attrPtr = const_cast<AttributeInfo*>(&attr);
+        auto* attrPtr = const_cast<AttributeInfo*>(&attr);
         idAttributes_[attrPtr] = src.GetUInt();
     }
     else if (attr.type_ == VAR_RESOURCEREF && attr.ptr_)
@@ -151,7 +151,7 @@ void ScriptInstance::OnSetAttribute(const AttributeInfo& attr, const Variant& sr
 
 void ScriptInstance::OnGetAttribute(const AttributeInfo& attr, Variant& dest) const
 {
-    AttributeInfo* attrPtr = const_cast<AttributeInfo*>(&attr);
+    auto* attrPtr = const_cast<AttributeInfo*>(&attr);
 
     // Get ID's for node / component handle attributes
     if (attr.mode_ & (AM_NODEID | AM_COMPONENTID))
@@ -442,7 +442,7 @@ bool ScriptInstance::HasMethod(const String& declaration) const
 
 void ScriptInstance::SetScriptFileAttr(const ResourceRef& value)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SetScriptFile(cache->GetResource<ScriptFile>(value.name_));
 }
 
@@ -930,7 +930,7 @@ void ScriptInstance::HandleScriptEvent(StringHash eventType, VariantMap& eventDa
     if (!IsEnabledEffective() || !scriptFile_ || !scriptObject_)
         return;
 
-    asIScriptFunction* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
+    auto* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
 
     VariantVector parameters;
     if (method->GetParamCount() > 0)
@@ -1006,7 +1006,7 @@ ScriptEventListener* GetScriptContextEventListener()
     asIScriptContext* context = asGetActiveContext();
     if (context)
     {
-        asIScriptObject* object = static_cast<asIScriptObject*>(context->GetThisPointer());
+        auto* object = static_cast<asIScriptObject*>(context->GetThisPointer());
         if (object && object->GetUserData())
             return GetScriptContextInstance();
         else

+ 2 - 2
Source/Urho3D/Audio/Audio.cpp

@@ -271,7 +271,7 @@ float Audio::GetSoundSourceMasterGain(StringHash typeHash) const
 
 void SDLAudioCallback(void* userdata, Uint8* stream, int len)
 {
-    Audio* audio = static_cast<Audio*>(userdata);
+    auto* audio = static_cast<Audio*>(userdata);
     {
         MutexLock Lock(audio->GetMutex());
         audio->MixOutput(stream, len / audio->GetSampleSize() / Audio::SAMPLE_SIZE_MUL);
@@ -318,7 +318,7 @@ void Audio::MixOutput(void* dest, unsigned samples)
         while (clipSamples--)
             *destPtr++ = (float)Clamp(*clipPtr++, -32768, 32767) / 32768.0f;
 #else
-        short* destPtr = (short*)dest;
+        auto* destPtr = (short*)dest;
         while (clipSamples--)
             *destPtr++ = (short)Clamp(*clipPtr++, -32768, 32767);
 #endif

+ 6 - 6
Source/Urho3D/Audio/OggVorbisSoundStream.cpp

@@ -52,7 +52,7 @@ OggVorbisSoundStream::~OggVorbisSoundStream()
     // Close decoder
     if (decoder_)
     {
-        stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
+        auto* vorbis = static_cast<stb_vorbis*>(decoder_);
 
         stb_vorbis_close(vorbis);
         decoder_ = nullptr;
@@ -63,9 +63,9 @@ bool OggVorbisSoundStream::Seek(unsigned sample_number)
 {
     if (!decoder_)
         return false;
-    
-    stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
-    
+
+    auto* vorbis = static_cast<stb_vorbis*>(decoder_);
+
     return stb_vorbis_seek(vorbis, sample_number) == 1;
 }
 
@@ -74,10 +74,10 @@ unsigned OggVorbisSoundStream::GetData(signed char* dest, unsigned numBytes)
     if (!decoder_)
         return 0;
 
-    stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
+    auto* vorbis = static_cast<stb_vorbis*>(decoder_);
 
     unsigned channels = stereo_ ? 2 : 1;
-    unsigned outSamples = (unsigned)stb_vorbis_get_samples_short_interleaved(vorbis, channels, (short*)dest, numBytes >> 1);
+    auto outSamples = (unsigned)stb_vorbis_get_samples_short_interleaved(vorbis, channels, (short*)dest, numBytes >> 1);
     unsigned outBytes = (outSamples * channels) << 1;
 
     // Rewind and retry if is looping and produced less output than should have

+ 1 - 1
Source/Urho3D/Audio/Sound.cpp

@@ -342,7 +342,7 @@ unsigned Sound::GetSampleSize() const
 
 void Sound::LoadParameters()
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     String xmlName = ReplaceExtension(GetName(), ".xml");
 
     SharedPtr<XMLFile> file(cache->GetTempResource<XMLFile>(xmlName, false));

+ 63 - 63
Source/Urho3D/Audio/SoundSource.cpp

@@ -374,7 +374,7 @@ void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, boo
     {
         int streamBufferSize = streamBuffer_->GetDataSize();
         // Calculate how many bytes of stream sound data is needed
-        int neededSize = (int)((float)samples * frequency_ / (float)mixRate);
+        auto neededSize = (int)((float)samples * frequency_ / (float)mixRate);
         // Add a little safety buffer. Subtract previous unused data
         neededSize += STREAM_SAFETY_SAMPLES;
         neededSize *= soundStream_->GetSampleSize();
@@ -465,8 +465,8 @@ void SoundSource::UpdateMasterGain()
 
 void SoundSource::SetSoundAttr(const ResourceRef& value)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sound* newSound = cache->GetResource<Sound>(value.name_);
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* newSound = cache->GetResource<Sound>(value.name_);
     if (IsPlaying())
         Play(newSound);
     else
@@ -605,7 +605,7 @@ void SoundSource::SetPlayPositionLockless(signed char* pos)
 void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -613,15 +613,15 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -646,7 +646,7 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -677,8 +677,8 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
 void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
-    int rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
+    auto leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
+    auto rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
     if (!leftVol && !rightVol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -686,15 +686,15 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -723,7 +723,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -759,7 +759,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
 void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -767,15 +767,15 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -800,7 +800,7 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -832,8 +832,8 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
 void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
-    int rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
+    auto leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
+    auto rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
     if (!leftVol && !rightVol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -841,15 +841,15 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -880,7 +880,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -918,7 +918,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -926,15 +926,15 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -961,7 +961,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -995,7 +995,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
 void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -1003,15 +1003,15 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -1040,7 +1040,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -1076,7 +1076,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -1084,15 +1084,15 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -1119,7 +1119,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -1153,7 +1153,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     {
         MixZeroVolume(sound, samples, mixRate);
@@ -1161,15 +1161,15 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     }
 
     float add = frequency_ / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     int fractPos = fractPosition_;
 
     if (sound->IsSixteenBit())
     {
-        short* pos = (short*)position_;
-        short* end = (short*)sound->GetEnd();
-        short* repeat = (short*)sound->GetRepeat();
+        auto* pos = (short*)position_;
+        auto* end = (short*)sound->GetEnd();
+        auto* repeat = (short*)sound->GetRepeat();
 
         if (sound->IsLooped())
         {
@@ -1198,7 +1198,7 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     }
     else
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
 
@@ -1234,8 +1234,8 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
 void SoundSource::MixZeroVolume(Sound* sound, unsigned samples, int mixRate)
 {
     float add = frequency_ * (float)samples / (float)mixRate;
-    int intAdd = (int)add;
-    int fractAdd = (int)((add - floorf(add)) * 65536.0f);
+    auto intAdd = (int)add;
+    auto fractAdd = (int)((add - floorf(add)) * 65536.0f);
     unsigned sampleSize = sound->GetSampleSize();
 
     fractPosition_ += fractAdd;

+ 7 - 7
Source/Urho3D/Container/Allocator.cpp

@@ -32,8 +32,8 @@ AllocatorBlock* AllocatorReserveBlock(AllocatorBlock* allocator, unsigned nodeSi
     if (!capacity)
         capacity = 1;
 
-    unsigned char* blockPtr = new unsigned char[sizeof(AllocatorBlock) + capacity * (sizeof(AllocatorNode) + nodeSize)];
-    AllocatorBlock* newBlock = reinterpret_cast<AllocatorBlock*>(blockPtr);
+    auto* blockPtr = new unsigned char[sizeof(AllocatorBlock) + capacity * (sizeof(AllocatorNode) + nodeSize)];
+    auto* newBlock = reinterpret_cast<AllocatorBlock*>(blockPtr);
     newBlock->nodeSize_ = nodeSize;
     newBlock->capacity_ = capacity;
     newBlock->free_ = nullptr;
@@ -49,17 +49,17 @@ AllocatorBlock* AllocatorReserveBlock(AllocatorBlock* allocator, unsigned nodeSi
 
     // Initialize the nodes. Free nodes are always chained to the first (parent) allocator
     unsigned char* nodePtr = blockPtr + sizeof(AllocatorBlock);
-    AllocatorNode* firstNewNode = reinterpret_cast<AllocatorNode*>(nodePtr);
+    auto* firstNewNode = reinterpret_cast<AllocatorNode*>(nodePtr);
 
     for (unsigned i = 0; i < capacity - 1; ++i)
     {
-        AllocatorNode* newNode = reinterpret_cast<AllocatorNode*>(nodePtr);
+        auto* newNode = reinterpret_cast<AllocatorNode*>(nodePtr);
         newNode->next_ = reinterpret_cast<AllocatorNode*>(nodePtr + sizeof(AllocatorNode) + nodeSize);
         nodePtr += sizeof(AllocatorNode) + nodeSize;
     }
     // i == capacity - 1
     {
-        AllocatorNode* newNode = reinterpret_cast<AllocatorNode*>(nodePtr);
+        auto* newNode = reinterpret_cast<AllocatorNode*>(nodePtr);
         newNode->next_ = nullptr;
     }
 
@@ -111,8 +111,8 @@ void AllocatorFree(AllocatorBlock* allocator, void* ptr)
     if (!allocator || !ptr)
         return;
 
-    unsigned char* dataPtr = static_cast<unsigned char*>(ptr);
-    AllocatorNode* node = reinterpret_cast<AllocatorNode*>(dataPtr - sizeof(AllocatorNode));
+    auto* dataPtr = static_cast<unsigned char*>(ptr);
+    auto* node = reinterpret_cast<AllocatorNode*>(dataPtr - sizeof(AllocatorNode));
 
     // Chain the node back to free nodes
     node->next_ = allocator->free_;

+ 2 - 2
Source/Urho3D/Container/Allocator.h

@@ -90,7 +90,7 @@ public:
     {
         if (!allocator_)
             allocator_ = AllocatorInitialize((unsigned)sizeof(T));
-        T* newObject = static_cast<T*>(AllocatorReserve(allocator_));
+        auto* newObject = static_cast<T*>(AllocatorReserve(allocator_));
         new(newObject) T();
 
         return newObject;
@@ -101,7 +101,7 @@ public:
     {
         if (!allocator_)
             allocator_ = AllocatorInitialize((unsigned)sizeof(T));
-        T* newObject = static_cast<T*>(AllocatorReserve(allocator_));
+        auto* newObject = static_cast<T*>(AllocatorReserve(allocator_));
         new(newObject) T(object);
 
         return newObject;

+ 2 - 2
Source/Urho3D/Container/HashBase.cpp

@@ -32,8 +32,8 @@ void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
     if (ptrs_)
         delete[] ptrs_;
 
-    HashNodeBase** ptrs = new HashNodeBase* [numBuckets + 2];
-    unsigned* data = reinterpret_cast<unsigned*>(ptrs);
+    auto** ptrs = new HashNodeBase* [numBuckets + 2];
+    auto* data = reinterpret_cast<unsigned*>(ptrs);
     data[0] = size;
     data[1] = numBuckets;
     ptrs_ = ptrs;

+ 8 - 8
Source/Urho3D/Container/HashMap.h

@@ -420,13 +420,13 @@ public:
         if (!ptrs_ || !it.ptr_)
             return End();
 
-        Node* node = static_cast<Node*>(it.ptr_);
+        auto* node = static_cast<Node*>(it.ptr_);
         Node* next = node->Next();
 
         unsigned hashKey = Hash(node->pair_.first_);
 
         Node* previous = 0;
-        Node* current = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* current = static_cast<Node*>(Ptrs()[hashKey]);
         while (current && current != node)
         {
             previous = current;
@@ -470,7 +470,7 @@ public:
         if (!numKeys)
             return;
 
-        Node** ptrs = new Node* [numKeys];
+        auto** ptrs = new Node* [numKeys];
         Node* ptr = Head();
 
         for (unsigned i = 0; i < numKeys; ++i)
@@ -616,7 +616,7 @@ private:
     /// Find a node from the buckets. Do not call if the buckets have not been allocated.
     Node* FindNode(const T& key, unsigned hashKey) const
     {
-        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->pair_.first_ == key)
@@ -632,7 +632,7 @@ private:
     {
         previous = 0;
 
-        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->pair_.first_ == key)
@@ -730,7 +730,7 @@ private:
     /// Reserve a node.
     Node* ReserveNode()
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node();
         return newNode;
     }
@@ -738,7 +738,7 @@ private:
     /// Reserve a node with specified key and value.
     Node* ReserveNode(const T& key, const U& value)
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node(key, value);
         return newNode;
     }
@@ -755,7 +755,7 @@ private:
     {
         for (Iterator i = Begin(); i != End(); ++i)
         {
-            Node* node = static_cast<Node*>(i.ptr_);
+            auto* node = static_cast<Node*>(i.ptr_);
             unsigned hashKey = Hash(i->first_);
             node->down_ = Ptrs()[hashKey];
             Ptrs()[hashKey] = node;

+ 8 - 8
Source/Urho3D/Container/HashSet.h

@@ -352,13 +352,13 @@ public:
         if (!ptrs_ || !it.ptr_)
             return End();
 
-        Node* node = static_cast<Node*>(it.ptr_);
+        auto* node = static_cast<Node*>(it.ptr_);
         Node* next = node->Next();
 
         unsigned hashKey = Hash(node->key_);
 
         Node* previous = 0;
-        Node* current = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* current = static_cast<Node*>(Ptrs()[hashKey]);
         while (current && current != node)
         {
             previous = current;
@@ -402,7 +402,7 @@ public:
         if (!numKeys)
             return;
 
-        Node** ptrs = new Node* [numKeys];
+        auto** ptrs = new Node* [numKeys];
         Node* ptr = Head();
 
         for (unsigned i = 0; i < numKeys; ++i)
@@ -512,7 +512,7 @@ private:
     /// Find a node from the buckets. Do not call if the buckets have not been allocated.
     Node* FindNode(const T& key, unsigned hashKey) const
     {
-        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->key_ == key)
@@ -528,7 +528,7 @@ private:
     {
         previous = 0;
 
-        Node* node = static_cast<Node*>(Ptrs()[hashKey]);
+        auto* node = static_cast<Node*>(Ptrs()[hashKey]);
         while (node)
         {
             if (node->key_ == key)
@@ -589,7 +589,7 @@ private:
     /// Reserve a node.
     Node* ReserveNode()
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node();
         return newNode;
     }
@@ -597,7 +597,7 @@ private:
     /// Reserve a node with specified key.
     Node* ReserveNode(const T& key)
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node(key);
         return newNode;
     }
@@ -614,7 +614,7 @@ private:
     {
         for (Iterator it = Begin(); it != End(); ++it)
         {
-            Node* node = static_cast<Node*>(it.ptr_);
+            auto* node = static_cast<Node*>(it.ptr_);
             unsigned hashKey = Hash(*it);
             node->down_ = Ptrs()[hashKey];
             Ptrs()[hashKey] = node;

+ 5 - 5
Source/Urho3D/Container/List.h

@@ -278,7 +278,7 @@ public:
     /// Insert a list at position.
     void Insert(const Iterator& dest, const List<T>& list)
     {
-        Node* destNode = static_cast<Node*>(dest.ptr_);
+        auto* destNode = static_cast<Node*>(dest.ptr_);
         ConstIterator it = list.Begin();
         ConstIterator end = list.End();
         while (it != end)
@@ -288,7 +288,7 @@ public:
     /// Insert elements by iterators.
     void Insert(const Iterator& dest, const ConstIterator& start, const ConstIterator& end)
     {
-        Node* destNode = static_cast<Node*>(dest.ptr_);
+        auto* destNode = static_cast<Node*>(dest.ptr_);
         ConstIterator it = start;
         while (it != end)
             InsertNode(destNode, *it++);
@@ -297,7 +297,7 @@ public:
     /// Insert elements.
     void Insert(const Iterator& dest, const T* start, const T* end)
     {
-        Node* destNode = static_cast<Node*>(dest.ptr_);
+        auto* destNode = static_cast<Node*>(dest.ptr_);
         const T* ptr = start;
         while (ptr != end)
             InsertNode(destNode, *ptr++);
@@ -464,7 +464,7 @@ private:
     /// Reserve a node.
     Node* ReserveNode()
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node();
         return newNode;
     }
@@ -472,7 +472,7 @@ private:
     /// Reserve a node with initial value.
     Node* ReserveNode(const T& value)
     {
-        Node* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
+        auto* newNode = static_cast<Node*>(AllocatorReserve(allocator_));
         new(newNode) Node(value);
         return newNode;
     }

+ 16 - 16
Source/Urho3D/Container/Str.cpp

@@ -285,7 +285,7 @@ String::Iterator String::Replace(const String::Iterator& start, const String::It
     unsigned pos = (unsigned)(start - Begin());
     if (pos >= length_)
         return End();
-    unsigned length = (unsigned)(end - start);
+    auto length = (unsigned)(end - start);
     Replace(pos, length, replaceWith);
 
     return Begin() + pos;
@@ -373,7 +373,7 @@ String::Iterator String::Insert(const String::Iterator& dest, const String::Iter
     unsigned pos = (unsigned)(dest - Begin());
     if (pos > length_)
         pos = length_;
-    unsigned length = (unsigned)(end - start);
+    auto length = (unsigned)(end - start);
     Replace(pos, 0, &(*start), length);
 
     return Begin() + pos;
@@ -409,7 +409,7 @@ String::Iterator String::Erase(const String::Iterator& start, const String::Iter
     unsigned pos = (unsigned)(start - Begin());
     if (pos >= length_)
         return End();
-    unsigned length = (unsigned)(end - start);
+    auto length = (unsigned)(end - start);
     Erase(pos, length);
 
     return Begin() + pos;
@@ -438,7 +438,7 @@ void String::Resize(unsigned newLength)
             while (capacity_ < newLength + 1)
                 capacity_ += (capacity_ + 1) >> 1;
 
-            char* newBuffer = new char[capacity_];
+            auto* newBuffer = new char[capacity_];
             // Move the existing data to the new buffer, then delete the old buffer
             if (length_)
                 CopyChars(newBuffer, buffer_, length_);
@@ -459,7 +459,7 @@ void String::Reserve(unsigned newCapacity)
     if (newCapacity == capacity_)
         return;
 
-    char* newBuffer = new char[newCapacity];
+    auto* newBuffer = new char[newCapacity];
     // Move the existing data to the new buffer, then delete the old buffer
     CopyChars(newBuffer, buffer_, length_ + 1);
     if (capacity_)
@@ -1013,9 +1013,9 @@ unsigned String::DecodeUTF16(const wchar_t*& src)
 {
     if (src == nullptr)
         return 0;
-    
+
     unsigned short word1 = *src++;
-    
+
     // Check if we are at a low surrogate
     if (word1 >= 0xdc00 && word1 < 0xe000)
     {
@@ -1023,7 +1023,7 @@ unsigned String::DecodeUTF16(const wchar_t*& src)
             ++src;
         return '?';
     }
-    
+
     if (word1 < 0xd800 || word1 >= 0xe000)
         return word1;
     else
@@ -1059,7 +1059,7 @@ Vector<String> String::Split(const char* str, char separator, bool keepEmptyStri
     const ptrdiff_t splitLen = strEnd - str;
     if (splitLen > 0 || keepEmptyStrings)
         ret.Push(String(str, splitLen));
-    
+
     return ret;
 }
 
@@ -1087,7 +1087,7 @@ String& String::AppendWithFormat(const char* formatString, ...)
 String& String::AppendWithFormatArgs(const char* formatString, va_list args)
 {
     int pos = 0, lastPos = 0;
-    int length = (int)strlen(formatString);
+    auto length = (int)strlen(formatString);
 
     while (true)
     {
@@ -1196,8 +1196,8 @@ int String::Compare(const char* lhs, const char* rhs, bool caseSensitive)
     {
         for (;;)
         {
-            char l = (char)tolower(*lhs);
-            char r = (char)tolower(*rhs);
+            auto l = (char)tolower(*lhs);
+            auto r = (char)tolower(*rhs);
             if (!l || !r)
                 return l ? 1 : (r ? -1 : 0);
             if (l < r)
@@ -1247,7 +1247,7 @@ WString::WString(const String& str) :
 #ifdef _WIN32
     unsigned neededSize = 0;
     wchar_t temp[3];
-    
+
     unsigned byteOffset = 0;
     while (byteOffset < str.Length())
     {
@@ -1255,9 +1255,9 @@ WString::WString(const String& str) :
         String::EncodeUTF16(dest, str.NextUTF8Char(byteOffset));
         neededSize += dest - temp;
     }
-    
+
     Resize(neededSize);
-    
+
     byteOffset = 0;
     wchar_t* dest = buffer_;
     while (byteOffset < str.Length())
@@ -1287,7 +1287,7 @@ void WString::Resize(unsigned newLength)
     }
     else
     {
-        wchar_t* newBuffer = new wchar_t[newLength + 1];
+        auto* newBuffer = new wchar_t[newLength + 1];
         if (buffer_)
         {
             unsigned copyLength = length_ < newLength ? length_ : newLength;

+ 17 - 17
Source/Urho3D/Container/Vector.h

@@ -235,28 +235,28 @@ public:
     /// Insert an element by iterator.
     Iterator Insert(const Iterator& dest, const T& value)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         return InsertElements(pos, &value, &value + 1);
     }
 
     /// Insert a vector by iterator.
     Iterator Insert(const Iterator& dest, const Vector<T>& vector)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         return InsertElements(pos, vector.Begin(), vector.End());
     }
 
     /// Insert a vector partially by iterators.
     Iterator Insert(const Iterator& dest, const ConstIterator& start, const ConstIterator& end)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         return InsertElements(pos, start, end);
     }
 
     /// Insert elements.
     Iterator Insert(const Iterator& dest, const T* start, const T* end)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         return InsertElements(pos, start, end);
     }
 
@@ -297,7 +297,7 @@ public:
     /// Erase an element by iterator. Return iterator to the next element.
     Iterator Erase(const Iterator& it)
     {
-        unsigned pos = (unsigned)(it - Begin());
+        auto pos = (unsigned)(it - Begin());
         if (pos >= size_)
             return End();
         Erase(pos);
@@ -308,10 +308,10 @@ public:
     /// Erase a range by iterators. Return iterator to the next element.
     Iterator Erase(const Iterator& start, const Iterator& end)
     {
-        unsigned pos = (unsigned)(start - Begin());
+        auto pos = (unsigned)(start - Begin());
         if (pos >= size_)
             return End();
-        unsigned length = (unsigned)(end - start);
+        auto length = (unsigned)(end - start);
         Erase(pos, length);
 
         return Begin() + pos;
@@ -512,7 +512,7 @@ private:
 
         if (pos > size_)
             pos = size_;
-        unsigned length = (unsigned)(end - start);
+        auto length = (unsigned)(end - start);
         Vector<T> tempBuffer;
         Resize(size_ + length, 0, tempBuffer);
         MoveRange(pos + length, pos, size_ - pos - length);
@@ -782,7 +782,7 @@ public:
     /// Insert an element by iterator.
     Iterator Insert(const Iterator& dest, const T& value)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         if (pos > size_)
             pos = size_;
         Insert(pos, value);
@@ -793,7 +793,7 @@ public:
     /// Insert a vector by iterator.
     Iterator Insert(const Iterator& dest, const PODVector<T>& vector)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         if (pos > size_)
             pos = size_;
         Insert(pos, vector);
@@ -804,10 +804,10 @@ public:
     /// Insert a vector partially by iterators.
     Iterator Insert(const Iterator& dest, const ConstIterator& start, const ConstIterator& end)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         if (pos > size_)
             pos = size_;
-        unsigned length = (unsigned)(end - start);
+        auto length = (unsigned)(end - start);
         Resize(size_ + length);
         MoveRange(pos + length, pos, size_ - pos - length);
         CopyElements(Buffer() + pos, &(*start), length);
@@ -818,10 +818,10 @@ public:
     /// Insert elements.
     Iterator Insert(const Iterator& dest, const T* start, const T* end)
     {
-        unsigned pos = (unsigned)(dest - Begin());
+        auto pos = (unsigned)(dest - Begin());
         if (pos > size_)
             pos = size_;
-        unsigned length = (unsigned)(end - start);
+        auto length = (unsigned)(end - start);
         Resize(size_ + length);
         MoveRange(pos + length, pos, size_ - pos - length);
 
@@ -846,7 +846,7 @@ public:
     /// Erase an element by iterator. Return iterator to the next element.
     Iterator Erase(const Iterator& it)
     {
-        unsigned pos = (unsigned)(it - Begin());
+        auto pos = (unsigned)(it - Begin());
         if (pos >= size_)
             return End();
         Erase(pos);
@@ -857,10 +857,10 @@ public:
     /// Erase a range by iterators. Return iterator to the next element.
     Iterator Erase(const Iterator& start, const Iterator& end)
     {
-        unsigned pos = (unsigned)(start - Begin());
+        auto pos = (unsigned)(start - Begin());
         if (pos >= size_)
             return End();
-        unsigned length = (unsigned)(end - start);
+        auto length = (unsigned)(end - start);
         Erase(pos, length);
 
         return Begin() + pos;

+ 4 - 4
Source/Urho3D/Core/Condition.cpp

@@ -69,8 +69,8 @@ Condition::Condition() :
 
 Condition::~Condition()
 {
-    pthread_cond_t* cond = (pthread_cond_t*)event_;
-    pthread_mutex_t* mutex = (pthread_mutex_t*)mutex_;
+    auto* cond = (pthread_cond_t*)event_;
+    auto* mutex = (pthread_mutex_t*)mutex_;
 
     pthread_cond_destroy(cond);
     pthread_mutex_destroy(mutex);
@@ -87,8 +87,8 @@ void Condition::Set()
 
 void Condition::Wait()
 {
-    pthread_cond_t* cond = (pthread_cond_t*)event_;
-    pthread_mutex_t* mutex = (pthread_mutex_t*)mutex_;
+    auto* cond = (pthread_cond_t*)event_;
+    auto* mutex = (pthread_mutex_t*)mutex_;
 
     pthread_mutex_lock(mutex);
     pthread_cond_wait(cond, mutex);

+ 2 - 2
Source/Urho3D/Core/Context.cpp

@@ -456,7 +456,7 @@ void Context::BeginSendEvent(Object* sender, StringHash eventType)
 #ifdef URHO3D_PROFILING
     if (EventProfiler::IsActive())
     {
-        EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+        auto* eventProfiler = GetSubsystem<EventProfiler>();
         if (eventProfiler)
             eventProfiler->BeginBlock(eventType);
     }
@@ -472,7 +472,7 @@ void Context::EndSendEvent()
 #ifdef URHO3D_PROFILING
     if (EventProfiler::IsActive())
     {
-        EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+        auto* eventProfiler = GetSubsystem<EventProfiler>();
         if (eventProfiler)
             eventProfiler->EndBlock();
     }

+ 2 - 2
Source/Urho3D/Core/EventProfiler.h

@@ -43,12 +43,12 @@ public:
     {
         for (PODVector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
         {
-            EventProfilerBlock* eventProfilerBlock = static_cast<EventProfilerBlock*>(*i);
+            auto* eventProfilerBlock = static_cast<EventProfilerBlock*>(*i);
             if (eventProfilerBlock->eventID_ == eventID)
                 return eventProfilerBlock;
         }
 
-        EventProfilerBlock* newBlock = new EventProfilerBlock(this, eventID);
+        auto* newBlock = new EventProfilerBlock(this, eventID);
         children_.Push(newBlock);
 
         return newBlock;

+ 2 - 2
Source/Urho3D/Core/Mutex.cpp

@@ -71,7 +71,7 @@ void Mutex::Release()
 Mutex::Mutex() :
     handle_(new pthread_mutex_t)
 {
-    pthread_mutex_t* mutex = (pthread_mutex_t*)handle_;
+    auto* mutex = (pthread_mutex_t*)handle_;
     pthread_mutexattr_t attr;
     pthread_mutexattr_init(&attr);
     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@@ -80,7 +80,7 @@ Mutex::Mutex() :
 
 Mutex::~Mutex()
 {
-    pthread_mutex_t* mutex = (pthread_mutex_t*)handle_;
+    auto* mutex = (pthread_mutex_t*)handle_;
     pthread_mutex_destroy(mutex);
     delete mutex;
     handle_ = 0;

+ 1 - 1
Source/Urho3D/Core/Object.h

@@ -309,7 +309,7 @@ public:
     /// Invoke event handler function.
     void Invoke(VariantMap& eventData) override
     {
-        T* receiver = static_cast<T*>(receiver_);
+        auto* receiver = static_cast<T*>(receiver_);
         (receiver->*function_)(eventType_, eventData);
     }
 

+ 1 - 1
Source/Urho3D/Core/Profiler.h

@@ -128,7 +128,7 @@ public:
                 return *i;
         }
 
-        ProfilerBlock* newBlock = new ProfilerBlock(this, name);
+        auto* newBlock = new ProfilerBlock(this, name);
         children_.Push(newBlock);
 
         return newBlock;

+ 1 - 1
Source/Urho3D/Core/Spline.cpp

@@ -203,7 +203,7 @@ Variant Spline::CatmullRomInterpolation(const Vector<Variant>& knots, float t) c
         if (t >= 1.f)
             return knots[knots.Size() - 2];
 
-        int originIndex = static_cast<int>(t * (knots.Size() - 3));
+        auto originIndex = static_cast<int>(t * (knots.Size() - 3));
         t = fmodf(t * (knots.Size() - 3), 1.f);
         float t2 = t * t;
         float t3 = t2 * t;

+ 22 - 22
Source/Urho3D/Core/StringUtils.cpp

@@ -98,7 +98,7 @@ bool ToBool(const char* source)
 
     for (unsigned i = 0; i < length; ++i)
     {
-        char c = (char)tolower(source[i]);
+        auto c = (char)tolower(source[i]);
         if (c == 't' || c == 'y' || c == '1')
             return true;
         else if (c != ' ' && c != '\t')
@@ -214,7 +214,7 @@ Color ToColor(const char* source)
     if (elements < 3)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.r_ = (float)strtod(ptr, &ptr);
     ret.g_ = (float)strtod(ptr, &ptr);
     ret.b_ = (float)strtod(ptr, &ptr);
@@ -237,7 +237,7 @@ IntRect ToIntRect(const char* source)
     if (elements < 4)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.left_ = (int)strtol(ptr, &ptr, 10);
     ret.top_ = (int)strtol(ptr, &ptr, 10);
     ret.right_ = (int)strtol(ptr, &ptr, 10);
@@ -259,7 +259,7 @@ IntVector2 ToIntVector2(const char* source)
     if (elements < 2)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
 
@@ -279,7 +279,7 @@ IntVector3 ToIntVector3(const char* source)
     if (elements < 3)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
     ret.z_ = (int)strtol(ptr, &ptr, 10);
@@ -300,7 +300,7 @@ Rect ToRect(const char* source)
     if (elements < 4)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.min_.x_ = (float)strtod(ptr, &ptr);
     ret.min_.y_ = (float)strtod(ptr, &ptr);
     ret.max_.x_ = (float)strtod(ptr, &ptr);
@@ -317,7 +317,7 @@ Quaternion ToQuaternion(const String& source)
 Quaternion ToQuaternion(const char* source)
 {
     unsigned elements = CountElements(source, ' ');
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
 
     if (elements < 3)
         return Quaternion::IDENTITY;
@@ -357,7 +357,7 @@ Vector2 ToVector2(const char* source)
     if (elements < 2)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
 
@@ -377,7 +377,7 @@ Vector3 ToVector3(const char* source)
     if (elements < 3)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
     ret.z_ = (float)strtod(ptr, &ptr);
@@ -395,7 +395,7 @@ Vector4 ToVector4(const char* source, bool allowMissingCoords)
     Vector4 ret(Vector4::ZERO);
 
     unsigned elements = CountElements(source, ' ');
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
 
     if (!allowMissingCoords)
     {
@@ -485,7 +485,7 @@ Matrix3 ToMatrix3(const char* source)
     if (elements < 9)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
@@ -512,7 +512,7 @@ Matrix3x4 ToMatrix3x4(const char* source)
     if (elements < 12)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
@@ -542,7 +542,7 @@ Matrix4 ToMatrix4(const char* source)
     if (elements < 16)
         return ret;
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
@@ -578,7 +578,7 @@ String ToStringHex(unsigned value)
 void BufferToString(String& dest, const void* data, unsigned size)
 {
     // Precalculate needed string size
-    const unsigned char* bytes = (const unsigned char*)data;
+    const auto* bytes = (const unsigned char*)data;
     unsigned length = 0;
     for (unsigned i = 0; i < size; ++i)
     {
@@ -745,7 +745,7 @@ String GetFileSizeString(unsigned long long memorySize)
     }
     else
     {
-        const int exponent = (int)(log((double)memorySize) / log(1024.0));
+        const auto exponent = (int)(log((double)memorySize) / log(1024.0));
         const double majorValue = ((double)memorySize) / pow(1024.0, exponent);
         char buffer[64];
         memset(buffer, 0, 64);
@@ -758,13 +758,13 @@ String GetFileSizeString(unsigned long long memorySize)
     return output;
 }
 
-// Implementation of base64 decoding originally by René Nyffenegger.
+// Implementation of base64 decoding originally by Ren� Nyffenegger.
 // Modified by Konstantin Guschin and Lasse Oorni
 
 /*
 base64.cpp and base64.h
 
-Copyright (C) 2004-2017 René Nyffenegger
+Copyright (C) 2004-2017 Ren� Nyffenegger
 
 This source code is provided 'as-is', without any express or implied
 warranty. In no event will the author be held liable for any damages
@@ -784,7 +784,7 @@ misrepresented as being the original source code.
 
 3. This notice may not be removed or altered from any source distribution.
 
-René Nyffenegger [email protected]
+Ren� Nyffenegger [email protected]
 
 */
 
@@ -792,7 +792,7 @@ static inline bool IsBase64(char c) {
     return (isalnum(c) || (c == '+') || (c == '/'));
 }
 
-PODVector<unsigned char> DecodeBase64(String encodedString) 
+PODVector<unsigned char> DecodeBase64(String encodedString)
 {
     int inLen = encodedString.Length();
     int i = 0;
@@ -801,9 +801,9 @@ PODVector<unsigned char> DecodeBase64(String encodedString)
     unsigned char charArray4[4], charArray3[3];
     PODVector<unsigned char> ret;
 
-    while (inLen-- && (encodedString[in_] != '=') && IsBase64(encodedString[in_])) 
+    while (inLen-- && (encodedString[in_] != '=') && IsBase64(encodedString[in_]))
     {
-        charArray4[i++] = encodedString[in_]; 
+        charArray4[i++] = encodedString[in_];
         in_++;
 
         if (i == 4)
@@ -834,7 +834,7 @@ PODVector<unsigned char> DecodeBase64(String encodedString)
         charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
         charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];
 
-        for (j = 0; (j < i - 1); j++) 
+        for (j = 0; (j < i - 1); j++)
             ret.Push(charArray3[j]);
     }
 

+ 3 - 3
Source/Urho3D/Core/Thread.cpp

@@ -49,7 +49,7 @@ static DWORD WINAPI ThreadFunctionStatic(void* data)
 
 static void* ThreadFunctionStatic(void* data)
 {
-    Thread* thread = static_cast<Thread*>(data);
+    auto* thread = static_cast<Thread*>(data);
     thread->ThreadFunction();
     pthread_exit((void*)0);
     return 0;
@@ -106,7 +106,7 @@ void Thread::Stop()
     WaitForSingleObject((HANDLE)handle_, INFINITE);
     CloseHandle((HANDLE)handle_);
 #else
-    pthread_t* thread = (pthread_t*)handle_;
+    auto* thread = (pthread_t*)handle_;
     if (thread)
         pthread_join(*thread, 0);
     delete thread;
@@ -122,7 +122,7 @@ void Thread::SetPriority(int priority)
     if (handle_)
         SetThreadPriority((HANDLE)handle_, priority);
 #elif defined(__linux__) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
-    pthread_t* thread = (pthread_t*)handle_;
+    auto* thread = (pthread_t*)handle_;
     if (thread)
         pthread_setschedprio(*thread, priority);
 #endif

+ 2 - 2
Source/Urho3D/Core/Timer.cpp

@@ -110,7 +110,7 @@ void Time::BeginFrame(float timeStep)
 
     timeStep_ = timeStep;
 
-    Profiler* profiler = GetSubsystem<Profiler>();
+    auto* profiler = GetSubsystem<Profiler>();
     if (profiler)
         profiler->BeginFrame();
 
@@ -136,7 +136,7 @@ void Time::EndFrame()
         SendEvent(E_ENDFRAME);
     }
 
-    Profiler* profiler = GetSubsystem<Profiler>();
+    auto* profiler = GetSubsystem<Profiler>();
     if (profiler)
         profiler->EndFrame();
 }

+ 1 - 1
Source/Urho3D/Database/SQLite/SQLiteConnection.cpp

@@ -82,7 +82,7 @@ DbResult DbConnection::Execute(const String& sql, bool useCursorEvent)
         return result;
     }
 
-    unsigned numCols = (unsigned)sqlite3_column_count(pStmt);
+    auto numCols = (unsigned)sqlite3_column_count(pStmt);
     result.columns_.Resize(numCols);
     for (unsigned i = 0; i < numCols; ++i)
         result.columns_[i] = sqlite3_column_name(pStmt, i);

+ 6 - 6
Source/Urho3D/Engine/Console.cpp

@@ -66,7 +66,7 @@ Console::Console(Context* context) :
     historyOrAutoCompleteChange_(false),
     printing_(false)
 {
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* uiRoot = ui->GetRoot();
 
     // By default prevent the automatic showing of the screen keyboard
@@ -138,8 +138,8 @@ void Console::SetDefaultStyle(XMLFile* style)
 
 void Console::SetVisible(bool enable)
 {
-    Input* input = GetSubsystem<Input>();
-    UI* ui = GetSubsystem<UI>();
+    auto* input = GetSubsystem<Input>();
+    auto* ui = GetSubsystem<UI>();
     Cursor* cursor = ui->GetCursor();
 
     background_->SetVisible(enable);
@@ -206,7 +206,7 @@ void Console::SetNumBufferedRows(unsigned rows)
         // We have less, add more rows at the top
         for (int i = 0; i > delta; --i)
         {
-            Text* text = new Text(context_);
+            auto* text = new Text(context_);
             // If style is already set, apply here to ensure proper height of the console when
             // amount of rows is changed
             if (background_->GetDefaultStyle())
@@ -328,7 +328,7 @@ bool Console::PopulateInterpreter()
         const String& name = names[i];
         if (name == commandInterpreter_)
             selection = i;
-        Text* text = new Text(context_);
+        auto* text = new Text(context_);
         text->SetStyle("ConsoleText");
         text->SetText(name);
         interpreters_->AddItem(text);
@@ -549,7 +549,7 @@ void Console::HandlePostUpdate(StringHash eventType, VariantMap& eventData)
     // Ensure UI-elements are not detached
     if (!background_->GetParent())
     {
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         UIElement* uiRoot = ui->GetRoot();
         uiRoot->AddChild(background_);
         uiRoot->AddChild(closeButton_);

+ 7 - 7
Source/Urho3D/Engine/DebugHud.cpp

@@ -66,7 +66,7 @@ DebugHud::DebugHud(Context* context) :
     useRendererStats_(false),
     mode_(DEBUGHUD_SHOW_NONE)
 {
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* uiRoot = ui->GetRoot();
 
     statsText_ = new Text(context_);
@@ -113,15 +113,15 @@ DebugHud::~DebugHud()
 
 void DebugHud::Update()
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* graphics = GetSubsystem<Graphics>();
+    auto* renderer = GetSubsystem<Renderer>();
     if (!renderer || !graphics)
         return;
 
     // Ensure UI-elements are not detached
     if (!statsText_->GetParent())
     {
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         UIElement* uiRoot = ui->GetRoot();
         uiRoot->AddChild(statsText_);
         uiRoot->AddChild(modeText_);
@@ -178,8 +178,8 @@ void DebugHud::Update()
         modeText_->SetText(mode);
     }
 
-    Profiler* profiler = GetSubsystem<Profiler>();
-    EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+    auto* profiler = GetSubsystem<Profiler>();
+    auto* eventProfiler = GetSubsystem<EventProfiler>();
     if (profiler)
     {
         if (profilerTimer_.GetMSec(false) >= profilerInterval_)
@@ -234,7 +234,7 @@ void DebugHud::SetMode(unsigned mode)
 
 #ifdef URHO3D_PROFILING
     // Event profiler is created on engine initialization if "EventProfiler" parameter is set
-    EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+    auto* eventProfiler = GetSubsystem<EventProfiler>();
     if (eventProfiler)
         EventProfiler::SetActive((mode & DEBUGHUD_SHOW_EVENTPROFILER) != 0);
 #endif

+ 20 - 20
Source/Urho3D/Engine/Engine.cpp

@@ -146,7 +146,7 @@ Engine::Engine(Context* context) :
 #ifdef URHO3D_IK
     RegisterIKLibrary(context_);
 #endif
-    
+
 #ifdef URHO3D_PHYSICS
     RegisterPhysicsLibrary(context_);
 #endif
@@ -190,7 +190,7 @@ bool Engine::Initialize(const VariantMap& parameters)
 #endif
 
     // Start logging
-    Log* log = GetSubsystem<Log>();
+    auto* log = GetSubsystem<Log>();
     if (log)
     {
         if (HasParameter(parameters, EP_LOG_LEVEL))
@@ -222,14 +222,14 @@ bool Engine::Initialize(const VariantMap& parameters)
     if (!InitializeResourceCache(parameters, false))
         return false;
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* fileSystem = GetSubsystem<FileSystem>();
 
     // Initialize graphics & audio output
     if (!headless_)
     {
-        Graphics* graphics = GetSubsystem<Graphics>();
-        Renderer* renderer = GetSubsystem<Renderer>();
+        auto* graphics = GetSubsystem<Graphics>();
+        auto* renderer = GetSubsystem<Renderer>();
 
         if (HasParameter(parameters, EP_EXTERNAL_WINDOW))
             graphics->SetExternalWindow(GetParameter(parameters, EP_EXTERNAL_WINDOW).GetVoidPtr());
@@ -322,8 +322,8 @@ bool Engine::Initialize(const VariantMap& parameters)
 
 bool Engine::InitializeResourceCache(const VariantMap& parameters, bool removeOld /*= true*/)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* fileSystem = GetSubsystem<FileSystem>();
 
     // Remove all resource paths and packages
     if (removeOld)
@@ -483,14 +483,14 @@ void Engine::RunFrame()
 
     // Note: there is a minimal performance cost to looking up subsystems (uses a hashmap); if they would be looked up several
     // times per frame it would be better to cache the pointers
-    Time* time = GetSubsystem<Time>();
-    Input* input = GetSubsystem<Input>();
-    Audio* audio = GetSubsystem<Audio>();
+    auto* time = GetSubsystem<Time>();
+    auto* input = GetSubsystem<Input>();
+    auto* audio = GetSubsystem<Audio>();
 
 #ifdef URHO3D_PROFILING
     if (EventProfiler::IsActive())
     {
-        EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+        auto* eventProfiler = GetSubsystem<EventProfiler>();
         if (eventProfiler)
             eventProfiler->BeginFrame();
     }
@@ -531,7 +531,7 @@ Console* Engine::CreateConsole()
         return nullptr;
 
     // Return existing console if possible
-    Console* console = GetSubsystem<Console>();
+    auto* console = GetSubsystem<Console>();
     if (!console)
     {
         console = new Console(context_);
@@ -547,7 +547,7 @@ DebugHud* Engine::CreateDebugHud()
         return nullptr;
 
     // Return existing debug HUD if possible
-    DebugHud* debugHud = GetSubsystem<DebugHud>();
+    auto* debugHud = GetSubsystem<DebugHud>();
     if (!debugHud)
     {
         debugHud = new DebugHud(context_);
@@ -611,7 +611,7 @@ void Engine::DumpProfiler()
     if (!Thread::IsMainThread())
         return;
 
-    Profiler* profiler = GetSubsystem<Profiler>();
+    auto* profiler = GetSubsystem<Profiler>();
     if (profiler)
         URHO3D_LOGRAW(profiler->PrintData(true, true) + "\n");
 #endif
@@ -623,7 +623,7 @@ void Engine::DumpResources(bool dumpFileName)
     if (!Thread::IsMainThread())
         return;
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     const HashMap<StringHash, ResourceGroup>& resourceGroups = cache->GetAllResources();
     if (dumpFileName)
     {
@@ -712,7 +712,7 @@ void Engine::Render()
     URHO3D_PROFILE(Render);
 
     // If device is lost, BeginFrame will fail and we skip rendering
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (!graphics->BeginFrame())
         return;
 
@@ -727,7 +727,7 @@ void Engine::ApplyFrameLimit()
         return;
 
     unsigned maxFps = maxFps_;
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input && !input->HasFocus())
         maxFps = Min(maxInactiveFps_, maxFps);
 
@@ -756,7 +756,7 @@ void Engine::ApplyFrameLimit()
             // Sleep if 1 ms or more off the frame limiting goal
             if (targetMax - elapsed >= 1000LL)
             {
-                unsigned sleepTime = (unsigned)((targetMax - elapsed) / 1000LL);
+                auto sleepTime = (unsigned)((targetMax - elapsed) / 1000LL);
                 Time::Sleep(sleepTime);
             }
         }
@@ -986,7 +986,7 @@ void Engine::HandleExitRequested(StringHash eventType, VariantMap& eventData)
 
 void Engine::DoExit()
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (graphics)
         graphics->Close();
 

+ 17 - 17
Source/Urho3D/Graphics/AnimatedModel.cpp

@@ -776,7 +776,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         skeleton_.Define(skeleton);
 
         // Instruct the master model to refresh (merge) its bone bounding boxes
-        AnimatedModel* master = node_->GetComponent<AnimatedModel>();
+        auto* master = node_->GetComponent<AnimatedModel>();
         if (master && master != this)
             master->FinalizeBoneBoundingBoxes();
 
@@ -798,7 +798,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
 
 void AnimatedModel::SetModelAttr(const ResourceRef& value)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     // When loading a scene, set model without creating the bone nodes (will be assigned later during post-load)
     SetModel(cache->GetResource<Model>(value.name_), !loading_);
 }
@@ -812,7 +812,7 @@ void AnimatedModel::SetBonesEnabledAttr(const VariantVector& value)
 
 void AnimatedModel::SetAnimationStatesAttr(const VariantVector& value)
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     RemoveAllAnimationStates();
     unsigned index = 0;
     unsigned numStates = index < value.Size() ? value[index++].GetUInt() : 0;
@@ -967,7 +967,7 @@ void AnimatedModel::OnWorldBoundingBoxUpdate()
     {
         // Non-master animated models get the bounding box from the master
         /// \todo If it's a skinned attachment that does not cover the whole body, it will have unnecessarily large bounds
-        AnimatedModel* master = node_->GetComponent<AnimatedModel>();
+        auto* master = node_->GetComponent<AnimatedModel>();
         // Check if we've become the new master model in case the original was deleted
         if (master == this)
             isMaster_ = true;
@@ -1185,14 +1185,14 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
     unsigned normalOffset = srcBuffer->GetElementOffset(SEM_NORMAL);
     unsigned tangentOffset = srcBuffer->GetElementOffset(SEM_TANGENT);
     unsigned vertexSize = srcBuffer->GetVertexSize();
-    float* dest = (float*)destVertexData;
-    unsigned char* src = (unsigned char*)srcVertexData;
+    auto* dest = (float*)destVertexData;
+    auto* src = (unsigned char*)srcVertexData;
 
     while (vertexCount--)
     {
         if (mask & MASK_POSITION)
         {
-            float* posSrc = (float*)src;
+            auto* posSrc = (float*)src;
             dest[0] = posSrc[0];
             dest[1] = posSrc[1];
             dest[2] = posSrc[2];
@@ -1200,7 +1200,7 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
         }
         if (mask & MASK_NORMAL)
         {
-            float* normalSrc = (float*)(src + normalOffset);
+            auto* normalSrc = (float*)(src + normalOffset);
             dest[0] = normalSrc[0];
             dest[1] = normalSrc[1];
             dest[2] = normalSrc[2];
@@ -1208,7 +1208,7 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
         }
         if (mask & MASK_TANGENT)
         {
-            float* tangentSrc = (float*)(src + tangentOffset);
+            auto* tangentSrc = (float*)(src + tangentOffset);
             dest[0] = tangentSrc[0];
             dest[1] = tangentSrc[1];
             dest[2] = tangentSrc[2];
@@ -1341,7 +1341,7 @@ void AnimatedModel::UpdateSkinning()
 
 void AnimatedModel::UpdateMorphs()
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (!graphics)
         return;
 
@@ -1393,7 +1393,7 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
     unsigned vertexSize = buffer->GetVertexSize();
 
     unsigned char* srcData = morph.morphData_;
-    unsigned char* destData = (unsigned char*)destVertexData;
+    auto* destData = (unsigned char*)destVertexData;
 
     while (vertexCount--)
     {
@@ -1402,8 +1402,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
 
         if (elementMask & MASK_POSITION)
         {
-            float* dest = (float*)(destData + vertexIndex * vertexSize);
-            float* src = (float*)srcData;
+            auto* dest = (float*)(destData + vertexIndex * vertexSize);
+            auto* src = (float*)srcData;
             dest[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;
@@ -1411,8 +1411,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
         }
         if (elementMask & MASK_NORMAL)
         {
-            float* dest = (float*)(destData + vertexIndex * vertexSize + normalOffset);
-            float* src = (float*)srcData;
+            auto* dest = (float*)(destData + vertexIndex * vertexSize + normalOffset);
+            auto* src = (float*)srcData;
             dest[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;
@@ -1420,8 +1420,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
         }
         if (elementMask & MASK_TANGENT)
         {
-            float* dest = (float*)(destData + vertexIndex * vertexSize + tangentOffset);
-            float* src = (float*)srcData;
+            auto* dest = (float*)(destData + vertexIndex * vertexSize + tangentOffset);
+            auto* src = (float*)srcData;
             dest[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;

Some files were not shown because too many files changed in this diff