Example #1
0
        protected override void Initialize(DisplayWindowConfiguration conf)
        {
            base.Initialize(conf);


            _guiManager.AddButton(10, 80, 200, 50, "White Color", () =>
            {
                _currentLineColor = Color.White;
            }
                                  );
            _guiManager.AddButton(10, 140, 200, 50, "Red Color", () =>
            {
                _currentLineColor = Color.Red;
            }
                                  );
            _guiManager.AddButton(10, 200, 200, 50, "Cube", () =>
            {
                _currentDrawMode = DrawMode.Cubes;
            }
                                  );
            _guiManager.AddButton(10, 260, 200, 50, "Pyramid", () =>
            {
                _currentDrawMode = DrawMode.Pyramids;
            }
                                  );
            _guiManager.AddButton(10, 320, 200, 50, "Clear", () =>
            {
                _drawings.Clear();
            }
                                  );

            _drawings.Add(new Cube(Device));
        }
Example #2
0
        private static void Main()
        {
            Program program    = new Program();
            var     demoConfig = new DisplayWindowConfiguration("LineDrawer", APP_WIDTH, APP_HEIGHT);

            program.Run(demoConfig);

            // Main loop is implemented in base Class BaseSharpDXApp
        }
Example #3
0
        protected override void Initialize(DisplayWindowConfiguration conf)
        {
            base.Initialize(conf);

            // Initialize a TextFormat
            TextFormat = new TextFormat(FactoryDWrite, "Calibri", 20)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Center
            };

            RenderTarget2D.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Cleartype;
            TextLayout = new TextLayout(FactoryDWrite, _mousePosition.GetMouseCoordinates(), TextFormat, conf.Width, conf.Height);


            _guiManager.AddButton(10, 80, 200, 50, "White Color", () =>
            {
                _currentLineColor = Color.White;
            }
                                  );
            _guiManager.AddButton(10, 140, 200, 50, "Red Color", () =>
            {
                _currentLineColor = Color.Red;
            }
                                  );
            _guiManager.AddButton(10, 200, 200, 50, "Lines", () =>
            {
                _currentDrawMode = DrawMode.Lines;
            }
                                  );
            _guiManager.AddButton(10, 260, 200, 50, "Rectangles", () =>
            {
                _currentDrawMode = DrawMode.Rectangles;
            }
                                  );
            _guiManager.AddButton(10, 320, 200, 50, "Clear", () =>
            {
                _drawings.Clear();
            }
                                  );
            _guiManager.AddCheckbox(10, 380, 200, 25, "Fill rectangle", () =>
            {
                _fillRect = !_fillRect;
            }
                                    );
        }