-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#39 - adds SceneWithCamera; zoom works
- Loading branch information
Showing
7 changed files
with
135 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package game | ||
|
||
import ( | ||
"github.com/co0p/tankism/lib/ecs" | ||
"github.com/hajimehoshi/ebiten/v2" | ||
camera "github.com/melonfunction/ebiten-camera" | ||
) | ||
|
||
type GameSceneWithCamera struct { | ||
Systems []ecs.System | ||
EntityManager ecs.EntityManager | ||
Camera camera.Camera // TODO move to own camera wrapping this | ||
|
||
game Game | ||
} | ||
|
||
func (s *GameSceneWithCamera) Init() error { | ||
return nil | ||
} | ||
|
||
func (s *GameSceneWithCamera) Draw(screen *ebiten.Image) { | ||
|
||
s.Camera.Surface.Clear() | ||
|
||
for _, v := range s.Systems { | ||
v.Draw(s.Camera.Surface) | ||
} | ||
|
||
s.Camera.Blit(screen) | ||
|
||
} | ||
|
||
func (s *GameSceneWithCamera) Update() error { | ||
var err error | ||
for _, v := range s.Systems { | ||
err = v.Update() | ||
} | ||
return err | ||
} | ||
|
||
func (s *GameSceneWithCamera) HandleInput() {} |
This file contains 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
This file contains 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