Last active
December 14, 2015 00:49
-
-
Save whyrusleeping/5001753 to your computer and use it in GitHub Desktop.
A mockup for gocmdchat class structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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