コード例 #1
0
 /// <summary>
 /// Handles the Resized event of the <see cref="GameBase.RenderWindow"/>.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SFML.Window.SizeEventArgs"/> instance containing the event data.</param>
 void rw_Resized(object sender, SizeEventArgs e)
 {
     if (Resized != null)
     {
         Resized.Raise(this, e);
     }
 }
コード例 #2
0
 public void Resize(int width, int height)
 {
     Width  = width;
     Height = height;
     OnResize(width, height);
     Resized.Raise(this, EventArgs.Empty);
 }
コード例 #3
0
ファイル: Entity.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Sets the <see cref="Entity"/>'s <see cref="Size"/> directly without any chance to be overridden.
        /// This should only be used for synchronization.
        /// </summary>
        /// <param name="newSize">The new <see cref="Size"/> value.</param>
        protected internal void SetSizeRaw(Vector2 newSize)
        {
            if (newSize == Size)
            {
                return;
            }

            var oldSize = Size;

            _size = newSize;

            // Notify listeners
            OnResized(oldSize);
            if (Resized != null)
            {
                Resized.Raise(this, EventArgsHelper.Create(oldSize));
            }
        }
コード例 #4
0
        /// <summary>
        /// Updates the <see cref="MapGrh"/>.
        /// </summary>
        /// <param name="currentTime">Current game time.</param>
        public virtual void Update(TickCount currentTime)
        {
            Grh.Update(currentTime);

            Vector2 grhSize = Grh.Size;
            Vector2 previousScaledGrhSizeCache = _scaledGrhSizeCache;

            Vector2.Multiply(ref _scale, ref grhSize, out _scaledGrhSizeCache);

            // Check if the scaled size has changed, but we have not updated the cache. The most common ways for this to happen is if the GrhData changes, or the
            // Grh is animated but not all frames are the same size.
            if (_scaledGrhSizeCache != previousScaledGrhSizeCache)
            {
                if (Resized != null)
                {
                    Resized.Raise(this, EventArgsHelper.Create(previousScaledGrhSizeCache));
                }
            }
        }