public FarseerGame() { _graphics = new GraphicsDeviceManager(this); _content = new ContentManager(Services); this.IsFixedTimeStep = true; this.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16); _graphics.SynchronizeWithVerticalRetrace = true; _graphics.PreferredBackBufferWidth = 1024; _graphics.PreferredBackBufferHeight = 768; Window.AllowUserResizing = false; Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged); //_scene = new SceneGraph(); _sceneManager = new SceneManager(); _entityManager = new EntityManager(); _keyboardInputComponent = new KeyboardInputComponent(this); _keyboardInputComponent.EscapeKeyDown += new EventHandler <KeyEventArgs>(KeyboardInputComponent_EscKeyDown); #if !XBOX _mouseInputComponent = new MouseInputComponent(this); #endif _farseerPhysicsComponent = new FarseerPhysicsComponent(this); Components.Add(_keyboardInputComponent); #if !XBOX Components.Add(_mouseInputComponent); #endif Components.Add(_farseerPhysicsComponent); }
public void Execute() { Entity e = _group.GetSingleEntity(); MouseInputComponent input = e.mouseInput; input.x = Input.mousePosition.x; input.y = Input.mousePosition.y; input.isDown = isMouseButton(); }
protected override void Process(MouseInputComponent myReferenceSingle, EntityReference <TextureComponent, TransformComponent, CursorComponent> myReferencedMany) { if (TextureCursorIsChangingTo != null) { lock (Lock) { ResourceManager.LoadInto <TextureComponent>(myReferencedMany.Component1[0], TextureCursorIsChangingTo); TextureCursorIsChangingTo = null; } } myReferencedMany.Component2[0].WorldPosition = myReferenceSingle.MousePosition; }
public void Execute() { Entity e = _group.GetSingleEntity(); MouseInputComponent component = e.mouseInput; temp.Set(component.x, component.y, 0); temp = Camera.main.ScreenToWorldPoint(temp); InputComponent input = _input.GetSingleEntity().input; input.x = temp.x; input.y = temp.y; input.isDown = component.isDown; }