No description
Find a file
2025-02-02 01:21:54 +02:00
.github/workflows Update main.yml 2022-11-29 14:26:11 -07:00
data button test 2022-04-20 01:55:59 -07:00
examples Added abillity of generic widgets and toggle group to test it 2023-03-21 00:36:23 -06:00
src Added abillity of generic widgets and toggle group to test it 2023-03-21 00:36:23 -06:00
tests Added abillity of generic widgets and toggle group to test it 2023-03-21 00:36:23 -06:00
.gitignore add missing theming file 2022-10-20 02:40:56 -07:00
config.nims fix non-arc compile 2022-10-16 21:46:46 -07:00
fidgetty.nimble Update fidgetty.nimble 2022-11-29 14:27:16 -07:00
LICENSE Initial commit 2022-04-20 01:20:37 -07:00
README.md Update README.md 2025-02-02 01:21:54 +02:00

Fidgetty

NOTE: Checkout Figuro the successor to Fidgetty

Widget library built using a fork of Fidget written in pure Nim and OpenGL rendered.

Demo application in example/demo.nim:

Demo

nimble install -d
nim c -r examples/demo.nim

Example widget and application:

import std/strformat, std/hashes
import fidgetty
loadFont("IBM Plex Sans", "IBMPlexSans-Regular.ttf")

fidgetty CounterButton:
  properties:
    label: string
  state:
    count: int

proc new*(_: typedesc[CounterButtonProps]): CounterButtonProps =
  new result
  fill palette.foreground

proc render*(
    props: CounterButtonProps,
    self: CounterButtonState
): Events[All]=
  clipContent true
  cornerRadius theme.cornerRadius
  onHover:
    highlight palette
  onClick:
    self.count.inc()
  text "counter button":
    boxSizeOf parent
    fill palette.text
    characters  fmt"label ({self.count})"
    textAutoResize tsHeight

type
  AppState* = ref object
    count1: int

proc exampleApp*() =
  ## defines a stateful app widget
  frame "main":
    font "IBM Plex Sans", 16, 200, 0, hCenter, vCenter
    let self = withState(AppState)

    CounterButton:
      centeredXY 8'em, 2'em
      onClick:
        echo "hi!"

startFidget(
  exampleApp,
  setup = 
    when defined(demoBulmaTheme): setup(bulmaTheme)
    else: setup(grayTheme),
  w=640, h=400,
  uiScale=2.0
)