Esempio n. 1
0
        private void CreateOverlays()
        {
            var graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };

            window = new GraphicsWindow(graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 60,
                X         = 0,
                Y         = 0,
                Width     = actualScreenWidth,
                Height    = actualScreenHeight
            };

            window.SetupGraphics   += Window_SetupGraphics;
            window.DestroyGraphics += Window_DestroyGraphics;
            window.DrawGraphics    += Window_DrawGraphics;

            window.StartThread();
        }
Esempio n. 2
0
        private void buttonInstances_Click(object sender, EventArgs e)
        {
            //GraphicsWindow.Show();
            Primitive win = new Primitive();

            for (int i = 0; i < 3; i++)
            {
                win[i] = LDWindows.Create();
                GraphicsWindow.Title = i.ToString();
                //Shapes.AddEllipse(100, 100);
            }
            LDWindows.CurrentID = win[0];
            Primitive ball = Shapes.AddEllipse(100, 100);

            LDWindows.CurrentID = win[1];
            Shapes.AddEllipse(100, 100);
            GraphicsWindow.BackgroundColor = "Red";
            GraphicsWindow.Hide();
            LDWindows.CurrentID = 0;
            GraphicsWindow.Show();
            LDWindows.CurrentID = win[0];
            Shapes.Move(ball, 200, 200);
            LDWindows.CurrentID = 0;
            Shapes.Move(ball, 300, 300);
            //LDWindow.Hide(win[0]);
            //LDWindow.Close(win[1]);
            //Program.Delay(5000);
            //LDWindow.Hide(win[2]);
        }
 public void CanResizeWindow()
 {
     GraphicsWindow wnd = new GraphicsWindow("", 128, 128);
     wnd.ResizeTo(200, 100);
     Assert.AreEqual(200, wnd.Width);
     Assert.AreEqual(100, wnd.Height);
 }
Esempio n. 4
0
        //private Image _image;

        public StickyOverlay()
        {
            // initialize a new Graphics object
            // GraphicsWindow will do the remaining initialization

            var graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };

            //WINDOWPLACEMENT placement = new WINDOWPLACEMENT();
            // placement.length = Marshal.SizeOf(placement);
            // GetWindowPlacement(GetConsoleWindowHandle(), ref placement);

            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new StickyWindow(GetWindowHandle(), graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 60,
                X         = 0,
                Y         = 0,
                Width     = 800,
                Height    = 600
            };

            _window.SetupGraphics   += _window_SetupGraphics;
            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
        }
Esempio n. 5
0
        public GraphicsWindowExample()
        {
            // initialize a new Graphics object
            // GraphicsWindow will do the remaining initialization
            var graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };

            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new GraphicsWindow(graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 60,
                X         = 0,
                Y         = 0,
                Width     = 800,
                Height    = 600
            };

            _window.SetupGraphics   += _window_SetupGraphics;
            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
        }
Esempio n. 6
0
        public Visuals()
        {
            // initialize a new Graphics object
            // GraphicsWindow will do the remaining initialization
            var graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };

            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new StickyWindow(Memory.Process.MainWindowHandle, graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 144,
                X         = Main.ScreenRect.left,
                Y         = Main.ScreenRect.top,
                Width     = Main.ScreenSize.Width,
                Height    = Main.ScreenSize.Height
            };

            _window.DrawGraphics += _window_DrawGraphics;
        }
