Compare commits
4 Commits
6cd2b8186c
...
220e0ed712
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
220e0ed712 | ||
|
|
09de5bf455 | ||
|
|
296f56df72 | ||
|
|
10d6cad4a3 |
@@ -37,7 +37,8 @@ func loadScenes(m *groovy.Manager) {
|
||||
//loadMenu(m)
|
||||
//loadNoise(m)
|
||||
//loadSplashpad(m)
|
||||
loadParallax(m)
|
||||
//loadParallax(m)
|
||||
loadRays(m)
|
||||
|
||||
//reset the manager to start scene 1
|
||||
m.ResetScenes()
|
||||
@@ -95,3 +96,8 @@ func loadParallax(m *groovy.Manager) {
|
||||
m.AddScene(&sceneParallax)
|
||||
sceneParallax.InitializeParallax()
|
||||
}
|
||||
|
||||
func loadRays(m *groovy.Manager) {
|
||||
sceneRays := splashmenu.NewRays()
|
||||
m.AddScene(&sceneRays)
|
||||
}
|
||||
|
||||
@@ -175,6 +175,13 @@ func (p *Parallax) DrawDynamicBackground(screen *ebiten.Image) {
|
||||
xd := (x0-float64(x))/DEBRIS_SCALE_DIST*float64(k+1) + x0 - float64(p.increment*k)/FLOAT_SCALE
|
||||
yd := (y0-float64(y))/DEBRIS_SCALE_DIST*float64(k+1) + y0 - float64(p.increment*k)/FLOAT_SCALE
|
||||
|
||||
adjustX := float64(p.Dimensions.Width)
|
||||
adjustY := float64(p.Dimensions.Height)
|
||||
intX := adjustX * math.Floor(float64(p.increment)/adjustX)
|
||||
intY := adjustY * math.Floor(float64(p.increment)/adjustY)
|
||||
xd = xd + intX
|
||||
yd = yd + intY
|
||||
|
||||
op = &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Translate(xd, yd)
|
||||
//op.GeoM.Rotate(math.Pi / 180 * float64(p.increment))
|
||||
@@ -239,8 +246,10 @@ func (p *Parallax) RepositionTest(screen *ebiten.Image) {
|
||||
x0 := float32(p.Dimensions.Width / 2)
|
||||
y0 := float32(p.Dimensions.Height / 2)
|
||||
|
||||
xd := float32(100.0)
|
||||
yd := float32(100.0)
|
||||
adjustment := float32(400.0)
|
||||
|
||||
xd := adjustment / 4.0
|
||||
yd := adjustment / 4.0
|
||||
|
||||
//connect the dots
|
||||
path.MoveTo(x0-xd, y0-yd)
|
||||
@@ -272,11 +281,10 @@ func (p *Parallax) RepositionTest(screen *ebiten.Image) {
|
||||
|
||||
roX := float64(178 / 4)
|
||||
roY := float64(229 / 4)
|
||||
startX := float64(maxX) + roX
|
||||
startX := float64(maxX) + roX*2
|
||||
startY := float64(y0) + roY/2
|
||||
|
||||
adjustment := 400.0
|
||||
currentX := startX - float64(p.increment) + adjustment*math.Floor(float64(p.increment)/adjustment)
|
||||
currentX := startX - float64(p.increment) + float64(adjustment)*math.Floor(float64(p.increment)/float64(adjustment))
|
||||
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Scale(.5, .5)
|
||||
|
||||
49
examples/splashmenu/scenes/rays.go
Normal file
49
examples/splashmenu/scenes/rays.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package splashmenu
|
||||
|
||||
import (
|
||||
"cosmos/diego/groovy"
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
BGCOLOR = 0xCCCCCC
|
||||
)
|
||||
|
||||
type Rays struct {
|
||||
events map[groovy.SceneEvent]func()
|
||||
increment int
|
||||
Dimensions groovy.Area
|
||||
bgcolor color.RGBA
|
||||
}
|
||||
|
||||
func NewRays() Rays {
|
||||
return Rays{
|
||||
events: make(map[groovy.SceneEvent]func()),
|
||||
increment: 0,
|
||||
bgcolor: color.RGBA{
|
||||
R: BGCOLOR >> 0x10 & 0xff,
|
||||
G: BGCOLOR >> 0x08 & 0xff,
|
||||
B: BGCOLOR >> 0x00 & 0xff,
|
||||
A: 0xff,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Rays) Update() error {
|
||||
r.increment++
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Rays) Draw(screen *ebiten.Image) {
|
||||
screen.Fill(r.bgcolor)
|
||||
}
|
||||
|
||||
func (r *Rays) SetDimensions(a groovy.Area) {
|
||||
r.Dimensions = a
|
||||
}
|
||||
|
||||
func (r *Rays) SetEventHandler(event groovy.SceneEvent, f func()) {
|
||||
r.events[event] = f
|
||||
}
|
||||
@@ -10,7 +10,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
splashText = "schmoopysoft"
|
||||
splashText = "schmoopysoft®"
|
||||
splashSubtext = "\"how was the gravy\"\n- christorpher hollick"
|
||||
)
|
||||
|
||||
type Splash struct {
|
||||
@@ -53,7 +54,7 @@ func (s *Splash) Draw(screen *ebiten.Image) {
|
||||
y := s.Dimensions.Height / 2
|
||||
text.Draw(screen, splashText, splashmenu.SplashFont.MegaTitle, x, y, color.White)
|
||||
|
||||
text.Draw(screen, "\"how was the gravy\"\n- christorpher hollick", splashmenu.SplashFont.Title, x, y+40, color.White)
|
||||
text.Draw(screen, splashSubtext, splashmenu.SplashFont.Title, x, y+40, color.White)
|
||||
}
|
||||
|
||||
func (s *Splash) SetEventHandler(event groovy.SceneEvent, f func()) {
|
||||
|
||||
Reference in New Issue
Block a user