Ejemplo n.º 1
0
 /// <summary>
 /// Registers a new Direct Input device, initiating the data structures associated to it
 /// </summary>
 /// <param name="guid"></param>
 public static void AddDirectInputDevice(Guid guid)
 {
     if (!PressedButtons.ContainsKey(guid))
     {
         pressedButtons.Add(guid, new bool[256]);
         pressedDpad.Add(guid, new int[4]);
         directInputAxis.Add(guid, new int[8]);
     }
 }
 protected void UpdateButtonState(GamepadButtons button, bool isDown)
 {
     if (isDown && !DownButtons.Contains(button))
     {
         PressedButtons.Add(button);
         DownButtons.Add(button);
     }
     else if (!isDown && DownButtons.Contains(button))
     {
         ReleasedButtons.Add(button);
         DownButtons.Remove(button);
     }
 }
Ejemplo n.º 3
0
        public PlayerS(Texture2D txt, World _world) : base(txt)
        {
            buttons = new PressedButtons();
            nearobj = new List <ObjectS>();
            texture = txt;
            _Size   = new Vector2(0.5f, 0.5f);
            //_SizeZ = new Vector2(0.5f, 0.5f);
            speed_rotation = 4f;
            origin         = new Vector2(texture.Width / 2, texture.Height / 2);
            //пересчетать для плеера на 512х512 и поменять его размер
            body = BodyConstructor.CreateBody(TipTela.Player_1, _world, null, 1f);

            RandPos();
        }
Ejemplo n.º 4
0
	bool BlockDefinitionSpecialTableInterface_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
		{

		String NewDefaultNameID = m_DataBase.GetCommonDataSet (String.Format
							("Select NameID from PageDefinitions where ID = '{0}'",
							 m_SelectedPageID)).Tables ["PageDefinitions"].Rows [0] ["NameID"].ToString ();
		String ModifyCommand = String.Format ("Update BlockDefinitions set PageID = '{0}', NameID = '{1}', "
									+ "BlockType = 'Text', BlockPlayingOrder = 1, "
									+ "MinPositionLeft = 25, MaxPositionRight = 75, "
									+ "MinPositionTop = 25, MaxPositionBottom = 75, "
									+ "BlockRotation = 0 "
									+ " where ID = '{2}'",
											  m_SelectedPageID, NewDefaultNameID, ProcessingID);
		m_DataBase.RunSQLBatch (ModifyCommand);
		return true;
		}
Ejemplo n.º 5
0
	bool FrameAdministrationInterface_ProcessGetSelectedCall (PressedButtons PressedButton, string ProcessingID)
		{
//		throw new NotImplementedException ();
		return true;
		}
Ejemplo n.º 6
0
	bool CommonContentSpecialTableInterface_ProcessGetSelectedCall (PressedButtons PressedButton, string ProcessingID)
		{
		return true;
		}
Ejemplo n.º 7
0
	bool CommonContentSpecialTableInterface_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
		{
		String ModifyCommand = String.Format ("Update FrameContent set TableID = '{0}' where ID = '{1}'",
											  m_SelectedTableID, ProcessingID);
		String ReturnMessage = m_DataBase.RunSQLBatch (ModifyCommand);
		return true;
		}
Ejemplo n.º 8
0
	bool PictureDefinitionSpecialTableInterface_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
		{
		String NewDefaultNameID = m_DataBase.GetCommonDataSet (String.Format
								("Select NameID from PageDefinitions where ID = '{0}'",
								 m_SelectedPageID)).Tables ["PageDefinitions"].Rows [0] ["NameID"].ToString () + "BackGround";
		String ModifyCommand = String.Format ("Update PictureDefinitions set PageID = '{0}', NameID = '{1}', "
							+ "FileName = '$$LayoutGrouping\\BackGround.jpg', Transparency = 100, "
							+ "PositionLeft = 0, PositionTop = 0, PositionRight = 100, PositionBottom = 100 where ID = '{2}'",
											  m_SelectedPageID, NewDefaultNameID, ProcessingID);
		m_DataBase.RunSQLBatch (ModifyCommand);
		return true;
		}
