GoLang, Pixel, Window

In the last snippet we saw the different fields of data we could obtain from the pixelgl Monitor struct. Now lets expand on the Create-a-Window tutorial from pixel and make use of the fields we do not see used.

We know that we can retreive information on multiple monitors, I am only going to be using a single primary monitor for these snippets.

primary monitor:
-name: eDP
-bitDepth: 8-bit red, 8-bit green, 8-bit blue
-physicalSize: 509 mm, 286 mm
-position: 0, 0 upper-left corner
-refreshRate: 59 Hz
-size: 1920 px, 1080 px
-video mode 0: -width: 640 px, height: 480 px, refresh rate:59 Hz
-video mode 14: -width: 1920 px, height: 1080 px, refresh rate:59 Hz

The WindowConfig base setup in the Create-a-Window tutorial is as follows. This will allow us to create a window with a minimize and close button.

cfg := pixelgl.WindowConfig {
	Title: "snippet-02",
	Bounds: pixel.R(0, 0, 640, 480),
	VSync: true,

This is what the output will look like:

Good luck with your own setup.

Be kind, Steve

comments powered by Disqus