Example #1
0
 public GameBoard(IGameUiDrawer drawer, IMatrix matrix, IOptions <GameSettings> settings, IToolBox toolBox)
 {
     this.Drawer        = drawer;
     this.Matrix        = matrix;
     this._gameSettings = settings;
     this._toolBox      = toolBox;
 }
Example #2
0
        public TheMatrix(IOptions <GameSettings> settings, IToolBox toolBox)
        {
            this._gamesttings          = settings;
            this.TheGrid               = new ICell[this._gamesttings.Value.BoardHeight, this._gamesttings.Value.BoardWidth];
            this.TheNextGenerationGrid = new ICell[this._gamesttings.Value.BoardHeight, this._gamesttings.Value.BoardWidth];

            this.ToolBox = toolBox;
        }
Example #3
0
        public ActiveFormation(IFormation formation, ICellPosition formationPosition, IToolBox toolBox)
        {
            this.Formation = formation;

            this.Position = formationPosition;
            this.ToolBox  = toolBox;
            this.InitializeInstructions();
        }
Example #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent</param>
 public FormTools(IToolBox parent)
 {
     InitializeComponent();
     ResourceService.Resources.LoadControlResources(this,
                                                    new Dictionary <string, object>[]
     {
         ResourceService.Resources.ControlResources
     });
     this.parent = parent;
     if (pictImage == null)
     {
         pictImage = buttonPicture.Image;
     }
     init();
 }
Example #5
0
        private void initForm()
        {
            #region ToolBox
            this.toolbox = new DefaultToolBox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.toolbox);
            #endregion

            #region Tool
            this.toolbox.addTool(new LineTool());
            this.toolbox.addTool(new RectangleTool());
            this.toolbox.addTool(new SelectionTool());
            this.toolbox.addTool(new ConnectorTool());
            this.toolbox.addTool(new FreeLineTool());
            this.toolbox.ToolSelected += ToolBox_ToolSelected;
            #endregion

            #region Canvas
            this.canvas = new DefaultCanvas();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.canvas);
            #endregion
        }
