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

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

@@ -61,16 +61,16 @@ void Sprites::Start()
 
 
 void Sprites::CreateSprites()
 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
     // 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
     // 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)
     for (unsigned i = 0; i < NUM_SPRITES; ++i)
     {
     {
@@ -106,9 +106,9 @@ void Sprites::CreateSprites()
 
 
 void Sprites::MoveSprites(float timeStep)
 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
     // Go through all sprites
     for (unsigned i = 0; i < sprites_.Size(); ++i)
     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()
 void StaticScene::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -85,7 +85,7 @@ void StaticScene::CreateScene()
     // (100 x 100 world units)
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     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)
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
 
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
     // 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->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->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     }
     }
@@ -126,11 +126,11 @@ void StaticScene::CreateScene()
 
 
 void StaticScene::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -142,7 +142,7 @@ void StaticScene::CreateInstructions()
 
 
 void StaticScene::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -74,7 +74,7 @@ void AnimatingScene::Start()
 
 
 void AnimatingScene::CreateScene()
 void AnimatingScene::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     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
     // 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
     // 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");
     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
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
     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));
         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
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
         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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         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
         // 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.
         // writing logic/update components in C++ becomes similar to scripting.
         // Now we simply set same rotation speed for all objects
         // 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));
         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
     // 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
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
     camera->SetFarClip(100.0f);
 
 
     // Create a point light to the camera scene node
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
     light->SetRange(30.0f);
 }
 }
 
 
 void AnimatingScene::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -145,7 +145,7 @@ void AnimatingScene::CreateInstructions()
 
 
 void AnimatingScene::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -164,7 +164,7 @@ void AnimatingScene::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     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
     // Get the model's first (only) animation state and advance its time. Note the convenience accessor to other components
     // in the same scene node
     // in the same scene node
-    AnimatedModel* model = node_->GetComponent<AnimatedModel>(true);
+    auto* model = node_->GetComponent<AnimatedModel>(true);
     if (model->GetNumAnimationStates())
     if (model->GetNumAnimationStates())
     {
     {
         AnimationState* state = model->GetAnimationStates()[0];
         AnimationState* state = model->GetAnimationStates()[0];

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

@@ -78,7 +78,7 @@ void SkeletalAnimation::Start()
 
 
 void SkeletalAnimation::CreateScene()
 void SkeletalAnimation::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -90,13 +90,13 @@ void SkeletalAnimation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(50.0f, 1.0f, 50.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetColor(Color(0.5f, 0.5f, 0.5f));
     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->SetPosition(Vector3(Random(40.0f) - 20.0f, 0.0f, Random(40.0f) - 20.0f));
         modelNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.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->SetModel(cache->GetResource<Model>("Models/Kachujin/Kachujin.mdl"));
         modelObject->SetMaterial(cache->GetResource<Material>("Models/Kachujin/Materials/Kachujin.xml"));
         modelObject->SetMaterial(cache->GetResource<Material>("Models/Kachujin/Materials/Kachujin.xml"));
         modelObject->SetCastShadows(true);
         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
         // 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,
         // 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
         // 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);
         AnimationState* state = modelObject->AddAnimationState(walkAnimation);
         // The state would fail to create (return null) if the animation was not found
         // 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
         // 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);
         mover->SetParameters(MODEL_MOVE_SPEED, MODEL_ROTATE_SPEED, bounds);
     }
     }
 
 
     // Create the camera. Limit far clip distance to match the fog
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane
     // Set an initial position for the camera scene node above the plane
@@ -162,11 +162,11 @@ void SkeletalAnimation::CreateScene()
 
 
 void SkeletalAnimation::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle debug geometry"
         "Space to toggle debug geometry"
@@ -183,7 +183,7 @@ void SkeletalAnimation::CreateInstructions()
 
 
 void SkeletalAnimation::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -207,7 +207,7 @@ void SkeletalAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -75,7 +75,7 @@ void Billboards::Start()
 
 
 void Billboards::CreateScene()
 void Billboards::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -86,7 +86,7 @@ void Billboards::CreateScene()
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetFogStart(100.0f);
     zone->SetFogStart(100.0f);
@@ -95,7 +95,7 @@ void Billboards::CreateScene()
     // Create a directional light without shadows
     // Create a directional light without shadows
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetSpecularIntensity(1.0f);
     light->SetSpecularIntensity(1.0f);
@@ -108,7 +108,7 @@ void Billboards::CreateScene()
             Node* floorNode = scene_->CreateChild("FloorTile");
             Node* floorNode = scene_->CreateChild("FloorTile");
             floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
             floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
             floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
             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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             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->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->SetRotation(Quaternion(0.0f, Random() * 360.0f, 0.0f));
             mushroomNode->SetScale(1.0f + Random() * 4.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetCastShadows(true);
             mushroomObject->SetCastShadows(true);
@@ -146,7 +146,7 @@ void Billboards::CreateScene()
         Node* smokeNode = scene_->CreateChild("Smoke");
         Node* smokeNode = scene_->CreateChild("Smoke");
         smokeNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(20.0f) + 10.0f, Random(200.0f) - 100.0f));
         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->SetNumBillboards(NUM_BILLBOARDS);
         billboardObject->SetMaterial(cache->GetResource<Material>("Materials/LitSmoke.xml"));
         billboardObject->SetMaterial(cache->GetResource<Material>("Materials/LitSmoke.xml"));
         billboardObject->SetSorted(true);
         billboardObject->SetSorted(true);
