rust/lib-hedgewars-engine/src/instance.rs
changeset 14710 19122a329774
parent 14709 12db7e435ea6
child 15270 07e909ba4203
equal deleted inserted replaced
14709:12db7e435ea6 14710:19122a329774
     1 use hedgewars_engine_messages::messages::{
     1 use hedgewars_engine_messages::messages::{
     2     ConfigEngineMessage::*, EngineMessage::*, KeystrokeAction::*, SyncedEngineMessage::*,
     2     ConfigEngineMessage::*, EngineMessage::*, KeystrokeAction::*, SyncedEngineMessage::*,
     3     UnorderedEngineMessage::*, UnsyncedEngineMessage::*, *,
     3     UnorderedEngineMessage::*, UnsyncedEngineMessage::*, *,
     4 };
     4 };
     5 
     5 
       
     6 use integral_geometry::{Point, Rect, Size};
     6 use landgen::outline_template::OutlineTemplate;
     7 use landgen::outline_template::OutlineTemplate;
     7 use integral_geometry::{Point, Rect, Size};
       
     8 
     8 
     9 use super::{ipc::IPC, world::World};
     9 use super::{ipc::IPC, world::World};
    10 
    10 
    11 pub struct EngineInstance {
    11 pub struct EngineInstance {
    12     pub world: World,
    12     pub world: World,
    16 impl EngineInstance {
    16 impl EngineInstance {
    17     pub fn new() -> Self {
    17     pub fn new() -> Self {
    18         let mut world = World::new();
    18         let mut world = World::new();
    19 
    19 
    20         fn template() -> OutlineTemplate {
    20         fn template() -> OutlineTemplate {
    21             let mut template = OutlineTemplate::new(Size::new(4096*1, 2048*1));
    21             let mut template = OutlineTemplate::new(Size::new(4096 * 1, 2048 * 1));
    22             template.islands = vec![vec![
    22             template.islands = vec![vec![
    23                 Rect::from_size_coords(100, 2050, 1, 1),
    23                 Rect::from_size_coords(100, 2050, 1, 1),
    24                 Rect::from_size_coords(100, 500, 400, 1200),
    24                 Rect::from_size_coords(100, 500, 400, 1200),
    25                 Rect::from_size_coords(3600, 500, 400, 1200),
    25                 Rect::from_size_coords(3600, 500, 400, 1200),
    26                 Rect::from_size_coords(3900, 2050, 1, 1),
    26                 Rect::from_size_coords(3900, 2050, 1, 1),
    27             ]];
    27             ]];
    28             template.fill_points = vec![Point::new(1, 0)];
    28             template.fill_points = vec![Point::new(1, 0)];
    29 
    29 
    30             template
    30             template
    31         }
    31         }
    32         
    32 
    33         world.init(template());
    33         world.init(template());
    34         
    34 
    35         Self {
    35         Self {
    36             world,
    36             world,
    37             ipc: IPC::new(),
    37             ipc: IPC::new(),
    38         }
    38         }
    39     }
    39     }