Example #6
0
 public Piccasso(IOptions <GameSettings> setings, IToolBox toolBox)
 {
     this._gameSettings = setings;
     this._toolBox      = toolBox;
 }
        /// <summary>
        /// We load any content we need at the beginning of the application life cycle.
        /// Also anything that needs initialising is done here
        /// </summary>
        protected override void LoadContent()
        {
            this.SpriteBatch = new SpriteBatch (GraphicsDeviceManager.GraphicsDevice);

            // determine if we are a retina or not -
            // if so then we'll need to double (scale = 2) our layout locations/sizes
            // and load a bigger spritemap
            bool highResolution = this.DeviceScale  > 1;

            Texture2D graphicsTextureMap = null;
            if (highResolution)
            {
                graphicsTextureMap = Content.Load<Texture2D>("*****@*****.**");
            }
            else
            {
                graphicsTextureMap = Content.Load<Texture2D>("graphics.png");
            }

            this.GraphicsDisplay = new GraphicsDisplay(graphicsTextureMap, this.SpriteBatch, highResolution);

            this.Canvas = new Canvas(this.GraphicsDisplay);

            this.ToolBox = CreateToolbox();

            this.CreateRenderTargets();
        }
        public MainWindow()
        {
            InitializeComponent();
            Debug.WriteLine("Initializing UI objects.");

            #region Canvas

            Debug.WriteLine("Loading canvas...");
            this.canvas = new DefaultCanvas();
            this.toolStripContainer1.ContentPanel.Controls.Add((Control)this.canvas);

            #endregion


            #region Menubar

            Debug.WriteLine("Loading menubar...");
            this.menubar = new DefaultMenubar();
            this.Controls.Add((Control)this.menubar);

            DefaultMenuItem fileMenuItem = new DefaultMenuItem("File");
            this.menubar.AddMenuItem(fileMenuItem);

            DefaultMenuItem newMenuItem = new DefaultMenuItem("New");
            fileMenuItem.AddMenuItem(newMenuItem);
            fileMenuItem.AddSeparator();
            DefaultMenuItem exitMenuItem = new DefaultMenuItem("Exit");
            fileMenuItem.AddMenuItem(exitMenuItem);
            exitMenuItem.Click += new System.EventHandler(this.OnexitMenuItemClick);

            DefaultMenuItem editMenuItem = new DefaultMenuItem("Edit");
            this.menubar.AddMenuItem(editMenuItem);

            //Disini untuk membuat Default Menu item, ini tombol yang tempatnya di MenuBar
            //Dia akan melakukan perintah this.OnundoMenuItemClick
            //Coba find ini OnundoMenuItemClick
            //Ada di line 169
            DefaultMenuItem undoMenuItem = new DefaultMenuItem("Undo");
            editMenuItem.AddMenuItem(undoMenuItem);
            undoMenuItem.Click += new System.EventHandler(this.OnundoMenuItemClick);

            DefaultMenuItem redoMenuItem = new DefaultMenuItem("Redo");
            editMenuItem.AddMenuItem(redoMenuItem);
            redoMenuItem.Click += new System.EventHandler(this.OnredoMenuItemClick);

            DefaultMenuItem viewMenuItem = new DefaultMenuItem("View");
            this.menubar.AddMenuItem(viewMenuItem);

            DefaultMenuItem helpMenuItem = new DefaultMenuItem("Help");
            this.menubar.AddMenuItem(helpMenuItem);

            DefaultMenuItem aboutMenuItem = new DefaultMenuItem("About");
            helpMenuItem.AddMenuItem(aboutMenuItem);
            helpMenuItem.Click += new System.EventHandler(this.OnaboutMenuItemClick);

            #endregion

            #region Toolbox

            // Initializing toolbox
            Debug.WriteLine("Loading toolbox...");
            this.tool_box = new DefaultToolbox();
            this.toolStripContainer1.LeftToolStripPanel.Controls.Add((Control)this.tool_box);

            #endregion

            #region Tools

            // Initializing tools
            Debug.WriteLine("Loading tools...");
            //this.tool_box.AddTool(new SelectionTool());
            this.tool_box.AddSeparator();
            this.tool_box.AddTool(new LineTool());
            this.tool_box.AddTool(new DiamondTool());
            this.tool_box.AddTool(new RectangleTool());
            this.tool_box.AddTool(new ParallelogramTool());
            this.tool_box.AddTool(new OvalTool());
            this.tool_box.AddTool(new SelectionTool());
            //this.tool_box.AddTool(new StatefulLineTool());
            //this.tool_box.AddTool(new RectangleTool());
            this.tool_box.tool_selected += Toolbox_ToolSelected;

            #endregion

            #region Toolbar

            // Initializing toolbar
            Debug.WriteLine("Loading toolbar...");
            this.toolbar = new DefaultToolbar();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add((Control)this.toolbar);

            //Nah Kita sekarang disini,
            //Di program utama dari program ini,
            //Kita butuh undo disini, jadi perlu dipanggil dulu undoCommand yang udah dibuat tadi,
            //Inisialisasinya kayak gini NamaKelas variableKelas = new NamaKelas(variableYangAkanDiKirim)
            //Nha dia akan ngirim variable this.canvas (Canvas yang sedang dipakai)
            //Kalau disini dia bakal muncul di Toolbar
            //Sebenarnya gausah di inisialisasi karena dicanvas sendiri sudah implement undoredo sejak ada di ICanvas
            //sehingga kalau manggil canvas maka udah bisa dipanggil undo yang udah dibuat tadi
            UndoCommand undoCmd = new UndoCommand(this.canvas);
            RedoCommand redoCmd = new RedoCommand(this.canvas);

            Undo toolItemUndo = new Undo();
            toolItemUndo.SetCommand(undoCmd);
            Redo toolItemRedo = new Redo();
            toolItemRedo.SetCommand(redoCmd);

            this.toolbar.AddToolbarItem(toolItemUndo);
            this.toolbar.AddSeparator();
            this.toolbar.AddToolbarItem(toolItemRedo);
            #endregion
        }