Results 1 to 5 of 5

Thread: mouseUp event

  1. #1

    mouseUp event

    I have a bit of a problem where I'm trying to get certain events to fire when the mouse buttons are released.
    I'm searching the solution in states, like for example
    [pascal]if (Input.mouse.Buttons[mbLeft]) and (isUp in Input.mouse.states) then <dosomething> [/pascal]
    but that does not appear to work, as nothting seems to be happening.

    It's probably something simple, but I dont see it.
    So, any hints or tips would be appreciated

  2. #2

    mouseUp event

    I believe you would have to make MouseUpHandler like this

    [pascal]TPHXInputListener.getInstance.addMouseUpHandler(mo useuppro)[/pascal]
    Where mouseuppro is a class procedure.

    There's an example of making a KeyPressHandler in the Input Demo that should make a good reference
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3

    Re: mouseUp event

    Quote Originally Posted by Traveler
    I have a bit of a problem where I'm trying to get certain events to fire when the mouse buttons are released.
    I'm searching the solution in states, like for example
    [pascal]if (Input.mouse.Buttons[mbLeft]) and (isUp in Input.mouse.states) then <dosomething> [/pascal]
    but that does not appear to work, as nothting seems to be happening.

    It's probably something simple, but I dont see it.
    So, any hints or tips would be appreciated
    Easiest is to do as pstudio said.

    [pascal]if (Input.mouse.Buttons[mbLeft]) and (isUp in Input.mouse.states) then <dosomething> [/pascal]

    This code snippet just says if the Left mouse button is pressed and the mouse is moving upwards, <dosomething>. There is no way to detect keyups except for saving the last key state

    [pascal]
    var isLeft: Boolean;
    ...
    if isButton1 in Input.Mouse.States then
    isLeft:= true;
    else begin
    if isLeft then <dosomething>
    isLeft:= False;
    end;
    [/pascal]
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  4. #4

    mouseUp event

    Thanks to both of you.
    I had seen the sample, and I even considered writing something similar for the mouseup event. Somehow I kept thinking it would be something more simpler, though.

  5. #5

    mouseUp event

    I got the thing to work now using pstudio's suggestion.

    In case someone else is looking for something similar:

    [pascal]Type TMyMouseClass = Class
    procedure MouseUp(X, Y: Integer; Button: Integer);
    end;

    procedure TMyMouseClass.MouseUp(X, Y: Integer; Button: Integer);
    begin
    // your mouse stuff goes here
    end;

    (..)
    // add this to the oncreate, onInit or whatever, of your game.
    with TMyMouseClass.Create do
    begin
    TPHXInputListener.getInstance().addMouseUpHandler( MouseUp);
    end;[/pascal]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •