public class VisualInput extends SquidInput
SquidPanel(int, int, TextCellFactory, squidpony.IColorCenter, float, float, char[][])
) or
SquidLayers(int, int, int, int, TextCellFactory, SquidColorCenter, SquidColorCenter, char[][])
constructors with a larger 2D char array than the given gridWidth and/or gridHeight). It works fine if the
area that can be seen on one screen is as big as it gets, such as in the normal text-based mode of games like
Rogue and Brogue. It can also work if you manually handle movement over a larger area without using libGDX
Viewport and Camera code to accomplish that, since this class needs to handle the Viewport to some extent.
SquidInput.KeyHandler
Modifier and Type | Field and Description |
---|---|
protected java.util.TreeMap<java.lang.Character,java.lang.String> |
availableKeys |
protected com.badlogic.gdx.utils.CharArray |
clicks |
com.badlogic.gdx.graphics.Color |
color |
boolean |
eightWay |
boolean |
forceButtons |
protected boolean |
initialized |
SquidPanel |
left |
protected SquidMouse |
mouseLeft |
protected SquidMouse |
mouseRight |
SquidPanel |
right |
protected ShrinkPartViewport |
spv |
com.badlogic.gdx.scenes.scene2d.Stage |
stage |
protected TextCellFactory |
tcfLeft |
protected TextCellFactory |
tcfRight |
BACKSPACE, CENTER_ARROW, DOWN_ARROW, DOWN_LEFT_ARROW, DOWN_RIGHT_ARROW, END, ENTER, ESCAPE, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FORWARD_DELETE, GAMEPAD_A, GAMEPAD_B, GAMEPAD_C, GAMEPAD_L1, GAMEPAD_L2, GAMEPAD_LEFT_THUMB, GAMEPAD_R1, GAMEPAD_R2, GAMEPAD_RIGHT_THUMB, GAMEPAD_SELECT, GAMEPAD_START, GAMEPAD_X, GAMEPAD_Y, GAMEPAD_Z, heldCodes, HOME, ignoreInput, INSERT, keyAction, lastKeyTime, LEFT_ARROW, mapping, mouse, numpadDirections, PAGE_DOWN, PAGE_UP, queue, repeatGapMillis, RIGHT_ARROW, TAB, UP_ARROW, UP_LEFT_ARROW, UP_RIGHT_ARROW, VERTICAL_ARROW
Constructor and Description |
---|
VisualInput(SquidInput.KeyHandler keyHandler) |
VisualInput(SquidInput.KeyHandler keyHandler,
boolean ignoreInput) |
VisualInput(SquidInput.KeyHandler keyHandler,
SquidMouse mouse) |
VisualInput(SquidInput.KeyHandler keyHandler,
SquidMouse mouse,
boolean ignoreInput) |
Modifier and Type | Method and Description |
---|---|
int |
getSectionHeight() |
int |
getSectionWidth() |
void |
init(java.util.Map<java.lang.Character,java.lang.String> available)
For each char and String in available, registers each keyboard key (as a char, such as 'A' or
SquidInput.LEFT_ARROW) with a String that names the action that key is used to perform, and makes these Strings
available as buttons on the right side of the screen if on a device with no hardware keyboard.
|
void |
init(java.lang.String... enabled)
Convenience method that does essentially the same thing as init(Map<Character, String>).
|
void |
init(TextCellFactory font,
java.util.Map<java.lang.Character,java.lang.String> available)
For each char and String in available, registers each keyboard key (as a char, such as 'A' or
SquidInput.LEFT_ARROW) with a String that names the action that key is used to perform, and makes these Strings
available as buttons on the right side of the screen if on a device with no hardware keyboard.
|
void |
init(TextCellFactory font,
java.lang.String... enabled)
Convenience method that does essentially the same thing as init(Map<Character, String>).
|
boolean |
mouseMoved(int screenX,
int screenY) |
void |
reinitialize(float cellWidth,
float cellHeight,
float gridWidth,
float gridHeight,
int offsetX,
int offsetY,
float screenWidth,
float screenHeight) |
ShrinkPartViewport |
resizeInnerStage(com.badlogic.gdx.scenes.scene2d.Stage insides) |
void |
show() |
boolean |
touchDown(int screenX,
int screenY,
int pointer,
int button) |
boolean |
touchDragged(int screenX,
int screenY,
int pointer) |
boolean |
touchUp(int screenX,
int screenY,
int pointer,
int button) |
void |
update(int width,
int height,
boolean centerCamera) |
clearMapping, combineModifiers, drain, flush, fromCode, getIgnoreInput, getKeyHandler, getMouse, getRepeatGap, hasNext, isUsingNumpadDirections, keyDown, keyMappingFromString, keyMappingToString, keyTyped, keyUp, next, remap, remap, remap, scrolled, setIgnoreInput, setKeyHandler, setMouse, setRepeatGap, setUsingNumpadDirections, unmap, unmap
public SquidPanel left
public SquidPanel right
protected TextCellFactory tcfLeft
protected TextCellFactory tcfRight
protected java.util.TreeMap<java.lang.Character,java.lang.String> availableKeys
protected SquidMouse mouseLeft
protected SquidMouse mouseRight
protected boolean initialized
public com.badlogic.gdx.graphics.Color color
protected com.badlogic.gdx.utils.CharArray clicks
public boolean eightWay
public boolean forceButtons
public com.badlogic.gdx.scenes.scene2d.Stage stage
protected ShrinkPartViewport spv
public VisualInput(SquidInput.KeyHandler keyHandler)
public VisualInput(SquidInput.KeyHandler keyHandler, boolean ignoreInput)
public VisualInput(SquidInput.KeyHandler keyHandler, SquidMouse mouse)
public VisualInput(SquidInput.KeyHandler keyHandler, SquidMouse mouse, boolean ignoreInput)
public void init(java.lang.String... enabled)
init("fire", "Fortify")
would register "fire" under 'f' and "Fortify" under 'F', displaying the Strings
instead of the characters if possible. The first char of each String should be unique in the arguments.
DefaultResources.getStretchableFont()
and requires the .fnt file and .png file
listed in the documentation for that method. If you don't have those files, but have some other font (preferably
some kind of distance field font, since this resizes the font significantly), you can use
init(TextCellFactory, String...)
or init(TextCellFactory, Map)
to have this use your font.enabled
- an array or vararg of Strings that name actions; the first char of each String should be uniquepublic void init(TextCellFactory font, java.lang.String... enabled)
init("fire", "Fortify")
would register "fire" under 'f' and "Fortify" under 'F', displaying the Strings
instead of the characters if possible. The first char of each String should be unique in the arguments.
font
- the TextCellFactory to use for the buttons, usually a distance field font from DefaultResourcesenabled
- an array or vararg of Strings that name actions; the first char of each String should be uniquepublic void init(java.util.Map<java.lang.Character,java.lang.String> available)
DefaultResources.getStretchableFont()
and requires the .fnt file and .png file
listed in the documentation for that method. If you don't have those files, but have some other font (preferably
some kind of distance field font, since this resizes the font significantly), you can use
init(TextCellFactory, String...)
or init(TextCellFactory, Map)
to have this use your font.available
- a Map of Character keys representing keyboard keys and Strings for the actions they triggerpublic void init(TextCellFactory font, java.util.Map<java.lang.Character,java.lang.String> available)
font
- the TextCellFactory to use for the buttons, usually a distance field font from DefaultResourcesavailable
- a Map of Character keys representing keyboard keys and Strings for the actions they triggerpublic boolean touchDown(int screenX, int screenY, int pointer, int button)
touchDown
in interface com.badlogic.gdx.InputProcessor
touchDown
in class SquidInput
public boolean touchUp(int screenX, int screenY, int pointer, int button)
touchUp
in interface com.badlogic.gdx.InputProcessor
touchUp
in class SquidInput
public boolean touchDragged(int screenX, int screenY, int pointer)
touchDragged
in interface com.badlogic.gdx.InputProcessor
touchDragged
in class SquidInput
public boolean mouseMoved(int screenX, int screenY)
mouseMoved
in interface com.badlogic.gdx.InputProcessor
mouseMoved
in class SquidInput
public void reinitialize(float cellWidth, float cellHeight, float gridWidth, float gridHeight, int offsetX, int offsetY, float screenWidth, float screenHeight)
public ShrinkPartViewport resizeInnerStage(com.badlogic.gdx.scenes.scene2d.Stage insides)
public int getSectionWidth()
public int getSectionHeight()
public void update(int width, int height, boolean centerCamera)
public void show()
Copyright © Eben Howard 2012–2022. All rights reserved.