Skip to content

Commit

Permalink
Made match more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
superlou committed Jul 28, 2023
1 parent 479d532 commit d3f7d23
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/window_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,41 +73,40 @@ impl WindowHandler<String> for SignWindowHandler {
self.draw_offset = (0., 0.).into();

for call in graphics_calls.iter() {
use GraphicsCalls::*;
match call {
GraphicsCalls::ClearScreenBlack => {
graphics.clear_screen(Color::BLACK);
},
GraphicsCalls::ClearScreen(c) => graphics.clear_screen(*c),
GraphicsCalls::DrawRectangle(r, c) => {
ClearScreenBlack => graphics.clear_screen(Color::BLACK),
ClearScreen(c) => graphics.clear_screen(*c),
DrawRectangle(r, c) => {
graphics.draw_rectangle(r.with_offset(self.draw_offset), *c)
},
GraphicsCalls::DrawRectangleImageTinted(r, path_string, c) => {
DrawRectangleImageTinted(r, path_string, c) => {
let image_handle = self.get_image_handle(path_string, graphics);
graphics.draw_rectangle_image_tinted(
r.with_offset(self.draw_offset),
*c,
&image_handle
);
},
GraphicsCalls::DrawText(pos, c, block) => {
DrawText(pos, c, block) => {
graphics.draw_text(pos + self.draw_offset, *c, block);
},
GraphicsCalls::DrawImage(pos, path_string) => {
DrawImage(pos, path_string) => {
let image_handle = self.get_image_handle(path_string, graphics);
graphics.draw_image(pos + self.draw_offset, &image_handle);
},
GraphicsCalls::PushOffset(vec2) => {
PushOffset(vec2) => {
self.draw_offset += *vec2;
self.draw_offset_stack.push(*vec2);
}
GraphicsCalls::PopOffset => {
PopOffset => {
self.draw_offset -= self.draw_offset_stack.pop().unwrap_or(Vec2::ZERO);
},
GraphicsCalls::SetResolution(uvec2) => {
SetResolution(uvec2) => {
graphics.set_resolution(*uvec2);
helper.set_size_pixels(uvec2);
},
GraphicsCalls::ImageFileUpdate(pathbuf) => {
ImageFileUpdate(pathbuf) => {
self.update_image_handle(pathbuf, graphics)
}
}
Expand Down

0 comments on commit d3f7d23

Please sign in to comment.