Modified:
/trunk/v2/resources/res/data/config/userDefaults.properties
/trunk/v2/src/com/customwars/client/ui/state/COSelectState.java
/trunk/v2/src/com/customwars/client/ui/state/CWState.java
/trunk/v2/src/com/customwars/client/ui/state/ControlBindingState.java
/trunk/v2/src/com/customwars/client/ui/state/InGameState.java
=======================================
--- /trunk/v2/resources/res/data/config/userDefaults.properties Sun Feb 27
05:21:21 2011
+++ /trunk/v2/resources/res/data/config/userDefaults.properties Mon Mar 14
06:42:50 2011
@@ -1,7 +1,4 @@
# USER DEFAULTS, use user.properties to overwrite defaults.
-# Button0 == Left mouse button (Reserved for selecting, don't use)
-# Button1 == Right mouse button
-#
# The left part is a command defined in
com.customwars.client.ui.state.CwInput
# it cannot have spaces and is in lower case.
#
@@ -9,7 +6,7 @@
# keyboard keys are always without the KEY_ prefix, duplicates are ignored.
#
user.input.select=w,a
-user.input.cancel=b,x,Button1
+user.input.cancel=b,x
user.input.toggle_music=m
user.input.toggle_fps=F4
user.input.toggle_console=F2
=======================================
--- /trunk/v2/src/com/customwars/client/ui/state/COSelectState.java Sun
Jul 4 03:56:52 2010
+++ /trunk/v2/src/com/customwars/client/ui/state/COSelectState.java Mon Mar
14 06:42:50 2011
@@ -214,9 +214,12 @@
}
@Override
- public void mouseClicked(int button, int x, int y, int clickCount) {
- if (isMouseWithinCOFramework(x, y)) {
- selectCurrentCO();
+ public void mousePressed(int button, int x, int y) {
+ super.mousePressed(button, x, y);
+ if (button == Input.MOUSE_LEFT_BUTTON) {
+ if (isMouseWithinCOFramework(x, y)) {
+ selectCurrentCO();
+ }
}
}
=======================================
--- /trunk/v2/src/com/customwars/client/ui/state/CWState.java Mon Mar 22
05:56:20 2010
+++ /trunk/v2/src/com/customwars/client/ui/state/CWState.java Mon Mar 14
06:42:50 2011
@@ -6,6 +6,7 @@
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
+import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
@@ -14,8 +15,6 @@
* A state that CW can be in, examples MainMenu, EndTurn, InGame
* each state can listen for input commands(Select, Cancel,
menuUp,menuDown etc)
* by overwriting controlPressed(Command command)
- *
- * @author stefan
*/
public abstract class CWState extends BasicGameState {
protected static StateChanger stateChanger; // Allows to change to
another state
@@ -41,6 +40,18 @@
public void controlReleased(CWCommand command, CWInput cwInput) {
}
+
+ @Override
+ /**
+ * Default behaviour of a CW state.
+ * When a right click occurs return to the previous state.
+ * Subclasses that don't want this behaviour must override this method.
+ */
+ public void mousePressed(int button, int x, int y) {
+ if (button == Input.MOUSE_RIGHT_BUTTON) {
+ changeToPreviousState();
+ }
+ }
public void enter(GameContainer container, StateBasedGame
stateBasedGame) throws SlickException {
entered = true;
=======================================
--- /trunk/v2/src/com/customwars/client/ui/state/ControlBindingState.java
Wed Dec 9 06:04:59 2009
+++ /trunk/v2/src/com/customwars/client/ui/state/ControlBindingState.java
Mon Mar 14 06:42:50 2011
@@ -4,7 +4,6 @@
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
-import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.command.BasicCommand;
import org.newdawn.slick.gui.TextField;
@@ -17,8 +16,6 @@
/**
* Show current Command binds and allow to remap them
* Right click takes you back to the menu
- *
- * @author stefan
*/
public class ControlBindingState extends CWState {
private static final boolean DEBUG = false;
@@ -31,10 +28,8 @@
private static final int BIND_LIMIT = LEFT_MARGIN;
private static final Point leftTop = new Point(LEFT_MARGIN, 50);
private static final List<TextField> fields = new ArrayList<TextField>();
- private Input input;
public void init(GameContainer container, StateBasedGame game) throws
SlickException {
- this.input = container.getInput();
int rowCount = 0;
List commands = cwInput.getUniqueCommands();
@@ -136,14 +131,6 @@
}
}
}
-
- @Override
- public void mousePressed(int button, int x, int y) {
- // CWInput is disabled, check for right click
- if (input.isMousePressed(1)) {
- changeToPreviousState();
- }
- }
public int getID() {
return 31;
=======================================
--- /trunk/v2/src/com/customwars/client/ui/state/InGameState.java Fri Feb
18 15:15:52 2011
+++ /trunk/v2/src/com/customwars/client/ui/state/InGameState.java Mon Mar
14 06:42:50 2011
@@ -339,6 +339,8 @@
}
input.consumeEvent();
}
+ } else if (button == Input.MOUSE_RIGHT_BUTTON) {
+ inputHandler.undo();
}
}
}