Skip to content

Commit

Permalink
Release version v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkauzh committed Jan 5, 2025
1 parent 0f800ba commit 7097008
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Binary file added examples/web/galaxy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions examples/web/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"embed"

vuelto "vuelto.pp.ua/pkg"
)

//go:embed tree.png galaxy.png
var embeddedFiles embed.FS

func main() {
// This works in the web too! This is because of the images being embedded!
w := vuelto.NewWindow("Image Example - Vuelto", 800, 600, false)
ren := w.NewRenderer2D()

iembed := vuelto.ImageEmbed{
Filesystem: embeddedFiles,
Image: "tree.png",
}

i2embed := vuelto.ImageEmbed{
Filesystem: embeddedFiles,
Image: "galaxy.png",
}

image1 := ren.LoadImage(iembed, 0.5, 0.5, -0.5, 0.5)
image := ren.LoadImage(i2embed, 0, 0, 1, 1)
rect := ren.NewRect(0, 0, -1, -1, [4]int{10, 145, 245, 255})
rect2 := ren.NewRect(0, 1, 1, 1, [4]int{245, 145, 10, 255})
line := ren.NewLine(0.5, 0.5, -0.5, -0.5, [4]int{10, 145, 245, 255})

for !w.Close() {
ren.ClearColor([4]int{100, 100, 100, 255})
ren.DrawLine(-0.9, -0.9, 0.9, -0.9, [4]int{10, 145, 245, 255})

rect.Draw()
rect2.Draw()
line.Draw()

image1.Draw()
image.Draw()
w.Refresh()
}
}
Binary file added examples/web/tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion internal/window/win_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (w *Window) Destroy() {}

func (w *Window) HandleEvents() {
now := time.Now()
w.deltaTime = now.Sub(w.lastTime).Seconds()
w.deltaTime = float32(now.Sub(w.lastTime).Seconds())
w.lastTime = now

duration := time.Since(w.lastTime)
Expand Down

0 comments on commit 7097008

Please sign in to comment.