Moved main loop to App
[kaka/rust-sdl-test.git] / src / main.rs
CommitLineData
296187ca
TW
1extern crate rand;
2extern crate sdl2;
3extern crate time;
4
9c06350b 5use game::app::*;
296187ca 6
9c06350b 7mod game;
6ba7aef1
TW
8#[macro_use]
9mod common;
296187ca 10mod boll;
cdf8f998 11mod sprites;
296187ca
TW
12
13const SCREEN_WIDTH: u32 = 1280;
14const SCREEN_HEIGHT: u32 = (SCREEN_WIDTH as f64 * (1440.0 / 2560.0)) as u32;
296187ca 15
296187ca
TW
16fn main() {
17 println!("starting...");
6edafdc0 18 let mut app = App::new()
6ba7aef1
TW
19 .with_resolution(SCREEN_WIDTH as u16, SCREEN_HEIGHT as u16)
20 .with_state(Box::new(ActiveState::new()))
21 .with_title("SDL test")
22 .build()
23 .unwrap();
24 app.load_sprites(&[("block", "res/block.bmp"), ("mario", "res/mario-trans.png")]);
25
26 app.start();
296187ca 27}