Update to jinput2.10.1. Mouseover for text bits inside of Action control change list
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
c24c6a3972
commit
8a13331af0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/jinput.jar
BIN
lib/jinput.jar
Binary file not shown.
@ -25,7 +25,6 @@ import sig.engine.PaletteColor;
|
|||||||
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
|
|
||||||
public class RabiClone{
|
public class RabiClone{
|
||||||
public static final String PROGRAM_NAME="RabiClone";
|
public static final String PROGRAM_NAME="RabiClone";
|
||||||
@ -44,6 +43,7 @@ public class RabiClone{
|
|||||||
public static PaletteColor BACKGROUND_COLOR = PaletteColor.DARK_ORCHID;
|
public static PaletteColor BACKGROUND_COLOR = PaletteColor.DARK_ORCHID;
|
||||||
|
|
||||||
public static LevelRenderer level_renderer;
|
public static LevelRenderer level_renderer;
|
||||||
|
public static ConfigureControls control_settings_menu;
|
||||||
public static Player player;
|
public static Player player;
|
||||||
|
|
||||||
public static Maps CURRENT_MAP = Maps.WORLD1;
|
public static Maps CURRENT_MAP = Maps.WORLD1;
|
||||||
@ -138,7 +138,7 @@ public class RabiClone{
|
|||||||
if (Key.isKeyHeld(KeyEvent.VK_F3)) {
|
if (Key.isKeyHeld(KeyEvent.VK_F3)) {
|
||||||
OBJ.clear();
|
OBJ.clear();
|
||||||
ResetGame();
|
ResetGame();
|
||||||
OBJ.add(new ConfigureControls(p));
|
OBJ.add(control_settings_menu=new ConfigureControls(p));
|
||||||
}
|
}
|
||||||
if (Key.isKeyHeld(KeyEvent.VK_F5)&&System.currentTimeMillis()-lastControllerScan>5000) {
|
if (Key.isKeyHeld(KeyEvent.VK_F5)&&System.currentTimeMillis()-lastControllerScan>5000) {
|
||||||
CONTROLLERS=ControllerEnvironment.getDefaultEnvironment().rescanControllers();
|
CONTROLLERS=ControllerEnvironment.getDefaultEnvironment().rescanControllers();
|
||||||
@ -158,6 +158,7 @@ public class RabiClone{
|
|||||||
private static void ResetGame() {
|
private static void ResetGame() {
|
||||||
player=null;
|
player=null;
|
||||||
level_renderer=null;
|
level_renderer=null;
|
||||||
|
control_settings_menu=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StartGame() {
|
private static void StartGame() {
|
||||||
|
@ -404,11 +404,8 @@ public class Panel extends JPanel implements Runnable,KeyListener {
|
|||||||
if (!Key.isKeyHeld(e.getKeyCode())) {
|
if (!Key.isKeyHeld(e.getKeyCode())) {
|
||||||
Key.setKeyHeld(e.getKeyCode(), true);
|
Key.setKeyHeld(e.getKeyCode(), true);
|
||||||
}
|
}
|
||||||
for (Object o : RabiClone.OBJ) {
|
if (RabiClone.control_settings_menu!=null) {
|
||||||
if (o instanceof ConfigureControls) {
|
RabiClone.control_settings_menu.rawKeyPressed(e.getKeyCode());
|
||||||
((ConfigureControls)o).rawKeyPressed(e.getKeyCode());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//System.out.println("Key List: "+KEYS);
|
//System.out.println("Key List: "+KEYS);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package sig.objects;
|
package sig.objects;
|
||||||
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.java.games.input.Component;
|
import net.java.games.input.Component;
|
||||||
import net.java.games.input.Controller;
|
|
||||||
import net.java.games.input.Event;
|
import net.java.games.input.Event;
|
||||||
import net.java.games.input.Component.Identifier;
|
import net.java.games.input.Component.Identifier;
|
||||||
import net.java.games.input.Component.POV;
|
import net.java.games.input.Component.POV;
|
||||||
@ -21,10 +21,24 @@ public class ConfigureControls extends Object{
|
|||||||
|
|
||||||
Action selectedAction = Action.MOVE_RIGHT;
|
Action selectedAction = Action.MOVE_RIGHT;
|
||||||
boolean assigningKey = false;
|
boolean assigningKey = false;
|
||||||
|
List<List<Integer>> actionHighlightSections = new ArrayList<>();
|
||||||
|
|
||||||
public ConfigureControls(Panel panel) {
|
public ConfigureControls(Panel panel) {
|
||||||
super(panel);
|
super(panel);
|
||||||
RabiClone.BACKGROUND_COLOR = PaletteColor.WHITE;
|
RabiClone.BACKGROUND_COLOR = PaletteColor.WHITE;
|
||||||
|
int index=0;
|
||||||
|
for (Action a : Action.values()) {
|
||||||
|
actionHighlightSections.add(new ArrayList<Integer>());
|
||||||
|
for (int i=0;i<KeyBind.KEYBINDS.get(a).size();i++) {
|
||||||
|
KeyBind c = KeyBind.KEYBINDS.get(a).get(i);
|
||||||
|
StringBuilder renderedText=new StringBuilder(a.toString()).append(": ");
|
||||||
|
List<Integer> sectionList = actionHighlightSections.get(a.ordinal());
|
||||||
|
sectionList.add(renderedText.length());
|
||||||
|
renderedText.append(c.getName());
|
||||||
|
sectionList.add(renderedText.length());
|
||||||
|
renderedText.append(i!=KeyBind.KEYBINDS.get(a).size()-1?",":"");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,6 +81,15 @@ public class ConfigureControls extends Object{
|
|||||||
selectedAction=a;
|
selectedAction=a;
|
||||||
Draw_Rect(p,(byte)PaletteColor.PEACH.ordinal(),0,getY()+y,RabiClone.BASE_WIDTH,Font.PROFONT_12.getGlyphHeight()+4);
|
Draw_Rect(p,(byte)PaletteColor.PEACH.ordinal(),0,getY()+y,RabiClone.BASE_WIDTH,Font.PROFONT_12.getGlyphHeight()+4);
|
||||||
}
|
}
|
||||||
|
for (int i=0;i<actionHighlightSections.get(a.ordinal()).size();i+=2) {
|
||||||
|
List<Integer> sectionList = actionHighlightSections.get(a.ordinal());
|
||||||
|
int startX=sectionList.get(i)*Font.PROFONT_12.getGlyphWidth()-4;
|
||||||
|
int endX=sectionList.get(i+1)*Font.PROFONT_12.getGlyphWidth()+4;
|
||||||
|
if (RabiClone.MOUSE_POS.getY()>=getY()+y&&RabiClone.MOUSE_POS.getY()<getY()+y+Font.PROFONT_12.getGlyphHeight()+4&&RabiClone.MOUSE_POS.getX()>=startX&&RabiClone.MOUSE_POS.getX()<=endX) {
|
||||||
|
Draw_Rect(p,(byte)PaletteColor.AZURE.ordinal(),startX,getY()+y,endX-startX,Font.PROFONT_12.getGlyphHeight()+4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
Draw_Text_Ext(4,getY()+y,DisplayActionKeys(a),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.MIDNIGHT_BLUE);
|
Draw_Text_Ext(4,getY()+y,DisplayActionKeys(a),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.MIDNIGHT_BLUE);
|
||||||
y+=Font.PROFONT_12.getGlyphHeight()+4;
|
y+=Font.PROFONT_12.getGlyphHeight()+4;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user