Exemplo n.º 1
0
 public Sprite(Position state)
 {
     this.lastUpdate = null;
     this.State = state;
     this.Width = 60;
     this.Height = 20;
     this.IsSolid = true;
     this.DestroyOffscreen = true;
     this.DeleteMe = false;
     this.CreationIndex = indexCounter++;
 }
Exemplo n.º 2
0
        public ControlPanel()
        {
            InitializeComponent();
            this.boardStatePanel.DataContext = GameInstance.Inst;

            List<Sprite> allSprites = new List<Sprite>();
            var state1 = new Position() { Ay = 0, Ax = 0};
            var s1 = new Sprite(state1) {
                Name = "Red Brick",
                Brush = Brushes.Red,
                IsSolid = true
            };

            var state2 = new Position() { Ay = .0001, Ax = .000012 };
            var s2 = new Sprite(state2) {
                Name = "Wall",
                Brush = Brushes.Black
            };

            var state3 = new Position() { Ay = .0001, Ax = .000012 };
            var s3 = new Sprite(state3) {
                Name = "Avatar",
                Brush = Brushes.Green,
                Width = 10,
                Height = 30
            };

            //var s3 = new Sprite();

            allSprites.Add(s1);
            allSprites.Add(s2);
            allSprites.Add(s3);
            this.allSprites.ItemsSource = allSprites;
            if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.LastFilepath)) {
                ///openFile(Properties.Settings.Default.LastFilepath);
            }
            ///Create a list of sprites, bind these sprites to the control panel
            ///Allow point and click addition to the window
        }
Exemplo n.º 3
0
 internal static Position Deserialize(XElement root)
 {
     var pos = new Position();
     pos.X = double.Parse((string)root.Attribute("X"));
     pos.Y = double.Parse((string)root.Attribute("Y"));
     pos.Ax = double.Parse((string)root.Attribute("Ax"));
     pos.Ay = double.Parse((string)root.Attribute("Ay"));
     pos.Vx = double.Parse((string)root.Attribute("Vx"));
     pos.Vy = double.Parse((string)root.Attribute("Vy"));
     return pos;
 }