Simplify rotation explanation

This commit is contained in:
oakes
2014-05-03 02:31:15 -04:00
parent e49bae9a97
commit 6bfd8dedcf

View File

@@ -65,16 +65,14 @@ A `texture` contains the underlying Java object. By default, it will be drawn at
:x 50 :y 50 :width 100 :height 100)
```
You can also set scaling and rotation on a texture using :scale-x, :scale-y, and :angle, which all use either (:origin-x, :origin-y) as the center, or calculate it from the size of the texture:
You can also set scaling and rotation on a texture using :scale-x, :scale-y, and :angle, which all use (:origin-x, :origin-y) as the center. For example, here we rotate it 45 degrees counter-clockwise around the bottom-left corner:
```clojure
(assoc (texture "clojure.png")
:x 50 :y 50 :width 100 :height 100
:scale-x 1.5 :scale-y 0.75 :angle 30
:origin-x 50 :origin-y 0)
:angle 45 :origin-x 0 :origin-y 0)
```
Note: if you're not rotating/scaling, try to set the angle and scale keys to nil, so that the simpler drawing function will be used.
## Input
Let's add a new function at the end of `defscreen` called `:on-key-down`, which runs when a key is pressed: