Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kivutar committed Nov 12, 2018
1 parent 3006dd1 commit ebd1be9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions menu/notifications.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package menu

import (
"github.com/libretro/ludo/notifications"
"github.com/libretro/ludo/video"
)

// RenderNotifications draws the list of notification messages on the viewport
func RenderNotifications() {
fbw, fbh := vid.Window.GetFramebufferSize()
vid.Font.UpdateResolution(fbw, fbh)
for i, n := range notifications.List() {
lw := vid.Font.Width(0.6*menu.ratio, n.Message)
vid.DrawRoundedRect(
25*menu.ratio, (float32(80+80*i)-52)*menu.ratio,
lw+35*menu.ratio, 75*menu.ratio, 0.25,
video.Color{R: 0.4, G: 0.4, B: 0, A: float32(n.Frames) / 120.0})
vid.Font.SetColor(1, 1, 0.85, float32(n.Frames)/120.0)
vid.Font.Printf(
45*menu.ratio, float32(80+80*i)*menu.ratio, 0.6*menu.ratio, n.Message)
}
}
2 changes: 1 addition & 1 deletion video/gfx.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (video *Video) DrawRoundedRect(x, y, w, h, r float32, c Color) {
// DrawCircle draws a circle
func (video *Video) DrawCircle(x, y, r float32, c Color) {

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

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

0 comments on commit ebd1be9

Please sign in to comment.