/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (ShouldClose) { Exit(); } KeyHelper.Update(); RenderHandler.Update(); MouseHandler.Update(); if (KeyHelper.CheckTap(Keys.OemTilde)) { DialogueHandler.Start(TestHelper.GetTestDialogues()); } if (KeyHelper.CheckTap(Keys.D3)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new Flight()); } if (KeyHelper.CheckTap(Keys.D2)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new RegularHealingPotion()); } if (KeyHelper.CheckTap(Keys.D1)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new RegularSpeedPotion()); } if (KeyHelper.CheckHeld(Keys.D0)) { PlayerManager.Health--; } GameTimeMilliseconds = gameTime.ElapsedGameTime.TotalMilliseconds; GameTimeSeconds = gameTime.ElapsedGameTime.TotalSeconds; base.Update(gameTime); }
public DraftingSystem(LD34Game game, SpriteBatch spriteBatch, MouseHandler mouse, WindowControl window, ContentManager content) { this.game = game; this.spriteBatch = spriteBatch; this.mouse = mouse; this.window = window; this.content = content; random = new Random(); cards = new CardCreator[] { (ContentManager contentManager, EntityWorld world) => new GolemCard(content, world), (ContentManager contentManager, EntityWorld world) => new ImpCard(content), (ContentManager contentManager, EntityWorld world) => new ImpLordCard(content, world), (ContentManager contentManager, EntityWorld world) => new ManaGolem(content, world), (ContentManager contentManager, EntityWorld world) => new DemonFuryCard(), (ContentManager contentManager, EntityWorld world) => new DisenchantCard(), (ContentManager contentManager, EntityWorld world) => new FireballCard(), (ContentManager contentManager, EntityWorld world) => new SanctuaryCard(), (ContentManager contentManager, EntityWorld world) => new StatueCard(content, world), (ContentManager contentManager, EntityWorld world) => new ChargeCard(), (ContentManager contentManager, EntityWorld world) => new StormCard(), (ContentManager contentManager, EntityWorld world) => new BlinkCard(), (ContentManager contentManager, EntityWorld world) => new HawkCard(content), (ContentManager contentManager, EntityWorld world) => new BearCard(content), (ContentManager contentManager, EntityWorld world) => new SwordsmanCard(content), (ContentManager contentManager, EntityWorld world) => new ShieldsmanCard(content), (ContentManager contentManager, EntityWorld world) => new ImpBallCard(content), (ContentManager contentManager, EntityWorld world) => new LionCard(content, world), }; deck = new List <Entity>(); choices = new Entity[2]; discarded = new List <Entity>(); // Load content. cardSelection = content.Load <SoundEffect>("SoundEffects/card_opening"); help3 = content.Load <Texture2D>("Textures/help3"); }
/// <inheritdoc /> protected override void OnEnable() { base.OnEnable(); Debug.LogWarning("[TouchScript] MouseInput is deprecated! Please use StandardInput instead."); if (DisableOnMobilePlatforms) { switch (Application.platform) { case RuntimePlatform.Android: case RuntimePlatform.IPhonePlayer: case RuntimePlatform.WP8Player: case RuntimePlatform.MetroPlayerARM: case RuntimePlatform.MetroPlayerX64: case RuntimePlatform.MetroPlayerX86: case RuntimePlatform.TizenPlayer: case RuntimePlatform.BlackBerryPlayer: // don't need mouse here enabled = false; return; } } mouseHandler = new MouseHandler(Tags, beginTouch, moveTouch, endTouch, cancelTouch); }
public TrueCraftGame(MultiplayerClient client, IPEndPoint endPoint) { Window.Title = "TrueCraft"; Content.RootDirectory = "Content"; Graphics = new GraphicsDeviceManager(this); Graphics.SynchronizeWithVerticalRetrace = false; Graphics.IsFullScreen = UserSettings.Local.IsFullscreen; Graphics.PreferredBackBufferWidth = UserSettings.Local.WindowResolution.Width; Graphics.PreferredBackBufferHeight = UserSettings.Local.WindowResolution.Height; Graphics.ApplyChanges(); Window.ClientSizeChanged += Window_ClientSizeChanged; Client = client; EndPoint = endPoint; LastPhysicsUpdate = DateTime.MinValue; NextPhysicsUpdate = DateTime.MinValue; PendingMainThreadActions = new ConcurrentBag<Action>(); MouseCaptured = true; Bobbing = 0; KeyboardComponent = new KeyboardHandler(this); Components.Add(KeyboardComponent); MouseComponent = new MouseHandler(this); Components.Add(MouseComponent); GamePadComponent = new GamePadHandler(this); Components.Add(GamePadComponent); }
//private void UpdateUI(int x, int y) //{ // // Unhide the GazePointer if you want to see your gaze point // if (GazePointer.Visibility == Visibility.Visible) // { // var relativePt = new System.Windows.Point(x, y); // relativePt = transfrm.Transform(relativePt); // Canvas.SetLeft(GazePointer, relativePt.X - GazePointer.Width / 2); // Canvas.SetTop(GazePointer, relativePt.Y - GazePointer.Height / 2); // } //} private void CheckClick(int x, int y, double buttonHeight, double buttonWidth) { var newVarW = 200; //var newVarH = 200; // Verificando opções de rolagem de tela. //if ((y > buttonHeight) && (y < buttonHeight + newVarH) && (x < buttonWidth + newVarW) && (x > buttonWidth)) if ((x < buttonWidth + newVarW) && (x > buttonWidth)) { if (!CONTROLE) { Dispatcher.BeginInvoke(new Action(() => buttonSelect.Fill = new SolidColorBrush(System.Windows.Media.Colors.LightGreen))); Dispatcher.BeginInvoke(new Action(() => MouseHandler.doClick(x, y))); CONTROLE = true; } } else { if (CONTROLE) { Dispatcher.BeginInvoke(new Action(() => buttonSelect.Fill = new SolidColorBrush(System.Windows.Media.Colors.DarkGray))); timer.Start(); } } }
/// <inheritdoc /> protected override void OnDisable() { mouseHandler.Dispose(); mouseHandler = null; base.OnDisable(); }
public SpecialPastePopupViewModel(Workspace workspace, Options options, MouseHandler mouseHandler) : base(workspace, options, mouseHandler) { _workspace = workspace; TitleVisible = true; HideInputAtStartup = false; Title = "Paste from Clipboard"; }
public Ground(int heigth, int width, int number, MouseHandler mouseHandler) { MapWidth = width; MapHeight = heigth; Map = new GroundItem[width, heigth]; while (number != 0) { Random a = new Random(); int k = a.Next(heigth * width); if (Map[k % width, k / width] == null) { Map[k % width, k / width] = new Mine(new Point(k % width, k / width)); number--; } } for (int i = 0; i < width; i++) { for (int j = 0; j < heigth; j++) { if (Map[i, j] == null) { Map[i, j] = new Cell(new Point(i, j)); } } } }
internal void CheckMarket() { string imgPath = $"{_imgDirPath}{_imgMarket}"; string word = string.Empty; Console.WriteLine("-> Starting to check the market..."); if (!File.Exists(imgPath)) { ConsoleWriter.WriteLineWarning($"Cannot find file {imgPath}. Phase skipped."); Thread.Sleep(500); return; } WindowHandler.RepositionRaidWindow(raidProcessId); MouseHandler.SetCursorPosition(0, 0); Bitmap bitmapTemoin = new Bitmap(imgPath); Bitmap bitmapTest = ImgHandler.GetBitmap(_recMarket); if (!ImgHandler.AreBitmapsDifferent(bitmapTemoin, bitmapTest, RaidOptions.SavePicturesAllowed)) { ConsoleWriter.WriteLineInformation("Update detected. Let's go and search for shards !"); Console.WriteLine("Maybe later..."); //MouseHandler.MouseClick(1161, 515); Thread.Sleep(800); } else { Console.WriteLine("No update detected."); Thread.Sleep(100); } }
private void Cleanup() { if (IsConnected) { Win32.ShowSystemCursor(); } else if (mouseHandler != null) { mouseHandler.Dispose(); mouseHandler = null; } disposed = true; if (serviceClient != null) { if (IsConnected) { serviceClient.UnregisterApplication(); } if (serviceClient.State == CommunicationState.Opened) { serviceClient.Close(); } serviceClient = null; } }
private void enableMouse() { mouseHandler = new MouseHandler(addPointer, updatePointer, pressPointer, releasePointer, removePointer, cancelPointer); mouseHandler.EmulateSecondMousePointer = emulateSecondMousePointer; //Debug.Log("[TouchScript] Initialized Unity mouse input."); }
private void Awake() { playerMovement = GetComponent <PlayerMovement>(); timeController = GetComponent <TimeController>(); mouseHandler = GetComponent <MouseHandler>(); animController = GetComponent <Animator>(); }
/// <summary>Move the mouse to the center of an image in the screen</summary> /// <param name="image">rect image object</param> /// <param name="isRelative">If isRelativeis set to True, it will move the cursor starting from its current positions and not /// from the beginning of the screen </param> public static bool Move(Rect image, bool isRelative = false) { MouseHandler handler = new MouseHandler(); Point currenPosition = Position(); if (isRelative) { handler.Move(Center(image)); } else { handler.MoveTo(new List <Point>() { currenPosition, Center(image) }); } Point lastPosition = Position(); if (currenPosition.X == lastPosition.X && currenPosition.Y == lastPosition.Y) { return(false); } return(true); }
private static int GlobalHookCallback(HookType Type, int code, IntPtr wParam, IntPtr lParam) { switch (Type) { case HookType.WH_KEYBOARD_LL: { if (!KeyboardHandler.Dispatch(code, wParam, lParam)) { return(1); } break; } case HookType.WH_MOUSE_LL: { if (!MouseHandler.Dispatch(code, wParam, lParam)) { return(1); } break; } default: break; } return(User32.CallNextHookEx(IntPtr.Zero, code, wParam, lParam)); }
/// <summary>Look for and image at the given path and move the cursor at the center of the image</summary> /// <param name="path">Path of the image</param> /// <param name="region">Region of the screen to look for the image, for more details look for ScreenRegions class</param> /// <param name="isRelative">If isRelativeis set to True, it will move the cursor starting from its current positions and not /// from the beginning of the screen </param> public static bool Move(string path, Rect region, bool isRelative = false) { MouseHandler handler = new MouseHandler(); Rect image = Image.Find(path, region: region); if (image == null) { return(false); } Point currenPosition = Position(); if (isRelative) { handler.Move(Center(image)); } else { handler.MoveTo(new List <Point>() { currenPosition, Center(image) }); } Point lastPosition = Position(); if (currenPosition.X == lastPosition.X && currenPosition.Y == lastPosition.Y) { return(false); } return(true); }
/// <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() { swappableGems = new List <Gem>(4); //recentlyMatchedGems = new List<Gem>(4); IsMouseVisible = true; graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2; // set this value to the desired width of your window graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 2; // set this value to the desired height of your window Size = graphics.PreferredBackBufferHeight / 8; graphics.ApplyChanges(); scoreIcon = Content.Load <Texture2D>("score"); square = Content.Load <Texture2D>("Sqaure"); background = Content.Load <Texture2D>("galaxy"); gemTextures[0] = Content.Load <Texture2D>("purpleicon"); gemTextures[1] = Content.Load <Texture2D>("orangeicon"); gemTextures[2] = Content.Load <Texture2D>("redicon"); gemTextures[3] = Content.Load <Texture2D>("greenicon"); gemTextures[4] = Content.Load <Texture2D>("grayicon"); gemTextures[5] = Content.Load <Texture2D>("yellowicon"); gemTextures[6] = Content.Load <Texture2D>("blueicon"); font = Content.Load <SpriteFont>("Courier New"); scoreIconRect = new Rectangle(Size * 8, 0, Size * 5, Size * 4); scoreVect = new Vector2(Size * 11, Size * 3); GameLogic.Instance.Initialze(); previousScores = FileIO.GetScores(); highScore = FileIO.HighScore; OnLeftClick += GemSelectionHandler; Window.Title = $"Bejeweled HighScore: {highScore}"; base.Initialize(); }
/// <summary>Move the mouse to a given point in the screen</summary> /// <param name="x">Horizontal coordinate to move</param> /// <param name="y">Vertical coordinate to move</param> /// <param name="isRelative">If isRelativeis set to True, it will move the cursor starting from its current positions and not /// from the beginning of the screen </param> public static bool Move(int x, int y, bool isRelative = false) { MouseHandler handler = new MouseHandler(); Point currenPosition = Position(); if (isRelative) { handler.Move(x, y); } else { handler.MoveTo(new List <Point>() { currenPosition, new Point(x, y) }); } Point lastPosition = Position(); if (currenPosition.X == lastPosition.X && currenPosition.Y == lastPosition.Y) { return(false); } return(true); }
internal void CheckMine() { string imgPath = $"{_imgDirPath}{_imgNameMine}"; Console.WriteLine("-> Starting to check the mine..."); if (!File.Exists(imgPath)) { ConsoleWriter.WriteLineWarning($"Cannot find file {imgPath}. Phase skipped."); Thread.Sleep(500); return; } WindowHandler.RepositionRaidWindow(raidProcessId); MouseHandler.SetCursorPosition(0, 0); Bitmap bitmapTemoin = new Bitmap(imgPath); Bitmap bitmapTest = ImgHandler.GetBitmap(_recMine); if (!ImgHandler.AreBitmapsDifferent(bitmapTemoin, bitmapTest, RaidOptions.SavePicturesAllowed)) { ConsoleWriter.WriteLineInformation("New gems found. Let's get them."); MouseHandler.MouseClick(823, 404); } else { Console.WriteLine("No gems found."); Thread.Sleep(100); } }
private void MainPaint_Load(object sender, EventArgs e) { settings = Settings.Initialize(); mouseHandler = MouseHandler.Initialize(); penPreview = PenPreview.Initialize(settings.Pen, PictureBoxThickness.Width, PictureBoxThickness.Height); storage = Storage.Initialize(); drawingEngine = new DrawingEngine(settings, mouseHandler, penPreview, storage); PictureBoxThickness.Image = drawingEngine.GetPenImage(); PictureBoxPaint.Image = drawingEngine.MainImage; currentProcess = Process.GetCurrentProcess(); currentProcess.Refresh(); memoryLabel.Text = "Memory usage: " + ((float)currentProcess.PrivateMemorySize64 / 1024f / 1024f).ToString("F1") + "MB"; _isLineFinished = true; _isBtnFillClicked = false; _isFigureCreated = false; _isFirstPointAdd = false; _isFigureSelected = false; this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); NumericUpDownPolygon.Value = settings.numberOfPolygonApexes; }
internal bool ShowBastion() { string battlePath = $"{_imgDirPath}{_imgNameBattle}"; if (!File.Exists(battlePath)) { ConsoleWriter.WriteLineError($"Cannot find file {battlePath}"); return(false); } MouseHandler.SetCursorPosition(0, 0); Bitmap bitmapTemoin = new Bitmap(battlePath); int c = 0; debut: WindowHandler.RepositionRaidWindow(raidProcessId); if (c > 20) { throw new Exception("Cannot find the bastion. Number of attempts failed."); } Bitmap bitmapTest = ImgHandler.GetBitmap(_recBattle); if (ImgHandler.AreBitmapsDifferent(bitmapTemoin, bitmapTest, RaidOptions.SavePicturesAllowed)) { KeyBoardHandler.SendKey(KEY_ESCAPE); Thread.Sleep(2000); c++; goto debut; } return(true); }
private int RunDungeon(int nbLoop, string dungeonName, int mouseX, int mouseY) { int compteur = 0; Console.Write($"-> Starting the {dungeonName} run "); if (nbLoop != 0) { Console.Write($"({nbLoop} run left)"); } Console.WriteLine(); Thread.Sleep(500); if (GoToDungeonMap()) { Console.WriteLine($"---> Entering the {dungeonName}..."); Thread.Sleep(500); MouseHandler.MouseClick(mouseX, mouseY); Thread.Sleep(500); compteur = AutoBattleForKeeps(nbLoop, compteur, dungeonName); } if (nbLoop != 0) { return(nbLoop - compteur); } else { return(nbLoop); } }
public void TestChangingSettingsSaves() { var handler = new MouseHandler(); var config = new TestInputConfigManager(new[] { handler }); handler.Sensitivity.Value = 5; Assert.IsTrue(config.SaveEvent.WaitOne(10000)); // wait for QueueBackgroundSave() debounce. Assert.AreEqual(1, config.TimesSaved); handler.Enabled.Value = !handler.Enabled.Value; Assert.IsTrue(config.SaveEvent.WaitOne(10000)); Assert.AreEqual(2, config.TimesSaved); handler.Reset(); Assert.IsTrue(config.SaveEvent.WaitOne(10000)); Assert.AreEqual(3, config.TimesSaved); for (int i = 0; i < 10; i++) { handler.Sensitivity.Value += 0.1; Assert.AreEqual(3, config.TimesSaved); } Assert.IsTrue(config.SaveEvent.WaitOne(10000)); Assert.AreEqual(4, config.TimesSaved); }
public override void Load() { Game.Instance.IsMouseVisible = true; mouseHandler = new MouseHandler(); GUIElements = new List <GUIElement>(); bishop = new Image(200, 200, 50, 50, 0, "Bishop", 1) { isDraggable = true }; knight = new Image(200, 350, 50, 50, 0, "Knight", 1) { isDraggable = true }; board = new Image(0, 0, 600, 600, 0, "ChessBoard", 0); GUIElements.Add(board); GUIElements.Add(bishop); GUIElements.Add(knight); TransformComponent transform = new TransformComponent(new Vector2(10, 10)); label = new Label("Teste (:", "defaultFont", Color.Crimson, transform); GUIElements.Add(label); mouseHandler.Click += new MouseHandler.MouseClickHandler(HandleClick); mouseHandler.Hover += new MouseHandler.MouseClickHandler(HandleHover); mouseHandler.Drag += new MouseHandler.MouseDragHandler(HandleDrag); }
private void btnSetCursorPos_Click(object sender, EventArgs e) { int x = int.Parse(this.txtCursorPosX.Text.Trim()); int y = int.Parse(this.txtCursorPosY.Text.Trim()); MouseHandler.SetCursorPos(x, y); MouseHandler.MouseClick(); }
public InputSystem() { Keyboard = new KeyboardHandler(); GamePad = new GamePadHandler(); Mouse = new MouseHandler(); _pressedDirectionDelay = FULL_PRESSED_DIRECTION_DELAY; }
public Root() { var mouseHandler = new MouseHandler(); RegisterService <IMouseEvents>(mouseHandler); RegisterService <IMouseWheel>(mouseHandler); RegisterService <ILayout>(new PassDownChildrenLayout()); }
public SearchPopupViewModel(Workspace workspace, Options options, MouseHandler mouseHandler, DoSearchCommand searchCommand) : base(workspace, options, mouseHandler) { _searchCommand = searchCommand; TitleVisible = true; Title = "Search"; HideInputAtStartup = false; SetHeaderIconByKey("appbar_magnify"); }
private void OnLoadInternal(object sender, EventArgs e) { var window = (GameWindow)sender; KeyboardHandler.Init(window); MouseHandler.Init(window); OnLoad(); }
private void disableMouse() { if (mouseHandler != null) { mouseHandler.Dispose(); mouseHandler = null; } }
protected PopupViewModel(Workspace workspace, Options options, MouseHandler mouseHandler) { Workspace = workspace; Options = options; MouseHandler = mouseHandler; TitleVisible = Options.PopupTitleVisible; _hideInputAtStartup = true; }
private ProcessHandler(IntPtr foregroundHWnd, IntPtr windowRectHWnd, IntPtr screenshotHWnd, IntPtr keyboardHWnd, IntPtr mouseHWnd) { _foreground = new ForegroundHandler(foregroundHWnd); _windowRect = new WindowRectHandler(windowRectHWnd); _screenshot = new ScreenshotHandler(screenshotHWnd); _keyboard = new KeyboardHandler(keyboardHWnd); _mouse = new MouseHandler(mouseHWnd); }
/// <summary> /// Self-generating singleton. /// </summary> public static MouseHandler GetInstance() { if (instance == null) { instance = new GameObject("MouseHandler").AddComponent<MouseHandler>(); instance.Init(); } return instance; }
public Form1() { InitializeComponent(); this.PictureBoxHeight = pictureBox1.Height; this.PictureBoxWidth = pictureBox1.Width; this.pictureBoxTheseus.Image = this.theseus; this.pictureBoxMinotaur.Image = this.minotaur; myMouseHandler = new MouseHandler(); drawer = new Drawer(); mapBuilder = new MapBuilder(); }
public Control(String name, Rectangle area) { this.name = name; Area = area; LPress += new MouseHandler(OnMouseLeftPress); LRelease += new MouseHandler(OnMouseLeftRelease); RPress += new MouseHandler(OnMouseRightPress); RRelease += new MouseHandler(OnMouseRightRelease); Move += new MouseHandler(OnMouseMove); }
public override void LoadContent() { Viewport vp = manager.UI.GraphicsDevice.Viewport; cgList.Add(menu); cgList.Add(gc); cgList.Add(wc); cgList.Add(cc); cgList.Add(ac); SetupMenu(vp); SetupGC(vp); SetupWC(vp); SetupCC(vp); SetupAC(vp); lClick = new MouseHandler(OnLClick); rClick = new MouseHandler(OnRClick); }
public void Update(KeyboardHandler keyboardHandler, MouseHandler mouseHandler) { if (keyboardHandler.KeyPressed(Keys.W)) { _currentIndex -= 1; } if (keyboardHandler.KeyPressed(Keys.X)) { _currentIndex += 1; } if (keyboardHandler.KeyPressed(Keys.Enter)) { _thresholdGame.Log(_menuOptions[_currentIndex]); if (_currentIndex == 2) { _thresholdGame.Exit(); } } if (_currentIndex < 0) _currentIndex = _menuOptions.Count - 1; if (_currentIndex >= _menuOptions.Count) _currentIndex = 0; }
internal void AddEditHandler(Keys key, MouseHandler handler) { editHandlers[key] = handler; }
void Start() { if (instance == null) { instance = this; } if (!initialized) { Init(); } }
// Use this for initialization public void Awake() { if (!Application.isEditor) { Screen.showCursor = false; } instance = this; cursorStored = false; UseDefaultCursor(); LockCursorXPosition(); }
public ToolControl(MouseHandler moveAction) { this.action = moveAction; Position = new PointD (-5, -5); }
public InterceptMouse(MouseHandler handler) { _handler = handler; _hookID = SetHook(_proc); }
protected void AddEditHandler(Keys key, MouseHandler handler) { EditHandlers[key] = (object)handler; }
public static void Initialize() { MouseMoved = true; MouseDown = new MouseHandler(DownHandler); MouseClick = new MouseHandler(ClickHandler); MousePress = new MouseHandler(PressHandler); MouseRelease = new MouseHandler(ReleaseHandler); MouseMove = new MouseHandler(MoveHandler); keysToRelease = new LinkedList<Key>(); keysToPress = new LinkedList<Key>(); mouseButtonsToRelease = new LinkedList<MouseButton>(); mouseButtonsToPress = new LinkedList<MouseButton>(); Keys = new Dictionary<Key, InputState>(); MouseButtons = new Dictionary<MouseButton, InputState>(); string[] names = Enum.GetNames(typeof(Key)); for (int i = 0; i < names.Length; ++i) { try { Keys.Add((Key)Enum.Parse(typeof(Key), names[i]), InputState.Up); } catch (Exception e) { string stupingWarnings = e.Message; } } names = Enum.GetNames(typeof(MouseButton)); for (int i = 0; i < names.Length; ++i) { try { MouseButtons.Add((MouseButton)Enum.Parse(typeof(MouseButton), names[i]), InputState.Up); } catch (Exception e) { string stupidWarnings = e.Message; } } Firefly.Window.GameWindow.Mouse.Move += new EventHandler<MouseMoveEventArgs>(OpentkMove); Firefly.Window.GameWindow.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(OpentkMouseDown); Firefly.Window.GameWindow.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(OpentkMouseUp); Firefly.Window.GameWindow.Keyboard.KeyDown += new EventHandler<KeyboardKeyEventArgs>(OpentkKeyDown); Firefly.Window.GameWindow.Keyboard.KeyUp += new EventHandler<KeyboardKeyEventArgs>(OpentkKeyUp); Firefly.Window.GameWindow.Mouse.WheelChanged += new EventHandler<MouseWheelEventArgs>(OpentkWheelChange); Firefly.Window.GameWindow.KeyPress += new EventHandler<OpenTK.KeyPressEventArgs>(OpenTKKeyPress); TypedSymbols = new Stack<char>(); }
public static void Initialize() { MouseDown = new MouseHandler( downHandler ); MouseClick = new MouseHandler( clickHandler ); MousePress = new MouseHandler( pressHandler ); MouseRelease = new MouseHandler( releaseHandler ); MouseMove = new MouseHandler( moveHandler ); keysToRelease = new LinkedList<Key>(); mouseButtonsToRelease = new LinkedList<MouseButton>(); keys = new Dictionary<Key, InputState>(); mouseButtons = new Dictionary<MouseButton, InputState>(); string[] names = Enum.GetNames( typeof( Key ) ); for ( int i = 0 ; i < names.Length ; ++i ) { try { keys.Add( (Key)Enum.Parse( typeof( Key ), names[ i ] ), InputState.Up ); } catch ( Exception e ) { string stupingWarnings = e.Message; } } names = Enum.GetNames( typeof( MouseButton ) ); for ( int i = 0 ; i < names.Length ; ++i ) { try { mouseButtons.Add( (MouseButton)Enum.Parse( typeof( MouseButton ), names[ i ] ), InputState.Up ); } catch ( Exception e ) { string stupidWarnings = e.Message; } } Firefly.Window.GameWindow.Mouse.Move += new EventHandler<MouseMoveEventArgs>( opentkMove ); Firefly.Window.GameWindow.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>( opentkMouseDown ); Firefly.Window.GameWindow.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>( opentkMouseUp ); Firefly.Window.GameWindow.Keyboard.KeyDown += new EventHandler<KeyboardKeyEventArgs>( opentkKeyDown ); Firefly.Window.GameWindow.Keyboard.KeyUp += new EventHandler<KeyboardKeyEventArgs>( opentkKeyUp ); }
internal void AddScrollHandler(Keys key, MouseHandler handler) { scrollHandlers[key] = handler; }
public ToolControl (Gdk.CursorType cursor, MouseHandler moveAction) { this.action = moveAction; Position = new PointD (-5, -5); Cursor = cursor; }
public void Update(KeyboardHandler keyboardHandler, MouseHandler mouseHandler) { if (_currentGameState != null) _currentGameState.Update(keyboardHandler, mouseHandler); }