summaryrefslogtreecommitdiff
path: root/doc/graphics/sprite.texi
blob: 9b20e3fa7ea61930864fbd0d77cc2d1c4e154b73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
@node Sprites
@section Sprites

Sprites are typically the most important part of a 2D game. Sprites
represent a texture with a specific color, position, rotation and
scale. Sprites can render texture objects or animations.

@anchor{2d sprite set-sprite-batch-size!}@defspec set-sprite-batch-size!
@end defspec

@anchor{2d sprite set-sprite-batch-texture!}@defspec set-sprite-batch-texture!
@end defspec

@anchor{2d sprite set-sprite-drawable!}@defspec set-sprite-drawable!
@end defspec

@anchor{2d sprite set-sprite-vertices!}@defspec set-sprite-vertices!
@end defspec

@anchor{2d sprite sprite-anchor}@defspec sprite-anchor
@end defspec

@anchor{2d sprite sprite-batch-max-size}@defspec sprite-batch-max-size
@end defspec

@anchor{2d sprite sprite-batch-size}@defspec sprite-batch-size
@end defspec

@anchor{2d sprite sprite-batch-texture}@defspec sprite-batch-texture
@end defspec

@anchor{2d sprite sprite-batch-vertices}@defspec sprite-batch-vertices
@end defspec

@anchor{2d sprite sprite-batch?}@defspec sprite-batch?
@end defspec

@anchor{2d sprite sprite-color}@defspec sprite-color
@end defspec

@anchor{2d sprite sprite-drawable}@defspec sprite-drawable
@end defspec

@anchor{2d sprite sprite-position}@defspec sprite-position
@end defspec

@anchor{2d sprite sprite-rotation}@defspec sprite-rotation
@end defspec

@anchor{2d sprite sprite-scale}@defspec sprite-scale
@end defspec

@anchor{2d sprite sprite-vertices}@defspec sprite-vertices
@end defspec

@anchor{2d sprite sprite?}@defspec sprite?
@end defspec

@anchor{2d sprite with-sprite-batch}@defspec with-sprite-batch batch body ...
@end defspec

@anchor{2d sprite animated-sprite?}@defun animated-sprite? sprite
Return #t if SPRITE has an animation as its drawable object.

@end defun

@anchor{2d sprite draw-sprite}@defun draw-sprite sprite
Render SPRITE to the screen.  A sprite batch will be used if one is
currently bound.

@end defun

@anchor{2d sprite load-sprite}@defun load-sprite filename [#:position] [#:scale] [#:rotation] [#:color] [#:anchor]
Load a sprite from the file at FILENAME.  See make-sprite for optional
keyword arguments.

@end defun

@anchor{2d sprite make-sprite}@defun make-sprite drawable [#:position] [#:scale] [#:rotation] [#:color] [#:anchor]
Create a new sprite object.  DRAWABLE is either a texture or animation
object.  All keyword arguments are optional.  POSITION is a vector2
object with a default of (0, 0).  SCALE is a vector2 object that
describes how much DRAWABLE should be strected on the x and y axes, with
a default of 1x scale.  ROTATION is an angle in degrees with a default
of 0.  COLOR is a color object with a default of white.  ANCHOR is
either a vector2 that represents the center point of the sprite, or
'center which will place the anchor at the center of DRAWABLE.  Sprites
are centered by default.

@end defun

@anchor{2d sprite make-sprite-batch}@defun make-sprite-batch [max-size]
Creates a new sprite batch.  The default max-size is 1000.

@end defun

@anchor{2d sprite set-sprite-anchor!}@defun set-sprite-anchor! sprite value
@end defun

@anchor{2d sprite set-sprite-color!}@defun set-sprite-color! sprite value
@end defun

@anchor{2d sprite set-sprite-position!}@defun set-sprite-position! sprite value
@end defun

@anchor{2d sprite set-sprite-rotation!}@defun set-sprite-rotation! sprite value
@end defun

@anchor{2d sprite set-sprite-scale!}@defun set-sprite-scale! sprite value
@end defun

@anchor{2d sprite sprite-batch-draw}@defun sprite-batch-draw . args
Add a textured quad to the current sprite batch.  X, Y, WIDTH, and
HEIGHT represent the quad in pixels.  ORIGIN-X and ORIGIN-Y represent
the center point of the quad which is used for rotation.  SCALE-X and
SCALE-Y are the scaling factors for the x and y axis, respectively.
ROTATION is the angle in degrees to rotate the quad.  U, V, U2, and V2
represent the texture coordinate region to texture the quad with.  COLOR
is a color object.

@end defun