aboutsummaryrefslogtreecommitdiff
path: root/src/ui.rs
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-10 20:55:43 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-10 20:55:43 +0200
commit7fa4f497f77471fa145881d759afe0b521971e04 (patch)
tree4cb813362075667db6dbec140dc2ce166dc4d894 /src/ui.rs
parent47d15d537c61b828e72113cc8d3d8da3db9a2efb (diff)
downloadrutikmer-7fa4f497f77471fa145881d759afe0b521971e04.tar.gz
rutikmer-7fa4f497f77471fa145881d759afe0b521971e04.tar.bz2
rutikmer-7fa4f497f77471fa145881d759afe0b521971e04.zip
Added shuffle generator
Diffstat (limited to 'src/ui.rs')
-rw-r--r--src/ui.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ui.rs b/src/ui.rs
new file mode 100644
index 0000000..011e5ed
--- /dev/null
+++ b/src/ui.rs
@@ -0,0 +1,23 @@
+use sdl2::rect::Rect;
+
+pub struct UI {
+ pub history_rect: Rect,
+ pub shuffle_rect: Rect,
+ pub timer_rect: Rect,
+}
+
+impl UI {
+ pub fn new(width: u32, height: u32) -> UI {
+ let default = Rect::new(0, 0, 0, 0);
+ let mut ret = UI {history_rect: default, shuffle_rect: default, timer_rect:default};
+ ret.set_layout(width, height);
+ ret
+ }
+
+ pub fn set_layout(&mut self, width: u32, height: u32) {
+ self.history_rect = Rect::new(0, 0, width / 3, height);
+ self.shuffle_rect = Rect::new((width / 3) as i32, 0, width - width / 3, height / 4);
+ self.timer_rect = Rect::new((width / 3) as i32, (height / 4 + (height - height / 4) / 2) as i32,
+ 100, 40);
+ }
+}