1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: fix fireworks.v

This commit is contained in:
Alexander Medvednikov 2021-02-17 06:50:09 +01:00
parent 60a8881326
commit 2f328f952e

View File

@ -3,7 +3,6 @@ import objects
import gg
import gx
import rand
import sokol.sapp
struct App {
mut:
@ -56,7 +55,7 @@ fn on_frame(mut app App) {
app.gg.end()
}
fn on_event(e &sapp.Event, mut app App) {
fn on_event(e &gg.Event, mut app App) {
match e.typ {
.resized, .restored, .resumed { app.resize() }
else {}
@ -64,15 +63,14 @@ fn on_event(e &sapp.Event, mut app App) {
}
fn (mut app App) resize() {
mut s := sapp.dpi_scale()
mut s := gg.dpi_scale()
if s == 0.0 {
s = 1.0
}
w := int(sapp.width() / s)
h := int(sapp.height() / s)
size := gg.window_size()
app.ui.dpi_scale = s
app.ui.width = w
app.ui.height = h
app.ui.width = size.width
app.ui.height = size.height
}
fn main() {