Beispiel #1
0
        /// <summary>
        /// This method sets the eye tracking region for a N*M matrix menu, the number
        /// of icons in the list shall be N*M.
        /// </summary>
        /// <param name="cols">The number of cols of the matrix menu</param>
        /// <param name="rows">The number of rows of the matrix menu</param>
        /// <param name="icons">The list of icons</param>
        private void FreeStyle(int cols, int rows, List <MenuIcon> icons, Globals.TextureTypes menuTexture, bool scrollZone)
        {
            if (icons.Count != cols * rows)
            {
                throw new ArgumentException("Wrong amount of icons in menu");
            }
            int iconWidth  = (int)(Recellection.viewPort.Width / cols);
            int iconHeight = (int)(Recellection.viewPort.Height / rows);

            if (menuTexture != Globals.TextureTypes.NoTexture)
            {
                menuPic = Recellection.textureMap.GetTexture(menuTexture);
            }
            else
            {
                for (int i = 0; i < cols * rows; i++)
                {
                    icons[i].targetTextureRectangle = new Microsoft.Xna.Framework.Rectangle((i % cols) * iconWidth, (i / rows) * iconHeight, iconWidth, iconHeight);

                    icons[i].region = new GUIRegion(Recellection.windowHandle,
                                                    new System.Windows.Rect((i % cols) * iconWidth, (i / rows) * iconHeight, iconWidth, iconHeight));
                }
            }
            this.icons = icons;
        }
 /// <summary>
 /// This method returns the Texture2D specified by the enum
 /// Globals.TextureTypes.
 /// </summary>
 /// <param name="texture">The Globals.TextureTypes enum which
 /// specifies which Texture2D to return</param>
 /// <returns>The requested Texture2D</returns>
 public Texture2D GetTexture(Globals.TextureTypes texture)
 {
     if (loadedTextures.ContainsKey(texture))
     {
         return(loadedTextures[texture]);
     }
     return(loadedTextures[texture] = content.Load <Texture2D>("Graphics/" + texture));
 }