initial window

This commit is contained in:
Martijn de Boer 2020-02-03 21:29:22 +01:00
parent eefa866251
commit 6a46681397
4 changed files with 62 additions and 0 deletions

5
.gitignore vendored
View File

@ -10,3 +10,8 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
#Added by cargo
/target

25
.vscode/tasks.json vendored Normal file
View File

@ -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
}
}
]
}

10
Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
name = "spijkerboor"
version = "0.1.0"
authors = ["Martijn de Boer <git@sexybiggetje.nl>"]
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"] }

22
src/main.rs Normal file
View File

@ -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, _ => {}
}
}
}
}