summaryrefslogtreecommitdiffstats
path: root/examples/geometry
diff options
context:
space:
mode:
Diffstat (limited to 'examples/geometry')
-rw-r--r--examples/geometry/Cargo.toml1
-rw-r--r--examples/geometry/src/main.rs28
2 files changed, 13 insertions, 16 deletions
diff --git a/examples/geometry/Cargo.toml b/examples/geometry/Cargo.toml
index 79fe52d5..6068d651 100644
--- a/examples/geometry/Cargo.toml
+++ b/examples/geometry/Cargo.toml
@@ -7,4 +7,3 @@ publish = false
[dependencies]
iced = { path = "../..", features = ["advanced"] }
-iced_graphics = { path = "../../graphics" }
diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs
index 29f78ea1..3bc7f46b 100644
--- a/examples/geometry/src/main.rs
+++ b/examples/geometry/src/main.rs
@@ -1,8 +1,6 @@
//! This example showcases a simple native custom widget that renders using
//! arbitrary low-level geometry.
mod rainbow {
- use iced_graphics::primitive::{ColoredVertex2D, Primitive};
-
use iced::advanced::graphics::color;
use iced::advanced::layout::{self, Layout};
use iced::advanced::renderer;
@@ -46,8 +44,8 @@ mod rainbow {
cursor: mouse::Cursor,
_viewport: &Rectangle,
) {
+ use iced::advanced::graphics::mesh::{self, Mesh, SolidVertex2D};
use iced::advanced::Renderer as _;
- use iced_graphics::primitive::Mesh2D;
let bounds = layout.bounds();
@@ -78,43 +76,43 @@ mod rainbow {
let posn_bl = [0.0, bounds.height];
let posn_l = [0.0, bounds.height / 2.0];
- let mesh = Primitive::SolidMesh {
+ let mesh = Mesh::Solid {
size: bounds.size(),
- buffers: Mesh2D {
+ buffers: mesh::Indexed {
vertices: vec![
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_center,
color: color::pack([1.0, 1.0, 1.0, 1.0]),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_tl,
color: color::pack(color_r),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_t,
color: color::pack(color_o),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_tr,
color: color::pack(color_y),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_r,
color: color::pack(color_g),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_br,
color: color::pack(color_gb),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_b,
color: color::pack(color_b),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_bl,
color: color::pack(color_i),
},
- ColoredVertex2D {
+ SolidVertex2D {
position: posn_l,
color: color::pack(color_v),
},
@@ -135,7 +133,7 @@ mod rainbow {
renderer.with_translation(
Vector::new(bounds.x, bounds.y),
|renderer| {
- renderer.draw_primitive(mesh);
+ renderer.draw_mesh(mesh);
},
);
}