examples: fix fireworks.v
parent
60a8881326
commit
2f328f952e
|
@ -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…
Reference in New Issue