Skip to content

nim bindings for Facebook's Yoga layout library

Notifications You must be signed in to change notification settings

mvenditto/nim-yoga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nim-yoga

nim bindings for Facebook's Yoga layout library

Example

import [
  yoga_enums,
  yoga
]

const
  rootW = 500
  rootH = 500
  childW = 100
  childH = 100
  
proc main() =
  let root = newYGNode()
  root.styleSetWidth(rootW)
  root.styleSetHeight(rootH)
  
  let node1 = newYGNode()
  node1.styleSetWidth(childW)
  node1.styleSetHeight(childH)

  let node2 = newYGNode()
  node2.styleSetWidth(childW)
  node2.styleSetHeight(childH)

  let node3 = newYGNode()
  node3.styleSetWidth(childW)
  node3.styleSetHeight(childH)

  root.insertChild(node1, 0)
  root.insertChild(node2, 1)
  root.insertChild(node3, 2)

  root.calculateLayout(rootW, rootH, YGDirectionLTR)
  
  #root=(top=0.0 left=0.0 width=500.0 height=500.0)
  #node1=(top=0.0 left=0.0 width=100.0 height=100.0)
  #node2(top=0.0 left=100.0 width=100.0 height=100.0)
  #node3(top=0.0 left=200.0 width=100.0 height=100.0)

Showcase

(drawn with nimskia!)

About

nim bindings for Facebook's Yoga layout library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published