Closed pckuijper closed 7 years ago
Hey man, Thank you for looking into this.
Unfortunately it seems this didn't fix the bug.
Running the exact same code again results in all black buttons + text again.
Likewise opening the lua
on OC and typing the following
g = component.glasses
rect = g.addRect()
rect.setColor(0,0,0)
rect.setSize(30,30)
rect.setAlpha(0.5)
txt = g.addTextLabel()
txt.setText('click')
txt.setScale(1)
txt.setColor(1,1,1)
Produces a black square with black text
With some testing it appears that creating a rectangle first and then text appears to leave this result.
Creating text, settings its color and then adding a rectangle does work when adding more text after (the text can be set normally)
Adding a dot
appears to yield the same result.
From my testing it seems that creating an object on the screen first and setting it's color changes the max value of what a color can be. Therefore setting a text color to white (1,1,1) will result in the text being whatever color the object is. This doesn't seem to happen when creating 2 text objects.
On an unrelated sidenote: It appears that through the code you input coordinates in a X, Y manner which makes sense. But when it comes to the size you go height, width (Y, X) which leads to confusion sometimes.
Thank you very much for fixing this o/ seems to work perfectly
I'm currently in the process of writing a little button API helper for the OC glasses. Great mod so far for sure, Having a good bit of fun with it.
The problem i'm running into is that the color of the textlabel the same is as the rectangle its on. For example i create a rectangle by glasses.addRect() and then setColor(0,0,0) and then do a glasses.addTextLabel() and do setColor(1,1,1) the text appears black instead of white. This follow the color of the rectangle. So changing the rectangle to 0,1,0 would give a green rectangle with green text.
The code i'm using can be see in this Gist
Note: the click functionality hasn't been implemented yet