cindy is a small library that adds several functions to LÖVE 11 that allow you to work with a [0-255] color value range instead of the newly introduced [0.0-1.0] range in love.graphics, ImageData, ParticleSystem, SpriteBatch, and Shader.
Besides adding new functions, it also provides a mechanism to patch all relevant functions and restore the 0.10 behavior. This makes it easy to port your existing projects without having to change a lot of code.
GitHub repo with code and documentation.
License: WTFPL
Thanks to ivan and pgimeno for doing code reviews and providing valuable input!
cindy - [0-255] color range in LÖVE 11
Re: cindy - [0-255] color range in LÖVE 11
Great job with this lib, looks much cleaner!
Re: cindy - [0-255] color range in LÖVE 11
it's working fine. IMHO it wasn't a good idea to make this breaking change, especially when most color pickers are using a 0-255 range for colors, it's a real PITA to work with colors since Löve 11. It don't understand the benefit of this.
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: cindy - [0-255] color range in LÖVE 11
The benefit is that you are not restricted to 8bit values.
obey
Re: cindy - [0-255] color range in LÖVE 11
maybe some gradients could benefit from this then... even if I suppose many monitors won't support this yet.BrotSagtMist wrote: ↑Sun Nov 05, 2023 3:17 pm The benefit is that you are not restricted to 8bit values.
Anyway, I've found this tool coded in Löve very convenient to pick a color: viewtopic.php?p=257037#p257037
Re: cindy - [0-255] color range in LÖVE 11
You just have to use one more function:
https://love2d.org/wiki/love.math.colorFromBytes
I also originally thought it wasn't a good idea (=breaking change), check my old rant:
https://ambience.sk/on-backward-compatibility/
But adding one more function to work with 255 ranges is alright with me these days.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: cindy - [0-255] color range in LÖVE 11
thank you @dusoft for pointing me toward this colorFromBytes function!
Sure it's not easy to find a good balance between breaking everything to move forward, and keeping old, dormant, deprecated code for compatibility's sake...
Sure it's not easy to find a good balance between breaking everything to move forward, and keeping old, dormant, deprecated code for compatibility's sake...
Re: cindy - [0-255] color range in LÖVE 11
Am I doing something wrong by taking the colour code and dividing by 255?
Last edited by togFox on Wed Nov 08, 2023 9:25 pm, edited 1 time in total.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
Re: cindy - [0-255] color range in LÖVE 11
Nope. That's exactly how to convert a 0..255 range to a 0..1 range. (No, I don't understand the agita here either.)
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: cindy - [0-255] color range in LÖVE 11
Gosh again, not every pixel has a range of 255.
But more importantly using percentages is great.
Yall should get your head checked for wanting integers.
But more importantly using percentages is great.
Yall should get your head checked for wanting integers.
obey
Who is online
Users browsing this forum: No registered users and 6 guests