Move files and folders to new repo format to enable multi-project format
This commit is contained in:
11
Zennysoft.Game.Ma/src/utils/FpsCounter.cs
Normal file
11
Zennysoft.Game.Ma/src/utils/FpsCounter.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class FpsCounter : Label
|
||||
{
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
this.Text = Engine.GetFramesPerSecond().ToString();
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/utils/FpsCounter.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/utils/FpsCounter.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dj6oqler47dqf
|
||||
6
Zennysoft.Game.Ma/src/utils/GameInputs.cs
Normal file
6
Zennysoft.Game.Ma/src/utils/GameInputs.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[InputMap]
|
||||
public partial class GameInputs;
|
||||
1
Zennysoft.Game.Ma/src/utils/GameInputs.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/utils/GameInputs.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b2ff347q41vpq
|
||||
39
Zennysoft.Game.Ma/src/utils/Instantiator.cs
Normal file
39
Zennysoft.Game.Ma/src/utils/Instantiator.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
/// <summary>
|
||||
/// Utility class that loads and instantiates scenes.
|
||||
/// </summary>
|
||||
public interface IInstantiator
|
||||
{
|
||||
/// <summary>Scene tree.</summary>
|
||||
public SceneTree SceneTree { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads and instantiates the given scene.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to the scene.</param>
|
||||
/// <typeparam name="T">Type of the scene's root.</typeparam>
|
||||
/// <returns>Instance of the scene.</returns>
|
||||
T LoadAndInstantiate<T>(string path) where T : Node;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Utility class that loads and instantiates scenes.
|
||||
/// </summary>
|
||||
public class Instantiator : IInstantiator
|
||||
{
|
||||
public SceneTree SceneTree { get; }
|
||||
|
||||
public Instantiator(SceneTree sceneTree)
|
||||
{
|
||||
SceneTree = sceneTree;
|
||||
}
|
||||
|
||||
public T LoadAndInstantiate<T>(string path) where T : Node
|
||||
{
|
||||
var scene = GD.Load<PackedScene>(path);
|
||||
return scene.Instantiate<T>();
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/utils/Instantiator.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/utils/Instantiator.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://lg0ofgq38m5j
|
||||
Reference in New Issue
Block a user