Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Makign it appear smoothly?

Author
Message
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Mar 2009 12:12
I am trying to make my sprite to appear from alpha of 0 to alpha of 255. But when I try my code,program just freezes and loads up after all the time has passed.

Header


CPP


I have also tried using dbWait,dbSleep but it makes no effect..

Any help would be appreciated.

~Murloc.

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
The Real Abaddon
16
Years of Service
User Offline
Joined: 26th Jun 2008
Location:
Posted: 11th Mar 2009 12:19
I think dbSetSpriteAlpha sets the alpha only once and after the sprite had been rendered the next dbSetSpriteAlpha has no effect.
What i think you should is to delete the sprite every time and create it again using the next higher value of alpha.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 11th Mar 2009 12:47
Quote: "What i think you should is to delete the sprite every time and create it again using the next higher value of alpha."


Or not.

Your application can't guess when you want it to render your scene again; All it's doing is running through your whole loop then rendering it after it when it hits a dbSync() call.

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 11th Mar 2009 12:49
Also, use the Sleep function to pause for a specified amount of time, it's much kinder to the CPU than busy waiting, which is what you are currently doing.

Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Mar 2009 12:50
DC I <3 u. I have added dbSync(); to my code,and tadaaa! It's working. What a stupid mistake though

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Mar 2009 15:25
think of dbSync(); as a screen updater, if you do something and you need to see it, use it when ever something is in a loop and will run until the condition is met.

Dark Physics makes any hot drink go cold.
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Mar 2009 15:41
Yeah,now I understand it Some time ago I thought there can be only one copy of this per project.

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.

Login to post a reply

Server time is: 2024-11-25 17:24:30
Your offset time is: 2024-11-25 17:24:30