mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
examples: fix fireworks.v
This commit is contained in:
parent
60a8881326
commit
2f328f952e
1 changed files with 5 additions and 7 deletions
|
@ -3,7 +3,6 @@ import objects
|
||||||
import gg
|
import gg
|
||||||
import gx
|
import gx
|
||||||
import rand
|
import rand
|
||||||
import sokol.sapp
|
|
||||||
|
|
||||||
struct App {
|
struct App {
|
||||||
mut:
|
mut:
|
||||||
|
@ -56,7 +55,7 @@ fn on_frame(mut app App) {
|
||||||
app.gg.end()
|
app.gg.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_event(e &sapp.Event, mut app App) {
|
fn on_event(e &gg.Event, mut app App) {
|
||||||
match e.typ {
|
match e.typ {
|
||||||
.resized, .restored, .resumed { app.resize() }
|
.resized, .restored, .resumed { app.resize() }
|
||||||
else {}
|
else {}
|
||||||
|
@ -64,15 +63,14 @@ fn on_event(e &sapp.Event, mut app App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut app App) resize() {
|
fn (mut app App) resize() {
|
||||||
mut s := sapp.dpi_scale()
|
mut s := gg.dpi_scale()
|
||||||
if s == 0.0 {
|
if s == 0.0 {
|
||||||
s = 1.0
|
s = 1.0
|
||||||
}
|
}
|
||||||
w := int(sapp.width() / s)
|
size := gg.window_size()
|
||||||
h := int(sapp.height() / s)
|
|
||||||
app.ui.dpi_scale = s
|
app.ui.dpi_scale = s
|
||||||
app.ui.width = w
|
app.ui.width = size.width
|
||||||
app.ui.height = h
|
app.ui.height = size.height
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue