forked from iand/amberfell
/
pause.go
68 lines (50 loc) · 1.5 KB
/
pause.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
68
/*
To the extent possible under law, Ian Davis has waived all copyright
and related or neighboring rights to this Amberfell Source Code file.
This work is published from the United Kingdom.
*/
package main
import (
// "fmt"
"github.com/banthar/Go-SDL/sdl"
"github.com/banthar/gl"
// "math"
)
type Pause struct {
visible bool
}
func (self *Pause) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
gl.Color4ub(0, 0, 0, 240)
gl.Begin(gl.QUADS)
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.tplane))
gl.Vertex2f(float32(viewport.lplane), float32(viewport.tplane))
gl.End()
str := "paused"
h, w := pauseFont.Measure(str)
// x := (viewport.rplane - viewport.lplane - w) / 2
// y := (viewport.tplane - viewport.bplane - h) / 2
gl.Translated(-w/2, -h/2, 0)
pauseFont.Print(str)
gl.PopMatrix()
}
func (self *Pause) HandleMouseButton(re *sdl.MouseButtonEvent) {
if re.Button == 1 && re.State == 1 { // LEFT, DOWN
// x, y := viewport.ScreenCoordsToWorld2D(re.X, re.Y)
}
}
func (self *Pause) HandleMouse(mousex int, mousey int, mousestate uint8) {
// x, y := viewport.ScreenCoordsToWorld2D(uint16(mousex), uint16(mousey))
}
func (self *Pause) HandleKeyboard(re *sdl.KeyboardEvent) {
}
func (self *Pause) HandleKeys(keys []uint8) {
}