Esempio n. 1
0
 protected void OnAreaEditorButtonClicked(object sender, EventArgs e)
 {
     if (Project == null)
         return;
     Window win = new Window(WindowType.Toplevel);
     AreaEditor a = new AreaEditor(areaviewer1.Area);
     win.Add(a);
     win.Name = "Edit Area";
     win.ShowAll();
 }
Esempio n. 2
0
        public SubTileEditor(AreaEditor areaEditor)
            : base(0,0,0,0)
        {
            this.areaEditor = areaEditor;

            Gtk.Box tmpBox;

            Gtk.VBox vbox = new VBox(false, 2);
            vbox.Spacing = 10;

            // Top row: 2 images of the tile, one for selecting, one to show
            // collisions

            subTileViewer = new SubTileViewer();

            subTileViewer.SubTileChangedEvent += delegate() {
                PullEverything();
            };

            subTileCollisionEditor = new SubTileCollisionEditor();
            subTileCollisionEditor.CollisionsChangedHandler += () => {
                PullEverything();
            };

            Alignment hAlign = new Alignment(0.5f, 0, 0, 0);
            Gtk.HBox hbox = new HBox(false, 2);
            hbox.PackStart(subTileViewer);
            hbox.PackStart(subTileCollisionEditor);
            hAlign.Add(hbox);

            vbox.PackStart(hAlign);

            // Next row: collision value

            collisionSpinButton = new SpinButtonHexadecimal(0,255);
            collisionSpinButton.Digits = 2;
            collisionSpinButton.CanFocus = false;
            collisionSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                Area.SetTileCollision(TileIndex, (byte)collisionSpinButton.ValueAsInt);
                subTileCollisionEditor.QueueDraw();
            };

            Gtk.Label collisionLabel = new Gtk.Label("Collisions");

            tmpBox = new Gtk.HBox(false, 2);
            tmpBox.PackStart(collisionLabel);
            tmpBox.PackStart(collisionSpinButton);
            vbox.PackStart(tmpBox);

            // Next rows: subtile properties

            var table = new Table(2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 6;

            subTileSpinButton = new SpinButtonHexadecimal(0,255);
            subTileSpinButton.CanFocus = false;
            subTileSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            paletteSpinButton = new SpinButton(0,7,1);
            paletteSpinButton.CanFocus = false;
            paletteSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipXCheckButton = new Gtk.CheckButton();
            flipXCheckButton.CanFocus = false;
            flipXCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipYCheckButton = new Gtk.CheckButton();
            flipYCheckButton.CanFocus = false;
            flipYCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            priorityCheckButton = new Gtk.CheckButton();
            priorityCheckButton.CanFocus = false;
            priorityCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            bankCheckButton = new Gtk.CheckButton();
            bankCheckButton.CanFocus = false;
            bankCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };

            Gtk.Label subTileLabel = new Gtk.Label("Subtile Index");
            Gtk.Label paletteLabel = new Gtk.Label("Palette");
            Gtk.Label flipXLabel = new Gtk.Label("Flip X");
            Gtk.Label flipYLabel = new Gtk.Label("Flip Y");
            Gtk.Label priorityLabel = new Gtk.Label("Priority");
            Gtk.Label bankLabel = new Gtk.Label("Bank (0/1)");

            paletteLabel.TooltipText = "Palette index (0-7)";
            paletteSpinButton.TooltipText = "Palette index (0-7)";

            priorityLabel.TooltipText = "Check to make colors 1-3 appear above sprites";
            priorityCheckButton.TooltipText = "Check to make colors 1-3 appear above sprites";

            bankLabel.TooltipText = "You're better off leaving this checked.";
            bankCheckButton.TooltipText = "You're better off leaving this checked.";

            uint y = 0;

            table.Attach(subTileLabel, 0, 1, y, y+1);
            table.Attach(subTileSpinButton, 1, 2, y, y+1);
            y++;
            table.Attach(paletteLabel, 0, 1, y, y+1);
            table.Attach(paletteSpinButton, 1, 2, y, y+1);
            y++;
            table.Attach(flipXLabel, 0, 1, y, y+1);
            table.Attach(flipXCheckButton, 1, 2, y, y+1);
            y++;
            table.Attach(flipYLabel, 0, 1, y, y+1);
            table.Attach(flipYCheckButton, 1, 2, y, y+1);
            y++;
            table.Attach(priorityLabel, 0, 1, y, y+1);
            table.Attach(priorityCheckButton, 1, 2, y, y+1);
            y++;
            table.Attach(bankLabel, 0, 1, y, y+1);
            table.Attach(bankCheckButton, 1, 2, y, y+1);
            y++;

            vbox.PackStart(table);
            this.Add(vbox);

            ShowAll();

            PullEverything();
        }
