đ¨ Draw module¶
A module for drawing UI elements, such as rects.
đĸ Types¶
âšī¸ Usage¶
Note
For this you will need a renderer initialized.
For now this module is pretty basic. You can draw a rectangle using the DrawRect()
function, passing X position, Y position, width & height, and an RGBA color (int array as described above).
You can also use DrawLine()
to draw line that goes from x1
, y1
to x2
, y2
, and again, with a color.
You can also create them and render them later, using "New" instead of "Draw", with the same arguments.
myRect := renderer.NewRect(-0.4, -0.3, 0.4, 0.4, [4]int{67, 239, 189, 255})
myLine := renderer.NewLine(0.5, 0.5, -0.5, -0.5, [4]int{255, 255, 255, 255})
// then, when you feel like it, draw them
myRect.Draw();
myLine.Draw();
If you want to "clear" the window, you can use ClearColor()
, passing a color that'll be used as the background of the window.