|
1 | 1 | use sfml::{
|
2 | 2 | graphics::{
|
3 |
| - Color, RcFont, RcSprite, RcText, RcTexture, RenderTarget, RenderWindow, Transformable, |
| 3 | + Color, RcFont, RcSprite, RcText, RcTexture, RenderTarget, RenderWindow, Texture, |
| 4 | + Transformable, |
4 | 5 | },
|
5 | 6 | system::Vector2f,
|
6 | 7 | window::{Event, Style},
|
@@ -97,19 +98,26 @@ impl FloatingResource {
|
97 | 98 | }
|
98 | 99 | }
|
99 | 100 |
|
| 101 | +fn test_getting_rc_texture_from_texture() -> RcTexture { |
| 102 | + RcTexture::from_texture(Texture::from_file(example_res!("frank.jpeg")).unwrap()) |
| 103 | +} |
| 104 | + |
100 | 105 | fn main() {
|
101 | 106 | let mut window =
|
102 | 107 | RenderWindow::new((800, 600), "SFML window", Style::CLOSE, &Default::default());
|
103 | 108 | window.set_framerate_limit(60);
|
104 | 109 |
|
105 | 110 | // Create a new texture.
|
106 | 111 | let texture = RcTexture::from_file(example_res!("logo.png")).unwrap();
|
| 112 | + let texture2 = test_getting_rc_texture_from_texture(); |
107 | 113 |
|
108 | 114 | // Create a new font.
|
109 | 115 | let font = RcFont::from_file(example_res!("sansation.ttf")).unwrap();
|
110 | 116 |
|
111 | 117 | // Load many resources with no lifetime contingencies
|
112 | 118 | let mut floating_resources = Vec::from([
|
| 119 | + FloatingResource::with_texture(&texture2, true, true, 1.1f32), |
| 120 | + FloatingResource::with_texture(&texture2, true, true, 1.2f32), |
113 | 121 | FloatingResource::with_texture(&texture, true, true, 1f32),
|
114 | 122 | FloatingResource::with_texture(&texture, true, false, 1.5f32),
|
115 | 123 | FloatingResource::with_texture(&texture, false, true, 2f32),
|
|
0 commit comments