https://linen.dev logo
Join Discord
Powered by
# ceramic
  • a

    ambitious-knife-25690

    03/10/2023, 2:38 PM
    just to confirm
  • a

    ambitious-knife-25690

    03/10/2023, 2:39 PM
    i can't double/multi bind to an event(mouse/input) in any way, can i?
  • a

    ambitious-knife-25690

    03/10/2023, 2:42 PM
    @billowy-waiter-28954 as an example, I want to have 2 seperate or more events on a
    screen.onPointerMove
  • a

    ambitious-knife-25690

    03/10/2023, 2:48 PM
    a bit hard to follow code due to macro stuff
  • a

    ambitious-knife-25690

    03/10/2023, 2:49 PM
    i'll do some messing around with owner
  • a

    ambitious-knife-25690

    03/10/2023, 3:25 PM
    hmmm, seems to work with owner
  • a

    ambitious-knife-25690

    03/10/2023, 3:25 PM
    neat
  • b

    billowy-waiter-28954

    03/10/2023, 3:29 PM
    @ambitious-knife-25690 I'm not sure I understand what you mean?
  • a

    ambitious-knife-25690

    03/10/2023, 3:30 PM
    I wanted to know if I could have multiple events assigned to a
    visual.onPointerUp
  • a

    ambitious-knife-25690

    03/10/2023, 3:30 PM
    as an example
  • b

    billowy-waiter-28954

    03/10/2023, 3:30 PM
    you mean multiple event handlers?
  • a

    ambitious-knife-25690

    03/10/2023, 3:30 PM
    yea
  • b

    billowy-waiter-28954

    03/10/2023, 3:30 PM
    Yeah you can, it's intended to be used this way
  • b

    billowy-waiter-28954

    03/10/2023, 3:31 PM
    you can add as many handlers as you want to an event
  • b

    billowy-waiter-28954

    03/10/2023, 3:31 PM
    Copy code
    haxe
    visual.onPointerUp(owner1, info -> { ... });
    visual.onPointerUp(owner2, info -> { ... });
    visual.onPointerUp(owner2, info -> { ... });
    ...
  • a

    ambitious-knife-25690

    03/10/2023, 3:31 PM
    ahhh
  • a

    ambitious-knife-25690

    03/10/2023, 3:31 PM
    the way i was thinking about it was more like:
  • b

    billowy-waiter-28954

    03/10/2023, 3:32 PM
    You can also add multiple handlers with the same owner, nothing restrictive about that either
  • a

    ambitious-knife-25690

    03/10/2023, 3:32 PM
    visual.onPointerUp = event
  • b

    billowy-waiter-28954

    03/10/2023, 3:32 PM
    it's just that if the owner gets destroyed, all handlers related to this owner will be unbound
  • a

    ambitious-knife-25690

    03/10/2023, 3:32 PM
    Ohh! that's really cool to know
  • b

    billowy-waiter-28954

    03/10/2023, 3:32 PM
    pointerUp
    is the event
  • b

    billowy-waiter-28954

    03/10/2023, 3:33 PM
    Might be worth reading that a second time: https://ceramic-engine.com/guides/events/
  • a

    ambitious-knife-25690

    03/10/2023, 3:37 PM
    ahh, i completely forgot that the owner is purely for this. I had been making custom entities
  • a

    ambitious-knife-25690

    03/10/2023, 3:39 PM
    But it may be worth mentioning in there as well that doing
    visual.onPointerUp()
    doesn't mean you can't do something like
    Copy code
    hx
    class Foo extends Visual {
      function new() {
        visual.onPointerUp(this, a);
        visual.onPointerUp(this, b);
      }
      function a(info) {
        //logic
      }
      function b(info) {
        //logic
      }
    }
  • a

    ambitious-knife-25690

    03/10/2023, 3:39 PM
    maybe it is obvious, but to me i had assumed that the second call overwrote the first event
  • a

    ambitious-knife-25690

    03/10/2023, 3:40 PM
    😅
  • b

    billowy-waiter-28954

    03/10/2023, 3:47 PM
    That's right I don't mention this detail because it's so obvious for me xD but I guess I should
  • b

    billowy-waiter-28954

    03/10/2023, 4:20 PM
    @ambitious-knife-25690 And if you want to unbind one handler specifically, following your example code:
    Copy code
    haxe
    visual.offPointerUp(a);
    In that case
    a
    becomes unbound but
    b
    is still bound and will be called when the event is fired
  • b

    billowy-waiter-28954

    03/10/2023, 4:20 PM
    visual.offPointerUp();
    (without arguments) unbinds every handler (no specific handler provided)
1...969798...124Latest