pub struct TextureSettings { /* private fields */ }Expand description
Texture creation parameters.
Implementations§
Source§impl TextureSettings
impl TextureSettings
Sourcepub fn new() -> TextureSettings
pub fn new() -> TextureSettings
Create default settings.
Examples found in repository?
11fn main() {
12 let opengl = OpenGL::V3_2;
13 let size = [500, 300];
14 let ref mut window: GliumWindow = WindowSettings::new("gfx_graphics: text_test", size)
15 .exit_on_esc(true)
16 .graphics_api(opengl)
17 .build()
18 .unwrap();
19
20 let mut glyph_cache = GlyphCache::new(
21 Path::new("assets/FiraSans-Regular.ttf"),
22 window.clone(),
23 TextureSettings::new(),
24 )
25 .unwrap();
26
27 let mut g2d = Glium2d::new(opengl, window);
28 window.set_lazy(true);
29 while let Some(e) = window.next() {
30 if let Some(args) = e.render_args() {
31 let mut target = window.draw();
32 g2d.draw(&mut target, args.viewport(), |c, g| {
33 use graphics::*;
34
35 clear([1.0; 4], g);
36 text::Text::new_color([0.0, 0.5, 0.0, 1.0], 32)
37 .draw(
38 "Hello glium_graphics!",
39 &mut glyph_cache,
40 &DrawState::default(),
41 c.transform.trans(10.0, 100.0),
42 g,
43 )
44 .unwrap();
45 });
46 target.finish().unwrap();
47 }
48 }
49}More examples
12fn main() {
13 let opengl = OpenGL::V3_2;
14 let (w, h) = (300, 300);
15 let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: image_test", [w, h])
16 .exit_on_esc(true)
17 .graphics_api(opengl)
18 .build()
19 .unwrap();
20
21 let rust_logo = Texture::from_path(
22 window,
23 "assets/rust.png",
24 Flip::None,
25 &TextureSettings::new(),
26 )
27 .unwrap();
28
29 let mut g2d = Glium2d::new(opengl, window);
30 window.set_lazy(true);
31 while let Some(e) = window.next() {
32 use graphics::*;
33
34 if let Some(args) = e.render_args() {
35 let mut target = window.draw();
36 g2d.draw(&mut target, args.viewport(), |c, g| {
37 clear(color::WHITE, g);
38 rectangle(
39 [1.0, 0.0, 0.0, 1.0],
40 [0.0, 0.0, 100.0, 100.0],
41 c.transform,
42 g,
43 );
44 rectangle(
45 [0.0, 1.0, 0.0, 0.3],
46 [50.0, 50.0, 100.0, 100.0],
47 c.transform,
48 g,
49 );
50 image(&rust_logo, c.transform.trans(100.0, 100.0), g);
51 });
52 target.finish().unwrap();
53 }
54 }
55}12fn main() {
13 let opengl = OpenGL::V3_2;
14 let (w, h) = (300, 300);
15 let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: colored_image_test", [w, h])
16 .exit_on_esc(true)
17 .graphics_api(opengl)
18 .build()
19 .unwrap();
20
21 let rust_logo = Texture::from_path(
22 window,
23 "assets/rust-white.png",
24 Flip::None,
25 &TextureSettings::new(),
26 )
27 .unwrap();
28
29 let mut g2d = Glium2d::new(opengl, window);
30 window.set_lazy(true);
31 while let Some(e) = window.next() {
32 use graphics::*;
33
34 if let Some(args) = e.render_args() {
35 let mut target = window.draw();
36 g2d.draw(&mut target, args.viewport(), |c, g| {
37 use graphics::triangulation::{tx, ty};
38
39 let transform = c.transform.trans(0.0, 0.0);
40
41 let tr = |p: [f64; 2]| [tx(transform, p[0], p[1]), ty(transform, p[0], p[1])];
42
43 clear(color::WHITE, g);
44 Rectangle::new([1.0, 0.0, 0.0, 1.0])
45 .draw([0.0, 0.0, 100.0, 100.0], &c.draw_state, c.transform, g);
46 Rectangle::new([0.0, 1.0, 0.0, 0.3])
47 .draw([50.0, 50.0, 100.0, 100.0], &c.draw_state, c.transform, g);
48 g.tri_list_uv_c(&c.draw_state, &rust_logo, |f| {
49 (f)(
50 &[
51 tr([0.0, 0.0]),
52 tr([300.0, 0.0]),
53 tr([0.0, 300.0]),
54
55 tr([300.0, 0.0]),
56 tr([0.0, 300.0]),
57 tr([300.0, 300.0]),
58 ],
59 &[
60 [0.0, 0.0],
61 [1.0, 0.0],
62 [0.0, 1.0],
63
64 [1.0, 0.0],
65 [0.0, 1.0],
66 [1.0, 1.0],
67 ],
68 &[
69 [1.0, 0.0, 0.0, 1.0],
70 [0.0, 1.0, 0.0, 1.0],
71 [0.0, 0.0, 1.0, 1.0],
72
73 [0.0, 00.0, 0.0, 1.0],
74 [0.0, 00.0, 0.0, 1.0],
75 [0.0, 00.0, 0.0, 1.0],
76 ]
77 )
78 });
79 });
80 target.finish().unwrap();
81 }
82 }
83}12fn main() {
13 println!("Press U to change the texture wrap mode for the u coordinate");
14 println!("Press V to change the texture wrap mode for the v coordinate");
15
16 let opengl = OpenGL::V3_2;
17 let (w, h) = (600, 600);
18 let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19 .exit_on_esc(true)
20 .graphics_api(opengl)
21 .build()
22 .unwrap();
23 window.set_lazy(true);
24
25 // Set up wrap modes
26 let wrap_modes = [
27 Wrap::ClampToEdge,
28 Wrap::ClampToBorder,
29 Wrap::Repeat,
30 Wrap::MirroredRepeat,
31 ];
32 let mut ix_u = 0;
33 let mut ix_v = 0;
34 let mut texture_settings = TextureSettings::new();
35 texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37 let mut rust_logo = Texture::from_path(
38 &mut window,
39 "assets/rust.png",
40 Flip::None,
41 &texture_settings,
42 )
43 .unwrap();
44
45 let mut g2d = Glium2d::new(opengl, &mut window);
46 while let Some(e) = window.next() {
47 if let Some(args) = e.render_args() {
48 use graphics::*;
49 let mut target = window.draw();
50 g2d.draw(&mut target, args.viewport(), |_c, g| {
51 clear([1.0; 4], g);
52 let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53 // (0, 1, 2) and (0, 2, 3)
54 let uvs = [
55 [4.0, 0.0],
56 [0.0, 0.0],
57 [0.0, 4.0],
58 [4.0, 0.0],
59 [0.0, 4.0],
60 [4.0, 4.0],
61 ];
62 let mut verts = [[0.0, 0.0]; 6];
63 let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64 for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65 verts[ixv] = points[ixp];
66 }
67 g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68 f(&verts, &uvs)
69 });
70 });
71 target.finish().unwrap();
72 }
73
74 if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75 ix_u = (ix_u + 1) % wrap_modes.len();
76 texture_settings.set_wrap_u(wrap_modes[ix_u]);
77 rust_logo = Texture::from_path(
78 &mut window,
79 "assets/rust.png",
80 Flip::None,
81 &texture_settings,
82 )
83 .unwrap();
84 println!(
85 "Changed texture wrap mode for u coordinate to: {:?}",
86 wrap_modes[ix_u]
87 );
88 }
89
90 if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91 ix_v = (ix_v + 1) % wrap_modes.len();
92 texture_settings.set_wrap_v(wrap_modes[ix_v]);
93 rust_logo = Texture::from_path(
94 &mut window,
95 "assets/rust.png",
96 Flip::None,
97 &texture_settings,
98 )
99 .unwrap();
100 println!(
101 "Changed texture wrap mode for v coordinate to: {:?}",
102 wrap_modes[ix_v]
103 );
104 }
105 }
106}11fn main() {
12 println!("Press A to change blending");
13 println!("Press S to change clip inside/out");
14
15 let opengl = OpenGL::V3_2;
16 let (w, h) = (640, 480);
17 let ref mut window: GliumWindow = WindowSettings::new("glium_graphics: image_test", [w, h])
18 .exit_on_esc(true)
19 .graphics_api(opengl)
20 .build()
21 .unwrap();
22
23 let mut blend = Blend::Alpha;
24 let mut clip_inside = true;
25 let rust_logo = Texture::from_path(
26 window,
27 "assets/rust.png",
28 Flip::None,
29 &TextureSettings::new(),
30 )
31 .unwrap();
32
33 let mut g2d = Glium2d::new(opengl, window);
34 window.set_lazy(true);
35 while let Some(e) = window.next() {
36 if let Some(args) = e.render_args() {
37 use graphics::*;
38
39 let mut target = window.draw();
40 g2d.draw(&mut target, args.viewport(), |c, g| {
41 clear([0.8, 0.8, 0.8, 1.0], g);
42 g.clear_stencil(0);
43 Rectangle::new([1.0, 0.0, 0.0, 1.0]).draw(
44 [0.0, 0.0, 100.0, 100.0],
45 &c.draw_state,
46 c.transform,
47 g,
48 );
49
50 let draw_state = c.draw_state.blend(blend);
51 Rectangle::new([0.5, 1.0, 0.0, 0.3]).draw(
52 [50.0, 50.0, 100.0, 100.0],
53 &draw_state,
54 c.transform,
55 g,
56 );
57
58 let transform = c.transform.trans(100.0, 100.0);
59 // Compute clip rectangle from upper left corner.
60 let (clip_x, clip_y, clip_w, clip_h) = (100, 100, 100, 100);
61 let (clip_x, clip_y, clip_w, clip_h) = (
62 clip_x,
63 c.viewport.unwrap().draw_size[1] - clip_y - clip_h,
64 clip_w,
65 clip_h,
66 );
67 let clipped = c.draw_state.scissor([clip_x, clip_y, clip_w, clip_h]);
68 Image::new().draw(&rust_logo, &clipped, transform, g);
69
70 let transform = c.transform.trans(200.0, 200.0);
71 Ellipse::new([1.0, 0.0, 0.0, 1.0]).draw(
72 [0.0, 0.0, 50.0, 50.0],
73 &DrawState::new_clip(),
74 transform,
75 g,
76 );
77 Image::new().draw(
78 &rust_logo,
79 &(if clip_inside {
80 DrawState::new_inside()
81 } else {
82 DrawState::new_outside()
83 }),
84 transform,
85 g,
86 );
87 });
88
89 target.finish().unwrap();
90 }
91
92 if let Some(Button::Keyboard(Key::A)) = e.press_args() {
93 blend = match blend {
94 Blend::Alpha => Blend::Add,
95 Blend::Add => Blend::Multiply,
96 Blend::Multiply => Blend::Invert,
97 Blend::Invert => Blend::Lighter,
98 Blend::Lighter => Blend::Alpha,
99 };
100 println!("Changed blending to {:?}", blend);
101 }
102
103 if let Some(Button::Keyboard(Key::S)) = e.press_args() {
104 clip_inside = !clip_inside;
105 if clip_inside {
106 println!("Changed to clip inside");
107 } else {
108 println!("Changed to clip outside");
109 }
110 }
111 }
112}Sourcepub fn get_convert_gamma(&self) -> bool
pub fn get_convert_gamma(&self) -> bool
Gets whether to convert gamma, treated as sRGB color space.
Sourcepub fn set_convert_gamma(&mut self, val: bool)
pub fn set_convert_gamma(&mut self, val: bool)
Sets convert gamma.
Sourcepub fn convert_gamma(self, val: bool) -> TextureSettings
pub fn convert_gamma(self, val: bool) -> TextureSettings
Sets convert gamma.
Sourcepub fn get_compress(&self) -> bool
pub fn get_compress(&self) -> bool
Gets wheter compress on the GPU.
Sourcepub fn set_compress(&mut self, val: bool)
pub fn set_compress(&mut self, val: bool)
Sets compress.
Sourcepub fn compress(self, val: bool) -> TextureSettings
pub fn compress(self, val: bool) -> TextureSettings
Sets compress.
Sourcepub fn get_generate_mipmap(&self) -> bool
pub fn get_generate_mipmap(&self) -> bool
Gets generate mipmap.
Sourcepub fn set_generate_mipmap(&mut self, val: bool)
pub fn set_generate_mipmap(&mut self, val: bool)
Sets generate mipmap.
Sourcepub fn generate_mipmap(self, val: bool) -> TextureSettings
pub fn generate_mipmap(self, val: bool) -> TextureSettings
Sets generate mipmap.
Sourcepub fn min(self, val: Filter) -> TextureSettings
pub fn min(self, val: Filter) -> TextureSettings
Sets minify filter.
Sourcepub fn mag(self, val: Filter) -> TextureSettings
pub fn mag(self, val: Filter) -> TextureSettings
Sets magnify filter
Sourcepub fn get_mipmap(&self) -> Filter
pub fn get_mipmap(&self) -> Filter
Gets minify mipmap filter
Sourcepub fn set_mipmap(&mut self, val: Filter)
pub fn set_mipmap(&mut self, val: Filter)
Sets magnify mipmap filter, and sets generate_mipmap to true.
Sourcepub fn mipmap(self, val: Filter) -> TextureSettings
pub fn mipmap(self, val: Filter) -> TextureSettings
Sets magnify mipmap filter, and sets generate_mipmap to true
Sourcepub fn get_filter(&self) -> (Filter, Filter)
pub fn get_filter(&self) -> (Filter, Filter)
Returns the min and mag filter
Sourcepub fn set_filter(&mut self, val: Filter)
pub fn set_filter(&mut self, val: Filter)
Sets the min and mag filter
Sourcepub fn filter(self, val: Filter) -> TextureSettings
pub fn filter(self, val: Filter) -> TextureSettings
Sets the min and mag filter
Sourcepub fn get_wrap_u(&self) -> Wrap
pub fn get_wrap_u(&self) -> Wrap
Gets the wrapping mode for the u coordinate
Sourcepub fn set_wrap_u(&mut self, val: Wrap)
pub fn set_wrap_u(&mut self, val: Wrap)
Sets the wrapping mode for the u coordinate
Examples found in repository?
12fn main() {
13 println!("Press U to change the texture wrap mode for the u coordinate");
14 println!("Press V to change the texture wrap mode for the v coordinate");
15
16 let opengl = OpenGL::V3_2;
17 let (w, h) = (600, 600);
18 let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19 .exit_on_esc(true)
20 .graphics_api(opengl)
21 .build()
22 .unwrap();
23 window.set_lazy(true);
24
25 // Set up wrap modes
26 let wrap_modes = [
27 Wrap::ClampToEdge,
28 Wrap::ClampToBorder,
29 Wrap::Repeat,
30 Wrap::MirroredRepeat,
31 ];
32 let mut ix_u = 0;
33 let mut ix_v = 0;
34 let mut texture_settings = TextureSettings::new();
35 texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37 let mut rust_logo = Texture::from_path(
38 &mut window,
39 "assets/rust.png",
40 Flip::None,
41 &texture_settings,
42 )
43 .unwrap();
44
45 let mut g2d = Glium2d::new(opengl, &mut window);
46 while let Some(e) = window.next() {
47 if let Some(args) = e.render_args() {
48 use graphics::*;
49 let mut target = window.draw();
50 g2d.draw(&mut target, args.viewport(), |_c, g| {
51 clear([1.0; 4], g);
52 let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53 // (0, 1, 2) and (0, 2, 3)
54 let uvs = [
55 [4.0, 0.0],
56 [0.0, 0.0],
57 [0.0, 4.0],
58 [4.0, 0.0],
59 [0.0, 4.0],
60 [4.0, 4.0],
61 ];
62 let mut verts = [[0.0, 0.0]; 6];
63 let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64 for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65 verts[ixv] = points[ixp];
66 }
67 g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68 f(&verts, &uvs)
69 });
70 });
71 target.finish().unwrap();
72 }
73
74 if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75 ix_u = (ix_u + 1) % wrap_modes.len();
76 texture_settings.set_wrap_u(wrap_modes[ix_u]);
77 rust_logo = Texture::from_path(
78 &mut window,
79 "assets/rust.png",
80 Flip::None,
81 &texture_settings,
82 )
83 .unwrap();
84 println!(
85 "Changed texture wrap mode for u coordinate to: {:?}",
86 wrap_modes[ix_u]
87 );
88 }
89
90 if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91 ix_v = (ix_v + 1) % wrap_modes.len();
92 texture_settings.set_wrap_v(wrap_modes[ix_v]);
93 rust_logo = Texture::from_path(
94 &mut window,
95 "assets/rust.png",
96 Flip::None,
97 &texture_settings,
98 )
99 .unwrap();
100 println!(
101 "Changed texture wrap mode for v coordinate to: {:?}",
102 wrap_modes[ix_v]
103 );
104 }
105 }
106}Sourcepub fn wrap_u(self, val: Wrap) -> TextureSettings
pub fn wrap_u(self, val: Wrap) -> TextureSettings
Sets the wrapping mode for the u coordinate
Sourcepub fn get_wrap_v(&self) -> Wrap
pub fn get_wrap_v(&self) -> Wrap
Gets the wrapping mode for the v coordinate
Sourcepub fn set_wrap_v(&mut self, val: Wrap)
pub fn set_wrap_v(&mut self, val: Wrap)
Sets the wrapping mode for the v coordinate
Examples found in repository?
12fn main() {
13 println!("Press U to change the texture wrap mode for the u coordinate");
14 println!("Press V to change the texture wrap mode for the v coordinate");
15
16 let opengl = OpenGL::V3_2;
17 let (w, h) = (600, 600);
18 let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19 .exit_on_esc(true)
20 .graphics_api(opengl)
21 .build()
22 .unwrap();
23 window.set_lazy(true);
24
25 // Set up wrap modes
26 let wrap_modes = [
27 Wrap::ClampToEdge,
28 Wrap::ClampToBorder,
29 Wrap::Repeat,
30 Wrap::MirroredRepeat,
31 ];
32 let mut ix_u = 0;
33 let mut ix_v = 0;
34 let mut texture_settings = TextureSettings::new();
35 texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37 let mut rust_logo = Texture::from_path(
38 &mut window,
39 "assets/rust.png",
40 Flip::None,
41 &texture_settings,
42 )
43 .unwrap();
44
45 let mut g2d = Glium2d::new(opengl, &mut window);
46 while let Some(e) = window.next() {
47 if let Some(args) = e.render_args() {
48 use graphics::*;
49 let mut target = window.draw();
50 g2d.draw(&mut target, args.viewport(), |_c, g| {
51 clear([1.0; 4], g);
52 let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53 // (0, 1, 2) and (0, 2, 3)
54 let uvs = [
55 [4.0, 0.0],
56 [0.0, 0.0],
57 [0.0, 4.0],
58 [4.0, 0.0],
59 [0.0, 4.0],
60 [4.0, 4.0],
61 ];
62 let mut verts = [[0.0, 0.0]; 6];
63 let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64 for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65 verts[ixv] = points[ixp];
66 }
67 g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68 f(&verts, &uvs)
69 });
70 });
71 target.finish().unwrap();
72 }
73
74 if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75 ix_u = (ix_u + 1) % wrap_modes.len();
76 texture_settings.set_wrap_u(wrap_modes[ix_u]);
77 rust_logo = Texture::from_path(
78 &mut window,
79 "assets/rust.png",
80 Flip::None,
81 &texture_settings,
82 )
83 .unwrap();
84 println!(
85 "Changed texture wrap mode for u coordinate to: {:?}",
86 wrap_modes[ix_u]
87 );
88 }
89
90 if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91 ix_v = (ix_v + 1) % wrap_modes.len();
92 texture_settings.set_wrap_v(wrap_modes[ix_v]);
93 rust_logo = Texture::from_path(
94 &mut window,
95 "assets/rust.png",
96 Flip::None,
97 &texture_settings,
98 )
99 .unwrap();
100 println!(
101 "Changed texture wrap mode for v coordinate to: {:?}",
102 wrap_modes[ix_v]
103 );
104 }
105 }
106}Sourcepub fn wrap_v(self, val: Wrap) -> TextureSettings
pub fn wrap_v(self, val: Wrap) -> TextureSettings
Sets the wrapping mode for the v coordinate
Sourcepub fn get_border_color(&self) -> [f32; 4]
pub fn get_border_color(&self) -> [f32; 4]
Gets the border color
Sourcepub fn set_border_color(&mut self, val: [f32; 4])
pub fn set_border_color(&mut self, val: [f32; 4])
Sets the border color
Examples found in repository?
12fn main() {
13 println!("Press U to change the texture wrap mode for the u coordinate");
14 println!("Press V to change the texture wrap mode for the v coordinate");
15
16 let opengl = OpenGL::V3_2;
17 let (w, h) = (600, 600);
18 let mut window: GliumWindow = WindowSettings::new("glium_graphics: texture_wrap", [w, h])
19 .exit_on_esc(true)
20 .graphics_api(opengl)
21 .build()
22 .unwrap();
23 window.set_lazy(true);
24
25 // Set up wrap modes
26 let wrap_modes = [
27 Wrap::ClampToEdge,
28 Wrap::ClampToBorder,
29 Wrap::Repeat,
30 Wrap::MirroredRepeat,
31 ];
32 let mut ix_u = 0;
33 let mut ix_v = 0;
34 let mut texture_settings = TextureSettings::new();
35 texture_settings.set_border_color([0.0, 0.0, 0.0, 1.0]);
36
37 let mut rust_logo = Texture::from_path(
38 &mut window,
39 "assets/rust.png",
40 Flip::None,
41 &texture_settings,
42 )
43 .unwrap();
44
45 let mut g2d = Glium2d::new(opengl, &mut window);
46 while let Some(e) = window.next() {
47 if let Some(args) = e.render_args() {
48 use graphics::*;
49 let mut target = window.draw();
50 g2d.draw(&mut target, args.viewport(), |_c, g| {
51 clear([1.0; 4], g);
52 let points = [[0.5, 0.5], [-0.5, 0.5], [-0.5, -0.5], [0.5, -0.5]];
53 // (0, 1, 2) and (0, 2, 3)
54 let uvs = [
55 [4.0, 0.0],
56 [0.0, 0.0],
57 [0.0, 4.0],
58 [4.0, 0.0],
59 [0.0, 4.0],
60 [4.0, 4.0],
61 ];
62 let mut verts = [[0.0, 0.0]; 6];
63 let indices_points: [usize; 6] = [0, 1, 2, 0, 2, 3];
64 for (ixv, &ixp) in (0..6).zip((&indices_points).into_iter()) {
65 verts[ixv] = points[ixp];
66 }
67 g.tri_list_uv(&DrawState::new_alpha(), &[1.0; 4], &rust_logo, |f| {
68 f(&verts, &uvs)
69 });
70 });
71 target.finish().unwrap();
72 }
73
74 if let Some(Button::Keyboard(Key::U)) = e.press_args() {
75 ix_u = (ix_u + 1) % wrap_modes.len();
76 texture_settings.set_wrap_u(wrap_modes[ix_u]);
77 rust_logo = Texture::from_path(
78 &mut window,
79 "assets/rust.png",
80 Flip::None,
81 &texture_settings,
82 )
83 .unwrap();
84 println!(
85 "Changed texture wrap mode for u coordinate to: {:?}",
86 wrap_modes[ix_u]
87 );
88 }
89
90 if let Some(Button::Keyboard(Key::V)) = e.press_args() {
91 ix_v = (ix_v + 1) % wrap_modes.len();
92 texture_settings.set_wrap_v(wrap_modes[ix_v]);
93 rust_logo = Texture::from_path(
94 &mut window,
95 "assets/rust.png",
96 Flip::None,
97 &texture_settings,
98 )
99 .unwrap();
100 println!(
101 "Changed texture wrap mode for v coordinate to: {:?}",
102 wrap_modes[ix_v]
103 );
104 }
105 }
106}Sourcepub fn border_color(self, val: [f32; 4]) -> TextureSettings
pub fn border_color(self, val: [f32; 4]) -> TextureSettings
Sets the border color
Trait Implementations§
Source§impl Clone for TextureSettings
impl Clone for TextureSettings
Source§fn clone(&self) -> TextureSettings
fn clone(&self) -> TextureSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TextureSettings
Auto Trait Implementations§
impl Freeze for TextureSettings
impl RefUnwindSafe for TextureSettings
impl Send for TextureSettings
impl Sync for TextureSettings
impl Unpin for TextureSettings
impl UnwindSafe for TextureSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Content for Twhere
T: Copy,
impl<T> Content for Twhere
T: Copy,
Source§fn read<F, E>(size: usize, f: F) -> Result<T, E>
fn read<F, E>(size: usize, f: F) -> Result<T, E>
Owned.Source§fn get_elements_size() -> usize
fn get_elements_size() -> usize
Source§fn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
Source§fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
Source§fn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more