gg: window_size_real_pixels that for 3D without dpi scaling (#9004)
parent
5807e1b3ae
commit
1d69a0bd22
|
@ -268,7 +268,7 @@ fn cube_field(app App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(mut app App) {
|
fn frame(mut app App) {
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
ratio := f32(ws.width) / ws.height
|
ratio := f32(ws.width) / ws.height
|
||||||
dw := ws.width
|
dw := ws.width
|
||||||
dh := ws.height
|
dh := ws.height
|
||||||
|
|
|
@ -359,7 +359,7 @@ fn draw_cube_glsl(app App) {
|
||||||
|
|
||||||
rot := [f32(app.mouse_y), f32(app.mouse_x)]
|
rot := [f32(app.mouse_y), f32(app.mouse_x)]
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
// ratio := f32(ws.width)/ws.height
|
// ratio := f32(ws.width)/ws.height
|
||||||
dw := f32(ws.width / 2)
|
dw := f32(ws.width / 2)
|
||||||
dh := f32(ws.height / 2)
|
dh := f32(ws.height / 2)
|
||||||
|
@ -428,7 +428,7 @@ fn draw_texture_cubes(app App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(mut app App) {
|
fn frame(mut app App) {
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
ratio := f32(ws.width) / ws.height
|
ratio := f32(ws.width) / ws.height
|
||||||
dw := ws.width
|
dw := ws.width
|
||||||
dh := ws.height
|
dh := ws.height
|
||||||
|
|
|
@ -255,7 +255,7 @@ fn draw_cube_glsl(app App) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
ratio := f32(ws.width) / ws.height
|
ratio := f32(ws.width) / ws.height
|
||||||
dw := f32(ws.width / 2)
|
dw := f32(ws.width / 2)
|
||||||
dh := f32(ws.height / 2)
|
dh := f32(ws.height / 2)
|
||||||
|
@ -297,7 +297,7 @@ fn draw_cube_glsl(app App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(mut app App) {
|
fn frame(mut app App) {
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
mut color_action := C.sg_color_attachment_action{
|
mut color_action := C.sg_color_attachment_action{
|
||||||
|
|
|
@ -372,7 +372,7 @@ fn draw_cube_glsl_m(app App) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
ratio := f32(ws.width) / ws.height
|
ratio := f32(ws.width) / ws.height
|
||||||
dw := f32(ws.width / 2)
|
dw := f32(ws.width / 2)
|
||||||
dh := f32(ws.height / 2)
|
dh := f32(ws.height / 2)
|
||||||
|
@ -415,7 +415,7 @@ fn draw_cube_glsl_p(app App) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
ratio := f32(ws.width) / ws.height
|
ratio := f32(ws.width) / ws.height
|
||||||
dw := f32(ws.width / 2)
|
dw := f32(ws.width / 2)
|
||||||
dh := f32(ws.height / 2)
|
dh := f32(ws.height / 2)
|
||||||
|
@ -458,7 +458,7 @@ fn draw_start_glsl(app App) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
// ratio := f32(ws.width) / ws.height
|
// ratio := f32(ws.width) / ws.height
|
||||||
// dw := f32(ws.width / 2)
|
// dw := f32(ws.width / 2)
|
||||||
// dh := f32(ws.height / 2)
|
// dh := f32(ws.height / 2)
|
||||||
|
@ -472,7 +472,7 @@ fn draw_end_glsl(app App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(mut app App) {
|
fn frame(mut app App) {
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
mut color_action := C.sg_color_attachment_action{
|
mut color_action := C.sg_color_attachment_action{
|
||||||
|
|
|
@ -292,7 +292,7 @@ fn draw_cube_glsl_i(mut app App){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
//ratio := f32(ws.width) / ws.height
|
//ratio := f32(ws.width) / ws.height
|
||||||
dw := f32(ws.width / 2)
|
dw := f32(ws.width / 2)
|
||||||
dh := f32(ws.height / 2)
|
dh := f32(ws.height / 2)
|
||||||
|
@ -356,7 +356,7 @@ fn draw_start_glsl(app App){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
//ratio := f32(ws.width) / ws.height
|
//ratio := f32(ws.width) / ws.height
|
||||||
//dw := f32(ws.width / 2)
|
//dw := f32(ws.width / 2)
|
||||||
//dh := f32(ws.height / 2)
|
//dh := f32(ws.height / 2)
|
||||||
|
@ -370,7 +370,7 @@ fn draw_end_glsl(app App){
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(mut app App) {
|
fn frame(mut app App) {
|
||||||
ws := gg.window_size()
|
ws := gg.window_size_real_pixels()
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
mut color_action := C.sg_color_attachment_action{
|
mut color_action := C.sg_color_attachment_action{
|
||||||
|
|
|
@ -760,6 +760,11 @@ pub fn window_size() Size {
|
||||||
return Size{int(sapp.width() / s), int(sapp.height() / s)}
|
return Size{int(sapp.width() / s), int(sapp.height() / s)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// window_size_real_pixels returns the `Size` of the active window without scale
|
||||||
|
pub fn window_size_real_pixels() Size {
|
||||||
|
return Size{sapp.width(), sapp.height()}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn dpi_scale() f32 {
|
pub fn dpi_scale() f32 {
|
||||||
mut s := sapp.dpi_scale()
|
mut s := sapp.dpi_scale()
|
||||||
$if android {
|
$if android {
|
||||||
|
|
Loading…
Reference in New Issue