New Animated Cursor format?

New Animated Cursor format?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

New Animated Cursor format?

Post by Argh »

* Implemented a simple animation file format for cursors
(this is more flexible, easier to use, and saves texture memory)
* Modified the existing animated cursors in springcontent to use the new format
Trepan, is that file going to be in SVN if I update once I get home? Needless to say, I'm intrigued...
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Two points:

1. tvo made the inclusion of springcontent.sdz mandatory for
all mods (but the files within it can be overriden by the primary mod).
That means that Nanoblobs gets all the cursors for the new commands
without any effort on your part.

2. Yup, the new file format is already being used for the cursors within
install/builddata/springcontent/anims. Here's is an example (cursornumber.txt):

Code: Select all

frame  anims/cursornumber_00.png  0.600
frame  anims/cursornumber_01.png  0.200
frame  anims/cursornumber_02.png  0.200
frame  anims/cursornumber_03.png  0.400
frame  anims/cursornumber_04.png  0.200
frame  anims/cursornumber_05.png  0.200
frame  anims/cursornumber_06.png  0.400
frame  anims/cursornumber_07.png  0.200
frame  anims/cursornumber_08.png  0.200
frame  anims/cursornumber_09.png  0.400
frame  anims/cursornumber_10.png  0.200
frame  anims/cursornumber_11.png  0.200
The numbers at the end of the line are frame times in seconds.

Another example (cursorwait.txt):

Code: Select all

frame  anims/cursorwait_0.png  0.100
frame  anims/cursorwait_1.png  0.100
frame  anims/cursorwait_2.png  0.100
frame  anims/cursorwait_3.png  0.100
frame  anims/cursorwait_2.png  0.100
frame  anims/cursorwait_1.png  0.100
Note that the frame images can be repeated.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

How many frames could a cursor realistically be, without doing strange things?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

For note #1, I forgot to mention that you'll also pickup
the minimapbuttons.png texture, and the icon frame
textures (which I've been using with the lua gui stuff).

How many images can you use? Beats me. The only
limitation is texture memory. The animation algorithm
should not suffer from having large numbers of images.
Note that each image is only loaded into memory once,
even if it is used in multiple frames.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

in the new version of EE, some of my cursors have up to 78 frames (I believe) and no issues.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Also, if this method of swapping images is really fast, it'd be nice if it was added to CSimpleParticleSystem... we could do some really neat tricks then...
Post Reply

Return to “Engine”