Updated to MonoGame 3.6 + Directory refactor
- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
public enum InputType
|
||||
{
|
||||
Select,
|
||||
Use,
|
||||
Aim,
|
||||
Up, Down, Left, Right,
|
||||
Attack,
|
||||
Run, Crouch,
|
||||
Chat, CrewOrders
|
||||
}
|
||||
|
||||
public class KeyOrMouse
|
||||
{
|
||||
Keys keyBinding;
|
||||
int? mouseButton;
|
||||
|
||||
public Keys Key
|
||||
{
|
||||
get { return keyBinding; }
|
||||
}
|
||||
public int? MouseButton
|
||||
{
|
||||
get { return mouseButton; }
|
||||
}
|
||||
|
||||
public KeyOrMouse(Keys keyBinding)
|
||||
{
|
||||
this.keyBinding = keyBinding;
|
||||
}
|
||||
|
||||
public KeyOrMouse(int mouseButton)
|
||||
{
|
||||
this.mouseButton = mouseButton;
|
||||
}
|
||||
|
||||
public bool IsDown()
|
||||
{
|
||||
if (mouseButton==null)
|
||||
{
|
||||
return PlayerInput.KeyDown(keyBinding);
|
||||
}
|
||||
else if (mouseButton == 0)
|
||||
{
|
||||
return PlayerInput.LeftButtonHeld();
|
||||
}
|
||||
else if (mouseButton == 1)
|
||||
{
|
||||
return PlayerInput.RightButtonHeld();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsHit()
|
||||
{
|
||||
if (mouseButton == null)
|
||||
{
|
||||
return PlayerInput.KeyHit(keyBinding);
|
||||
}
|
||||
else if (mouseButton == 0)
|
||||
{
|
||||
return PlayerInput.LeftButtonClicked();
|
||||
}
|
||||
else if (mouseButton == 1)
|
||||
{
|
||||
return PlayerInput.RightButtonClicked();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (mouseButton==null)
|
||||
{
|
||||
return keyBinding.ToString();
|
||||
}
|
||||
else if (mouseButton==0)
|
||||
{
|
||||
return "Mouse1";
|
||||
}
|
||||
else if (mouseButton==1)
|
||||
{
|
||||
return "Mouse2";
|
||||
}
|
||||
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
||||
class Key
|
||||
{
|
||||
private bool hit, hitQueue;
|
||||
private bool held, heldQueue;
|
||||
|
||||
|
||||
KeyOrMouse binding;
|
||||
|
||||
//public bool CanBeHeld
|
||||
//{
|
||||
// get { return canBeHeld; }
|
||||
//}
|
||||
|
||||
public Key(KeyOrMouse binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
{
|
||||
return hit;
|
||||
}
|
||||
set
|
||||
{
|
||||
hit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Held
|
||||
{
|
||||
get
|
||||
{
|
||||
return held;
|
||||
}
|
||||
set
|
||||
{
|
||||
held = value;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyOrMouse State
|
||||
{
|
||||
get { return binding; }
|
||||
}
|
||||
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
|
||||
held = binding.IsDown();
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
|
||||
public void SetState(bool hit, bool held)
|
||||
{
|
||||
if (hit) hitQueue = true;
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
|
||||
public bool DequeueHit()
|
||||
{
|
||||
bool value = hitQueue;
|
||||
hitQueue = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
public bool DequeueHeld()
|
||||
{
|
||||
bool value = heldQueue;
|
||||
heldQueue = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
public bool GetHeldQueue
|
||||
{
|
||||
get { return heldQueue; }
|
||||
}
|
||||
|
||||
public bool GetHitQueue
|
||||
{
|
||||
get { return hitQueue; }
|
||||
}
|
||||
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
hit = false;
|
||||
held = false;
|
||||
}
|
||||
|
||||
public void ResetHit()
|
||||
{
|
||||
hit = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
|
||||
|
||||
public void ResetHeld()
|
||||
{
|
||||
held = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user