Make emigui fill entire web page
This commit is contained in:
parent
1affa10dee
commit
7459aa60a4
4 changed files with 9 additions and 6 deletions
Binary file not shown.
|
@ -16,12 +16,15 @@
|
|||
}
|
||||
|
||||
body {
|
||||
background: #000000;
|
||||
background: #101010;
|
||||
}
|
||||
|
||||
/* Allow canvas to fill entire web page: */
|
||||
html,
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
@ -80,12 +83,11 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
var g_mouse_pos = null;
|
||||
var g_mouse_down = false;
|
||||
var g_is_touch = false;
|
||||
var g_is_touch = false; // we don't know yet
|
||||
var g_scroll_delta_x = 0;
|
||||
var g_scroll_delta_y = 0;
|
||||
|
||||
function pixels_per_point() {
|
||||
// return 1.0;
|
||||
return window.devicePixelRatio || 1.0;
|
||||
}
|
||||
|
||||
|
@ -218,7 +220,7 @@
|
|||
paint_and_schedule();
|
||||
}
|
||||
</script>
|
||||
<!-- TODO: make this cover the entire screen, with resize and all -->
|
||||
<!-- We later make this cover the entire screen even when resized -->
|
||||
<canvas id="canvas" width="1024" height="1024"></canvas>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ pub struct GuiInput {
|
|||
pub mouse_released: bool,
|
||||
|
||||
/// Current position of the mouse in points.
|
||||
/// None for touch screens when finger is not down.
|
||||
pub mouse_pos: Option<Pos2>,
|
||||
|
||||
/// How much the mouse moved compared to last frame, in points.
|
||||
|
@ -71,7 +72,7 @@ impl GuiInput {
|
|||
.and_then(|new| last.mouse_pos.map(|last| new - last))
|
||||
.unwrap_or_default();
|
||||
GuiInput {
|
||||
mouse_down: new.mouse_down,
|
||||
mouse_down: new.mouse_down && new.mouse_pos.is_some(),
|
||||
mouse_pressed: !last.mouse_down && new.mouse_down,
|
||||
mouse_released: last.mouse_down && !new.mouse_down,
|
||||
mouse_pos: new.mouse_pos,
|
||||
|
|
|
@ -91,7 +91,7 @@ impl State {
|
|||
self.emigui.ui(region);
|
||||
});
|
||||
|
||||
let bg_color = srgba(16, 16, 16, 255);
|
||||
let bg_color = srgba(0, 0, 0, 0); // Use background css color.
|
||||
let (output, batches) = self.emigui.end_frame();
|
||||
self.webgl_painter.paint_batches(
|
||||
bg_color,
|
||||
|
|
Loading…
Reference in a new issue