public Level(EventListener sysCall, StaticData sdb, ViewDB vdb, Viewport view) { disp = new EventDispatcher(); state = new State(sdb); op = new Operator(); gui = new GUI(vdb, view, op.OnSelect, disp); disp.MapInput(InputType.MouseLeft_Up, EventType.Select); disp.MapInput(InputType.MouseRight_Up, EventType.Action); disp.MapInput(InputType.RightShift_Down, EventType.Waypoint); disp.MapInput(InputType.RightShift_Up, EventType.WaypointOff); disp.MapInput(InputType.LeftShift_Down, EventType.Waypoint); disp.MapInput(InputType.LeftShift_Up, EventType.WaypointOff); disp.MapInput(InputType.Up_Down, EventType.CameraUp); disp.MapInput(InputType.Right_Down, EventType.CameraRight); disp.MapInput(InputType.Down_Down, EventType.CameraDown); disp.MapInput(InputType.Left_Down, EventType.CameraLeft); disp.MapInput(InputType.Up_Up, EventType.CameraUpEnd); disp.MapInput(InputType.Right_Up, EventType.CameraRightEnd); disp.MapInput(InputType.Down_Up, EventType.CameraDownEnd); disp.MapInput(InputType.Left_Up, EventType.CameraLeftEnd); disp.MapInput(InputType.Escape_Up, EventType.End); disp.AddListener(this, EventType.Game); disp.AddListener(sysCall, EventType.System); }
public UI(ViewDB db_, Camera c_, SelectionCallback onSelect_) { db = db_; c = c_; newSel = new Point(-1, -1); onSelect = onSelect_; }
public GUI(ViewDB db_, Viewport v, SelectionCallback onSelect, EventDispatcher disp) { db = db_; c = new Camera(0, 0, v); r = new Renderer(db, c); ui = new UI(db, c, onSelect); disp.AddListener(r, EventType.View); disp.AddListener(ui, EventType.UI); }
public Level CreateLevel(InGameScreen screen) { StaticData sdb = screen.Load<StaticData>("Entities/entities"); ViewDB vdb = new ViewDB(); vdb.Put("red", screen.Load<Texture2D>("Image/red")); vdb.Put("blue", screen.Load<Texture2D>("Image/blue")); vdb.Put("bg", screen.Load<Texture2D>("Image/bg")); vdb.Put("anim", screen.Load<AnimatedTexture2D>("Image/test")); vdb.Put("animSelect", screen.Load<AnimatedTexture2D>("Image/testSelect")); return new Level(screen, sdb, vdb, new Viewport(0, 0, 800, 400)); }
public Renderer(ViewDB db_, Camera c_) { db = db_; c = c_; xPan = yPan = 0; }