mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
sort some code
This commit is contained in:
parent
3b124c55ca
commit
becb6d0681
1 changed files with 17 additions and 14 deletions
|
|
@ -329,7 +329,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
|
|
||||||
minecraftGLView.setFocusable(true);
|
minecraftGLView.setFocusable(true);
|
||||||
// minecraftGLView.setEGLContextClientVersion(2);
|
// minecraftGLView.setEGLContextClientVersion(2);
|
||||||
|
|
||||||
glTouchListener = new OnTouchListener(){
|
glTouchListener = new OnTouchListener(){
|
||||||
private boolean isTouchInHotbar = false;
|
private boolean isTouchInHotbar = false;
|
||||||
private int hotbarX, hotbarY;
|
private int hotbarX, hotbarY;
|
||||||
|
|
@ -337,21 +336,25 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View p1, MotionEvent e)
|
public boolean onTouch(View p1, MotionEvent e)
|
||||||
{
|
{
|
||||||
int mptrIndex = -1;
|
|
||||||
for(int i = 0; i < e.getPointerCount(); i++) {
|
{
|
||||||
if(e.getToolType(i) == MotionEvent.TOOL_TYPE_MOUSE) { //if there's at least one mouse...
|
int mptrIndex = -1;
|
||||||
mptrIndex = i; //index it
|
for (int i = 0; i < e.getPointerCount(); i++) {
|
||||||
|
if (e.getToolType(i) == MotionEvent.TOOL_TYPE_MOUSE) { //if there's at least one mouse...
|
||||||
|
mptrIndex = i; //index it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (mptrIndex != -1) {
|
||||||
|
//handle mouse events by just sending the coords of the new point in touch event
|
||||||
|
int x = ((int) e.getX(mptrIndex)) / scaleFactor;
|
||||||
|
int y = ((int) e.getY(mptrIndex)) / scaleFactor;
|
||||||
|
CallbackBridge.mouseX = x;
|
||||||
|
CallbackBridge.mouseY = y;
|
||||||
|
CallbackBridge.sendCursorPos(x, y);
|
||||||
|
return true; // event handled sucessfully
|
||||||
|
}//if index IS -1, continue handling as an usual touch event
|
||||||
}
|
}
|
||||||
if(mptrIndex != -1) {
|
|
||||||
//handle mouse events by just sending the coords of the new point in touch event
|
|
||||||
int x = ((int) e.getX(mptrIndex)) / scaleFactor;
|
|
||||||
int y = ((int) e.getY(mptrIndex)) / scaleFactor;
|
|
||||||
CallbackBridge.mouseX = x;
|
|
||||||
CallbackBridge.mouseY = y;
|
|
||||||
CallbackBridge.sendCursorPos(x,y);
|
|
||||||
return true; // event handled sucessfully
|
|
||||||
}//if index IS -1, continue handling as an usual touch event
|
|
||||||
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
||||||
int x = ((int) e.getX()) / scaleFactor;
|
int x = ((int) e.getX()) / scaleFactor;
|
||||||
int y = ((int) e.getY()) / scaleFactor;
|
int y = ((int) e.getY()) / scaleFactor;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue