1SDLx::Controller::StateU(s3e)r Contributed Perl DocumentaStDiLoxn::Controller::State(3)
2
3
4
6 SDLx::Controller::State - the state of a SDLx::Controller::Interface
7
9 Extension, Controller
10
12 # you'll most likely get a State object from a SDLx::Controller::Interface
13 # object. Just in case, here's how you would construct one by hand:
14 my $state1 = SDLx::Controller::State->new;
15 my $state2 = SDLx::Controller::State->new( $x, $y, $v_x, $v_y, $rotation, $ang_v );
16
17 # attributes are just simple accessors:
18 $state->x(10);
19 $state->x; # 10
20
21 # same goes for the rest:
22 $state->y;
23 $state->ang_v;
24
25 # etc.
26
28 A state object is a simple container for any given state inside a
29 running SDLx::Controller::Interface instance.
30
32 new()
33 new( $x, $y, $v_x, $v_y, $rotation, $ang_v )
34 Creates a new state container object. Can optionally set the initial
35 value of all its attributes (see below).
36
38 x
39 Accessor to get/set the x value, usually used to position the item or
40 check for collisions.
41
42 y
43 Accessor to get/set the y value, usually used to position the item or
44 check for collisions.
45
46 v_x
47 Accessor to get/set the x velocity of the instance, for moving objects
48 dynamically.
49
50 v_y
51 Accessor to get/set the y velocity of the instance, for moving objects
52 dynamically.
53
54 rotation
55 Accessor to get/set the rotation of the object, in degrees (0..360).
56
57 ang_v
58 Accessor to get/set the angular velocity, for rotating objects
59 dynamically.
60
61 AUTHORS
62 See "AUTHORS" in SDL
63
64
65
66perl v5.36.0 2023-03-10 SDLx::Controller::State(3)