Fix broken image link

This commit is contained in:
oakes
2014-06-12 11:53:37 -04:00
parent 44eeda1f95
commit 666b694c67

View File

@@ -44,10 +44,10 @@ Right now, you're using the `play-clj.ui` library to display a label. This libra
[play-clj.g2d :refer :all]))
```
Now let's find an image to use as a texture in the game. Find one you'd like to use, such as [this Clojure logo](http://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Clojure_Programming_Language_Logo_Icon_SVG.svg/200px-Clojure_Programming_Language_Logo_Icon_SVG.svg.png), and save it to the `desktop/resources` folder. Next, simply change the line where the label entity is being created, so it creates a texture from that file instead:
Now let's find an image to use as a texture in the game. Find one you'd like to use, such as [this Clojure logo](http://upload.wikimedia.org/wikipedia/commons/c/c5/Clojure-icon.gif), and save it to the `desktop/resources` folder. Next, simply change the line where the label entity is being created, so it creates a texture from that file instead:
```clojure
(texture "clojure.png")
(texture "Clojure-icon.gif")
```
## Size and Position
@@ -61,14 +61,14 @@ If you run the code now, you'll see the image in the bottom-left corner. As ment
A `texture` contains the underlying Java object. By default, it will be drawn at the bottom-left corner with the size of the image itself. You can change the position and size by simply using `assoc`:
```clojure
(assoc (texture "clojure.png")
(assoc (texture "Clojure-icon.gif")
: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 (: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")
(assoc (texture "Clojure-icon.gif")
:x 50 :y 50 :width 100 :height 100
:angle 45 :origin-x 0 :origin-y 0)
```
@@ -254,13 +254,13 @@ At some point, you will need to do more than simple positioning and sizing. For
In play-clj, many different calls, such as `texture`, are actually macros that allow you to call the underlying Java methods after the required argument(s). In this case, the underlying class is called [TextureRegion](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/TextureRegion.html). Consider this:
```clojure
(texture "clojure.png" :flip true false)
(texture "Clojure-icon.gif" :flip true false)
```
...which is transformed into:
```clojure
(let [entity (texture "clojure.png")]
(let [entity (texture "Clojure-icon.gif")]
(doto ^TextureRegion (:object entity)
(.flip true false))
entity)
@@ -269,7 +269,7 @@ In play-clj, many different calls, such as `texture`, are actually macros that a
You can even call multiple methods in the same expression this way. For example:
```clojure
(texture "clojure.png"
(texture "Clojure-icon.gif"
:flip true false
:set-region 0 0 100 100)
```
@@ -277,7 +277,7 @@ You can even call multiple methods in the same expression this way. For example:
...which is transformed into:
```clojure
(let [entity (texture "clojure.png")]
(let [entity (texture "Clojure-icon.gif")]
(doto ^TextureRegion (:object entity)
(.flip true false)
(.setRegion 0 0 100 100)