equal
deleted
inserted
replaced
2 dpi::LogicalSize, |
2 dpi::LogicalSize, |
3 Event, |
3 Event, |
4 WindowEvent, |
4 WindowEvent, |
5 EventsLoop, |
5 EventsLoop, |
6 GlWindow, |
6 GlWindow, |
|
7 GlContext |
7 }; |
8 }; |
|
9 |
|
10 use gfx::{ |
|
11 texture, |
|
12 format, |
|
13 Encoder |
|
14 }; |
|
15 |
|
16 use gfx_window_glutin::init_existing; |
|
17 |
|
18 use hedgewars_engine::EngineInstance; |
8 |
19 |
9 fn init(event_loop: &EventsLoop, size: LogicalSize) -> GlWindow { |
20 fn init(event_loop: &EventsLoop, size: LogicalSize) -> GlWindow { |
10 use glutin::{ |
21 use glutin::{ |
11 ContextBuilder, |
22 ContextBuilder, |
12 WindowBuilder |
23 WindowBuilder |
22 |
33 |
23 fn main() { |
34 fn main() { |
24 let mut event_loop = EventsLoop::new(); |
35 let mut event_loop = EventsLoop::new(); |
25 let window = init(&event_loop, LogicalSize::new(1024.0, 768.0)); |
36 let window = init(&event_loop, LogicalSize::new(1024.0, 768.0)); |
26 |
37 |
|
38 let (mut device, mut factory, color_view, depth_view) = |
|
39 init_existing::<format::Rgba8, format::Depth>(&window); |
|
40 |
|
41 let mut encoder: Encoder<_, _> = factory.create_command_buffer().into(); |
|
42 |
|
43 let engine = EngineInstance::new(); |
|
44 |
27 let mut is_running = true; |
45 let mut is_running = true; |
28 while is_running { |
46 while is_running { |
29 event_loop.poll_events(|event| { |
47 event_loop.poll_events(|event| { |
30 match event { |
48 match event { |
31 Event::WindowEvent { event, ..} => match event { |
49 Event::WindowEvent { event, ..} => match event { |
34 }, |
52 }, |
35 _ => () |
53 _ => () |
36 }, |
54 }, |
37 _ => () |
55 _ => () |
38 } |
56 } |
39 }) |
57 }); |
|
58 |
|
59 encoder.clear(&color_view, [0.5, 0.0, 0.0, 1.0]); |
|
60 engine.render(&mut encoder, &color_view); |
|
61 |
|
62 encoder.flush(&mut device); |
|
63 |
|
64 window.swap_buffers().unwrap(); |
40 } |
65 } |
41 } |
66 } |