Exemplo n.º 1
0
        public void Reset(bool fullscreen, int width, int height)
        {
            isSwitching = true;

            this.fullscreen = fullscreen;

            resetLastBuffer();

            screenWidth      = width;
            screenHeight     = height;
            Mouse.ShowCursor = !fullscreen;

            screen =
                Video.SetVideoMode(
                    screenWidth,
                    screenHeight,
                    false,
                    false,
                    fullscreen,
                    true,
                    !fullscreen
                    );

            Settings.Default.Fullscreen       = fullscreen;
            Settings.Default.ResolutionWidth  = width;
            Settings.Default.ResolutionHeight = height;

            scale = (short)(Math.Ceiling((float)screenWidth / (float)C64WIDTH));

            if (
                C64WIDTH * scale - screenWidth > C64BORDER * scale * 2 ||
                C64HEIGHT * scale - screenHeight > C64BORDER * scale * 2
                )
            {
                scale--;
            }

            xPos = (short)((screenWidth - C64WIDTH * scale) / 2);
            yPos = (short)((screenHeight - C64HEIGHT * scale) / 2);

            statusFont.Dispose();
            statusFont = new SdlDotNet.Graphics.Font(Resources.c64font, 15 * scale);

            fpsFont.Dispose();
            fpsFont = new SdlDotNet.Graphics.Font(Resources.c64font, 8 * scale);

            menuFont.Dispose();
            menuFont = new SdlDotNet.Graphics.Font(Resources.c64font, 12 * scale);

            statusLight.Font = statusFont;
            statusDark.Font  = statusFont;

            fpsLight.Font = fpsFont;
            fpsDark.Font  = fpsFont;

            isSwitching = false;
        }
Exemplo n.º 2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (buttonFont != null)
         {
             buttonFont.Dispose();
             buttonFont = null;
         }
         if (passButton != null)
         {
             passButton.Dispose();
             passButton = null;
         }
         if (passDot != null)
         {
             passDot.Dispose();
             passDot = null;
         }
         if (surf != null)
         {
             surf.Dispose();
             surf = null;
         }
         if (drawer != null)
         {
             drawer.Dispose();
             drawer = null;
         }
     }
 }
Exemplo n.º 3
0
        public static void Release()
        {
            if (_cursorGraphic != null)
            {
                _cursorGraphic.Dispose();
            }

            if (_smallTTFont != null)
            {
                _smallTTFont.Dispose();
            }
            if (_middleTTFont != null)
            {
                _middleTTFont.Dispose();
            }
            if (_largeTTFont != null)
            {
                _largeTTFont.Dispose();
            }

            if (_smallPFont != null)
            {
                _smallPFont.Dispose();
            }
            if (_middlePFont != null)
            {
                _middlePFont.Dispose();
            }
            if (_largePFont != null)
            {
                _largePFont.Dispose();
            }

            if (_soundOK != null)
            {
                _soundOK.Dispose();
            }
            if (_soundCancel != null)
            {
                _soundCancel.Dispose();
            }
            if (_soundExplosion != null)
            {
                foreach (Sound s in _soundExplosion.Values)
                {
                    s.Dispose();
                }
            }

            foreach (KeyValuePair <Color, AnimatedSprite> kv in _coloredCursors)
            {
                kv.Value.Dispose();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Destroy sprite
 /// </summary>
 /// <param name="disposing">If true, remove all unamanged resources</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             font.Dispose();
             GC.SuppressFinalize(this);
         }
         this.disposed = true;
     }
 }
Exemplo n.º 5
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (numberFont != null)
         {
             numberFont.Dispose();
             numberFont = null;
         }
         if (surf != null)
         {
             surf.Dispose();
             surf = null;
         }
     }
 }
Exemplo n.º 6
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (surf != null)
         {
             surf.Dispose();
             surf = null;
         }
         if (cellBackground != null)
         {
             cellBackground.Dispose();
             cellBackground = null;
         }
         if (font != null)
         {
             font.Dispose();
             font = null;
         }
         if (Font != null)
         {
             Font.Dispose();
             Font = null;
         }
         if (KingLeft != null)
         {
             KingLeft.Dispose();
             KingLeft = null;
         }
         if (KingRight != null)
         {
             KingRight.Dispose();
             KingRight = null;
         }
         if (KingSmile != null)
         {
             KingSmile.Dispose();
             KingSmile = null;
         }
         if (drawer != null)
         {
             drawer.Dispose();
             drawer = null;
         }
     }
 }
Exemplo n.º 7
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (!this.disposed)
         {
             if (textFont != null)
             {
                 textFont.Dispose();
             }
             this.disposed = true;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 8
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (infoFont != null)
         {
             infoFont.Dispose();
             infoFont = null;
         }
         if (gameFont != null)
         {
             gameFont.Dispose();
             gameFont = null;
         }
         if (scoreFont != null)
         {
             scoreFont.Dispose();
             scoreFont = null;
         }
         if (gfxFont != null)
         {
             gfxFont.Dispose();
             gfxFont = null;
         }
         if (newGame != null)
         {
             newGame.Dispose();
             newGame = null;
         }
         if (exitButton != null)
         {
             exitButton.Dispose();
             exitButton = null;
         }
         if (highScores != null)
         {
             highScores.Dispose();
             highScores = null;
         }
         if (quitGame != null)
         {
             quitGame.Dispose();
             quitGame = null;
         }
         if (switchMode != null)
         {
             switchMode.Dispose();
             switchMode = null;
         }
         if (SoundImage != null)
         {
             SoundImage.Dispose();
             SoundImage = null;
         }
         if (SoundOffImage != null)
         {
             SoundOffImage.Dispose();
             SoundOffImage = null;
         }
     }
 }