fighting with the borrow checker. I don't think this child-parent updating works in rust

This commit is contained in:
2019-07-07 02:33:01 -07:00
parent 820b99ae4e
commit 35b4907d5d
3 changed files with 98 additions and 19 deletions

View File

@@ -46,6 +46,7 @@ mod timer;
mod input;
mod vkprocessor;
mod util;
mod button;
// What next?
@@ -54,6 +55,8 @@ mod util;
fn main() {
let font = Font::from_file("resources/fonts/sansation.ttf").unwrap();
let instance = Instance::new(None, &InstanceExtensions::none(), None).unwrap();
let mut processor = vkprocessor::VkProcessor::new(&instance);
processor.compile_kernel(String::from("simple-edge.compute"));
@@ -72,8 +75,6 @@ fn main() {
let mut timer = Timer::new();
let mut input = Input::new();
let font = Font::from_file("resources/fonts/sansation.ttf").unwrap();
let xy = processor.xy;
let mut bg_texture = Texture::new(xy.0, xy.1).unwrap();
bg_texture.update_from_pixels(processor.read_image().as_slice(), xy.0, xy.1, 0, 0);
@@ -81,10 +82,12 @@ fn main() {
let mut background_sprite = Sprite::with_texture(&bg_texture);
background_sprite.set_position((0., 0.));
let mut slider = Slider::new(40.0, None);
let mut slider = Slider::new(Vector2f::new(40.0, 40.0), None, &font);
let mut selected_colors = Vec::new();
let mut button = button::Button::new(Vector2f::new(40.0,40.0), Vector2f::new(100.0,100.0), &font);
button.set_text("Text");
let step_size: f32 = 0.005;
let mut elapsed_time: f32;
@@ -165,6 +168,8 @@ fn main() {
window.draw(i);
}
window.draw(&button);
window.display();
}
}