doc: Refactoring

This commit is contained in:
Hajime Hoshi 2016-09-03 02:40:30 +09:00
parent 84b512a3ac
commit 74029cee13

View File

@ -131,29 +131,17 @@ func safeHTML(text string) template.HTML {
}
type example struct {
Name string
}
func (e *example) ThumbWidth() int {
if e.Name == "blocks" {
return 256
}
return 320
}
func (e *example) ThumbHeight() int {
if e.Name == "blocks" {
return 240
}
return 240
Name string
ThumbWidth int
ThumbHeight int
}
func (e *example) Width() int {
return e.ThumbWidth() * 2
return e.ThumbWidth * 2
}
func (e *example) Height() int {
return e.ThumbHeight() * 2
return e.ThumbHeight * 2
}
const commentForBlocks = `// Please read examples/blocks/main.go and examples/blocks/blocks/*.go
@ -179,22 +167,22 @@ func versions() string {
}
var examples = []example{
{Name: "alphablending"},
{Name: "audio"},
{Name: "font"},
{Name: "hsv"},
{Name: "hue"},
{Name: "gamepad"},
{Name: "keyboard"},
{Name: "masking"},
{Name: "mosaic"},
{Name: "noise"},
{Name: "paint"},
{Name: "perspective"},
{Name: "piano"},
{Name: "rotate"},
{Name: "sprites"},
{Name: "blocks"},
{"alphablending", 320, 240},
{"audio", 320, 240},
{"font", 320, 240},
{"hsv", 320, 240},
{"hue", 320, 240},
{"gamepad", 320, 240},
{"keyboard", 320, 240},
{"masking", 320, 240},
{"mosaic", 320, 240},
{"noise", 320, 240},
{"paint", 320, 240},
{"perspective", 320, 240},
{"piano", 320, 240},
{"rotate", 320, 240},
{"sprites", 320, 240},
{"blocks", 256, 240},
}
func clear() error {