This commit is contained in:
Linus Vogel 2025-12-12 01:14:28 +01:00
parent 95926f7638
commit d140e8d0db

View File

@ -15,6 +15,7 @@ public partial class MainScript : Node2D
private Dictionary<string, Star> _stars = new Dictionary<string, Star>(); private Dictionary<string, Star> _stars = new Dictionary<string, Star>();
private List<Scene> _scenes = new List<Scene>(); private List<Scene> _scenes = new List<Scene>();
private Sprite2D _background = null;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
@ -78,6 +79,13 @@ public partial class MainScript : Node2D
this._stars.Clear(); this._stars.Clear();
Image bgImage = Image.LoadFromFile("resources/" + obj_conf.background);
ImageTexture bgTexture = ImageTexture.CreateFromImage(bgImage);
this._background = new Sprite2D();
this._background.SetTexture(bgTexture);
projection.AddChild(this._background);
this._background.ZIndex = 4;
foreach (StarConfig star_config in obj_conf.stars) foreach (StarConfig star_config in obj_conf.stars)
{ {
Sprite2D sprite = new Sprite2D(); Sprite2D sprite = new Sprite2D();
@ -105,6 +113,8 @@ public partial class MainScript : Node2D
child.QueueFree(); child.QueueFree();
} }
foreach (KeyValuePair<string, Star> star in this._stars) foreach (KeyValuePair<string, Star> star in this._stars)
{ {
projection.AddChild(star.Value.Sprite); projection.AddChild(star.Value.Sprite);