Pixel UI

Pixel UI

2019-01-12

Finally have the mouse cursor sticking to the scrollbar grip.

2018-12-30

Working on a panel with scrollbars. so far so good needs some adjustments, but it has functionality.

2018-12-06

I have been playing more and more with the pixel game library. More and more I want some controls to use in my development. Simple buttons or checkboxes. I have started a library of my own for just such a task. It is in the very early stages, but I am having fun building it so far.

So far I have buttons and checkboxes and would like to build on that. I would like dropdowns and a file dialog. I will work away in my spare time and I am making good progress. Not enough to make public, soon when I have enough code that will be the idea.

Here are some screenshots of buttons and checkboxes:

Writing a function to make sure text always fits the control.

Stay tuned, I will try to update my progress as I go.

global.Text

The global.Text struct helps us pin-point the position of our text. This will help when trying to place labels on controls. global.Text does not have a matrix, it will always start at pixel.ZV the zero vector. In the examples below the cross hair is pixel.ZV.

| Example | Alignment | | - | - | | | AlignLeft() method. Align starting from pixel.ZV with text moving right and down.| | | AlignRight() method. Align starting from pixel.ZV with text moving left and down.| | | Center() method. Center the width and height of the text with pixel.ZV. This is also the default alignment. | | | CenterHorizontally() method. Center the width of the text with pixel.ZV with text moving down. | | | CenterVertically() method. Center the height of the text with pixel.ZV with text moving right.|

There is also a method called Shorten(r pixel.Rect), this menthod will shorten text to fit a rectangle, as you can see in the images above Width 3 p... is long text but it was shortened and ... is the indicator that this line was shortened. The other lines fit the rectangle without the need to be shortened.

Be kind,
Steve