Giving image representation a top and left border
plus some other minor visual cleanups to web game.
This commit is contained in:
parent
45c45bb838
commit
142c802a70
@ -178,7 +178,8 @@ func (state *GameState) String() string {
|
||||
}
|
||||
|
||||
func (state *GameState) Image(xMult, yMult int) (*image.Gray, error) {
|
||||
img := image.NewGray(image.Rect(0, 0, state.Height()*xMult, state.Width()*yMult))
|
||||
img := image.NewGray(image.Rect(0, 0,
|
||||
(state.Height()*xMult)+1, (state.Width()*yMult)+1))
|
||||
draw.Draw(img, img.Bounds(), &image.Uniform{color.Gray16{0xff}},
|
||||
image.ZP, draw.Src)
|
||||
|
||||
@ -196,8 +197,8 @@ func (state *GameState) Image(xMult, yMult int) (*image.Gray, error) {
|
||||
color = black
|
||||
}
|
||||
|
||||
square := image.Rect(cell.X*xMult, cell.Y*yMult,
|
||||
(cell.X*xMult)+xMult-1, (cell.Y*yMult)+yMult-1)
|
||||
square := image.Rect((cell.X*xMult)+1, (cell.Y*yMult)+1,
|
||||
(cell.X*xMult)+xMult, (cell.Y*yMult)+yMult)
|
||||
draw.Draw(img, square, color, image.ZP, draw.Src)
|
||||
}
|
||||
|
||||
|
@ -3,4 +3,6 @@ set -e
|
||||
|
||||
cd web_assets
|
||||
go build -x .
|
||||
./web_assets index.html | gofmt > ../web_assets.go
|
||||
./web_assets index.html > _tmp.go
|
||||
gofmt < _tmp.go > ../web_assets.go
|
||||
rm -vf _tmp.go
|
||||
|
@ -1,20 +1,22 @@
|
||||
// WARNING: GENERATED FILE, NERDS! 2012-12-19 00:05:27.733288 -0500 EST
|
||||
// WARNING: GENERATED FILE, NERDS! 2012-12-19 00:21:18.395802 -0500 EST
|
||||
package conway
|
||||
|
||||
const (
|
||||
GAME_OF_LIFE_INDEX_HTML = `
|
||||
H4sIAAAJbogC/5RV32/TMBB+319xhEpJRZRsCHhY074MBENom7YiwRPy0mvqzrEz+zIoU/93nDhJ
|
||||
k+6HWB7S+Hz+7vvuztfk1cfzk/nPi0+wolzMDhL3A5CskC2qD/tJnATOTpT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+43,32 @@
|
||||
$('#play').click(function() { goToNextState(curState, true); });
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 0 auto;
|
||||
width: 1024px;
|
||||
}
|
||||
|
||||
#state_container {
|
||||
margin-top: 21px;
|
||||
padding-top: 9px;
|
||||
border-top: 1px solid #999;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Conway's Game of Life</h1>
|
||||
<div id="controls">
|
||||
<button id="step">Step</button>
|
||||
<button id="play">Play</button>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="state_container">
|
||||
<div id="container">
|
||||
<h1>Conway's Game of Life</h1>
|
||||
<div id="controls">
|
||||
<button id="play">Play</button>
|
||||
<button id="step">Step</button>
|
||||
</div>
|
||||
<div id="state_container">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user