Drivers

A driver in Fyne is responsible for rendering the text, canvas objects, and images, as well as handling window management and user input. The drivers are also required to handle any thread management behind the scenes. By adopting this design, it is possible for background processes or asynchronous events to update the user interface without any of the thread management code that is common in many graphical toolkits.

The default driver for Fyne uses Go-GL and the Go GLFW bindings, which means it has the same dependencies as the examples we worked through in the previous chapter, nk – Nuklear for Go. If your computer, and that of your target customers, supports OpenGL (which includes all recent desktop computers, most laptops, smart phones, and tablets, and beyond), then you don't need any additional libraries or support packages. Having the appropriate Go developer tools installed (see Prerequisites within the Getting started with Fyne, discussed earlier) is all you need, and there are no runtime requirements for users of your apps.

If you wish to build for an older computer, or one that does not have support for OpenGL, it is possible to use the alternative efl driver. This driver uses the Enlightenment Foundation Libraries to handle rendering, window management, and user input in a cross platform manner. Their years of development for a wide range of platforms (alongside desktop platforms, they support Playstation, Tizen, Samsung Gear watch, and various set-top boxes) means that applications could potentially run on a wider range of devices. To run using this driver, just add -tags efl to any go build or run command, such as go run -tags efl hello.go. While this driver does offer better multi-platform support, it also requires that the EFL libraries are installed both on the developer's computer and the target device. For this reason, it is often not the preferred approach when working with Fyne.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.68.18