Sponsored Content
The Lounge What is on Your Mind? What is your favourite movie at the moment? Post 302553756 by figaro on Thursday 8th of September 2011 01:31:29 PM
Old 09-08-2011
Keenly awaiting the release of Tintin, a childhood hero.
 

9 More Discussions You Might Find Interesting

1. OS X (Apple)

i Movie HD

i Movie HD will not play sound from an imported movie :confused: (2 Replies)
Discussion started by: fgjiu
2 Replies

2. UNIX for Dummies Questions & Answers

is there any way to know how much time process was running from the moment it started

i have process that was started few days ago , is there way to know by its id how long it was alive in the system ? Thanks (2 Replies)
Discussion started by: umen
2 Replies

3. Shell Programming and Scripting

Any one here this moment? (Ignore)

I have small question i should solve it (1 Reply)
Discussion started by: Ame
1 Replies

4. OS X (Apple)

OS 10 lässt sich nicht mehr installieren...ubuntu läuft als system im moment....hilfe!

hello, I have installed on my MacBookPro Ubuntu via Boot Camp, but bootcamp has deletet that MacOS partion and created just one new and installed ubuntu. Now I can not install MacOS 10 from the DVD, the gray screen comes when I use the "C" key during the boot process. it starts booting... (2 Replies)
Discussion started by: ingwio
2 Replies

5. Homework & Coursework Questions

2. Write a shell script that produces some summary information of the system at a particular moment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all... (2 Replies)
Discussion started by: jsk319342
2 Replies

6. What is on Your Mind?

Favourite Games console

So what is everyones all time favourite games console and why do you like it? (Please - no comments on why they are better than others as that would be opinion based and cause arguments, positive comments only) (28 Replies)
Discussion started by: Tommyk
28 Replies

7. What is on Your Mind?

Your favourite computer games....

Hi all, there have been a tremendous evolution in the computer games from games like Tetris or DAVE or Prince of Persia or wolf3d... to Call of Duty or BattleField or tomb raider etc etc so let us know the games which you liked the most.... you can also mention about the gaming rig you... (32 Replies)
Discussion started by: vivek d r
32 Replies

8. Shell Programming and Scripting

Blond moment : sed

Hallo Team, I have thousands of lines and i would like to manilpute a pattern but i am getting an error: File lo0ks like below: ... (5 Replies)
Discussion started by: kekanap
5 Replies

9. UNIX Desktop Questions & Answers

Which is your favourite desktop?

Most of the people think that they can not use Unix as desktop. By this poll we gone tell them that we not just use Unix as desktop but also love different display managers like GNOME, KDE etc..... (35 Replies)
Discussion started by: ynilesh
35 Replies
pods::SDLx::Sprite::Animated(3pm)			User Contributed Perl Documentation			 pods::SDLx::Sprite::Animated(3pm)

