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 / dbSpriteScaleX initially returns sprite width rather than scale

Author
Message
Peppivankokki
13
Years of Service
User Offline
Joined: 19th Aug 2011
Location:
Posted: 19th Aug 2011 23:41 Edited at: 24th Aug 2011 22:51
When I initially call dbSpriteScaleX, the function returns the sprite width, rather than the scale. After setting the scale to 100 with dbScaleSprite, the function does return the actual scale (100). Is this a bug, or am I missing something?

See for instance the code below:


at first, the width of the sprite is shown (128). But after pressing the left key, the scale is set to 100 and the actual scale (100) is returned correctly.

Thanks in advance for your help!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Aug 2011 10:39
It's a bug. When you create an animated sprite, it calls a function which sizes the sprite in pixels, and that function sets the scale value badly. (I've just checked the Dark GDK source code.) The same error happens when you use dbSizeSprite.

You can write a bug report about it. I will confirm it (or I'll make the report later if you don't).

It seems you have already found a workaround by setting the initial scale to 100 after creating the sprite.

An advice: do not use dbStr like this because you will create a memory leak. With Dark GDK functions that return char* you should either delete[] the returned string, or - better - don't use them when you can avoid it. Whenever you want to print something to the screen, it's easy to use sprintf and more convenient too, since you can format the printed string.
Peppivankokki
13
Years of Service
User Offline
Joined: 19th Aug 2011
Location:
Posted: 24th Aug 2011 22:53
Thanks for the confirmation. I guess the workaround will do for now.

As for the dbStr function, I'm aware of the the memory leak. I'm only using dbStr like this for debugging purposes...

Login to post a reply

Server time is: 2024-10-02 19:15:23
Your offset time is: 2024-10-02 19:15:23