Esempio n. 3
0
        public SubTileEditor(AreaEditor areaEditor) : base(0, 0, 0, 0)
        {
            this.areaEditor = areaEditor;

            Gtk.Box tmpBox;

            Gtk.VBox vbox = new VBox(false, 2);
            vbox.Spacing = 10;

            // Top row: 2 images of the tile, one for selecting, one to show
            // collisions

            subTileViewer = new SubTileViewer();

            subTileViewer.SubTileChangedEvent += delegate() {
                PullEverything();
            };

            subTileCollisionEditor = new SubTileCollisionEditor();
            subTileCollisionEditor.CollisionsChangedHandler += () => {
                PullEverything();
            };

            Alignment hAlign = new Alignment(0.5f, 0, 0, 0);

            Gtk.HBox hbox = new HBox(false, 2);
            hbox.Add(subTileViewer);
            hbox.Add(subTileCollisionEditor);
            hAlign.Add(hbox);

            vbox.Add(hAlign);

            // Next row: collision value

            collisionSpinButton               = new SpinButtonHexadecimal(0, 255);
            collisionSpinButton.Digits        = 2;
            collisionSpinButton.CanFocus      = false;
            collisionSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                Area.SetTileCollision(TileIndex, (byte)collisionSpinButton.ValueAsInt);
                subTileCollisionEditor.QueueDraw();
            };

            Gtk.Label collisionLabel = new Gtk.Label("Collisions");

            tmpBox = new Gtk.HBox(false, 2);
            tmpBox.Add(collisionLabel);
            tmpBox.Add(collisionSpinButton);
            vbox.Add(tmpBox);

            // Next rows: subtile properties

            var table = new Table(2, 2, false);

            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;

            subTileSpinButton               = new SpinButtonHexadecimal(0, 255);
            subTileSpinButton.CanFocus      = false;
            subTileSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            paletteSpinButton               = new SpinButton(0, 7, 1);
            paletteSpinButton.CanFocus      = false;
            paletteSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipXCheckButton          = new Gtk.CheckButton();
            flipXCheckButton.CanFocus = false;
            flipXCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipYCheckButton          = new Gtk.CheckButton();
            flipYCheckButton.CanFocus = false;
            flipYCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            priorityCheckButton          = new Gtk.CheckButton();
            priorityCheckButton.CanFocus = false;
            priorityCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            bankCheckButton          = new Gtk.CheckButton();
            bankCheckButton.CanFocus = false;
            bankCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };

            Gtk.Label subTileLabel  = new Gtk.Label("Subtile Index");
            Gtk.Label paletteLabel  = new Gtk.Label("Palette");
            Gtk.Label flipXLabel    = new Gtk.Label("Flip X");
            Gtk.Label flipYLabel    = new Gtk.Label("Flip Y");
            Gtk.Label priorityLabel = new Gtk.Label("Priority");
            Gtk.Label bankLabel     = new Gtk.Label("Bank (0/1)");

            paletteLabel.TooltipText      = "Palette index (0-7)";
            paletteSpinButton.TooltipText = "Palette index (0-7)";

            priorityLabel.TooltipText       = "Check to make colors 1-3 appear above sprites";
            priorityCheckButton.TooltipText = "Check to make colors 1-3 appear above sprites";

            bankLabel.TooltipText       = "You're better off leaving this checked.";
            bankCheckButton.TooltipText = "You're better off leaving this checked.";

            uint y = 0;

            table.Attach(subTileLabel, 0, 1, y, y + 1);
            table.Attach(subTileSpinButton, 1, 2, y, y + 1);
            y++;
            table.Attach(paletteLabel, 0, 1, y, y + 1);
            table.Attach(paletteSpinButton, 1, 2, y, y + 1);
            y++;
            table.Attach(flipXLabel, 0, 1, y, y + 1);
            table.Attach(flipXCheckButton, 1, 2, y, y + 1);
            y++;
            table.Attach(flipYLabel, 0, 1, y, y + 1);
            table.Attach(flipYCheckButton, 1, 2, y, y + 1);
            y++;
            table.Attach(priorityLabel, 0, 1, y, y + 1);
            table.Attach(priorityCheckButton, 1, 2, y, y + 1);
            y++;
            table.Attach(bankLabel, 0, 1, y, y + 1);
            table.Attach(bankCheckButton, 1, 2, y, y + 1);
            y++;

            vbox.Add(table);
            this.Add(vbox);

            ShowAll();

            PullEverything();
        }