From b09036110266f0550a3cef6e9b0ca589dccf509f Mon Sep 17 00:00:00 2001 From: fence Date: Mon, 6 Jan 2025 18:07:04 +0100 Subject: feat: init --- .gitignore | 1 + .vscode/settings.json | 3 ++ Cargo.lock | 63 ++++++++++++++++++++++++++++++++++ Cargo.toml | 14 ++++++++ assets/galmuri-alphabet-font-20px.png | Bin 0 -> 2111 bytes assets/uwu-logo-font-20px.png | Bin 0 -> 1711 bytes build | 3 ++ rustfmt.toml | 1 + src/main.rs | 44 ++++++++++++++++++++++++ 9 files changed, 129 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 assets/galmuri-alphabet-font-20px.png create mode 100644 assets/uwu-logo-font-20px.png create mode 100755 build create mode 100644 rustfmt.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ff30c44 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.tabSize": 2 +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..290a040 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,63 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cosin-2025-invite-deck" +version = "0.1.0" +dependencies = [ + "sdl2", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.169" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" + +[[package]] +name = "sdl2" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b498da7d14d1ad6c839729bd4ad6fc11d90a57583605f3b4df2cd709a9cd380" +dependencies = [ + "bitflags", + "lazy_static", + "libc", + "sdl2-sys", +] + +[[package]] +name = "sdl2-sys" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951deab27af08ed9c6068b7b0d05a93c91f0a8eb16b6b816a5e73452a43521d3" +dependencies = [ + "cfg-if", + "libc", + "version-compare", +] + +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9bb8ac8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "cosin-2025-invite-deck" +version = "0.1.0" +edition = "2021" + +[dependencies] +sdl2 = "0.37.0" + +[profile.release] +strip = true +opt-level = "z" +lto = true +codegen-units = 1 +panic = "abort" diff --git a/assets/galmuri-alphabet-font-20px.png b/assets/galmuri-alphabet-font-20px.png new file mode 100644 index 0000000..57e4c30 Binary files /dev/null and b/assets/galmuri-alphabet-font-20px.png differ diff --git a/assets/uwu-logo-font-20px.png b/assets/uwu-logo-font-20px.png new file mode 100644 index 0000000..7ecbdaf Binary files /dev/null and b/assets/uwu-logo-font-20px.png differ diff --git a/build b/build new file mode 100755 index 0000000..6fc9458 --- /dev/null +++ b/build @@ -0,0 +1,3 @@ +#!/bin/sh +set -eax +RUSTFLAGS="-Zfmt-debug=none -Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features="optimize_for_size" -Z build-std-features=panic_immediate_abort -r diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..b196eaa --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +tab_spaces = 2 diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..a3bcca1 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,44 @@ +extern crate sdl2; + +use sdl2::event::Event; +use sdl2::keyboard::Keycode; +use sdl2::pixels::Color; +use std::time::Duration; + +pub fn main() { + let sdl_context = sdl2::init().unwrap(); + let video_subsystem = sdl_context.video().unwrap(); + + let window = video_subsystem + .window("hentai", 800, 600) + .position_centered() + .build() + .unwrap(); + + let mut canvas = window.into_canvas().build().unwrap(); + + canvas.set_draw_color(Color::RGB(0, 255, 255)); + canvas.clear(); + canvas.present(); + let mut event_pump = sdl_context.event_pump().unwrap(); + let mut i = 0; + 'running: loop { + i = (i + 1) % 255; + canvas.set_draw_color(Color::RGB(i, 64, 255 - i)); + canvas.clear(); + for event in event_pump.poll_iter() { + match event { + Event::Quit { .. } + | Event::KeyDown { + keycode: Some(Keycode::Escape), + .. + } => break 'running, + _ => {} + } + } + // The rest of the game loop goes here... + + canvas.present(); + ::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 60)); + } +} -- cgit v1.2.3