mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 21:40:15 -07:00
make mouse more pleasing
This commit is contained in:
parent
dbacdb7873
commit
5c932b0851
1 changed files with 14 additions and 4 deletions
|
|
@ -333,6 +333,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
private boolean isTouchInHotbar = false;
|
private boolean isTouchInHotbar = false;
|
||||||
private int hotbarX, hotbarY;
|
private int hotbarX, hotbarY;
|
||||||
private int scrollInitialX, scrollInitialY;
|
private int scrollInitialX, scrollInitialY;
|
||||||
|
private int x,y;
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View p1, MotionEvent e)
|
public boolean onTouch(View p1, MotionEvent e)
|
||||||
{
|
{
|
||||||
|
|
@ -356,14 +357,23 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;*/
|
||||||
|
if(e.getHistorySize() > 0) {
|
||||||
|
x += (int)(e.getX() - e.getHistoricalX(0));
|
||||||
|
y += (int)(e.getY() - e.getHistoricalY(0));
|
||||||
|
}
|
||||||
|
if(x == 0 || !CallbackBridge.isGrabbing()) {
|
||||||
|
x = (int) e.getX();
|
||||||
|
y = (int) e.getY();
|
||||||
|
}
|
||||||
int hudKeyHandled = handleGuiBar(x, y);
|
int hudKeyHandled = handleGuiBar(x, y);
|
||||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) {
|
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) {
|
||||||
if (hudKeyHandled != -1) {
|
if (hudKeyHandled != -1) {
|
||||||
sendKeyPress(hudKeyHandled);
|
sendKeyPress(hudKeyHandled);
|
||||||
} else {
|
} else {
|
||||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, x, y);
|
CallbackBridge.sendMouseKeycode(rightOverride ? (byte) 1 : (byte) 0);
|
||||||
|
CallbackBridge.sendCursorPos(x, y);
|
||||||
if (!rightOverride) {
|
if (!rightOverride) {
|
||||||
CallbackBridge.mouseLeft = true;
|
CallbackBridge.mouseLeft = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue