Commit 535e6783 authored by Maxime's avatar Maxime
Browse files

adaptative input depending on plateform

parent 37473e19
......@@ -20,7 +20,7 @@ namespace ZZZZZZ.GUI
switch (obj.Key)
{
case Key.L:
System.Console.WriteLine((GameManager.Current.LocalPlayerManager.Character as LocalCharacter).Body.Node.Position.ToString());
//System.Console.WriteLine((GameManager.Current.LocalPlayerManager.Character as LocalCharacter).Body.Node.Position.ToString());
break;
case Key.F3:
AppConfig.Current.DrawDebug = !AppConfig.Current.DrawDebug;
......
......@@ -18,7 +18,8 @@ namespace ZZZZZZ
public void SpawnPlayer()
{
LocalPlayerManager = new LocalPlayerManager(new LocalCharacter(), new KeyboardInput(), LevelManager);
LocalPlayerManager = new LocalPlayerManager(new LocalCharacter(), ToolBox.AdaptedInput(), LevelManager);
//LocalPlayerManager = new LocalPlayerManager(new LocalCharacter(), new JoystickInput(), LevelManager);
}
public void DispawnPlayer()
......@@ -73,7 +74,7 @@ namespace ZZZZZZ
{
LevelManager.Load(Assets.Levels.World0Start);
Navigation.Load(Assets.UI.Menus.Ingame);
LocalPlayerManager = new LocalPlayerManager(new LocalCharacter(joinedID), new KeyboardInput(), LevelManager);
LocalPlayerManager = new LocalPlayerManager(new LocalCharacter(joinedID), ToolBox.AdaptedInput(), LevelManager);
RemotePlayerManager = new RemotePlayerManager(new RemoteCharacter((joinedID + 1) % 2), LevelManager);
});
Task.Delay(50).Wait();
......
......@@ -2,6 +2,7 @@
using System.Net;
using System.Net.Sockets;
using Urho;
using ZZZZZZ.Inputs;
using ZZZZZZ.Objects.Character;
namespace ZZZZZZ.Utils
......@@ -156,6 +157,14 @@ namespace ZZZZZZ.Utils
var port = int.Parse(splitted[1]);
return (ip, port);
}
public static AbstractInput AdaptedInput()
{
var rt = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
if (rt.Contains("Framework"))
return new KeyboardInput();
if (rt.Contains("Mono"))
return new JoystickInput();
return new JoystickInput();
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment