module Kiwi

Overview

Kiwi is a constraint solving algorith specifically designed for solving GUI layout constraints.

Usage is very simple, you just need to create an instance of the Solver and a few Variables. The actual constraints are written out like you would any mathematical equation.

Constraints support these opperators: >=, <=, ==, *, +, and -.

The Solver will not allow you to add a constraint that cannot be solved, and will raise an exception.

Example

solver = Kiwi::Solver.new
x = Kiwi::Variable.new("x")
y = Kiwi::Variable.new("y")
solver.add_constraint(x == 20)
solver.add_constraint(x + 2 == y + 10)
solver.update_variables
y.value # => 12
x.value # => 20

Included Modules

Defined in:

constraint.cr
dsl/dsl.cr
dsl/variable.cr
edit_info.cr
expression.cr
kiwi.cr
relational_operator.cr
row.cr
solver.cr
symbol.cr
tag.cr
term.cr
util.cr
variable_state.cr

Constant Summary

VERSION = "0.3.0"