예제 #1
0
파일: Graphics.cs 프로젝트: jsparber/chess
 // constructor that show the graphic interface to users
 public Graphics(Game g)
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
       int scale = 10;
       if (Screen.Height < 1000)
     scale = 5;
       this.game = g;
       VBox gridWrapper = new VBox ();
       HBox box = new HBox ();
       this.status = new Label ("");
       this.chooser = new Popup (this, this.game.getChooseableFigures(), handleChooser, scale);
       this.mainGrid = new GridWidget (this.game, clickHandler, scale);
       gridWrapper.PackStart (status, false, false, 0);
       gridWrapper.PackStart (this.mainGrid, false, false, 0);
       this.sidebarLeft = new SidebarWidget (g.getRemovedFigures (), "black", scale);
       box.PackStart (new HBox ());
       box.PackStart (this.sidebarLeft);
       box.PackStart (gridWrapper, false, false, 0);
       this.sidebarRight = new SidebarWidget (g.getRemovedFigures (), "white", scale);
       box.PackEnd (this.sidebarRight);
       box.PackStart (new HBox ());
       box.ShowAll ();
       this.Add (box);
       updateGui (this.game.initialState ());
       this.Show ();
 }
예제 #2
0
        // constructor that show the graphic interface to users
        public Graphics(Game g) : base(Gtk.WindowType.Toplevel)
        {
            Build();
            int scale = 10;

            if (Screen.Height < 1000)
            {
                scale = 5;
            }
            this.game = g;
            VBox gridWrapper = new VBox();
            HBox box         = new HBox();

            this.status   = new Label("");
            this.chooser  = new Popup(this, this.game.getChooseableFigures(), handleChooser, scale);
            this.mainGrid = new GridWidget(this.game, clickHandler, scale);
            gridWrapper.PackStart(status, false, false, 0);
            gridWrapper.PackStart(this.mainGrid, false, false, 0);
            this.sidebarLeft = new SidebarWidget(g.getRemovedFigures(), "black", scale);
            box.PackStart(new HBox());
            box.PackStart(this.sidebarLeft);
            box.PackStart(gridWrapper, false, false, 0);
            this.sidebarRight = new SidebarWidget(g.getRemovedFigures(), "white", scale);
            box.PackEnd(this.sidebarRight);
            box.PackStart(new HBox());
            box.ShowAll();
            this.Add(box);
            updateGui(this.game.initialState());
            this.Show();
        }