Esempio n. 7
0
        static void Paint(int StartPosX, int StartPosY, int Scale)
        {
            GraphicsWindow.Clear();
            for (int i = 0; i < bitPicture.GetLength(0); i++)
            {
                for (int j = 0; j < bitPicture.GetLength(1); j++)
                {
                    if (bitPicture[i, j] == -1)
                    {
                        GraphicsWindow.BrushColor = "Red";
                    }
                    else if (bitPicture[i, j] == 2)
                    {
                        GraphicsWindow.BrushColor = "Blue";
                    }
                    else if (bitPicture[i, j] == 0)
                    {
                        GraphicsWindow.BrushColor = "White";
                    }

                    GraphicsWindow.FillRectangle(
                        x: StartPosX + (j - Scale / 2) * Scale,
                        y: StartPosY + (i - Scale / 2) * Scale,
                        width: Scale,
                        height: Scale);
                }
            }
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            double a = 0.1;

            GraphicsWindow.MouseDown += () =>
            {
                GraphicsWindow.Clear();
                int s = 20;
                int x = s;
                int y = s;
                int w = GraphicsWindow.Width - 2 * x - 10;
                int h = GraphicsWindow.Height - 2 * x - 10;


                DrawSquare(100, a, x, y, x + w, y, x + w, y + h, x, y + h);
                if (GraphicsWindow.LastKey == "D1")
                {
                    a += 0.05;
                }
                if (GraphicsWindow.LastKey == "D2")
                {
                    a -= 0.05;
                }
            };
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="camera">The renderer camera that is to be manipulated by the new instance.</param>
        /// <param name="window">The window in which the scene is drawn.</param>
        /// <param name="ellipsoid">The ellipsoid defining the shape of the globe.</param>
        public CameraLookAtPoint(Camera camera, GraphicsWindow window, Ellipsoid ellipsoid)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            _camera = camera;
            _window = window;

            _centerPoint = camera.Target;

            _zoomFactor = 5.0;
            _zoomRateRangeAdjustment = ellipsoid.MaximumRadius;
            _maximumZoomRate         = Double.MaxValue;
            _minimumZoomRate         = ellipsoid.MaximumRadius / 100.0;

            _rotateFactor = 1.0 / ellipsoid.MaximumRadius;
            _rotateRateRangeAdjustment = ellipsoid.MaximumRadius;
            _maximumRotateRate         = 1.0;
            _minimumRotateRate         = 1.0 / 5000.0;

            // TODO: Should really be:
            // _range = (camera.Eye - camera.Target).Magnitude;
            _range = ellipsoid.MaximumRadius * 2.0;

            MouseEnabled = true;
        }
Esempio n. 10
0
        public WarframeOverlay(Process process)
        {
            _process = process;

            Graphics graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = _process.MainWindowHandle
            };

            _window = new StickyWindow(_process.MainWindowHandle, graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 30,
                X         = 0,
                Y         = 0,
                Width     = 800,
                Height    = 600
            };

            _window.SetupGraphics   += Window_SetupGraphics;
            _window.DestroyGraphics += Window_DestroyGraphics;
            _window.DrawGraphics    += Window_DrawGraphics;
        }
Esempio n. 11
0
        public WatermaskForm(Rectangle canvas)
        {
            Canvas = canvas;

            _brushes = new Dictionary <string, SolidBrush>();
            _fonts   = new Dictionary <string, Font>();
            _images  = new Dictionary <string, Image>();

            var gfx = new Graphics()
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing = true,
                TextAntiAliasing         = true
            };

            _window = new GraphicsWindow((int)Canvas.Left, (int)Canvas.Top, (int)Canvas.Width, (int)Canvas.Height, gfx)
            {
                FPS       = 120,
                IsTopmost = true,
                IsVisible = true
            };

            _window.DestroyGraphics += Window_DestroyGraphics;
            _window.DrawGraphics    += Window_DrawGraphics;
            _window.SetupGraphics   += Window_SetupGraphics;
        }
        public StickyOverlayWindow()
        {
            // initialize a new Graphics object
            // GraphicsWindow will do the remaining initialization
            _graphics = new Graphics()
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };

            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new GraphicsWindow(GetConsoleWindowHandle(), _graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                FPS       = 60
            };

            _window.SetupGraphics   += _window_SetupGraphics;
            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
        }
Esempio n. 13
0
        public Example()
        {
            _brushes        = new Dictionary <string, SolidBrush>();
            _fonts          = new Dictionary <string, Font>();
            _images         = new Dictionary <string, Image>();
            this.gridBounds = Screen.PrimaryScreen.Bounds;

            var gfx = new Graphics()
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing = true,
                TextAntiAliasing         = true
            };

            _window = new GraphicsWindow(0, 0, 800, 600, gfx)
            {
                FPS       = 1,
                IsTopmost = true,
                IsVisible = true,
                X         = 0,
                Y         = 0,
                Width     = this.gridBounds.Width,
                Height    = this.gridBounds.Height
            };

            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
            _window.SetupGraphics   += _window_SetupGraphics;
        }
