Exemplo n.º 1
0
        public void Duplicate()
        {
            SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);

            Program.Sprites.Add(Program.SpriteIncremental, res);
            Program.IDE.AddResource(Node.Parent, res, "sprite" + Program.SpriteIncremental++.ToString(), Node.Index + 1, true, false, true);
        }
Exemplo n.º 2
0
        public void Insert()
        {
            SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);

            Program.Sprites.Add(Program.SpriteIncremental, res);
            Program.IDE.AddResource(Node, res, "sprite" + Program.SpriteIncremental++.ToString(), -1, true, false, true);
        }
Exemplo n.º 3
0
 public void Edit()
 {
     if (editor != null && editor.Created)
     {
         editor.Focus();
     }
     else
     {
         editor = new ObjectEditor(this);
         editor.ObjectEvents      = Events;
         editor.VisibleChecked    = visible;
         editor.SolidChecked      = solid;
         editor.PersistentChecked = persistent;
         editor.ObjectName        = name;
         editor.Depth             = depth;
         editor.Text      = "Object Properties: " + name;
         editor.MdiParent = Program.IDE;
         editor.Saved     = true;
         SpriteResourceView r = null;
         Program.Sprites.TryGetValue(sprite, out r);
         editor.Sprite = r;
         editor.Save  += new EventHandler(editor_Save);
         editor.Show();
     }
 }
Exemplo n.º 4
0
        private void CreateSprite()
        {
            SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);

            Program.Sprites.Add(Program.SpriteIncremental, res);
            AddResource(Sprites.Node, res, "sprite" + Program.SpriteIncremental++.ToString(), -1, true, false, true);
        }
Exemplo n.º 5
0
        public DesignerForm()
        {
            InitializeComponent();
            PopulateNewResourceTree();
            //
            //ScriptResourceView res = new ScriptResourceView(Program.ScriptIncremental);
            //Program.Scripts.Add(Program.ScriptIncremental++, res);
            //res.Code = Properties.Resources.scr_main;
            //AddResource(Scripts.Node, res, "scr_main", -1, false, false, false);
            //
            SpriteResourceView spr = new SpriteResourceView(Program.SpriteIncremental);

            Program.Sprites.Add(Program.SpriteIncremental++, spr);
            //spr.SubImages = new Bitmap[] { new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb) };
            //Graphics.FromImage(spr.SubImages.First()).Clear(Color.Red);
            using (Bitmap temp = Properties.Resources.Earth) // make temp a temporary copy
            {
                spr.Animation = new FrameBasedAnimation(temp, false, false, false);
            }
            AddResource(Sprites.Node, spr, "spr_earth", -1, false, false, false);
            //
            ObjectResourceView obj = new ObjectResourceView(Program.ObjectIncremental);

            Program.Objects.Add(Program.ObjectIncremental++, obj);
            obj.Sprite = 0;
            obj.events.Add(new ObjectEvent(EventType.Create, 0));
            // I'm likin' linq! First time using it ^^
            ActionDefinition setVariable =
                (from lib in Program.Library
                 where lib.TabCaption == "control"
                 select lib.Actions into actions
                 from action in actions
                 where action.Name == "Variable"
                 select action).First();

            // yea let's use our setVariable action we found with linq :)
            obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
            obj.events[0].Actions[0].Arguments[0] = "image_speed";
            obj.events[0].Actions[0].Arguments[1] = ".5";
            obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
            obj.events[0].Actions[1].Arguments[0] = "image_xscale";
            obj.events[0].Actions[1].Arguments[1] = "3.2";
            obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
            obj.events[0].Actions[2].Arguments[0] = "image_yscale";
            obj.events[0].Actions[2].Arguments[1] = "2.4";
            //obj.events[0].Actions.Add(new ActionDeclaration(Program.Library[3].Actions[20])); // 'Execute Code' action in 'Control' lib, by index
            //obj.events[0].Actions[1].Arguments[0] = "show_message(\r\n \"hspeed: \" +	string(hspeed) +  \r\n \"#vspeed: \" +	string(vspeed) + \r\n \"#speed: \" +	string(speed) + \r\n \"#dir: \" +	string(direction) \r\n);";
            AddResource(Objects.Node, obj, "object0", -1, false, false, false);
            //
            TreeNode         RoomsNode = treeView1.Nodes["Rooms"];
            RoomResourceView res1      = new RoomResourceView(Program.RoomIncremental);

            res1.CreationCode = "instance_create(0, 0, object0)";//\r\nscr_main();";
            Program.Rooms.Add(Program.RoomIncremental, res1);
            AddResource(Rooms.Node, res1, "room" + Program.RoomIncremental++, -1, false, false, false);
        }
