Skip to content

manen/rlnicex

Repository files navigation

RlNiceX

RlNiceX is a Raylib library for creating and styling interactive GUI and HUD widgets.

License

GPL 3

Usage

Example usages for all widgets + styling

import (
  rl "github.com/gen2brain/raylib-go/raylib"
  rlx "github.com/manen/rlnicex"
)

(You'll need a correctly initialized Raylib window)

Styles

Styles can be read from a JSON file. An example can be found here

Load style:

err := rlx.LoadStyle("./path/to/style.json")
if err != nil {
  // Handle error
}

NOTE: You can create manual styles too. Not recommended though.

sc := rlx.StyleConfig{
  Base: rlx.Style{
    Background: rl.Black,
  },
  Held: rlx.Style{
    BorderWidth: 4,
  },
}
err := sc.Apply()
if err != nil {
  // Handle error
}

If you've done this, all widgets will use the respected theme.

Offset

r := rlx.NewOffset(0, 0) // Why 'r'? I don't know, lol

Render any widget

for !rl.WindowShouldClose() {
  widget.Render(r)
}

Label

lbl := rlx.NewLabel("Label here!", false, 4, 4)

Button

btn := rlx.NewButton(rlx.NewLabelSimple("Click me!"), 10, 10, 140, 40)

Check if clicked:

if btn.IsClicked(r) {
  log.Println("Clicked!")
}

About

Widget Library for raylib-go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages