Beispiel #1
0
        /// <summary>
        /// Runs before any Update is called
        /// </summary>
        void Start()
        {
            // Create our global instance
            if (Reticle.Instance == null)
            {
                Reticle.DefaultIsVisible = IsVisible;
                Reticle.Instance         = this;
            }

            // Ensure we have a casting root
            if (RaycastRoot == null && Camera.main != null)
            {
                RaycastRoot = Camera.main.transform;
            }

            // Ensure the position is set
            if (_FillTexture != null)
            {
                FillTexture = _FillTexture;
            }
            if (_BGTexture != null)
            {
                BGTexture = _BGTexture;
            }

            // Initialize the material
            FillPercent = 1f;
            FillPercent = 0f;
        }
    /// <summary>
    /// If user passes usingEyeTracker, then Game will implement eye tracker filtering and logic
    /// upon mouse inputs. If false, the game defaults to reading the mouse-state normally.
    /// </summary>
    /// <param name="usingEyeTracker"></param>
    public GameViewFramework(bool usingEyeTracker)
    {
      _graphics = new GraphicsDeviceManager(this);
      this.IsMouseVisible = false;
      _graphics.PreferredBackBufferWidth = 800; // GameParameters.MAX_X;// +GameParameters.BORDER_PIXELS * 2;
      _graphics.PreferredBackBufferHeight = 480; // GameParameters.MAX_Y;// +GameParameters.TOP_BAR_PIXELS + GameParameters.BORDER_PIXELS; ;
      //_graphics.IsFullScreen = true;
      _graphics.ApplyChanges();

      this.Content.RootDirectory = "Content";
      _gameSpriteContainer = new ViewSpriteContainer();
      _textureFlyweight = new SpriteLoaderFlyweight();
      _screenDimension.X = _graphics.PreferredBackBufferWidth;
      _screenDimension.Y = _graphics.PreferredBackBufferHeight;
      _contentManagerWaitHandle = new AutoResetEvent(true);

      _reticle = new Reticle(usingEyeTracker, "Images/Reticle", _textureFlyweight);
    }