diff --git a/.gitignore b/.gitignore index 62bd1a4..29a7654 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,8 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk + + +#Added by cargo + +/target diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..9ae6215 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "cargo", + "subcommand": "run", + "problemMatcher": [ + "$rustc" + ] + }, + { + "type": "cargo", + "subcommand": "build", + "problemMatcher": [ + "$rustc" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..ec27cd7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "spijkerboor" +version = "0.1.0" +authors = ["Martijn de Boer "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +sdl2 = { version = "0.33.0", features = ["bundled", "static-link"] } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..b1a446d --- /dev/null +++ b/src/main.rs @@ -0,0 +1,22 @@ +extern crate sdl2; + +fn main() { + let sdl = sdl2::init().unwrap(); + let video = sdl.video().unwrap(); + let window = video.window( + "Spijkerboor", 400, 400 + ) + .opengl() + .build().unwrap(); + + let gl_context = window.gl_create_context().unwrap(); + + let mut event_pump = sdl.event_pump().unwrap(); + 'main: loop { + for event in event_pump.poll_iter() { + match event { + sdl2::event::Event::Quit { .. } => break 'main, _ => {} + } + } + } +}