Add mode for pointer
This commit is contained in:
parent
ef7e708401
commit
ce680c9f36
@ -10,14 +10,18 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
|||||||
*/
|
*/
|
||||||
public class Pointer {
|
public class Pointer {
|
||||||
|
|
||||||
|
public static final int POSITIONING = 0, READY = 1;
|
||||||
|
|
||||||
private boolean isAccelerometerSupports, isHardwareKeyboardSupports;
|
private boolean isAccelerometerSupports, isHardwareKeyboardSupports;
|
||||||
|
|
||||||
private float screenWidth, screenHeight;
|
private float screenWidth, screenHeight;
|
||||||
private float x, y;
|
private float x, y;
|
||||||
|
private int mode;
|
||||||
|
|
||||||
public Pointer(float width, float height) {
|
public Pointer(float width, float height) {
|
||||||
x = width / 2;
|
x = width / 2;
|
||||||
y = height / 2;
|
y = height / 2;
|
||||||
|
mode = POSITIONING;
|
||||||
setScreenParameters(width, height);
|
setScreenParameters(width, height);
|
||||||
|
|
||||||
isAccelerometerSupports = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);
|
isAccelerometerSupports = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);
|
||||||
@ -35,6 +39,10 @@ public class Pointer {
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMode(int mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
public void setScreenParameters(float width, float height) {
|
public void setScreenParameters(float width, float height) {
|
||||||
screenWidth = width;
|
screenWidth = width;
|
||||||
screenHeight = height;
|
screenHeight = height;
|
||||||
@ -48,7 +56,7 @@ public class Pointer {
|
|||||||
|
|
||||||
public void draw(ShapeRenderer renderer) {
|
public void draw(ShapeRenderer renderer) {
|
||||||
control();
|
control();
|
||||||
DrawUtils.drawPointer(renderer, x, y, screenWidth, screenHeight, 1);
|
DrawUtils.drawPointer(renderer, x, y, screenWidth, screenHeight, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void control() {
|
private void control() {
|
||||||
|
Loading…
Reference in New Issue
Block a user