Quantcast
Viewing all articles
Browse latest Browse all 36

Losing focus while pressing face buttons

Hi all,
I just got my Ouya dev kit. I got it up and running in my maven builds with libgdx and robolectric! That all being said I am having some issues with the controller. 

For some reason my app loses focus after a few button presses. Once in this state the buttons all become unresponsive for a bit. So I basically mash buttons and the app comes back. When this happens adb reports: W/InputMethodManagerService(  306): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41a4c080 attribute=null

Let me also note that this doesn't seem to happen with the d-pad, and occurs whether or not I press the A button.

Here is my input handling class. The only thing I am doing right now is changing the screen color and writing to console:

package com.angrydojo.zomglflogrcoptr.core.inputs;

import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.Color;
import tv.ouya.console.api.OuyaController;

public class HandleInput implements InputProcessor {
    public Color color;

    public HandleInput(Color color){
        super();
        this.color = color;
    }

    @Override
    public boolean keyDown (int keycode) {
        return true;
    }

    @Override
    public boolean keyUp (int keycode) {
        System.out.println("OUYA O is: " + OuyaController.BUTTON_O);
        System.out.println("OUYA U is: " + OuyaController.BUTTON_U);
        System.out.println("OUYA Y is: " + OuyaController.BUTTON_Y);
        System.out.println("OUYA A is: " + OuyaController.BUTTON_A);

        System.out.println("Current Press is: " + keycode);

        if (keycode == OuyaController.BUTTON_O || keycode == Input.Keys.ENTER) {
            color = Color.GREEN;
            return true;
        }

        if (keycode == OuyaController.BUTTON_A || keycode == Input.Keys.BACK) {
            color = Color.RED;
            return true;
        }

        if (keycode == OuyaController.BUTTON_Y) {
            color = Color.YELLOW;
            return true;
        }


        if (keycode == OuyaController.BUTTON_U) {
            color = Color.BLUE;
            return true;
        }

        return false;
    }

    @Override
    public boolean keyTyped (char character) {
        return false;
    }

    @Override
    public boolean touchDown (int x, int y, int pointer, int button) {
        return false;
    }

    @Override
    public boolean touchUp (int x, int y, int pointer, int button) {
        return false;
    }

    @Override
    public boolean touchDragged (int x, int y, int pointer) {
        return false;
    }

    @Override
    public boolean mouseMoved(int i, int i2) {
        return false;
    }

    @Override
    public boolean scrolled (int amount) {
        return false;
    }
}


Viewing all articles
Browse latest Browse all 36

Trending Articles