Browse Source

Rename example components

main
Trevor Slocum 3 months ago
parent
commit
5cd926a1b2
  1. 2
      examples/twinstick/component/bullet.go
  2. 2
      examples/twinstick/component/position.go
  3. 2
      examples/twinstick/component/velocity.go
  4. 2
      examples/twinstick/component/weapon.go
  5. 6
      examples/twinstick/entity/bullet.go
  6. 6
      examples/twinstick/entity/player.go
  7. 4
      examples/twinstick/system/draw_bullets.go
  8. 4
      examples/twinstick/system/draw_player.go
  9. 4
      examples/twinstick/system/input_fire.go
  10. 4
      examples/twinstick/system/input_move.go
  11. 2
      examples/twinstick/system/input_profile.go
  12. 4
      examples/twinstick/system/movement.go
  13. 2
      examples/twinstick/system/printinfo.go
  14. 2
      go.mod
  15. 4
      go.sum

2
examples/twinstick/component/bullet.go

@ -3,5 +3,5 @@ @@ -3,5 +3,5 @@
package component
type BulletComponent struct {
type Bullet struct {
}

2
examples/twinstick/component/position.go

@ -3,6 +3,6 @@ @@ -3,6 +3,6 @@
package component
type PositionComponent struct {
type Position struct {
X, Y float64
}

2
examples/twinstick/component/velocity.go

@ -3,6 +3,6 @@ @@ -3,6 +3,6 @@
package component
type VelocityComponent struct {
type Velocity struct {
X, Y float64
}

2
examples/twinstick/component/weapon.go

@ -7,7 +7,7 @@ import ( @@ -7,7 +7,7 @@ import (
"time"
)
type WeaponComponent struct {
type Weapon struct {
Ammo int
Damage int

6
examples/twinstick/entity/bullet.go

@ -11,17 +11,17 @@ import ( @@ -11,17 +11,17 @@ import (
func NewBullet(x, y, xSpeed, ySpeed float64) gohan.Entity {
bullet := gohan.NewEntity()
bullet.AddComponent(&component.PositionComponent{
bullet.AddComponent(&component.Position{
X: x,
Y: y,
})
bullet.AddComponent(&component.VelocityComponent{
bullet.AddComponent(&component.Velocity{
X: xSpeed,
Y: ySpeed,
})
bullet.AddComponent(&component.BulletComponent{})
bullet.AddComponent(&component.Bullet{})
return bullet
}

6
examples/twinstick/entity/player.go

@ -17,14 +17,14 @@ func NewPlayer() gohan.Entity { @@ -17,14 +17,14 @@ func NewPlayer() gohan.Entity {
// Set position to -1,-1 to indicate the player has not been assigned a
// position yet. We will place the player in the center of the screen when
// we receive the screen dimensions for the first time.
player.AddComponent(&component.PositionComponent{
player.AddComponent(&component.Position{
X: -1,
Y: -1,
})
player.AddComponent(&component.VelocityComponent{})
player.AddComponent(&component.Velocity{})
weapon := &component.WeaponComponent{
weapon := &component.Weapon{
Ammo: math.MaxInt64,
Damage: 1,
FireRate: 100 * time.Millisecond,

4
examples/twinstick/system/draw_bullets.go

@ -11,8 +11,8 @@ import ( @@ -11,8 +11,8 @@ import (
)
type DrawBulletsSystem struct {
Position *component.PositionComponent
Bullet *component.BulletComponent
Position *component.Position
Bullet *component.Bullet
op *ebiten.DrawImageOptions
}

4
examples/twinstick/system/draw_player.go

@ -11,8 +11,8 @@ import ( @@ -11,8 +11,8 @@ import (
)
type drawPlayerSystem struct {
Position *component.PositionComponent
Weapon *component.WeaponComponent
Position *component.Position
Weapon *component.Weapon
op *ebiten.DrawImageOptions
}

4
examples/twinstick/system/input_fire.go

@ -18,8 +18,8 @@ func angle(x1, y1, x2, y2 float64) float64 { @@ -18,8 +18,8 @@ func angle(x1, y1, x2, y2 float64) float64 {
}
type fireInputSystem struct {
Position *component.PositionComponent
Weapon *component.WeaponComponent
Position *component.Position
Weapon *component.Weapon
}
func NewFireInputSystem() *fireInputSystem {

4
examples/twinstick/system/input_move.go

@ -10,8 +10,8 @@ import ( @@ -10,8 +10,8 @@ import (
)
type movementInputSystem struct {
Velocity *component.VelocityComponent
Weapon *component.WeaponComponent
Velocity *component.Velocity
Weapon *component.Weapon
}
func NewMovementInputSystem() *movementInputSystem {

2
examples/twinstick/system/input_profile.go

@ -18,7 +18,7 @@ import ( @@ -18,7 +18,7 @@ import (
)
type profileSystem struct {
Weapon *component.WeaponComponent
Weapon *component.Weapon
cpuProfile *os.File
}

4
examples/twinstick/system/movement.go

@ -11,8 +11,8 @@ import ( @@ -11,8 +11,8 @@ import (
)
type MovementSystem struct {
Position *component.PositionComponent
Velocity *component.VelocityComponent
Position *component.Position
Velocity *component.Velocity
}
func NewMovementSystem() *MovementSystem {

2
examples/twinstick/system/printinfo.go

@ -14,7 +14,7 @@ import ( @@ -14,7 +14,7 @@ import (
)
type printInfoSystem struct {
Weapon *component.WeaponComponent
Weapon *component.Weapon
img *ebiten.Image
op *ebiten.DrawImageOptions

2
go.mod

@ -2,7 +2,7 @@ module code.rocketnine.space/tslocum/gohan @@ -2,7 +2,7 @@ module code.rocketnine.space/tslocum/gohan
go 1.17
require github.com/hajimehoshi/ebiten/v2 v2.2.3
require github.com/hajimehoshi/ebiten/v2 v2.2.4
require (
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be // indirect

4
go.sum

@ -2,8 +2,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym @@ -2,8 +2,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be h1:vEIVIuBApEBQTEJt19GfhoU+zFSV+sNTa9E9FdnRYfk=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/hajimehoshi/bitmapfont/v2 v2.1.3/go.mod h1:2BnYrkTQGThpr/CY6LorYtt/zEPNzvE/ND69CRTaHMs=
github.com/hajimehoshi/ebiten/v2 v2.2.3 h1:jZUP3XWP6mXaw9SCrjWT5Pl6EPuz6FY737dZQgN1KJ4=
github.com/hajimehoshi/ebiten/v2 v2.2.3/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0=
github.com/hajimehoshi/ebiten/v2 v2.2.4 h1:/+qrmbv+W6scgVWwQJ7IyiI2z4y8QM2n0JDHStNC+Ns=
github.com/hajimehoshi/ebiten/v2 v2.2.4/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0=
github.com/hajimehoshi/file2byteslice v0.0.0-20210813153925-5340248a8f41/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE=
github.com/hajimehoshi/go-mp3 v0.3.2/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI=

Loading…
Cancel
Save