Skip to content

Commit

Permalink
support camera and animation
Browse files Browse the repository at this point in the history
  • Loading branch information
ntop001 committed Mar 4, 2018
1 parent cf9c681 commit 7b0e8b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gfx/render_system.go
Expand Up @@ -89,7 +89,7 @@ func (th *RenderSystem) RegisterRender(t RenderType, render Render) {

func (th *RenderSystem) Update(dt float32) {
// update camera todo default invalid should be zero
if c := &th.MainCamera; c.follow != 1000000 {
if c := &th.MainCamera; c.follow != 0xFFFFFFFF {
xf := th.xfs.Comp(c.follow)
p := xf.Position()
c.MoveTo(p[0], p[1])
Expand All @@ -116,5 +116,6 @@ func (th *RenderSystem) Destroy() {

func NewRenderSystem() *RenderSystem {
th := new(RenderSystem)
th.MainCamera.follow = 0xFFFFFFFF
return th
}
5 changes: 5 additions & 0 deletions gfx/sprite.go
Expand Up @@ -14,6 +14,7 @@ import (
type SpriteComp struct {
engi.Entity
*SubTex
anim uint16

Scale float32
Color uint32
Expand Down Expand Up @@ -41,6 +42,10 @@ func (sc *SpriteComp) SetBatchId(b int16) {
sc.batchId = b
}

func (sc *SpriteComp) SetSize(w, h float32) {
sc.Width, sc.Height = w, h
}

type SpriteTable struct {
comps []SpriteComp
_map map[uint32]int
Expand Down

0 comments on commit 7b0e8b6

Please sign in to comment.