about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-22 11:04:32 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-22 11:04:32 +0100
commit9ebc55d4a83c4ae830c74f16d86c4ea5eab539c6 (patch)
treed34d420e0cfa74578719a081fcbc618c0dbb0634
parentLoop: Quit if 'ESC' pressed (diff)
downloadkyukai-9ebc55d4a83c4ae830c74f16d86c4ea5eab539c6.tar.gz
kyukai-9ebc55d4a83c4ae830c74f16d86c4ea5eab539c6.tar.bz2
kyukai-9ebc55d4a83c4ae830c74f16d86c4ea5eab539c6.zip
Move window showing to its own function
-rw-r--r--src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 6c7565c..ad96f8f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,12 +2,16 @@ use sdl2::event::Event;
 use sdl2::keyboard::Keycode;
 use sdl2::pixels::Color;
 
-pub fn main() {
+fn main() {
     let sdl_context = sdl2::init().expect("Couldn't initialize the SDL2 context!");
     let sdl_video = sdl_context
         .video()
         .expect("Couldn't get the SDL2 video subsystem!");
 
+    show_screensaver(sdl_context, sdl_video);
+}
+
+fn show_screensaver(sdl_context: sdl2::Sdl, sdl_video: sdl2::VideoSubsystem) {
     let window = sdl_video
         .window("Kyukai", 10, 10)
         .fullscreen()