From 5cd926a1b221853b50e94fb26117b5d329d15941 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 2 Feb 2022 22:27:29 -0800 Subject: [PATCH] Rename example components --- examples/twinstick/component/bullet.go | 2 +- examples/twinstick/component/position.go | 2 +- examples/twinstick/component/velocity.go | 2 +- examples/twinstick/component/weapon.go | 2 +- examples/twinstick/entity/bullet.go | 6 +++--- examples/twinstick/entity/player.go | 6 +++--- examples/twinstick/system/draw_bullets.go | 4 ++-- examples/twinstick/system/draw_player.go | 4 ++-- examples/twinstick/system/input_fire.go | 4 ++-- examples/twinstick/system/input_move.go | 4 ++-- examples/twinstick/system/input_profile.go | 2 +- examples/twinstick/system/movement.go | 4 ++-- examples/twinstick/system/printinfo.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/twinstick/component/bullet.go b/examples/twinstick/component/bullet.go index fc99c85..877bc15 100644 --- a/examples/twinstick/component/bullet.go +++ b/examples/twinstick/component/bullet.go @@ -3,5 +3,5 @@ package component -type BulletComponent struct { +type Bullet struct { } diff --git a/examples/twinstick/component/position.go b/examples/twinstick/component/position.go index b4a8e48..10270b3 100644 --- a/examples/twinstick/component/position.go +++ b/examples/twinstick/component/position.go @@ -3,6 +3,6 @@ package component -type PositionComponent struct { +type Position struct { X, Y float64 } diff --git a/examples/twinstick/component/velocity.go b/examples/twinstick/component/velocity.go index a24de21..c6e84fb 100644 --- a/examples/twinstick/component/velocity.go +++ b/examples/twinstick/component/velocity.go @@ -3,6 +3,6 @@ package component -type VelocityComponent struct { +type Velocity struct { X, Y float64 } diff --git a/examples/twinstick/component/weapon.go b/examples/twinstick/component/weapon.go index a493d89..079753d 100644 --- a/examples/twinstick/component/weapon.go +++ b/examples/twinstick/component/weapon.go @@ -7,7 +7,7 @@ import ( "time" ) -type WeaponComponent struct { +type Weapon struct { Ammo int Damage int diff --git a/examples/twinstick/entity/bullet.go b/examples/twinstick/entity/bullet.go index 0aafc72..d6de76a 100644 --- a/examples/twinstick/entity/bullet.go +++ b/examples/twinstick/entity/bullet.go @@ -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 } diff --git a/examples/twinstick/entity/player.go b/examples/twinstick/entity/player.go index a3fa4ab..c237932 100644 --- a/examples/twinstick/entity/player.go +++ b/examples/twinstick/entity/player.go @@ -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, diff --git a/examples/twinstick/system/draw_bullets.go b/examples/twinstick/system/draw_bullets.go index 893fc96..8b45ec0 100644 --- a/examples/twinstick/system/draw_bullets.go +++ b/examples/twinstick/system/draw_bullets.go @@ -11,8 +11,8 @@ import ( ) type DrawBulletsSystem struct { - Position *component.PositionComponent - Bullet *component.BulletComponent + Position *component.Position + Bullet *component.Bullet op *ebiten.DrawImageOptions } diff --git a/examples/twinstick/system/draw_player.go b/examples/twinstick/system/draw_player.go index cdbe315..6bd7f87 100644 --- a/examples/twinstick/system/draw_player.go +++ b/examples/twinstick/system/draw_player.go @@ -11,8 +11,8 @@ import ( ) type drawPlayerSystem struct { - Position *component.PositionComponent - Weapon *component.WeaponComponent + Position *component.Position + Weapon *component.Weapon op *ebiten.DrawImageOptions } diff --git a/examples/twinstick/system/input_fire.go b/examples/twinstick/system/input_fire.go index 602e492..4bfb22e 100644 --- a/examples/twinstick/system/input_fire.go +++ b/examples/twinstick/system/input_fire.go @@ -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 { diff --git a/examples/twinstick/system/input_move.go b/examples/twinstick/system/input_move.go index 60ff9ac..f0bff67 100644 --- a/examples/twinstick/system/input_move.go +++ b/examples/twinstick/system/input_move.go @@ -10,8 +10,8 @@ import ( ) type movementInputSystem struct { - Velocity *component.VelocityComponent - Weapon *component.WeaponComponent + Velocity *component.Velocity + Weapon *component.Weapon } func NewMovementInputSystem() *movementInputSystem { diff --git a/examples/twinstick/system/input_profile.go b/examples/twinstick/system/input_profile.go index 41dddd2..58eeb99 100644 --- a/examples/twinstick/system/input_profile.go +++ b/examples/twinstick/system/input_profile.go @@ -18,7 +18,7 @@ import ( ) type profileSystem struct { - Weapon *component.WeaponComponent + Weapon *component.Weapon cpuProfile *os.File } diff --git a/examples/twinstick/system/movement.go b/examples/twinstick/system/movement.go index 6134008..7db56d8 100644 --- a/examples/twinstick/system/movement.go +++ b/examples/twinstick/system/movement.go @@ -11,8 +11,8 @@ import ( ) type MovementSystem struct { - Position *component.PositionComponent - Velocity *component.VelocityComponent + Position *component.Position + Velocity *component.Velocity } func NewMovementSystem() *MovementSystem { diff --git a/examples/twinstick/system/printinfo.go b/examples/twinstick/system/printinfo.go index 696325c..bce7ae2 100644 --- a/examples/twinstick/system/printinfo.go +++ b/examples/twinstick/system/printinfo.go @@ -14,7 +14,7 @@ import ( ) type printInfoSystem struct { - Weapon *component.WeaponComponent + Weapon *component.Weapon img *ebiten.Image op *ebiten.DrawImageOptions diff --git a/go.mod b/go.mod index 9f5d24a..f6a4dc4 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 0162cd0..f3bf034 100644 --- a/go.sum +++ b/go.sum @@ -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=