Sprite brightness

Advanced game related topics
Voidy
New User
New User
Posts: 8
Joined: Tue May 28, 2024 1:26 pm

Sprite brightness

Post by Voidy »

How can I change the brightness of my 2D sprite? I only found DisplayTransparentSprite for transparency but not for brightness.
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Sprite brightness

Post by infratec »

I think you need to transform your colors to an other model, which allows you to modify the brightness. (maybe HSV)
Then you can convert it back to RGB.

Here in te forum are lready functions to convert rgb to hsv vice versa.
If you have the hsv values, you can increase the v value to get higher brightness and convert it back to rgb.
Voidy
New User
New User
Posts: 8
Joined: Tue May 28, 2024 1:26 pm

Re: Sprite brightness

Post by Voidy »

Thanks for your help. I can't find a thread with the example code.
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Sprite brightness

Post by infratec »

Voidy
New User
New User
Posts: 8
Joined: Tue May 28, 2024 1:26 pm

Re: Sprite brightness

Post by Voidy »

Thank you :)
Unfortunately, PureBasic doesn't have that many 2D sprite functions. Can I import from DirectX11? Is there a example code?
User avatar
darius676
Enthusiast
Enthusiast
Posts: 301
Joined: Thu Jan 31, 2019 12:59 am
Contact:

Re: Sprite brightness

Post by darius676 »

https://github.com/microsoft/DirectXTK ... -textures maybe you ll have to do some research yourself? Try, fail, repeat? Like most of developers?
Voidy
New User
New User
Posts: 8
Joined: Tue May 28, 2024 1:26 pm

Re: Sprite brightness

Post by Voidy »

What kind of answer is that?!
1. I did research, but when I get stuck, I need help.
2. Why does the forum exist if you're not allowed to ask questions?! As if you never asked any questions. -.-
User avatar
darius676
Enthusiast
Enthusiast
Posts: 301
Joined: Thu Jan 31, 2019 12:59 am
Contact:

Re: Sprite brightness

Post by darius676 »

Maybe my answer sounds rude, but in my opinion, there so many people asking for ready to go solutions, without investigation by their own. I m an old computer guy. When starting programming, coding, I had to search for solutions, not for answers. I m sorry if you feel bad. isn't programming, coding an adventure, where you can fail, go back search resources, try to implement code, try to understand, what's behind the curtain? I had to buy and read books. Now the internet is full of solutions, of ways to get a hint. Why not try it? Why not use Microsoft, to understand how Windows /DirectX API may help? Yes it takes time . Time to progress, time to fail. But getting the solution by yourself can be so satisfying. Make yourself proud. And the results will last forever. In this forum, are so many encouraged people. But just to use them as a code/sniped automat, I feel, this isn't right. And it's not fair, not fair to you. Besides: I m not a rude person, I read this Forum for years, and it helped me, inspired me. I found solutions, ways to solve a task. But in a way, to study the language, the API. And now I m far away from a "good" developer, but I try to get better.
Yes I use this Forum, and yes I aske(d) for help, but never for a final code, just for the way. A good source is RSBASIC with WINAPI Collection. Purebasics Help also is a good source.
https://mark-dowen.itch.io/ If you interested, what I have achieved with nearly plain purebasic code and some hints in the forum, and trial and error. All done in my free time ( which is very short :cry: ) . Overall, maybe it's just my imagination, that people, don't want help, they want the result. This is not reduced to this forum. Hopefully you understand my standing and opinion.
Voidy
New User
New User
Posts: 8
Joined: Tue May 28, 2024 1:26 pm

Re: Sprite brightness

Post by Voidy »

You're right. There are people who are lazy and ask questions about every little thing instead of using Google first, but I'm not like that.
Thank you for the url.
Have a nice day :)
Post Reply