Move files from core.mimis to relevant subprojects

This commit is contained in:
2016-07-11 22:18:05 +01:00
parent c8e113cdfb
commit 60b10632d5
55 changed files with 59 additions and 71 deletions

View File

@@ -0,0 +1,3 @@
dependencies {
compile project(':core.input')
}

View File

@@ -0,0 +1,59 @@
/**
* Copyright (C) 2015 Rik Veenboer <rik.veenboer@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package mimis.device.javainput.extreme3d;
import mimis.exception.button.UnknownButtonException;
import mimis.input.Button;
import de.hardcode.jxinput.event.JXInputButtonEvent;
public enum Extreme3DButton implements Button {
ONE ("Button 0"),
TWO ("Button 1"),
THREE ("Button 2"),
FOUR ("Button 3"),
FIVE ("Button 4"),
SIX ("Button 5"),
SEVEN ("Button 6"),
EIGHT ("Button 7"),
NINE ("Button 8"),
TEN ("Button 9"),
ELEVEN ("Button 10"),
TWELVE ("Button 11");
protected String code;
private Extreme3DButton(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public static Extreme3DButton create(String code) throws UnknownButtonException {
for (Extreme3DButton button : Extreme3DButton.values()) {
if (button.getCode().equals(code)) {
return button;
}
}
throw new UnknownButtonException();
}
public static Extreme3DButton create(JXInputButtonEvent event) throws UnknownButtonException {
return create(event.getButton().getName());
}
}

View File

@@ -0,0 +1,54 @@
/**
* Copyright (C) 2015 Rik Veenboer <rik.veenboer@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package mimis.device.javainput.extreme3d;
import base.exception.worker.ActivateException;
import mimis.device.javainput.DirectionButton;
import mimis.device.javainput.JavaInputDevice;
import mimis.exception.button.UnknownButtonException;
import mimis.exception.button.UnknownDirectionException;
import mimis.input.Button;
import mimis.value.Action;
import de.hardcode.jxinput.event.JXInputButtonEvent;
import de.hardcode.jxinput.event.JXInputDirectionalEvent;
public class Extreme3DDevice extends JavaInputDevice {
protected static final String TITLE = "Extreme 3D";
protected static final String NAME = "Logitech Extreme 3D";
protected static Extreme3DTaskMapCycle taskMapCycle;
public Extreme3DDevice() {
super(TITLE, NAME);
taskMapCycle = new Extreme3DTaskMapCycle();
}
public void activate() throws ActivateException {
parser(Action.ADD, taskMapCycle.mimis);
parser(Action.ADD, taskMapCycle.player);
parser(Action.ADD, taskMapCycle.like);
super.activate();
}
protected Button getButton(JXInputButtonEvent event) throws UnknownButtonException {
return Extreme3DButton.create(event);
}
protected Button getButton(JXInputDirectionalEvent event) throws UnknownDirectionException {
return DirectionButton.create(event);
}
}

View File

@@ -0,0 +1,86 @@
/**
* Copyright (C) 2015 Rik Veenboer <rik.veenboer@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package mimis.device.javainput.extreme3d;
import mimis.device.javainput.DirectionButton;
import mimis.input.Task;
import mimis.input.state.Press;
import mimis.state.TaskMap;
import mimis.state.TaskMapCycle;
import mimis.value.Action;
import mimis.value.Target;
public class Extreme3DTaskMapCycle extends TaskMapCycle {
protected static final long serialVersionUID = 1L;
public TaskMap mimis, player, like;
public Extreme3DTaskMapCycle() {
/* Mimis */
mimis = new TaskMap();
mimis.add(
new Press(Extreme3DButton.SEVEN),
new Task(Action.PREVIOUS, Target.MAIN));
mimis.add(
new Press(Extreme3DButton.EIGHT),
new Task(Action.NEXT, Target.MAIN));
add(mimis);
/* Player */
player = new TaskMap();
player.add(
new Press(Extreme3DButton.ONE),
new Task(Action.PLAY, Target.CURRENT));
player.add(
new Press(Extreme3DButton.TWO),
new Task(Action.MUTE, Target.CURRENT));
player.add(
new Press(Extreme3DButton.NINE),
new Task(Action.SHUFFLE, Target.CURRENT));
player.add(
new Press(Extreme3DButton.TEN),
new Task(Action.REPEAT, Target.CURRENT));
player.add(
new Press(Extreme3DButton.SIX),
new Task(Action.NEXT, Target.CURRENT));
player.add(
new Press(Extreme3DButton.FOUR),
new Task(Action.PREVIOUS, Target.CURRENT));
player.add(
new Press(Extreme3DButton.FIVE),
new Task(Action.FORWARD, Target.CURRENT));
player.add(
new Press(Extreme3DButton.THREE),
new Task(Action.REWIND, Target.CURRENT));
player.add(
new Press(DirectionButton.SOUTH),
new Task(Action.VOLUME_DOWN, Target.CURRENT));
player.add(
new Press(DirectionButton.NORTH),
new Task(Action.VOLUME_UP, Target.CURRENT));
add(player);
like = new TaskMap();
like.add(
new Press(Extreme3DButton.ELEVEN),
new Task(Action.LIKE, Target.CURRENT));
like.add(
new Press(Extreme3DButton.TWELVE),
new Task(Action.DISLIKE, Target.CURRENT));
add(like);
}
}