mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-07 08:24:26 +01:00
Updated Tutorial:Screen, colors and squares (markdown)
parent
72eac1c73a
commit
d11b8498af
@ -186,12 +186,12 @@ Our text is covered by the new image. We'll need to set the position of the imag
|
|||||||
|
|
||||||
# Image transforming
|
# Image transforming
|
||||||
|
|
||||||
There's no position configuration in Ebiten, but you can get the same result by transforming your images. There are many ways to transform your images in Ebiten, but we'll only talk the basic `x`, `y` position translate in this chapter.
|
To put an image at a position as you like, there's only one way to specify geometry matrix when drawing an image. The geometry matrix is affine matrix and you can translate, enlarge or rotate the image with it.
|
||||||
|
|
||||||
What we need is to add the `translate` effect to the `option struct` by using `Translate(tx, ty float64)` function, `float64` is the floating point data type, and here're the two parameters that you'll need to pass to the function:
|
What we need is to add the `translate` effect to the `DrawImageOptions` struct by using `Translate(tx, ty float64)` function. `float64` is the floating point data type, and here're the two parameters that you'll need to pass to the function:
|
||||||
|
|
||||||
* `tx` Is the distance from the left, it's also called as the x offset.
|
* `tx` Is the distance from the left. It's also called as the x offset.
|
||||||
* `ty` Is the distance from the top, and it's also called as the y offset.
|
* `ty` Is the distance from the top. It's also called as the y offset.
|
||||||
|
|
||||||
So right now, let's add another code to tell the render function that we want to translate the new image while rendering it.
|
So right now, let's add another code to tell the render function that we want to translate the new image while rendering it.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user