-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.go
57 lines (45 loc) · 2 KB
/
game.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package game
import (
"github.com/YarikRevich/hide-seek-client/internal/core/effects/particles"
"github.com/YarikRevich/hide-seek-client/internal/core/render"
"github.com/hajimehoshi/ebiten/v2"
)
var particlesPool = particles.UseParticlesPool(4)
func Draw() {
render.UseRender().SetToRender(func(i *ebiten.Image) {
// cam := world.UseWorld().GetCamera()
// pc := world.UseWorld().GetPC()
// if events.UseEvents().Mouse().IsAnyMovementButtonPressed() {
// particle := particles.Props{
// SizeBegin: glm.Quat{V: glm.Vec3{0.3}},
// SizeVariation: glm.Quat{V: glm.Vec3{0.1}},
// SizeEnd: glm.Quat{V: glm.Vec3{0.2}},
// LifeTime: 2.0,
// Velocity: [2]float64{0.01, 0.01},
// VelocityVariation: [2]float64{2.0, 0.5},
// Position: [2]float64{0.0, 30.0},
// ColorBegin: color.CreateColorFromArray(pc.MetadataModel.Effects.TraceColorBegin),
// ColorEnd: color.CreateColorFromArray(pc.MetadataModel.Effects.TraceColorEnd),
// }
// particlesPool.Fill(particle)
// }
// particlesPool.Update(0.2)
// particlesPool.ForEachParticle(func(p *particles.Particle) {
// img := primitives.CreateSquare(20)
// opts := &ebiten.DrawImageOptions{}
// life := float32(p.LifeRemaining / p.LifeTime)
// scale := glm.QuatLerp(&p.SizeEnd, &p.SizeBegin, life)
// opts.GeoM.Scale(float64(scale.X()), float64(scale.X()))
// if pc.IsDirectionLEFT() {
// opts.GeoM.Rotate(p.Rotation)
// opts.GeoM.Translate((p.Position[0])+(pc.GetScaledOffsetX()-cam.AlignOffset.X), (p.Position[1])+(pc.GetScaledOffsetY()-cam.AlignOffset.Y))
// } else {
// opts.GeoM.Rotate(-p.Rotation)
// opts.GeoM.Translate(((pc.GetScaledOffsetX() - cam.AlignOffset.X) - (p.Position[0])), (p.Position[1])+(pc.GetScaledOffsetY()-cam.AlignOffset.Y))
// }
// colorVariantion := glm.QuatLerp(&p.ColorEnd, &p.ColorBegin, life)
// img.Fill(color.CreateRGBAFromQuatColor(colorVariantion))
// i.DrawImage(img, opts)
// })
})
}