diff options
Diffstat (limited to 'doc/api.texi')
-rw-r--r-- | doc/api.texi | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/doc/api.texi b/doc/api.texi index cb3c885..e2864a5 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -681,10 +681,26 @@ players, NPCs, items, particles, text, etc. In Chickadee, bitmaps are stored in textures (@pxref{Textures}) and can be used to draw sprites via the @code{draw-sprite} procedure. -@deffn {Procedure} draw-sprite @var{texture} @var{region} @ - [#:scale] [#:rotation] [#:blend-mode alpha] [#:texcoords] @ - [#:shader] +@deffn {Procedure} draw-sprite @var{texture} @var{position} @ + [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] @ + [#:rect] [#:shader] + +Draw @var{texture} at @var{position}. + +Optionally, other transformations may be applied to the sprite. +@var{rotation} specifies the angle to rotate the sprite, in radians. +@var{scale} specifies the scaling factor as a 2D vector. All +transformations are applied relative to @var{origin}, a 2D vector, +which defaults to the lower-left corner. + +Alpha blending is used by default but the blending method can be +changed by specifying @var{blend-mode}. + +The area drawn to is as big as the texture, by default. To draw to an +arbitrary section of the screen, specify @var{rect}. +Finally, advanced users may specify @var{shader} to change the way the +sprite is rendered entirely. @end deffn It's not uncommon to need to draw hundreds or thousands of sprites @@ -740,10 +756,10 @@ interface widgets like buttons and dialog boxes. By using a nine patch, they can be rendered at any size without unappealing scaling artifacts. -@deffn {Procedure} draw-nine-patch @var{texture} @var{region} @ +@deffn {Procedure} draw-nine-patch @var{texture} @var{rect} @ [#:margin 0] [#:top-margin margin] [#:bottom-margin margin] @ [#:left-margin margin] [#:right-margin margin] @ - [#:texture-region] [#:scale] [#:rotation] [#:blend-mode alpha] @ + [#:origin] [#:scale] [#:rotation] [#:blend-mode alpha] @ [#:shader] Draw a nine patch sprite. A nine patch sprite renders @var{texture} @@ -809,9 +825,7 @@ rendering technique comes in. Introduced by @url{http://www.valvesoftware.com/.../2007/SIGGRAPH2007_AlphaTestedMagnification.pdf, Valve} in 2007, signed distance field fonts can be efficiently stored in a bitmap and be rendered at arbitrary scale factors with good -results. Chickadee can render both traditional bitmap fonts and -signed distance field fonts. @emph{Signed distance field font -rendering is not yet available, so be patient.} +results. While Chickadee does not yet offer a tool for converting TTF fonts into FNT fonts, tools such as @@ -851,7 +865,7 @@ Return @code{#t} if @var{font} is an italicized font. @end deffn @deffn {Procedure} draw-text @var{font} @var{text} @var{position} - [#:scale] [#:rotation] [#:blend-mode] + [#:origin] [#:scale] [#:rotation] [#:blend-mode] Draw the string @var{text} with the first character starting at @var{position} using @var{font}. |