@@ -170,7 +170,7 @@ void Billboards::CreateScene()
     for (unsigned i = 0; i < NUM_LIGHTS; ++i)
     for (unsigned i = 0; i < NUM_LIGHTS; ++i)
     {
     {
         Node* lightNode = scene_->CreateChild("SpotLight");
         Node* lightNode = scene_->CreateChild("SpotLight");
-        Light* light = lightNode->CreateComponent<Light>();
+        auto* light = lightNode->CreateComponent<Light>();
 
 
         float angle = 0.0f;
         float angle = 0.0f;
 
 
@@ -202,7 +202,7 @@ void Billboards::CreateScene()
 
 
     // Create the camera. Limit far clip distance to match the fog
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane
     // Set an initial position for the camera scene node above the plane
@@ -211,11 +211,11 @@ void Billboards::CreateScene()
 
 
 void Billboards::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle debug geometry"
         "Space to toggle debug geometry"
@@ -232,7 +232,7 @@ void Billboards::CreateInstructions()
 
 
 void Billboards::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -255,7 +255,7 @@ void Billboards::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     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
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (unsigned i = 0; i < billboardNodes.Size(); ++i)
     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)
         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()
 void Decals::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -87,13 +87,13 @@ void Decals::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     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->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->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetCastShadows(true);
         mushroomObject->SetCastShadows(true);
@@ -133,7 +133,7 @@ void Decals::CreateScene()
         float size = 1.0f + Random(10.0f);
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
         boxObject->SetCastShadows(true);
@@ -143,7 +143,7 @@ void Decals::CreateScene()
 
 
     // Create the camera. Limit far clip distance to match the fog
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane
     // Set an initial position for the camera scene node above the plane
@@ -152,21 +152,21 @@ void Decals::CreateScene()
 
 
 void Decals::CreateUI()
 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
     // 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
     // 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_));
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     // Construct new Text object, set string to display and font to use
     // 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(
     instructionText->SetText(
         "Use WASD keys to move\n"
         "Use WASD keys to move\n"
         "LMB to paint decals, RMB to rotate view\n"
         "LMB to paint decals, RMB to rotate view\n"
@@ -185,7 +185,7 @@ void Decals::CreateUI()
 
 
 void Decals::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -205,8 +205,8 @@ void Decals::SubscribeToEvents()
 void Decals::MoveCamera(float timeStep)
 void Decals::MoveCamera(float timeStep)
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Do not move if the UI has a focused element (the console)
     // 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
         // Check if target scene node already has a DecalSet component. If not, create now
         Node* targetNode = hitDrawable->GetNode();
         Node* targetNode = hitDrawable->GetNode();
-        DecalSet* decal = targetNode->GetComponent<DecalSet>();
+        auto* decal = targetNode->GetComponent<DecalSet>();
         if (!decal)
         if (!decal)
         {
         {
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
+            auto* cache = GetSubsystem<ResourceCache>();
 
 
             decal = targetNode->CreateComponent<DecalSet>();
             decal = targetNode->CreateComponent<DecalSet>();
             decal->SetMaterial(cache->GetResource<Material>("Materials/UrhoDecal.xml"));
             decal->SetMaterial(cache->GetResource<Material>("Materials/UrhoDecal.xml"));
@@ -280,14 +280,14 @@ bool Decals::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
 {
 {
     hitDrawable = nullptr;
     hitDrawable = nullptr;
 
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
         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());
     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
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;
     PODVector<RayQueryResult> results;

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

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

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

@@ -77,7 +77,7 @@ void RenderToTexture::Start()
 
 
 void RenderToTexture::CreateScene()
 void RenderToTexture::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     {
     {
         // Create the scene which will be rendered to a texture
         // 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
         // Create a Zone for ambient light & fog control
         Node* zoneNode = rttScene_->CreateChild("Zone");
         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
         // Set same volume as the Octree, set a close bluish fog and some ambient light
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
         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));
             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
             // Orient using random pitch, yaw and roll Euler angles
             boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
             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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             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.
             // 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
             // 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));
             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
         // 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");
         rttCameraNode_ = rttScene_->CreateChild("Camera");
-        Camera* camera = rttCameraNode_->CreateComponent<Camera>();
+        auto* camera = rttCameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(100.0f);
         camera->SetFarClip(100.0f);
 
 
         // Create a point light to the camera scene node
         // Create a point light to the camera scene node
-        Light* light = rttCameraNode_->CreateComponent<Light>();
+        auto* light = rttCameraNode_->CreateComponent<Light>();
         light->SetLightType(LIGHT_POINT);
         light->SetLightType(LIGHT_POINT);
         light->SetRange(30.0f);
         light->SetRange(30.0f);
     }
     }
@@ -134,7 +134,7 @@ void RenderToTexture::CreateScene()
 
 
         // Create a Zone component for ambient lighting & fog control
         // Create a Zone component for ambient lighting & fog control
         Node* zoneNode = scene_->CreateChild("Zone");
         Node* zoneNode = scene_->CreateChild("Zone");
-        Zone* zone = zoneNode->CreateComponent<Zone>();
+        auto* zone = zoneNode->CreateComponent<Zone>();
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
         zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
         zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
         zone->SetFogStart(100.0f);
         zone->SetFogStart(100.0f);
@@ -143,7 +143,7 @@ void RenderToTexture::CreateScene()
         // Create a directional light without shadows
         // Create a directional light without shadows
         Node* lightNode = scene_->CreateChild("DirectionalLight");
         Node* lightNode = scene_->CreateChild("DirectionalLight");
         lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
         lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-        Light* light = lightNode->CreateComponent<Light>();
+        auto* light = lightNode->CreateComponent<Light>();
         light->SetLightType(LIGHT_DIRECTIONAL);
         light->SetLightType(LIGHT_DIRECTIONAL);
         light->SetColor(Color(0.2f, 0.2f, 0.2f));
         light->SetColor(Color(0.2f, 0.2f, 0.2f));
         light->SetSpecularIntensity(1.0f);
         light->SetSpecularIntensity(1.0f);
@@ -156,7 +156,7 @@ void RenderToTexture::CreateScene()
                 Node* floorNode = scene_->CreateChild("FloorTile");
                 Node* floorNode = scene_->CreateChild("FloorTile");
                 floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
                 floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
                 floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
                 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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
                 floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             }
             }
@@ -168,7 +168,7 @@ void RenderToTexture::CreateScene()
             Node* boxNode = scene_->CreateChild("ScreenBox");
             Node* boxNode = scene_->CreateChild("ScreenBox");
             boxNode->SetPosition(Vector3(0.0f, 10.0f, 0.0f));
             boxNode->SetPosition(Vector3(0.0f, 10.0f, 0.0f));
             boxNode->SetScale(Vector3(21.0f, 16.0f, 0.5f));
             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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             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->SetPosition(Vector3(0.0f, 10.0f, -0.27f));
             screenNode->SetRotation(Quaternion(-90.0f, 0.0f, 0.0f));
             screenNode->SetRotation(Quaternion(-90.0f, 0.0f, 0.0f));
             screenNode->SetScale(Vector3(20.0f, 0.0f, 15.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"));
             screenObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
 
 
             // Create a renderable texture (1024x768, RGB format), enable bilinear filtering on it
             // 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
         // Create the camera which we will move around. Limit far clip distance to match the fog
         cameraNode_ = scene_->CreateChild("Camera");
         cameraNode_ = scene_->CreateChild("Camera");
-        Camera* camera = cameraNode_->CreateComponent<Camera>();
+        auto* camera = cameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(300.0f);
         camera->SetFarClip(300.0f);
 
 
         // Set an initial position for the camera scene node above the plane
         // Set an initial position for the camera scene node above the plane
@@ -215,11 +215,11 @@ void RenderToTexture::CreateScene()
 
 
 void RenderToTexture::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -231,7 +231,7 @@ void RenderToTexture::CreateInstructions()
 
 
 void RenderToTexture::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -244,7 +244,7 @@ void RenderToTexture::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

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

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

@@ -79,7 +79,7 @@ void PhysicsStressTest::Start()
 
 
 void PhysicsStressTest::CreateScene()
 void PhysicsStressTest::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -93,7 +93,7 @@ void PhysicsStressTest::CreateScene()
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -115,13 +115,13 @@ void PhysicsStressTest::CreateScene()
         Node* floorNode = scene_->CreateChild("Floor");
         Node* floorNode = scene_->CreateChild("Floor");
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetScale(Vector3(500.0f, 1.0f, 500.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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
         // Make the floor physical by adding RigidBody and CollisionShape components
         // Make the floor physical by adding RigidBody and CollisionShape components
         /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
         /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+        auto* shape = floorNode->CreateComponent<CollisionShape>();
         shape->SetBox(Vector3::ONE);
         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->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->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
             mushroomNode->SetScale(5.0f + Random(5.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
             mushroomObject->SetCastShadows(true);
             mushroomObject->SetCastShadows(true);
 
 
             /*RigidBody* body = */mushroomNode->CreateComponent<RigidBody>();
             /*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
             // By default the highest LOD level will be used, the LOD level can be passed as an optional parameter
             shape->SetTriangleMesh(mushroomObject->GetModel());
             shape->SetTriangleMesh(mushroomObject->GetModel());
         }
         }
@@ -153,18 +153,18 @@ void PhysicsStressTest::CreateScene()
         {
         {
             Node* boxNode = scene_->CreateChild("Box");
             Node* boxNode = scene_->CreateChild("Box");
             boxNode->SetPosition(Vector3(0.0f, i * 2.0f + 100.0f, 0.0f));
             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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
             boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
             boxObject->SetCastShadows(true);
             boxObject->SetCastShadows(true);
 
 
             // Give the RigidBody mass to make it movable and also adjust friction
             // 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->SetMass(1.0f);
             body->SetFriction(1.0f);
             body->SetFriction(1.0f);
             // Disable collision event signaling to reduce CPU load of the physics simulation
             // Disable collision event signaling to reduce CPU load of the physics simulation
             body->SetCollisionEventMode(COLLISION_NEVER);
             body->SetCollisionEventMode(COLLISION_NEVER);
-            CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+            auto* shape = boxNode->CreateComponent<CollisionShape>();
             shape->SetBox(Vector3::ONE);
             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
     // 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
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the floor
     // Set an initial position for the camera scene node above the floor
@@ -181,11 +181,11 @@ void PhysicsStressTest::CreateScene()
 
 
 void PhysicsStressTest::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "LMB to spawn physics objects\n"
         "LMB to spawn physics objects\n"
@@ -204,7 +204,7 @@ void PhysicsStressTest::CreateInstructions()
 
 
 void PhysicsStressTest::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -227,7 +227,7 @@ void PhysicsStressTest::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;
@@ -276,23 +276,23 @@ void PhysicsStressTest::MoveCamera(float timeStep)
 
 
 void PhysicsStressTest::SpawnObject()
 void PhysicsStressTest::SpawnObject()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     // Create a smaller box at camera position
     // Create a smaller box at camera position
     Node* boxNode = scene_->CreateChild("SmallBox");
     Node* boxNode = scene_->CreateChild("SmallBox");
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetScale(0.25f);
     boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+    auto* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetCastShadows(true);
     boxObject->SetCastShadows(true);
 
 
     // Create physics components, use a smaller mass also
     // Create physics components, use a smaller mass also
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
+    auto* body = boxNode->CreateComponent<RigidBody>();
     body->SetMass(0.25f);
     body->SetMass(0.25f);
     body->SetFriction(0.75f);
     body->SetFriction(0.75f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+    auto* shape = boxNode->CreateComponent<CollisionShape>();
     shape->SetBox(Vector3::ONE);
     shape->SetBox(Vector3::ONE);
 
 
     const float OBJECT_VELOCITY = 10.0f;
     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;
     using namespace NodeCollision;
 
 
     // Get the other colliding body, make sure it is moving (has nonzero mass)
     // 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)
     if (otherBody->GetMass() > 0.0f)
     {
     {
@@ -102,7 +102,7 @@ void CreateRagdoll::HandleNodeCollision(StringHash eventType, VariantMap& eventD
             Vector2(90.0f, 0.0f), Vector2::ZERO);
             Vector2(90.0f, 0.0f), Vector2::ZERO);
 
 
         // Disable keyframe animation from all bones so that they will not interfere with the ragdoll
         // 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();
         Skeleton& skeleton = model->GetSkeleton();
         for (unsigned i = 0; i < skeleton.GetNumBones(); ++i)
         for (unsigned i = 0; i < skeleton.GetNumBones(); ++i)
             skeleton.GetBone(i)->animated_ = false;
             skeleton.GetBone(i)->animated_ = false;
@@ -123,7 +123,7 @@ void CreateRagdoll::CreateRagdollBone(const String& boneName, ShapeType type, co
         return;
         return;
     }
     }
 
 
-    RigidBody* body = boneNode->CreateComponent<RigidBody>();
+    auto* body = boneNode->CreateComponent<RigidBody>();
     // Set mass to make movable
     // Set mass to make movable
     body->SetMass(1.0f);
     body->SetMass(1.0f);
     // Set damping parameters to smooth out the motion
     // 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->SetLinearRestThreshold(1.5f);
     body->SetAngularRestThreshold(2.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
     // We use either a box or a capsule shape for all of the bones
     if (type == SHAPE_BOX)
     if (type == SHAPE_BOX)
         shape->SetBox(size, position, rotation);
         shape->SetBox(size, position, rotation);
@@ -158,7 +158,7 @@ void CreateRagdoll::CreateRagdollConstraint(const String& boneName, const String
         return;
         return;
     }
     }
 
 
-    Constraint* constraint = boneNode->CreateComponent<Constraint>();
+    auto* constraint = boneNode->CreateComponent<Constraint>();
     constraint->SetConstraintType(type);
     constraint->SetConstraintType(type);
     // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
     // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
     constraint->SetDisableCollision(disableCollision);
     constraint->SetDisableCollision(disableCollision);

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

@@ -81,7 +81,7 @@ void Ragdolls::Start()
 
 
 void Ragdolls::CreateScene()
 void Ragdolls::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -95,7 +95,7 @@ void Ragdolls::CreateScene()
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -117,16 +117,16 @@ void Ragdolls::CreateScene()
         Node* floorNode = scene_->CreateChild("Floor");
         Node* floorNode = scene_->CreateChild("Floor");
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
         floorNode->SetScale(Vector3(500.0f, 1.0f, 500.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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
         floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
         // Make the floor physical by adding RigidBody and CollisionShape components
         // 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
         // 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
         // the spheres will eventually come to rest
         body->SetRollingFriction(0.15f);
         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
         // 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.)
         // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.)
         shape->SetBox(Vector3::ONE);
         shape->SetBox(Vector3::ONE);
@@ -140,7 +140,7 @@ void Ragdolls::CreateScene()
             Node* modelNode = scene_->CreateChild("Jack");
             Node* modelNode = scene_->CreateChild("Jack");
             modelNode->SetPosition(Vector3(x * 5.0f, 0.0f, z * 5.0f));
             modelNode->SetPosition(Vector3(x * 5.0f, 0.0f, z * 5.0f));
             modelNode->SetRotation(Quaternion(0.0f, 180.0f, 0.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->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
             modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
             modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
             modelObject->SetCastShadows(true);
             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
             // 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
             // 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
             // The Trigger mode makes the rigid body only detect collisions, but impart no forces on the
             // colliding objects
             // colliding objects
             body->SetTrigger(true);
             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
             // Create the capsule shape with an offset so that it is correctly aligned with the model, which
             // has its origin at the feet
             // has its origin at the feet
             shape->SetCapsule(0.7f, 2.0f, Vector3(0.0f, 1.0f, 0.0f));
             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
     // 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
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the floor
     // Set an initial position for the camera scene node above the floor
@@ -176,11 +176,11 @@ void Ragdolls::CreateScene()
 
 
 void Ragdolls::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "LMB to spawn physics objects\n"
         "LMB to spawn physics objects\n"
@@ -199,7 +199,7 @@ void Ragdolls::CreateInstructions()
 
 
 void Ragdolls::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -212,7 +212,7 @@ void Ragdolls::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;
@@ -261,21 +261,21 @@ void Ragdolls::MoveCamera(float timeStep)
 
 
 void Ragdolls::SpawnObject()
 void Ragdolls::SpawnObject()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     Node* boxNode = scene_->CreateChild("Sphere");
     Node* boxNode = scene_->CreateChild("Sphere");
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetPosition(cameraNode_->GetPosition());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetRotation(cameraNode_->GetRotation());
     boxNode->SetScale(0.25f);
     boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+    auto* boxObject = boxNode->CreateComponent<StaticModel>();
     boxObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     boxObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     boxObject->SetCastShadows(true);
     boxObject->SetCastShadows(true);
 
 
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
+    auto* body = boxNode->CreateComponent<RigidBody>();
     body->SetMass(1.0f);
     body->SetMass(1.0f);
     body->SetRollingFriction(0.15f);
     body->SetRollingFriction(0.15f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
+    auto* shape = boxNode->CreateComponent<CollisionShape>();
     shape->SetSphere(1.0f);
     shape->SetSphere(1.0f);
 
 
     const float OBJECT_VELOCITY = 10.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()
 void SoundEffects::CreateUI()
 {
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     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
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
     root->SetDefaultStyle(uiStyle);
 
 
@@ -118,7 +118,7 @@ void SoundEffects::CreateUI()
     button = CreateButton(160, 80, 120, 40, "Stop Music");
     button = CreateButton(160, 80, 120, 40, "Stop Music");
     SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(SoundEffects, HandleStopMusic));
     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
     // Create sliders for controlling sound and music master volume
     Slider* slider = CreateSlider(20, 140, 200, 20, "Sound 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)
 Button* SoundEffects::CreateButton(int x, int y, int xSize, int ySize, const String& text)
 {
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     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
     // Create the button and center the text onto it
-    Button* button = root->CreateChild<Button>();
+    auto* button = root->CreateChild<Button>();
     button->SetStyleAuto();
     button->SetStyleAuto();
     button->SetPosition(x, y);
     button->SetPosition(x, y);
     button->SetSize(xSize, ySize);
     button->SetSize(xSize, ySize);
 
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetFont(font, 12);
     buttonText->SetFont(font, 12);
     buttonText->SetText(text);
     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)
 Slider* SoundEffects::CreateSlider(int x, int y, int xSize, int ySize, const String& text)
 {
 {
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     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
     // Create text and slider below it
-    Text* sliderText = root->CreateChild<Text>();
+    auto* sliderText = root->CreateChild<Text>();
     sliderText->SetPosition(x, y);
     sliderText->SetPosition(x, y);
     sliderText->SetFont(font, 12);
     sliderText->SetFont(font, 12);
     sliderText->SetText(text);
     sliderText->SetText(text);
 
 
-    Slider* slider = root->CreateChild<Slider>();
+    auto* slider = root->CreateChild<Slider>();
     slider->SetStyleAuto();
     slider->SetStyleAuto();
     slider->SetPosition(x, y + 20);
     slider->SetPosition(x, y + 20);
     slider->SetSize(xSize, ySize);
     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)
 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();
     const String& soundResourceName = button->GetVar(VAR_SOUNDRESOURCE).GetString();
 
 
     // Get the sound resource
     // 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)
     if (sound)
     {
     {
         // Create a SoundSource component for playing the sound. The SoundSource component plays
         // 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
         // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the
         // SoundSource3D component would be used instead
         // 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
         // Component will automatically remove itself when the sound finished playing
         soundSource->SetAutoRemoveMode(REMOVE_COMPONENT);
         soundSource->SetAutoRemoveMode(REMOVE_COMPONENT);
         soundSource->Play(sound);
         soundSource->Play(sound);
@@ -197,8 +197,8 @@ void SoundEffects::HandlePlaySound(StringHash eventType, VariantMap& eventData)
 
 
 void SoundEffects::HandlePlayMusic(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
     // Set the song to loop
     music->SetLooped(true);
     music->SetLooped(true);
 
 

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

@@ -77,7 +77,7 @@ void Navigation::Start()
 
 
 void Navigation::CreateScene()
 void Navigation::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -89,13 +89,13 @@ void Navigation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -125,7 +125,7 @@ void Navigation::CreateScene()
         float size = 1.0f + Random(10.0f);
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
         boxObject->SetCastShadows(true);
@@ -136,13 +136,13 @@ void Navigation::CreateScene()
     // Create Jack node that will follow the path
     // Create Jack node that will follow the path
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_->SetPosition(Vector3(-5.0f, 0.0f, 20.0f));
     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->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetCastShadows(true);
     modelObject->SetCastShadows(true);
 
 
     // Create a NavigationMesh component to the scene root
     // 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
     // Set small tiles to show navigation mesh streaming
     navMesh->SetTileSize(32);
     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
     // 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
     // Create the camera. Limit far clip distance to match the fog
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane and looking down
     // 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()
 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
     // 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
     // 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_));
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
 
 
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     // Construct new Text object, set string to display and font to use
     // 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(
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
@@ -204,7 +204,7 @@ void Navigation::CreateUI()
 
 
 void Navigation::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -224,8 +224,8 @@ void Navigation::SubscribeToEvents()
 void Navigation::MoveCamera(float timeStep)
 void Navigation::MoveCamera(float timeStep)
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Do not move if the UI has a focused element (the console)
     // Do not move if the UI has a focused element (the console)
@@ -276,7 +276,7 @@ void Navigation::SetPathPoint()
 {
 {
     Vector3 hitPos;
     Vector3 hitPos;
     Drawable* hitDrawable;
     Drawable* hitDrawable;
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
 
 
     if (Raycast(250.0f, hitPos, hitDrawable))
     if (Raycast(250.0f, hitPos, hitDrawable))
     {
     {
@@ -323,7 +323,7 @@ void Navigation::AddOrRemoveObject()
         }
         }
 
 
         // Rebuild part of the navigation mesh, then recalculate path if applicable
         // Rebuild part of the navigation mesh, then recalculate path if applicable
-        NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+        auto* navMesh = scene_->GetComponent<NavigationMesh>();
         navMesh->Build(updateBox);
         navMesh->Build(updateBox);
         if (currentPath_.Size())
         if (currentPath_.Size())
             navMesh->FindPath(currentPath_, jackNode_->GetPosition(), endPos_);
             navMesh->FindPath(currentPath_, jackNode_->GetPosition(), endPos_);
@@ -332,13 +332,13 @@ void Navigation::AddOrRemoveObject()
 
 
 Node* Navigation::CreateMushroom(const Vector3& pos)
 Node* Navigation::CreateMushroom(const Vector3& pos)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     mushroomNode->SetPosition(pos);
     mushroomNode->SetPosition(pos);
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetScale(2.0f + Random(0.5f));
     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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetCastShadows(true);
     mushroomObject->SetCastShadows(true);
@@ -350,14 +350,14 @@ bool Navigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawa
 {
 {
     hitDrawable = nullptr;
     hitDrawable = nullptr;
 
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
         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());
     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
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;
     PODVector<RayQueryResult> results;
@@ -397,7 +397,7 @@ void Navigation::FollowPath(float timeStep)
 
 
 void Navigation::ToggleStreaming(bool enabled)
 void Navigation::ToggleStreaming(bool enabled)
 {
 {
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
     if (enabled)
     if (enabled)
     {
     {
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
@@ -412,7 +412,7 @@ void Navigation::ToggleStreaming(bool enabled)
 void Navigation::UpdateStreaming()
 void Navigation::UpdateStreaming()
 {
 {
     // Center the navigation mesh at the jack
     // 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 jackTile = navMesh->GetTileIndex(jackNode_->GetWorldPosition());
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
@@ -446,7 +446,7 @@ void Navigation::UpdateStreaming()
 
 
 void Navigation::SaveNavigationData()
 void Navigation::SaveNavigationData()
 {
 {
-    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    auto* navMesh = scene_->GetComponent<NavigationMesh>();
     tileData_.Clear();
     tileData_.Clear();
     addedTiles_.Clear();
     addedTiles_.Clear();
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 numTiles = navMesh->GetNumTiles();
@@ -472,7 +472,7 @@ void Navigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
     FollowPath(timeStep);
     FollowPath(timeStep);
 
 
     // Update streaming
     // Update streaming
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_TAB))
     if (input->GetKeyPress(KEY_TAB))
     {
     {
         useStreaming_ = !useStreaming_;
         useStreaming_ = !useStreaming_;
@@ -491,7 +491,7 @@ void Navigation::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventD
     if (currentPath_.Size())
     if (currentPath_.Size())
     {
     {
         // Visualize the current calculated path
         // 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)),
         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));
             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
     SetLogoVisible(false); // We need the full rendering window
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     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
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
     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_ = root->CreateChild<Text>();
     chatHistoryText_->SetFont(font, 12);
     chatHistoryText_->SetFont(font, 12);
 
 
@@ -140,14 +140,14 @@ void Chat::SubscribeToEvents()
 
 
 Button* Chat::CreateButton(const String& text, int width)
 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->SetStyleAuto();
     button->SetFixedWidth(width);
     button->SetFixedWidth(width);
 
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetFont(font, 12);
     buttonText->SetFont(font, 12);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetText(text);
     buttonText->SetText(text);
@@ -170,7 +170,7 @@ void Chat::ShowChatText(const String& row)
 
 
 void Chat::UpdateButtons()
 void Chat::UpdateButtons()
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     Connection* serverConnection = network->GetServerConnection();
     bool serverRunning = network->IsServerRunning();
     bool serverRunning = network->IsServerRunning();
 
 
@@ -194,7 +194,7 @@ void Chat::HandleSend(StringHash eventType, VariantMap& eventData)
     if (text.Empty())
     if (text.Empty())
         return; // Do not send an empty message
         return; // Do not send an empty message
 
 
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     Connection* serverConnection = network->GetServerConnection();
 
 
     if (serverConnection)
     if (serverConnection)
@@ -211,7 +211,7 @@ void Chat::HandleSend(StringHash eventType, VariantMap& eventData)
 
 
 void Chat::HandleConnect(StringHash eventType, VariantMap& eventData)
 void Chat::HandleConnect(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     String address = textEdit_->GetText().Trimmed();
     String address = textEdit_->GetText().Trimmed();
     if (address.Empty())
     if (address.Empty())
         address = "localhost"; // Use localhost to connect if nothing else specified
         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)
 void Chat::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     Connection* serverConnection = network->GetServerConnection();
     // If we were connected to server, disconnect
     // If we were connected to server, disconnect
     if (serverConnection)
     if (serverConnection)
@@ -242,7 +242,7 @@ void Chat::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 
 
 void Chat::HandleStartServer(StringHash eventType, VariantMap& eventData)
 void Chat::HandleStartServer(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     network->StartServer(CHAT_SERVER_PORT);
     network->StartServer(CHAT_SERVER_PORT);
 
 
     UpdateButtons();
     UpdateButtons();
@@ -250,7 +250,7 @@ void Chat::HandleStartServer(StringHash eventType, VariantMap& eventData)
 
 
 void Chat::HandleNetworkMessage(StringHash eventType, VariantMap& eventData)
 void Chat::HandleNetworkMessage(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
 
 
     using namespace NetworkMessage;
     using namespace NetworkMessage;
 
 
@@ -266,7 +266,7 @@ void Chat::HandleNetworkMessage(StringHash eventType, VariantMap& eventData)
         // If we are a client, just display the message
         // If we are a client, just display the message
         if (network->IsServerRunning())
         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;
             text = sender->ToString() + " " + text;
 
 

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

@@ -99,7 +99,7 @@ void SceneReplication::CreateScene()
 {
 {
     scene_ = new Scene(context_);
     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
     // Create octree and physics world with default settings. Create them as local so that they are not needlessly replicated
     // when a client connects
     // 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
     // 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.
     // not removed from the client upon connection. Create a Zone component first for ambient lighting & fog control.
     Node* zoneNode = scene_->CreateChild("Zone", LOCAL);
     Node* zoneNode = scene_->CreateChild("Zone", LOCAL);
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
     zone->SetFogStart(100.0f);
     zone->SetFogStart(100.0f);
@@ -118,7 +118,7 @@ void SceneReplication::CreateScene()
     // Create a directional light without shadows
     // Create a directional light without shadows
     Node* lightNode = scene_->CreateChild("DirectionalLight", LOCAL);
     Node* lightNode = scene_->CreateChild("DirectionalLight", LOCAL);
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
     lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetColor(Color(0.2f, 0.2f, 0.2f));
     light->SetSpecularIntensity(1.0f);
     light->SetSpecularIntensity(1.0f);
@@ -131,13 +131,13 @@ void SceneReplication::CreateScene()
             Node* floorNode = scene_->CreateChild("FloorTile", LOCAL);
             Node* floorNode = scene_->CreateChild("FloorTile", LOCAL);
             floorNode->SetPosition(Vector3(x * 20.2f, -0.5f, y * 20.2f));
             floorNode->SetPosition(Vector3(x * 20.2f, -0.5f, y * 20.2f));
             floorNode->SetScale(Vector3(20.0f, 1.0f, 20.0f));
             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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
             floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
             floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
 
 
-            RigidBody* body = floorNode->CreateComponent<RigidBody>();
+            auto* body = floorNode->CreateComponent<RigidBody>();
             body->SetFriction(1.0f);
             body->SetFriction(1.0f);
-            CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
+            auto* shape = floorNode->CreateComponent<CollisionShape>();
             shape->SetBox(Vector3::ONE);
             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
     // 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)
     // viewport in SetupViewports() below)
     cameraNode_ = scene_->CreateChild("Camera", LOCAL);
     cameraNode_ = scene_->CreateChild("Camera", LOCAL);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane
     // Set an initial position for the camera scene node above the plane
@@ -157,10 +157,10 @@ void SceneReplication::CreateScene()
 
 
 void SceneReplication::CreateUI()
 void SceneReplication::CreateUI()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* root = ui->GetRoot();
     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
     // Set style to the UI root so that elements will inherit it
     root->SetDefaultStyle(uiStyle);
     root->SetDefaultStyle(uiStyle);
 
 
@@ -170,7 +170,7 @@ void SceneReplication::CreateUI()
     cursor->SetStyleAuto(uiStyle);
     cursor->SetStyleAuto(uiStyle);
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     // Construct the instructions text element
     // Construct the instructions text element
@@ -203,7 +203,7 @@ void SceneReplication::CreateUI()
 
 
 void SceneReplication::SetupViewport()
 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
     // 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>()));
     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)
 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->SetStyleAuto();
     button->SetFixedWidth(width);
     button->SetFixedWidth(width);
 
 
-    Text* buttonText = button->CreateChild<Text>();
+    auto* buttonText = button->CreateChild<Text>();
     buttonText->SetFont(font, 12);
     buttonText->SetFont(font, 12);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetAlignment(HA_CENTER, VA_CENTER);
     buttonText->SetText(text);
     buttonText->SetText(text);
@@ -256,7 +256,7 @@ Button* SceneReplication::CreateButton(const String& text, int width)
 
 
 void SceneReplication::UpdateButtons()
 void SceneReplication::UpdateButtons()
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     Connection* serverConnection = network->GetServerConnection();
     bool serverRunning = network->IsServerRunning();
     bool serverRunning = network->IsServerRunning();
 
 
@@ -269,28 +269,28 @@ void SceneReplication::UpdateButtons()
 
 
 Node* SceneReplication::CreateControllableObject()
 Node* SceneReplication::CreateControllableObject()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     // Create the scene node & visual representation. This will be a replicated object
     // Create the scene node & visual representation. This will be a replicated object
     Node* ballNode = scene_->CreateChild("Ball");
     Node* ballNode = scene_->CreateChild("Ball");
     ballNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 5.0f, Random(40.0f) - 20.0f));
     ballNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 5.0f, Random(40.0f) - 20.0f));
     ballNode->SetScale(0.5f);
     ballNode->SetScale(0.5f);
-    StaticModel* ballObject = ballNode->CreateComponent<StaticModel>();
+    auto* ballObject = ballNode->CreateComponent<StaticModel>();
     ballObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     ballObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
     ballObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
     ballObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
 
 
     // Create the physics components
     // Create the physics components
-    RigidBody* body = ballNode->CreateComponent<RigidBody>();
+    auto* body = ballNode->CreateComponent<RigidBody>();
     body->SetMass(1.0f);
     body->SetMass(1.0f);
     body->SetFriction(1.0f);
     body->SetFriction(1.0f);
     // In addition to friction, use motion damping so that the ball can not accelerate limitlessly
     // In addition to friction, use motion damping so that the ball can not accelerate limitlessly
     body->SetLinearDamping(0.5f);
     body->SetLinearDamping(0.5f);
     body->SetAngularDamping(0.5f);
     body->SetAngularDamping(0.5f);
-    CollisionShape* shape = ballNode->CreateComponent<CollisionShape>();
+    auto* shape = ballNode->CreateComponent<CollisionShape>();
     shape->SetSphere(1.0f);
     shape->SetSphere(1.0f);
 
 
     // Create a random colored point light at the ball so that can see better where is going
     // 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->SetRange(3.0f);
     light->SetColor(Color(0.5f + (Rand() & 1) * 0.5f, 0.5f + (Rand() & 1) * 0.5f, 0.5f + (Rand() & 1) * 0.5f));
     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()
 void SceneReplication::MoveCamera()
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Mouse sensitivity as degrees per pixel
     // 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)
     // 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
     // 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.)
     // 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();
     Connection* serverConnection = network->GetServerConnection();
 
 
     // Client: collect controls
     // Client: collect controls
     if (serverConnection)
     if (serverConnection)
     {
     {
-        UI* ui = GetSubsystem<UI>();
-        Input* input = GetSubsystem<Input>();
+        auto* ui = GetSubsystem<UI>();
+        auto* input = GetSubsystem<Input>();
         Controls controls;
         Controls controls;
 
 
         // Copy mouse yaw
         // Copy mouse yaw
@@ -389,7 +389,7 @@ void SceneReplication::HandlePhysicsPreStep(StringHash eventType, VariantMap& ev
             if (!ballNode)
             if (!ballNode)
                 continue;
                 continue;
 
 
-            RigidBody* body = ballNode->GetComponent<RigidBody>();
+            auto* body = ballNode->GetComponent<RigidBody>();
 
 
             // Get the last controls sent by the client
             // Get the last controls sent by the client
             const Controls& controls = connection->GetControls();
             const Controls& controls = connection->GetControls();
@@ -415,7 +415,7 @@ void SceneReplication::HandlePhysicsPreStep(StringHash eventType, VariantMap& ev
 
 
 void SceneReplication::HandleConnect(StringHash eventType, VariantMap& eventData)
 void SceneReplication::HandleConnect(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     String address = textEdit_->GetText().Trimmed();
     String address = textEdit_->GetText().Trimmed();
     if (address.Empty())
     if (address.Empty())
         address = "localhost"; // Use localhost to connect if nothing else specified
         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)
 void SceneReplication::HandleDisconnect(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     Connection* serverConnection = network->GetServerConnection();
     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
     // 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
     // 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)
 void SceneReplication::HandleStartServer(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
     network->StartServer(SERVER_PORT);
     network->StartServer(SERVER_PORT);
 
 
     UpdateButtons();
     UpdateButtons();
@@ -467,7 +467,7 @@ void SceneReplication::HandleClientConnected(StringHash eventType, VariantMap& e
     using namespace ClientConnected;
     using namespace ClientConnected;
 
 
     // When a client connects, assign to scene to begin scene replication
     // 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_);
     newConnection->SetScene(scene_);
 
 
     // Then create a controllable object for that client
     // Then create a controllable object for that client
@@ -485,7 +485,7 @@ void SceneReplication::HandleClientDisconnected(StringHash eventType, VariantMap
     using namespace ClientConnected;
     using namespace ClientConnected;
 
 
     // When a client disconnects, remove the controlled object
     // 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];
     Node* object = serverObjects_[connection];
     if (object)
     if (object)
         object->Remove();
         object->Remove();

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

@@ -63,8 +63,8 @@ void Character::Start()
 void Character::FixedUpdate(float timeStep)
 void Character::FixedUpdate(float timeStep)
 {
 {
     /// \todo Could cache the components for faster access instead of finding them each frame
     /// \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
     // Update the in air timer. Reset if grounded
     if (!onGround_)
     if (!onGround_)

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

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

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

@@ -122,11 +122,11 @@ void Vehicle::FixedUpdate(float timeStep)
 void Vehicle::Init()
 void Vehicle::Init()
 {
 {
     // This function is called only from the main program when initially creating the vehicle, not on scene load
     // 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>();
     hullBody_ = node_->CreateComponent<RigidBody>();
-    CollisionShape* hullShape = node_->CreateComponent<CollisionShape>();
+    auto* hullShape = node_->CreateComponent<CollisionShape>();
 
 
     node_->SetScale(Vector3(1.5f, 1.0f, 3.0f));
     node_->SetScale(Vector3(1.5f, 1.0f, 3.0f));
     hullObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     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)
 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
     // 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
     // constraint keep it together
@@ -160,10 +160,10 @@ void Vehicle::InitWheel(const String& name, const Vector3& offset, WeakPtr<Node>
     // Remember the ID for serialization
     // Remember the ID for serialization
     wheelNodeID = wheelNode->GetID();
     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->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
     wheelObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
     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()
 void VehicleDemo::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     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,
     // 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
     // so that it won't be destroyed and recreated, and we don't have to redefine the viewport on load
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(500.0f);
     camera->SetFarClip(500.0f);
     GetSubsystem<Renderer>()->SetViewport(0, new Viewport(context_, scene_, camera));
     GetSubsystem<Renderer>()->SetViewport(0, new Viewport(context_, scene_, camera));
 
 
     // Create static scene content. First create a zone for ambient lighting and fog control
     // Create static scene content. First create a zone for ambient lighting and fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     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->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     zone->SetFogStart(300.0f);
     zone->SetFogStart(300.0f);
@@ -110,7 +110,7 @@ void VehicleDemo::CreateScene()
     // Create a directional light with cascaded shadow mapping
     // Create a directional light with cascaded shadow mapping
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.3f, -0.5f, 0.425f));
     lightNode->SetDirection(Vector3(0.3f, -0.5f, 0.425f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -120,7 +120,7 @@ void VehicleDemo::CreateScene()
     // Create heightmap terrain with collision
     // Create heightmap terrain with collision
     Node* terrainNode = scene_->CreateChild("Terrain");
     Node* terrainNode = scene_->CreateChild("Terrain");
     terrainNode->SetPosition(Vector3::ZERO);
     terrainNode->SetPosition(Vector3::ZERO);
-    Terrain* terrain = terrainNode->CreateComponent<Terrain>();
+    auto* terrain = terrainNode->CreateComponent<Terrain>();
     terrain->SetPatchSize(64);
     terrain->SetPatchSize(64);
     terrain->SetSpacing(Vector3(2.0f, 0.1f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSpacing(Vector3(2.0f, 0.1f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSmoothing(true);
     terrain->SetSmoothing(true);
@@ -130,9 +130,9 @@ void VehicleDemo::CreateScene()
     // terrain patches and other objects behind it
     // terrain patches and other objects behind it
     terrain->SetOccluder(true);
     terrain->SetOccluder(true);
 
 
-    RigidBody* body = terrainNode->CreateComponent<RigidBody>();
+    auto* body = terrainNode->CreateComponent<RigidBody>();
     body->SetCollisionLayer(2); // Use layer bitmask 2 for static geometry
     body->SetCollisionLayer(2); // Use layer bitmask 2 for static geometry
-    CollisionShape* shape = terrainNode->CreateComponent<CollisionShape>();
+    auto* shape = terrainNode->CreateComponent<CollisionShape>();
     shape->SetTerrain();
     shape->SetTerrain();
 
 
     // Create 1000 mushrooms in the terrain. Always face outward along the terrain normal
     // 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
         // Create a rotation quaternion from up vector to terrain normal
         objectNode->SetRotation(Quaternion(Vector3::UP, terrain->GetNormal(position)));
         objectNode->SetRotation(Quaternion(Vector3::UP, terrain->GetNormal(position)));
         objectNode->SetScale(3.0f);
         objectNode->SetScale(3.0f);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         object->SetCastShadows(true);
         object->SetCastShadows(true);
 
 
-        RigidBody* body = objectNode->CreateComponent<RigidBody>();
+        auto* body = objectNode->CreateComponent<RigidBody>();
         body->SetCollisionLayer(2);
         body->SetCollisionLayer(2);
-        CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();
+        auto* shape = objectNode->CreateComponent<CollisionShape>();
         shape->SetTriangleMesh(object->GetModel(), 0);
         shape->SetTriangleMesh(object->GetModel(), 0);
     }
     }
 }
 }
@@ -171,11 +171,11 @@ void VehicleDemo::CreateVehicle()
 
 
 void VehicleDemo::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys to drive, mouse/touch to rotate camera\n"
         "Use WASD keys to drive, mouse/touch to rotate camera\n"
         "F5 to save scene, F7 to load"
         "F5 to save scene, F7 to load"
@@ -206,11 +206,11 @@ void VehicleDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace Update;
     using namespace Update;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     if (vehicle_)
     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
         // Get movement controls and assign them to the vehicle component. If UI has a focused element, clear controls
         if (!ui->GetFocusElement())
         if (!ui->GetFocusElement())
@@ -228,11 +228,11 @@ void VehicleDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
                     TouchState* state = input->GetTouch(i);
                     TouchState* state = input->GetTouch(i);
                     if (!state->touchedElement_)    // Touch on empty space
                     if (!state->touchedElement_)    // Touch on empty space
                     {
                     {
-                        Camera* camera = cameraNode_->GetComponent<Camera>();
+                        auto* camera = cameraNode_->GetComponent<Camera>();
                         if (!camera)
                         if (!camera)
                             return;
                             return;
 
 
-                        Graphics* graphics = GetSubsystem<Graphics>();
+                        auto* graphics = GetSubsystem<Graphics>();
                         vehicle_->controls_.yaw_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.x_;
                         vehicle_->controls_.yaw_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.x_;
                         vehicle_->controls_.pitch_ += TOUCH_SENSITIVITY * camera->GetFov() / graphics->GetHeight() * state->delta_.y_;
                         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()
 void HugeObjectCount::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     if (!scene_)
     if (!scene_)
         scene_ = new Scene(context_);
         scene_ = new Scene(context_);
@@ -90,7 +90,7 @@ void HugeObjectCount::CreateScene()
 
 
     // Create a Zone for ambient light & fog control
     // Create a Zone for ambient light & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogStart(200.0f);
     zone->SetFogStart(200.0f);
@@ -99,7 +99,7 @@ void HugeObjectCount::CreateScene()
     // Create a directional light
     // Create a directional light
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(-0.6f, -1.0f, -0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
 
 
     if (!useGroups_)
     if (!useGroups_)
@@ -114,7 +114,7 @@ void HugeObjectCount::CreateScene()
                 Node* boxNode = scene_->CreateChild("Box");
                 Node* boxNode = scene_->CreateChild("Box");
                 boxNode->SetPosition(Vector3(x * 0.3f, 0.0f, y * 0.3f));
                 boxNode->SetPosition(Vector3(x * 0.3f, 0.0f, y * 0.3f));
                 boxNode->SetScale(0.25f);
                 boxNode->SetScale(0.25f);
-                StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+                auto* boxObject = boxNode->CreateComponent<StaticModel>();
                 boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
                 boxNodes_.Push(SharedPtr<Node>(boxNode));
                 boxNodes_.Push(SharedPtr<Node>(boxNode));
             }
             }
@@ -156,18 +156,18 @@ void HugeObjectCount::CreateScene()
     {
     {
         cameraNode_ = new Node(context_);
         cameraNode_ = new Node(context_);
         cameraNode_->SetPosition(Vector3(0.0f, 10.0f, -100.0f));
         cameraNode_->SetPosition(Vector3(0.0f, 10.0f, -100.0f));
-        Camera* camera = cameraNode_->CreateComponent<Camera>();
+        auto* camera = cameraNode_->CreateComponent<Camera>();
         camera->SetFarClip(300.0f);
         camera->SetFarClip(300.0f);
     }
     }
 }
 }
 
 
 void HugeObjectCount::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle animation\n"
         "Space to toggle animation\n"
@@ -185,7 +185,7 @@ void HugeObjectCount::CreateInstructions()
 
 
 void HugeObjectCount::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -204,7 +204,7 @@ void HugeObjectCount::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;
@@ -251,7 +251,7 @@ void HugeObjectCount::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
 
     // Toggle animation with space
     // Toggle animation with space
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_SPACE))
     if (input->GetKeyPress(KEY_SPACE))
         animate_ = !animate_;
         animate_ = !animate_;
 
 

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

@@ -76,7 +76,7 @@ void AngelScriptIntegration::Start()
 
 
 void AngelScriptIntegration::CreateScene()
 void AngelScriptIntegration::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     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
     // 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
     // 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");
     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
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
     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));
         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
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
         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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         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
         // 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
         // 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");
         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
         // Call the script object's "SetRotationSpeed" function. Function arguments need to be passed in a VariantVector
         VariantVector parameters;
         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
     // 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
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
     camera->SetFarClip(100.0f);
 
 
     // Create a point light to the camera scene node
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
     light->SetRange(30.0f);
 }
 }
 
 
 void AngelScriptIntegration::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -148,7 +148,7 @@ void AngelScriptIntegration::CreateInstructions()
 
 
 void AngelScriptIntegration::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -167,7 +167,7 @@ void AngelScriptIntegration::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -77,7 +77,7 @@ void LuaIntegration::Start()
 
 
 void LuaIntegration::CreateScene()
 void LuaIntegration::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     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
     // 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
     // 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");
     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
     // Set same volume as the Octree, set a close bluish fog and some ambient light
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
     zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
@@ -97,7 +97,7 @@ void LuaIntegration::CreateScene()
     zone->SetFogStart(10.0f);
     zone->SetFogStart(10.0f);
     zone->SetFogEnd(100.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)
     if (!scriptFile)
         return;
         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));
         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
         // Orient using random pitch, yaw and roll Euler angles
         boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
         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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         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
         // 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
         // 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");
         instance->CreateObject(scriptFile, "Rotator");
 
 
         // Call the script object's "SetRotationSpeed" function.
         // 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
     // 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
     // bring the far clip plane closer for more effective culling of distant objects
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(100.0f);
     camera->SetFarClip(100.0f);
 
 
     // Create a point light to the camera scene node
     // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
+    auto* light = cameraNode_->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetLightType(LIGHT_POINT);
     light->SetRange(30.0f);
     light->SetRange(30.0f);
 }
 }
 
 
 void LuaIntegration::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -157,7 +157,7 @@ void LuaIntegration::CreateInstructions()
 
 
 void LuaIntegration::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -176,7 +176,7 @@ void LuaIntegration::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -77,7 +77,7 @@ void Water::Start()
 
 
 void Water::CreateScene()
 void Water::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -86,7 +86,7 @@ void Water::CreateScene()
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(1.0f, 1.0f, 1.0f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -110,14 +110,14 @@ void Water::CreateScene()
     // generate the necessary 3D texture coordinates for cube mapping
     // generate the necessary 3D texture coordinates for cube mapping
     Node* skyNode = scene_->CreateChild("Sky");
     Node* skyNode = scene_->CreateChild("Sky");
     skyNode->SetScale(500.0f); // The scale actually does not matter
     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->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     skybox->SetMaterial(cache->GetResource<Material>("Materials/Skybox.xml"));
     skybox->SetMaterial(cache->GetResource<Material>("Materials/Skybox.xml"));
 
 
     // Create heightmap terrain
     // Create heightmap terrain
     Node* terrainNode = scene_->CreateChild("Terrain");
     Node* terrainNode = scene_->CreateChild("Terrain");
     terrainNode->SetPosition(Vector3(0.0f, 0.0f, 0.0f));
     terrainNode->SetPosition(Vector3(0.0f, 0.0f, 0.0f));
-    Terrain* terrain = terrainNode->CreateComponent<Terrain>();
+    auto* terrain = terrainNode->CreateComponent<Terrain>();
     terrain->SetPatchSize(64);
     terrain->SetPatchSize(64);
     terrain->SetSpacing(Vector3(2.0f, 0.5f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSpacing(Vector3(2.0f, 0.5f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
     terrain->SetSmoothing(true);
     terrain->SetSmoothing(true);
@@ -138,7 +138,7 @@ void Water::CreateScene()
         // Create a rotation quaternion from up vector to terrain normal
         // Create a rotation quaternion from up vector to terrain normal
         objectNode->SetRotation(Quaternion(Vector3(0.0f, 1.0f, 0.0f), terrain->GetNormal(position)));
         objectNode->SetRotation(Quaternion(Vector3(0.0f, 1.0f, 0.0f), terrain->GetNormal(position)));
         objectNode->SetScale(5.0f);
         objectNode->SetScale(5.0f);
-        StaticModel* object = objectNode->CreateComponent<StaticModel>();
+        auto* object = objectNode->CreateComponent<StaticModel>();
         object->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         object->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         object->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         object->SetCastShadows(true);
         object->SetCastShadows(true);
@@ -148,7 +148,7 @@ void Water::CreateScene()
     waterNode_ = scene_->CreateChild("Water");
     waterNode_ = scene_->CreateChild("Water");
     waterNode_->SetScale(Vector3(2048.0f, 1.0f, 2048.0f));
     waterNode_->SetScale(Vector3(2048.0f, 1.0f, 2048.0f));
     waterNode_->SetPosition(Vector3(0.0f, 5.0f, 0.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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     water->SetMaterial(cache->GetResource<Material>("Materials/Water.xml"));
     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
     // 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
     // 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
     // the scene, because we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(750.0f);
     camera->SetFarClip(750.0f);
 
 
     // Set an initial position for the camera scene node above the ground
     // Set an initial position for the camera scene node above the ground
@@ -166,11 +166,11 @@ void Water::CreateScene()
 
 
 void Water::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER);
     instructionText->SetTextAlignment(HA_CENTER);
@@ -183,9 +183,9 @@ void Water::CreateInstructions()
 
 
 void Water::SetupViewport()
 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
     // 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>()));
     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
     // It will have the same farclip and position as the main viewport camera, but uses a reflection plane to modify
     // its position when rendering
     // its position when rendering
     reflectionCameraNode_ = cameraNode_->CreateChild();
     reflectionCameraNode_ = cameraNode_->CreateChild();
-    Camera* reflectionCamera = reflectionCameraNode_->CreateComponent<Camera>();
+    auto* reflectionCamera = reflectionCameraNode_->CreateComponent<Camera>();
     reflectionCamera->SetFarClip(750.0);
     reflectionCamera->SetFarClip(750.0);
     reflectionCamera->SetViewMask(0x7fffffff); // Hide objects with only bit 31 in the viewmask (the water plane)
     reflectionCamera->SetViewMask(0x7fffffff); // Hide objects with only bit 31 in the viewmask (the water plane)
     reflectionCamera->SetAutoAspectRatio(false);
     reflectionCamera->SetAutoAspectRatio(false);
@@ -223,7 +223,7 @@ void Water::SetupViewport()
     RenderSurface* surface = renderTexture->GetRenderSurface();
     RenderSurface* surface = renderTexture->GetRenderSurface();
     SharedPtr<Viewport> rttViewport(new Viewport(context_, scene_, reflectionCamera));
     SharedPtr<Viewport> rttViewport(new Viewport(context_, scene_, reflectionCamera));
     surface->SetViewport(0, rttViewport);
     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);
     waterMat->SetTexture(TU_DIFFUSE, renderTexture);
 }
 }
 
 
@@ -239,7 +239,7 @@ void Water::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;
@@ -266,8 +266,8 @@ void Water::MoveCamera(float timeStep)
         cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
         cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 
 
     // In case resolution has changed, adjust the reflection camera aspect ratio
     // 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());
     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
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
 
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     // Get sprite
     // Get sprite
-    Sprite2D* sprite = cache->GetResource<Sprite2D>("Urho2D/Aster.png");
+    auto* sprite = cache->GetResource<Sprite2D>("Urho2D/Aster.png");
     if (!sprite)
     if (!sprite)
         return;
         return;
 
 
@@ -104,7 +104,7 @@ void Urho2DSprite::CreateScene()
         SharedPtr<Node> spriteNode(scene_->CreateChild("StaticSprite2D"));
         SharedPtr<Node> spriteNode(scene_->CreateChild("StaticSprite2D"));
         spriteNode->SetPosition(Vector3(Random(-halfWidth, halfWidth), Random(-halfHeight, halfHeight), 0.0f));
         spriteNode->SetPosition(Vector3(Random(-halfWidth, halfWidth), Random(-halfHeight, halfHeight), 0.0f));
 
 
-        StaticSprite2D* staticSprite = spriteNode->CreateComponent<StaticSprite2D>();
+        auto* staticSprite = spriteNode->CreateComponent<StaticSprite2D>();
         // Set random color
         // Set random color
         staticSprite->SetColor(Color(Random(1.0f), Random(1.0f), Random(1.0f), 1.0f));
         staticSprite->SetColor(Color(Random(1.0f), Random(1.0f), Random(1.0f), 1.0f));
         // Set blend mode
         // Set blend mode
@@ -122,14 +122,14 @@ void Urho2DSprite::CreateScene()
     }
     }
 
 
     // Get animation set
     // Get animation set
-    AnimationSet2D* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
+    auto* animationSet = cache->GetResource<AnimationSet2D>("Urho2D/GoldIcon.scml");
     if (!animationSet)
     if (!animationSet)
         return;
         return;
 
 
     SharedPtr<Node> spriteNode(scene_->CreateChild("AnimatedSprite2D"));
     SharedPtr<Node> spriteNode(scene_->CreateChild("AnimatedSprite2D"));
     spriteNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
     spriteNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
 
 
-    AnimatedSprite2D* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
+    auto* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
     // Set animation
     // Set animation
     animatedSprite->SetAnimationSet(animationSet);
     animatedSprite->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetAnimation("idle");
@@ -137,11 +137,11 @@ void Urho2DSprite::CreateScene()
 
 
 void Urho2DSprite::CreateInstructions()
 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
     // 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->SetText("Use WASD keys to move, use PageUp PageDown keys to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -153,7 +153,7 @@ void Urho2DSprite::CreateInstructions()
 
 
 void Urho2DSprite::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -166,7 +166,7 @@ void Urho2DSprite::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     const float MOVE_SPEED = 4.0f;
@@ -183,13 +183,13 @@ void Urho2DSprite::MoveCamera(float timeStep)
 
 
     if (input->GetKeyDown(KEY_PAGEUP))
     if (input->GetKeyDown(KEY_PAGEUP))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
     }
 
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
         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
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
     MoveCamera(timeStep);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     float halfWidth = (float)graphics->GetWidth() * 0.5f * PIXEL_SIZE;
     float halfWidth = (float)graphics->GetWidth() * 0.5f * PIXEL_SIZE;
     float halfHeight = (float)graphics->GetHeight() * 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();
     Sample::Start();
 
 
     // Set mouse visible
     // Set mouse visible
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->SetMouseVisible(true);
 
 
     // Create the scene content
     // Create the scene content
@@ -66,7 +66,7 @@ void Urho2DParticle::Start()
 
 
     // Hook up to the frame update events
     // Hook up to the frame update events
     SubscribeToEvents();
     SubscribeToEvents();
-    
+
     // Set the mouse mode to use in the sample
     // Set the mouse mode to use in the sample
     Sample::InitMouseMode(MM_FREE);
     Sample::InitMouseMode(MM_FREE);
 }
 }
@@ -81,38 +81,38 @@ void Urho2DParticle::CreateScene()
     // Set camera's position
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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)
     if (!particleEffect)
         return;
         return;
 
 
     particleNode_ = scene_->CreateChild("ParticleEmitter2D");
     particleNode_ = scene_->CreateChild("ParticleEmitter2D");
-    ParticleEmitter2D* particleEmitter = particleNode_->CreateComponent<ParticleEmitter2D>();
+    auto* particleEmitter = particleNode_->CreateComponent<ParticleEmitter2D>();
     particleEmitter->SetEffect(particleEffect);
     particleEmitter->SetEffect(particleEffect);
 
 
-    ParticleEffect2D* greenSpiralEffect = cache->GetResource<ParticleEffect2D>("Urho2D/greenspiral.pex");
+    auto* greenSpiralEffect = cache->GetResource<ParticleEffect2D>("Urho2D/greenspiral.pex");
     if (!greenSpiralEffect)
     if (!greenSpiralEffect)
         return;
         return;
 
 
     Node* greenSpiralNode = scene_->CreateChild("GreenSpiral");
     Node* greenSpiralNode = scene_->CreateChild("GreenSpiral");
-    ParticleEmitter2D* greenSpiralEmitter = greenSpiralNode->CreateComponent<ParticleEmitter2D>();
+    auto* greenSpiralEmitter = greenSpiralNode->CreateComponent<ParticleEmitter2D>();
     greenSpiralEmitter->SetEffect(greenSpiralEffect);
     greenSpiralEmitter->SetEffect(greenSpiralEffect);
 }
 }
 
 
 void Urho2DParticle::CreateInstructions()
 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
     // 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->SetText("Use mouse/touch to move the particle.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -124,7 +124,7 @@ void Urho2DParticle::CreateInstructions()
 
 
 void Urho2DParticle::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -146,10 +146,10 @@ void Urho2DParticle::HandleMouseMove(StringHash eventType, VariantMap& eventData
     if (particleNode_)
     if (particleNode_)
     {
     {
         using namespace MouseMove;
         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)));
         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
     // 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
     // subscriber for the console command event
-    Console* console = GetSubsystem<Console>();
+    auto* console = GetSubsystem<Console>();
     console->SetNumRows(GetSubsystem<Graphics>()->GetHeight() / 16);
     console->SetNumRows(GetSubsystem<Graphics>()->GetHeight() / 16);
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetCommandInterpreter(GetTypeName());
     console->SetCommandInterpreter(GetTypeName());

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

@@ -85,19 +85,19 @@ void Urho2DPhysics::CreateScene()
     // Set camera's position
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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
     // Create 2D physics world component
     /*PhysicsWorld2D* physicsWorld = */scene_->CreateComponent<PhysicsWorld2D>();
     /*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.
     // Create ground.
     Node* groundNode = scene_->CreateChild("Ground");
     Node* groundNode = scene_->CreateChild("Ground");
@@ -107,11 +107,11 @@ void Urho2DPhysics::CreateScene()
     // Create 2D rigid body for gound
     // Create 2D rigid body for gound
     /*RigidBody2D* groundBody = */groundNode->CreateComponent<RigidBody2D>();
     /*RigidBody2D* groundBody = */groundNode->CreateComponent<RigidBody2D>();
 
 
-    StaticSprite2D* groundSprite = groundNode->CreateComponent<StaticSprite2D>();
+    auto* groundSprite = groundNode->CreateComponent<StaticSprite2D>();
     groundSprite->SetSprite(boxSprite);
     groundSprite->SetSprite(boxSprite);
 
 
     // Create box collider for ground
     // Create box collider for ground
-    CollisionBox2D* groundShape = groundNode->CreateComponent<CollisionBox2D>();
+    auto* groundShape = groundNode->CreateComponent<CollisionBox2D>();
     // Set box size
     // Set box size
     groundShape->SetSize(Vector2(0.32f, 0.32f));
     groundShape->SetSize(Vector2(0.32f, 0.32f));
     // Set friction
     // Set friction
@@ -123,17 +123,17 @@ void Urho2DPhysics::CreateScene()
         node->SetPosition(Vector3(Random(-0.1f, 0.1f), 5.0f + i * 0.4f, 0.0f));
         node->SetPosition(Vector3(Random(-0.1f, 0.1f), 5.0f + i * 0.4f, 0.0f));
 
 
         // Create rigid body
         // Create rigid body
-        RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+        auto* body = node->CreateComponent<RigidBody2D>();
         body->SetBodyType(BT_DYNAMIC);
         body->SetBodyType(BT_DYNAMIC);
 
 
-        StaticSprite2D* staticSprite = node->CreateComponent<StaticSprite2D>();
+        auto* staticSprite = node->CreateComponent<StaticSprite2D>();
 
 
         if (i % 2 == 0)
         if (i % 2 == 0)
         {
         {
             staticSprite->SetSprite(boxSprite);
             staticSprite->SetSprite(boxSprite);
 
 
             // Create box
             // Create box
-            CollisionBox2D* box = node->CreateComponent<CollisionBox2D>();
+            auto* box = node->CreateComponent<CollisionBox2D>();
             // Set size
             // Set size
             box->SetSize(Vector2(0.32f, 0.32f));
             box->SetSize(Vector2(0.32f, 0.32f));
             // Set density
             // Set density
@@ -148,7 +148,7 @@ void Urho2DPhysics::CreateScene()
             staticSprite->SetSprite(ballSprite);
             staticSprite->SetSprite(ballSprite);
 
 
             // Create circle
             // Create circle
-            CollisionCircle2D* circle = node->CreateComponent<CollisionCircle2D>();
+            auto* circle = node->CreateComponent<CollisionCircle2D>();
             // Set radius
             // Set radius
             circle->SetRadius(0.16f);
             circle->SetRadius(0.16f);
             // Set density
             // Set density
@@ -163,11 +163,11 @@ void Urho2DPhysics::CreateScene()
 
 
 void Urho2DPhysics::CreateInstructions()
 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
     // 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->SetText("Use WASD keys to move, use PageUp PageDown keys to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -179,7 +179,7 @@ void Urho2DPhysics::CreateInstructions()
 
 
 void Urho2DPhysics::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -192,7 +192,7 @@ void Urho2DPhysics::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     const float MOVE_SPEED = 4.0f;
@@ -209,13 +209,13 @@ void Urho2DPhysics::MoveCamera(float timeStep)
 
 
     if (input->GetKeyDown(KEY_PAGEUP))
     if (input->GetKeyDown(KEY_PAGEUP))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
     }
 
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
         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
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 5.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 5.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * 0.05f);
     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)
     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
     // Create 2D physics world component
-    PhysicsWorld2D* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->CreateComponent<PhysicsWorld2D>();
     physicsWorld->SetDrawJoint(true);
     physicsWorld->SetDrawJoint(true);
 
 
     // Create ground
     // Create ground
     Node* groundNode = scene_->CreateChild("Ground");
     Node* groundNode = scene_->CreateChild("Ground");
     // Create 2D rigid body for gound
     // Create 2D rigid body for gound
-    RigidBody2D* groundBody = groundNode->CreateComponent<RigidBody2D>();
+    auto* groundBody = groundNode->CreateComponent<RigidBody2D>();
     // Create edge collider for ground
     // 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));
     groundShape->SetVertices(Vector2(-40.0f, 0.0f), Vector2(40.0f, 0.0f));
 
 
     const float y = 15.0f;
     const float y = 15.0f;
@@ -110,11 +110,11 @@ void Urho2DPhysicsRope::CreateScene()
         Node* node  = scene_->CreateChild("RigidBody");
         Node* node  = scene_->CreateChild("RigidBody");
 
 
         // Create rigid body
         // Create rigid body
-        RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+        auto* body = node->CreateComponent<RigidBody2D>();
         body->SetBodyType(BT_DYNAMIC);
         body->SetBodyType(BT_DYNAMIC);
 
 
         // Create box
         // Create box
-        CollisionBox2D* box = node->CreateComponent<CollisionBox2D>();
+        auto* box = node->CreateComponent<CollisionBox2D>();
         // Set friction
         // Set friction
         box->SetFriction(0.2f);
         box->SetFriction(0.2f);
         // Set mask bits.
         // Set mask bits.
@@ -136,7 +136,7 @@ void Urho2DPhysicsRope::CreateScene()
             box->SetCategoryBits(0x0001);
             box->SetCategoryBits(0x0001);
         }
         }
 
 
-        ConstraintRevolute2D* joint = node->CreateComponent<ConstraintRevolute2D>();
+        auto* joint = node->CreateComponent<ConstraintRevolute2D>();
         joint->SetOtherBody(prevBody);
         joint->SetOtherBody(prevBody);
         joint->SetAnchor(Vector2(float(i), y));
         joint->SetAnchor(Vector2(float(i), y));
         joint->SetCollideConnected(false);
         joint->SetCollideConnected(false);
@@ -144,7 +144,7 @@ void Urho2DPhysicsRope::CreateScene()
         prevBody = body;
         prevBody = body;
     }
     }
 
 
-    ConstraintRope2D* constraintRope = groundNode->CreateComponent<ConstraintRope2D>();
+    auto* constraintRope = groundNode->CreateComponent<ConstraintRope2D>();
     constraintRope->SetOtherBody(prevBody);
     constraintRope->SetOtherBody(prevBody);
     constraintRope->SetOwnerBodyAnchor(Vector2(0.0f, y));
     constraintRope->SetOwnerBodyAnchor(Vector2(0.0f, y));
     constraintRope->SetMaxLength(NUM_OBJECTS - 1.0f + 0.01f);
     constraintRope->SetMaxLength(NUM_OBJECTS - 1.0f + 0.01f);
@@ -152,11 +152,11 @@ void Urho2DPhysicsRope::CreateScene()
 
 
 void Urho2DPhysicsRope::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move, Use PageUp PageDown to zoom.");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -168,7 +168,7 @@ void Urho2DPhysicsRope::CreateInstructions()
 
 
 void Urho2DPhysicsRope::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -181,7 +181,7 @@ void Urho2DPhysicsRope::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     const float MOVE_SPEED = 4.0f;
@@ -198,13 +198,13 @@ void Urho2DPhysicsRope::MoveCamera(float timeStep)
 
 
     if (input->GetKeyDown(KEY_PAGEUP))
     if (input->GetKeyDown(KEY_PAGEUP))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
     }
 
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
         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
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
     MoveCamera(timeStep);
 
 
-    PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+    auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
     physicsWorld->DrawDebugGeometry();
     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
     // Sound source needs a node so that it is considered enabled
     node_ = new Node(context_);
     node_ = new Node(context_);
-    SoundSource* source = node_->CreateComponent<SoundSource>();
+    auto* source = node_->CreateComponent<SoundSource>();
 
 
     soundStream_ = new BufferedSoundStream();
     soundStream_ = new BufferedSoundStream();
     // Set format: 44100 Hz, sixteen bit, mono
     // Set format: 44100 Hz, sixteen bit, mono
@@ -95,7 +95,7 @@ void SoundSynthesis::UpdateSound()
     if (requiredLength < 0.0f)
     if (requiredLength < 0.0f)
         return;
         return;
 
 
-    unsigned numSamples = (unsigned)(soundStream_->GetFrequency() * requiredLength);
+    auto numSamples = (unsigned)(soundStream_->GetFrequency() * requiredLength);
     if (!numSamples)
     if (!numSamples)
         return;
         return;
 
 
@@ -118,8 +118,8 @@ void SoundSynthesis::UpdateSound()
 
 
 void SoundSynthesis::CreateInstructions()
 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
     // Construct new Text object, set string to display and font to use
     instructionText_ = ui->GetRoot()->CreateChild<Text>();
     instructionText_ = ui->GetRoot()->CreateChild<Text>();
@@ -147,7 +147,7 @@ void SoundSynthesis::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
 
     // Use keys to control the filter constant
     // Use keys to control the filter constant
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyDown(KEY_UP))
     if (input->GetKeyDown(KEY_UP))
         filter_ += timeStep * 0.5f;
         filter_ += timeStep * 0.5f;
     if (input->GetKeyDown(KEY_DOWN))
     if (input->GetKeyDown(KEY_DOWN))

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

