mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
* Fix bad mouse controls on desktop.
This commit is contained in:
@@ -359,16 +359,23 @@ void Minecraft::handleMouseClick(int type)
|
||||
{
|
||||
if (!isTouchscreen())
|
||||
{
|
||||
if (type == 1)
|
||||
eBuildActionIntent intent;
|
||||
switch (type)
|
||||
{
|
||||
BuildActionIntention bai(INTENT_HELD);
|
||||
handleBuildAction(&bai);
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
BuildActionIntention bai(INTENT_CLICKED);
|
||||
handleBuildAction(&bai);
|
||||
case BUTTON_LEFT:
|
||||
intent = INTENT_MOUSE_LEFTCLICK;
|
||||
break;
|
||||
case BUTTON_RIGHT:
|
||||
intent = INTENT_MOUSE_RIGHTCLICK;
|
||||
break;
|
||||
case BUTTON_MIDDLE:
|
||||
intent = INTENT_MOUSE_MIDDLECLICK;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
BuildActionIntention bai(intent);
|
||||
handleBuildAction(&bai);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ enum eBuildActionIntent
|
||||
INTENT_CLICKED = 1, // touch screen was clicked
|
||||
INTENT_HELD = 2, // touch screen is being held down
|
||||
INTENT_FIRST_REMOVE = 10, // after a small delay, starts breaking with this as a signal
|
||||
|
||||
INTENT_MOUSE_LEFTCLICK = 16,
|
||||
INTENT_MOUSE_RIGHTCLICK = 17,
|
||||
INTENT_MOUSE_MIDDLECLICK = 18,
|
||||
};
|
||||
|
||||
class BuildActionIntention
|
||||
@@ -22,15 +26,19 @@ public:
|
||||
BuildActionIntention(int type) : m_type(type) {}
|
||||
|
||||
bool isAttack() const {
|
||||
return m_type == INTENT_CLICKED;
|
||||
return m_type == INTENT_CLICKED || m_type == INTENT_MOUSE_LEFTCLICK;
|
||||
}
|
||||
|
||||
bool isFirstRemove() const {
|
||||
return m_type == INTENT_FIRST_REMOVE;
|
||||
return m_type == INTENT_FIRST_REMOVE || m_type == INTENT_MOUSE_LEFTCLICK;
|
||||
}
|
||||
|
||||
bool isInteract() const {
|
||||
return m_type == INTENT_HELD;
|
||||
return m_type == INTENT_HELD || m_type == INTENT_MOUSE_RIGHTCLICK;
|
||||
}
|
||||
|
||||
bool isBuild() {
|
||||
return m_type == INTENT_CLICKED || m_type == INTENT_MOUSE_RIGHTCLICK;
|
||||
}
|
||||
|
||||
bool isRemove() const {
|
||||
@@ -38,7 +46,11 @@ public:
|
||||
}
|
||||
|
||||
bool isRemoveContinue() const {
|
||||
return m_type == INTENT_HELD;
|
||||
return m_type == INTENT_HELD || m_type == INTENT_MOUSE_LEFTCLICK;
|
||||
}
|
||||
|
||||
bool isPick() const {
|
||||
return m_type == INTENT_MOUSE_MIDDLECLICK;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user