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

Gosu::Color should implement Gosu::Color#argb #476

Closed
mblumtritt opened this issue Oct 25, 2018 · 1 comment
Closed

Gosu::Color should implement Gosu::Color#argb #476

mblumtritt opened this issue Oct 25, 2018 · 1 comment

Comments

@mblumtritt
Copy link

Since Gosu::Color.new accepts an argb value the instance should be able to return this value.

A method Gosu::Color#argb would be fine, maybe Gosu::Color#to_i is acceptable for this.

There is only an Gosu::Color#abgr which is not accepted by any Gosu::Color method. (Where is this helpful?)

@jlnr
Copy link
Member

jlnr commented Jan 16, 2020

In theory there is a Gosu::Color#argb method, but in practice SWIG has merged it with the class method of the same name:

irb(main):004:0> Gosu::Color.argb
ArgumentError (Wrong arguments for overloaded method 'Color.argb'.)
Possible C/C++ prototypes are:
    std::uint32_t Color.argb(Gosu::Color const *self)
    Gosu::Color Color.argb(Gosu::Color::Channel a, Gosu::Color::Channel r, Gosu::Color::Channel g, Gosu::Color::Channel b)
    Gosu::Color Color.argb(std::uint32_t argb)

I'll export it in SWIG as #to_i to prevent this from happening, and then alias it to #argb as well.

There is only an Gosu::Color#abgr which is not accepted by any Gosu::Color method. (Where is this helpful?)

I think this is from when Gosu still had a Direct3D backend. There's also a #bgr method that I think was only ever useful for Win32 programming:

irb(main):006:0> Gosu::Color::FUCHSIA.bgr
=> 16711935

Maybe I'll kick them out at some point in the future.

jlnr added a commit that referenced this issue Jan 17, 2020
@jlnr jlnr closed this as completed in 746f70b Jan 17, 2020
@jlnr jlnr mentioned this issue Jan 17, 2020
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