import ../wain/[keyboard,mouse]

type
 Bind[T] = object
  case hasBind*: bool
  of true: value: T
  else: nil

 ActionBindObj = object of RootObj
  bind0*: Bind[T]
  action*: proc()
  #gamepad0
 ActionBind* = ref object of ActionBindObj

proc the*[T](value: T): Bind[T] = Bind[T](hasBind: true, value: value)

proc setBind*[T]( b: Bind[T]
                , value: T
                ) = 
 if value != nil: b.value = value
 else: 
  b.value = nil
  b.hasBind = false

proc emptyBind*[T]: Bind[T] = Bind[T](hasBind: false)