@@ -73,7 +73,7 @@ void LightAnimation::Start()
 
 
 void LightAnimation::CreateScene()
 void LightAnimation::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -88,13 +88,13 @@ void LightAnimation::CreateScene()
     // (100 x 100 world units)
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a point light to the world so that we can see something.
     // Create a point light to the world so that we can see something.
     Node* lightNode = scene_->CreateChild("PointLight");
     Node* lightNode = scene_->CreateChild("PointLight");
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_POINT);
     light->SetLightType(LIGHT_POINT);
     light->SetRange(10.0f);
     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->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->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     }
     }
@@ -177,13 +177,13 @@ void LightAnimation::CreateScene()
 
 
 void LightAnimation::CreateInstructions()
 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
     // 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->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);
     instructionText->SetFont(font, 15);
 
 
     // Position the text relative to the screen center
     // Position the text relative to the screen center
@@ -192,21 +192,21 @@ void LightAnimation::CreateInstructions()
     instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
     instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
 
 
     // Animating text
     // Animating text
-    Text* text = ui->GetRoot()->CreateChild<Text>("animatingText");
+    auto* text = ui->GetRoot()->CreateChild<Text>("animatingText");
     text->SetFont(font, 15);
     text->SetFont(font, 15);
     text->SetHorizontalAlignment(HA_CENTER);
     text->SetHorizontalAlignment(HA_CENTER);
     text->SetVerticalAlignment(VA_CENTER);
     text->SetVerticalAlignment(VA_CENTER);
     text->SetPosition(0, ui->GetRoot()->GetHeight() / 4 + 20);
     text->SetPosition(0, ui->GetRoot()->GetHeight() / 4 + 20);
 
 
     // Animating sprite in the top left corner
     // 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->SetPosition(8, 8);
     sprite->SetSize(64, 64);
     sprite->SetSize(64, 64);
 }
 }
 
 
 void LightAnimation::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -71,7 +71,7 @@ void MaterialAnimation::Start()
 
 
 void MaterialAnimation::CreateScene()
 void MaterialAnimation::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -86,7 +86,7 @@ void MaterialAnimation::CreateScene()
     // (100 x 100 world units)
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     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)
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
 
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
     // 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
     // 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
     // same material allows instancing to be used, if the GPU supports it. This reduces the amount of CPU work in rendering the
     // scene.
     // scene.
-    Material* mushroomMat = cache->GetResource<Material>("Materials/Mushroom.xml");
+    auto* mushroomMat = cache->GetResource<Material>("Materials/Mushroom.xml");
     // Apply shader parameter animation to material
     // Apply shader parameter animation to material
     SharedPtr<ValueAnimation> specColorAnimation(new ValueAnimation(context_));
     SharedPtr<ValueAnimation> specColorAnimation(new ValueAnimation(context_));
     specColorAnimation->SetKeyFrame(0.0f, Color(0.1f, 0.1f, 0.1f, 16.0f));
     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->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->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
         mushroomNode->SetScale(0.5f + Random(2.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(mushroomMat);
         mushroomObject->SetMaterial(mushroomMat);
     }
     }
@@ -138,11 +138,11 @@ void MaterialAnimation::CreateScene()
 
 
 void MaterialAnimation::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -154,7 +154,7 @@ void MaterialAnimation::CreateInstructions()
 
 
 void MaterialAnimation::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     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_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<DebugRenderer>();
     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)
     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
     drawDebug_ = true; // Set DrawDebugGeometry() to true
 
 
@@ -110,13 +110,13 @@ void Urho2DConstraints::CreateScene()
     camera_ = cameraNode_->CreateComponent<Camera>();
     camera_ = cameraNode_->CreateComponent<Camera>();
     camera_->SetOrthographic(true);
     camera_->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera_->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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
     // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera_));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera_));
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     renderer->SetViewport(0, viewport);
     renderer->SetViewport(0, viewport);
 
 
     Zone* zone = renderer->GetDefaultZone();
     Zone* zone = renderer->GetDefaultZone();
@@ -126,10 +126,10 @@ void Urho2DConstraints::CreateScene()
     for (unsigned i = 0; i<5; ++i)
     for (unsigned i = 0; i<5; ++i)
     {
     {
         Node* edgeNode = scene_->CreateChild("VerticalEdge");
         Node* edgeNode = scene_->CreateChild("VerticalEdge");
-        RigidBody2D* edgeBody = edgeNode->CreateComponent<RigidBody2D>();
+        auto* edgeBody = edgeNode->CreateComponent<RigidBody2D>();
         if (!dummyBody)
         if (!dummyBody)
             dummyBody = edgeBody; // Mark first edge as dummy body (used by mouse pick)
             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->SetVertices(Vector2(i*2.5f -5.0f, -3.0f), Vector2(i*2.5f -5.0f, 3.0f));
         edgeShape->SetFriction(0.5f); // Set friction
         edgeShape->SetFriction(0.5f); // Set friction
     }
     }