Esempio n. 14
0
        static bool Download(string URL)
        {
            int    StackPointer   = Stack.Add("Utilities.DownloadUpdate(" + URL + ")");
            string DownloadFolder = string.Empty;

            while (string.IsNullOrWhiteSpace(DownloadFolder) || string.IsNullOrWhiteSpace(LDFile.GetExtension(DownloadFolder)))
            {
                GraphicsWindow.ShowMessage("You will be prompted to select the download location.", "Download Location");
                DownloadFolder = LDDialogs.SaveFile("1=zip;", Program.Directory);
            }
            int UpdaterSize = LDNetwork.DownloadFile(DownloadFolder, URL);

            switch (UpdaterSize)
            {
            case -1:
                GraphicsWindow.ShowMessage(
                    Language.Localization["Check Log"],
                    Language.Localization["Error"]);
                Stack.Exit(StackPointer);
                return(false);

            default:
                GraphicsWindow.ShowMessage("SUCCESS", "Update Downloaded");
                Stack.Exit(StackPointer);
                return(true);
            }
        }
Esempio n. 15
0
        static void Koch(int X1, int Y1, int X2, int Y2, int X3, int Y3, int Step)
        {
            if (Step >= 0)
            {
                var x4 = (int)((X2 + 2 * X1) / 3);
                var y4 = (int)((Y2 + 2 * Y1) / 3);

                var x5 = (int)((2 * X2 + X1) / 3);
                var y5 = (int)((Y1 + 2 * Y2) / 3);

                var xs = (int)((X2 + X1) / 2);
                var ys = (int)((Y2 + Y1) / 2);
                var xn = (int)((4 * xs - X3) / 3);
                var yn = (int)((4 * ys - Y3) / 3);

                GraphicsWindow.DrawLine(x4, y4, xn, yn);
                GraphicsWindow.DrawLine(x5, y5, xn, yn);
                GraphicsWindow.DrawLine(x4, y4, x5, y5);

                Koch(x4, y4, xn, yn, x5, y5, Step - 1);
                Koch(xn, yn, x5, y5, x4, y4, Step - 1);

                Koch(X1, Y1, x4, y4, (int)((2 * X1 + X3) / 3), (int)((2 * Y1 + Y3) / 3) + 1, Step - 1);
                Koch(x5, y5, X2, Y2, (int)((2 * X2 + X3) / 3), (int)((2 * Y2 + Y3) / 3) + 1, Step - 1);
            }
        }
Esempio n. 16
0
        public static void CreateTableUI()
        {
            int StackPointer = Stack.Add("UI.CreateTableUI()");

            Controls.HideControl(GlobalStatic.Dataview);
            Controls.HideControl(GlobalStatic.ListView);
            GlobalStatic.ListView = null;

            HideDisplayResults();
            ClearWindow();

            LDGraphicsWindow.CancelClose = true;
            LDGraphicsWindow.ExitOnClose = false;

            GlobalStatic.Dataview = LDControls.AddDataView((Desktop.Width - 10), (Desktop.Height - 100), "1=Field;2=Type;3=PK;4=AI;5=Unique;6=Not_Null;");
            GraphicsWindow.DrawText(1, 4, "Name: ");
            Controls.Move(GlobalStatic.Dataview, 1, 30);

            _TextBox["Table_Name"] = Controls.AddTextBox(50, 1);
            Controls.SetTextBoxText(_TextBox["Table_Name"], "Table1");

            _Buttons.AddOrReplace("Commit", Controls.AddButton("Commit", 250, 1));
            _Buttons.AddOrReplace("Exit", Controls.AddButton("Exit", 350, 1));

            LDControls.DataViewSetColumnComboBox(GlobalStatic.Dataview, 2, "1=Integer;2=Text;3=Blob;4=Real;5=Numeric;");
            for (int i = 3; i <= 6; i++)
            {
                LDControls.DataViewSetColumnCheckBox(GlobalStatic.Dataview, i);
            }

            Controls.ButtonClicked -= Events.BC;
            Controls.ButtonClicked += CreateTableHandler;
            Stack.Exit(StackPointer);
        }
        public OverlayWrapper(string p, AttachTargetEnum target = AttachTargetEnum.Process)
        {
            _currentProcessId = Process.GetCurrentProcess().Id;
            _attachTargetName = p;

            var graphics = new Graphics
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = false,
                WindowHandle = IntPtr.Zero,
            };

            Window = new GraphicsWindow(graphics)
            {
                IsTopmost = true,
                IsVisible = true,
                X         = SystemInformation.VirtualScreen.X,
                Y         = SystemInformation.VirtualScreen.Y,
                Width     = SystemInformation.VirtualScreen.Width,
                Height    = SystemInformation.VirtualScreen.Height,
            };

            _attachTargetType = target;

            Window.SetupGraphics   += _window_SetupGraphics;
            Window.DestroyGraphics += _window_DestroyGraphics;
            Window.PreDrawGraphics += _window_PreDrawGraphics;
            Window.DrawGraphics    += _window_DrawGraphics;
            Window.SizeChanged     += _window_SizeChanged;
        }
