Socket
Socket
Sign inDemoInstall

github.com/aarzilli/nucular

Package Overview
Dependencies
16
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/aarzilli/nucular

Nucular is an immediate mode GUI library for Go, its implementation is a partial source port of Nuklear [0] by Micha Mettke. For a brief introduction to Immediate Mode GUI see [1] A window can be opened with the following three lines of code: The first line creates the MasterWindow object and sets its flags (usually 0 is fine) and updatefn as the update function. Updatefn will be responsible for drawing the contents of the window and handling the GUI logic (see the "Window Update and layout" section). The second line configures the theme, the font (passing nil will use the default font face) and the default scaling factor (see the "Scaling" section). The third line opens the window and starts its event loop, updatefn will be called whenever the window needs to be redrawn, this is usually only in response to mouse and keyboard events, if you want the window to be redrawn you can also manually call wnd.Changed(). The update function is responsible for drawing the contents of the window as well as handling user events, this is usually done by calling methods of nucular.Window. For example, drawing a simple text button is done with this code: Widgets are laid out left to right and top to bottom, each row has a layout that can be configured calling the methods of nucular.rowConstructor (an instance of which can be obtained by calling the `nucular.Window.Row` or `nucular.Window.RowScaled`). There are three main row layout modes: Static: in this mode the columns of the row have a fixed, user defined, width. This row layout can be selected calling Static or StaticScaled Dynamic: in this mode the columns of the row have a width proportional to the total width of the window. This row layout can be selected calling Dynamic, DynamicScaled or Ratio Space: in this mode widgets are positioned and sized arbitrarily. This row layout can be selected calling SpaceBegin or SpaceBeginRatio, once this row layout is selected widgets can be positioned using LayoutSpacePush or LayoutSpacePushRatio When calling SetStyle you can specify a scaling factor, this will be used to scale the sizes in the style argument and also all the size arguments for the methods of rowConstructor. Links


Version published

Readme

Source

Mostly-immediate-mode GUI library for Go. Source port to go of an early version of nuklear.

:warning: Subject to backwards incompatible changes. :warning:

:warning: Feature requests unaccompanied by an implementation will not be serviced. :warning:

Documentation

See godoc, _examples/simple/main.go and _examples/overview/main.go for single window examples, _examples/demo/demo.go for a multi-window example, and gdlv for a more complex application built using nucular.

Screenshots

Overview Gdlv

Backend

Nucular uses build tags to select its backend:

go build -tags nucular_gio

Selects the gio backend.

go build -tags nucular_shiny

Selects the shiny backend.

go build -tags nucular_shiny,metal

Selects the shiny backend but uses metal to render on macOS.

By default shiny is used on all operating systems except macOS, where gio is used.

FAQs

Last updated on 17 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc