17.01.2021
+ WPF-Support + Game Controller System + GameKeybind System + SM_WPF_TEST
This commit is contained in:
parent
af90d617d3
commit
6f23a80f7f
60 changed files with 1536 additions and 143 deletions
40
SMOptionals/SM.Game/Controls/GameKeybindHost.cs
Normal file
40
SMOptionals/SM.Game/Controls/GameKeybindHost.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace SM.Game.Controls
|
||||
{
|
||||
public class GameKeybindHost
|
||||
{
|
||||
internal Dictionary<string, GameKeybind> _actions = new Dictionary<string, GameKeybind>();
|
||||
|
||||
public GameKeybindHost()
|
||||
{ }
|
||||
|
||||
public GameKeybindHost(GameKeybindList setup)
|
||||
{
|
||||
for (int i = 0; i < setup.Count; i++)
|
||||
{
|
||||
_actions[setup[i].Key] = setup[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Setup(string name, Func<GameKeybindContext, object> keyboard = null, Func<GameKeybindContext, object> gameController = null, Func<GameKeybindContext, object> ai = null)
|
||||
{
|
||||
GameKeybind bind;
|
||||
if (_actions.ContainsKey(name))
|
||||
{
|
||||
bind = _actions[name];
|
||||
}
|
||||
else
|
||||
{
|
||||
bind = new GameKeybind();
|
||||
_actions.Add(name, bind);
|
||||
}
|
||||
|
||||
bind.Keyboard = keyboard;
|
||||
bind.Controller = gameController;
|
||||
bind.AI = ai;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue