feat: inverted positive/negative args of Listener
This commit is contained in:
		
							parent
							
								
									3cad3af3fe
								
							
						
					
					
						commit
						41f5c440c4
					
				| 
						 | 
				
			
			@ -14,14 +14,14 @@ void PlayerInput::_bind_methods() {
 | 
			
		|||
gd::Vector2 PlayerInput::lastMouseMotion{0.f, 0.f};
 | 
			
		||||
bool PlayerInput::primaryExists{false};
 | 
			
		||||
 | 
			
		||||
PlayerInput::Listener::Listener(gd::String positive, gd::String negative, gd::Callable callable)
 | 
			
		||||
PlayerInput::Listener::Listener(gd::String negative, gd::String positive, gd::Callable callable)
 | 
			
		||||
: actionNegative{negative}
 | 
			
		||||
, actionPositive{positive}
 | 
			
		||||
, callable{callable}
 | 
			
		||||
, isMouseEvent{positive.begins_with("_mouse_") || negative.begins_with("_mouse_")} {}
 | 
			
		||||
 | 
			
		||||
PlayerInput::Listener::Listener(gd::String action, gd::Callable callable)
 | 
			
		||||
: PlayerInput::Listener::Listener(action, gd::String(), callable) {}
 | 
			
		||||
: PlayerInput::Listener::Listener(gd::String(), action, callable) {}
 | 
			
		||||
 | 
			
		||||
std::optional<float> PlayerInput::Listener::evaluate_action(gd::String const &action) {
 | 
			
		||||
    gd::Input *input = gd::Input::get_singleton();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ public:
 | 
			
		|||
 | 
			
		||||
    public:
 | 
			
		||||
        Listener() = default;
 | 
			
		||||
        Listener(gd::String positive, gd::String negative, gd::Callable callable);
 | 
			
		||||
        Listener(gd::String negative, gd::String positive, gd::Callable callable);
 | 
			
		||||
        Listener(gd::String action, gd::Callable callable);
 | 
			
		||||
        // evaluate the current state of an action.
 | 
			
		||||
        static std::optional<float> evaluate_action(gd::String const &action);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue