I’m hoping to make my cellular automaton look cool with low room light settings. The widget paints both a background grid plus some active cells. I’m hoping to take advantage of the new brightness settings in rack. I’ve been successful in overriding the drawLayer method for the widget. It looks like this with a darkened background:
My question is: Is there a way for me to read the room brightness so that I can fine-tune the background grid color? Similarly, is there a way to read the light bloom value?
Yes, that’s exactly what I’m hoping to do. I hope to dim the grid so that only the bright squares appear. And I’m also hoping to figure out a way to add a halo effect to the bright squares based on the settings::haloBrightness and general room brightness.
If your widget is a ModuleLightWidget, try moving the drawing of the grid to drawBackground, that should hide the grid when the lights are out. Then, for the halo, make sure you have the ModuleLightWidgets color set. The drawHalo function checks the color and if it is black, it does nothing.
You could draw the background of the grid in the draw method, and the active cells in the drawLayer method. Irrespective of whether or not it’s a ModuleLightWidget.
The background will be drawn, then the room darkening layer is applied, then the drawLayer(… 1) method is called to draw the illuminated parts.
If you want to fine tune things, you could draw the background in the draw method, and then draw it again with a degree of transparency in the drawLayer method. Which is what I’ve done in this example:
The draw method has a white rectangle.
The drawLayer method has the same rectangle with a white → transparent gradient, and then also the scale and needle.