Skip to content

Commit

Permalink
add mouse.rightClickMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline authored Mar 30, 2024
1 parent 3e1ae0d commit 5e36536
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions flixel/input/mouse/FlxMouse.hx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ class FlxMouse extends FlxPointer implements IFlxInputManager
*/
public var justPressedTimeInTicks(get, never):Int;

/**
* Helper for the right click menu (context menu). For now just has a field to suppress it.
*/
public var rightClickMenu = new RightClickMenu();

#if FLX_MOUSE_ADVANCED
/**
* Check to see if the right mouse button is currently pressed.
Expand Down Expand Up @@ -769,4 +774,27 @@ class FlxMouse extends FlxPointer implements IFlxInputManager
return cursor = value;
}
}

/**
* For now it's just helper to show or hide the right click menu, but more may get added later.
*/
class RightClickMenu
{
/**
* Whether the context menu will appear when the right mouse button is clicked.
*/
public var suppress(get, set):Bool;

public function new() { }

inline function get_suppress()
{
return !FlxG.stage.showDefaultContextMenu;
}

inline function set_suppress(value:Bool)
{
return FlxG.stage.showDefaultContextMenu = !value;
}
}
#end

0 comments on commit 5e36536

Please sign in to comment.