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.

AppGameKit Classic Chat / I find that SetSpriteColor() can't change the color of the Sprite.

Author
Message
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Oct 2011 08:47
what's wrong?

I need to change the color of a sprite. but I failed. why?

give my best
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 27th Oct 2011 09:37
For best results make sure your sprite is grayscale to start with.
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 28th Oct 2011 16:30
my sprite is colorful ,not grayscale, then how can I set the color?
once a time , I use a game sdk named CLanLib ,it's also a perfect game sdk. I can use api of Clanlib to change the color of sprite .

can the official answer this question?

give my best
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Oct 2011 17:50 Edited at: 28th Oct 2011 17:52
Post the code, and attach one of your sprite graphics.

Without looking at either one it's hard to say why you "failed"

Here's an example...



and here's the image...



Notice that the color image is shaded with the new color.

Attachments

Login to view attachments
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 28th Oct 2011 18:46
sorry , I took a mistake. it was not a sprite,but a text object.

agk::SetTextColor can't change the color which I need.

May I ask, is it the same for text and sprite to SetColor ?

give my best
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 28th Oct 2011 20:15 Edited at: 28th Oct 2011 20:24
The arguments for SetTextColor() are the same. But if the text is from a custom font sheet, it will only shade the colors that are not-white. If you want to replace the color in a custom font, you'll need to do that outside of AppGameKit, in a paint package.

halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 28th Oct 2011 22:01
I didn't use alpha.i will try it tomorrow.it's too late for me now.

give my best

Login to post a reply

Server time is: 2024-04-25 15:20:22
Your offset time is: 2024-04-25 15:20:22