Easy GL2D
-
- Posts: 289
- Joined: Oct 10, 2006 7:19
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
-
- Posts: 289
- Joined: Oct 10, 2006 7:19
fernando.inf: What does different FPS mean? If you are asking whether you could animate sprites with different speeds, then yes you can. Also if you want to use a frame independent timing(ie. delta_time), it's not hard to implement either.
super_castle: I'm not at home but I'll ask my sister if shed allow e to install FB here. BTW, do you want the standard or the fb.image compatible lib?
15 minute job:
http://www.file-pasta.com/file/0/cateplillar.rar
Tip: to make the segment distances equal, you could use a distance parametized catmull-rom to trace the segments. But that would involve an sqr() so....
super_castle: I'm not at home but I'll ask my sister if shed allow e to install FB here. BTW, do you want the standard or the fb.image compatible lib?
15 minute job:
http://www.file-pasta.com/file/0/cateplillar.rar
Tip: to make the segment distances equal, you could use a distance parametized catmull-rom to trace the segments. But that would involve an sqr() so....
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
-
- Posts: 2655
- Joined: Aug 28, 2008 10:54
- Location: new york
My animation engine can animate sprites at different speeds, I'm in the process of porting it to fbgl.
You need a separate anaimation class which is out of scope for rel's library probably. You're asking him to write your code for you. You can find an implementation of a timer delay animation here:
http://www.freebasic.net/forum/viewtopic.php?t=16297
You need a separate anaimation class which is out of scope for rel's library probably. You're asking him to write your code for you. You can find an implementation of a timer delay animation here:
http://www.freebasic.net/forum/viewtopic.php?t=16297
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
How do you set up those animation parameters in allegro? I haven't used it ever so I can't really speculate.fernando.inf wrote:rolliebollocks you are right.
I just asked, why have it in allegro, and I believe it is not difficult to implement in GL2D anyway I will look at your engine animation and studied best in GL2D.
Thanks for the replies, and sorry for the bad habit of asking before studying.
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
Hello relsoft!
I created an object called animation, and instantiate it as follows:
use as follows:
Explanation:
FPS control is done with a timer in the allegro.
mainFPS is the object that calculates the FPS and updates the screen.
The technique I used was: do not lock the fps, but just do render to buffer after reaching the right time for each animation.
Then I have many animations at different speeds because they will only draw into the buffer when it reaches the correct FPS of each, and the update screen is the same way, each 60fps it updates the buffer to the screen.
I do not know if you understand because of my bad English?
I created an object called animation, and instantiate it as follows:
Code: Select all
Dim As Animation Ptr myAnim = New Animation
Dim as Animation Ptr mainFPS = New Animation
mainFPS->initFPS(60)
myAnim->init(filename, x, y, fps, frameStart, frameEnd, currentFrame, isLoop, isReverse)
Code: Select all
'' Main loop
do
myAnim->update()
'myAnim1->update()
'myAnim2->update()
'etc....
mainFPS->loopControl()
loop until exit_app = True
delete myAnim
FPS control is done with a timer in the allegro.
mainFPS is the object that calculates the FPS and updates the screen.
The technique I used was: do not lock the fps, but just do render to buffer after reaching the right time for each animation.
Then I have many animations at different speeds because they will only draw into the buffer when it reaches the correct FPS of each, and the update screen is the same way, each 60fps it updates the buffer to the screen.
I do not know if you understand because of my bad English?
I'm assuming you are loading each sprite as a separate image? Or do you use a spriteset?
BTW, I need to see your working demo's source if it's okay. You can email it to me if you want.
This:
Would really be easy to wrap with the init_sprite() routine since it uses indices (so frameend and framestart are useable)
[edit]
Are you using a fixed timestep or deltatiming?
BTW, I need to see your working demo's source if it's okay. You can email it to me if you want.
This:
Code: Select all
myAnim->init(filename, x, y, fps, frameStart, frameEnd, currentFrame, isLoop, isReverse)
Would really be easy to wrap with the init_sprite() routine since it uses indices (so frameend and framestart are useable)
[edit]
Are you using a fixed timestep or deltatiming?
-
- Posts: 28
- Joined: Mar 10, 2009 1:41
relsoft hello again!
I use all images in a datafile of the allegro.
I'm using each sprite as a separate image, but I also have an init routine in the animation object which supports several sprites in a single image, where two parameters inform the most telling how many sprites the image has vertical and many horizontal (row and spine) remembering that in my case the sprites must have the same size as the routine calculates the size of each one and make the cut according to the amount reported
I could not use all the images in a single spriteset like you, because I use screen resolution is 1024x768 and has about 10 background images with this size, and several other large images, taking the total over 500 PNG images, I believe that would sriteset giant.
About the sources, I could not send the entire code, because currently has 52 separate files in 14 folders, with over 15 000 lines of code, use allegro, libpng, loadpng, libmysql, etc.. And I'm developing this for others, then it would be unethical of my part.
But I can separate the animations and FPS control, create a demo with some animations running at different speeds and post here or send it to you, how you want.
I do not understand the deltatiming, but do so: Calculate the time that each frame should last according to the desired FPS in animation, calculate how long it took, and I see it did not exceed the duration of each frame, I went off this time next frame, and also calculate the lost frames if any.
Well, actually I'm newbie in this, I begin to use FreeBASIC a short time, whenever I enter the forum to find and track new things, but do not put many posts due to my English very bad.
I'll look at backups if I no longer have the animated part of the separate sources and sending it.
Thanks for the reply, and I use to tell everyone that I have learned a lot from the community, with examples and good will of the participants.
I use all images in a datafile of the allegro.
I'm using each sprite as a separate image, but I also have an init routine in the animation object which supports several sprites in a single image, where two parameters inform the most telling how many sprites the image has vertical and many horizontal (row and spine) remembering that in my case the sprites must have the same size as the routine calculates the size of each one and make the cut according to the amount reported
I could not use all the images in a single spriteset like you, because I use screen resolution is 1024x768 and has about 10 background images with this size, and several other large images, taking the total over 500 PNG images, I believe that would sriteset giant.
About the sources, I could not send the entire code, because currently has 52 separate files in 14 folders, with over 15 000 lines of code, use allegro, libpng, loadpng, libmysql, etc.. And I'm developing this for others, then it would be unethical of my part.
But I can separate the animations and FPS control, create a demo with some animations running at different speeds and post here or send it to you, how you want.
I do not understand the deltatiming, but do so: Calculate the time that each frame should last according to the desired FPS in animation, calculate how long it took, and I see it did not exceed the duration of each frame, I went off this time next frame, and also calculate the lost frames if any.
Well, actually I'm newbie in this, I begin to use FreeBASIC a short time, whenever I enter the forum to find and track new things, but do not put many posts due to my English very bad.
I'll look at backups if I no longer have the animated part of the separate sources and sending it.
Thanks for the reply, and I use to tell everyone that I have learned a lot from the community, with examples and good will of the participants.