fixed initial zoom for smaller grids, turned grid to 1px, fix generation count

This commit is contained in:
2024-06-04 18:46:59 +02:00
parent 126de458b1
commit f877cf5cb0
3 changed files with 7 additions and 12 deletions

View File

@@ -1,7 +1 @@
- add all other options like size etc - add all other options like size etc
- changing options mid-game has no effect in most cases, even after a restart
- initial zoom pos doesnt work for small grids
- fix generation count: starts even when delayedstart is on or on restart

View File

@@ -66,10 +66,10 @@ func (config *Config) SetupCamera() {
config.InitialCamPos[0] = math.Abs(config.InitialCamPos[0]) config.InitialCamPos[0] = math.Abs(config.InitialCamPos[0])
} }
// for Y we need only positive (really?) // same for Y
config.InitialCamPos[1] = float64(((config.ScreenHeight - (config.Height * config.Cellsize)) / 2) * -1)
if config.Height*config.Cellsize > config.ScreenHeight { if config.Height*config.Cellsize > config.ScreenHeight {
config.InitialCamPos[1] = math.Abs( config.InitialCamPos[1] = math.Abs(config.InitialCamPos[1])
float64(((config.ScreenHeight - (config.Height * config.Cellsize)) / 2)))
} }
// Calculate zoom out factor, which shows 100% of the world. We // Calculate zoom out factor, which shows 100% of the world. We
@@ -80,7 +80,7 @@ func (config *Config) SetupCamera() {
// is being used in camera.go:worldMatrix(). // is being used in camera.go:worldMatrix().
// FIXME: determine if the diff is larger on width, then calc with // FIXME: determine if the diff is larger on width, then calc with
// widh instead of height // width instead of height
config.ZoomOutFactor = int( config.ZoomOutFactor = int(
math.Log(float64(config.ScreenHeight)/(float64(config.Height)*float64(config.Cellsize))) / math.Log(float64(config.ScreenHeight)/(float64(config.Height)*float64(config.Cellsize))) /
math.Log(1.01)) math.Log(1.01))

View File

@@ -385,6 +385,7 @@ func (scene *ScenePlay) SaveRectRLE() {
func (scene *ScenePlay) Update() error { func (scene *ScenePlay) Update() error {
if scene.Config.Restart { if scene.Config.Restart {
scene.Config.Restart = false scene.Config.Restart = false
scene.Generations = 0
scene.InitGrid() scene.InitGrid()
scene.InitCache() scene.InitCache()
return nil return nil
@@ -713,8 +714,8 @@ func FillCell(tile *ebiten.Image, cellsize int, col color.RGBA) {
tile, tile,
float32(1), float32(1),
float32(1), float32(1),
float32(cellsize-1), float32(cellsize),
float32(cellsize-1), float32(cellsize),
col, false, col, false,
) )
} }