Quantcast
Viewing latest article 16
Browse Latest Browse All 36

Can't get input controllers working in MonoGame.

My game is loading on devkits fine, and it runs, but the only input that's being picked up at all is touchpad movement.

I'm pasting my Activity file below... I can't for the life of me figure out what I might be doing wrong...


using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Content;
using Android.Widget;
using System;
using Ouya.Console.Api;

namespace ColourThiefOuya
{
    [Activity(Label = "ColourThiefOuya"
        , MainLauncher = true
        , Icon = "@drawable/icon"
        , Theme = "@style/Theme.Splash"
        , AlwaysRetainTaskState = true
        , LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
        , ScreenOrientation = ScreenOrientation.SensorLandscape
        , ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
    [IntentFilter(new[] { Intent.ActionMain }
        , Categories = new[] { Intent.CategoryLauncher, OuyaIntent.CategoryGame })]
    public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
Ouya.Console.Api.OuyaFacade.Instance.Init(this, "f6981bd4-ce09-4ed0-9466-040114c6cca4");

base.OnCreate(bundle);


            ColorThief.Game1.Activity = this;
            var g = new ColorThief.Game1();
            SetContentView(g.Window);
            g.Run();
        }


public override bool OnKeyDown (Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
{
Console.Out.WriteLine ("entered OnKeyDown");
//int player = OuyaController.GetPlayerNumByDeviceId (e.DeviceId);

return ColorThief.Controls.OuyaControl.ButtonDown(keyCode, e)
|| base.OnKeyDown (keyCode, e);
}

public override bool OnKeyUp (Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
{
Console.Out.WriteLine ("entered OnKeyUp");
return ColorThief.Controls.OuyaControl.ButtonUp(keyCode, e)
|| base.OnKeyUp (keyCode, e);
}

public override bool OnGenericMotionEvent (Android.Views.MotionEvent e)
{
Console.Out.WriteLine ("entered OnGenericMotionEvent");
switch (e.ActionMasked) {
case Android.Views.MotionEventActions.Move: // joystick move
ColorThief.Controls.OuyaControl.HandleMove(e);
break;

case Android.Views.MotionEventActions.HoverMove: // touchpad move
break;
}

return true;
}
    }
}


Viewing latest article 16
Browse Latest Browse All 36

Trending Articles