@@ -138,23 +138,23 @@ void Urho2DConstraints::CreateScene()
     {
     {
         Node* edgeNode = scene_->CreateChild("HorizontalEdge");
         Node* edgeNode = scene_->CreateChild("HorizontalEdge");
         /*RigidBody2D* edgeBody = */edgeNode->CreateComponent<RigidBody2D>();
         /*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->SetVertices(Vector2(-5.0f, j*2.0f -3.0f), Vector2(5.0f, j*2.0f -3.0f));
         edgeShape->SetFriction(0.5f); // Set friction
         edgeShape->SetFriction(0.5f); // Set friction
     }
     }
 
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     // Create a box (will be cloned later)
     // Create a box (will be cloned later)
     Node* box  = scene_->CreateChild("Box");
     Node* box  = scene_->CreateChild("Box");
     box->SetPosition(Vector3(0.8f, -2.0f, 0.0f));
     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"));
     boxSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Box.png"));
-    RigidBody2D* boxBody = box->CreateComponent<RigidBody2D>();
+    auto* boxBody = box->CreateComponent<RigidBody2D>();
     boxBody->SetBodyType(BT_DYNAMIC);
     boxBody->SetBodyType(BT_DYNAMIC);
     boxBody->SetLinearDamping(0.0f);
     boxBody->SetLinearDamping(0.0f);
     boxBody->SetAngularDamping(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->SetSize(Vector2(0.32f, 0.32f)); // Set size
     shape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     shape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     shape->SetFriction(0.5f); // Set friction
     shape->SetFriction(0.5f); // Set friction
@@ -163,13 +163,13 @@ void Urho2DConstraints::CreateScene()
     // Create a ball (will be cloned later)
     // Create a ball (will be cloned later)
     Node* ball  = scene_->CreateChild("Ball");
     Node* ball  = scene_->CreateChild("Ball");
     ball->SetPosition(Vector3(1.8f, -2.0f, 0.0f));
     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"));
     ballSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Ball.png"));
-    RigidBody2D* ballBody = ball->CreateComponent<RigidBody2D>();
+    auto* ballBody = ball->CreateComponent<RigidBody2D>();
     ballBody->SetBodyType(BT_DYNAMIC);
     ballBody->SetBodyType(BT_DYNAMIC);
     ballBody->SetLinearDamping(0.0f);
     ballBody->SetLinearDamping(0.0f);
     ballBody->SetAngularDamping(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->SetRadius(0.16f); // Set radius
     ballShape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     ballShape->SetDensity(1.0f); // Set shape density (kilograms per meter squared)
     ballShape->SetFriction(0.5f); // Set friction
     ballShape->SetFriction(0.5f); // Set friction
@@ -179,11 +179,11 @@ void Urho2DConstraints::CreateScene()
     Node* polygon = scene_->CreateChild("Polygon");
     Node* polygon = scene_->CreateChild("Polygon");
     polygon->SetPosition(Vector3(1.6f, -2.0f, 0.0f));
     polygon->SetPosition(Vector3(1.6f, -2.0f, 0.0f));
     polygon->SetScale(0.7f);
     polygon->SetScale(0.7f);
-    StaticSprite2D* polygonSprite = polygon->CreateComponent<StaticSprite2D>();
+    auto* polygonSprite = polygon->CreateComponent<StaticSprite2D>();
     polygonSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
     polygonSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
-    RigidBody2D* polygonBody = polygon->CreateComponent<RigidBody2D>();
+    auto* polygonBody = polygon->CreateComponent<RigidBody2D>();
     polygonBody->SetBodyType(BT_DYNAMIC);
     polygonBody->SetBodyType(BT_DYNAMIC);
-    CollisionPolygon2D* polygonShape = polygon->CreateComponent<CollisionPolygon2D>();
+    auto* polygonShape = polygon->CreateComponent<CollisionPolygon2D>();
     // TODO: create from PODVector<Vector2> using SetVertices()
     // TODO: create from PODVector<Vector2> using SetVertices()
     polygonShape->SetVertexCount(6); // Set number of vertices (mandatory when using SetVertex())
     polygonShape->SetVertexCount(6); // Set number of vertices (mandatory when using SetVertex())
     polygonShape->SetVertex(0, Vector2(-0.8f, -0.3f));
     polygonShape->SetVertex(0, Vector2(-0.8f, -0.3f));
@@ -200,11 +200,11 @@ void Urho2DConstraints::CreateScene()
     CreateFlag("ConstraintDistance2D", -4.97f, 3.0f); // Display Text3D flag
     CreateFlag("ConstraintDistance2D", -4.97f, 3.0f); // Display Text3D flag
     Node* boxDistanceNode = box->Clone();
     Node* boxDistanceNode = box->Clone();
     Node* ballDistanceNode = ball->Clone();
     Node* ballDistanceNode = ball->Clone();
-    RigidBody2D* ballDistanceBody = ballDistanceNode->GetComponent<RigidBody2D>();
+    auto* ballDistanceBody = ballDistanceNode->GetComponent<RigidBody2D>();
     boxDistanceNode->SetPosition(Vector3(-4.5f, 2.0f, 0.0f));
     boxDistanceNode->SetPosition(Vector3(-4.5f, 2.0f, 0.0f));
     ballDistanceNode->SetPosition(Vector3(-3.0f, 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->SetOtherBody(ballDistanceBody); // Constrain ball to box
     constraintDistance->SetOwnerBodyAnchor(boxDistanceNode->GetPosition2D());
     constraintDistance->SetOwnerBodyAnchor(boxDistanceNode->GetPosition2D());
     constraintDistance->SetOtherBodyAnchor(ballDistanceNode->GetPosition2D());
     constraintDistance->SetOtherBodyAnchor(ballDistanceNode->GetPosition2D());
@@ -219,7 +219,7 @@ void Urho2DConstraints::CreateScene()
     boxFrictionNode->SetPosition(Vector3(0.5f, 0.0f, 0.0f));
     boxFrictionNode->SetPosition(Vector3(0.5f, 0.0f, 0.0f));
     ballFrictionNode->SetPosition(Vector3(1.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->SetOtherBody(ballFrictionNode->GetComponent<RigidBody2D>()); // Constraint ball to box
     //constraintFriction->SetOwnerBodyAnchor(boxNode->GetPosition2D());
     //constraintFriction->SetOwnerBodyAnchor(boxNode->GetPosition2D());
     //constraintFriction->SetOtherBodyAnchor(ballNode->GetPosition2D());
     //constraintFriction->SetOtherBodyAnchor(ballNode->GetPosition2D());
@@ -229,24 +229,24 @@ void Urho2DConstraints::CreateScene()
     // Create a ConstraintGear2D
     // Create a ConstraintGear2D
     CreateFlag("ConstraintGear2D", -4.97f, -1.0f); // Display Text3D flag
     CreateFlag("ConstraintGear2D", -4.97f, -1.0f); // Display Text3D flag
     Node* baseNode = box->Clone();
     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);
     tempBody->SetBodyType(BT_STATIC);
     baseNode->SetPosition(Vector3(-3.7f, -2.5f, 0.0f));
     baseNode->SetPosition(Vector3(-3.7f, -2.5f, 0.0f));
     Node* ball1Node = ball->Clone();
     Node* ball1Node = ball->Clone();
     ball1Node->SetPosition(Vector3(-4.5f, -2.0f, 0.0f));
     ball1Node->SetPosition(Vector3(-4.5f, -2.0f, 0.0f));
-    RigidBody2D* ball1Body = ball1Node->GetComponent<RigidBody2D>();
+    auto* ball1Body = ball1Node->GetComponent<RigidBody2D>();
     Node* ball2Node = ball->Clone();
     Node* ball2Node = ball->Clone();
     ball2Node->SetPosition(Vector3(-3.0f, -2.0f, 0.0f));
     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->SetOtherBody(ball1Body); // Constrain ball1 to baseBox
     gear1->SetAnchor(ball1Node->GetPosition2D());
     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->SetOtherBody(ball2Body); // Constrain ball2 to baseBox
     gear2->SetAnchor(ball2Node->GetPosition2D());
     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->SetOtherBody(ball2Body); // Constrain ball2 to ball1
     constraintGear->SetOwnerConstraint(gear1);
     constraintGear->SetOwnerConstraint(gear1);
     constraintGear->SetOtherConstraint(gear2);
     constraintGear->SetOtherConstraint(gear2);
@@ -259,14 +259,14 @@ void Urho2DConstraints::CreateScene()
     Node* car = box->Clone();
     Node* car = box->Clone();
     car->SetScale(Vector3(4.0f, 1.0f, 0.0f));
     car->SetScale(Vector3(4.0f, 1.0f, 0.0f));
     car->SetPosition(Vector3(-1.2f, -2.3f, 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)
     tempSprite->SetOrderInLayer(0); // Draw car on top of the wheels (set to -1 to draw below)
     Node* ball1WheelNode = ball->Clone();
     Node* ball1WheelNode = ball->Clone();
     ball1WheelNode->SetPosition(Vector3(-1.6f, -2.5f, 0.0f));
     ball1WheelNode->SetPosition(Vector3(-1.6f, -2.5f, 0.0f));
     Node* ball2WheelNode = ball->Clone();
     Node* ball2WheelNode = ball->Clone();
     ball2WheelNode->SetPosition(Vector3(-0.8f, -2.5f, 0.0f));
     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->SetOtherBody(ball1WheelNode->GetComponent<RigidBody2D>());
     wheel1->SetAnchor(ball1WheelNode->GetPosition2D());
     wheel1->SetAnchor(ball1WheelNode->GetPosition2D());
     wheel1->SetAxis(Vector2(0.0f, 1.0f));
     wheel1->SetAxis(Vector2(0.0f, 1.0f));
@@ -274,7 +274,7 @@ void Urho2DConstraints::CreateScene()
     wheel1->SetFrequencyHz(4.0f);
     wheel1->SetFrequencyHz(4.0f);
     wheel1->SetDampingRatio(0.4f);
     wheel1->SetDampingRatio(0.4f);
 
 
-    ConstraintWheel2D* wheel2 = car->CreateComponent<ConstraintWheel2D>();
+    auto* wheel2 = car->CreateComponent<ConstraintWheel2D>();
     wheel2->SetOtherBody(ball2WheelNode->GetComponent<RigidBody2D>());
     wheel2->SetOtherBody(ball2WheelNode->GetComponent<RigidBody2D>());
     wheel2->SetAnchor(ball2WheelNode->GetPosition2D());
     wheel2->SetAnchor(ball2WheelNode->GetPosition2D());
     wheel2->SetAxis(Vector2(0.0f, 1.0f));
     wheel2->SetAxis(Vector2(0.0f, 1.0f));
@@ -291,7 +291,7 @@ void Urho2DConstraints::CreateScene()
     boxMotorNode->SetPosition(Vector3(3.8f, -2.1f, 0.0f));
     boxMotorNode->SetPosition(Vector3(3.8f, -2.1f, 0.0f));
     ballMotorNode->SetPosition(Vector3(3.8f, -1.5f, 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->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->SetLinearOffset(Vector2(0.0f, 0.8f)); // Set ballNode position relative to boxNode position = (0,0)
     constraintMotor->SetAngularOffset(0.1f);
     constraintMotor->SetAngularOffset(0.1f);
@@ -312,7 +312,7 @@ void Urho2DConstraints::CreateScene()
     boxPrismaticNode->SetPosition(Vector3(3.3f, 2.5f, 0.0f));
     boxPrismaticNode->SetPosition(Vector3(3.3f, 2.5f, 0.0f));
     ballPrismaticNode->SetPosition(Vector3(4.3f, 2.0f, 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->SetOtherBody(ballPrismaticNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintPrismatic->SetAxis(Vector2(1.0f, 1.0f)); // Slide from [0,0] to [1,1]
     constraintPrismatic->SetAxis(Vector2(1.0f, 1.0f)); // Slide from [0,0] to [1,1]
     constraintPrismatic->SetAnchor(Vector2(4.0f, 2.0f));
     constraintPrismatic->SetAnchor(Vector2(4.0f, 2.0f));
@@ -329,7 +329,7 @@ void Urho2DConstraints::CreateScene()
     boxPulleyNode->SetPosition(Vector3(0.5f, 2.0f, 0.0f));
     boxPulleyNode->SetPosition(Vector3(0.5f, 2.0f, 0.0f));
     ballPulleyNode->SetPosition(Vector3(2.0f, 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->SetOtherBody(ballPulleyNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintPulley->SetOwnerBodyAnchor(boxPulleyNode->GetPosition2D());
     constraintPulley->SetOwnerBodyAnchor(boxPulleyNode->GetPosition2D());
     constraintPulley->SetOtherBodyAnchor(ballPulleyNode->GetPosition2D());
     constraintPulley->SetOtherBodyAnchor(ballPulleyNode->GetPosition2D());
@@ -346,7 +346,7 @@ void Urho2DConstraints::CreateScene()
     boxRevoluteNode->SetPosition(Vector3(-2.0f, 1.5f, 0.0f));
     boxRevoluteNode->SetPosition(Vector3(-2.0f, 1.5f, 0.0f));
     ballRevoluteNode->SetPosition(Vector3(-1.0f, 2.0f, 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->SetOtherBody(ballRevoluteNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintRevolute->SetAnchor(Vector2(-1.0f, 1.5f));
     constraintRevolute->SetAnchor(Vector2(-1.0f, 1.5f));
     constraintRevolute->SetLowerAngle(-1.0f); // In radians
     constraintRevolute->SetLowerAngle(-1.0f); // In radians
@@ -365,7 +365,7 @@ void Urho2DConstraints::CreateScene()
     boxRopeNode->SetPosition(Vector3(-3.7f, 0.7f, 0.0f));
     boxRopeNode->SetPosition(Vector3(-3.7f, 0.7f, 0.0f));
     ballRopeNode->SetPosition(Vector3(-4.5f, 0.0f, 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->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->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
     constraintRope->SetMaxLength(0.9f); // Rope length
@@ -378,7 +378,7 @@ void Urho2DConstraints::CreateScene()
     boxWeldNode->SetPosition(Vector3(-0.5f, 0.0f, 0.0f));
     boxWeldNode->SetPosition(Vector3(-0.5f, 0.0f, 0.0f));
     ballWeldNode->SetPosition(Vector3(-2.0f, 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->SetOtherBody(ballWeldNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintWeld->SetAnchor(boxWeldNode->GetPosition2D());
     constraintWeld->SetAnchor(boxWeldNode->GetPosition2D());
     constraintWeld->SetFrequencyHz(4.0f);
     constraintWeld->SetFrequencyHz(4.0f);
@@ -391,7 +391,7 @@ void Urho2DConstraints::CreateScene()
     boxWheelNode->SetPosition(Vector3(3.8f, 0.0f, 0.0f));
     boxWheelNode->SetPosition(Vector3(3.8f, 0.0f, 0.0f));
     ballWheelNode->SetPosition(Vector3(3.8f, 0.9f, 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->SetOtherBody(ballWheelNode->GetComponent<RigidBody2D>()); // Constrain ball to box
     constraintWheel->SetAnchor(ballWheelNode->GetPosition2D());
     constraintWheel->SetAnchor(ballWheelNode->GetPosition2D());
     constraintWheel->SetAxis(Vector2(0.0f, 1.0f));
     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");
     Node* flagNode = scene_->CreateChild("Flag");
     flagNode->SetPosition(Vector3(x, y, 0.0f));
     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);
     flag3D->SetText(text);
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     flag3D->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     flag3D->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 }
 }
 
 
 void Urho2DConstraints::CreateInstructions()
 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
     // 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->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->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
@@ -436,7 +436,7 @@ void Urho2DConstraints::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     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
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
     MoveCamera(timeStep);
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Toggle physics debug geometry with space
     // Toggle physics debug geometry with space
     if (input->GetKeyPress(KEY_SPACE))
     if (input->GetKeyPress(KEY_SPACE))
@@ -502,24 +502,24 @@ void Urho2DConstraints::HandleUpdate(StringHash eventType, VariantMap& eventData
 
 
 void Urho2DConstraints::HandlePostRenderUpdate(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();
     if (drawDebug_) physicsWorld->DrawDebugGeometry();
 }
 }
 
 
 void Urho2DConstraints::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 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
     RigidBody2D* rigidBody = physicsWorld->GetRigidBody(input->GetMousePosition().x_, input->GetMousePosition().y_); // Raycast for RigidBody2Ds to pick
     if (rigidBody)
     if (rigidBody)
     {
     {
         pickedNode = rigidBody->GetNode();
         pickedNode = rigidBody->GetNode();
         //log.Info(pickedNode.name);
         //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
         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
         // 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->SetTarget(GetMousePositionXY());
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
         constraintMouse->SetCollideConnected(true);
         constraintMouse->SetCollideConnected(true);
@@ -533,7 +533,7 @@ void Urho2DConstraints::HandleMouseButtonUp(StringHash eventType, VariantMap& ev
 {
 {
     if (pickedNode)
     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
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
@@ -545,8 +545,8 @@ void Urho2DConstraints::HandleMouseButtonUp(StringHash eventType, VariantMap& ev
 
 
 Vector2 Urho2DConstraints::GetMousePositionXY()
 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 screenPoint = Vector3((float)input->GetMousePosition().x_ / graphics->GetWidth(), (float)input->GetMousePosition().y_ / graphics->GetHeight(), 0.0f);
     Vector3 worldPoint = camera_->ScreenToWorldPoint(screenPoint);
     Vector3 worldPoint = camera_->ScreenToWorldPoint(screenPoint);
     return Vector2(worldPoint.x_, worldPoint.y_);
     return Vector2(worldPoint.x_, worldPoint.y_);
@@ -556,26 +556,26 @@ void Urho2DConstraints::HandleMouseMove(StringHash eventType, VariantMap& eventD
 {
 {
     if (pickedNode)
     if (pickedNode)
     {
     {
-        ConstraintMouse2D* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
+        auto* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
         constraintMouse->SetTarget(GetMousePositionXY());
         constraintMouse->SetTarget(GetMousePositionXY());
     }
     }
 }
 }
 
 
 void Urho2DConstraints::HandleTouchBegin3(StringHash eventType, VariantMap& eventData)
 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;
     using namespace TouchBegin;
     RigidBody2D* rigidBody = physicsWorld->GetRigidBody(eventData[P_X].GetInt(), eventData[P_Y].GetInt()); // Raycast for RigidBody2Ds to pick
     RigidBody2D* rigidBody = physicsWorld->GetRigidBody(eventData[P_X].GetInt(), eventData[P_Y].GetInt()); // Raycast for RigidBody2Ds to pick
     if (rigidBody)
     if (rigidBody)
     {
     {
         pickedNode = rigidBody->GetNode();
         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
         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
         // 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));
         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->SetTarget(Vector2(pos.x_, pos.y_));
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
         constraintMouse->SetMaxForce(1000 * rigidBody->GetMass());
@@ -591,8 +591,8 @@ void Urho2DConstraints::HandleTouchMove3(StringHash eventType, VariantMap& event
 {
 {
     if (pickedNode)
     if (pickedNode)
     {
     {
-        Graphics* graphics = GetSubsystem<Graphics>();
-        ConstraintMouse2D* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
+        auto* graphics = GetSubsystem<Graphics>();
+        auto* constraintMouse = pickedNode->GetComponent<ConstraintMouse2D>();
         using namespace TouchMove;
         using namespace TouchMove;
         Vector3 pos = camera_->ScreenToWorldPoint(Vector3(float(eventData[P_X].GetInt()) / graphics->GetWidth(), float(eventData[P_Y].GetInt()) / graphics->GetHeight(), 0.0f));
         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->SetTarget(Vector2(pos.x_, pos.y_));
@@ -603,7 +603,7 @@ void Urho2DConstraints::HandleTouchEnd3(StringHash eventType, VariantMap& eventD
 {
 {
     if (pickedNode)
     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
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
         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
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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)
     if (!spriterAnimationSet)
         return;
         return;
 
 
     spriterNode_ = scene_->CreateChild("SpriterAnimation");
     spriterNode_ = scene_->CreateChild("SpriterAnimation");
-    AnimatedSprite2D* spriterAnimatedSprite = spriterNode_->CreateComponent<AnimatedSprite2D>();
+    auto* spriterAnimatedSprite = spriterNode_->CreateComponent<AnimatedSprite2D>();
     spriterAnimatedSprite->SetAnimationSet(spriterAnimationSet);
     spriterAnimatedSprite->SetAnimationSet(spriterAnimationSet);
     spriterAnimatedSprite->SetAnimation(spriterAnimationSet->GetAnimation(spriterAnimationIndex_));
     spriterAnimatedSprite->SetAnimation(spriterAnimationSet->GetAnimation(spriterAnimationIndex_));
 }
 }
 
 
 void Urho2DSpriterAnimation::CreateInstructions()
 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
     // 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->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->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
@@ -115,7 +115,7 @@ void Urho2DSpriterAnimation::CreateInstructions()
 
 
 void Urho2DSpriterAnimation::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -128,7 +128,7 @@ void Urho2DSpriterAnimation::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     const float MOVE_SPEED = 4.0f;
@@ -145,13 +145,13 @@ void Urho2DSpriterAnimation::MoveCamera(float timeStep)
 
 
     if (input->GetKeyDown(KEY_PAGEUP))
     if (input->GetKeyDown(KEY_PAGEUP))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
     }
 
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
     }
 }
 }
@@ -179,7 +179,7 @@ void Urho2DSpriterAnimation::HandleUpdate(StringHash eventType, VariantMap& even
 
 
 void Urho2DSpriterAnimation::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 void Urho2DSpriterAnimation::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
 {
 {
-    AnimatedSprite2D* spriterAnimatedSprite = spriterNode_->GetComponent<AnimatedSprite2D>();
+    auto* spriterAnimatedSprite = spriterNode_->GetComponent<AnimatedSprite2D>();
     AnimationSet2D* spriterAnimationSet = spriterAnimatedSprite->GetAnimationSet();
     AnimationSet2D* spriterAnimationSet = spriterAnimatedSprite->GetAnimationSet();
     spriterAnimationIndex_ = (spriterAnimationIndex_ + 1) % spriterAnimationSet->GetNumAnimations();
     spriterAnimationIndex_ = (spriterAnimationIndex_ + 1) % spriterAnimationSet->GetNumAnimations();
     spriterAnimatedSprite->SetAnimation(spriterAnimationSet->GetAnimation(spriterAnimationIndex_), LM_FORCE_LOOPED);
     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()
 void DynamicGeometry::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -88,7 +88,7 @@ void DynamicGeometry::CreateScene()
 
 
     // Create a Zone for ambient light & fog control
     // Create a Zone for ambient light & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogStart(200.0f);
     zone->SetFogStart(200.0f);
@@ -97,13 +97,13 @@ void DynamicGeometry::CreateScene()
     // Create a directional light
     // Create a directional light
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(-0.6f, -1.0f, -0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.4f, 1.0f, 0.4f));
     light->SetColor(Color(0.4f, 1.0f, 0.4f));
     light->SetSpecularIntensity(1.5f);
     light->SetSpecularIntensity(1.5f);
 
 
     // Get the original model and its unmodified vertices, which are used as source data for the animation
     // 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)
     if (!originalModel)
     {
     {
         URHO3D_LOGERROR("Model not found, cannot initialize example scene");
         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
     // Get the vertex buffer from the first geometry's first LOD level
     VertexBuffer* buffer = originalModel->GetGeometry(0, 0)->GetVertexBuffer(0);
     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)
     if (vertexData)
     {
     {
         unsigned numVertices = buffer->GetVertexCount();
         unsigned numVertices = buffer->GetVertexCount();
@@ -152,7 +152,7 @@ void DynamicGeometry::CreateScene()
         {
         {
             Node* node = scene_->CreateChild("Object");
             Node* node = scene_->CreateChild("Object");
             node->SetPosition(Vector3(x * 2.0f, 0.0f, y * 2.0f));
             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();
             SharedPtr<Model> cloneModel = originalModel->Clone();
             object->SetModel(cloneModel);
             object->SetModel(cloneModel);
             // Store the cloned vertex buffer that we will modify when animating
             // Store the cloned vertex buffer that we will modify when animating
@@ -258,24 +258,24 @@ void DynamicGeometry::CreateScene()
 
 
         Node* node = scene_->CreateChild("FromScratchObject");
         Node* node = scene_->CreateChild("FromScratchObject");
         node->SetPosition(Vector3(0.0f, 3.0f, 0.0f));
         node->SetPosition(Vector3(0.0f, 3.0f, 0.0f));
-        StaticModel* object = node->CreateComponent<StaticModel>();
+        auto* object = node->CreateComponent<StaticModel>();
         object->SetModel(fromScratchModel);
         object->SetModel(fromScratchModel);
     }
     }
 
 
     // Create the camera
     // Create the camera
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
     cameraNode_->SetPosition(Vector3(0.0f, 2.0f, -20.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 2.0f, -20.0f));
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 }
 }
 
 
 void DynamicGeometry::CreateInstructions()
 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
     // 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(
     instructionText->SetText(
         "Use WASD keys and mouse/touch to move\n"
         "Use WASD keys and mouse/touch to move\n"
         "Space to toggle animation"
         "Space to toggle animation"
@@ -292,7 +292,7 @@ void DynamicGeometry::CreateInstructions()
 
 
 void DynamicGeometry::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -311,7 +311,7 @@ void DynamicGeometry::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     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
         // 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
         // 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)
         if (vertexData)
         {
         {
             unsigned vertexSize = buffer->GetVertexSize();
             unsigned vertexSize = buffer->GetVertexSize();
@@ -381,7 +381,7 @@ void DynamicGeometry::HandleUpdate(StringHash eventType, VariantMap& eventData)
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
 
     // Toggle animation with space
     // Toggle animation with space
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_SPACE))
     if (input->GetKeyPress(KEY_SPACE))
         animate_ = !animate_;
         animate_ = !animate_;
 
 

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

@@ -71,7 +71,7 @@ void SignedDistanceFieldText::Start()
 
 
 void SignedDistanceFieldText::CreateScene()
 void SignedDistanceFieldText::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -86,7 +86,7 @@ void SignedDistanceFieldText::CreateScene()
     // (100 x 100 world units)
     // (100 x 100 world units)
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     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)
     // The light will use default settings (white light, no shadows)
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
 
 
     // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
     // 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");
         Node* mushroomNode = scene_->CreateChild("Mushroom");
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
         mushroomNode->SetScale(0.5f + Random(2.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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
         mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
 
 
         Node* mushroomTitleNode = mushroomNode->CreateChild("MushroomTitle");
         Node* mushroomTitleNode = mushroomNode->CreateChild("MushroomTitle");
         mushroomTitleNode->SetPosition(Vector3(0.0f, 1.2f, 0.0f));
         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->SetText("Mushroom " + String(i));
         mushroomTitleText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
         mushroomTitleText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
 
@@ -149,11 +149,11 @@ void SignedDistanceFieldText::CreateScene()
 
 
 void SignedDistanceFieldText::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -165,7 +165,7 @@ void SignedDistanceFieldText::CreateInstructions()
 
 
 void SignedDistanceFieldText::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     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
     // Set camera's position
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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
     // 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)
     if (!tmxFile)
         return;
         return;
 
 
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
     tileMapNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
     tileMapNode->SetPosition(Vector3(0.0f, 0.0f, -1.0f));
 
 
-    TileMap2D* tileMap = tileMapNode->CreateComponent<TileMap2D>();
+    auto* tileMap = tileMapNode->CreateComponent<TileMap2D>();
     // Set animation
     // Set animation
     tileMap->SetTmxFile(tmxFile);
     tileMap->SetTmxFile(tmxFile);
 
 
@@ -110,11 +110,11 @@ void Urho2DTileMap::CreateScene()
 
 
 void Urho2DTileMap::CreateInstructions()
 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
     // 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->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);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -126,7 +126,7 @@ void Urho2DTileMap::CreateInstructions()
 
 
 void Urho2DTileMap::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -139,7 +139,7 @@ void Urho2DTileMap::MoveCamera(float timeStep)
     if (GetSubsystem<UI>()->GetFocusElement())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 4.0f;
     const float MOVE_SPEED = 4.0f;
@@ -156,13 +156,13 @@ void Urho2DTileMap::MoveCamera(float timeStep)
 
 
     if (input->GetKeyDown(KEY_PAGEUP))
     if (input->GetKeyDown(KEY_PAGEUP))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 1.01f);
         camera->SetZoom(camera->GetZoom() * 1.01f);
     }
     }
 
 
     if (input->GetKeyDown(KEY_PAGEDOWN))
     if (input->GetKeyDown(KEY_PAGEDOWN))
     {
     {
-        Camera* camera = cameraNode_->GetComponent<Camera>();
+        auto* camera = cameraNode_->GetComponent<Camera>();
         camera->SetZoom(camera->GetZoom() * 0.99f);
         camera->SetZoom(camera->GetZoom() * 0.99f);
     }
     }
 }
 }
@@ -192,10 +192,10 @@ void Urho2DTileMap::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 
 void Urho2DTileMap::HandleMouseButtonDown(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);
     Node* tileMapNode = scene_->GetChild("TileMap", true);
-    TileMap2D* map = tileMapNode->GetComponent<TileMap2D>();
+    auto* map = tileMapNode->GetComponent<TileMap2D>();
     TileMapLayer2D* layer = map->GetLayer(0);
     TileMapLayer2D* layer = map->GetLayer(0);
 
 
     Vector2 pos = GetMousePositionXY();
     Vector2 pos = GetMousePositionXY();
@@ -206,7 +206,7 @@ void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& even
         Node* n = layer->GetTileNode(x, y);
         Node* n = layer->GetTileNode(x, y);
         if (!n)
         if (!n)
             return;
             return;
-        StaticSprite2D* sprite = n->GetComponent<StaticSprite2D>();
+        auto* sprite = n->GetComponent<StaticSprite2D>();
 
 
         if (input->GetMouseButtonDown(MOUSEB_RIGHT))
         if (input->GetMouseButtonDown(MOUSEB_RIGHT))
         {
         {
@@ -221,9 +221,9 @@ void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& even
 
 
 Vector2 Urho2DTileMap::GetMousePositionXY()
 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 screenPoint = Vector3((float)input->GetMousePosition().x_ / graphics->GetWidth(), (float)input->GetMousePosition().y_ / graphics->GetHeight(), 10.0f);
     Vector3 worldPoint = camera->ScreenToWorldPoint(screenPoint);
     Vector3 worldPoint = camera->ScreenToWorldPoint(screenPoint);
     return Vector2(worldPoint.x_, worldPoint.y_);
     return Vector2(worldPoint.x_, worldPoint.y_);

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

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

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

@@ -65,7 +65,7 @@ void SceneAndUILoad::Start()
 
 
 void SceneAndUILoad::CreateScene()
 void SceneAndUILoad::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -84,11 +84,11 @@ void SceneAndUILoad::CreateScene()
 
 
 void SceneAndUILoad::CreateUI()
 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
     // 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);
     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
     // 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();
     cursor->SetStyleAuto();
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     // Load UI content prepared in the editor and add to the UI hierarchy
     // Load UI content prepared in the editor and add to the UI hierarchy
@@ -105,7 +105,7 @@ void SceneAndUILoad::CreateUI()
     ui->GetRoot()->AddChild(layoutRoot);
     ui->GetRoot()->AddChild(layoutRoot);
 
 
     // Subscribe to button actions (toggle scene lights when pressed then released)
     // 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)
     if (button)
         SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(SceneAndUILoad, ToggleLight1));
         SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(SceneAndUILoad, ToggleLight1));
     button = layoutRoot->GetChildStaticCast<Button>("ToggleLight2", true);
     button = layoutRoot->GetChildStaticCast<Button>("ToggleLight2", true);
@@ -115,7 +115,7 @@ void SceneAndUILoad::CreateUI()
 
 
 void SceneAndUILoad::SetupViewport()
 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
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
@@ -131,8 +131,8 @@ void SceneAndUILoad::SubscribeToEvents()
 void SceneAndUILoad::MoveCamera(float timeStep)
 void SceneAndUILoad::MoveCamera(float timeStep)
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Do not move if the UI has a focused element
     // 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()
 void CrowdNavigation::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -95,13 +95,13 @@ void CrowdNavigation::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a Zone component for ambient lighting & fog control
     // Create a Zone component for ambient lighting & fog control
     Node* zoneNode = scene_->CreateChild("Zone");
     Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
+    auto* zone = zoneNode->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
     zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
     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
     // Create a directional light to the world. Enable cascaded shadows on it
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
@@ -126,7 +126,7 @@ void CrowdNavigation::CreateScene()
         float size = 1.0f + Random(10.0f);
         float size = 1.0f + Random(10.0f);
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
         boxNode->SetScale(size);
         boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
+        auto* boxObject = boxNode->CreateComponent<StaticModel>();
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         boxObject->SetCastShadows(true);
         boxObject->SetCastShadows(true);
@@ -135,7 +135,7 @@ void CrowdNavigation::CreateScene()
     }
     }
 
 
     // Create a DynamicNavigationMesh component to the scene root
     // 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
     // Set small tiles to show navigation mesh streaming
     navMesh->SetTileSize(32);
     navMesh->SetTileSize(32);
     // Enable drawing debug geometry for obstacles and off-mesh connections
     // 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));
         CreateMushroom(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
 
 
     // Create a CrowdManager component to the scene root
     // Create a CrowdManager component to the scene root
-    CrowdManager* crowdManager = scene_->CreateComponent<CrowdManager>();
+    auto* crowdManager = scene_->CreateComponent<CrowdManager>();
     CrowdObstacleAvoidanceParams params = crowdManager->GetObstacleAvoidanceParams(0);
     CrowdObstacleAvoidanceParams params = crowdManager->GetObstacleAvoidanceParams(0);
     // Set the params to "High (66)" setting
     // Set the params to "High (66)" setting
     params.velBias = 0.5f;
     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
     // 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
     // we want it to be unaffected by scene load / save
     cameraNode_ = new Node(context_);
     cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetFarClip(300.0f);
     camera->SetFarClip(300.0f);
 
 
     // Set an initial position for the camera scene node above the plane and looking down
     // 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()
 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
     // 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
     // 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_));
     SharedPtr<Cursor> cursor(new Cursor(context_));
     cursor->SetStyleAuto(style);
     cursor->SetStyleAuto(style);
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
 
 
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     // Construct new Text object, set string to display and font to use
     // 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(
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
@@ -232,7 +232,7 @@ void CrowdNavigation::CreateUI()
 
 
 void CrowdNavigation::SetupViewport()
 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
     // 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>()));
     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)
 void CrowdNavigation::SpawnJack(const Vector3& pos, Node* jackGroup)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SharedPtr<Node> jackNode(jackGroup->CreateChild("Jack"));
     SharedPtr<Node> jackNode(jackGroup->CreateChild("Jack"));
     jackNode->SetPosition(pos);
     jackNode->SetPosition(pos);
-    AnimatedModel* modelObject = jackNode->CreateComponent<AnimatedModel>();
+    auto* modelObject = jackNode->CreateComponent<AnimatedModel>();
     modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     modelObject->SetCastShadows(true);
     modelObject->SetCastShadows(true);
     jackNode->CreateComponent<AnimationController>();
     jackNode->CreateComponent<AnimationController>();
 
 
     // Create a CrowdAgent component and set its height and realistic max speed/acceleration. Use default radius
     // 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->SetHeight(2.0f);
     agent->SetMaxSpeed(3.0f);
     agent->SetMaxSpeed(3.0f);
     agent->SetMaxAccel(5.0f);
     agent->SetMaxAccel(5.0f);
@@ -278,19 +278,19 @@ void CrowdNavigation::SpawnJack(const Vector3& pos, Node* jackGroup)
 
 
 void CrowdNavigation::CreateMushroom(const Vector3& pos)
 void CrowdNavigation::CreateMushroom(const Vector3& pos)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     Node* mushroomNode = scene_->CreateChild("Mushroom");
     mushroomNode->SetPosition(pos);
     mushroomNode->SetPosition(pos);
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
     mushroomNode->SetScale(2.0f + Random(0.5f));
     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->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
     mushroomObject->SetCastShadows(true);
     mushroomObject->SetCastShadows(true);
 
 
     // Create the navigation Obstacle component and set its height & radius proportional to scale
     // 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->SetRadius(mushroomNode->GetScale().x_);
     obstacle->SetHeight(mushroomNode->GetScale().y_);
     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
         connectionEnd->SetWorldPosition(navMesh->FindNearestPoint(boxPos + Vector3(boxHalfSize, boxHalfSize, 0))); // Top of box
 
 
         // Create the OffMeshConnection component to one node and link the other node
         // 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);
         connection->SetEndPoint(connectionEnd);
     }
     }
 }
 }
 
 
 void CrowdNavigation::CreateMovingBarrels(DynamicNavigationMesh* navMesh)
 void CrowdNavigation::CreateMovingBarrels(DynamicNavigationMesh* navMesh)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* barrel = scene_->CreateChild("Barrel");
     Node* barrel = scene_->CreateChild("Barrel");
-    StaticModel* model = barrel->CreateComponent<StaticModel>();
+    auto* model = barrel->CreateComponent<StaticModel>();
     model->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
     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);
     model->SetMaterial(material);
     material->SetTexture(TU_DIFFUSE, cache->GetResource<Texture2D>("Textures/TerrainDetail2.dds"));
     material->SetTexture(TU_DIFFUSE, cache->GetResource<Texture2D>("Textures/TerrainDetail2.dds"));
     model->SetCastShadows(true);
     model->SetCastShadows(true);
@@ -332,7 +332,7 @@ void CrowdNavigation::CreateMovingBarrels(DynamicNavigationMesh* navMesh)
         float size = 0.5f + Random(1.0f);
         float size = 0.5f + Random(1.0f);
         clone->SetScale(Vector3(size / 1.5f, size * 2.0f, size / 1.5f));
         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)));
         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->SetRadius(clone->GetScale().x_ * 0.5f);
         agent->SetHeight(size);
         agent->SetHeight(size);
         agent->SetNavigationQuality(NAVIGATIONQUALITY_LOW);
         agent->SetNavigationQuality(NAVIGATIONQUALITY_LOW);
@@ -347,7 +347,7 @@ void CrowdNavigation::SetPathPoint(bool spawning)
 
 
     if (Raycast(250.0f, hitPos, hitDrawable))
     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));
         Vector3 pathPos = navMesh->FindNearestPoint(hitPos, Vector3(1.0f, 1.0f, 1.0f));
         Node* jackGroup = scene_->GetChild("Jacks");
         Node* jackGroup = scene_->GetChild("Jacks");
         if (spawning)
         if (spawning)
@@ -383,14 +383,14 @@ bool CrowdNavigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hit
 {
 {
     hitDrawable = nullptr;
     hitDrawable = nullptr;
 
 
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
     IntVector2 pos = ui->GetCursorPosition();
     // Check the cursor is visible and there is no UI element in front of the cursor
     // Check the cursor is visible and there is no UI element in front of the cursor
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
     if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
         return false;
         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());
     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
     // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
     PODVector<RayQueryResult> results;
     PODVector<RayQueryResult> results;
@@ -410,8 +410,8 @@ bool CrowdNavigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hit
 void CrowdNavigation::MoveCamera(float timeStep)
 void CrowdNavigation::MoveCamera(float timeStep)
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Do not move if the UI has a focused element (the console)
     // 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)
 void CrowdNavigation::ToggleStreaming(bool enabled)
 {
 {
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     if (enabled)
     if (enabled)
     {
     {
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
         int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
@@ -504,7 +504,7 @@ void CrowdNavigation::UpdateStreaming()
     }
     }
 
 
     // Compute currently loaded area
     // Compute currently loaded area
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     const IntVector2 jackTile = navMesh->GetTileIndex(averageJackPosition);
     const IntVector2 jackTile = navMesh->GetTileIndex(averageJackPosition);
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
     const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
@@ -538,7 +538,7 @@ void CrowdNavigation::UpdateStreaming()
 
 
 void CrowdNavigation::SaveNavigationData()
 void CrowdNavigation::SaveNavigationData()
 {
 {
-    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    auto* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
     tileData_.Clear();
     tileData_.Clear();
     addedTiles_.Clear();
     addedTiles_.Clear();
     const IntVector2 numTiles = navMesh->GetNumTiles();
     const IntVector2 numTiles = navMesh->GetNumTiles();
@@ -561,7 +561,7 @@ void CrowdNavigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
     MoveCamera(timeStep);
     MoveCamera(timeStep);
 
 
     // Update streaming
     // Update streaming
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     if (input->GetKeyPress(KEY_TAB))
     if (input->GetKeyPress(KEY_TAB))
     {
     {
         useStreaming_ = !useStreaming_;
         useStreaming_ = !useStreaming_;
@@ -587,8 +587,8 @@ void CrowdNavigation::HandleCrowdAgentFailure(StringHash eventType, VariantMap&
 {
 {
     using namespace CrowdAgentFailure;
     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 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)
     if (agentState == CA_STATE_INVALID)
@@ -606,13 +606,13 @@ void CrowdNavigation::HandleCrowdAgentReposition(StringHash eventType, VariantMa
 
 
     using namespace CrowdAgentReposition;
     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();
     Vector3 velocity = eventData[P_VELOCITY].GetVector3();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
 
 
     // Only Jack agent has animation controller
     // Only Jack agent has animation controller
-    AnimationController* animCtrl = node->GetComponent<AnimationController>();
+    auto* animCtrl = node->GetComponent<AnimationController>();
     if (animCtrl)
     if (animCtrl)
     {
     {
         float speed = velocity.Length();
         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
     // The first agent will always move to the exact position, all other agents will select a random point nearby
     if (index)
     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());
         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();
     Sample::Start();
 
 
     // Enable and center OS cursor
     // Enable and center OS cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->SetMouseVisible(true);
     input->CenterMousePosition();
     input->CenterMousePosition();
 
 
@@ -71,7 +71,7 @@ void L10n::Start()
 
 
 void L10n::InitLocalizationSystem()
 void L10n::InitLocalizationSystem()
 {
 {
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
     // JSON files must be in UTF8 encoding without BOM
     // JSON files must be in UTF8 encoding without BOM
     // The first found language will be set as current
     // The first found language will be set as current
     l10n->LoadJSONFile("StringsEnRu.json");
     l10n->LoadJSONFile("StringsEnRu.json");
@@ -84,20 +84,20 @@ void L10n::InitLocalizationSystem()
 void L10n::CreateGUI()
 void L10n::CreateGUI()
 {
 {
     // Get localization subsystem
     // Get localization subsystem
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
 
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     UIElement* root = GetSubsystem<UI>()->GetRoot();
     root->SetDefaultStyle(cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
     root->SetDefaultStyle(cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
 
 
-    Window* window = new Window(context_);
+    auto* window = new Window(context_);
     root->AddChild(window);
     root->AddChild(window);
     window->SetMinSize(384, 192);
     window->SetMinSize(384, 192);
     window->SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6));
     window->SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6));
     window->SetAlignment(HA_CENTER, VA_CENTER);
     window->SetAlignment(HA_CENTER, VA_CENTER);
     window->SetStyleAuto();
     window->SetStyleAuto();
 
 
-    Text* windowTitle = new Text(context_);
+    auto* windowTitle = new Text(context_);
     windowTitle->SetName("WindowTitle");
     windowTitle->SetName("WindowTitle");
     windowTitle->SetStyleAuto();
     windowTitle->SetStyleAuto();
     window->AddChild(windowTitle);
     window->AddChild(windowTitle);
@@ -113,12 +113,12 @@ void L10n::CreateGUI()
 
 
     windowTitle->SetText(localizedString + " (" + String(langIndex) + " " + langName + ")");
     windowTitle->SetText(localizedString + " (" + String(langIndex) + " " + langName + ")");
 
 
-    Button* b = new Button(context_);
+    auto* b = new Button(context_);
     window->AddChild(b);
     window->AddChild(b);
     b->SetStyle("Button");
     b->SetStyle("Button");
     b->SetMinHeight(24);
     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
     // The showing text value will automatically change when language is changed
     t->SetAutoLocalizable(true);
     t->SetAutoLocalizable(true);
     // The text value used as a string identifier in this mode.
     // The text value used as a string identifier in this mode.
@@ -146,13 +146,13 @@ void L10n::CreateGUI()
 void L10n::CreateScene()
 void L10n::CreateScene()
 {
 {
     // Get localization subsystem
     // Get localization subsystem
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
 
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<Octree>();
 
 
-    Zone* zone = scene_->CreateComponent<Zone>();
+    auto* zone = scene_->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));
     zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
     zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
@@ -161,13 +161,13 @@ void L10n::CreateScene()
 
 
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(300.0f, 1.0f, 300.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
+    auto* light = lightNode->CreateComponent<Light>();
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetLightType(LIGHT_DIRECTIONAL);
     light->SetColor(Color(0.8f, 0.8f, 0.8f));
     light->SetColor(Color(0.8f, 0.8f, 0.8f));
 
 
@@ -177,7 +177,7 @@ void L10n::CreateScene()
 
 
     Node* text3DNode = scene_->CreateChild("Text3D");
     Node* text3DNode = scene_->CreateChild("Text3D");
     text3DNode->SetPosition(Vector3(0.0f, 0.1f, 30.0f));
     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.
     // Manually set text in the current language.
     text3D->SetText(l10n->Get("lang"));
     text3D->SetText(l10n->Get("lang"));
@@ -187,7 +187,7 @@ void L10n::CreateScene()
     text3D->SetAlignment(HA_CENTER, VA_BOTTOM);
     text3D->SetAlignment(HA_CENTER, VA_BOTTOM);
     text3DNode->SetScale(15);
     text3DNode->SetScale(15);
 
 
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
     renderer->SetViewport(0, viewport);
     renderer->SetViewport(0, viewport);
 
 
@@ -198,7 +198,7 @@ void L10n::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace Update;
     using namespace Update;
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     const float MOUSE_SENSITIVITY = 0.1f;
     const float MOUSE_SENSITIVITY = 0.1f;
     IntVector2 mouseMove = input->GetMouseMove();
     IntVector2 mouseMove = input->GetMouseMove();
     yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
     yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
@@ -209,7 +209,7 @@ void L10n::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 
 void L10n::HandleChangeLangButtonPressed(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
     // Languages are numbered in the loading order
     int lang = l10n->GetLanguageIndex();
     int lang = l10n->GetLanguageIndex();
     lang++;
     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
 // You can manually change texts, sprites and other aspects of the game when language is changed
 void L10n::HandleChangeLanguage(StringHash eventType, VariantMap& eventData)
 void L10n::HandleChangeLanguage(StringHash eventType, VariantMap& eventData)
 {
 {
-    Localization* l10n = GetSubsystem<Localization>();
+    auto* l10n = GetSubsystem<Localization>();
     UIElement* uiRoot = GetSubsystem<UI>()->GetRoot();
     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() + ")");
     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"));
     buttonText->SetText(l10n->Get("quit"));
 
 
-    Text3D* text3D = scene_->GetChild("Text3D")->GetComponent<Text3D>();
+    auto* text3D = scene_->GetChild("Text3D")->GetComponent<Text3D>();
     text3D->SetText(l10n->Get("lang"));
     text3D->SetText(l10n->Get("lang"));
 
 
     // A text on the button "Press this button" changes automatically
     // 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
     // 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
     // subscriber for the console command event
-    Console* console = GetSubsystem<Console>();
+    auto* console = GetSubsystem<Console>();
     console->SetNumRows((unsigned)(GetSubsystem<Graphics>()->GetHeight() / 16));
     console->SetNumRows((unsigned)(GetSubsystem<Graphics>()->GetHeight() / 16));
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetNumBufferedRows(2 * console->GetNumRows());
     console->SetCommandInterpreter(GetTypeName());
     console->SetCommandInterpreter(GetTypeName());
@@ -182,7 +182,7 @@ void DatabaseDemo::HandleInput(const String& input)
             else if (setting == "connstr")
             else if (setting == "connstr")
             {
             {
                 String newConnectionString(input.Substring(input.Find(" ", input.Find("connstr")) + 1));
                 String newConnectionString(input.Substring(input.Find(" ", input.Find("connstr")) + 1));
-                Database* database = GetSubsystem<Database>();
+                auto* database = GetSubsystem<Database>();
                 DbConnection* newConnection = database->Connect(newConnectionString);
                 DbConnection* newConnection = database->Connect(newConnectionString);
                 if (newConnection)
                 if (newConnection)
                 {
                 {

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

@@ -76,11 +76,11 @@ void PBRMaterials::Start()
 
 
 void PBRMaterials::CreateInstructions()
 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
     // 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"
     instructionText->SetText("Use sliders to change Roughness and Metallic\n"
         "Hold RMB and use WASD keys and mouse to move");
         "Hold RMB and use WASD keys and mouse to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
@@ -94,7 +94,7 @@ void PBRMaterials::CreateInstructions()
 
 
 void PBRMaterials::CreateScene()
 void PBRMaterials::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
 #ifdef URHO3D_ANGELSCRIPT
 #ifdef URHO3D_ANGELSCRIPT
     // The scene uses an AngelScript component for animation. Instantiate the subsystem if possible
     // The scene uses an AngelScript component for animation. Instantiate the subsystem if possible
@@ -109,7 +109,7 @@ void PBRMaterials::CreateScene()
     scene_->LoadXML(*file);
     scene_->LoadXML(*file);
 
 
     Node* sphereWithDynamicMatNode = scene_->GetChild("SphereWithDynamicMat");
     Node* sphereWithDynamicMatNode = scene_->GetChild("SphereWithDynamicMat");
-    StaticModel* staticModel = sphereWithDynamicMatNode->GetComponent<StaticModel>();
+    auto* staticModel = sphereWithDynamicMatNode->GetComponent<StaticModel>();
     dynamicMaterial_ = staticModel->GetMaterial(0);
     dynamicMaterial_ = staticModel->GetMaterial(0);
 
 
     Node* zoneNode = scene_->GetChild("Zone");
     Node* zoneNode = scene_->GetChild("Zone");
@@ -127,11 +127,11 @@ void PBRMaterials::CreateScene()
 
 
 void PBRMaterials::CreateUI()
 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
     // 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);
     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
     // 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();
     cursor->SetStyleAuto();
     ui->SetCursor(cursor);
     ui->SetCursor(cursor);
     // Set starting position of the cursor at the rendering window center
     // 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);
     cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
 
 
     roughnessLabel_ = ui->GetRoot()->CreateChild<Text>();
     roughnessLabel_ = ui->GetRoot()->CreateChild<Text>();
@@ -158,7 +158,7 @@ void PBRMaterials::CreateUI()
     ambientLabel_->SetPosition(370, 150);
     ambientLabel_->SetPosition(370, 150);
     ambientLabel_->SetTextEffect(TE_SHADOW);
     ambientLabel_->SetTextEffect(TE_SHADOW);
 
 
-    Slider* roughnessSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* roughnessSlider = ui->GetRoot()->CreateChild<Slider>();
     roughnessSlider->SetStyleAuto();
     roughnessSlider->SetStyleAuto();
     roughnessSlider->SetPosition(50, 50);
     roughnessSlider->SetPosition(50, 50);
     roughnessSlider->SetSize(300, 20);
     roughnessSlider->SetSize(300, 20);
@@ -166,7 +166,7 @@ void PBRMaterials::CreateUI()
     SubscribeToEvent(roughnessSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleRoughnessSliderChanged));
     SubscribeToEvent(roughnessSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleRoughnessSliderChanged));
     roughnessSlider->SetValue(0.5f);
     roughnessSlider->SetValue(0.5f);
 
 
-    Slider* metallicSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* metallicSlider = ui->GetRoot()->CreateChild<Slider>();
     metallicSlider->SetStyleAuto();
     metallicSlider->SetStyleAuto();
     metallicSlider->SetPosition(50, 100);
     metallicSlider->SetPosition(50, 100);
     metallicSlider->SetSize(300, 20);
     metallicSlider->SetSize(300, 20);
@@ -174,7 +174,7 @@ void PBRMaterials::CreateUI()
     SubscribeToEvent(metallicSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleMetallicSliderChanged));
     SubscribeToEvent(metallicSlider, E_SLIDERCHANGED, URHO3D_HANDLER(PBRMaterials, HandleMetallicSliderChanged));
     metallicSlider->SetValue(0.5f);
     metallicSlider->SetValue(0.5f);
 
 
-    Slider* ambientSlider = ui->GetRoot()->CreateChild<Slider>();
+    auto* ambientSlider = ui->GetRoot()->CreateChild<Slider>();
     ambientSlider->SetStyleAuto();
     ambientSlider->SetStyleAuto();
     ambientSlider->SetPosition(50, 150);
     ambientSlider->SetPosition(50, 150);
     ambientSlider->SetSize(300, 20);
     ambientSlider->SetSize(300, 20);
@@ -207,8 +207,8 @@ void PBRMaterials::HandleAmbientSliderChanged(StringHash eventType, VariantMap&
 
 
 void PBRMaterials::SetupViewport()
 void PBRMaterials::SetupViewport()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* renderer = GetSubsystem<Renderer>();
 
 
     renderer->SetHDRRendering(true);
     renderer->SetHDRRendering(true);
 
 
@@ -235,8 +235,8 @@ void PBRMaterials::SubscribeToEvents()
 void PBRMaterials::MoveCamera(float timeStep)
 void PBRMaterials::MoveCamera(float timeStep)
 {
 {
     // Right mouse button controls mouse cursor visibility: hide when pressed
     // 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));
     ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
 
 
     // Do not move if the UI has a focused element
     // 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()
 void HttpRequestDemo::CreateUI()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     // Construct new Text object
     // Construct new Text object
     text_ = new Text(context_);
     text_ = new Text(context_);
@@ -82,7 +82,7 @@ void HttpRequestDemo::SubscribeToEvents()
 
 
 void HttpRequestDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 void HttpRequestDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
 {
-    Network* network = GetSubsystem<Network>();
+    auto* network = GetSubsystem<Network>();
 
 
     if (httpRequest_.Null())
     if (httpRequest_.Null())
         httpRequest_ = network->MakeHttpRequest("http://httpbin.org/ip");
         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()
 void RibbonTrailDemo::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -85,14 +85,14 @@ void RibbonTrailDemo::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     Node* planeNode = scene_->CreateChild("Plane");
     Node* planeNode = scene_->CreateChild("Plane");
     planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Create a directional light to the world.
     // Create a directional light to the world.
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00005f, 0.5f));
     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.
     // Create first box for face camera trail demo with 1 column.
     boxNode1_ = scene_->CreateChild("Box1");
     boxNode1_ = scene_->CreateChild("Box1");
-    StaticModel* box1 = boxNode1_->CreateComponent<StaticModel>();
+    auto* box1 = boxNode1_->CreateComponent<StaticModel>();
     box1->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box1->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box1->SetCastShadows(true);
     box1->SetCastShadows(true);
-    RibbonTrail* boxTrail1 = boxNode1_->CreateComponent<RibbonTrail>();
+    auto* boxTrail1 = boxNode1_->CreateComponent<RibbonTrail>();
     boxTrail1->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail1->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail1->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail1->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail1->SetEndColor(Color(1.0f, 1.0f, 0.0f, 0.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.
     // Create second box for face camera trail demo with 4 column.
     // This will produce less distortion than first trail.
     // This will produce less distortion than first trail.
     boxNode2_ = scene_->CreateChild("Box2");
     boxNode2_ = scene_->CreateChild("Box2");
-    StaticModel* box2 = boxNode2_->CreateComponent<StaticModel>();
+    auto* box2 = boxNode2_->CreateComponent<StaticModel>();
     box2->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box2->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     box2->SetCastShadows(true);
     box2->SetCastShadows(true);
-    RibbonTrail* boxTrail2 = boxNode2_->CreateComponent<RibbonTrail>();
+    auto* boxTrail2 = boxNode2_->CreateComponent<RibbonTrail>();
     boxTrail2->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail2->SetMaterial(cache->GetResource<Material>("Materials/RibbonTrail.xml"));
     boxTrail2->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail2->SetStartColor(Color(1.0f, 0.5f, 0.0f, 1.0f));
     boxTrail2->SetEndColor(Color(1.0f, 1.0f, 0.0f, 0.0f));
     boxTrail2->SetEndColor(Color(1.0f, 1.0f, 0.0f, 0.0f));
@@ -129,7 +129,7 @@ void RibbonTrailDemo::CreateScene()
     Node* ninjaNode = scene_->CreateChild("Ninja");
     Node* ninjaNode = scene_->CreateChild("Ninja");
     ninjaNode->SetPosition(Vector3(5.0f, 0.0f, 0.0f));
     ninjaNode->SetPosition(Vector3(5.0f, 0.0f, 0.0f));
     ninjaNode->SetRotation(Quaternion(0.0f, 180.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->SetModel(cache->GetResource<Model>("Models/NinjaSnowWar/Ninja.mdl"));
     ninja->SetMaterial(cache->GetResource<Material>("Materials/NinjaSnowWar/Ninja.xml"));
     ninja->SetMaterial(cache->GetResource<Material>("Materials/NinjaSnowWar/Ninja.xml"));
     ninja->SetCastShadows(true);
     ninja->SetCastShadows(true);
@@ -154,19 +154,19 @@ void RibbonTrailDemo::CreateScene()
     // Add floating text for info.
     // Add floating text for info.
     Node* boxTextNode1 = scene_->CreateChild("BoxText1");
     Node* boxTextNode1 = scene_->CreateChild("BoxText1");
     boxTextNode1->SetPosition(Vector3(-1.0f, 2.0f, 0.0f));
     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->SetText(String("Face Camera Trail (4 Column)"));
     boxText1->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
     boxText1->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
 
     Node* boxTextNode2 = scene_->CreateChild("BoxText2");
     Node* boxTextNode2 = scene_->CreateChild("BoxText2");
     boxTextNode2->SetPosition(Vector3(-6.0f, 2.0f, 0.0f));
     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->SetText(String("Face Camera Trail (1 Column)"));
     boxText2->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
     boxText2->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
 
     Node* ninjaTextNode2 = scene_->CreateChild("NinjaText");
     Node* ninjaTextNode2 = scene_->CreateChild("NinjaText");
     ninjaTextNode2->SetPosition(Vector3(4.0f, 2.5f, 0.0f));
     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->SetText(String("Bone Trail (4 Column)"));
     ninjaText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
     ninjaText->SetFont(cache->GetResource<Font>("Fonts/BlueHighway.sdf"), 24);
 
 
@@ -180,11 +180,11 @@ void RibbonTrailDemo::CreateScene()
 
 
 void RibbonTrailDemo::CreateInstructions()
 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
     // 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->SetText("Use WASD keys and mouse/touch to move");
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -196,7 +196,7 @@ void RibbonTrailDemo::CreateInstructions()
 
 
 void RibbonTrailDemo::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Movement speed as world units per second
     // Movement speed as world units per second
     const float MOVE_SPEED = 20.0f;
     const float MOVE_SPEED = 20.0f;

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

@@ -81,7 +81,7 @@ void InverseKinematics::Start()
 
 
 void InverseKinematics::CreateScene()
 void InverseKinematics::CreateScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
 
 
@@ -93,19 +93,19 @@ void InverseKinematics::CreateScene()
     // Create scene node & StaticModel component for showing a static plane
     // Create scene node & StaticModel component for showing a static plane
     floorNode_ = scene_->CreateChild("Plane");
     floorNode_ = scene_->CreateChild("Plane");
     floorNode_->SetScale(Vector3(50.0f, 1.0f, 50.0f));
     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->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
     planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
 
 
     // Set up collision, we need to raycast to determine foot height
     // Set up collision, we need to raycast to determine foot height
     floorNode_->CreateComponent<RigidBody>();
     floorNode_->CreateComponent<RigidBody>();
-    CollisionShape* col = floorNode_->CreateComponent<CollisionShape>();
+    auto* col = floorNode_->CreateComponent<CollisionShape>();
     col->SetBox(Vector3(1, 0, 1));
     col->SetBox(Vector3(1, 0, 1));
 
 
     // Create a directional light to the world.
     // Create a directional light to the world.
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     Node* lightNode = scene_->CreateChild("DirectionalLight");
     lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
     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->SetLightType(LIGHT_DIRECTIONAL);
     light->SetCastShadows(true);
     light->SetCastShadows(true);
     light->SetShadowBias(BiasParameters(0.00005f, 0.5f));
     light->SetShadowBias(BiasParameters(0.00005f, 0.5f));
@@ -115,7 +115,7 @@ void InverseKinematics::CreateScene()
     // Load Jack model
     // Load Jack model
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_ = scene_->CreateChild("Jack");
     jackNode_->SetRotation(Quaternion(0.0f, 270.0f, 0.0f));
     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->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
     jack->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     jack->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
     jack->SetCastShadows(true);
     jack->SetCastShadows(true);
@@ -167,11 +167,11 @@ void InverseKinematics::CreateScene()
 
 
 void InverseKinematics::CreateInstructions()
 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
     // 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->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);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
 
 
@@ -183,7 +183,7 @@ void InverseKinematics::CreateInstructions()
 
 
 void InverseKinematics::SetupViewport()
 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
     // 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
     // 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())
     if (GetSubsystem<UI>()->GetFocusElement())
         return;
         return;
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Mouse sensitivity as degrees per pixel
     // Mouse sensitivity as degrees per pixel
     const float MOUSE_SENSITIVITY = 0.1f;
     const float MOUSE_SENSITIVITY = 0.1f;
@@ -267,7 +267,7 @@ void InverseKinematics::HandlePostRenderUpdate(StringHash /*eventType*/, Variant
 
 
 void InverseKinematics::HandleSceneDrawableUpdateFinished(StringHash /*eventType*/, VariantMap& eventData)
 void InverseKinematics::HandleSceneDrawableUpdateFinished(StringHash /*eventType*/, VariantMap& eventData)
 {
 {
-    PhysicsWorld* phyWorld = scene_->GetComponent<PhysicsWorld>();
+    auto* phyWorld = scene_->GetComponent<PhysicsWorld>();
     Vector3 leftFootPosition = leftFoot_->GetWorldPosition();
     Vector3 leftFootPosition = leftFoot_->GetWorldPosition();
     Vector3 rightFootPosition = rightFoot_->GetWorldPosition();
     Vector3 rightFootPosition = rightFoot_->GetWorldPosition();
 
 

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

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

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

@@ -58,18 +58,18 @@ Vehicle::~Vehicle()
 
 
 void Vehicle::Init()
 void Vehicle::Init()
 {
 {
-    RaycastVehicle* vehicle = node_->CreateComponent<RaycastVehicle>();
+    auto* vehicle = node_->CreateComponent<RaycastVehicle>();
     vehicle->Init();
     vehicle->Init();
-    RigidBody* hullBody = node_->GetComponent<RigidBody>();
+    auto* hullBody = node_->GetComponent<RigidBody>();
     hullBody->SetMass(800.0f);
     hullBody->SetMass(800.0f);
     hullBody->SetLinearDamping(0.2f); // Some air resistance
     hullBody->SetLinearDamping(0.2f); // Some air resistance
     hullBody->SetAngularDamping(0.5f);
     hullBody->SetAngularDamping(0.5f);
     hullBody->SetCollisionLayer(1);
     hullBody->SetCollisionLayer(1);
     // This function is called only from the main program when initially creating the vehicle, not on scene load
     // 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
     // Setting-up collision shape
-    CollisionShape* hullColShape = node_->CreateComponent<CollisionShape>();
+    auto* hullColShape = node_->CreateComponent<CollisionShape>();
     Vector3 v3BoxExtents = Vector3::ONE;
     Vector3 v3BoxExtents = Vector3::ONE;
     hullColShape->SetBox(v3BoxExtents);
     hullColShape->SetBox(v3BoxExtents);
     node_->SetScale(Vector3(2.3f, 1.0f, 4.0f));
     node_->SetScale(Vector3(2.3f, 1.0f, 4.0f));
@@ -110,7 +110,7 @@ void Vehicle::Init()
         vehicle->SetWheelFrictionSlip(id, wheelFriction_);
         vehicle->SetWheelFrictionSlip(id, wheelFriction_);
         vehicle->SetWheelRollInfluence(id, rollInfluence_);
         vehicle->SetWheelRollInfluence(id, rollInfluence_);
         wheelNode->SetScale(Vector3(1.0f, 0.65f, 1.0f));
         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->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
         pWheel->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         pWheel->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
         pWheel->SetCastShadows(true);
         pWheel->SetCastShadows(true);
@@ -122,10 +122,10 @@ void Vehicle::Init()
 
 
 void Vehicle::CreateEmitter(Vector3 place)
 void Vehicle::CreateEmitter(Vector3 place)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* emitter = GetScene()->CreateChild();
     Node* emitter = GetScene()->CreateChild();
     emitter->SetWorldPosition(node_->GetWorldPosition() + node_->GetWorldRotation() * place + Vector3(0, -wheelRadius_, 0));
     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->SetEffect(cache->GetResource<ParticleEffect>("Particle/Dust.xml"));
     particleEmitter->SetEmitting(false);
     particleEmitter->SetEmitting(false);
     particleEmitterNodeList_.Push(emitter);
     particleEmitterNodeList_.Push(emitter);
@@ -135,7 +135,7 @@ void Vehicle::CreateEmitter(Vector3 place)
 /// Applying attributes
 /// Applying attributes
 void Vehicle::ApplyAttributes()
 void Vehicle::ApplyAttributes()
 {
 {
-    RaycastVehicle* vehicle = node_->GetOrCreateComponent<RaycastVehicle>();
+    auto* vehicle = node_->GetOrCreateComponent<RaycastVehicle>();
     if (emittersCreated)
     if (emittersCreated)
         return;
         return;
     for (int i = 0; i < 4; i++)
     for (int i = 0; i < 4; i++)
@@ -150,7 +150,7 @@ void Vehicle::FixedUpdate(float timeStep)
     float newSteering = 0.0f;
     float newSteering = 0.0f;
     float accelerator = 0.0f;
     float accelerator = 0.0f;
     bool brake = false;
     bool brake = false;
-    RaycastVehicle* vehicle = node_->GetComponent<RaycastVehicle>();
+    auto* vehicle = node_->GetComponent<RaycastVehicle>();
     // Read controls
     // Read controls
     if (controls_.buttons_ & CTRL_LEFT)
     if (controls_.buttons_ & CTRL_LEFT)
     {
     {
@@ -207,16 +207,16 @@ void Vehicle::FixedUpdate(float timeStep)
 
 
 void Vehicle::PostUpdate(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 velocity = vehicleBody->GetLinearVelocity();
     Vector3 accel = (velocity - prevVelocity_) / timeStep;
     Vector3 accel = (velocity - prevVelocity_) / timeStep;
     float planeAccel = Vector3(accel.x_, 0.0f, accel.z_).Length();
     float planeAccel = Vector3(accel.x_, 0.0f, accel.z_).Length();
     for (int i = 0; i < vehicle->GetNumWheels(); i++)
     for (int i = 0; i < vehicle->GetNumWheels(); i++)
     {
     {
         Node* emitter = particleEmitterNodeList_[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))
             planeAccel > 15.0f))
         {
         {
             particleEmitterNodeList_[i]->SetWorldPosition(vehicle->GetContactPosition(i));
             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);
     GetSubsystem<Input>()->SetMouseVisible(true);
 
 
     // Load XML file containing default UI style sheet
     // 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
     // Set the loaded style as default style
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     UIElement* root = ui->GetRoot();
     UIElement* root = ui->GetRoot();
     root->SetDefaultStyle(style);
     root->SetDefaultStyle(style);
 
 
@@ -143,8 +143,8 @@ void Typography::CreateText()
     container->SetLayout(LM_VERTICAL);
     container->SetLayout(LM_VERTICAL);
     uielement_->AddChild(container);
     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)
     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)
 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();
     bool checked = box->IsChecked();
 
 
     Color fg = checked ? Color::BLACK : Color::WHITE;
     Color fg = checked ? Color::BLACK : Color::WHITE;
     Color bg = checked ? Color::WHITE : Color::BLACK;
     Color bg = checked ? Color::WHITE : Color::BLACK;
 
 
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     Zone* zone = renderer->GetDefaultZone();
     Zone* zone = renderer->GetDefaultZone();
     zone->SetFogColor(bg);
     zone->SetFogColor(bg);
 
 
@@ -231,17 +231,17 @@ void Typography::HandleWhiteBackground(StringHash eventType, VariantMap& eventDa
 
 
 void Typography::HandleForceAutoHint(StringHash eventType, VariantMap& eventData)
 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();
     bool checked = box->IsChecked();
     GetSubsystem<UI>()->SetForceAutoHint(checked);
     GetSubsystem<UI>()->SetForceAutoHint(checked);
 }
 }
 
 
 void Typography::HandleSRGB(StringHash eventType, VariantMap& eventData)
 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();
     bool checked = box->IsChecked();
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (graphics->GetSRGBWriteSupport())
     if (graphics->GetSRGBWriteSupport())
     {
     {
         graphics->SetSRGB(checked);
         graphics->SetSRGB(checked);
@@ -257,21 +257,21 @@ void Typography::HandleSRGB(StringHash eventType, VariantMap& eventData)
 
 
 void Typography::HandleFontHintLevel(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();
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontHintLevel((FontHintLevel)i);
     GetSubsystem<UI>()->SetFontHintLevel((FontHintLevel)i);
 }
 }
 
 
 void Typography::HandleFontSubpixel(StringHash eventType, VariantMap& eventData)
 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();
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontSubpixelThreshold(i * 3);
     GetSubsystem<UI>()->SetFontSubpixelThreshold(i * 3);
 }
 }
 
 
 void Typography::HandleFontOversampling(StringHash eventType, VariantMap& eventData)
 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();
     unsigned i = list->GetSelection();
     GetSubsystem<UI>()->SetFontOversampling(i + 1);
     GetSubsystem<UI>()->SetFontOversampling(i + 1);
 }
 }

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

@@ -67,8 +67,8 @@ void Hello3DUI::Start()
     GetSubsystem<Input>()->SetMouseVisible(true);
     GetSubsystem<Input>()->SetMouseVisible(true);
 
 
     // Load XML file containing default UI style sheet
     // 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
     // Set the loaded style as default style
     uiRoot_->SetDefaultStyle(style);
     uiRoot_->SetDefaultStyle(style);
@@ -95,16 +95,16 @@ void Hello3DUI::Start()
 void Hello3DUI::InitControls()
 void Hello3DUI::InitControls()
 {
 {
     // Create a CheckBox
     // Create a CheckBox
-    CheckBox* checkBox = new CheckBox(context_);
+    auto* checkBox = new CheckBox(context_);
     checkBox->SetName("CheckBox");
     checkBox->SetName("CheckBox");
 
 
     // Create a Button
     // Create a Button
-    Button* button = new Button(context_);
+    auto* button = new Button(context_);
     button->SetName("Button");
     button->SetName("Button");
     button->SetMinHeight(24);
     button->SetMinHeight(24);
 
 
     // Create a LineEdit
     // Create a LineEdit
-    LineEdit* lineEdit = new LineEdit(context_);
+    auto* lineEdit = new LineEdit(context_);
     lineEdit->SetName("LineEdit");
     lineEdit->SetName("LineEdit");
     lineEdit->SetMinHeight(24);
     lineEdit->SetMinHeight(24);
 
 
@@ -138,18 +138,18 @@ void Hello3DUI::InitWindow()
     window_->SetName("Window");
     window_->SetName("Window");
 
 
     // Create Window 'titlebar' container
     // Create Window 'titlebar' container
-    UIElement* titleBar = new UIElement(context_);
+    auto* titleBar = new UIElement(context_);
     titleBar->SetMinSize(0, 24);
     titleBar->SetMinSize(0, 24);
     titleBar->SetVerticalAlignment(VA_TOP);
     titleBar->SetVerticalAlignment(VA_TOP);
     titleBar->SetLayoutMode(LM_HORIZONTAL);
     titleBar->SetLayoutMode(LM_HORIZONTAL);
 
 
     // Create the Window title Text
     // Create the Window title Text
-    Text* windowTitle = new Text(context_);
+    auto* windowTitle = new Text(context_);
     windowTitle->SetName("WindowTitle");
     windowTitle->SetName("WindowTitle");
     windowTitle->SetText("Hello GUI!");
     windowTitle->SetText("Hello GUI!");
 
 
     // Create the Window's close button
     // Create the Window's close button
-    Button* buttonClose = new Button(context_);
+    auto* buttonClose = new Button(context_);
     buttonClose->SetName("CloseButton");
     buttonClose->SetName("CloseButton");
 
 
     // Add the controls to the title bar
     // Add the controls to the title bar
@@ -160,14 +160,14 @@ void Hello3DUI::InitWindow()
     window_->AddChild(titleBar);
     window_->AddChild(titleBar);
 
 
     // Create a list.
     // Create a list.
-    ListView* list = window_->CreateChild<ListView>();
+    auto* list = window_->CreateChild<ListView>();
     list->SetSelectOnClickEnd(true);
     list->SetSelectOnClickEnd(true);
     list->SetHighlightMode(HM_ALWAYS);
     list->SetHighlightMode(HM_ALWAYS);
     list->SetMinHeight(200);
     list->SetMinHeight(200);
 
 
     for (int i = 0; i < 32; i++)
     for (int i = 0; i < 32; i++)
     {
     {
-        Text* text = new Text(context_);
+        auto* text = new Text(context_);
         text->SetStyleAuto();
         text->SetStyleAuto();
         text->SetText(ToString("List item %d", i));
         text->SetText(ToString("List item %d", i));
         text->SetName(ToString("Item %d", i));
         text->SetName(ToString("Item %d", i));
@@ -189,11 +189,11 @@ void Hello3DUI::InitWindow()
 
 
 void Hello3DUI::InitScene()
 void Hello3DUI::InitScene()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     scene_ = new Scene(context_);
     scene_ = new Scene(context_);
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<Octree>();
-    Zone* zone = scene_->CreateComponent<Zone>();
+    auto* zone = scene_->CreateComponent<Zone>();
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
     zone->SetFogColor(Color::GRAY);
     zone->SetFogColor(Color::GRAY);
     zone->SetFogStart(100.0f);
     zone->SetFogStart(100.0f);
@@ -205,7 +205,7 @@ void Hello3DUI::InitScene()
     boxNode->SetRotation(Quaternion(90, Vector3::LEFT));
     boxNode->SetRotation(Quaternion(90, Vector3::LEFT));
 
 
     // Create a box model and hide it initially.
     // 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"));
     boxModel->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
     boxNode->SetEnabled(false);
     boxNode->SetEnabled(false);
 
 
@@ -217,7 +217,7 @@ void Hello3DUI::InitScene()
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
     cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
 
 
     // Set up a viewport so 3D scene can be visible.
     // 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>()));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
     renderer->SetViewport(0, viewport);
     renderer->SetViewport(0, viewport);
 
 
@@ -227,11 +227,11 @@ void Hello3DUI::InitScene()
 
 
 void Hello3DUI::CreateDraggableFish()
 void Hello3DUI::CreateDraggableFish()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* cache = GetSubsystem<ResourceCache>();
+    auto* graphics = GetSubsystem<Graphics>();
 
 
     // Create a draggable Fish button
     // 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->SetTexture(cache->GetResource<Texture2D>("Textures/UrhoDecal.dds")); // Set texture
     draggableFish->SetBlendMode(BLEND_ADD);
     draggableFish->SetBlendMode(BLEND_ADD);
     draggableFish->SetSize(128, 128);
     draggableFish->SetSize(128, 128);
@@ -240,13 +240,13 @@ void Hello3DUI::CreateDraggableFish()
     uiRoot_->AddChild(draggableFish);
     uiRoot_->AddChild(draggableFish);
 
 
     // Add a tooltip to Fish button
     // Add a tooltip to Fish button
-    ToolTip* toolTip = new ToolTip(context_);
+    auto* toolTip = new ToolTip(context_);
     draggableFish->AddChild(toolTip);
     draggableFish->AddChild(toolTip);
     toolTip->SetPosition(IntVector2(draggableFish->GetWidth() + 5, draggableFish->GetWidth() / 2)); // slightly offset from close button
     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);
     toolTip->AddChild(textHolder);
     textHolder->SetStyle("ToolTipBorderImage");
     textHolder->SetStyle("ToolTipBorderImage");
-    Text* toolTipText = new Text(context_);
+    auto* toolTipText = new Text(context_);
     textHolder->AddChild(toolTipText);
     textHolder->AddChild(toolTipText);
     toolTipText->SetStyle("ToolTipText");
     toolTipText->SetStyle("ToolTipText");
     toolTipText->SetText("Please drag me!");
     toolTipText->SetText("Please drag me!");
@@ -284,10 +284,10 @@ void Hello3DUI::HandleClosePressed(StringHash eventType, VariantMap& eventData)
 void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
 void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
 {
 {
     // Get the Text control acting as the Window's title
     // 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
     // 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 = "...?";
     String name = "...?";
     if (clicked)
     if (clicked)
@@ -302,12 +302,12 @@ void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData
 
 
 void Hello3DUI::Init3DUI()
 void Hello3DUI::Init3DUI()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     // Node that will get UI rendered on it.
     // Node that will get UI rendered on it.
     Node* boxNode = scene_->GetChild("Box");
     Node* boxNode = scene_->GetChild("Box");
     // Create a component that sets up UI rendering. It sets material to StaticModel of the node.
     // 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.
     // Optionally modify material. Technique is changed so object is visible without any lights.
     component->GetMaterial()->SetTechnique(0, cache->GetResource<Technique>("Techniques/DiffUnlit.xml"));
     component->GetMaterial()->SetTechnique(0, cache->GetResource<Technique>("Techniques/DiffUnlit.xml"));
     // Save root element of texture UI for later use.
     // Save root element of texture UI for later use.
@@ -320,7 +320,7 @@ void Hello3DUI::HandleUpdate(StringHash, VariantMap& eventData)
 {
 {
     using namespace Update;
     using namespace Update;
     float timeStep = eventData[P_TIMESTEP].GetFloat();
     float timeStep = eventData[P_TIMESTEP].GetFloat();
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     Node* node = scene_->GetChild("Box");
     Node* node = scene_->GetChild("Box");
 
 
     if (current_.NotNull() && drawDebug_)
     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
     // Handle wounded/killed states
     if (killed_)
     if (killed_)
         return;
         return;
-    
+
     if (wounded_)
     if (wounded_)
     {
     {
         HandleWoundedState(timeStep);
         HandleWoundedState(timeStep);
         return;
         return;
     }
     }
 
 
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
-    Input* input = GetSubsystem<Input>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Set direction
     // Set direction
     Vector3 moveDir = Vector3::ZERO; // Reset
     Vector3 moveDir = Vector3::ZERO; // Reset
@@ -125,45 +125,45 @@ void Character2D::Update(float timeStep)
 
 
 void Character2D::HandleWoundedState(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
     // Play "hit" animation in loop
     if (animatedSprite->GetAnimation() != "hit")
     if (animatedSprite->GetAnimation() != "hit")
         animatedSprite->SetAnimation("hit", LM_FORCE_LOOPED);
         animatedSprite->SetAnimation("hit", LM_FORCE_LOOPED);
-    
+
     // Update timer
     // Update timer
     timer_ += timeStep;
     timer_ += timeStep;
-    
+
     if (timer_ > 2.0f)
     if (timer_ > 2.0f)
     {
     {
         // Reset timer
         // Reset timer
         timer_ = 0.0f;
         timer_ = 0.0f;
-        
+
         // Clear forces (should be performed by setting linear velocity to zero, but currently doesn't work)
         // Clear forces (should be performed by setting linear velocity to zero, but currently doesn't work)
         body->SetLinearVelocity(Vector2::ZERO);
         body->SetLinearVelocity(Vector2::ZERO);
         body->SetAwake(false);
         body->SetAwake(false);
         body->SetAwake(true);
         body->SetAwake(true);
-        
+
         // Remove particle emitter
         // Remove particle emitter
         node_->GetChild("Emitter", true)->Remove();
         node_->GetChild("Emitter", true)->Remove();
-        
+
         // Update lifes UI and counter
         // Update lifes UI and counter
         remainingLifes_ -= 1;
         remainingLifes_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
-        
+
         // Reset wounded state
         // Reset wounded state
         wounded_ = false;
         wounded_ = false;
-        
+
         // Handle death
         // Handle death
         if (remainingLifes_ == 0)
         if (remainingLifes_ == 0)
         {
         {
             HandleDeath();
             HandleDeath();
             return;
             return;
         }
         }
-        
+
         // Re-position the character to the nearest point
         // Re-position the character to the nearest point
         if (node_->GetPosition().x_ < 15.0f)
         if (node_->GetPosition().x_ < 15.0f)
             node_->SetPosition(Vector3(-5.0f, 11.0f, 0.0f));
             node_->SetPosition(Vector3(-5.0f, 11.0f, 0.0f));
@@ -174,27 +174,27 @@ void Character2D::HandleWoundedState(float timeStep)
 
 
 void Character2D::HandleDeath()
 void Character2D::HandleDeath()
 {
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
-    
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
+
     // Set state to 'killed'
     // Set state to 'killed'
     killed_ = true;
     killed_ = true;
-    
+
     // Update UI elements
     // Update UI elements
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     instructions->SetText("!!! GAME OVER !!!");
     instructions->SetText("!!! GAME OVER !!!");
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
 
 
     // Show mouse cursor so that we can click
     // Show mouse cursor so that we can click
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->SetMouseVisible(true);
-    
+
     // Put character outside of the scene and magnify him
     // Put character outside of the scene and magnify him
     node_->SetPosition(Vector3(-20.0f, 0.0f, 0.0f));
     node_->SetPosition(Vector3(-20.0f, 0.0f, 0.0f));
     node_->SetScale(1.2f);
     node_->SetScale(1.2f);
-    
+
     // Play death animation once
     // Play death animation once
     if (animatedSprite->GetAnimation() != "dead")
     if (animatedSprite->GetAnimation() != "dead")
         animatedSprite->SetAnimation("dead");
         animatedSprite->SetAnimation("dead");

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

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

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

@@ -85,15 +85,15 @@ void Character2D::Update(float timeStep)
     }
     }
 
 
     // Set temporary variables
     // 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 onGround = false;
     bool jump = false;
     bool jump = false;
 
 
     // Collision detection (AABB query)
     // Collision detection (AABB query)
     Vector2 characterHalfSize = Vector2(0.16f, 0.16f);
     Vector2 characterHalfSize = Vector2(0.16f, 0.16f);
-    PhysicsWorld2D* physicsWorld = GetScene()->GetComponent<PhysicsWorld2D>();
+    auto* physicsWorld = GetScene()->GetComponent<PhysicsWorld2D>();
     PODVector<RigidBody2D*> collidingBodies;
     PODVector<RigidBody2D*> collidingBodies;
     physicsWorld->GetRigidBodies(collidingBodies, Rect(node_->GetWorldPosition2D() - characterHalfSize - Vector2(0.0f, 0.1f), node_->GetWorldPosition2D() + characterHalfSize));
     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)
 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
     // Play "hit" animation in loop
     if (animatedSprite->GetAnimation() != "hit")
     if (animatedSprite->GetAnimation() != "hit")
@@ -186,7 +186,7 @@ void Character2D::HandleWoundedState(float timeStep)
 
 
         // Update lifes UI and counter
         // Update lifes UI and counter
         remainingLifes_ -= 1;
         remainingLifes_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
         lifeText->SetText(String(remainingLifes_)); // Update lifes UI counter
 
 
@@ -210,21 +210,21 @@ void Character2D::HandleWoundedState(float timeStep)
 
 
 void Character2D::HandleDeath()
 void Character2D::HandleDeath()
 {
 {
-    RigidBody2D* body = GetComponent<RigidBody2D>();
-    AnimatedSprite2D* animatedSprite = GetComponent<AnimatedSprite2D>();
+    auto* body = GetComponent<RigidBody2D>();
+    auto* animatedSprite = GetComponent<AnimatedSprite2D>();
 
 
     // Set state to 'killed'
     // Set state to 'killed'
     killed_ = true;
     killed_ = true;
 
 
     // Update UI elements
     // Update UI elements
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
     instructions->SetText("!!! GAME OVER !!!");
     instructions->SetText("!!! GAME OVER !!!");
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("ExitButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
     static_cast<Text*>(ui->GetRoot()->GetChild("PlayButton", true))->SetVisible(true);
 
 
     // Show mouse cursor so that we can click
     // Show mouse cursor so that we can click
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->SetMouseVisible(true);
 
 
     // Put character outside of the scene and magnify him
     // 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
     // Create the UI content
     sample2D_->CreateUIContent("PLATFORMER 2D DEMO", character2D_->remainingLifes_, character2D_->remainingCoins_);
     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));
     Button* playButton = static_cast<Button*>(ui->GetRoot()->GetChild("PlayButton", true));
     SubscribeToEvent(playButton, E_RELEASED, URHO3D_HANDLER(Urho2DPlatformer, HandlePlayButton));
     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
     // Create the Octree, DebugRenderer and PhysicsWorld2D components to the scene
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<Octree>();
     scene_->CreateComponent<DebugRenderer>();
     scene_->CreateComponent<DebugRenderer>();
-    /*PhysicsWorld2D* physicsWorld =*/ scene_->CreateComponent<PhysicsWorld2D>(); 
+    /*PhysicsWorld2D* physicsWorld =*/ scene_->CreateComponent<PhysicsWorld2D>();
 
 
     // Create camera
     // Create camera
     cameraNode_ = scene_->CreateChild("Camera");
     cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
+    auto* camera = cameraNode_->CreateComponent<Camera>();
     camera->SetOrthographic(true);
     camera->SetOrthographic(true);
 
 
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     camera->SetOrthoSize((float)graphics->GetHeight() * PIXEL_SIZE);
     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)
     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
     // Setup the viewport for displaying the scene
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera));
     SharedPtr<Viewport> viewport(new Viewport(context_, scene_, camera));
-    Renderer* renderer = GetSubsystem<Renderer>();
+    auto* renderer = GetSubsystem<Renderer>();
     renderer->SetViewport(0, viewport);
     renderer->SetViewport(0, viewport);
 
 
     // Set background color for the scene
     // Set background color for the scene
@@ -134,9 +134,9 @@ void Urho2DPlatformer::CreateScene()
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
     zone->SetFogColor(Color(0.2f, 0.2f, 0.2f));
 
 
     // Create tile map from tmx file
     // Create tile map from tmx file
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SharedPtr<Node> tileMapNode(scene_->CreateChild("TileMap"));
     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"));
     tileMap->SetTmxFile(cache->GetResource<TmxFile2D>("Urho2D/Tilesets/Ortho.tmx"));
     const TileMapInfo2D& info = tileMap->GetInfo();
     const TileMapInfo2D& info = tileMap->GetInfo();
 
 
@@ -200,7 +200,7 @@ void Urho2DPlatformer::SubscribeToEvents()
 void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& eventData)
 void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& eventData)
 {
 {
     // Get colliding node
     // 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")
     if (hitNode->GetName() == "Imp")
         hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEB].GetPtr());
         hitNode = static_cast<Node*>(eventData[PhysicsBeginContact2D::P_NODEB].GetPtr());
     String nodeName = hitNode->GetName();
     String nodeName = hitNode->GetName();
@@ -214,7 +214,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
         else
         else
         {
         {
             character2D_->isClimbing_ = true;
             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
             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)
             // 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));
             body->SetLinearVelocity(Vector2(0.0f, 0.0f));
@@ -231,7 +231,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     {
     {
         hitNode->Remove();
         hitNode->Remove();
         character2D_->remainingCoins_ -= 1;
         character2D_->remainingCoins_ -= 1;
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         if (character2D_->remainingCoins_ == 0)
         if (character2D_->remainingCoins_ == 0)
         {
         {
             Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
             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
     // Handle interactions with enemies
     if (nodeName == "Enemy" || nodeName == "Orc")
     if (nodeName == "Enemy" || nodeName == "Orc")
     {
     {
-        AnimatedSprite2D* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
+        auto* animatedSprite = character2DNode->GetComponent<AnimatedSprite2D>();
         float deltaX = character2DNode->GetPosition().x_ - hitNode->GetPosition().x_;
         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)
         // 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;
                 character2D_->wounded_ = true;
                 if (nodeName == "Orc")
                 if (nodeName == "Orc")
                 {
                 {
-                    Mover* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
+                    auto* orc = static_cast<Mover*>(hitNode->GetComponent<Mover>());
                     orc->fightTimer_ = 1;
                     orc->fightTimer_ = 1;
                 }
                 }
                 sample2D_->SpawnEffect(character2DNode);
                 sample2D_->SpawnEffect(character2DNode);
@@ -280,7 +280,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     if (nodeName == "Exit" && character2D_->remainingCoins_ == 0)
     if (nodeName == "Exit" && character2D_->remainingCoins_ == 0)
     {
     {
         // Update UI
         // Update UI
-        UI* ui = GetSubsystem<UI>();
+        auto* ui = GetSubsystem<UI>();
         Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
         Text* instructions = static_cast<Text*>(ui->GetRoot()->GetChild("Instructions", true));
         instructions->SetText("!!! WELL DONE !!!");
         instructions->SetText("!!! WELL DONE !!!");
         instructions->SetPosition(IntVector2(0, 0));
         instructions->SetPosition(IntVector2(0, 0));
@@ -292,7 +292,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
     // Handle falling into lava
     // Handle falling into lava
     if (nodeName == "Lava")
     if (nodeName == "Lava")
     {
     {
-        RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+        auto* body = character2DNode->GetComponent<RigidBody2D>();
         body->ApplyForceToCenter(Vector2(0.0f, 1000.0f), true);
         body->ApplyForceToCenter(Vector2(0.0f, 1000.0f), true);
         if (!character2DNode->GetChild("Emitter", true))
         if (!character2DNode->GetChild("Emitter", true))
         {
         {
@@ -310,7 +310,7 @@ void Urho2DPlatformer::HandleCollisionBegin(StringHash eventType, VariantMap& ev
 void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& eventData)
 void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& eventData)
 {
 {
     // Get colliding node
     // 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")
     if (hitNode->GetName() == "Imp")
         hitNode = static_cast<Node*>(eventData[PhysicsEndContact2D::P_NODEB].GetPtr());
         hitNode = static_cast<Node*>(eventData[PhysicsEndContact2D::P_NODEB].GetPtr());
     String nodeName = hitNode->GetName();
     String nodeName = hitNode->GetName();
@@ -324,7 +324,7 @@ void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& even
         else
         else
         {
         {
             character2D_->isClimbing_ = false;
             character2D_->isClimbing_ = false;
-            RigidBody2D* body = character2DNode->GetComponent<RigidBody2D>();
+            auto* body = character2DNode->GetComponent<RigidBody2D>();
             body->SetGravityScale(1.0f); // Restore gravity
             body->SetGravityScale(1.0f); // Restore gravity
         }
         }
     }
     }
@@ -337,7 +337,7 @@ void Urho2DPlatformer::HandleCollisionEnd(StringHash eventType, VariantMap& even
     {
     {
         character2D_->onSlope_ = false;
         character2D_->onSlope_ = false;
         // Clear forces (should be performed by setting linear velocity to zero, but currently doesn't work)
         // 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->SetLinearVelocity(Vector2::ZERO);
         body->SetAwake(false);
         body->SetAwake(false);
         body->SetAwake(true);
         body->SetAwake(true);
@@ -352,7 +352,7 @@ void Urho2DPlatformer::HandleUpdate(StringHash eventType, VariantMap& eventData)
     if (cameraNode_)
     if (cameraNode_)
         sample2D_->Zoom(cameraNode_->GetComponent<Camera>());
         sample2D_->Zoom(cameraNode_->GetComponent<Camera>());
 
 
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
 
 
     // Toggle debug geometry with 'Z' key
     // Toggle debug geometry with 'Z' key
     if (input->GetKeyPress(KEY_Z))
     if (input->GetKeyPress(KEY_Z))
@@ -378,11 +378,11 @@ void Urho2DPlatformer::HandlePostRenderUpdate(StringHash eventType, VariantMap&
 {
 {
     if (drawDebug_)
     if (drawDebug_)
     {
     {
-        PhysicsWorld2D* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
+        auto* physicsWorld = scene_->GetComponent<PhysicsWorld2D>();
         physicsWorld->DrawDebugGeometry();
         physicsWorld->DrawDebugGeometry();
 
 
         Node* tileMapNode = scene_->GetChild("TileMap", true);
         Node* tileMapNode = scene_->GetChild("TileMap", true);
-        TileMap2D* map = tileMapNode->GetComponent<TileMap2D>();
+        auto* map = tileMapNode->GetComponent<TileMap2D>();
         map->DrawDebugGeometry(scene_->GetComponent<DebugRenderer>(), false);
         map->DrawDebugGeometry(scene_->GetComponent<DebugRenderer>(), false);
     }
     }
 }
 }
@@ -411,7 +411,7 @@ void Urho2DPlatformer::ReloadScene(bool reInit)
     }
     }
 
 
     // Update lifes UI
     // Update lifes UI
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
     Text* lifeText = static_cast<Text*>(ui->GetRoot()->GetChild("LifeText", true));
     lifeText->SetText(String(lifes));
     lifeText->SetText(String(lifes));
 
 
@@ -423,7 +423,7 @@ void Urho2DPlatformer::ReloadScene(bool reInit)
 void Urho2DPlatformer::HandlePlayButton(StringHash eventType, VariantMap& eventData)
 void Urho2DPlatformer::HandlePlayButton(StringHash eventType, VariantMap& eventData)
 {
 {
     // Remove fullscreen UI and unfreeze the scene
     // Remove fullscreen UI and unfreeze the scene
-    UI* ui = GetSubsystem<UI>();
+    auto* ui = GetSubsystem<UI>();
     if (static_cast<Text*>(ui->GetRoot()->GetChild("FullUI", true)))
     if (static_cast<Text*>(ui->GetRoot()->GetChild("FullUI", true)))
     {
     {
         ui->GetRoot()->GetChild("FullUI", true)->Remove();
         ui->GetRoot()->GetChild("FullUI", true)->Remove();
@@ -442,6 +442,6 @@ void Urho2DPlatformer::HandlePlayButton(StringHash eventType, VariantMap& eventD
     playButton->SetVisible(false);
     playButton->SetVisible(false);
 
 
     // Hide mouse cursor
     // Hide mouse cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(false);
     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)
     // Handle Orc states (idle/wounded/fighting)
     if (node_->GetName() == "Orc")
     if (node_->GetName() == "Orc")
     {
     {
-        AnimatedSprite2D* animatedSprite = node_->GetComponent<AnimatedSprite2D>();
+        auto* animatedSprite = node_->GetComponent<AnimatedSprite2D>();
         String anim = "run";
         String anim = "run";
 
 
         // Handle wounded state
         // 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)
 void Sample2D::CreateCollisionShapesFromTMXObjects(Node* tileMapNode, TileMapLayer2D* tileMapLayer, TileMapInfo2D info)
 {
 {
     // Create rigid body to the root node
     // Create rigid body to the root node
-    RigidBody2D* body = tileMapNode->CreateComponent<RigidBody2D>();
+    auto* body = tileMapNode->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
     body->SetBodyType(BT_STATIC);
 
 
     // Generate physics collision shapes and rigid bodies from the tmx file's objects located in "Physics" layer
     // 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* Sample2D::CreateRectangleShape(Node* node, TileMapObject2D* object, Vector2 size, TileMapInfo2D info)
 {
 {
-    CollisionBox2D* shape = node->CreateComponent<CollisionBox2D>();
+    auto* shape = node->CreateComponent<CollisionBox2D>();
     shape->SetSize(size);
     shape->SetSize(size);
     if (info.orientation_ == O_ORTHOGONAL)
     if (info.orientation_ == O_ORTHOGONAL)
         shape->SetCenter(object->GetPosition() + size / 2);
         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* Sample2D::CreateCircleShape(Node* node, TileMapObject2D* object, float radius, TileMapInfo2D info)
 {
 {
-    CollisionCircle2D* shape = node->CreateComponent<CollisionCircle2D>();
+    auto* shape = node->CreateComponent<CollisionCircle2D>();
     Vector2 size = object->GetSize();
     Vector2 size = object->GetSize();
     if (info.orientation_ == O_ORTHOGONAL)
     if (info.orientation_ == O_ORTHOGONAL)
         shape->SetCenter(object->GetPosition() + size / 2);
         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* Sample2D::CreatePolygonShape(Node* node, TileMapObject2D* object)
 {
 {
-    CollisionPolygon2D* shape = node->CreateComponent<CollisionPolygon2D>();
+    auto* shape = node->CreateComponent<CollisionPolygon2D>();
     int numVertices = object->GetNumPoints();
     int numVertices = object->GetNumPoints();
     shape->SetVertexCount(numVertices);
     shape->SetVertexCount(numVertices);
     for (int i = 0; i < numVertices; ++i)
     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* Sample2D::CreatePolyLineShape(Node* node, TileMapObject2D* object)
 {
 {
-    CollisionChain2D* shape = node->CreateComponent<CollisionChain2D>();
+    auto* shape = node->CreateComponent<CollisionChain2D>();
     int numVertices = object->GetNumPoints();
     int numVertices = object->GetNumPoints();
     shape->SetVertexCount(numVertices);
     shape->SetVertexCount(numVertices);
     for (int i = 0; i < numVertices; ++i)
     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)
 Node* Sample2D::CreateCharacter(TileMapInfo2D info, float friction, Vector3 position, float scale)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* spriteNode = scene_->CreateChild("Imp");
     Node* spriteNode = scene_->CreateChild("Imp");
     spriteNode->SetPosition(position);
     spriteNode->SetPosition(position);
     spriteNode->SetScale(scale);
     spriteNode->SetScale(scale);
-    AnimatedSprite2D* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
+    auto* animatedSprite = spriteNode->CreateComponent<AnimatedSprite2D>();
     // Get scml file and Play "idle" anim
     // 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->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetLayer(3); // Put character over tile map (which is on layer 0) and over Orcs (which are on layer 2)
     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->SetBodyType(BT_DYNAMIC);
     impBody->SetAllowSleep(false);
     impBody->SetAllowSleep(false);
-    CollisionCircle2D* shape = spriteNode->CreateComponent<CollisionCircle2D>();
+    auto* shape = spriteNode->CreateComponent<CollisionCircle2D>();
     shape->SetRadius(1.1f); // Set shape size
     shape->SetRadius(1.1f); // Set shape size
     shape->SetFriction(friction); // Set friction
     shape->SetFriction(friction); // Set friction
     shape->SetRestitution(0.1f); // Bounce
     shape->SetRestitution(0.1f); // Bounce
@@ -198,38 +198,38 @@ Node* Sample2D::CreateCharacter(TileMapInfo2D info, float friction, Vector3 posi
 Node* Sample2D::CreateTrigger()
 Node* Sample2D::CreateTrigger()
 {
 {
     Node* node = scene_->CreateChild(); // Clones will be renamed according to object type
     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);
     body->SetBodyType(BT_STATIC);
-    CollisionBox2D* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
+    auto* shape = node->CreateComponent<CollisionBox2D>(); // Create box shape
     shape->SetTrigger(true);
     shape->SetTrigger(true);
     return node;
     return node;
 }
 }
 
 
 Node* Sample2D::CreateEnemy()
 Node* Sample2D::CreateEnemy()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Enemy");
     Node* node = scene_->CreateChild("Enemy");
-    StaticSprite2D* staticSprite = node->CreateComponent<StaticSprite2D>();
+    auto* staticSprite = node->CreateComponent<StaticSprite2D>();
     staticSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
     staticSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Aster.png"));
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
     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
     shape->SetRadius(0.25f); // Set radius
     return node;
     return node;
 }
 }
 
 
 Node* Sample2D::CreateOrc()
 Node* Sample2D::CreateOrc()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Orc");
     Node* node = scene_->CreateChild("Orc");
     node->SetScale(scene_->GetChild("Imp", true)->GetScale());
     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->SetAnimationSet(animationSet);
     animatedSprite->SetAnimation("run"); // Get scml file and Play "run" anim
     animatedSprite->SetAnimation("run"); // Get scml file and Play "run" anim
     animatedSprite->SetLayer(2); // Make orc always visible
     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->SetRadius(1.3f); // Set shape size
     shape->SetTrigger(true);
     shape->SetTrigger(true);
     return node;
     return node;
@@ -237,17 +237,17 @@ Node* Sample2D::CreateOrc()
 
 
 Node* Sample2D::CreateCoin()
 Node* Sample2D::CreateCoin()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Coin");
     Node* node = scene_->CreateChild("Coin");
     node->SetScale(0.5);
     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->SetAnimationSet(animationSet); // Get scml file and Play "idle" anim
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetAnimation("idle");
     animatedSprite->SetLayer(4);
     animatedSprite->SetLayer(4);
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
     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->SetRadius(0.32f); // Set radius
     shape->SetTrigger(true);
     shape->SetTrigger(true);
     return node;
     return node;
@@ -255,14 +255,14 @@ Node* Sample2D::CreateCoin()
 
 
 Node* Sample2D::CreateMovingPlatform()
 Node* Sample2D::CreateMovingPlatform()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("MovingPlatform");
     Node* node = scene_->CreateChild("MovingPlatform");
     node->SetScale(Vector3(3.0f, 1.0f, 0.0f));
     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"));
     staticSprite->SetSprite(cache->GetResource<Sprite2D>("Urho2D/Box.png"));
-    RigidBody2D* body = node->CreateComponent<RigidBody2D>();
+    auto* body = node->CreateComponent<RigidBody2D>();
     body->SetBodyType(BT_STATIC);
     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->SetSize(Vector2(0.32f, 0.32f)); // Set box size
     shape->SetFriction(0.8f); // Set friction
     shape->SetFriction(0.8f); // Set friction
     return node;
     return node;
@@ -299,7 +299,7 @@ void Sample2D::PopulateMovingEntities(TileMapLayer2D* movingEntitiesLayer)
             movingClone->SetPosition2D(movingObject->GetPoint(0) + offset);
             movingClone->SetPosition2D(movingObject->GetPoint(0) + offset);
 
 
             // Create script object that handles entity translation along its path
             // Create script object that handles entity translation along its path
-            Mover* mover = movingClone->CreateComponent<Mover>();
+            auto* mover = movingClone->CreateComponent<Mover>();
 
 
             // Set path from points
             // Set path from points
             PODVector<Vector2> path = CreatePathFromPoints(movingObject, offset);
             PODVector<Vector2> path = CreatePathFromPoints(movingObject, offset);
@@ -328,7 +328,7 @@ void Sample2D::PopulateCoins(TileMapLayer2D* coinsLayer)
         TileMapObject2D* coinObject = coinsLayer->GetObject(i); // Get placeholder object
         TileMapObject2D* coinObject = coinsLayer->GetObject(i); // Get placeholder object
         Node* coinClone = coinNode->Clone();
         Node* coinClone = coinNode->Clone();
         coinClone->SetPosition2D(coinObject->GetPosition() + coinObject->GetSize() / 2 + Vector2(0.0f, 0.16f));
         coinClone->SetPosition2D(coinObject->GetPosition() + coinObject->GetSize() / 2 + Vector2(0.0f, 0.16f));
-        
+
     }
     }
 
 
     // Remove node used for cloning purpose
     // Remove node used for cloning purpose
@@ -348,7 +348,7 @@ void Sample2D::PopulateTriggers(TileMapLayer2D* triggersLayer)
         {
         {
             Node* triggerClone = triggerNode->Clone();
             Node* triggerClone = triggerNode->Clone();
             triggerClone->SetName(triggerObject->GetType());
             triggerClone->SetName(triggerObject->GetType());
-            CollisionBox2D* shape = triggerClone->GetComponent<CollisionBox2D>();
+            auto* shape = triggerClone->GetComponent<CollisionBox2D>();
             shape->SetSize(triggerObject->GetSize());
             shape->SetSize(triggerObject->GetSize());
             triggerClone->SetPosition2D(triggerObject->GetPosition() + triggerObject->GetSize() / 2);
             triggerClone->SetPosition2D(triggerObject->GetPosition() + triggerObject->GetSize() / 2);
         }
         }
@@ -357,7 +357,7 @@ void Sample2D::PopulateTriggers(TileMapLayer2D* triggersLayer)
 
 
 float Sample2D::Zoom(Camera* camera)
 float Sample2D::Zoom(Camera* camera)
 {
 {
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     float zoom_ = camera->GetZoom();
     float zoom_ = camera->GetZoom();
 
 
     if (input->GetMouseMoveWheel() != 0)
     if (input->GetMouseMoveWheel() != 0)
@@ -389,92 +389,92 @@ PODVector<Vector2> Sample2D::CreatePathFromPoints(TileMapObject2D* object, Vecto
 
 
 void Sample2D::CreateUIContent(String demoTitle, int remainingLifes, int remainingCoins)
 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
     // Set the default UI style and font
     ui->GetRoot()->SetDefaultStyle(cache->GetResource<XMLFile>("UI/DefaultStyle.xml"));
     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)
     // 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
     // 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->SetTexture(cache->GetResource<Texture2D>("Urho2D/GoldIcon.png"));
     coinsUI->SetSize(50, 50);
     coinsUI->SetSize(50, 50);
     coinsUI->SetImageRect(IntRect(0, 64, 60, 128));
     coinsUI->SetImageRect(IntRect(0, 64, 60, 128));
     coinsUI->SetAlignment(HA_LEFT, VA_TOP);
     coinsUI->SetAlignment(HA_LEFT, VA_TOP);
     coinsUI->SetPosition(5, 5);
     coinsUI->SetPosition(5, 5);
-    Text* coinsText = coinsUI->CreateChild<Text>("CoinsText");
+    auto* coinsText = coinsUI->CreateChild<Text>("CoinsText");
     coinsText->SetAlignment(HA_CENTER, VA_CENTER);
     coinsText->SetAlignment(HA_CENTER, VA_CENTER);
     coinsText->SetFont(font, 24);
     coinsText->SetFont(font, 24);
     coinsText->SetTextEffect(TE_SHADOW);
     coinsText->SetTextEffect(TE_SHADOW);
     coinsText->SetText(String(remainingCoins));
     coinsText->SetText(String(remainingCoins));
 
 
     // Create the UI for displaying the remaining lifes
     // 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->SetTexture(cache->GetResource<Texture2D>("Urho2D/imp/imp_all.png"));
     lifeUI->SetSize(70, 80);
     lifeUI->SetSize(70, 80);
     lifeUI->SetAlignment(HA_RIGHT, VA_TOP);
     lifeUI->SetAlignment(HA_RIGHT, VA_TOP);
     lifeUI->SetPosition(-5, 5);
     lifeUI->SetPosition(-5, 5);
-    Text* lifeText = lifeUI->CreateChild<Text>("LifeText");
+    auto* lifeText = lifeUI->CreateChild<Text>("LifeText");
     lifeText->SetAlignment(HA_CENTER, VA_CENTER);
     lifeText->SetAlignment(HA_CENTER, VA_CENTER);
     lifeText->SetFont(font, 24);
     lifeText->SetFont(font, 24);
     lifeText->SetTextEffect(TE_SHADOW);
     lifeText->SetTextEffect(TE_SHADOW);
     lifeText->SetText(String(remainingLifes));
     lifeText->SetText(String(remainingLifes));
 
 
     // Create the fullscreen UI for start/end
     // Create the fullscreen UI for start/end
-    Window* fullUI = ui->GetRoot()->CreateChild<Window>("FullUI");
+    auto* fullUI = ui->GetRoot()->CreateChild<Window>("FullUI");
     fullUI->SetStyleAuto();
     fullUI->SetStyleAuto();
     fullUI->SetSize(ui->GetRoot()->GetWidth(), ui->GetRoot()->GetHeight());
     fullUI->SetSize(ui->GetRoot()->GetWidth(), ui->GetRoot()->GetHeight());
     fullUI->SetEnabled(false); // Do not react to input, only the 'Exit' and 'Play' buttons will
     fullUI->SetEnabled(false); // Do not react to input, only the 'Exit' and 'Play' buttons will
 
 
     // Create the title
     // Create the title
-    BorderImage* title = fullUI->CreateChild<BorderImage>("Title");
+    auto* title = fullUI->CreateChild<BorderImage>("Title");
     title->SetMinSize(fullUI->GetWidth(), 50);
     title->SetMinSize(fullUI->GetWidth(), 50);
     title->SetTexture(cache->GetResource<Texture2D>("Textures/HeightMap.png"));
     title->SetTexture(cache->GetResource<Texture2D>("Textures/HeightMap.png"));
     title->SetFullImageRect();
     title->SetFullImageRect();
     title->SetAlignment(HA_CENTER, VA_TOP);
     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->SetAlignment(HA_CENTER, VA_CENTER);
     titleText->SetFont(font, 24);
     titleText->SetFont(font, 24);
     titleText->SetText(demoTitle);
     titleText->SetText(demoTitle);
 
 
     // Create the image
     // 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->SetTexture(cache->GetResource<Texture2D>("Urho2D/imp/imp_all.png"));
     spriteUI->SetSize(238, 271);
     spriteUI->SetSize(238, 271);
     spriteUI->SetAlignment(HA_CENTER, VA_CENTER);
     spriteUI->SetAlignment(HA_CENTER, VA_CENTER);
     spriteUI->SetPosition(0, - ui->GetRoot()->GetHeight() / 4);
     spriteUI->SetPosition(0, - ui->GetRoot()->GetHeight() / 4);
 
 
     // Create the 'EXIT' button
     // Create the 'EXIT' button
-    Button* exitButton = ui->GetRoot()->CreateChild<Button>("ExitButton");
+    auto* exitButton = ui->GetRoot()->CreateChild<Button>("ExitButton");
     exitButton->SetStyleAuto();
     exitButton->SetStyleAuto();
     exitButton->SetFocusMode(FM_RESETFOCUS);
     exitButton->SetFocusMode(FM_RESETFOCUS);
     exitButton->SetSize(100, 50);
     exitButton->SetSize(100, 50);
     exitButton->SetAlignment(HA_CENTER, VA_CENTER);
     exitButton->SetAlignment(HA_CENTER, VA_CENTER);
     exitButton->SetPosition(-100, 0);
     exitButton->SetPosition(-100, 0);
-    Text* exitText = exitButton->CreateChild<Text>("ExitText");
+    auto* exitText = exitButton->CreateChild<Text>("ExitText");
     exitText->SetAlignment(HA_CENTER, VA_CENTER);
     exitText->SetAlignment(HA_CENTER, VA_CENTER);
     exitText->SetFont(font, 24);
     exitText->SetFont(font, 24);
     exitText->SetText("EXIT");
     exitText->SetText("EXIT");
     SubscribeToEvent(exitButton, E_RELEASED, URHO3D_HANDLER(Sample2D, HandleExitButton));
     SubscribeToEvent(exitButton, E_RELEASED, URHO3D_HANDLER(Sample2D, HandleExitButton));
 
 
     // Create the 'PLAY' button
     // Create the 'PLAY' button
-    Button* playButton = ui->GetRoot()->CreateChild<Button>("PlayButton");
+    auto* playButton = ui->GetRoot()->CreateChild<Button>("PlayButton");
     playButton->SetStyleAuto();
     playButton->SetStyleAuto();
     playButton->SetFocusMode(FM_RESETFOCUS);
     playButton->SetFocusMode(FM_RESETFOCUS);
     playButton->SetSize(100, 50);
     playButton->SetSize(100, 50);
     playButton->SetAlignment(HA_CENTER, VA_CENTER);
     playButton->SetAlignment(HA_CENTER, VA_CENTER);
     playButton->SetPosition(100, 0);
     playButton->SetPosition(100, 0);
-    Text* playText = playButton->CreateChild<Text>("PlayText");
+    auto* playText = playButton->CreateChild<Text>("PlayText");
     playText->SetAlignment(HA_CENTER, VA_CENTER);
     playText->SetAlignment(HA_CENTER, VA_CENTER);
     playText->SetFont(font, 24);
     playText->SetFont(font, 24);
     playText->SetText("PLAY");
     playText->SetText("PLAY");
 //  SubscribeToEvent(playButton, E_RELEASED, HANDLER(Urho2DPlatformer, HandlePlayButton));
 //  SubscribeToEvent(playButton, E_RELEASED, HANDLER(Urho2DPlatformer, HandlePlayButton));
 
 
     // Create the instructions
     // 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->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->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetTextAlignment(HA_CENTER); // Center rows in relation to each other
     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);
     instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
 
 
     // Show mouse cursor
     // Show mouse cursor
-    Input* input = GetSubsystem<Input>();
+    auto* input = GetSubsystem<Input>();
     input->SetMouseVisible(true);
     input->SetMouseVisible(true);
 }
 }
 
 
 void Sample2D::HandleExitButton(StringHash eventType, VariantMap& eventData)
 void Sample2D::HandleExitButton(StringHash eventType, VariantMap& eventData)
 {
 {
-    Engine* engine = GetSubsystem<Engine>();
+    auto* engine = GetSubsystem<Engine>();
     engine->Exit();
     engine->Exit();
 }
 }
 
 
@@ -503,11 +503,11 @@ void Sample2D::SaveScene(bool initial)
 
 
 void Sample2D::CreateBackgroundSprite(TileMapInfo2D info, float scale, String texture, bool animate)
 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* node = scene_->CreateChild("Background");
     node->SetPosition(Vector3(info.GetMapWidth(), info.GetMapHeight(), 0) / 2);
     node->SetPosition(Vector3(info.GetMapWidth(), info.GetMapHeight(), 0) / 2);
     node->SetScale(scale);
     node->SetScale(scale);
-    StaticSprite2D* sprite = node->CreateComponent<StaticSprite2D>();
+    auto* sprite = node->CreateComponent<StaticSprite2D>();
     sprite->SetSprite(cache->GetResource<Sprite2D>(texture));
     sprite->SetSprite(cache->GetResource<Sprite2D>(texture));
     SetRandomSeed(Time::GetSystemTime()); // Randomize from system clock
     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));
     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)
 void Sample2D::SpawnEffect(Node* node)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     Node* particleNode = node->CreateChild("Emitter");
     Node* particleNode = node->CreateChild("Emitter");
     particleNode->SetScale(0.5 / node->GetScale().x_);
     particleNode->SetScale(0.5 / node->GetScale().x_);
-    ParticleEmitter2D* particleEmitter = particleNode->CreateComponent<ParticleEmitter2D>();
+    auto* particleEmitter = particleNode->CreateComponent<ParticleEmitter2D>();
     particleEmitter->SetLayer(2);
     particleEmitter->SetLayer(2);
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex"));
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex"));
 }
 }
 
 
 void Sample2D::PlaySoundEffect(String soundName)
 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) {
     if (sound != NULL) {
         source->SetAutoRemoveMode(REMOVE_COMPONENT);
         source->SetAutoRemoveMode(REMOVE_COMPONENT);
         source->Play(sound);
         source->Play(sound);

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

@@ -685,7 +685,7 @@ void ExportAnimation(const String& outName, bool animationOnly)
     if (!noAnimations_)
     if (!noAnimations_)
     {
     {
         // Most fbx animation files contain only a skeleton and no skinned mesh.
         // 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.
         // transfer the info to the model.
         if (suppressFbxPivotNodes_ && model.bones_.Size() == 0)
         if (suppressFbxPivotNodes_ && model.bones_.Size() == 0)
             CollectSceneNodesAsBones(model, rootNode_);
             CollectSceneNodesAsBones(model, rootNode_);
@@ -1131,7 +1131,7 @@ void BuildAndSaveModel(OutModel& model)
         if (model.bones_.Size())
         if (model.bones_.Size())
             GetBlendData(model, mesh, model.meshNodes_[i], boneMappings, blendIndices, blendWeights);
             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)
         for (unsigned j = 0; j < mesh->mNumVertices; ++j)
             WriteVertex(dest, mesh, j, isSkinned, box, vertexTransform, normalTransform, blendIndices, blendWeights);
             WriteVertex(dest, mesh, j, isSkinned, box, vertexTransform, normalTransform, blendIndices, blendWeights);
 
 
@@ -1257,7 +1257,7 @@ void BuildAndSaveAnimations(OutModel* model)
     {
     {
         aiAnimation* anim = animations[i];
         aiAnimation* anim = animations[i];
 
 
-        float duration = (float)anim->mDuration;
+        auto duration = (float)anim->mDuration;
         String animName = FromAIString(anim->mName);
         String animName = FromAIString(anim->mName);
         String animOutName;
         String animOutName;
 
 
@@ -1275,7 +1275,7 @@ void BuildAndSaveAnimations(OutModel* model)
         else
         else
             animOutName = outPath_ + GetFileName(outName_) + "_" + SanitateAssetName(animName) + ".ani";
             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 ticks per second not specified, it's probably a .X file. In this case use the default tick rate
         if (ticksPerSecond < M_EPSILON)
         if (ticksPerSecond < M_EPSILON)
             ticksPerSecond = defaultTicksPerSecond_;
             ticksPerSecond = defaultTicksPerSecond_;
@@ -1655,7 +1655,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
         if (createZone_)
         if (createZone_)
         {
         {
             Node* zoneNode = outScene->CreateChild("Zone", localIDs_ ? LOCAL : REPLICATED);
             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->SetBoundingBox(BoundingBox(-1000.0f, 1000.f));
             zone->SetAmbientColor(Color(0.25f, 0.25f, 0.25f));
             zone->SetAmbientColor(Color(0.25f, 0.25f, 0.25f));
 
 
@@ -1663,14 +1663,14 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
             if (!scene_->HasLights())
             if (!scene_->HasLights())
             {
             {
                 Node* lightNode = outScene->CreateChild("GlobalLight", localIDs_ ? LOCAL : REPLICATED);
                 Node* lightNode = outScene->CreateChild("GlobalLight", localIDs_ ? LOCAL : REPLICATED);
-                Light* light = lightNode->CreateComponent<Light>();
+                auto* light = lightNode->CreateComponent<Light>();
                 light->SetLightType(LIGHT_DIRECTIONAL);
                 light->SetLightType(LIGHT_DIRECTIONAL);
                 lightNode->SetRotation(Quaternion(60.0f, 30.0f, 0.0f));
                 lightNode->SetRotation(Quaternion(60.0f, 30.0f, 0.0f));
             }
             }
         }
         }
     }
     }
 
 
-    ResourceCache* cache = context_->GetSubsystem<ResourceCache>();
+    auto* cache = context_->GetSubsystem<ResourceCache>();
 
 
     HashMap<aiNode*, Node*> nodeMapping;
     HashMap<aiNode*, Node*> nodeMapping;
 
 
@@ -1701,7 +1701,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
         String modelName = (useSubdirs_ ? "Models/" : "") + GetFileNameAndExtension(model.outName_);
         String modelName = (useSubdirs_ ? "Models/" : "") + GetFileNameAndExtension(model.outName_);
         if (!cache->Exists(modelName))
         if (!cache->Exists(modelName))
         {
         {
-            Model* dummyModel = new Model(context_);
+            auto* dummyModel = new Model(context_);
             dummyModel->SetName(modelName);
             dummyModel->SetName(modelName);
             dummyModel->SetNumGeometries(model.meshes_.Size());
             dummyModel->SetNumGeometries(model.meshes_.Size());
             cache->AddManualResource(dummyModel);
             cache->AddManualResource(dummyModel);
@@ -1715,7 +1715,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
             // Create a dummy material so that the reference can be stored
             // Create a dummy material so that the reference can be stored
             if (!cache->Exists(matName))
             if (!cache->Exists(matName))
             {
             {
-                Material* dummyMat = new Material(context_);
+                auto* dummyMat = new Material(context_);
                 dummyMat->SetName(matName);
                 dummyMat->SetName(matName);
                 cache->AddManualResource(dummyMat);
                 cache->AddManualResource(dummyMat);
             }
             }
@@ -1745,7 +1745,7 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
                 outNode->SetDirection(lightAdjustDirection);
                 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));
             outLight->SetColor(Color(light->mColorDiffuse.r, light->mColorDiffuse.g, light->mColorDiffuse.b));
 
 
             switch (light->mType)
             switch (light->mType)
@@ -1955,7 +1955,7 @@ void BuildAndSaveMaterial(aiMaterial* material, HashSet<String>& usedTextures)
         shadowCullElem.SetString("value", "none");
         shadowCullElem.SetString("value", "none");
     }
     }
 
 
-    FileSystem* fileSystem = context_->GetSubsystem<FileSystem>();
+    auto* fileSystem = context_->GetSubsystem<FileSystem>();
 
 
     String outFileName = resourcePath_ + (useSubdirs_ ? "Materials/" : "" ) + matName + ".xml";
     String outFileName = resourcePath_ + (useSubdirs_ ? "Materials/" : "" ) + matName + ".xml";
     if (noOverwriteMaterial_ && fileSystem->FileExists(outFileName))
     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)
 void CopyTextures(const HashSet<String>& usedTextures, const String& sourcePath)
 {
 {
-    FileSystem* fileSystem = context_->GetSubsystem<FileSystem>();
+    auto* fileSystem = context_->GetSubsystem<FileSystem>();
 
 
     if (useSubdirs_)
     if (useSubdirs_)
         fileSystem->CreateDir(resourcePath_ + "Textures");
         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();
             mesh->mColors[i][index].a).ToUInt();
         ++dest;
         ++dest;
     }
     }
-    
+
     for (unsigned i = 0; i < mesh->GetNumUVChannels() && i < MAX_CHANNELS; ++i)
     for (unsigned i = 0; i < mesh->GetNumUVChannels() && i < MAX_CHANNELS; ++i)
     {
     {
         Vector3 texCoord = ToVector3(mesh->mTextureCoords[i][index]);
         Vector3 texCoord = ToVector3(mesh->mTextureCoords[i][index]);
@@ -2484,8 +2484,8 @@ void WriteVertex(float*& dest, aiMesh* mesh, unsigned index, bool isSkinned, Bou
             else
             else
                 *dest++ = 0.0f;
                 *dest++ = 0.0f;
         }
         }
-    
-        unsigned char* destBytes = (unsigned char*)dest;
+
+        auto* destBytes = (unsigned char*)dest;
         ++dest;
         ++dest;
         for (unsigned i = 0; i < 4; ++i)
         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 poskeyFrames = channel->mNumPositionKeys;
     unsigned int rotkeyFrames = channel->mNumRotationKeys;
     unsigned int rotkeyFrames = channel->mNumRotationKeys;
     unsigned int scalekeyFrames = channel->mNumScalingKeys;
     unsigned int scalekeyFrames = channel->mNumScalingKeys;
-    
+
     // Get max key frames
     // Get max key frames
     for (unsigned i = 0; i < TransformationComp_MAXIMUM; ++i)
     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
     // Resize and init vector key array
     if (poskeyFrames > channel->mNumPositionKeys)
     if (poskeyFrames > channel->mNumPositionKeys)
     {
     {
-        aiVectorKey* newKeys  = new aiVectorKey[poskeyFrames];
+        auto* newKeys  = new aiVectorKey[poskeyFrames];
         for (unsigned i = 0; i < poskeyFrames; ++i)
         for (unsigned i = 0; i < poskeyFrames; ++i)
         {
         {
             if (i < channel->mNumPositionKeys )
             if (i < channel->mNumPositionKeys )
@@ -2699,7 +2699,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     }
     }
     if (rotkeyFrames > channel->mNumRotationKeys)
     if (rotkeyFrames > channel->mNumRotationKeys)
     {
     {
-        aiQuatKey* newKeys  = new aiQuatKey[rotkeyFrames];
+        auto* newKeys  = new aiQuatKey[rotkeyFrames];
         for (unsigned i = 0; i < rotkeyFrames; ++i)
         for (unsigned i = 0; i < rotkeyFrames; ++i)
         {
         {
             if (i < channel->mNumRotationKeys)
             if (i < channel->mNumRotationKeys)
@@ -2713,7 +2713,7 @@ void ExpandAnimatedChannelKeys(aiAnimation* anim, unsigned mainChannel, int *cha
     }
     }
     if (scalekeyFrames > channel->mNumScalingKeys)
     if (scalekeyFrames > channel->mNumScalingKeys)
     {
     {
-        aiVectorKey* newKeys  = new aiVectorKey[scalekeyFrames];
+        auto* newKeys  = new aiVectorKey[scalekeyFrames];
         for (unsigned i = 0; i < scalekeyFrames; ++i)
         for (unsigned i = 0; i < scalekeyFrames; ++i)
         {
         {
             if ( i < channel->mNumScalingKeys)
             if ( i < channel->mNumScalingKeys)
@@ -2778,7 +2778,7 @@ void CreatePivotlessFbxBoneStruct(OutModel &model)
             finalTransform = finalTransform * chain[j];
             finalTransform = finalTransform * chain[j];
 
 
         // New bone node
         // New bone node
-        aiNode *pnode = new aiNode;
+        auto*pnode = new aiNode;
         pnode->mName = model.bones_[i]->mName;
         pnode->mName = model.bones_[i]->mName;
         pnode->mTransformation = finalTransform * model.bones_[i]->mTransformation;
         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)
                 if (pos + unpackedSize > dataSize)
                     unpackedSize = dataSize - pos;
                     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)
                 if (!packedSize)
                     ErrorExit("LZ4 compression failed for file " + entries_[i].name_ + " at offset " + String(pos));
                     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
     #endif
     }
     }
 
 
-    Log* log = context->GetSubsystem<Log>();
+    auto* log = context->GetSubsystem<Log>();
     // Register Log subsystem manually if compiled without logging support
     // Register Log subsystem manually if compiled without logging support
     if (!log)
     if (!log)
     {
     {
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
         String path, file, extension;
         String path, file, extension;
         SplitPath(outputFile, 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
         // Add resource path to be able to resolve includes
         if (arguments.Size() > 1)
         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());
     SharedPtr<Context> context(new Context());
     context->RegisterSubsystem(new FileSystem(context));
     context->RegisterSubsystem(new FileSystem(context));
     context->RegisterSubsystem(new Log(context));
     context->RegisterSubsystem(new Log(context));
-    FileSystem* fileSystem = context->GetSubsystem<FileSystem>();
+    auto* fileSystem = context->GetSubsystem<FileSystem>();
 
 
     Vector<String> inputFiles;
     Vector<String> inputFiles;
     String outputFile;
     String outputFile;
@@ -276,7 +276,7 @@ void Run(Vector<String>& arguments)
         }
         }
 
 
         // load rectangles
         // 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)
         for (unsigned i = 0; i < packerInfos.Size(); ++i)
         {
         {
             PackerInfo* packerInfo = packerInfos[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.
     // 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
     // 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
     // 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";
     const String commandFileName = filesystem->GetProgramDir() + "Data/CommandLine.txt";
     if (GetArguments().Empty() && filesystem->FileExists(commandFileName))
     if (GetArguments().Empty() && filesystem->FileExists(commandFileName))
     {
     {
@@ -201,7 +201,7 @@ void Urho3DPlayer::Start()
     {
     {
 #ifdef URHO3D_LUA
 #ifdef URHO3D_LUA
         // Instantiate and register the Lua script subsystem
         // Instantiate and register the Lua script subsystem
-        LuaScript* luaScript = new LuaScript(context_);
+        auto* luaScript = new LuaScript(context_);
         context_->RegisterSubsystem(luaScript);
         context_->RegisterSubsystem(luaScript);
 
 
         // If script loading is successful, proceed to main loop
         // If script loading is successful, proceed to main loop
@@ -238,7 +238,7 @@ void Urho3DPlayer::Stop()
 #ifdef URHO3D_LUA
 #ifdef URHO3D_LUA
     else
     else
     {
     {
-        LuaScript* luaScript = GetSubsystem<LuaScript>();
+        auto* luaScript = GetSubsystem<LuaScript>();
         if (luaScript && luaScript->GetFunction("Stop", true))
         if (luaScript && luaScript->GetFunction("Stop", true))
             luaScript->ExecuteFunction("Stop");
             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()
 template <class T> T* ConstructObject()
 {
 {
-    T* object = new T(GetScriptContext());
+    auto* object = new T(GetScriptContext());
     object->AddRef();
     object->AddRef();
     return object;
     return object;
 }
 }
 
 
 template <class T> T* ConstructNamedObject(const String& name)
 template <class T> T* ConstructNamedObject(const String& name)
 {
 {
-    T* object = new T(GetScriptContext());
+    auto* object = new T(GetScriptContext());
     object->AddRef();
     object->AddRef();
     object->SetName(name);
     object->SetName(name);
     return object;
     return object;

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

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

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

@@ -58,7 +58,7 @@ class ScriptResourceRouter : public ResourceRouter
             String replaced = ReplaceExtension(name, ".asc");
             String replaced = ReplaceExtension(name, ".asc");
             // Note: ResourceCache prevents recursive calls to the resource routers so this is OK, the nested Exists()
             // Note: ResourceCache prevents recursive calls to the resource routers so this is OK, the nested Exists()
             // check does not go through the router again
             // check does not go through the router again
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
+            auto* cache = GetSubsystem<ResourceCache>();
             if (!cache->Exists(name) && cache->Exists(replaced))
             if (!cache->Exists(name) && cache->Exists(replaced))
                 name = replaced;
                 name = replaced;
         }
         }
@@ -145,7 +145,7 @@ Script::Script(Context* context) :
     SetExecuteConsoleCommands(true);
     SetExecuteConsoleCommands(true);
 
 
     // Create and register resource router for checking for compiled AngelScript files
     // Create and register resource router for checking for compiled AngelScript files
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     if (cache)
     if (cache)
     {
     {
         router_ = new ScriptResourceRouter(context_);
         router_ = new ScriptResourceRouter(context_);
@@ -170,7 +170,7 @@ Script::~Script()
         scriptEngine_ = nullptr;
         scriptEngine_ = nullptr;
     }
     }
 
 
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     if (cache)
     if (cache)
         cache->RemoveResourceRouter(router_);
         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())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             asIScriptObject* object = instance->GetScriptObject();
             asIScriptObject* object = instance->GetScriptObject();
             if (!object)
             if (!object)
             {
             {
@@ -79,7 +79,7 @@ static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const S
         }
         }
     }
     }
     // Then create a new component if not found
     // Then create a new component if not found
-    ScriptInstance* instance = ptr->CreateComponent<ScriptInstance>(mode);
+    auto* instance = ptr->CreateComponent<ScriptInstance>(mode);
     instance->CreateObject(file, className);
     instance->CreateObject(file, className);
     return instance->GetScriptObject();
     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)
 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);
     return NodeCreateScriptObjectWithFile(cache->GetResource<ScriptFile>(scriptFileName), className, mode, ptr);
 }
 }
 
 
@@ -108,7 +108,7 @@ asIScriptObject* NodeGetScriptObject(Node* ptr)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             asIScriptObject* object = instance->GetScriptObject();
             asIScriptObject* object = instance->GetScriptObject();
             if (object)
             if (object)
                 return object;
                 return object;
@@ -125,7 +125,7 @@ asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
     {
     {
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         if ((*i)->GetType() == ScriptInstance::GetTypeStatic())
         {
         {
-            ScriptInstance* instance = static_cast<ScriptInstance*>(i->Get());
+            auto* instance = static_cast<ScriptInstance*>(i->Get());
             if (instance->IsA(className))
             if (instance->IsA(className))
             {
             {
                 asIScriptObject* object = instance->GetScriptObject();
                 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");
         Log::WriteRaw("namespace Urho3D\n{\n\n/**\n");
 
 
-        FileSystem* fileSystem = GetSubsystem<FileSystem>();
+        auto* fileSystem = GetSubsystem<FileSystem>();
         Vector<String> headerFileNames;
         Vector<String> headerFileNames;
         String path = AddTrailingSlash(sourceTree);
         String path = AddTrailingSlash(sourceTree);
         if (!path.Empty())
         if (!path.Empty())
@@ -329,14 +329,14 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
                 "#define uint16 unsigned short\n"
                 "#define uint16 unsigned short\n"
                 "#define uint64 unsigned long\n"
                 "#define uint64 unsigned long\n"
                 "#define null 0\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"
                 "#define funcdef\n"
             );
             );
 
 
@@ -414,30 +414,30 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
             }
             }
             else if (mode == C_HEADER)
             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");
                 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();
             unsigned methods = type->GetMethodCount();
@@ -455,14 +455,14 @@ void Script::DumpAPI(DumpMode mode, const String& sourceTree)
                 else
                 else
                 {
                 {
                     // Sanitate the method name. For some operators fix name
                     // 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"))
                     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)
 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
     {
     {
@@ -225,7 +225,7 @@ void ScriptFile::RemoveEventHandler(StringHash eventType)
 
 
 void ScriptFile::RemoveEventHandler(Object* sender, 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
     {
     {
@@ -237,7 +237,7 @@ void ScriptFile::RemoveEventHandler(Object* sender, StringHash eventType)
 
 
 void ScriptFile::RemoveEventHandlers(Object* sender)
 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
     {
     {
@@ -249,7 +249,7 @@ void ScriptFile::RemoveEventHandlers(Object* sender)
 
 
 void ScriptFile::RemoveEventHandlers()
 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
     {
     {
@@ -261,7 +261,7 @@ void ScriptFile::RemoveEventHandlers()
 
 
 void ScriptFile::RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions)
 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::Iterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
     {
     {
@@ -273,7 +273,7 @@ void ScriptFile::RemoveEventHandlersExcept(const PODVector<StringHash>& exceptio
 
 
 bool ScriptFile::HasEventHandler(StringHash eventType) const
 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::ConstIterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
         return i->second_->HasSubscribedToEvent(eventType);
         return i->second_->HasSubscribedToEvent(eventType);
@@ -283,7 +283,7 @@ bool ScriptFile::HasEventHandler(StringHash eventType) const
 
 
 bool ScriptFile::HasEventHandler(Object* sender, 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);
     HashMap<asIScriptObject*, SharedPtr<ScriptEventInvoker> >::ConstIterator i = eventInvokers_.Find(receiver);
     if (i != eventInvokers_.End())
     if (i != eventInvokers_.End())
         return i->second_->HasSubscribedToEvent(sender, eventType);
         return i->second_->HasSubscribedToEvent(sender, eventType);
@@ -541,7 +541,7 @@ void ScriptFile::AddEventHandlerInternal(Object* sender, StringHash eventType, c
 {
 {
     String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
     String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
     asIScriptFunction* function = nullptr;
     asIScriptFunction* function = nullptr;
-    asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
+    auto* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
 
 
     if (receiver)
     if (receiver)
         function = GetMethod(receiver, declaration);
         function = GetMethod(receiver, declaration);
@@ -587,7 +587,7 @@ void ScriptFile::AddEventHandlerInternal(Object* sender, StringHash eventType, c
 
 
 bool ScriptFile::AddScriptSection(asIScriptEngine* engine, Deserializer& source)
 bool ScriptFile::AddScriptSection(asIScriptEngine* engine, Deserializer& source)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
 
 
     unsigned dataSize = source.GetSize();
     unsigned dataSize = source.GetSize();
     SharedArrayPtr<char> buffer(new char[dataSize]);
     SharedArrayPtr<char> buffer(new char[dataSize]);
@@ -857,7 +857,7 @@ void ScriptFile::ReleaseModule()
         compiled_ = false;
         compiled_ = false;
         SetMemoryUse(0);
         SetMemoryUse(0);
 
 
-        ResourceCache* cache = GetSubsystem<ResourceCache>();
+        auto* cache = GetSubsystem<ResourceCache>();
         if (cache)
         if (cache)
             cache->ResetDependencies(this);
             cache->ResetDependencies(this);
     }
     }
@@ -935,7 +935,7 @@ void ScriptEventInvoker::HandleScriptEvent(StringHash eventType, VariantMap& eve
     if (!file_->IsCompiled())
     if (!file_->IsCompiled())
         return;
         return;
 
 
-    asIScriptFunction* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
+    auto* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
 
 
     if (object_ && !IsObjectAlive())
     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
         // 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
         // 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();
         idAttributes_[attrPtr] = src.GetUInt();
     }
     }
     else if (attr.type_ == VAR_RESOURCEREF && attr.ptr_)
     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
 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
     // Get ID's for node / component handle attributes
     if (attr.mode_ & (AM_NODEID | AM_COMPONENTID))
     if (attr.mode_ & (AM_NODEID | AM_COMPONENTID))
@@ -442,7 +442,7 @@ bool ScriptInstance::HasMethod(const String& declaration) const
 
 
 void ScriptInstance::SetScriptFileAttr(const ResourceRef& value)
 void ScriptInstance::SetScriptFileAttr(const ResourceRef& value)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     SetScriptFile(cache->GetResource<ScriptFile>(value.name_));
     SetScriptFile(cache->GetResource<ScriptFile>(value.name_));
 }
 }
 
 
@@ -930,7 +930,7 @@ void ScriptInstance::HandleScriptEvent(StringHash eventType, VariantMap& eventDa
     if (!IsEnabledEffective() || !scriptFile_ || !scriptObject_)
     if (!IsEnabledEffective() || !scriptFile_ || !scriptObject_)
         return;
         return;
 
 
-    asIScriptFunction* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
+    auto* method = static_cast<asIScriptFunction*>(GetEventHandler()->GetUserData());
 
 
     VariantVector parameters;
     VariantVector parameters;
     if (method->GetParamCount() > 0)
     if (method->GetParamCount() > 0)
@@ -1006,7 +1006,7 @@ ScriptEventListener* GetScriptContextEventListener()
     asIScriptContext* context = asGetActiveContext();
     asIScriptContext* context = asGetActiveContext();
     if (context)
     if (context)
     {
     {
-        asIScriptObject* object = static_cast<asIScriptObject*>(context->GetThisPointer());
+        auto* object = static_cast<asIScriptObject*>(context->GetThisPointer());
         if (object && object->GetUserData())
         if (object && object->GetUserData())
             return GetScriptContextInstance();
             return GetScriptContextInstance();
         else
         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)
 void SDLAudioCallback(void* userdata, Uint8* stream, int len)
 {
 {
-    Audio* audio = static_cast<Audio*>(userdata);
+    auto* audio = static_cast<Audio*>(userdata);
     {
     {
         MutexLock Lock(audio->GetMutex());
         MutexLock Lock(audio->GetMutex());
         audio->MixOutput(stream, len / audio->GetSampleSize() / Audio::SAMPLE_SIZE_MUL);
         audio->MixOutput(stream, len / audio->GetSampleSize() / Audio::SAMPLE_SIZE_MUL);
@@ -318,7 +318,7 @@ void Audio::MixOutput(void* dest, unsigned samples)
         while (clipSamples--)
         while (clipSamples--)
             *destPtr++ = (float)Clamp(*clipPtr++, -32768, 32767) / 32768.0f;
             *destPtr++ = (float)Clamp(*clipPtr++, -32768, 32767) / 32768.0f;
 #else
 #else
-        short* destPtr = (short*)dest;
+        auto* destPtr = (short*)dest;
         while (clipSamples--)
         while (clipSamples--)
             *destPtr++ = (short)Clamp(*clipPtr++, -32768, 32767);
             *destPtr++ = (short)Clamp(*clipPtr++, -32768, 32767);
 #endif
 #endif

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

@@ -52,7 +52,7 @@ OggVorbisSoundStream::~OggVorbisSoundStream()
     // Close decoder
     // Close decoder
     if (decoder_)
     if (decoder_)
     {
     {
-        stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
+        auto* vorbis = static_cast<stb_vorbis*>(decoder_);
 
 
         stb_vorbis_close(vorbis);
         stb_vorbis_close(vorbis);
         decoder_ = nullptr;
         decoder_ = nullptr;
@@ -63,9 +63,9 @@ bool OggVorbisSoundStream::Seek(unsigned sample_number)
 {
 {
     if (!decoder_)
     if (!decoder_)
         return false;
         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;
     return stb_vorbis_seek(vorbis, sample_number) == 1;
 }
 }
 
 
@@ -74,10 +74,10 @@ unsigned OggVorbisSoundStream::GetData(signed char* dest, unsigned numBytes)
     if (!decoder_)
     if (!decoder_)
         return 0;
         return 0;
 
 
-    stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
+    auto* vorbis = static_cast<stb_vorbis*>(decoder_);
 
 
     unsigned channels = stereo_ ? 2 : 1;
     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;
     unsigned outBytes = (outSamples * channels) << 1;
 
 
     // Rewind and retry if is looping and produced less output than should have
     // 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()
 void Sound::LoadParameters()
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     String xmlName = ReplaceExtension(GetName(), ".xml");
     String xmlName = ReplaceExtension(GetName(), ".xml");
 
 
     SharedPtr<XMLFile> file(cache->GetTempResource<XMLFile>(xmlName, false));
     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();
         int streamBufferSize = streamBuffer_->GetDataSize();
         // Calculate how many bytes of stream sound data is needed
         // 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
         // Add a little safety buffer. Subtract previous unused data
         neededSize += STREAM_SAFETY_SAMPLES;
         neededSize += STREAM_SAFETY_SAMPLES;
         neededSize *= soundStream_->GetSampleSize();
         neededSize *= soundStream_->GetSampleSize();
@@ -465,8 +465,8 @@ void SoundSource::UpdateMasterGain()
 
 
 void SoundSource::SetSoundAttr(const ResourceRef& value)
 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())
     if (IsPlaying())
         Play(newSound);
         Play(newSound);
     else
     else
@@ -605,7 +605,7 @@ void SoundSource::SetPlayPositionLockless(signed char* pos)
 void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -613,15 +613,15 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -646,7 +646,7 @@ void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int m
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     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)
     if (!leftVol && !rightVol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -686,15 +686,15 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -723,7 +723,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -767,15 +767,15 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -800,7 +800,7 @@ void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     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)
     if (!leftVol && !rightVol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -841,15 +841,15 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -880,7 +880,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -926,15 +926,15 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -961,7 +961,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -1003,15 +1003,15 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -1040,7 +1040,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -1084,15 +1084,15 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -1119,7 +1119,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    int vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = (int)(256.0f * totalGain + 0.5f);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -1161,15 +1161,15 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     }
     }
 
 
     float add = frequency_ / (float)mixRate;
     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_;
     int fractPos = fractPosition_;
 
 
     if (sound->IsSixteenBit())
     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())
         if (sound->IsLooped())
         {
         {
@@ -1198,7 +1198,7 @@ void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples,
     }
     }
     else
     else
     {
     {
-        signed char* pos = (signed char*)position_;
+        auto* pos = (signed char*)position_;
         signed char* end = sound->GetEnd();
         signed char* end = sound->GetEnd();
         signed char* repeat = sound->GetRepeat();
         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)
 void SoundSource::MixZeroVolume(Sound* sound, unsigned samples, int mixRate)
 {
 {
     float add = frequency_ * (float)samples / (float)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();
     unsigned sampleSize = sound->GetSampleSize();
 
 
     fractPosition_ += fractAdd;
     fractPosition_ += fractAdd;

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

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

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

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

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

@@ -32,8 +32,8 @@ void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
     if (ptrs_)
     if (ptrs_)
         delete[] 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[0] = size;
     data[1] = numBuckets;
     data[1] = numBuckets;
     ptrs_ = ptrs;
     ptrs_ = ptrs;

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

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

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

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

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

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

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

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

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

@@ -69,8 +69,8 @@ Condition::Condition() :
 
 
 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_cond_destroy(cond);
     pthread_mutex_destroy(mutex);
     pthread_mutex_destroy(mutex);
@@ -87,8 +87,8 @@ void Condition::Set()
 
 
 void Condition::Wait()
 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_mutex_lock(mutex);
     pthread_cond_wait(cond, 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
 #ifdef URHO3D_PROFILING
     if (EventProfiler::IsActive())
     if (EventProfiler::IsActive())
     {
     {
-        EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+        auto* eventProfiler = GetSubsystem<EventProfiler>();
         if (eventProfiler)
         if (eventProfiler)
             eventProfiler->BeginBlock(eventType);
             eventProfiler->BeginBlock(eventType);
     }
     }
@@ -472,7 +472,7 @@ void Context::EndSendEvent()
 #ifdef URHO3D_PROFILING
 #ifdef URHO3D_PROFILING
     if (EventProfiler::IsActive())
     if (EventProfiler::IsActive())
     {
     {
-        EventProfiler* eventProfiler = GetSubsystem<EventProfiler>();
+        auto* eventProfiler = GetSubsystem<EventProfiler>();
         if (eventProfiler)
         if (eventProfiler)
             eventProfiler->EndBlock();
             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)
         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)
             if (eventProfilerBlock->eventID_ == eventID)
                 return eventProfilerBlock;
                 return eventProfilerBlock;
         }
         }
 
 
-        EventProfilerBlock* newBlock = new EventProfilerBlock(this, eventID);
+        auto* newBlock = new EventProfilerBlock(this, eventID);
         children_.Push(newBlock);
         children_.Push(newBlock);
 
 
         return newBlock;
         return newBlock;

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

@@ -71,7 +71,7 @@ void Mutex::Release()
 Mutex::Mutex() :
 Mutex::Mutex() :
     handle_(new pthread_mutex_t)
     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_t attr;
     pthread_mutexattr_init(&attr);
     pthread_mutexattr_init(&attr);
     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
     pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@@ -80,7 +80,7 @@ Mutex::Mutex() :
 
 
 Mutex::~Mutex()
 Mutex::~Mutex()
 {
 {
-    pthread_mutex_t* mutex = (pthread_mutex_t*)handle_;
+    auto* mutex = (pthread_mutex_t*)handle_;
     pthread_mutex_destroy(mutex);
     pthread_mutex_destroy(mutex);
     delete mutex;
     delete mutex;
     handle_ = 0;
     handle_ = 0;

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

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

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

@@ -128,7 +128,7 @@ public:
                 return *i;
                 return *i;
         }
         }
 
 
-        ProfilerBlock* newBlock = new ProfilerBlock(this, name);
+        auto* newBlock = new ProfilerBlock(this, name);
         children_.Push(newBlock);
         children_.Push(newBlock);
 
 
         return 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)
         if (t >= 1.f)
             return knots[knots.Size() - 2];
             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);
         t = fmodf(t * (knots.Size() - 3), 1.f);
         float t2 = t * t;
         float t2 = t * t;
         float t3 = t2 * 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)
     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')
         if (c == 't' || c == 'y' || c == '1')
             return true;
             return true;
         else if (c != ' ' && c != '\t')
         else if (c != ' ' && c != '\t')
@@ -214,7 +214,7 @@ Color ToColor(const char* source)
     if (elements < 3)
     if (elements < 3)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.r_ = (float)strtod(ptr, &ptr);
     ret.r_ = (float)strtod(ptr, &ptr);
     ret.g_ = (float)strtod(ptr, &ptr);
     ret.g_ = (float)strtod(ptr, &ptr);
     ret.b_ = (float)strtod(ptr, &ptr);
     ret.b_ = (float)strtod(ptr, &ptr);
@@ -237,7 +237,7 @@ IntRect ToIntRect(const char* source)
     if (elements < 4)
     if (elements < 4)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.left_ = (int)strtol(ptr, &ptr, 10);
     ret.left_ = (int)strtol(ptr, &ptr, 10);
     ret.top_ = (int)strtol(ptr, &ptr, 10);
     ret.top_ = (int)strtol(ptr, &ptr, 10);
     ret.right_ = (int)strtol(ptr, &ptr, 10);
     ret.right_ = (int)strtol(ptr, &ptr, 10);
@@ -259,7 +259,7 @@ IntVector2 ToIntVector2(const char* source)
     if (elements < 2)
     if (elements < 2)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
 
 
@@ -279,7 +279,7 @@ IntVector3 ToIntVector3(const char* source)
     if (elements < 3)
     if (elements < 3)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.x_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
     ret.y_ = (int)strtol(ptr, &ptr, 10);
     ret.z_ = (int)strtol(ptr, &ptr, 10);
     ret.z_ = (int)strtol(ptr, &ptr, 10);
@@ -300,7 +300,7 @@ Rect ToRect(const char* source)
     if (elements < 4)
     if (elements < 4)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.min_.x_ = (float)strtod(ptr, &ptr);
     ret.min_.x_ = (float)strtod(ptr, &ptr);
     ret.min_.y_ = (float)strtod(ptr, &ptr);
     ret.min_.y_ = (float)strtod(ptr, &ptr);
     ret.max_.x_ = (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)
 Quaternion ToQuaternion(const char* source)
 {
 {
     unsigned elements = CountElements(source, ' ');
     unsigned elements = CountElements(source, ' ');
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
 
 
     if (elements < 3)
     if (elements < 3)
         return Quaternion::IDENTITY;
         return Quaternion::IDENTITY;
@@ -357,7 +357,7 @@ Vector2 ToVector2(const char* source)
     if (elements < 2)
     if (elements < 2)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
 
 
@@ -377,7 +377,7 @@ Vector3 ToVector3(const char* source)
     if (elements < 3)
     if (elements < 3)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.x_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
     ret.y_ = (float)strtod(ptr, &ptr);
     ret.z_ = (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);
     Vector4 ret(Vector4::ZERO);
 
 
     unsigned elements = CountElements(source, ' ');
     unsigned elements = CountElements(source, ' ');
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
 
 
     if (!allowMissingCoords)
     if (!allowMissingCoords)
     {
     {
@@ -485,7 +485,7 @@ Matrix3 ToMatrix3(const char* source)
     if (elements < 9)
     if (elements < 9)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
@@ -512,7 +512,7 @@ Matrix3x4 ToMatrix3x4(const char* source)
     if (elements < 12)
     if (elements < 12)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (float)strtod(ptr, &ptr);
@@ -542,7 +542,7 @@ Matrix4 ToMatrix4(const char* source)
     if (elements < 16)
     if (elements < 16)
         return ret;
         return ret;
 
 
-    char* ptr = (char*)source;
+    auto* ptr = (char*)source;
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m00_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m01_ = (float)strtod(ptr, &ptr);
     ret.m02_ = (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)
 void BufferToString(String& dest, const void* data, unsigned size)
 {
 {
     // Precalculate needed string size
     // Precalculate needed string size
-    const unsigned char* bytes = (const unsigned char*)data;
+    const auto* bytes = (const unsigned char*)data;
     unsigned length = 0;
     unsigned length = 0;
     for (unsigned i = 0; i < size; ++i)
     for (unsigned i = 0; i < size; ++i)
     {
     {
@@ -745,7 +745,7 @@ String GetFileSizeString(unsigned long long memorySize)
     }
     }
     else
     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);
         const double majorValue = ((double)memorySize) / pow(1024.0, exponent);
         char buffer[64];
         char buffer[64];
         memset(buffer, 0, 64);
         memset(buffer, 0, 64);
@@ -758,13 +758,13 @@ String GetFileSizeString(unsigned long long memorySize)
     return output;
     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
 // Modified by Konstantin Guschin and Lasse Oorni
 
 
 /*
 /*
 base64.cpp and base64.h
 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
 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
 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.
 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 == '/'));
     return (isalnum(c) || (c == '+') || (c == '/'));
 }
 }
 
 
-PODVector<unsigned char> DecodeBase64(String encodedString) 
+PODVector<unsigned char> DecodeBase64(String encodedString)
 {
 {
     int inLen = encodedString.Length();
     int inLen = encodedString.Length();
     int i = 0;
     int i = 0;
@@ -801,9 +801,9 @@ PODVector<unsigned char> DecodeBase64(String encodedString)
     unsigned char charArray4[4], charArray3[3];
     unsigned char charArray4[4], charArray3[3];
     PODVector<unsigned char> ret;
     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_++;
         in_++;
 
 
         if (i == 4)
         if (i == 4)
@@ -834,7 +834,7 @@ PODVector<unsigned char> DecodeBase64(String encodedString)
         charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
         charArray3[1] = ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2);
         charArray3[2] = ((charArray4[2] & 0x3) << 6) + charArray4[3];
         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]);
             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)
 static void* ThreadFunctionStatic(void* data)
 {
 {
-    Thread* thread = static_cast<Thread*>(data);
+    auto* thread = static_cast<Thread*>(data);
     thread->ThreadFunction();
     thread->ThreadFunction();
     pthread_exit((void*)0);
     pthread_exit((void*)0);
     return 0;
     return 0;
@@ -106,7 +106,7 @@ void Thread::Stop()
     WaitForSingleObject((HANDLE)handle_, INFINITE);
     WaitForSingleObject((HANDLE)handle_, INFINITE);
     CloseHandle((HANDLE)handle_);
     CloseHandle((HANDLE)handle_);
 #else
 #else
-    pthread_t* thread = (pthread_t*)handle_;
+    auto* thread = (pthread_t*)handle_;
     if (thread)
     if (thread)
         pthread_join(*thread, 0);
         pthread_join(*thread, 0);
     delete thread;
     delete thread;
@@ -122,7 +122,7 @@ void Thread::SetPriority(int priority)
     if (handle_)
     if (handle_)
         SetThreadPriority((HANDLE)handle_, priority);
         SetThreadPriority((HANDLE)handle_, priority);
 #elif defined(__linux__) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
 #elif defined(__linux__) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)
-    pthread_t* thread = (pthread_t*)handle_;
+    auto* thread = (pthread_t*)handle_;
     if (thread)
     if (thread)
         pthread_setschedprio(*thread, priority);
         pthread_setschedprio(*thread, priority);
 #endif
 #endif

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

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

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

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

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

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

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

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

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

@@ -776,7 +776,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         skeleton_.Define(skeleton);
         skeleton_.Define(skeleton);
 
 
         // Instruct the master model to refresh (merge) its bone bounding boxes
         // 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)
         if (master && master != this)
             master->FinalizeBoneBoundingBoxes();
             master->FinalizeBoneBoundingBoxes();
 
 
@@ -798,7 +798,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
 
 
 void AnimatedModel::SetModelAttr(const ResourceRef& value)
 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)
     // 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_);
     SetModel(cache->GetResource<Model>(value.name_), !loading_);
 }
 }
@@ -812,7 +812,7 @@ void AnimatedModel::SetBonesEnabledAttr(const VariantVector& value)
 
 
 void AnimatedModel::SetAnimationStatesAttr(const VariantVector& value)
 void AnimatedModel::SetAnimationStatesAttr(const VariantVector& value)
 {
 {
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    auto* cache = GetSubsystem<ResourceCache>();
     RemoveAllAnimationStates();
     RemoveAllAnimationStates();
     unsigned index = 0;
     unsigned index = 0;
     unsigned numStates = index < value.Size() ? value[index++].GetUInt() : 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
         // 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
         /// \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
         // Check if we've become the new master model in case the original was deleted
         if (master == this)
         if (master == this)
             isMaster_ = true;
             isMaster_ = true;
@@ -1185,14 +1185,14 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
     unsigned normalOffset = srcBuffer->GetElementOffset(SEM_NORMAL);
     unsigned normalOffset = srcBuffer->GetElementOffset(SEM_NORMAL);
     unsigned tangentOffset = srcBuffer->GetElementOffset(SEM_TANGENT);
     unsigned tangentOffset = srcBuffer->GetElementOffset(SEM_TANGENT);
     unsigned vertexSize = srcBuffer->GetVertexSize();
     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--)
     while (vertexCount--)
     {
     {
         if (mask & MASK_POSITION)
         if (mask & MASK_POSITION)
         {
         {
-            float* posSrc = (float*)src;
+            auto* posSrc = (float*)src;
             dest[0] = posSrc[0];
             dest[0] = posSrc[0];
             dest[1] = posSrc[1];
             dest[1] = posSrc[1];
             dest[2] = posSrc[2];
             dest[2] = posSrc[2];
@@ -1200,7 +1200,7 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
         }
         }
         if (mask & MASK_NORMAL)
         if (mask & MASK_NORMAL)
         {
         {
-            float* normalSrc = (float*)(src + normalOffset);
+            auto* normalSrc = (float*)(src + normalOffset);
             dest[0] = normalSrc[0];
             dest[0] = normalSrc[0];
             dest[1] = normalSrc[1];
             dest[1] = normalSrc[1];
             dest[2] = normalSrc[2];
             dest[2] = normalSrc[2];
@@ -1208,7 +1208,7 @@ void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData,
         }
         }
         if (mask & MASK_TANGENT)
         if (mask & MASK_TANGENT)
         {
         {
-            float* tangentSrc = (float*)(src + tangentOffset);
+            auto* tangentSrc = (float*)(src + tangentOffset);
             dest[0] = tangentSrc[0];
             dest[0] = tangentSrc[0];
             dest[1] = tangentSrc[1];
             dest[1] = tangentSrc[1];
             dest[2] = tangentSrc[2];
             dest[2] = tangentSrc[2];
@@ -1341,7 +1341,7 @@ void AnimatedModel::UpdateSkinning()
 
 
 void AnimatedModel::UpdateMorphs()
 void AnimatedModel::UpdateMorphs()
 {
 {
-    Graphics* graphics = GetSubsystem<Graphics>();
+    auto* graphics = GetSubsystem<Graphics>();
     if (!graphics)
     if (!graphics)
         return;
         return;
 
 
@@ -1393,7 +1393,7 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
     unsigned vertexSize = buffer->GetVertexSize();
     unsigned vertexSize = buffer->GetVertexSize();
 
 
     unsigned char* srcData = morph.morphData_;
     unsigned char* srcData = morph.morphData_;
-    unsigned char* destData = (unsigned char*)destVertexData;
+    auto* destData = (unsigned char*)destVertexData;
 
 
     while (vertexCount--)
     while (vertexCount--)
     {
     {
@@ -1402,8 +1402,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
 
 
         if (elementMask & MASK_POSITION)
         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[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;
             dest[2] += src[2] * weight;
@@ -1411,8 +1411,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
         }
         }
         if (elementMask & MASK_NORMAL)
         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[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;
             dest[2] += src[2] * weight;
@@ -1420,8 +1420,8 @@ void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsig
         }
         }
         if (elementMask & MASK_TANGENT)
         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[0] += src[0] * weight;
             dest[1] += src[1] * weight;
             dest[1] += src[1] * weight;
             dest[2] += src[2] * weight;
             dest[2] += src[2] * weight;

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