mirror of
https://github.com/Stone-Red-Code/StoneRed.LogicSimulator.git
synced 2026-09-04 00:56:23 +02:00
42 lines
966 B
C#
42 lines
966 B
C#
using Microsoft.Xna.Framework;
|
|
|
|
using Myra.Graphics2D.UI;
|
|
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace StoneRed.LogicSimulator.UserInterface.Windows;
|
|
|
|
internal abstract class SrlsWindow
|
|
{
|
|
public event EventHandler? Closed;
|
|
|
|
protected Srls srls = null!;
|
|
protected Window window = null!;
|
|
|
|
public virtual bool ScalingEnabled { get; } = true;
|
|
public Vector2 Scale { get => window.Scale; set => window.Scale = value; }
|
|
|
|
protected abstract string XmmpPath { get; }
|
|
|
|
public void Load(Srls srls)
|
|
{
|
|
this.srls = srls;
|
|
|
|
string data = File.ReadAllText(Path.Combine(srls.ContentPath, XmmpPath));
|
|
window = (Window)Project.LoadFromXml(data, srls.AssetManager).Root;
|
|
window.Closed += (_, _) => Closed?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
window.Close();
|
|
}
|
|
|
|
public abstract void Initialize();
|
|
|
|
public void Show()
|
|
{
|
|
window.ShowModal(srls.Desktop);
|
|
}
|
|
} |