Ejemplo n.º 9
0
	bool PictureDefinitionSpecialTableInterface_ProcessSelectableModifiedCall (PressedButtons PressedButton, string ProcessingID)
		{
		DataSet ModifiedPictureDataSet = m_DataBase.GetCommonDataSet ("Select * from PictureDefinitions where ID = '"
																	  + ProcessingID + "'");
		if ((ModifiedPictureDataSet.Tables.Count != 1)
			|| (ModifiedPictureDataSet.Tables ["PictureDefinitions"].Rows.Count != 1))
			throw new Exception ("PictureDefinitionSpecialTableInterface_ProcessSelectableModifiedCall Fehler");
		bool ModifyNecessary = false;
		DataRow PictureRow = ModifiedPictureDataSet.Tables ["PictureDefinitions"].Rows [0];

		if ((PictureRow ["FileName"] == Convert.DBNull)
			|| (String.IsNullOrEmpty (PictureRow ["FileName"].ToString ())))
			{
			PictureRow ["FileName"] = "$$" + CommonValues.XML_AUTO_CONTENT_LAYOUT_GROUPING + "\\"
									  + PictureRow ["NameID"].ToString () + "_*_*.jpg";
			ModifyNecessary = true;
			}
		if ((PictureRow ["Transparency"] == Convert.DBNull)
			|| (Convert.ToDouble (PictureRow ["Transparency"]) < 0)
			|| (Convert.ToDouble (PictureRow ["Transparency"]) > 100))
			{
			PictureRow ["Transparency"] = 100;
			ModifyNecessary = true;
			}

		if (PictureRow ["PositionLeft"] == Convert.DBNull)
			{
			PictureRow ["PositionLeft"] = 0;
			ModifyNecessary = true;
			}
		if (PictureRow ["PositionRight"] == Convert.DBNull)
			{
			PictureRow ["PositionRight"] = 100;
			ModifyNecessary = true;
			}
		if (PictureRow ["PositionTop"] == Convert.DBNull)
			{
			PictureRow ["PositionTop"] = 0;
			ModifyNecessary = true;
			}
		if (PictureRow ["PositionBottom"] == Convert.DBNull)
			{
			PictureRow ["PositionBottom"] = 100;
			ModifyNecessary = true;
			}

		if (ModifyNecessary == true)
			m_DataBase.SetCommonDataSet (ModifiedPictureDataSet);
		return true;
		}
Ejemplo n.º 10
0
	bool TableSpecialTableInterface_ProcessGetSelectedCall (PressedButtons PressedButton, string ProcessingID)
		{
		m_SelectedTableID = ProcessingID;
		return true;
		}
Ejemplo n.º 11
0
 public ReplayMouseState(Vector2 position, IEnumerable <MouseButton> list)
 {
     Position = position;
     list.ForEach(b => PressedButtons.Add(b));
 }
Ejemplo n.º 12
0
		bool SelectionWindow_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
			{
			if (PressedButton == PressedButtons.SelectableCreated)
				{
				String UpdateStatement = "Update Aktivitaeten set ";
				}

			return true;
			}
 protected void ClearButtonStates()
 {
     PressedButtons.Clear();
     ReleasedButtons.Clear();
 }
Ejemplo n.º 14
0
	bool BlockDefinitionSpecialTableInterface_ProcessGetSelectedCall (PressedButtons PressedButton, string ProcessingID)
		{
		m_SelectedBlockID = ProcessingID;
		return true;
		}
Ejemplo n.º 15
0
	bool PageDefinitionSpecialTableInterface_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
		{
		String ModifyCommand = String.Format ("Update PageDefinitions set TableID = '{0}' where ID = '{1}'",
											  m_SelectedTableID, ProcessingID);
		m_DataBase.RunSQLBatch (ModifyCommand);
		return true;
		}
Ejemplo n.º 16
0
	bool TextDefinitionSpecialTableInterface_ProcessSelectableCreatedCall (PressedButtons PressedButton, string ProcessingID)
		{
		String NewDefaultNameID = m_DataBase.GetCommonDataSet (String.Format
							("Select NameID from BlockDefinitions where ID = '{0}'",
							 m_SelectedBlockID)).Tables ["BlockDefinitions"].Rows [0] ["NameID"].ToString ();

		String ModifyCommand = String.Format ("Update TextDefinitions set PageID = '{0}', BlockID = '{1}', NameID = '{2}', "
											+ "Text = 'TestText', FontDescription = 'DINx', FontStyle = 'Bold', "
											+ "FontColor = 'white', FontSize = 5, "
											+ "FontRotation = 0 "
											+ "where ID = '{3}'",
											  m_SelectedPageID, m_SelectedBlockID, NewDefaultNameID, ProcessingID);
		m_DataBase.RunSQLBatch (ModifyCommand);
		return true;
		}