Esempio n. 18
0
 public void Run(Scene scene, SceneOptions options)
 {
     var window = new GraphicsWindow(scene);
     var view = new ElementView(options);
     scene.Initialize(view);
     window.Content = view;
     window.ShowDialog();
 }
Esempio n. 19
0
 public GameOverlayEsp()
 {
     window     = null;
     brushes    = new Dictionary <Color, SolidBrush>();
     read       = new Buffer();
     write      = new Buffer();
     bufferLock = new object();
 }
 public void RegistersWithSubsystem()
 {
     using (GraphicsWindow wnd = new GraphicsWindow("Test Window", 128, 128))
     {
         Assert.AreEqual(1, GraphicsSystem.RenderTarget.Count);
     }
     Assert.AreEqual(0, GraphicsSystem.RenderTarget.Count);
 }
Esempio n. 21
0
        public void Handler([CallerMemberName] string memberName = "")
        {
            string message = "Exception has occurred with:" + Environment.NewLine + memberName;

            GraphicsWindow.Hide();
            System.Media.SystemSounds.Exclamation.Play();
            GraphicsWindow.ShowMessage(message, "Exception");
            Program.End();
        }
Esempio n. 22
0
        /// <summary>
        /// Clears the current window and associated UI dictionaries
        /// </summary>
        static void ClearWindow()
        {
            int StackPointer = Stack.Add("UI.ClearWindow()");

            GraphicsWindow.Clear();
            _Buttons.Clear();
            _TextBox.Clear();

            Stack.Exit(StackPointer);
        }
Esempio n. 23
0
 static void Main(string[] args)
 {
     GraphicsWindow.Show();
     Turtle.PenName("Red");
     (1000).Times(i =>
     {
         Turtle.Forward(6);
         Turtle.Right(i * 7);
     });
 }
 public void CanAttachToExistingWindow()
 {
     IntPtr wnd = Toolkit.utCreateWindow("", 16, 16);
     IntPtr hwnd = Toolkit.utGetWindowHandle(wnd);
     using (GraphicsWindow gfx = new GraphicsWindow(hwnd))
     {
         Assert.IsNotNull(gfx);
     }
     Toolkit.utDestroyWindow(wnd);
 }
