Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Friendly Colorname (ColorInfo) #5

Closed
ricardok1 opened this issue Oct 1, 2016 · 5 comments
Closed

Improvement: Friendly Colorname (ColorInfo) #5

ricardok1 opened this issue Oct 1, 2016 · 5 comments

Comments

@ricardok1
Copy link

Hi again
Please check my suggestion about having a friendly colorname.
I'm new to c++ and don't follow any convention/protocol so feel 100% free to adapt as you know best if you like this.
This was inspired by C# and MagikCore and overload of Color creation to add just the colorname instead of RGBA.

ColorInfo » Colornames to RGBA (outside Color to reduce memory footprint)
Color » overload to allow an easy Color("black"), Add a cache if too much called and an Exception if the color doesn't exist.

Thanks
Ricardo

ouzel.graphics.ColorInfo.zip
samples.zip

@ricardok1
Copy link
Author

forget Color.cpp change on the zip

ouzel.graphics.ColorInfo.zip

@ricardok1
Copy link
Author

corrected cache key from char* to string

ouzel.graphics.ColorInfo.zip

@elnormous
Copy link
Owner

Ok, I will add them as constants in Colot.h rather than the string map. String lookup is slow and unneeded and strings take up unnecessary space.
Why do you need the compliance information in a game engine?

@elnormous
Copy link
Owner

Added first color constants (see the commit 743f89c).

@ricardok1
Copy link
Author

My intention was to give tools and facilitate further integration. This called just on time on object creation - doesn't impact on animation speed.

Please see Xlib on wikipedia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants