Skip to content

Commit ebd1be9

Browse files
committed
Fixes
1 parent 3006dd1 commit ebd1be9

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

menu/notifications.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package menu
2+
3+
import (
4+
"github.com/libretro/ludo/notifications"
5+
"github.com/libretro/ludo/video"
6+
)
7+
8+
// RenderNotifications draws the list of notification messages on the viewport
9+
func RenderNotifications() {
10+
fbw, fbh := vid.Window.GetFramebufferSize()
11+
vid.Font.UpdateResolution(fbw, fbh)
12+
for i, n := range notifications.List() {
13+
lw := vid.Font.Width(0.6*menu.ratio, n.Message)
14+
vid.DrawRoundedRect(
15+
25*menu.ratio, (float32(80+80*i)-52)*menu.ratio,
16+
lw+35*menu.ratio, 75*menu.ratio, 0.25,
17+
video.Color{R: 0.4, G: 0.4, B: 0, A: float32(n.Frames) / 120.0})
18+
vid.Font.SetColor(1, 1, 0.85, float32(n.Frames)/120.0)
19+
vid.Font.Printf(
20+
45*menu.ratio, float32(80+80*i)*menu.ratio, 0.6*menu.ratio, n.Message)
21+
}
22+
}

video/gfx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (video *Video) DrawRoundedRect(x, y, w, h, r float32, c Color) {
121121
// DrawCircle draws a circle
122122
func (video *Video) DrawCircle(x, y, r float32, c Color) {
123123

124-
va := video.vertexArray(x, y, r*2, r*2, 1.0)
124+
va := video.vertexArray(x-r, y-r, r*2, r*2, 1.0)
125125

126126
gl.UseProgram(video.circleProgram)
127127
gl.Uniform4f(gl.GetUniformLocation(video.circleProgram, gl.Str("color\x00")), c.R, c.G, c.B, c.A)

0 commit comments

Comments
 (0)