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.
raw 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.
raw 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.
raw docstring

focus-gainedclj


focus-lostclj


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.
raw 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.
raw 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.
raw docstring

key-pressedclj


key-releasedclj


mouse-clickedclj


mouse-draggedclj


mouse-enteredclj


mouse-exitedclj


mouse-movedclj


mouse-pressedclj


mouse-releasedclj


mouse-wheelclj


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.
raw docstring

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

× close