NAME
SDLx::Sprite::Animated - create animated SDL sprites easily! CATEGORY
Extension SYNOPSIS
use SDLx::Sprite::Animated; # simplest possible form, where 'hero.png' is an image containing # fixed-length sprites in sequence. It doesn't matter if they are # placed vertically or horizontally, as long as the the widest # side is a multiple of the (narrowest) other. The widget will # automatically divide it in the proper frames, provided there is # no slack space between each frame. my $animation = SDLx::Sprite::Animated->new->load('hero.png'); # that's it! Defaults are sane enough to DWIM in simple cases, # so you just have to call draw() on the right place. If you # need to setup your animation or have more control over it, # feel free to use the attributes and methods below. # these are the most useful methods to use in your game loop # (or wherever you want to manipulate the animation): $animation->next; $animation->previous; $animation->reset; $animation->current_frame; # current frame number $animation->current_loop; # current loop number # you can control positioning just like a regular SDLx::Sprite: $animation->rect $animation->x; $animation->y; # just like a regular Sprite, we fetch our source rect from ->clip, # updating it on each call to ->next (or ->previous, or ->reset). # If source rects for your animation are further apart (or less) # than the rect's width and height, you can adjust the animation # x/y offsets: $animation->step_x(15); $animation->step_y(30); $animation->draw($screen); # remember to do this! :) # we can also call ->next() automatically after each draw(): $animation->start; $animation->stop; # default is to go to the next frame at each draw(). If this is # too fast for you, change the attribute below: $animation->ticks_per_frame(10); # select type of animation loop when it reaches the last frame: $animation->type('circular'); # restarts loop at the beginning $animation->type('reverse'); # goes backwards $animation->max_loops(3); 0 or undef for infinite looping # as usual, you can setup most of the above during object spawning my $animation = SDLx::Sprite::Animated->new( image => 'hero.png', rect => SDL::Rect->new(...), step_x => 20, step_y => 0, ... ); DESCRIPTION
An animation is a series of frames that are played in order. Frames are loaded from an image, usually referred to as a Sprite Sheet or Sprite Strip. This module let's you interact with such strips and create sprite animations just as easily as you would manipulate a regular SDLx::Sprite object. WARNING! VOLATILE CODE AHEAD This is a new module and the API is subject to change without notice. If you care, please join the discussion on the #sdl IRC channel in irc.perl.org. All thoughts on further improving the API are welcome. You have been warned :) ATTRIBUTES AND METHODS
SDLx::Sprite::Animated is a subclass of SDLx::Sprite, inheriting all its attributes and methods. Please refer to that module's documentation for information on those. The one difference in behavior is that, while a standard SDLx::Sprite uses "->clip()" to select the part of the surface to display, SDLx::Sprite::Animated treats "->clip()" as the initial rect, from which to start the animation. The following attributes and methods are available: new new( %options ) Creates a new SDLx::Sprite::Animated object. No option is mandatory. It accepts all the options from a regular SDLx::Sprite object plus these: o step_x => $integer Uses $integer as the number of pixels to move on the x-axis (left-to-right, 0 being no dislocation whatsoever, when the strip goes from top to bottom) to reach the next frame. o step_y => $integer Uses $integer as the number of pixels to move on the y-axis (top-to-bottom, 0 being no dislocation whatsoever, when the strip goes from left to right) to reach the next frame. o max_loops => $integer Uses $integer as the number of times to loop the animation (when it reaches the end of the strip). o ticks_per_frame => $integer Uses $integer to set how many calls to draw() must be issued before we go to the next frame during autoplay (i.e. between calls to start() and stop()). o type => $string Uses $string to set the type of animation loop when it reaches the last frame in the strip. See the type() method below for information on available looping types. o sequences => { $string => [ [ $x1, $y1 ], [ $x2, $y2 ], ... ], ... } Uses the supplied hashref to define named sequences of frames. o sequence => $string Uses $string to set the current sequence. step_x() step_x( $integer ) Uses $integer as the number of pixels to move on the x-axis (left-to-right, 0 being no dislocation whatsoever, when the strip goes from top to bottom) to reach the next frame. Defaults to the same width as the clip() rect. step_y() step_y( $integer ) Uses $integer as the number of pixels to move on the y-axis (top-to-bottom, 0 being no dislocation whatsoever, when the strip goes from left to right) to reach the next frame. Defaults to the same height as the clip() rect. max_loops() max_loops( $integer ) Uses $integer as the number of times to loop the animation (when it reaches the end of the strip). After that all calls to previous() or next() will be no-ops. Set it to 0 or "undef" to allow infinite loops. Default is 0 (infinite). ticks_per_frame() ticks_per_frame( $integer ) Uses $integer to set how many calls to draw() must be issued before we go to the next frame during autoplay (i.e. between calls to start() and stop()). Default is just 1 tick per frame, so you might want to change this if it's too fast. type() type( $string ) Uses $string to set the type of animation loop when it reaches the last frame in the strip. Available looping types are: o 'circular' Restarts loop at the beginning of the strip. If you have 4 frames, the flow will be 1-2-3-4-1-2-3-4-1-2-3-4-1-2-... up until the number of loops you set in the max_loops() attribute. o 'reverse' Loops back and forth on the strip. If you have 4 frames, the flow will be 1-2-3-4-3-2-1-2-3-4-3-2-... up until the number of loops you set in the max_loops() attribute. Case is irrelevant for type(), so for example 'Circular', 'CIRCULAR' and 'CiRcUlAr' are all accepted as 'circular'. The return value is guaranteed to be lowercase. Default value is 'circular'. set_sequences( $string => [ [ $x1, $y1 ], [ $x2, $y2 ], ... ], ... ) Uses the supplied hashref to define named sequences of frames. Replaces any previously defined sequences. sequence( $string ) Uses $string to set the current sequence. Goes to the first frame in the sequence and resets the loop counter. next() Goes to the next frame in the strip. Calling this method will also reset the tick counter used by ticks_per_frame(). If max_loops() has reached its limit, this will be a no-op. Returns the object, allowing method chaining. previous() Goes to the previous frame in the strip. Calling this method will also reset the tick counter used by ticks_per_frame(). If max_loops() has reached its limit, this will be a no-op. Returns the object, allowing method chaining. reset() Goes to the first frame in the strip, meaning whatever clip is set to. If max_loops() has reached its limit, this will be a no-op. Returns the object, allowing method chaining. current_frame() Returns the current frame number. Note that this is 1-based (first frame is 1, second is 2, etc). current_loop() Returns the loop counter, i.e. which run number is it at. This is also 1-based (first time is 1, second time is 2, etc). Note that we only keep track of the counter if max_loops() is set to a finite number. Otherwise, this will be a no-op. start() After you call this method, the object will issue a call to "->next()" automatically for you every time "->draw()" is called "ticks_per_frame()" times. If you want to stop autoplay, see "stop()" below. Default is off (no autoplay). stop() Stops autoplay. After you call this, the object will need you to call "->previous()" and "->next()" explicitly to change frames. To resume autoplay from wherever you are, use "start()". If you want to restart autoplay from the initial frame, just do: $sprite->reset->start; AUTHORS
See "AUTHORS" in SDL. SEE ALSO
SDL::Surface, SDL perl v5.14.2 2012-05-28 pods::SDLx::Sprite::Animated(3pm)
All times are GMT -4. The time now is 08:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy