forked from pankona/gomo-simra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
title.go
67 lines (52 loc) · 1.83 KB
/
title.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
58
59
60
61
62
63
64
65
66
67
package scene
import (
"image"
"github.com/telecoda/gomo-simra/examples/sample2/scene/config"
"github.com/telecoda/gomo-simra/simra"
)
// Title represents a scene object for Title
type Title struct {
background simra.Sprite
}
// Initialize initializes title scene
// This is called from simra.
// simra.GetInstance().SetDesiredScreenSize should be called to determine
// screen size of this scene.
func (title *Title) Initialize() {
simra.LogDebug("[IN]")
simra.GetInstance().SetDesiredScreenSize(config.ScreenWidth, config.ScreenHeight)
// initialize sprites
title.initialize()
simra.LogDebug("[OUT]")
}
func (title *Title) initialize() {
// add background sprite
title.background.W = float32(config.ScreenWidth)
title.background.H = float32(config.ScreenHeight)
// put center of screen
title.background.X = config.ScreenWidth / 2
title.background.Y = config.ScreenHeight / 2
simra.GetInstance().AddSprite("title.png",
image.Rect(0, 0, int(title.background.W), int(title.background.H)),
&title.background)
title.background.AddTouchListener(title)
}
// Drive is called from simra.
// This is used to update sprites position.
// This will be called 60 times per sec.
func (title *Title) Drive() {
}
// OnTouchBegin is called when Title scene is Touched.
// It is caused by calling AddtouchListener for title.background sprite.
func (title *Title) OnTouchBegin(x, y float32) {
}
// OnTouchMove is called when Title scene is Touched and moved.
// It is caused by calling AddtouchListener for title.background sprite.
func (title *Title) OnTouchMove(x, y float32) {
}
// OnTouchEnd is called when Title scene is Touched and it is released.
// It is caused by calling AddtouchListener for title.background sprite.
func (title *Title) OnTouchEnd(x, y float32) {
// scene end. go to next scene
simra.GetInstance().SetScene(&CtrlTrial{})
}