HLSF use long as aloloc size

This commit is contained in:
Nitload
2026-02-23 12:32:15 +08:00
parent 4bd88ccbca
commit c155cab510
552 changed files with 154266 additions and 154330 deletions
@@ -1,62 +1,62 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="BattleField"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Text;
// TODO 这玩意如何加载一个渲染流程以获得各个图元还没搞清楚
namespace StgSharp.Controls
{
public class BattleField : ControllingItem
{
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotImplementedException();
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
throw new NotImplementedException();
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="BattleField"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Text;
// TODO 这玩意如何加载一个渲染流程以获得各个图元还没搞清楚
namespace StgSharp.Controls
{
public class BattleField : ControllingItem
{
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotImplementedException();
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
throw new NotImplementedException();
}
}
}
@@ -1,149 +1,149 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ButtonGroup"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Transactions;
namespace StgSharp.Controls
{
public abstract class KeyboardButtonGroup : ControllingItem
{
private List<TriggerButton> buttonList;
private TriggerButton current;
public KeyboardButtonGroup()
{
buttonList = new List<TriggerButton>();
}
public bool IsEntity
{
get => false;
}
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotSupportedException();
}
public Rectangle BoundingBox { get; set; }
public TriggerButton CurrentButton
{
get => current;
}
public Vec2 Position { get; set; }
protected List<TriggerButton> AllButton
{
get => buttonList;
}
public void AddButton(TriggerButton button)
{
buttonList.Add(button);
}
public abstract void Confirm();
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
foreach (TriggerButton item in buttonList) {
yield return item.Single();
}
}
public void MoveDown()
{
TriggerButton button = current;
while ((button.Down != null) && button.Down.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveLeft()
{
TriggerButton button = current;
while ((button.Left != null) && button.Left.IsDisabled) {
button = button.Left;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveRight()
{
TriggerButton button = current;
while ((button.Right != null) && button.Right.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveUp()
{
TriggerButton button = current;
while ((button.Up != null) && button.Up.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ButtonGroup"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Transactions;
namespace StgSharp.Controls
{
public abstract class KeyboardButtonGroup : ControllingItem
{
private List<TriggerButton> buttonList;
private TriggerButton current;
public KeyboardButtonGroup()
{
buttonList = new List<TriggerButton>();
}
public bool IsEntity
{
get => false;
}
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotSupportedException();
}
public Rectangle BoundingBox { get; set; }
public TriggerButton CurrentButton
{
get => current;
}
public Vec2 Position { get; set; }
protected List<TriggerButton> AllButton
{
get => buttonList;
}
public void AddButton(TriggerButton button)
{
buttonList.Add(button);
}
public abstract void Confirm();
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
foreach (TriggerButton item in buttonList) {
yield return item.Single();
}
}
public void MoveDown()
{
TriggerButton button = current;
while ((button.Down != null) && button.Down.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveLeft()
{
TriggerButton button = current;
while ((button.Left != null) && button.Left.IsDisabled) {
button = button.Left;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveRight()
{
TriggerButton button = current;
while ((button.Right != null) && button.Right.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
public void MoveUp()
{
TriggerButton button = current;
while ((button.Up != null) && button.Up.IsDisabled) {
button = button.Right;
}
if (current == button) {
return;
}
current.DeHighlight();
button.Enable();
current = button;
}
}
}
@@ -1,109 +1,109 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="CharacterIndexImage"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
namespace StgSharp.Controls
{
public class CharacterLineIndexImage : ControllingItem
{
private char[] displayIndex;
private char defaultChar;
private Dictionary<char, PlainGeometryMesh> texIndex;
private int length;
private PlainGeometryMesh _tittleMesh;
public CharacterLineIndexImage(
int length,
char defaultChar,
PlainGeometryMesh tittleMesh,
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration)
{
this.length = length;
displayIndex = new char[length];
_tittleMesh = tittleMesh;
texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2);
}
public bool IsEntity
{
get => true;
}
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotSupportedException();
}
public Rectangle BoundingBox
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public Vec2 Position
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public void Display(string message)
{
if (string.IsNullOrEmpty(message)) {
message = string.Empty;
}
string result = (message.Length >= length) ?
message.Substring(message.Length - displayIndex.Length) :
message.PadLeft(
length, defaultChar);
displayIndex = result.ToCharArray();
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return _tittleMesh;
foreach (char item in displayIndex) {
yield return texIndex[item];
}
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="CharacterIndexImage"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
namespace StgSharp.Controls
{
public class CharacterLineIndexImage : ControllingItem
{
private char[] displayIndex;
private char defaultChar;
private Dictionary<char, PlainGeometryMesh> texIndex;
private int length;
private PlainGeometryMesh _tittleMesh;
public CharacterLineIndexImage(
int length,
char defaultChar,
PlainGeometryMesh tittleMesh,
IEnumerable<(char, PlainGeometryMesh)> indexEnumeration)
{
this.length = length;
displayIndex = new char[length];
_tittleMesh = tittleMesh;
texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2);
}
public bool IsEntity
{
get => true;
}
public ReadOnlySpan<Vec4> TextureBox
{
get => throw new NotSupportedException();
}
public Rectangle BoundingBox
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public Vec2 Position
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public void Display(string message)
{
if (string.IsNullOrEmpty(message)) {
message = string.Empty;
}
string result = (message.Length >= length) ?
message.Substring(message.Length - displayIndex.Length) :
message.PadLeft(
length, defaultChar);
displayIndex = result.ToCharArray();
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return _tittleMesh;
foreach (char item in displayIndex) {
yield return texIndex[item];
}
}
}
}
@@ -1,56 +1,56 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ControllingIntem"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controls
{
public interface ControllingItem : IEnumerable<PlainGeometryMesh>
{
public abstract bool IsEntity { get; }
public abstract ReadOnlySpan<Vec4> TextureBox { get; }
public abstract Rectangle BoundingBox { get; set; }
public abstract Vec2 Position { get; set; }
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ControllingIntem"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controls
{
public interface ControllingItem : IEnumerable<PlainGeometryMesh>
{
public abstract bool IsEntity { get; }
public abstract ReadOnlySpan<Vec4> TextureBox { get; }
public abstract Rectangle BoundingBox { get; set; }
public abstract Vec2 Position { get; set; }
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}
@@ -1,70 +1,70 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="DecorationBox.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace StgSharp.Controls
{
public class DecorationBox : ControllingItem
{
private PlainGeometryMesh renderMesh;
public DecorationBox(Rectangle bound, Image texture, Vec2[] texCoord)
{
renderMesh = new PlainGeometryMesh(
BoundingBox, new TextureProvider(texture, texCoord));
}
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => renderMesh.TextureCoord;
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return renderMesh;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="DecorationBox.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace StgSharp.Controls
{
public class DecorationBox : ControllingItem
{
private PlainGeometryMesh renderMesh;
public DecorationBox(Rectangle bound, Image texture, Vec2[] texCoord)
{
renderMesh = new PlainGeometryMesh(
BoundingBox, new TextureProvider(texture, texCoord));
}
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => renderMesh.TextureCoord;
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return renderMesh;
}
}
}
@@ -1,83 +1,83 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MarkingLable"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using StgSharp.Timing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Controls
{
public class MarkingLabel : ControllingItem
{
private PlainGeometryMesh marker;
private Vec2 _currentPosition, _movementVec;
public MarkingLabel(PlainGeometryMesh marker)
{
this.marker = marker;
}
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => marker.TextureCoord;
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return marker;
}
public void Move(Vec2 movement)
{
throw new NotImplementedException();
}
public void MoveTo(Vec2 target)
{
Move(target - Position);
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MarkingLable"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using StgSharp.Timing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Controls
{
public class MarkingLabel : ControllingItem
{
private PlainGeometryMesh marker;
private Vec2 _currentPosition, _movementVec;
public MarkingLabel(PlainGeometryMesh marker)
{
this.marker = marker;
}
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => marker.TextureCoord;
}
public Rectangle BoundingBox { get; set; }
public Vec2 Position { get; set; }
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return marker;
}
public void Move(Vec2 movement)
{
throw new NotImplementedException();
}
public void MoveTo(Vec2 target)
{
Move(target - Position);
}
}
}
@@ -1,213 +1,213 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TriggerButton"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Controls
{
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
public enum ButtonStatus
{
Error = 0b0,
Disable = 0b1,
Enable = 0b10,
Highlight = 0b100,
Confirm = 0b1000,
DisableToEnable = Disable | Enable,
EnableToDisable = -(Enable | DisableToEnable),
EnableToHighlight = Enable | Highlight,
HighlightToEnable = -(Enable | Highlight),
HighlightToDisable = -(Highlight | Disable),
}
public class TriggerButton : ControllingItem
{
private Action? confirmCallback;
private Action? disableCallback;
#nullable enable
private Action? enableCallback;
private float _statusBeginTime;
private RenderButtonTextureCallback _renderButton;
private TextureProvider _texture;
#nullable restore
public TriggerButton()
{
CurrentStatus = ButtonStatus.Disable;
}
public event Action ConfirmEvent
{
add { confirmCallback += value; }
remove { confirmCallback -= value; }
}
public event Action DisableEvent
{
add { disableCallback += value; }
remove { disableCallback -= value; }
}
public event Action EnableEvent
{
add { enableCallback += value; }
remove { enableCallback -= value; }
}
public event RenderButtonTextureCallback RenderButtonTexture
{
add
{
if (_renderButton == null)
{
_renderButton = value;
} else
{
_renderButton += value;
}
}
remove
{
if (_renderButton != null) {
_renderButton -= value;
}
}
}
public bool IsHighLighted { get; internal set; }
public bool IsDisabled { get; internal set; }
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
get => MemoryMarshal.Cast<Vec2, Vec4>(_texture.TextureCoordinate);
}
public Rectangle BoundingBox { get; set; }
public TriggerButton Left { get; internal set; }
public TriggerButton Right { get; internal set; }
public TriggerButton Up { get; internal set; }
public TriggerButton Down { get; internal set; }
public Vec2 Position { get; set; }
internal TextureProvider Texture
{
get => _texture;
set => _texture = value;
}
protected ButtonStatus CurrentStatus { get; set; }
public void DeHighlight()
{
if (CurrentStatus == ButtonStatus.Highlight) {
CurrentStatus = ButtonStatus.HighlightToEnable;
}
}
public void Disable()
{
CurrentStatus = CurrentStatus switch
{
ButtonStatus.Enable => ButtonStatus.EnableToDisable,
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
_ => CurrentStatus,
};
if (disableCallback != null) {
disableCallback();
}
}
public void Enable()
{
if (CurrentStatus == ButtonStatus.Disable)
{
CurrentStatus = ButtonStatus.DisableToEnable;
} else
{
return;
}
if (enableCallback != null) {
enableCallback();
}
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
_renderButton(CurrentStatus, _statusBeginTime, in _texture);
yield return new PlainGeometryMesh(this.BoundingBox, _texture);
}
public void Highlight()
{
if (CurrentStatus == ButtonStatus.Enable)
{
CurrentStatus |= ButtonStatus.EnableToHighlight;
} else
{
return;
}
if (confirmCallback != null) {
confirmCallback();
}
}
internal void Init(ButtonStatus status)
{
if (CurrentStatus == ButtonStatus.Error) {
CurrentStatus = status;
}
}
}//----------------------------------- End of class --------------------------------------------
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TriggerButton"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Controls
{
public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture);
public enum ButtonStatus
{
Error = 0b0,
Disable = 0b1,
Enable = 0b10,
Highlight = 0b100,
Confirm = 0b1000,
DisableToEnable = Disable | Enable,
EnableToDisable = -(Enable | DisableToEnable),
EnableToHighlight = Enable | Highlight,
HighlightToEnable = -(Enable | Highlight),
HighlightToDisable = -(Highlight | Disable),
}
public class TriggerButton : ControllingItem
{
private Action? confirmCallback;
private Action? disableCallback;
#nullable enable
private Action? enableCallback;
private float _statusBeginTime;
private RenderButtonTextureCallback _renderButton;
private TextureProvider _texture;
#nullable restore
public TriggerButton()
{
CurrentStatus = ButtonStatus.Disable;
}
public event Action ConfirmEvent
{
add { confirmCallback += value; }
remove { confirmCallback -= value; }
}
public event Action DisableEvent
{
add { disableCallback += value; }
remove { disableCallback -= value; }
}
public event Action EnableEvent
{
add { enableCallback += value; }
remove { enableCallback -= value; }
}
public event RenderButtonTextureCallback RenderButtonTexture
{
add
{
if (_renderButton == null)
{
_renderButton = value;
} else
{
_renderButton += value;
}
}
remove
{
if (_renderButton != null) {
_renderButton -= value;
}
}
}
public bool IsHighLighted { get; internal set; }
public bool IsDisabled { get; internal set; }
public bool IsEntity => true;
public ReadOnlySpan<Vec4> TextureBox
{
get => MemoryMarshal.Cast<Vec2, Vec4>(_texture.TextureCoordinate);
}
public Rectangle BoundingBox { get; set; }
public TriggerButton Left { get; internal set; }
public TriggerButton Right { get; internal set; }
public TriggerButton Up { get; internal set; }
public TriggerButton Down { get; internal set; }
public Vec2 Position { get; set; }
internal TextureProvider Texture
{
get => _texture;
set => _texture = value;
}
protected ButtonStatus CurrentStatus { get; set; }
public void DeHighlight()
{
if (CurrentStatus == ButtonStatus.Highlight) {
CurrentStatus = ButtonStatus.HighlightToEnable;
}
}
public void Disable()
{
CurrentStatus = CurrentStatus switch
{
ButtonStatus.Enable => ButtonStatus.EnableToDisable,
ButtonStatus.Highlight => ButtonStatus.HighlightToDisable,
_ => CurrentStatus,
};
if (disableCallback != null) {
disableCallback();
}
}
public void Enable()
{
if (CurrentStatus == ButtonStatus.Disable)
{
CurrentStatus = ButtonStatus.DisableToEnable;
} else
{
return;
}
if (enableCallback != null) {
enableCallback();
}
}
public IEnumerator<PlainGeometryMesh> GetEnumerator()
{
_renderButton(CurrentStatus, _statusBeginTime, in _texture);
yield return new PlainGeometryMesh(this.BoundingBox, _texture);
}
public void Highlight()
{
if (CurrentStatus == ButtonStatus.Enable)
{
CurrentStatus |= ButtonStatus.EnableToHighlight;
} else
{
return;
}
if (confirmCallback != null) {
confirmCallback();
}
}
internal void Init(ButtonStatus status)
{
if (CurrentStatus == ButtonStatus.Error) {
CurrentStatus = status;
}
}
}//----------------------------------- End of class --------------------------------------------
}
+234 -234
View File
@@ -1,234 +1,234 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyEnum"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using System;
namespace StgSharp
{
public enum KeyboardKey : int
{
UNKNOWN = -1,
None = 0,
Space = 32,
Apostrophe = 39/*'*/,
Comma = 44/*,*/,
Minus = 45/*-*/,
Period = 46/*.*/,
Slash = 47/*/*/,
Zero = 48,
One = 49,
Two = 50,
Three = 51,
Four = 52,
Five = 53,
Six = 54,
Seven = 55,
Eight = 56,
Nine = 57,
Semicolon = 59/*,*/,
Equal = 61/*=*/,
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
LeftBracket = 91/*[*/,
BACKSLASH = 92/*\*/,
RightBracket = 93/*]*/,
GraveAccent = 96/*`*/,
World1 = 161/*non-US#1*/,
World2 = 162/*non-US#2*/,
Esc = 256,
Enter = 257,
Tab = 258,
Backspace = 259,
Insert = 260,
Delete = 261,
Right = 262,
Left = 263,
Down = 264,
Up = 265,
PgUp = 266,
PgDown = 267,
Home = 268,
End = 269,
CapsLock = 280,
ScrollLock = 281,
NumLock = 282,
PrintScreen = 283,
Pause = 284,
F1 = 290,
F2 = 291,
F3 = 292,
F4 = 293,
F5 = 294,
F6 = 295,
F7 = 296,
F8 = 297,
F9 = 298,
F10 = 299,
F11 = 300,
F12 = 301,
F13 = 302,
F14 = 303,
F15 = 304,
F16 = 305,
F17 = 306,
F18 = 307,
F19 = 308,
F20 = 309,
F21 = 310,
F22 = 311,
F23 = 312,
F24 = 313,
F25 = 314,
NumPad0 = 320,
NumPad1 = 321,
NumPad2 = 322,
NumPad3 = 323,
NumPad4 = 324,
NumPad5 = 325,
NumPad6 = 326,
NumPad7 = 327,
NumPad8 = 328,
NumPad9 = 329,
NumPadDec = 330,
NumPadDiv = 331,
NumPadMul = 332,
NumPadSub = 333,
NumPadAdd = 334,
NumPadAnter = 335,
NumPadEqual = 336,
LeftShift = 340,
LeftControl = 341,
LeftAlt = 342,
LeftSuper = 343,
RightShift = 344,
RightControl = 345,
RightAlt = 346,
RightSuper = 347,
Menu = 348,
First = Space,
Last = Menu,
}
#pragma warning disable CA1707
#pragma warning disable CA1712
#pragma warning disable CA1008
#pragma warning disable CA1027
public enum Joystick : int
#pragma warning restore CA1027
{
Joystick_1 = FrameworkConstant. JOYSTICK_1,
Joystick_2 = FrameworkConstant. JOYSTICK_2,
Joystick_3 = FrameworkConstant. JOYSTICK_3,
Joystick_4 = FrameworkConstant. JOYSTICK_4,
Joystick_5 = FrameworkConstant. JOYSTICK_5,
Joystick_6 = FrameworkConstant. JOYSTICK_6,
Joystick_7 = FrameworkConstant. JOYSTICK_7,
Joystick_8 = FrameworkConstant. JOYSTICK_8,
Joystick_9 = FrameworkConstant. JOYSTICK_9,
Joystick_10 = FrameworkConstant.JOYSTICK_10,
Joystick_11 = FrameworkConstant.JOYSTICK_11,
Joystick_12 = FrameworkConstant.JOYSTICK_12,
Joystick_13 = FrameworkConstant.JOYSTICK_13,
Joystick_14 = FrameworkConstant.JOYSTICK_14,
Joystick_15 = FrameworkConstant.JOYSTICK_15,
Joystick_16 = FrameworkConstant.JOYSTICK_16,
First = Joystick_1,
Last = Joystick_16
}
[System.Flags]
public enum Mouse : int
{
Button1 = 0,
Button2 = 1,
Button3 = 2,
Button4 = 3,
Button5 = 4,
Button6 = 5,
Button7 = 6,
Button8 = 7,
First = Button1,
Last = Button8,
Left = Button1,
Right = Button2,
Middle = Button3
}
#pragma warning restore CA1707
#pragma warning restore CA1712
#pragma warning restore CA7008
internal enum InputEquipment
{
Keyboard,
Mouse,
Joystick
}
public enum KeyStatus : int
{
RELEASE = 0,
PRESS = 1
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyEnum"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using System;
namespace StgSharp
{
public enum KeyboardKey : int
{
UNKNOWN = -1,
None = 0,
Space = 32,
Apostrophe = 39/*'*/,
Comma = 44/*,*/,
Minus = 45/*-*/,
Period = 46/*.*/,
Slash = 47/*/*/,
Zero = 48,
One = 49,
Two = 50,
Three = 51,
Four = 52,
Five = 53,
Six = 54,
Seven = 55,
Eight = 56,
Nine = 57,
Semicolon = 59/*,*/,
Equal = 61/*=*/,
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
LeftBracket = 91/*[*/,
BACKSLASH = 92/*\*/,
RightBracket = 93/*]*/,
GraveAccent = 96/*`*/,
World1 = 161/*non-US#1*/,
World2 = 162/*non-US#2*/,
Esc = 256,
Enter = 257,
Tab = 258,
Backspace = 259,
Insert = 260,
Delete = 261,
Right = 262,
Left = 263,
Down = 264,
Up = 265,
PgUp = 266,
PgDown = 267,
Home = 268,
End = 269,
CapsLock = 280,
ScrollLock = 281,
NumLock = 282,
PrintScreen = 283,
Pause = 284,
F1 = 290,
F2 = 291,
F3 = 292,
F4 = 293,
F5 = 294,
F6 = 295,
F7 = 296,
F8 = 297,
F9 = 298,
F10 = 299,
F11 = 300,
F12 = 301,
F13 = 302,
F14 = 303,
F15 = 304,
F16 = 305,
F17 = 306,
F18 = 307,
F19 = 308,
F20 = 309,
F21 = 310,
F22 = 311,
F23 = 312,
F24 = 313,
F25 = 314,
NumPad0 = 320,
NumPad1 = 321,
NumPad2 = 322,
NumPad3 = 323,
NumPad4 = 324,
NumPad5 = 325,
NumPad6 = 326,
NumPad7 = 327,
NumPad8 = 328,
NumPad9 = 329,
NumPadDec = 330,
NumPadDiv = 331,
NumPadMul = 332,
NumPadSub = 333,
NumPadAdd = 334,
NumPadAnter = 335,
NumPadEqual = 336,
LeftShift = 340,
LeftControl = 341,
LeftAlt = 342,
LeftSuper = 343,
RightShift = 344,
RightControl = 345,
RightAlt = 346,
RightSuper = 347,
Menu = 348,
First = Space,
Last = Menu,
}
#pragma warning disable CA1707
#pragma warning disable CA1712
#pragma warning disable CA1008
#pragma warning disable CA1027
public enum Joystick : int
#pragma warning restore CA1027
{
Joystick_1 = FrameworkConstant. JOYSTICK_1,
Joystick_2 = FrameworkConstant. JOYSTICK_2,
Joystick_3 = FrameworkConstant. JOYSTICK_3,
Joystick_4 = FrameworkConstant. JOYSTICK_4,
Joystick_5 = FrameworkConstant. JOYSTICK_5,
Joystick_6 = FrameworkConstant. JOYSTICK_6,
Joystick_7 = FrameworkConstant. JOYSTICK_7,
Joystick_8 = FrameworkConstant. JOYSTICK_8,
Joystick_9 = FrameworkConstant. JOYSTICK_9,
Joystick_10 = FrameworkConstant.JOYSTICK_10,
Joystick_11 = FrameworkConstant.JOYSTICK_11,
Joystick_12 = FrameworkConstant.JOYSTICK_12,
Joystick_13 = FrameworkConstant.JOYSTICK_13,
Joystick_14 = FrameworkConstant.JOYSTICK_14,
Joystick_15 = FrameworkConstant.JOYSTICK_15,
Joystick_16 = FrameworkConstant.JOYSTICK_16,
First = Joystick_1,
Last = Joystick_16
}
[System.Flags]
public enum Mouse : int
{
Button1 = 0,
Button2 = 1,
Button3 = 2,
Button4 = 3,
Button5 = 4,
Button6 = 5,
Button7 = 6,
Button8 = 7,
First = Button1,
Last = Button8,
Left = Button1,
Right = Button2,
Middle = Button3
}
#pragma warning restore CA1707
#pragma warning restore CA1712
#pragma warning restore CA7008
internal enum InputEquipment
{
Keyboard,
Mouse,
Joystick
}
public enum KeyStatus : int
{
RELEASE = 0,
PRESS = 1
}
}
@@ -1,66 +1,66 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyEventAttribute"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
[AttributeUsage(AttributeTargets.Method)]
public class KeyEventAttribute : Attribute
{
internal int _equipment;
internal int _keyStat;
internal int _keyTarget;
public KeyEventAttribute(KeyboardKey key, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)key;
_keyStat = (int)status;
}
public KeyEventAttribute(Joystick joystick, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)joystick;
_keyStat = (int)status;
}
public KeyEventAttribute(Mouse mouse, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)mouse;
_keyStat = (int)status;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyEventAttribute"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
[AttributeUsage(AttributeTargets.Method)]
public class KeyEventAttribute : Attribute
{
internal int _equipment;
internal int _keyStat;
internal int _keyTarget;
public KeyEventAttribute(KeyboardKey key, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)key;
_keyStat = (int)status;
}
public KeyEventAttribute(Joystick joystick, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)joystick;
_keyStat = (int)status;
}
public KeyEventAttribute(Mouse mouse, KeyStatus status)
{
_equipment = (int)InputEquipment.Keyboard;
_keyTarget = (int)mouse;
_keyStat = (int)status;
}
}
}
@@ -1,42 +1,42 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="IClickTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public interface IClickTrigger
{
public int TargetKeyOrButtonID { get; }
public KeyStatus TriggeredStatus { get; }
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="IClickTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public interface IClickTrigger
{
public int TargetKeyOrButtonID { get; }
public KeyStatus TriggeredStatus { get; }
}
}
@@ -1,86 +1,86 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="JoystickTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct JoystickTrigger : IClickTrigger, IEquatable<JoystickTrigger>
{
private readonly Joystick _stick;
private readonly KeyStatus _status;
public JoystickTrigger(Joystick targetKey, KeyStatus status)
{
this._stick = targetKey;
_status = status;
}
public int TargetKeyOrButtonID => (int)_stick;
public Joystick Stick
{
get => _stick;
}
public KeyStatus TriggeredStatus => _status;
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return ((int)_stick) + (17 * ((int)_status));
}
public override string ToString()
{
return $"Key {_stick} triggered when {_status}";
}
public static bool operator !=(JoystickTrigger left, JoystickTrigger right)
{
return !(left == right);
}
public static bool operator ==(JoystickTrigger left, JoystickTrigger right)
{
return (left._status == right._status) && (left._stick == right._stick);
}
bool IEquatable<JoystickTrigger>.Equals(JoystickTrigger other)
{
return other == this;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="JoystickTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct JoystickTrigger : IClickTrigger, IEquatable<JoystickTrigger>
{
private readonly Joystick _stick;
private readonly KeyStatus _status;
public JoystickTrigger(Joystick targetKey, KeyStatus status)
{
this._stick = targetKey;
_status = status;
}
public int TargetKeyOrButtonID => (int)_stick;
public Joystick Stick
{
get => _stick;
}
public KeyStatus TriggeredStatus => _status;
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return ((int)_stick) + (17 * ((int)_status));
}
public override string ToString()
{
return $"Key {_stick} triggered when {_status}";
}
public static bool operator !=(JoystickTrigger left, JoystickTrigger right)
{
return !(left == right);
}
public static bool operator ==(JoystickTrigger left, JoystickTrigger right)
{
return (left._status == right._status) && (left._stick == right._stick);
}
bool IEquatable<JoystickTrigger>.Equals(JoystickTrigger other)
{
return other == this;
}
}
}
@@ -1,82 +1,82 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct KeyTrigger : IClickTrigger, IEquatable<KeyTrigger>
{
private readonly KeyboardKey _targetKey;
private readonly KeyStatus _triggerStat;
public KeyTrigger(KeyboardKey targetKey, KeyStatus targetStat)
{
this._targetKey = targetKey;
this._triggerStat = targetStat;
}
public int TargetKeyOrButtonID => (int)_targetKey;
public KeyStatus TriggeredStatus => _triggerStat;
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return ((int)_targetKey) + (17 * ((int)_triggerStat));
}
public override string ToString()
{
return $"Key {_targetKey} triggered when {_triggerStat}";
}
public static bool operator !=(KeyTrigger left, KeyTrigger right)
{
return !(left == right);
}
public static bool operator ==(KeyTrigger left, KeyTrigger right)
{
return (left._triggerStat == right._triggerStat) && (left._targetKey == right._targetKey);
}
bool IEquatable<KeyTrigger>.Equals(KeyTrigger other)
{
return other == this;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="KeyTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct KeyTrigger : IClickTrigger, IEquatable<KeyTrigger>
{
private readonly KeyboardKey _targetKey;
private readonly KeyStatus _triggerStat;
public KeyTrigger(KeyboardKey targetKey, KeyStatus targetStat)
{
this._targetKey = targetKey;
this._triggerStat = targetStat;
}
public int TargetKeyOrButtonID => (int)_targetKey;
public KeyStatus TriggeredStatus => _triggerStat;
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return ((int)_targetKey) + (17 * ((int)_triggerStat));
}
public override string ToString()
{
return $"Key {_targetKey} triggered when {_triggerStat}";
}
public static bool operator !=(KeyTrigger left, KeyTrigger right)
{
return !(left == right);
}
public static bool operator ==(KeyTrigger left, KeyTrigger right)
{
return (left._triggerStat == right._triggerStat) && (left._targetKey == right._targetKey);
}
bool IEquatable<KeyTrigger>.Equals(KeyTrigger other)
{
return other == this;
}
}
}
@@ -1,69 +1,69 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MouseTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Diagnostics.SymbolStore;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct MouseTrigger : IClickTrigger, IEquatable<MouseTrigger>
{
private readonly KeyStatus _status;
private readonly Mouse _mouse;
public MouseTrigger(Mouse mouse, KeyStatus status)
{
_mouse = mouse;
_status = status;
}
public int TargetKeyOrButtonID => (int)_mouse;
public KeyStatus TriggeredStatus => _status;
public bool Equals(MouseTrigger other)
{
return this == other;
}
public static bool operator !=(MouseTrigger left, MouseTrigger right)
{
return left._mouse != right._mouse || left._status != right._status;
}
public static bool operator ==(MouseTrigger left, MouseTrigger right)
{
return left._mouse == right._mouse && left._status == right._status;
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MouseTrigger"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Diagnostics.SymbolStore;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public readonly struct MouseTrigger : IClickTrigger, IEquatable<MouseTrigger>
{
private readonly KeyStatus _status;
private readonly Mouse _mouse;
public MouseTrigger(Mouse mouse, KeyStatus status)
{
_mouse = mouse;
_status = status;
}
public int TargetKeyOrButtonID => (int)_mouse;
public KeyStatus TriggeredStatus => _status;
public bool Equals(MouseTrigger other)
{
return this == other;
}
public static bool operator !=(MouseTrigger left, MouseTrigger right)
{
return left._mouse != right._mouse || left._status != right._status;
}
public static bool operator ==(MouseTrigger left, MouseTrigger right)
{
return left._mouse == right._mouse && left._status == right._status;
}
}
}
@@ -1,88 +1,88 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TriggetFactory"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public static class TriggetBuilder
{
private const int JoystickMax = (int)Joystick.Last + 1;
private const int JoystickMin = (int)Joystick.First - 1;
private const int KeyboardMax = (int)KeyboardKey.Last + 1;
private const int KeyboardMin = (int)KeyboardKey.First - 1;
private const int MouseMax = (int)Mouse.Last + 1;
private const int MouseMin = (int)Mouse.First - 1;
private static KeyTrigger keyboardtemp;
private static MouseTrigger mousetemp;
public static JoystickTrigger BuildJoystickClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode > MouseMin && keyCode < MouseMax) {
return new JoystickTrigger((Joystick)keyCode, status);
}
throw new InvalidOperationException("Known key code or key is not on joystick.");
}
public static KeyTrigger BuildKeyboardClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger((KeyboardKey)keyCode, status);
}
throw new InvalidOperationException("Known key code or kay is not on keyboard.");
}
public static MouseTrigger BuildMouseClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger((Mouse)keyCode, status);
}
throw new InvalidOperationException("Known key code or key is not on mouse.");
}
public static IClickTrigger BuildTrigger(int keyCode, KeyStatus status)
{
if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger((KeyboardKey)keyCode, status);
}
if (keyCode > JoystickMin && keyCode < JoystickMax) {
return new JoystickTrigger((Joystick)keyCode, status);
}
if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger((Mouse)keyCode, status);
}
throw new InvalidOperationException("Known key code.");
}
}
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TriggetFactory"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Controlling.UsrActivity
{
public static class TriggetBuilder
{
private const int JoystickMax = (int)Joystick.Last + 1;
private const int JoystickMin = (int)Joystick.First - 1;
private const int KeyboardMax = (int)KeyboardKey.Last + 1;
private const int KeyboardMin = (int)KeyboardKey.First - 1;
private const int MouseMax = (int)Mouse.Last + 1;
private const int MouseMin = (int)Mouse.First - 1;
private static KeyTrigger keyboardtemp;
private static MouseTrigger mousetemp;
public static JoystickTrigger BuildJoystickClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode > MouseMin && keyCode < MouseMax) {
return new JoystickTrigger((Joystick)keyCode, status);
}
throw new InvalidOperationException("Known key code or key is not on joystick.");
}
public static KeyTrigger BuildKeyboardClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger((KeyboardKey)keyCode, status);
}
throw new InvalidOperationException("Known key code or kay is not on keyboard.");
}
public static MouseTrigger BuildMouseClickTrigger(int keyCode, KeyStatus status)
{
if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger((Mouse)keyCode, status);
}
throw new InvalidOperationException("Known key code or key is not on mouse.");
}
public static IClickTrigger BuildTrigger(int keyCode, KeyStatus status)
{
if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger((KeyboardKey)keyCode, status);
}
if (keyCode > JoystickMin && keyCode < JoystickMax) {
return new JoystickTrigger((Joystick)keyCode, status);
}
if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger((Mouse)keyCode, status);
}
throw new InvalidOperationException("Known key code.");
}
}
}