protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); screenHelper = new ScreenHelper(); isDuo = screenHelper.Initialize(this); var items = Item.Items; fragmentMap = new Dictionary <string, BaseFragment>(); SinglePortrait singlePortrait = SinglePortrait.NewInstance(items); singlePortrait.RegisterOnItemSelectedListener(this); fragmentMap[GetSimpleName <SinglePortrait>()] = singlePortrait; var dualPortrait = DualPortrait.NewInstance(items); dualPortrait.RegisterOnItemSelectedListener(this); fragmentMap[GetSimpleName <DualPortrait>()] = dualPortrait; var dualLandscape = DualLandscape.NewInstance(items); dualLandscape.RegisterOnItemSelectedListener(this); fragmentMap[GetSimpleName <DualLandscape>()] = dualLandscape; SetupLayout(); }
public DictionaryConfigurationDlg(PropertyTable propertyTable) { m_propertyTable = propertyTable; InitializeComponent(); m_preview.Dock = DockStyle.Fill; m_preview.Location = new Point(0, 0); previewDetailSplit.Panel1.Controls.Add(m_preview); manageConfigs_treeDetailButton_split.IsSplitterFixed = true; treeDetail_Button_Split.IsSplitterFixed = true; this.MinimumSize = new Size(m_grpConfigurationManagement.Width + 3, manageConfigs_treeDetailButton_split.Height); m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider"); m_helpProvider = new HelpProvider { HelpNamespace = m_helpTopicProvider.HelpFile }; m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(HelpTopic)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); m_helpProvider.SetShowHelp(this, true); // Restore the location and size from last time we called this dialog. if (m_propertyTable != null) { object locWnd = m_propertyTable.GetValue <object>("DictionaryConfigurationDlg_Location"); object szWnd = m_propertyTable.GetValue <object>("DictionaryConfigurationDlg_Size"); if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenHelper.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } }
/// <summary> /// Shows the Encoder window. /// </summary> /// <param name="scale">Screen scale.</param> public static void Start(double scale) { #region If already started if (_encoder != null) { if (_encoder.WindowState == WindowState.Minimized) { Restore(); } return; } #endregion _encoder = new Encoder(); var screen = ScreenHelper.GetScreen(_encoder); //Lower Right corner. _encoder.Left = screen.WorkingArea.Width / scale - _encoder.Width; _encoder.Top = screen.WorkingArea.Height / scale - _encoder.Height; _encoder.Show(); }
/// <summary> /// 调整窗口全屏大小和位置 /// </summary> /// <param name="window">目标窗口</param> /// <param name="pre">用于比较的误差精度值</param> public static void AdjustWindowFullScreenSizeLocation(this Window window, double pre = 1e-6) { var workingArea = ScreenHelper.GetWorkingArea(); if (double.IsInfinity(window.MaxHeight) || Math.Abs(window.MaxHeight - workingArea.Height) > pre) { window.MaxHeight = workingArea.Height; } if (double.IsInfinity(window.MaxWidth) || Math.Abs(window.MaxWidth - workingArea.Width) > pre) { window.MaxWidth = workingArea.Width; } //if (Math.Abs(window.Top - workingArea.Y) > pre) //{ // window.Top = workingArea.Y; //} //if (Math.Abs(window.Left - workingArea.X) > pre) //{ // window.Left = workingArea.X; //} }
/// <summary> /// Main aimbot thread. /// </summary> public void Run() { // Retrieve the Fov. var myFov = Fovs.First(x => x.Resolution == new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)); // Run the main routine. while (true) { if (MouseHelper.GetAsyncKeyState(Settings.Widowbot.AimKey) < 0) { // Get the screen capture. var screenCapture = ScreenHelper.GetScreenCapture(myFov.FieldOfView); // Search for a target. var coordinates = SearchHelper.SearchColor(ref screenCapture, Settings.Widowbot.TargetColor, 12); // Only continue if a healthbar was found. if (coordinates.X != 0 || coordinates.Y != 0) { coordinates = ScreenHelper.GetAbsoluteCoordinates(coordinates, myFov.FieldOfView); MouseHelper.Move(ref myFov, coordinates, true); } // Destroy the bitmap. screenCapture.Dispose(); screenCapture = null; } Thread.Sleep(1); } }
/// <summary> /// Main aimbot thread. /// </summary> public void Run() { // Run the main routine. while (true) { if (MouseHelper.GetAsyncKeyState(SettingsManager.Widowbot.AimKey) < 0) { // Get the screen capture. var screenCapture = ScreenHelper.GetScreenCapture(MyFov.FieldOfView); // Search for a target. var coordinates = SearchHelper.SearchColor(ref screenCapture, SettingsManager.Widowbot.TargetColor, 12); // Only continue if a healthbar was found. if (coordinates.X != 0 || coordinates.Y != 0) { coordinates = ScreenHelper.GetAbsoluteCoordinates(coordinates, MyFov.FieldOfView); MouseHelper.Move(ref MyFov, coordinates, true); } // Destroy the bitmap. screenCapture.Dispose(); screenCapture = null; } Thread.Sleep(1); } }
public IEntity getNearTarget() { Color color = Color.FromArgb(203, 98, 88); // champion lifebar Color color2 = Color.FromArgb(208, 94, 94); // minion lifebar var target = ScreenHelper.GetColorPosition(color); if (target == null) { var minion = ScreenHelper.GetColorPosition(color2); if (minion == null) { return(null); } else { return(new Minion(new Point(minion.Value.X + 30, minion.Value.Y + 40))); } } else { return(new Champion(false, new Point(target.Value.X + 50, target.Value.Y + 60))); // lifebarposition + offset to find model } }
public void Update() { if (ScreenHelper.isOutOfScreen(transform.position)) { Destroy(gameObject); } }
protected override void SetFormLayout() { ScreenHelper.SetFormLocation(this); switch (KeyboardManager.ShiftState) { case KeyState.None: btnLeftShift.ForeColor = _defaultForeColor; btnLeftShift.BackColor = _defaultBackColor; break; case KeyState.Temporary: btnLeftShift.ForeColor = _defaultForeColor; btnLeftShift.BackColor = _aciveBackColor; break; case KeyState.Permanant: btnLeftShift.ForeColor = _activeForeColor; btnLeftShift.BackColor = _aciveBackColor; break; } Controls.Cast <Control>().Where(control => control is Button).Cast <Button>().ToList().ForEach(btn => { var keyboardKey = KeyboardManager.Layout[btn.Tag.ToString(), KeyboardManager.ShiftState != KeyState.None, KeyboardManager.IsCapsLocked]; if (keyboardKey != null) { btn.Text = keyboardKey.Char; } }); }
public void Update() { if (ScreenHelper.isOutOfScreen(character.transform.position)) { character.setPosition(characterStartingPosition); } }
void Update() { UpdateUI(); if (Input.GetKey("r")) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } _waveManager.ExecuteCurrentWave(); if (_waveManager.CurrentWave.Ended) { // handle wave powerUp if present if (_waveManager.CurrentWave.Definition.HasPowerUp) { var pos = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y); var powerUpType = _waveManager.CurrentWave.Definition.PowerUp; _powerUpFactory.Create(powerUpType, pos); } _waveManager.MoveNext(); } if (_difficultyManager.CanCreateAsteroid()) { _difficultyManager.NotifyEnemyTypeSelected(EnemyType.Asteroid1); var pos = ScreenHelper.GetRandomScreenPoint(y: EnemySpawnPoint.transform.position.y); _enemyFactory.Create(EnemyType.Asteroid1, pos); } }
/// <summary> /// Helpful place to fix common issues with settings files /// </summary> private void SanitizeSettingsFile() { if (this._hotKeys == null) { return; } // Remove duplicate hotkeys this._hotKeys = this._hotKeys.Distinct(Hotkey.EqualityComparerOnAction).ToList(); // Bring the Toast inside the working area if it is off-screen System.Windows.Rect toastRect = new System.Windows.Rect(this.PositionLeft, this.PositionTop, this.ToastWidth, this.ToastHeight); Vector offsetVector = ScreenHelper.BringRectInsideWorkingArea(toastRect); this.PositionLeft += offsetVector.X; this.PositionTop += offsetVector.Y; // Validate WindowsVolumeMixerIncrement: must be positive! this.WindowsVolumeMixerIncrement = Math.Abs(this.WindowsVolumeMixerIncrement); // Validate StartupWaitTimeout: it cannot be negative! this.StartupWaitTimeout = Math.Abs(this.StartupWaitTimeout); this.Save(); }
public async Task When_Mask_All() { using (ScreenHelper.OverrideVisibleBounds(new Thickness(0, 34, 0, 65))) { var inner = new Border { Background = new SolidColorBrush(Colors.AliceBlue), Child = new Ellipse { Fill = new SolidColorBrush(Colors.DarkOrange) } }; var container = new Grid { Children = { inner } }; VisibleBoundsPadding.SetPaddingMask(container, VisibleBoundsPadding.PaddingMask.All); WindowHelper.WindowContent = container; await WindowHelper.WaitForLoaded(inner); var visibleBounds = ApplicationView.GetForCurrentView().VisibleBounds; var windowBounds = Window.Current.Bounds; RectAssert.AreNotEqual(windowBounds, visibleBounds); var containerBounds = container.GetOnScreenBounds(); var childBounds = inner.GetOnScreenBounds(); RectAssert.AreEqual(windowBounds, containerBounds); RectAssert.AreEqual(visibleBounds, childBounds); } }
public void Initialize() { // Finding GameObjects m_object_player = GameObject.Find("Player"); m_object_helpers = GameObject.Find ("Helpers"); m_object_duckfield = GameObject.Find("Duckfield"); m_object_audio = GameObject.Find("Audio"); m_object_cameraman = GameObject.Find("Main Camera"); // Finding Components m_collision_prober = m_object_player.GetComponent<CollisionProber>(); m_scoring = m_object_player.GetComponent<Scoring>(); m_health = m_object_player.GetComponent<Health>(); m_walker = m_object_player.GetComponent<Walker>(); m_jumper = m_object_player.GetComponent<Jumper>(); m_time_helper = m_object_helpers.GetComponent<TimeHelper>(); m_screen_helper = m_object_helpers.GetComponent<ScreenHelper>(); m_duckfield = m_object_duckfield.GetComponent<DuckField>(); m_duckization = m_object_audio.GetComponent<DuckizationController>(); m_cameraman = m_object_cameraman.GetComponent<Cameraman>(); m_ig_menu = m_object_cameraman.GetComponent<IgMenu>(); }
/// <summary> /// Main trigger thread. /// </summary> public void Run() { while (true) { if (SettingsManager.Triggerbot.IsEnabled) { if (MouseHelper.GetAsyncKeyState(SettingsManager.Triggerbot.AimKey) < 0) { // Get the screen capture. var screenCapture = ScreenHelper.GetScreenCapture(MyFov.FieldOfView); // Search for a target. var coordinates = SearchHelper.SearchColor(ref screenCapture, SettingsManager.Triggerbot.TargetColor, 100); if (coordinates.X != 0 || coordinates.Y != 0) { MouseHelper.Click(); } // Destroy the bitmap. screenCapture.Dispose(); screenCapture = null; } } Thread.Sleep(1); } }
public void AdjustWindow(int clientWidth, int clientHeight, WindowStyles style, out int winWidth, out int winHeight) { // NB only call this for non full screen var rc = new RECT(0, 0, clientWidth, clientHeight); AdjustWindowRect(ref rc, style, false); winWidth = rc.Right - rc.Left; winHeight = rc.Bottom - rc.Top; // adjust to monitor var handle = this._windowHandle != null ? this._windowHandle.Handle : IntPtr.Zero; // Get monitor info var monitorInfo = ScreenHelper.FromHandle(handle); var maxW = monitorInfo.WorkingArea.Right - monitorInfo.WorkingArea.Left; var maxH = monitorInfo.WorkingArea.Bottom - monitorInfo.WorkingArea.Top; if (winWidth > maxW) { winWidth = maxW; } if (winHeight > maxH) { winHeight = maxH; } }
private void buttonWhileDisplay_Click(object sender, EventArgs e) { TabletConfigUtils.config.screenAreaRatio = HNStruct.HNRectRatio.DEFAULT; this.huionWorkAreaPictureRect1.ScreenRectRatio = TabletConfigUtils.config.screenAreaRatio; this.huionWorkAreaPictrueView1.Screenshot = ScreenHelper.getScreenImage((int)TabletConfigUtils.config.curScreenIndex, this.monitorInfos); }
/// <summary> /// Main trigger thread. /// </summary> public void Run() { // Retrieve the Fov. var myFov = Fovs.First(x => x.Resolution == new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)); while (true) { if (MouseHelper.GetAsyncKeyState(Settings.Triggerbot.AimKey) < 0) { // Get the screen capture. var screenCapture = ScreenHelper.GetScreenCapture(myFov.FieldOfView); // Search for a target. var coordinates = SearchHelper.SearchColor(ref screenCapture, Settings.Triggerbot.TargetColor, 100); if (coordinates.X != 0 || coordinates.Y != 0) { MouseHelper.Click(); } // Destroy the bitmap. screenCapture.Dispose(); screenCapture = null; } Thread.Sleep(1); } }
private void EnableFullScreen_Executed(object sender, ExecutedRoutedEventArgs e) { if (!UserSettings.All.FullScreenMode) { Left = _latestPoint.X; Top = _latestPoint.Y; UserSettings.All.RecorderThinMode = _wasThin; return; } _latestPoint = new System.Windows.Point(Left, Top); _wasThin = UserSettings.All.RecorderThinMode; //Check position while openning the window while in fullscreen mode. //Check memory usage. //Check the stop. //To hide a few elements. UserSettings.All.RecorderThinMode = true; //Reposition the window to the lower right corner. var screen = ScreenHelper.GetScreen(this); //Lower Right corner. Left = screen.WorkingArea.Width / _scale - Width; Top = screen.WorkingArea.Height / _scale - Height; }
public override void Initialize() { base.Initialize(); _scaleFactor = ScreenHelper.GetScale(); timeCounterWheelEntity.Scale = _scaleFactor; timeCounterWheelEntity.Position = new Vector2(YnG.Width / 2 - timeCounterWheelEntity.ScaledWidth / 2 + (timeCounterWheelEntity.Origin.X * timeCounterWheelEntity.Scale.X), ScreenHelper.GetScaleY(-70)); timeCounterNeedleEntity.Scale = _scaleFactor; timeCounterNeedleEntity.Position = new Vector2(YnG.Width / 2 - timeCounterNeedleEntity.ScaledWidth / 2, 0); timeText.Scale *= _scaleFactor; timeText.Position = new Vector2(YnG.Width / 2 - timeText.ScaledWidth / 2, timeCounterNeedleEntity.ScaledHeight + ScreenHelper.GetScaleY(10)); scoreCounterEntity.Scale = _scaleFactor; scoreCounterEntity.Position = new Vector2(0, ScreenHelper.GetScaleY(15)); scoreText.Scale *= _scaleFactor; scoreText.Position = new Vector2(scoreCounterEntity.ScaledWidth + ScreenHelper.GetScaleX(10), scoreCounterEntity.Y + scoreCounterEntity.ScaledHeight / 2 - scoreText.ScaledHeight / 2); itemsCounterEntity.Scale = _scaleFactor; itemsCounterEntity.Position = new Vector2(0, scoreCounterEntity.Y + scoreCounterEntity.ScaledHeight); itemsCounter.Scale *= _scaleFactor; itemsCounter.Position = new Vector2(itemsCounterEntity.ScaledWidth + ScreenHelper.GetScaleX(10), itemsCounterEntity.Y + itemsCounterEntity.ScaledHeight / 2 - scoreText.ScaledHeight / 2); bottomBar.Rectangle = new Rectangle(0, (int)(YnG.Height - bottomBar.ScaledHeight), YnG.Width, bottomBar.Height); bottomLogo.Position = new Vector2(YnG.Width / 2 - bottomLogo.ScaledWidth / 2, YnG.Height - bottomLogo.ScaledHeight); }
///*********************************************************************************** /// <summary> /// Load the top, left, width, and height of the window from the registry, use default /// application parameters if not present in registry. This should be called from /// OnLayout; it takes effect in the first call AFTER EndInit. /// </summary> ///*********************************************************************************** public void LoadWindowPosition() { if (m_fInInit) { return; } if (m_fHaveLoadedPosition) { return; } m_fHaveLoadedPosition = true; CheckDisposed(); RegistryKey key = SettingsKey; int iLeft = (int)key.GetValue(Parent.GetType().Name + "Left", (Parent is Form ? ((Form)Parent).DesktopBounds.Left : Parent.Left)); int iTop = (int)key.GetValue(Parent.GetType().Name + "Top", (Parent is Form ? ((Form)Parent).DesktopBounds.Top : Parent.Top)); int iWidth = (int)key.GetValue(Parent.GetType().Name + "Width", (Parent is Form ? ((Form)Parent).DesktopBounds.Width : Parent.Width)); int iHeight = (int)key.GetValue(Parent.GetType().Name + "Height", (Parent is Form ? ((Form)Parent).DesktopBounds.Height : Parent.Height)); var rect = new Rectangle(iLeft, iTop, iWidth, iHeight); var parentForm = Parent as Form; if (parentForm != null) { ScreenHelper.EnsureVisibleRect(ref rect); if (rect != parentForm.DesktopBounds) { // this means we loaded values from the registry - or the form is to big parentForm.StartPosition = FormStartPosition.Manual; } parentForm.DesktopLocation = new Point(rect.X, rect.Y); // we can't set the width and height on the form yet - if we do it won't // resize our child controls m_normalLeft = rect.X; m_normalTop = rect.Y; parentForm.Width = m_normalWidth = rect.Width; parentForm.Height = m_normalHeight = rect.Height; parentForm.WindowState = (FormWindowState)SettingsKey.GetValue( parentForm.GetType().Name + sWindowState, parentForm.WindowState); } else { // Set parent dimensions based upon possible adjustments in EnsureVisibleRect Parent.Top = rect.Top; Parent.Left = rect.Left; Parent.Width = rect.Width; Parent.Height = rect.Height; } }
public static void Init(Activity activity) { if (_HingeService == null) { _mainActivity = activity; return; } if (activity == _mainActivity && _HingeService._helper != null) { _HingeService?.Update(); return; } if (_mainActivity is IDeviceInfoProvider oldDeviceInfoProvider) { oldDeviceInfoProvider.ConfigurationChanged -= _HingeService.ConfigurationChanged; } _mainActivity = activity; if (_mainActivity == null) { return; } bool isDuo = _HingeService._isDuo = ScreenHelper.IsDualScreenDevice(_mainActivity); if (!isDuo) { if (_mainActivity is IDeviceInfoProvider infoProvider) { infoProvider.ConfigurationChanged += _HingeService.ConfigurationChanged; } return; } var screenHelper = _HingeService._helper ?? new ScreenHelper(); isDuo = screenHelper.Initialize(_mainActivity); _HingeService._isDuo = isDuo; if (!isDuo) { _HingeService._helper = null; _HingeService.SetupHingeSensors(null); return; } _HingeService._helper = screenHelper; _HingeService.SetupHingeSensors(_mainActivity); if (_mainActivity is IDeviceInfoProvider newDeviceInfoProvider) { newDeviceInfoProvider.ConfigurationChanged += _HingeService.ConfigurationChanged; } _HingeService?.Update(); }
private bool OnScreenEdge() { if (enemyTransform.position.x < ScreenHelper.ScreenBounds().x&& enemyTransform.position.x > -ScreenHelper.ScreenBounds().x) { return(false); } return(true); }
private void OnGUI() { if (_dragging) { var rect = ScreenHelper.GetScreenRect(_mousePos, Input.mousePosition); ScreenHelper.DrawScreenRectBorder(rect, 1.0f, Color.green); } }
private void OnGUI() { if (isDragging) { //GUI.DrawTexture(selectBox, boxTex); ScreenHelper.DrawScreenRectBorder(selectBox, 1f, Color.green); } }
public void Awake() { _instance = this; if (cam == null) cam = Camera.main; Vector2 min = cam.ScreenToWorldPoint(Vector3.zero); Vector2 max = cam.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0f)); _rect = Rect.MinMaxRect(min.x - border, min.y - border, max.x + border, max.y + border); }
static FontImage() { DefaultFontFamily = "Segoe UI Symbol"; DefaultBrush = Brushes.Black; var dpi = ScreenHelper.GetDpi().Width; RenderingEmSize = dpi / 96d; }
private void OnGUI() { if (isDragging) { var rect = ScreenHelper.GetScreenRect(mousePosition, Input.mousePosition); ScreenHelper.DrawScreenRect(rect, new Color(0.8f, 0.8f, 0.95f, 0.1f)); ScreenHelper.DrawScreenRectBorder(rect, 1, Color.blue); } }
private void OnGUI() { if (isDragging) { MouseUpPos = Input.mousePosition; draggedRect = ScreenHelper.GetScreenRect(MouseDownPos, MouseUpPos); ScreenHelper.DrawScreenRect(draggedRect, Color.red); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here ScreenHelper.Initialize(graphics, GraphicsDevice); screenManager = new ScreenManager(this); Components.Add(screenManager); base.Initialize(); }
public void TakeScreenIfFailed() { var res = TestContext.CurrentContext.Result.Outcome; if (res.Equals(ResultState.Failure) || res.Equals(ResultState.Error)) { ScreenHelper.SaveScreenshot(TakeScreen()); } }
/* When The player clicks start to draw a rectangle for selection. * Any narmies that were selected get set as selected. * * Any larmies that were selected get targeted by order of which is closest * (LamaniteTargeter has a method for this) */ void OnGUI() { if (isDragging) { var rect = ScreenHelper.GetScreenRect(mousePosition, Input.mousePosition); ScreenHelper.DrawScreenRect(rect, new Color(.8f, .8f, .95f, .1f)); ScreenHelper.DrawScreenRectBorder(rect, 1, Color.red); } }