It's not an implementation detail, it's consistency and extensibility. Previous love versions already had colors in the 0-1 range... but only in shaders, which is not consistent. love 11 also allows you to create and modify ImageData at different bit depths than 8 bits per color component (e.g. via ImageData:setPixel), whereas 0-255 only makes sense for 8 bits. Math on colors (such as interpolation, etc) is generally simplified when working in the 0-1 range as well.
0-255 (or hex) colors do make sense for certain scenarios, but they are not universally applicable, they have a narrower range of use than love's APIs, whereas 0-1 colors (or unbounded range colors in some scenarios) allow for a variety of inputs and outputs. Adding a simple function to convert 0-255 to 0-1 (and potentially other color conversion functions, although there are a lot of color spaces and few are really useful for games) might be helpful, but having love's base APIs take 0-1 colors was a necessary change.
Certain other engines have explicit float-color and byte-color objects, and have implicit conversions from byte-color to float-color objects. Unfortunately that's not feasible in Lua since the language doesn't have stack allocated value-type structures (tables would be far too expensive in terms of GC pressure).
What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
I understand the goal was to standardize. Maybe, it would be the right thing to add a conversion function (helper) for people using 0-255. (I know it's easy to code this, but that's one more reason this could have gotten into Love codebase).slime wrote: ↑Mon Oct 22, 2018 9:37 pm Adding a simple function to convert 0-255 to 0-1 (and potentially other color conversion functions, although there are a lot of color spaces and few are really useful for games) might be helpful, but having love's base APIs take 0-1 colors was a necessary change.
Thanks for joining the discussion.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
I made this. It patches all relevant functions for you when you start your game and forces everything (not just the trivial functions) back to 0-255 in a transparent way, as if the change never happened.
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
Great, will check that!
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
BTW, found this game which I believe has been written by slime:
https://github.com/wesleywerner/nova-pi ... tag/v0.2.3
Unable to run as it only supports 10.x and crashes.
https://github.com/wesleywerner/nova-pi ... tag/v0.2.3
Unable to run as it only supports 10.x and crashes.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
Runs fine with polyamory on Debian Stretch.dusoft wrote: ↑Thu Nov 01, 2018 5:16 pm BTW, found this game which I believe has been written by slime:
https://github.com/wesleywerner/nova-pi ... tag/v0.2.3
Unable to run as it only supports 10.x and crashes.
Thread's gone seriously off topic.
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
I guess dusoft's point is about cross-version compatibility, which is kinda on-topic. Yeah, there are lot more programs that break from one version to another. When a new version appears, I update my programs to adapt them to run in all versions, because they generally don't (T2R is already updated, but not pushed yet), but not everyone does the same.
On a side note, what makes you think Wesley Werner is Alex Szpakowski?
On a side note, what makes you think Wesley Werner is Alex Szpakowski?
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
Ah, It was just a guess based on this: https://github.com/wesleywerner/loveslimepgimeno wrote: ↑Thu Nov 01, 2018 7:32 pm On a side note, what makes you think Wesley Werner is Alex Szpakowski?
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
A suggestion which has worked for me: 97% of my game is in pure lua, it never calls the Love API. Everything goes through a 'framework'-module that handles the actual API calls to things like reading/writing data, controller input, drawing stuff, etc. So when eg. love.graphics.drawq was removed I only needed to change ONE line of code!
Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?
So you built another framework :-) Or a connector. Or a bridge. Erm, smart, but thanks no thanks.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Who is online
Users browsing this forum: Bing [Bot] and 7 guests