sandpypi/Sand.App/SandApp.Models.cs

49 lines
2.0 KiB
C#

using Raylib_cs;
using Sand.Core;
using System.Numerics;
namespace Sand.App;
internal sealed class AppState
{
public required IParticleLibrary Library { get; init; }
public required SimulationSettings Settings { get; init; }
public required ISimulationBackend Simulation { get; init; }
public required Dictionary<string, List<ParticleDef>> Categories { get; init; }
public required SettingItem[] SettingItems { get; init; }
public required byte[] UploadBuffer { get; init; }
public required string CurrentCategory { get; set; }
public required string CurrentParticle { get; set; }
public required string BackendName { get; init; }
public required int SimWidth { get; init; }
public required int SimHeight { get; init; }
public Texture2D FrameTexture { get; set; }
public int BrushRadius { get; set; }
public bool ZoomEnabled { get; set; }
public bool SettingsVisible { get; set; }
public int CategoryScrollOffset { get; set; }
public int ParticleScrollOffset { get; set; }
public int SettingsScrollOffset { get; set; }
public float SimulationAccumulator { get; set; }
public Vector2 PreviousMouse { get; set; }
public Vector2 LastWindDirection { get; set; }
public PendingWorldAction PendingWorldAction { get; set; }
public int LastSimulationStepCount { get; set; }
public long LastAppFrameTimeMicroseconds { get; set; }
public long LastUpdateTimeMicroseconds { get; set; }
public long LastSimulationLoopTimeMicroseconds { get; set; }
public long LastFrameBuildCallTimeMicroseconds { get; set; }
public long LastTextureUploadTimeMicroseconds { get; set; }
public long LastDrawTimeMicroseconds { get; set; }
public long LastAppOtherTimeMicroseconds { get; set; }
}
internal readonly record struct SettingItem(string Label, Func<bool> Get, Action Toggle);
internal readonly record struct PendingWorldAction(
bool Active,
bool IsErase,
int SimX,
int SimY,
Vector2 Mouse);