about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-22 00:29:16 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-22 00:29:16 +0100
commit22efbd7a0e98a759d154bf389d7231e3438b9eaf (patch)
tree59affe51ed3bf5f1cc4e8ec246cb64cfe274a906
parentDependencies: Add "SDL2" dependency (diff)
downloadkyukai-22efbd7a0e98a759d154bf389d7231e3438b9eaf.tar.gz
kyukai-22efbd7a0e98a759d154bf389d7231e3438b9eaf.tar.bz2
kyukai-22efbd7a0e98a759d154bf389d7231e3438b9eaf.zip
SDL: Create simple testing window
Works :^)
-rw-r--r--src/main.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index e7a11a9..f589070 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,25 @@
-fn main() {
-    println!("Hello, world!");
+use sdl2::pixels::Color;
+
+pub 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!");
+
+    let window = sdl_video
+        .window("Kyukai", 10, 10)
+        .fullscreen()
+        .build()
+        .expect("Failed to build the SDL2 window!");
+
+    let mut canvas = window
+        .into_canvas()
+        .build()
+        .expect("Couldn't get the SDL2 canvas from the window!");
+
+    canvas.set_draw_color(Color::RGB(255, 255, 255));
+    canvas.clear();
+    canvas.present();
+
+    loop {}
 }