Improve wording and add more tips to the defscreen docstring
This commit is contained in:
@@ -138,10 +138,11 @@ via the screen map.
|
|||||||
entities))
|
entities))
|
||||||
|
|
||||||
; input functions
|
; input functions
|
||||||
|
; Tip: use input-processor! to run these functions manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-key-down ; a key was pressed
|
:on-key-down ; a key was pressed
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:key screen)) ; the code of the key (see key-code)
|
(println (:key screen)) ; the key that was pressed (see key-code)
|
||||||
entities)
|
entities)
|
||||||
:on-key-typed ; a key was typed
|
:on-key-typed ; a key was typed
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -149,7 +150,7 @@ via the screen map.
|
|||||||
entities)
|
entities)
|
||||||
:on-key-up ; a key was released
|
:on-key-up ; a key was released
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:key screen)) ; the code of the key (see key-code)
|
(println (:key screen)) ; the key that was released (see key-code)
|
||||||
entities)
|
entities)
|
||||||
:on-mouse-moved ; the mouse was moved without pressing any buttons
|
:on-mouse-moved ; the mouse was moved without pressing any buttons
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -165,7 +166,7 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger/mouse
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger/mouse
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-touch-dragged ; a finger or the mouse was dragged
|
:on-touch-dragged ; a finger or the mouse was dragged
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -178,35 +179,36 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger/mouse
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger/mouse
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was released (see button-code)
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
; gesture functions
|
; gesture functions
|
||||||
|
; Tip: use gesture-detector! to configure these functions and run them manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-fling ; the user dragged a finger over the screen and lifted it
|
:on-fling ; the user dragged over the screen and lifted
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:velocity-x screen)) ; the x-axis velocity (s)
|
(println (:velocity-x screen)) ; the x-axis velocity (s)
|
||||||
(println (:velocity-y screen)) ; the y-axis velocity (s)
|
(println (:velocity-y screen)) ; the y-axis velocity (s)
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-long-press ; the user pressed
|
:on-long-press ; the user pressed for a long time
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
entities)
|
entities)
|
||||||
:on-pan ; the user dragged a finger over the screen
|
:on-pan ; the user dragged a finger over the screen
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:delta-x screen)) ; the x-axis distance moved
|
(println (:delta-x screen)) ; the x-axis distance moved
|
||||||
(println (:delta-y screen)) ; the y-axis distance moved
|
(println (:delta-y screen)) ; the y-axis distance moved
|
||||||
entities)
|
entities)
|
||||||
:on-pan-stop ; the user is no longer panning
|
:on-pan-stop ; the user is no longer panning
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-pinch ; the user performed a pinch zoom gesture
|
:on-pinch ; the user performed a pinch zoom gesture
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -217,10 +219,10 @@ via the screen map.
|
|||||||
entities)
|
entities)
|
||||||
:on-tap ; the user tapped
|
:on-tap ; the user tapped
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:count screen)) ; the number of taps
|
(println (:count screen)) ; the number of taps
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-zoom ; the user performed a pinch zoom gesture
|
:on-zoom ; the user performed a pinch zoom gesture
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -255,6 +257,7 @@ via the screen map.
|
|||||||
entities))
|
entities))
|
||||||
|
|
||||||
; ui input functions (for play-clj.ui)
|
; ui input functions (for play-clj.ui)
|
||||||
|
; Tip: use change-listener! and click-listener! to configure these functions and run them manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-ui-changed ; the ui entity was changed
|
:on-ui-changed ; the ui entity was changed
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -289,7 +292,7 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger/mouse
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger/mouse
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-ui-touch-dragged ; the finger/mouse moved anywhere
|
:on-ui-touch-dragged ; the finger/mouse moved anywhere
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -304,10 +307,11 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger/mouse
|
(println (:input-x screen)) ; the x position of the finger/mouse
|
||||||
(println (:input-y screen)) ; the y position of the finger/mouse
|
(println (:input-y screen)) ; the y position of the finger/mouse
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was released (see button-code)
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
; ui drag functions (for play-clj.ui)
|
; ui drag functions (for play-clj.ui)
|
||||||
|
; Tip: use drag-listener! to configure these functions and run them manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-ui-drag
|
:on-ui-drag
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -332,6 +336,7 @@ via the screen map.
|
|||||||
entities))
|
entities))
|
||||||
|
|
||||||
; ui focus functions (for play-clj.ui)
|
; ui focus functions (for play-clj.ui)
|
||||||
|
; Tip: use focus-listener! to run these functions manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-ui-keyboard-focus-changed
|
:on-ui-keyboard-focus-changed
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -347,13 +352,14 @@ via the screen map.
|
|||||||
entities))
|
entities))
|
||||||
|
|
||||||
; ui gesture functions (for play-clj.ui)
|
; ui gesture functions (for play-clj.ui)
|
||||||
|
; Tip: use actor-gesture-listener! to configure these functions and run them manually
|
||||||
(defscreen my-screen
|
(defscreen my-screen
|
||||||
:on-ui-fling ; the user dragged a finger over the screen and lifted it
|
:on-ui-fling ; the user dragged a finger over the screen and lifted it
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(println (:event screen)) ; the InputEvent - http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/InputEvent.html
|
(println (:event screen)) ; the InputEvent - http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/InputEvent.html
|
||||||
(println (:velocity-x screen)) ; the x-axis velocity (s)
|
(println (:velocity-x screen)) ; the x-axis velocity (s)
|
||||||
(println (:velocity-y screen)) ; the y-axis velocity (s)
|
(println (:velocity-y screen)) ; the y-axis velocity (s)
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-ui-long-press ; the user pressed
|
:on-ui-long-press ; the user pressed
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -375,7 +381,7 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger
|
||||||
(println (:pointer screen)) ; the pointer for the event
|
(println (:pointer screen)) ; the pointer for the event
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-ui-pinch ; the user performed a pinch zoom gesture
|
:on-ui-pinch ; the user performed a pinch zoom gesture
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
@@ -391,7 +397,7 @@ via the screen map.
|
|||||||
(println (:input-x screen)) ; the x position of the finger
|
(println (:input-x screen)) ; the x position of the finger
|
||||||
(println (:input-y screen)) ; the y position of the finger
|
(println (:input-y screen)) ; the y position of the finger
|
||||||
(println (:count screen)) ; the number of taps
|
(println (:count screen)) ; the number of taps
|
||||||
(println (:button screen)) ; the mouse button (see button-code)
|
(println (:button screen)) ; the mouse button that was pressed (see button-code)
|
||||||
entities)
|
entities)
|
||||||
:on-ui-zoom ; the user performed a pinch zoom gesture
|
:on-ui-zoom ; the user performed a pinch zoom gesture
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
|
|||||||
Reference in New Issue
Block a user