forked from tlitookilakin/AeroCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureTest.cs
More file actions
54 lines (52 loc) · 1.74 KB
/
Copy pathFeatureTest.cs
File metadata and controls
54 lines (52 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using AeroCore.Models;
using AeroCore.Particles;
using AeroCore.Utils;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using System;
namespace AeroCore
{
#if DEBUG
[ModInit]
#endif
internal class FeatureTest
{
private static IParticleManager particles;
private static Emitter emitter;
internal static void Init()
{
Patches.Action.ActionCursors.Add("Mailbox", 1);
emitter = new Emitter()
{
Region = new(0, 0, 64, 64),
Rate = 100
};
particles = ModEntry.api.CreateParticleSystem(ModEntry.helper.ModContent, "assets/MouseParticle.json", emitter, 100);
ModEntry.helper.Events.GameLoop.UpdateTicked += Tick;
ModEntry.helper.Events.Display.RenderedHud += Draw;
ModEntry.helper.Events.Input.CursorMoved += MouseMoved;
//ModEntry.helper.Events.Input.ButtonReleased += KeyReleased;
particles.Tick(0);
}
private static void KeyReleased(object _, ButtonReleasedEventArgs ev)
{
if (ev.IsSuppressed())
return;
}
private static void MouseMoved(object _, CursorMovedEventArgs ev)
{
emitter.Region = new(Game1.getMousePosition(), emitter.Region.Size);
particles.Offset = ev.NewPosition.ScreenPixels / 100f;
}
private static void Tick(object _, UpdateTickedEventArgs ev)
{
particles.Tick((int)Game1.currentGameTime.ElapsedGameTime.TotalMilliseconds);
}
private static void Draw(object _, RenderedHudEventArgs ev)
{
particles.Draw(ev.SpriteBatch);
}
}
}