Ejemplo n.º 17
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            Clear();

            MouseState state = Mouse.GetState();

            DeltaX = 0;
            DeltaY = 0;

            if (X != state.X || Y != state.Y)
            {
                HasMoved = true;

                DeltaX = X;
                DeltaY = Y;

                X = state.X;
                Y = state.Y;

                DeltaX = X - DeltaX;
                DeltaY = Y - DeltaY;
            }

            var pressedButtons = new List <MouseButtons>();

            if (state.LeftButton == ButtonState.Pressed)
            {
                pressedButtons.Add(MouseButtons.Left);
                LeftButton = true;
            }
            if (state.MiddleButton == ButtonState.Pressed)
            {
                pressedButtons.Add(MouseButtons.Middle);
                MiddleButton = true;
            }
            if (state.RightButton == ButtonState.Pressed)
            {
                pressedButtons.Add(MouseButtons.Right);
                RightButton = true;
            }

            foreach (IPressedButton pressedButton in new List <IPressedButton>(PressedButtons))
            {
                bool isPressed = false;
                foreach (MouseButtons pb in pressedButtons)
                {
                    if (pb == pressedButton.Button)
                    {
                        isPressed = true;
                    }
                }

                if (!isPressed)
                {
                    PressedButtons.Remove(pressedButton);
                    ReleasedButtons.Add(pressedButton);
                }
            }

            foreach (MouseButtons button in pressedButtons)
            {
                bool isAlreadyPressed = false;

                foreach (PressedButton pressedButton in PressedButtons)
                {
                    if (button == pressedButton.Button)
                    {
                        isAlreadyPressed = true;
                    }
                }

                if (!isAlreadyPressed)
                {
                    PressedButtons.Add(new PressedButton(new Point(X, Y), button, gameTime.TotalGameTime.Seconds));
                    ClickedButtons.Add(button);

                    switch (button)
                    {
                    case MouseButtons.Left:
                        if ((LastTimeClicked[0].Time + SecondsToDoubleClick) >= gameTime.TotalGameTime.TotalSeconds)
                        {
                            DoubleClickedButtons.Add(new DoubleClickedButton(LastTimeClicked[0].Position, new Point(X, Y), MouseButtons.Left));
                            LastTimeClicked[0] = ClickedButton.Negative;
                        }
                        else
                        {
                            LastTimeClicked[0] = new ClickedButton(new Point(X, Y), gameTime.TotalGameTime.TotalSeconds);
                        }

                        break;

                    case MouseButtons.Middle:
                        if ((LastTimeClicked[1].Time + SecondsToDoubleClick) >= gameTime.TotalGameTime.TotalSeconds)
                        {
                            DoubleClickedButtons.Add(new DoubleClickedButton(LastTimeClicked[1].Position, new Point(X, Y), MouseButtons.Middle));
                            LastTimeClicked[1] = ClickedButton.Negative;
                        }
                        else
                        {
                            LastTimeClicked[1] = new ClickedButton(new Point(X, Y), gameTime.TotalGameTime.TotalSeconds);
                        }

                        break;

                    case MouseButtons.Right:
                        if ((LastTimeClicked[2].Time + SecondsToDoubleClick) >= gameTime.TotalGameTime.TotalSeconds)
                        {
                            DoubleClickedButtons.Add(new DoubleClickedButton(LastTimeClicked[2].Position, new Point(X, Y), MouseButtons.Right));
                            LastTimeClicked[2] = ClickedButton.Negative;
                        }
                        else
                        {
                            LastTimeClicked[2] = new ClickedButton(new Point(X, Y), gameTime.TotalGameTime.TotalSeconds);
                        }

                        break;
                    }
                }
            }

            DeltaScroll = state.ScrollWheelValue - ScrollValue;
            if (ScrollValue != state.ScrollWheelValue)
            {
                HasScrolled = true;
                ScrollValue = state.ScrollWheelValue;
            }
        }