gen2brain / raylib-go

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
zlib License
1.61k stars 165 forks source link

Issue Getting Custom Colors to Work #108

Closed ghost closed 4 years ago

ghost commented 4 years ago

Not sure if this is a bug or I am not doing it correctly however apart from the predefined colors raylib also seems to offer the ability to define your own colors using RGBA values.

I am however really struggling to get this to work. If you take a look at the images or text below.

I create the color using the code

// colors green2 = rl.Color{77, 255, 77, 1}

which seems to work fine however Visual Studio Code gives me a WARNING (not error)

github.com/lachee/raylib-goplus/raylib.Color composite literal uses unkeyed fields

However it allows me to compile the code the problem is that though the program runs the color is blank and does not display, what is supposed to be green is just blank with no color at all.

If you have any help/advice as to how to create/use custom colors it would be really appreciated.

Nicholas Annotation 2020-08-18 081729 2

gen2brain commented 4 years ago

All default colors are defined with NewColor(), so you should use that. Vet error is not related, you must use R: G: B: etc. in struct to avoid that, but as you see it cannot work like that.