Esempio n. 25
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            notifyIcon.Visibility = Visibility.Visible;
            Visibility            = Visibility.Hidden;

            _brushes = new Dictionary <string, SolidBrush>();
            _fonts   = new Dictionary <string, Font>();

            var gfx = new Graphics()
            {
                MeasureFPS = true,
                PerPrimitiveAntiAliasing = true,
                TextAntiAliasing         = true
            };

            _window = new GraphicsWindow(0, 0, (int)System.Windows.SystemParameters.PrimaryScreenWidth, (int)System.Windows.SystemParameters.PrimaryScreenHeight, gfx)
            {
                FPS       = 60,
                IsTopmost = true,
                IsVisible = false
            };

            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
            _window.SetupGraphics   += _window_SetupGraphics;

            _window.Create();
            //var kg = new KeyGesture((Key)(Keys.Control | Keys.Alt | Keys.Tab));
            var key       = (Key)0;
            var modifiers = (ModifierKeys)0;

            if (lockedKeys.Contains(Key.LeftCtrl) || lockedKeys.Contains(Key.RightCtrl))
            {
                modifiers = modifiers | ModifierKeys.Control;
            }
            if (lockedKeys.Contains(Key.LeftAlt) || lockedKeys.Contains(Key.RightAlt))
            {
                modifiers = modifiers | ModifierKeys.Alt;
            }
            if (lockedKeys.Contains(Key.LeftShift) || lockedKeys.Contains(Key.RightShift))
            {
                modifiers = modifiers | ModifierKeys.Shift;
            }
            foreach (var k in lockedKeys.Where(x => x != Key.LeftCtrl && x != Key.RightCtrl && x != Key.LeftAlt && x != Key.RightAlt && x != Key.LeftShift && x != Key.RightShift))
            {
                key = key | k;
            }

            var kg = new KeyGesture(key, modifiers);

            HotkeyManager.Current.AddOrReplace("Toggle", kg, (obj, e) =>
            {
                _window.IsVisible = !_window.IsVisible;
            });
        }
Esempio n. 26
0
        public static void SetWallpaper(String assunto)
        {
            SmallBasicApplication.BeginProgram();



            SmallBasicProgram.foto = Flickr.GetRandomPicture(assunto);
            Desktop.SetWallPaper(SmallBasicProgram.foto);

            GraphicsWindow.ShowMessage("Papel de parede mudado para" + SmallBasicProgram.assunto, "OK");
        }
Esempio n. 27
0
 public OsgControl()
     : base()
 {
     if (!DesignMode)
      {
     _viewer = new Viewer();
     _gw = _viewer.setUpViewerAsEmbeddedInWindow(0, 0, Width, Height);
     _viewer.setCameraManipulator(new TrackballManipulator());
     _viewer.realize();
     InitializeContexts();
      }
 }
        public void CanClearAndSwap()
        {
            GraphicsWindow wnd = new GraphicsWindow("", 128, 128);

            Graphics.BeginFrame();
            Graphics.Clear(1.0f, 1.0f, 1.0f, 1.0f);
            Graphics.EndFrame();
            Graphics.Swap();

            Bitmap image = wnd.GrabScreen();
            Color color = image.GetPixel(1, 1);
            Assert.AreEqual(Color.FromArgb(0xff, 0xff, 0xff, 0xff), color);
        }
        public void CanResizeWindow()
        {
            using (GraphicsWindow wnd = new GraphicsWindow("Test Window", 128, 128))
            {
                wnd.Camera.BackgroundColor = Color.White;
                wnd.Size = new Size(256, 256);

                GraphicsSystem.DrawFrame(wnd);
                Bitmap image = wnd.GrabScreen();
                Color color = image.GetPixel(250, 250);
                Assert.AreEqual(Color.FromArgb(0xff, 0xff, 0xff, 0xff), color);
            }
        }
        public void CanUseSystemWindow()
        {
            using (TestForm form = new TestForm())
            {
                form.Text = "Test Form";
                form.Width = 256;
                form.Height = 256;
                form.Show();

                using (GraphicsWindow wnd = new GraphicsWindow(form.Handle))
                {
                    wnd.Camera.BackgroundColor = Color.White;
                    GraphicsSystem.DrawFrame();
                    Bitmap image = wnd.GrabScreen();
                    Color color = image.GetPixel(1, 1);
                    Assert.AreEqual(Color.FromArgb(0xff, 0xff, 0xff, 0xff), color);
                }
            }
        }
 public void Test_Setup()
 {
     Platform.Connect();
     _wnd = new GraphicsWindow("", 128, 128);
 }
 public void Test_Setup()
 {
     Framework.Connect();
     _wnd = new GraphicsWindow("", 128, 128);
 }
 public void CanCreateWindow()
 {
     using (GraphicsWindow wnd = new GraphicsWindow("Test Window", 128, 128))
     {
     }
 }
 public void CanCreateWindow()
 {
     GraphicsWindow wnd = new GraphicsWindow("", 128, 128);
     Assert.IsNotNull(wnd);
 }