Exemplo n.º 6
0
 public DesignerForm()
 {
     InitializeComponent();
     PopulateNewResourceTree();
     //
     //ScriptResourceView res = new ScriptResourceView(Program.ScriptIncremental);
     //Program.Scripts.Add(Program.ScriptIncremental++, res);
     //res.Code = Properties.Resources.scr_main;
     //AddResource(Scripts.Node, res, "scr_main", -1, false, false, false);
     //
     SpriteResourceView spr = new SpriteResourceView(Program.SpriteIncremental);
     Program.Sprites.Add(Program.SpriteIncremental++, spr);
     //spr.SubImages = new Bitmap[] { new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb) };
     //Graphics.FromImage(spr.SubImages.First()).Clear(Color.Red);
     using (Bitmap temp = Properties.Resources.Earth) // make temp a temporary copy 
     {
         spr.Animation = new FrameBasedAnimation(temp, false, false, false);
     }
     AddResource(Sprites.Node, spr, "spr_earth", -1, false, false, false);
     //
     ObjectResourceView obj = new ObjectResourceView(Program.ObjectIncremental);
     Program.Objects.Add(Program.ObjectIncremental++, obj);
     obj.Sprite = 0;
     obj.events.Add(new ObjectEvent(EventType.Create, 0));
     // I'm likin' linq! First time using it ^^
     ActionDefinition setVariable = 
         (from lib in Program.Library
         where lib.TabCaption == "control"
         select lib.Actions into actions
         from action in actions
         where action.Name == "Variable"
         select action).First();
     // yea let's use our setVariable action we found with linq :)
     obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
     obj.events[0].Actions[0].Arguments[0] = "image_speed";
     obj.events[0].Actions[0].Arguments[1] = ".5";
     obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
     obj.events[0].Actions[1].Arguments[0] = "image_xscale";
     obj.events[0].Actions[1].Arguments[1] = "3.2";
     obj.events[0].Actions.Add(new ActionDeclaration(setVariable));
     obj.events[0].Actions[2].Arguments[0] = "image_yscale";
     obj.events[0].Actions[2].Arguments[1] = "2.4";
     //obj.events[0].Actions.Add(new ActionDeclaration(Program.Library[3].Actions[20])); // 'Execute Code' action in 'Control' lib, by index
     //obj.events[0].Actions[1].Arguments[0] = "show_message(\r\n \"hspeed: \" +	string(hspeed) +  \r\n \"#vspeed: \" +	string(vspeed) + \r\n \"#speed: \" +	string(speed) + \r\n \"#dir: \" +	string(direction) \r\n);";
     AddResource(Objects.Node, obj, "object0", -1, false, false, false);
     //
     TreeNode RoomsNode = treeView1.Nodes["Rooms"];
     RoomResourceView res1 = new RoomResourceView(Program.RoomIncremental);
     res1.CreationCode = "instance_create(0, 0, object0)";//\r\nscr_main();";
     Program.Rooms.Add(Program.RoomIncremental, res1);
     AddResource(Rooms.Node, res1, "room" + Program.RoomIncremental++, -1, false, false, false);
 }
 public void Insert()
 {
     SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);
     Program.Sprites.Add(Program.SpriteIncremental, res);
     Program.IDE.AddResource(Node, res, "sprite" + Program.SpriteIncremental++.ToString(), -1, true, false, true);
 }
Exemplo n.º 8
0
 private void CreateSprite()
 {
     SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);
     Program.Sprites.Add(Program.SpriteIncremental, res);
     AddResource(Sprites.Node, res, "sprite" + Program.SpriteIncremental++.ToString(), -1, true, false, true);
 }
 public void Duplicate()
 {
     SpriteResourceView res = new SpriteResourceView(Program.SpriteIncremental);
     Program.Sprites.Add(Program.SpriteIncremental, res);
     Program.IDE.AddResource(Node.Parent, res, "sprite" + Program.SpriteIncremental++.ToString(), Node.Index + 1, true, false, true);
 }