Merge branch 'master' into remove-renderer-traits
This commit is contained in:
commit
e70a6be937
5 changed files with 30 additions and 29 deletions
|
|
@ -39,6 +39,7 @@ pub fn main() {
|
||||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||||
power_preference: wgpu::PowerPreference::HighPerformance,
|
power_preference: wgpu::PowerPreference::HighPerformance,
|
||||||
compatible_surface: Some(&surface),
|
compatible_surface: Some(&surface),
|
||||||
|
force_fallback_adapter: false,
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.expect("Request adapter");
|
.expect("Request adapter");
|
||||||
|
|
@ -171,7 +172,7 @@ pub fn main() {
|
||||||
resized = false;
|
resized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
match surface.get_current_frame() {
|
match surface.get_current_texture() {
|
||||||
Ok(frame) => {
|
Ok(frame) => {
|
||||||
let mut encoder = device.create_command_encoder(
|
let mut encoder = device.create_command_encoder(
|
||||||
&wgpu::CommandEncoderDescriptor { label: None },
|
&wgpu::CommandEncoderDescriptor { label: None },
|
||||||
|
|
@ -179,7 +180,7 @@ pub fn main() {
|
||||||
|
|
||||||
let program = state.program();
|
let program = state.program();
|
||||||
|
|
||||||
let view = frame.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
let view = frame.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||||
|
|
||||||
{
|
{
|
||||||
// We clear the frame
|
// We clear the frame
|
||||||
|
|
@ -209,6 +210,7 @@ pub fn main() {
|
||||||
// Then we submit the work
|
// Then we submit the work
|
||||||
staging_belt.finish();
|
staging_belt.finish();
|
||||||
queue.submit(Some(encoder.finish()));
|
queue.submit(Some(encoder.finish()));
|
||||||
|
frame.present();
|
||||||
|
|
||||||
// Update the mouse cursor
|
// Update the mouse cursor
|
||||||
window.set_cursor_icon(
|
window.set_cursor_icon(
|
||||||
|
|
|
||||||
|
|
@ -297,29 +297,27 @@ where
|
||||||
let text_layout = layout.children().next().unwrap();
|
let text_layout = layout.children().next().unwrap();
|
||||||
let target = position.x - text_layout.bounds().x;
|
let target = position.x - text_layout.bounds().x;
|
||||||
|
|
||||||
if target > 0.0 {
|
let value = if self.is_secure {
|
||||||
let value = if self.is_secure {
|
self.value.secure()
|
||||||
self.value.secure()
|
} else {
|
||||||
} else {
|
self.value.clone()
|
||||||
self.value.clone()
|
};
|
||||||
};
|
|
||||||
|
|
||||||
let position = find_cursor_position(
|
let position = find_cursor_position(
|
||||||
renderer,
|
renderer,
|
||||||
text_layout.bounds(),
|
text_layout.bounds(),
|
||||||
self.font,
|
self.font,
|
||||||
self.size,
|
self.size,
|
||||||
&value,
|
&value,
|
||||||
&self.state,
|
&self.state,
|
||||||
target,
|
target,
|
||||||
)
|
)
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|
||||||
self.state.cursor.select_range(
|
self.state.cursor.select_range(
|
||||||
self.state.cursor.start(&value),
|
self.state.cursor.start(&value),
|
||||||
position,
|
position,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ default_system_font = ["iced_graphics/font-source"]
|
||||||
spirv = ["wgpu/spirv"]
|
spirv = ["wgpu/spirv"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wgpu = "0.10"
|
wgpu = "0.11"
|
||||||
wgpu_glyph = "0.14"
|
wgpu_glyph = "0.15"
|
||||||
glyph_brush = "0.7"
|
glyph_brush = "0.7"
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
var positions: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
var<private> positions: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>(-1.0, -1.0),
|
vec2<f32>(-1.0, -1.0),
|
||||||
vec2<f32>(1.0, -1.0),
|
vec2<f32>(1.0, -1.0),
|
||||||
|
|
@ -7,7 +7,7 @@ var positions: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
vec2<f32>(1.0, -1.0)
|
vec2<f32>(1.0, -1.0)
|
||||||
);
|
);
|
||||||
|
|
||||||
var uvs: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
var<private> uvs: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
vec2<f32>(0.0, 0.0),
|
vec2<f32>(0.0, 0.0),
|
||||||
vec2<f32>(0.0, 1.0),
|
vec2<f32>(0.0, 1.0),
|
||||||
vec2<f32>(1.0, 1.0),
|
vec2<f32>(1.0, 1.0),
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ impl Compositor {
|
||||||
wgpu::PowerPreference::HighPerformance
|
wgpu::PowerPreference::HighPerformance
|
||||||
},
|
},
|
||||||
compatible_surface: compatible_surface.as_ref(),
|
compatible_surface: compatible_surface.as_ref(),
|
||||||
|
force_fallback_adapter: false,
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
@ -140,7 +141,7 @@ impl iced_graphics::window::Compositor for Compositor {
|
||||||
background_color: Color,
|
background_color: Color,
|
||||||
overlay: &[T],
|
overlay: &[T],
|
||||||
) -> Result<(), iced_graphics::window::SurfaceError> {
|
) -> Result<(), iced_graphics::window::SurfaceError> {
|
||||||
match surface.get_current_frame() {
|
match surface.get_current_texture() {
|
||||||
Ok(frame) => {
|
Ok(frame) => {
|
||||||
let mut encoder = self.device.create_command_encoder(
|
let mut encoder = self.device.create_command_encoder(
|
||||||
&wgpu::CommandEncoderDescriptor {
|
&wgpu::CommandEncoderDescriptor {
|
||||||
|
|
@ -149,7 +150,6 @@ impl iced_graphics::window::Compositor for Compositor {
|
||||||
);
|
);
|
||||||
|
|
||||||
let view = &frame
|
let view = &frame
|
||||||
.output
|
|
||||||
.texture
|
.texture
|
||||||
.create_view(&wgpu::TextureViewDescriptor::default());
|
.create_view(&wgpu::TextureViewDescriptor::default());
|
||||||
|
|
||||||
|
|
@ -194,6 +194,7 @@ impl iced_graphics::window::Compositor for Compositor {
|
||||||
// Submit work
|
// Submit work
|
||||||
self.staging_belt.finish();
|
self.staging_belt.finish();
|
||||||
self.queue.submit(Some(encoder.finish()));
|
self.queue.submit(Some(encoder.finish()));
|
||||||
|
frame.present();
|
||||||
|
|
||||||
// Recall staging buffers
|
// Recall staging buffers
|
||||||
self.local_pool
|
self.local_pool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue