Skip to content

Instantly share code, notes, and snippets.

@whyrusleeping
Last active December 14, 2015 00:49
Show Gist options
  • Save whyrusleeping/5001753 to your computer and use it in GitHub Desktop.
Save whyrusleeping/5001753 to your computer and use it in GitHub Desktop.
A mockup for gocmdchat class structure
type Drawable interface {
Draw()
}
type Selectable interface {
Draw()
Select() //button clicked
}
type Rectangle struct {
x,y int
width, height int
}
type Button struct {
rect Rectangle
OnClick func()
}
func (b *Button) Draw {
//draw the button
}
func (b *Button) Select() {
if b.OnClick != nil {
b.OnClick()
}
}
type Panel struct {
rect Rectangle
children []Drawable
}
func (p *Panel) Draw() {
//Draw the panel
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment