apense / nimx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nimx

Cross-platform GUI framework in Nim.

./doc/sample-screenshot.png

Quick start

Installation

nimble install nimx

Usage

# File: main.nim
import nimx.sdl_window
import nimx.text_field

# First create a window. Window is the root of view hierarchy.
# Currently there are two types of windows. SdlWindow should be used
# with native targets, JSCanvasWindow should be used for WebGL target
var wnd : SdlWindow
wnd.new()
wnd.init(newRect(40, 40, 800, 600))

# Create a static text field and add it to view hierarchy
let label = newLabel(newRect(20, 20, 150, 20))
label.text = "Hello, world!"
wnd.addSubview(label)

# Run the main loop
runUntilQuit()

Running

nim c -r --noMain main.nim

Running nimx samples

cd $(nimble path nimx)/test
nake # Build and run on the current platform
# or
nake js # Build and run in default web browser

Reference

TODO

About


Languages

Language:Nim 90.7%Language:Java 8.4%Language:Makefile 0.7%Language:Shell 0.2%Language:HTML 0.1%