Liking cljdoc? Tell your friends :D

quip.input

Keyboard and mouse input handling.

We allow scenes to define a collection of their own handlers for each event type:

  • :focus-gained-fns
  • :focus-lost-fns
  • :mouse-pressed-fns
  • :mouse-released-fns
  • :mouse-entered-fns
  • :mouse-exited-fns
  • :mouse-clicked-fns
  • :mouse-moved-fns
  • :mouse-dragged-fns
  • :mouse-wheel-fns

When an event occurs the handlers for that type are applied to the state in order. Most of the time you'll likely have at most one handler for each type, but it's sometimes very helpful to be able to split them out.

Keyboard and mouse input handling.

We allow scenes to define a collection of their own handlers for
each event type:
- `:focus-gained-fns`
- `:focus-lost-fns`
- `:mouse-pressed-fns`
- `:mouse-released-fns`
- `:mouse-entered-fns`
- `:mouse-exited-fns`
- `:mouse-clicked-fns`
- `:mouse-moved-fns`
- `:mouse-dragged-fns`
- `:mouse-wheel-fns`

When an event occurs the handlers for that type are applied to the
state in order. Most of the time you'll likely have at most one
handler for each type, but it's sometimes very helpful to be able to
split them out.
raw docstring

default-key-pressedclj

(default-key-pressed state e)

Prevent the default behaviour of esc closing the sketch and add the pressed key to the list of currently held keys.

Prevent the default behaviour of esc closing the sketch and add the
pressed key to the list of currently held keys.
sourceraw docstring

default-key-releasedclj

(default-key-released state e)

Remove the released key from the list of currently held keys.

Remove the released key from the list of currently held keys.
sourceraw docstring

default-mouse-pressedclj

(default-mouse-pressed {:keys [scenes current-scene] :as state} e)

Check all :clickable? sprites for collision with the mouse event, apply the :on-click-fn of all that have been licked on.

Check all `:clickable?` sprites for collision with the mouse event,
apply the `:on-click-fn` of all that have been licked on.
sourceraw docstring

focus-gainedclj

source

focus-lostclj

source

handler-reducerclj

(handler-reducer handler-fns-key
                 &
                 {:keys [default-handler]
                  :or {default-handler identity-handler}})

Returns a function which reduces across the collection of handler-fns-key functions in the current scene, applying each to the accumulating state.

Returns a function which reduces across the collection of
`handler-fns-key` functions in the current scene, applying each to
the accumulating state.
sourceraw docstring

handler-reducer-with-eventsclj

(handler-reducer-with-events handler-fns-key
                             &
                             {:keys [default-handler]
                              :or {default-handler identity-handler}})

Returns a function which reduces across the collection of handler-fns-key functions in the current scene, applying each to the accumulating state, passing in the event each time.

Returns a function which reduces across the collection of
`handler-fns-key` functions in the current scene, applying each to
the accumulating state, passing in the event each time.
sourceraw docstring

identity-handlerclj

(identity-handler state & _args)

Returns the state unchanged, optionally takes any number of additional arguments which it ignores.

Returns the state unchanged, optionally takes any number of
additional arguments which it ignores.
sourceraw docstring

key-pressedclj

source

key-releasedclj

source

mouse-clickedclj

source

mouse-draggedclj

source

mouse-enteredclj

source

mouse-exitedclj

source

mouse-movedclj

source

mouse-pressedclj

source

mouse-releasedclj

source

mouse-wheelclj

source

on-clickclj

(on-click sprite f)

Make a sprite :clickable? by adding an :on-click-fn to be invoked by the default mouse-pressed handler.

Make a sprite `:clickable?` by adding an `:on-click-fn` to be invoked
by the default mouse-pressed handler.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close