Compare commits
2 Commits
bef27762ee
...
11423d86e5
| Author | SHA1 | Date | |
|---|---|---|---|
| 11423d86e5 | |||
| 828ec4973f |
@@ -115,7 +115,7 @@ public class TestGame : Game
|
|||||||
{
|
{
|
||||||
if (Input.IsActionPressed("reload"))
|
if (Input.IsActionPressed("reload"))
|
||||||
{
|
{
|
||||||
ResourceManager.Reload();
|
// ResourceManager.Reload();
|
||||||
// _particleSystem!.RestartEmitter(_emitterId);
|
// _particleSystem!.RestartEmitter(_emitterId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,23 @@ namespace Voile;
|
|||||||
|
|
||||||
public class GridSet<T>
|
public class GridSet<T>
|
||||||
{
|
{
|
||||||
public float GridSize { get; }
|
/// <summary>
|
||||||
public GridSet(float gridSize = 32.0f)
|
/// The size of a cell of this <see cref="GridSet"/>.
|
||||||
|
/// </summary>
|
||||||
|
public float CellSize { get; }
|
||||||
|
public GridSet(float cellSize = 32.0f)
|
||||||
{
|
{
|
||||||
GridSize = gridSize;
|
CellSize = cellSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add an element to this <see cref="GridSet"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">Position of the element in this <see cref="GridSet"/>.</param>
|
||||||
|
/// <param name="child">Element to add.</param>
|
||||||
public void Add(Vector2 position, T child)
|
public void Add(Vector2 position, T child)
|
||||||
{
|
{
|
||||||
var snap = Vector2.One * GridSize;
|
var snap = Vector2.One * CellSize;
|
||||||
position = position.Snapped(snap);
|
position = position.Snapped(snap);
|
||||||
|
|
||||||
if (_values.TryGetValue(position, out var list))
|
if (_values.TryGetValue(position, out var list))
|
||||||
@@ -28,10 +36,11 @@ public class GridSet<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(T child)
|
/// <summary>
|
||||||
{
|
/// Removes an element from this <see cref="GridSet"/>.
|
||||||
|
/// </summary>
|
||||||
}
|
/// <param name="child">Element to remove.</param>
|
||||||
|
public void Remove(T child) => throw new NotImplementedException();
|
||||||
|
|
||||||
private Dictionary<Vector2, List<T>> _values = new();
|
private Dictionary<Vector2, List<T>> _values = new();
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,6 @@ namespace Voile.Resources
|
|||||||
| NotifyFilters.CreationTime
|
| NotifyFilters.CreationTime
|
||||||
| NotifyFilters.DirectoryName
|
| NotifyFilters.DirectoryName
|
||||||
| NotifyFilters.FileName
|
| NotifyFilters.FileName
|
||||||
| NotifyFilters.LastAccess
|
|
||||||
| NotifyFilters.LastWrite
|
| NotifyFilters.LastWrite
|
||||||
| NotifyFilters.Security
|
| NotifyFilters.Security
|
||||||
| NotifyFilters.Size;
|
| NotifyFilters.Size;
|
||||||
|
|||||||
@@ -3,19 +3,48 @@ using Voile.Input;
|
|||||||
|
|
||||||
namespace Voile.UI;
|
namespace Voile.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Input information for UI elements.
|
||||||
|
/// </summary>
|
||||||
public class UIInputContext
|
public class UIInputContext
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Current action handled by this <see cref="UIElement"/>.
|
||||||
|
/// </summary>
|
||||||
public IInputAction Action { get; }
|
public IInputAction Action { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Current mouse position.
|
||||||
|
/// </summary>
|
||||||
public Vector2 MousePosition { get; }
|
public Vector2 MousePosition { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if a mouse button was pressed.
|
||||||
|
/// </summary>
|
||||||
public bool MousePressed { get; set; }
|
public bool MousePressed { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if a mouse button was released.
|
||||||
|
/// </summary>
|
||||||
public bool MouseReleased { get; set; }
|
public bool MouseReleased { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if a mouse button is currently held.
|
||||||
|
/// </summary>
|
||||||
public bool MouseDown { get; set; }
|
public bool MouseDown { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the current <see cref="IInputAction"/>.
|
||||||
|
/// </summary>
|
||||||
public string ActionName { get; }
|
public string ActionName { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Keycode of a currently pressed character.
|
||||||
|
/// </summary>
|
||||||
public int CharPressed { get; }
|
public int CharPressed { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if this <see cref="UIInputContext"/> registered any character input from keyboard.
|
||||||
|
/// </summary>
|
||||||
public bool HasCharInput => CharPressed != 0;
|
public bool HasCharInput => CharPressed != 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if this context's input was already handled and no longer needs to be processed.
|
||||||
|
/// </summary>
|
||||||
public bool Handled => _handled;
|
public bool Handled => _handled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user