Ejemplo n.º 1
0
        public PlayLobbySceneView(IntPtr hwnd, AutomationElement shinyMain)
        {
            this.hwnd      = hwnd;
            this.shinyMain = shinyMain;

            _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 StickyWindow(hwnd, gfx)
            {
                FPS       = 60,
                IsTopmost = true,
                IsVisible = true
            };
            _window.DestroyGraphics += _window_DestroyGraphics;
            _window.DrawGraphics    += _window_DrawGraphics;
            _window.SetupGraphics   += _window_SetupGraphics;

            _window.Create();
        }
Ejemplo n.º 2
0
        public void FixtureSetUp()
        {
            try {
                // Support ES tests
                Egl.IsRequired = IsEsTest;

#if GL_LOG_ENABLED
                // Set logging
                Gl.QueryLogContext();
                Wgl.QueryLogContext();
                KhronosApi.RegisterApplicationLogDelegate(delegate(string format, object[] args) {
                    Console.WriteLine(format, args);
                });
#endif

                // Create window on which tests are run
                _Window = new GraphicsWindow(800, 600);

                // Define window buffers
                GraphicsBuffersFormat graphicsBuffersFormat = new GraphicsBuffersFormat(PixelLayout.RGB24);

                //graphicsBuffersFormat.DefineDepthBuffer(24, GraphicsBuffersFormat.BufferPolicy.RequiredAndDegradable);
                //graphicsBuffersFormat.DefineDoubleBuffers(GraphicsBuffersFormat.BufferPolicy.RequiredAndDegradable);

                _Window.Create(graphicsBuffersFormat);
                // Create graphics context
                _Context = new GraphicsContext(_Window.GetDeviceContext(), null, null, GraphicsContextFlags.CompatibilityProfile);
            } catch {
                // Release resources manually
                FixtureTearDown();
                throw;
            }
        }
Ejemplo n.º 3
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;
            });
        }
Ejemplo n.º 4
0
        public static void Start()
        {
            Process[] processes = Process.GetProcessesByName(albionProcessName);//Albion-Online

            if (processes.Length > 0)
            {
                albionProcess         = processes[0];
                albionProcess.Exited += AlbionProcess_Exited;
                Console.WriteLine("\nAlbion process found! \nDrawing overlay :)");
                albionWindowRect = new Rect();
                IntPtr ptr = albionProcess.MainWindowHandle;
                albionScreen = Screen.FromHandle(ptr);
                GetWindowRect(ptr, ref albionWindowRect);
            }
            else
            {
                Console.WriteLine("Albion process not found!");
                System.Threading.Thread.Sleep(5000);
                return;
            }

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

            overlayGraphics = gfx;



            window = new GraphicsWindow(albionScreen.Bounds.Left, albionScreen.Bounds.Top, albionScreen.Bounds.Width, albionScreen.Bounds.Height, gfx)
            {
                FPS       = 60,
                IsTopmost = true,
                IsVisible = true
            };

            window.DestroyGraphics += window_DestroyGraphics;
            window.DrawGraphics    += window_DrawGraphics;
            window.SetupGraphics   += window_SetupGraphics;


            window.Create();
            window.Join();

            //System.Threading.Thread.Sleep(5000);
        }
Ejemplo n.º 5
0
        public void Start(IntPtr windowHandle)
        {
            Stop();

            handle = windowHandle;
            var graphics = new Graphics(windowHandle);

            window = new GraphicsWindow(graphics)
            {
                FPS = 120, IsTopmost = true, IsVisible = true
            };

            window.DrawGraphics    += OnDrawGraphics;
            window.DestroyGraphics += OnDestroyGraphics;
            window.SetupGraphics   += OnSetupGraphics;

            window.VisibilityChanged += OnVisibilityChanged;

            window.Create();
            Refit();
        }
Ejemplo n.º 6
0
        public virtual void Run()
        {
            // g.Overlay  = this;
            // g.Graphics = Window.Graphics;
            // g.Window   = Window;
            Window.Create();

            while (!Window.Graphics.IsInitialized)
            {
                Thread.Sleep(10);
            }

            if (UseHook)
            {
                StartHook();
            }

            Window.Deactivate();
            DxWindow = new DxWindow(this, "");

            Loaded = true;
        }
