|
|
@ -86,13 +86,11 @@ pub fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
let mut mouse_xy = Vector2i::new(0, 0);
|
|
|
|
let mut mouse_xy = Vector2i::new(0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
let sprite = Sprite::new_with_color((0., 0.), (0.1, 0.1), (1., 0., 0., 1.));
|
|
|
|
|
|
|
|
let sprite2 = Sprite::new_with_color((-0.3, -0.5), (0.1, 0.1), (0., 1., 0., 1.));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let image_data = load_raw(String::from("funky-bird.jpg"));
|
|
|
|
let image_data = load_raw(String::from("funky-bird.jpg"));
|
|
|
|
let image_dimensions_f = ((image_data.1).0 as f32, (image_data.1).1 as f32);
|
|
|
|
let image_dimensions_f = ((image_data.1).0 as f32, (image_data.1).1 as f32);
|
|
|
|
let image_dimensions_u = image_data.1;
|
|
|
|
let image_dimensions_u = image_data.1;
|
|
|
|
let compu_sprite1 = CompuSprite::new((-1., -0.5), (1.0, 1.0), image_dimensions_f,
|
|
|
|
let compu_sprite1 = CompuSprite::new((0.0, -0.5), (0.4, 0.4), 3, image_dimensions_f,
|
|
|
|
// This swap image needs to match the size of the compute
|
|
|
|
// This swap image needs to match the size of the compute
|
|
|
|
processor.new_swap_image(image_dimensions_u));
|
|
|
|
processor.new_swap_image(image_dimensions_u));
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +102,8 @@ pub fn main() {
|
|
|
|
let funky_handle = processor.get_texture_handle(String::from("funky-bird.jpg")).unwrap();
|
|
|
|
let funky_handle = processor.get_texture_handle(String::from("funky-bird.jpg")).unwrap();
|
|
|
|
let sfml_handle = processor.get_texture_handle(String::from("sfml.png")).unwrap();
|
|
|
|
let sfml_handle = processor.get_texture_handle(String::from("sfml.png")).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
let sprite3 = Sprite::new_with_texture((0.0, -0.5), (0.5, 0.5), funky_handle.clone());
|
|
|
|
let funky_sprite = Sprite::new_with_texture((0.0, -0.5), (0.5, 0.5), 2, funky_handle.clone());
|
|
|
|
|
|
|
|
let sfml_sprite = Sprite::new_with_texture((0.0, -0.5), (0.5, 0.5), 1, sfml_handle.clone());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop(q2);
|
|
|
|
drop(q2);
|
|
|
@ -171,34 +170,10 @@ pub fn main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let mut canvas = CanvasFrame::new();
|
|
|
|
let mut canvas = CanvasFrame::new();
|
|
|
|
canvas.draw(&sprite);
|
|
|
|
canvas.draw(&funky_sprite);
|
|
|
|
canvas.draw(&sprite2);
|
|
|
|
canvas.draw(&sfml_sprite);
|
|
|
|
canvas.draw(&sprite3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_texture(
|
|
|
|
|
|
|
|
(0.3, -1.0),
|
|
|
|
|
|
|
|
(1.0 + elapsed_time.sin()/2.0, 1.0 + elapsed_time.sin()/2.0),
|
|
|
|
|
|
|
|
sfml_handle.clone()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
canvas.draw(&compu_sprite1);
|
|
|
|
canvas.draw(&compu_sprite1);
|
|
|
|
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color((
|
|
|
|
|
|
|
|
(elapsed_time + 0.0).sin()/2.0, (elapsed_time + 0.0).sin()/2.0),
|
|
|
|
|
|
|
|
(0.09,0.09),
|
|
|
|
|
|
|
|
(1.0,0.2,0.5,1.0)
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.0).sin(), 0.0), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.1).sin(), 0.1), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.2).sin(), 0.2), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.3).sin(), 0.3), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.4).sin(), 0.4), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.5).sin(), 0.5), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.6).sin(), 0.6), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.7).sin(), 0.7), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.8).sin(), 0.8), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
canvas.draw(&Sprite::new_with_color(((elapsed_time + 0.9).sin(), 0.9), (0.09,0.09), (1.0,1.0,1.0,1.0)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let g = hprof::enter("Run");
|
|
|
|
let g = hprof::enter("Run");
|
|
|
|
processor.run(&surface,
|
|
|
|
processor.run(&surface,
|
|
|
|