summaryrefslogtreecommitdiffstats
path: root/src/graphics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics.rs')
-rw-r--r--src/graphics.rs61
1 files changed, 60 insertions, 1 deletions
diff --git a/src/graphics.rs b/src/graphics.rs
index c3917af..ca98946 100644
--- a/src/graphics.rs
+++ b/src/graphics.rs
@@ -1,5 +1,64 @@
+extern crate sfml;
+
+
+use sfml::window::{
+ ContextSettings,
+ Event,
+ Style,
+};
+
+use sfml::graphics::{
+ RenderWindow,
+ RenderTarget,
+ Color,
+};
+
+
+struct State {
+ running: bool
+}
pub fn start() {
-
+ let default_window_size = (1280, 720);
+ let default_framerate = 80;
+
+ let mut state = State {
+ running: true
+ };
+
+ let context_settings = ContextSettings {
+ antialiasing_level: 0,
+ ..Default::default()
+ };
+
+ let mut window = RenderWindow::new(
+ default_window_size,
+ "Subconscious",
+ Style::CLOSE,
+ &context_settings
+ );
+
+ window.set_framerate_limit(default_framerate);
+ window.set_vertical_sync_enabled(true);
+
+
+ while state.running {
+ render(&mut window);
+ update(&mut window, &mut state);
+ }
+}
+
+fn render(window: &mut RenderWindow) {
+ window.clear(&Color::BLACK);
+ window.display();
+}
+
+fn update(window: &mut RenderWindow, state: &mut State) {
+ while let Some(ev) = window.poll_event() {
+ match ev {
+ Event::Closed => state.running = false,
+ _ => {},
+ }
+ }
} \ No newline at end of file