Ejemplo n.º 7
0
            /// <summary>
            /// Actually create resources associated to the type.
            /// </summary>
            /// <param name="instance">
            /// A <see cref="Object"/> that specifies the underlying instance.
            /// </param>
            /// <param name="ctx">
            /// A <see cref="GraphicsContext"/> used for creating the resources.
            /// </param>
            public override void Create(object instance, GraphicsContext ctx)
            {
                GraphicsWindow graphicsWindow = (GraphicsWindow)instance;

                graphicsWindow.Create(new GraphicsBuffersFormat(PixelLayout.RGB24, 24));
            }
Ejemplo n.º 8
0
 public void Run()
 {
     _window.Create();
     _window.Join();
 }
Ejemplo n.º 9
0
 public void Run()
 {
     Window.Create();
     Window.Join();
 }
Ejemplo n.º 10
0
        public SHubMain(SHubConfig cfg)
        {
            InitializeComponent();

            #region Load Configuration
            cfg    = cfg ?? new SHubConfig();
            config = cfg;

            config.Overlay_FontSize = (config.Overlay_FontSize == 0 ? 14 : config.Overlay_FontSize);

            SHubConfigPanel ConfigPannel = new SHubConfigPanel(config);
            while (!config.isSetup())
            {
                DialogResult r = MessageBox.Show("Setting incomplete. Retry or Quit software ?", "Configuration issue", MessageBoxButtons.RetryCancel);
                if (r == DialogResult.Retry)
                {
                    ConfigPannel.ShowDialog();
                }
                else
                {
                    Load += (s, e) => Close(); break;
                }
            }

            Text = $"{config.BotName}";
            #endregion

            #region Twitch
            client = new TwitchClient();

            try
            {
                var clientOptions = new ClientOptions
                {
                    MessagesAllowedInPeriod = 750,
                    ThrottlingPeriod        = TimeSpan.FromSeconds(30)
                };
                WebSocketClient customClient = new WebSocketClient(clientOptions);
                client = new TwitchClient(customClient);
                client.Initialize(config.GetCredential(), config.ChannelName);
                client.OnLog             += Client_OnLog;
                client.OnJoinedChannel   += Client_OnJoinedChannel;
                client.OnMessageReceived += Client_OnMessageReceived;
                client.OnWhisperReceived += Client_OnWhisperReceived;
                client.OnNewSubscriber   += Client_OnNewSubscriber;
                client.OnConnected       += Client_OnConnected;
                client.OnUserJoined      += Client_OnUserJoined;
                client.OnUserLeft        += Client_OnUserLeft;

                client.Connect();

                ExcludedNames.Add(client.TwitchUsername);
                //ExcludedNames.Add(client.JoinedChannels)
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
            #endregion

            #region Twitch_Features
            c_GTAPool.AutoGenerateColumns = true;

            //Bindings
            GTAList = new BindingList <GTA_User>(GTAPoolList);
            BindingSource source = new BindingSource(GTAList, null);
            c_GTAPool.DataSource = source;

            VoteList = new BindingList <RoleVote>(config.RoleVotes);
            BindingSource sourceVoteRole = new BindingSource(VoteList, null);
            c_VotesRoles.DataSource = sourceVoteRole;

            UsersList = new BindingList <GameUser>(ConnectedUsers);
            BindingSource sourceUsers = new BindingSource(UsersList, null);
            c_ConnectedUsers.DataSource = sourceUsers;

            //txt File output for OBS
            UpdateObsFiles();
            UpdateGTACount();
            #endregion

            #region Overlay
            _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(config.Overlay_width, 1080 - config.Overlay_height, config.Overlay_width, config.Overlay_height, gfx)
            {
                FPS       = 30,
                IsTopmost = true,
                IsVisible = true
            };

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

            _window.Create();
            //_window.Join(); //seems to replace or take over the WinForm
            #endregion

            #region Discord
            _client = new DiscordSocketClient();

            _client.Log             += LogAsync;
            _client.Ready           += ReadyAsync;
            _client.MessageReceived += MessageReceivedAsync;

            _ = DiscordTask();
            #endregion

            #region RolesVoteFeature

            #endregion
        }
Ejemplo n.º 11
0
        public void Run()
        {
            _window.Create();

            Console.WriteLine(_window.Handle.ToString("X"));
        }
Ejemplo n.º 12
0
 public void Run()
 {
     m_GraphicsWindow.Create();
     m_GraphicsWindow.Join();
 }