예제 #1
0
        private void Init()
        {
            mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png"));
            if (mWindow.TaskBarText != "")
            {
                Gfx.Font    font     = Logic.Graphics.FontManager.LoadFont("tahoma", 12);
                Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White);
                //textSurf = textSurf.CreateStretchedSurface(new Size(130, 12));
                mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14));
                string stateString = "?";
                switch (mWindow.WindowState)
                {
                case Client.Logic.Windows.WindowManager.WindowState.Normal:
                    stateString = "^";
                    break;

                case Client.Logic.Windows.WindowManager.WindowState.Minimized:
                    stateString = "v";
                    break;

                case Client.Logic.Windows.WindowManager.WindowState.Maximized:
                    stateString = "[]";
                    break;
                }
                mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0));
                font.Close();
            }
            base.Buffer.Blit(mBackgroundSurf, new Point(0, 0));
        }
예제 #2
0
 private void UpdateBackground()
 {
     mBackground = new SdlDotNet.Graphics.Surface(base.Size);
     base.Buffer.Fill(mBackColor);
     if (mBackColor.A != 0)
     {
         mBackground.Fill(mBackColor);
     }
     else
     {
         mBackground.Transparent      = true;
         mBackground.TransparentColor = Color.Transparent;
         mBackground.Fill(Color.Transparent);
     }
     mCheckedBoxBounds = new Rectangle(new Point(2, 2), new Size(this.Height - 4, this.Height - 4));
     Gfx.Primitives.Box box = new SdlDotNet.Graphics.Primitives.Box(mCheckedBoxBounds.Location, mCheckedBoxBounds.Size);
     mBackground.Draw(box, Color.Black);
     if (mChecked)
     {
         Gfx.Surface filled = new SdlDotNet.Graphics.Surface(box.Size);
         filled.Fill(Color.Black);
         mBackground.Blit(filled, box.Location);
         filled.Close();
         filled.Dispose();
     }
     if (mText != "")
     {
         Gfx.Font font = new Gfx.Font(IO.IO.CreateOSPath("Fonts\\PMU.ttf"), this.Height);
         mBackground.Blit(font.Render(mText, mForeColor, mAntiAlias), new Point(20, -4));
         font.Close();
     }
     base.Buffer.Blit(mBackground, new Point(0, 0));
 }
예제 #3
0
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width,Height);

            for (int i = 0; i < map.Rows; i++)
            {
                for (int j = 0; j < map.Columns; j++)
                {
                    String TexName = map.DefaultTileTexture;
                    Rectangle Clip = new Rectangle(new Point(j * TileWidth, i * TileHeight), new Size(Tile.TILE_WIDTH,Tile.TILE_HEIGHT));
                    Buffer.Blit(Textures[TexName], Clip);
                }
            }

            for(int i=0; i<map.Rows; i++)
            {
                for(int j=0; j<map.Columns; j++)
                {
                    String TexName = map.Tiles[i][j].Texture;
                    Rectangle Clip = new Rectangle(new Point(j * TileWidth, i * TileHeight), new Size(Tile.TILE_WIDTH, Tile.TILE_HEIGHT));
                    Buffer.Blit(Textures[TexName], Clip);
                }
            }

            Box Border = new Box(new Point(0, 0), new Size(Width - 1, Height - 1));

            Buffer.Draw(Border, Color.Black, true);

            return Buffer;
        }
예제 #4
0
        public DarknessOverlay(int newRange)
        {
            disposed = false;
            range = newRange;
            buffer = new Surface(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT);
            Surface holepart = new Surface(14 * Constants.TILE_WIDTH, 14 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 14; x++) {
                for (int y = 0; y < 14; y++) {
                    holepart.Blit(GraphicsManager.Tiles[10][210 + x + 14 * y], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }

            Surface hole = new Surface(28 * Constants.TILE_WIDTH, 28 * Constants.TILE_HEIGHT);
            hole.Blit(holepart, new Point(0,0));
            hole.Blit(holepart.CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, -2));
            hole.Blit(holepart.CreateFlippedVerticalSurface(), new Point(0, hole.Height / 2));
            hole.Blit(holepart.CreateFlippedVerticalSurface().CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, hole.Height / 2 - 2));
            hole = hole.CreateStretchedSurface(new Size((range) * Constants.TILE_WIDTH, (range) * Constants.TILE_HEIGHT));

            buffer.Blit(GraphicsManager.Tiles[10][45].CreateStretchedSurface(new Size(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT)), new Point(0,0));
            buffer.Blit(hole, new Point(buffer.Width / 2 - hole.Width / 2, buffer.Height / 2 - hole.Height / 2));

            //buffer = hole;
            buffer.Transparent = true;

            buffer.AlphaBlending = true;
            buffer.Alpha = 180;
        }
예제 #5
0
        public void UpdateSurfaces()
        {
            mButtonUpBounds         = new Rectangle(0, 0, this.Width, 25);
            mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
            mButtonDownBounds       = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
            mScrollBarBounds        = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);

            mBackground = new SdlDotNet.Graphics.Surface(this.Size);

            mButtonSurface = new SdlDotNet.Graphics.Surface(mButtonUpBounds.Size);
            mScrollbarBackgroundSurface = new SdlDotNet.Graphics.Surface(mScrollBackgroundBounds.Size);
            mScrollbarSurface           = new SdlDotNet.Graphics.Surface(mScrollBarBounds.Size);
            mScrollbarSurface.Fill(Color.Transparent);
            //mScrollbarSurface.Transparent = true;

            mButtonSurface.Fill(mForecolor);
            Gfx.Primitives.Box border = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollBackgroundBounds.Width - 2, mScrollBackgroundBounds.Height - 1));
            mScrollbarBackgroundSurface.Draw(border, Color.Blue);

            Gfx.Primitives.Box border2 = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollbarSurface.Width - 2, mScrollbarSurface.Height - 2));
            mScrollbarSurface.Draw(border, Color.Red);

            mBackground.Blit(mButtonSurface);
            mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
        }
예제 #6
0
 private void Init()
 {
     mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png"));
     if (mWindow.TaskBarText != "") {
         Gfx.Font font = Logic.Graphics.FontManager.LoadFont("tahoma", 12);
         Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White);
         //textSurf = textSurf.CreateStretchedSurface(new Size(130, 12));
         mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14));
         string stateString = "?";
         switch (mWindow.WindowState) {
             case Client.Logic.Windows.WindowManager.WindowState.Normal:
                 stateString = "^";
                 break;
             case Client.Logic.Windows.WindowManager.WindowState.Minimized:
                 stateString = "v";
                 break;
             case Client.Logic.Windows.WindowManager.WindowState.Maximized:
                 stateString = "[]";
                 break;
         }
         mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0));
         font.Close();
     }
     base.Buffer.Blit(mBackgroundSurf, new Point(0, 0));
 }
예제 #7
0
        private void drawMaps(SdlDotNet.Graphics.Surface s)
        {
            s.Fill(Constants.Color_Background);

            // ヘッダ
            if (_headerSurface == null)
            {
                _headerSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_MapSelect,
                                                                   Constants.Color_Strong);
            }
            s.Blit(_headerSurface, new Point(Constants.HeaderX, Constants.HeaderY));

            // 説明文
            if (_expSurface == null)
            {
                _expSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Explanation_MapSelect,
                                                                Constants.Color_Strong);
            }
            s.Blit(_expSurface, _expRect.Location);

            // ビルトインマップメニュー
            ImageUtil.DrawSelections(s, _randSurfaces, _randRects, _cursor,
                                     _randRect.Location, ((_mapFocus || _escFocus) ? -1 : _randSelectedIdx), MenuItemAlign.MiddleLeft);

            // 読み込んだマップメニュー
            ImageUtil.DrawSelections(s, _mapDrawSurfaces, _mapDrawRects, _cursor,
                                     _mapRect.Location, (_mapFocus ? _mapSelectedIdx - _mapDrawFirstIdx : -1), MenuItemAlign.MiddleLeft);

            // タイトルに戻るメニュー
            ImageUtil.DrawSelections(s, _escSurfaces, _escRects, _strongCursor,
                                     _escRect.Location, (_escFocus ? 0 : -1), MenuItemAlign.MiddleLeft);
        }
예제 #8
0
        private void UpdateSurface()
        {
            mBackground.Fill(mBackColor);
            if (base.IsColorTransparent(mBackColor))
            {
                mBackground.Transparent      = true;
                mBackground.TransparentColor = mBackColor;
            }
            else
            {
                mBackground.Transparent = false;
            }
            decimal newWidth = (decimal)base.Width * ((decimal)mPercent / (decimal)100);
            Size    barSize  = new Size(System.Math.Max(0, (int)newWidth - 2), System.Math.Max(0, base.Height - 2));

            Gfx.Surface barSurface = new SdlDotNet.Graphics.Surface(barSize);
            barSurface.Fill(mBarColor);
            mBackground.Blit(barSurface, new Point(1, 1));
            barSurface.Close();
            barSurface.Dispose();
            if (mText != "" && mFont != null)
            {
                Gfx.Surface fontSurf = mFont.Render(mText, Color.Black, false);
                mBackground.Blit(fontSurf, GetCenter(mBackground, fontSurf.Size), new Rectangle(0, 0, this.Width, this.Height));
            }
            Draw3dBorder();

            base.Buffer.Blit(mBackground, new Point(0, 0));
        }
예제 #9
0
        public override void Draw(SdlDotNet.Graphics.Surface screen)
        {
            // Draw the title
            titleTextSprite.X     = 20;
            titleTextSprite.Y     = _BaseY;
            titleTextSprite.Color = Color.Yellow;
            titleTextSprite.Text  = this.Name;
            screen.Blit(titleTextSprite);

            int item_y = _BaseY + _SpaceBetweenItems + 20;

            // Draw the lines
            for (int i = 0; i < Lines.Length; i++)
            {
                lineTextSprite.X     = 20;
                lineTextSprite.Y     = item_y;
                lineTextSprite.Color = Color.White;
                lineTextSprite.Text  = Lines[i];
                screen.Blit(lineTextSprite);

                item_y += 15;
            }

            // Draw the item
            itemTextSprite.X     = 20;
            itemTextSprite.Y     = screen.Height - 40;
            itemTextSprite.Color = Color.LightYellow;
            itemTextSprite.Text  = Items[0].Text;
            screen.Blit(itemTextSprite);
        }
예제 #10
0
        private void drawOctaveSelecting(SdlDotNet.Graphics.Surface s)
        {
            if (_octaveSelectingSurface == null)
            {
                using (Surface ts = ImageUtil.CreateMultilineStringSurface(new string[] {
                    Properties.Resources.Str_OctaveSelecting,
                    null, null, null,
                    Properties.Resources.Str_OctaveSelecting_Operation
                },
                                                                           ResourceManager.SmallPFont, Constants.Color_Background, TextAlign.Center))
                {
                    _octaveSelectingSurface = new Surface(
                        ts.Width + Constants.WindowPadding * 2,
                        ts.Height + Constants.WindowPadding * 2);

                    _octaveSelectingSurface.Fill(Constants.Color_Foreground);
                    _octaveSelectingSurface.Blit(ts, new Point(Constants.WindowPadding, Constants.WindowPadding));
                    _octaveSelectingSurface.Update();
                }

                _octaveUpSurface   = ResourceManager.SmallPFont.Render(Properties.Resources.Str_UpArrow, Constants.Color_Background);
                _octaveDownSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_DownArrow, Constants.Color_Background);
            }

            s.Blit(_octaveSelectingSurface, new Point(
                       (int)(Constants.ScreenWidth / 2.0 - _octaveSelectingSurface.Width / 2.0),
                       (int)(Constants.ScreenHeight / 2.0 - _octaveSelectingSurface.Height / 2.0)));

            int fh = (int)(ResourceManager.SmallPFont.Height * Constants.LineHeight);
            int y  = Constants.WindowPadding +
                     (int)(Constants.ScreenHeight / 2.0 - _octaveSelectingSurface.Height / 2.0) + fh;

            if (_octave < Constants.MaxOctave)
            {
                s.Blit(_octaveUpSurface, new Point((int)(Constants.ScreenWidth / 2.0 - _octaveUpSurface.Width / 2.0), y));
            }
            y += fh;

            using (Surface ts = ResourceManager.SmallPFont.Render(_octave.ToString(), Constants.Color_Background))
            {
                s.Blit(ts, new Point((int)(Constants.ScreenWidth / 2.0 - ts.Width / 2.0), y));
            }
            y += fh;

            if (_octave > Constants.MinOctave)
            {
                s.Blit(_octaveDownSurface, new Point((int)(Constants.ScreenWidth / 2.0 - _octaveDownSurface.Width / 2.0), y));
            }
        }
예제 #11
0
 protected override void renderMiniMapForeground(SdlDotNet.Graphics.Surface s, Rectangle r)
 {
     using (Surface ts = ResourceManager.LargePFont.Render("Endless Map", _backColor))
     {
         s.Blit(ts, new Point((int)(r.Width / 2.0 - ts.Width / 2.0), (int)(r.Height / 2.0 - ts.Height / 2.0)));
     }
 }
예제 #12
0
		protected override Surface CreateSurface ()
		{
			if (calc_width) {
				Surface textSurf = GuiUtil.ComposeText (Text, Font, Palette, -1, -1,
									Sensitive ? 4 : 24);
				Width = (ushort)textSurf.Width;
				Height = (ushort)textSurf.Height;

				return textSurf;
			}
			else {
				/* this is wrong */
				Surface surf = new Surface (Width, Height);

				Surface textSurf = GuiUtil.ComposeText (Text, Font, Palette, Width, Height,
									Sensitive ? 4 : 24);

				int x = 0;
				if (Type == ElementType.LabelRightAlign)
					x += Width - textSurf.Width;
				else if (Type == ElementType.LabelCenterAlign)
					x += (Width - textSurf.Width) / 2;

				surf.Blit (textSurf, new Point (x, 0));

				surf.TransparentColor = Color.Black /* XXX */;
				return surf;
			}
		}
예제 #13
0
        private void DrawCursor(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            cursorArea.Height = System.Math.Max(20, mBackground.Height - System.Math.Max(20, max / 4));
            cursorArea.Width  = 12;

            cursorPos.X = this.ScreenLocation.X;
            if (!isScrolling)
            {
                if (!inverted)
                {
                    cursorPos.Y = (this.ScreenLocation.Y + buttonHeight) + (Height - 21 - cursorArea.Height) + ((value * 100) / max);
                }
                else
                {
                    cursorPos.Y = (this.ScreenLocation.Y + buttonHeight) + (Height - 21 - cursorArea.Height) * ((max - value) / max);
                }
            }

            cursorArea.X = (int)(cursorPos.X + this.ScreenLocation.X);
            cursorArea.Y = (int)(cursorPos.Y + this.ScreenLocation.Y);

            cursorSurf = new SdlDotNet.Graphics.Surface(cursorArea.Size);
            cursorSurf.Fill(Color.Gray);

            dstSrf.Blit(cursorSurf, cursorPos);
            //spriteBatch.Draw(cursorTex, cursorPos, cursorLeft, BackColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);

            //cursorMidDest.X = (int)cursorPos.X + 3;
            //cursorMidDest.Y = (int)cursorPos.Y;
            //cursorMidDest.Width = cursorArea.Width - 6;
            //spriteBatch.Draw(cursorTex, cursorMidDest, cursorMiddle, BackColor, 0f, Vector2.Zero, SpriteEffects.None, 0f);

            //spriteBatch.Draw(cursorTex, cursorPos + new Vector2(cursorMidDest.Width, 0f), cursorRight, BackColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
예제 #14
0
        public override void paint(SdlDotNet.Graphics.Surface surface, bool focused, System.Drawing.Point offset)
        {
            display.Blit(atari.Display);
            surface.Blit(display, offset);

            atari.execute();
        }
예제 #15
0
        public static void Initialize()
        {
            activeAnimations = new List<Moves.IMoveAnimation>();
            srfcMoveTargetTile = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTile.Blit(GraphicsManager.Tiles[10][77], new Point(0, 0));
            srfcMoveTargetTile.Transparent = true;
            //srfcMoveTargetTile.Alpha = 150;
            //srfcMoveTargetTile.AlphaBlending = true;

            srfcMoveTargetTileHit = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTileHit.Blit(GraphicsManager.Tiles[10][91], new Point(0,0));
            srfcMoveTargetTileHit.Transparent = true;
            //srfcMoveTargetTileHit.Alpha = 150;
            //srfcMoveTargetTileHit.AlphaBlending = true;

            srfcMoveTargetTileDark = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
            srfcMoveTargetTileDark.Blit(GraphicsManager.Tiles[10][105], new Point(0, 0));
            srfcMoveTargetTileDark.Transparent = true;

            srfcMoveTargetUnknown = new Surface(Constants.TILE_WIDTH * 3, Constants.TILE_HEIGHT * 3);
            for (int i = 0; i < 9; i++)
            {
                srfcMoveTargetUnknown.Blit(GraphicsManager.Tiles[10][8 + i % 3 + i / 3 * 14], new Point(i % 3 * Constants.TILE_WIDTH, i / 3 * Constants.TILE_HEIGHT));
            }
            srfcMoveTargetUnknown.Transparent = true;
            srfcMoveTargetUnknown.Alpha = 150;
            srfcMoveTargetUnknown.AlphaBlending = true;
        }
예제 #16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="surface"></param>
        protected override void DrawGameObject(Surface surface)
        {
            int currentY = 0;

            Surface fontSurface = font.Render("Score: " + this._Score, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));

            currentY += 20;
            fontSurface = font.Render("Blocks Destroyed: " + this._BlocksDestroyed, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));

            currentY += 20;

            fontSurface = font.Render("Level: " + this._Level, Color.FromArgb(255, 255, 255));
            surface.Blit(fontSurface, new System.Drawing.Point(this.ScreenX, this.ScreenY + currentY));
        }
예제 #17
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     if (e.Tick > lastTick + 35)
     {
         mGameLoop.DrawScreen(mGameSurface, e);
         lastTick = e.Tick;
     }
     dstSrf.Blit(mGameSurface, this.Location);
 }
예제 #18
0
        public override void Draw(Surface dest, Rectangle Camera)
        {
            Camera.X = m_rect.X - Camera.X;
            Camera.Y = m_rect.Y - Camera.Y;
            Camera.Width = m_rect.Width;
            Camera.Height = m_rect.Height;

            dest.Blit(m_tileset, Camera);
        }
예제 #19
0
        public virtual void Render(Surface s, Point p)
        {
            s.Blit(_graphic, new Point(p.X - (int)(_width / 2.0), p.Y - (int)(_height / 2.0)));

            foreach (Point offset in _collisionPoints)
            {
                s.Fill(new Rectangle(p.X - offset.X, p.Y - offset.Y, 1, 1), Color.Red);
            }
        }
        public Achtergrond(Surface vid)
        {
            mVideo = vid;
            mAfbeelding = new Surface("background.jpg");
            mVideo.Blit(mAfbeelding);

            //Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
            Events.KeyboardDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardDown);
            Events.KeyboardUp += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardUp);
        }
예제 #21
0
 private void drawLoading(SdlDotNet.Graphics.Surface s)
 {
     s.Fill(Constants.Color_Foreground);
     if (_loadingSurface == null)
     {
         _loadingSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_MapLoading, Constants.Color_Background);
     }
     s.Blit(_loadingSurface, new Point(
                (int)(Constants.ScreenWidth / 2.0 - _loadingSurface.Width / 2.0),
                (int)(Constants.ScreenHeight / 2.0 - _loadingSurface.Height / 2.0)));
 }
예제 #22
0
 public DuskOverlay()
 {
     disposed = false;
     buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
     for (int x = 0; x < 20; x++) {
         for (int y = 0; y < 15; y++) {
             buffer.Blit(GraphicsManager.Tiles[10][63], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
         }
     }
     buffer.AlphaBlending = true;
     buffer.Alpha = 60;
 }
예제 #23
0
 private void UpdateTexture()
 {
     if (mBackcolor.A != 0)
     {
         mTexture.Fill(mBackcolor);
     }
     else
     {
         mTexture.Transparent      = true;
         mTexture.TransparentColor = Color.Transparent;
         mTexture.Fill(Color.Transparent);
     }
     mBackgroundTexture.Fill(mHoverColor);
     mTexture.Blit(mBackgroundTexture, new Point(1, 1));
     mTexture.Blit(mFont.Render(mText, mForecolor), new Point(((mTexture.Width / 2) - (mTextSize.Width / 2)) + mXOffset, ((mTexture.Height / 2) - (mTextSize.Height / 2)) + mYOffset));
     for (int i = 0; i < mBorderWidth; i++)
     {
         Gfx.IPrimitive border = new Gfx.Primitives.Box((short)(i + 1), (short)(i + 1), (short)(this.Width - (2 + i)), (short)(this.Height - (2 + i)));
         mTexture.Draw(border, mBorderColor);
     }
 }
예제 #24
0
        public ScoreCard(Player player, Point displayPosition)
        {
            this.player = player;

            this.displayPosition = displayPosition;

            this.kills = 0;
            this.defeats = 0;
            this.suicides = 0;

            this.font = new Font(Configuration.InfoBar.PlayerStatusDisplayFontFilename, Configuration.InfoBar.PlayerStatusDisplayFontSize);

            Surface scoreCardSurface = new Surface(Configuration.InfoBar.PlayerStatusDisplayImageFilename);

            Point position = new Point(Configuration.InfoBar.XBuffer, Configuration.InfoBar.YBuffer);

            // Show the ship's picture.
            scoreCardSurface.Blit(this.player.Ship.ShipPhotoSurface, position);

            position.X += this.player.Ship.ShipPhotoSurface.Width + Configuration.InfoBar.XBuffer;

            using (Surface text = font.Render(string.Format("Player {0}", player.Number), Configuration.Ships.Shields.InfoDisplayPlayerFontColor))
            {
                text.Transparent = true;
                scoreCardSurface.Blit(text, position);
            }

            int xPosition = position.X + Configuration.InfoBar.FirstColumn_PixelsToIndent;

            this.shieldsText = font.Render("Shields:", Configuration.Ships.Shields.InfoDisplayStrongColor, true);
            this.shieldsText.Transparent = true;
            scoreCardSurface.Blit(shieldsText, new Point(xPosition, position.Y + this.font.LineSize + 1));

            this.bulletsText = font.Render("Bullets:", Configuration.Ships.Cannon.InfoDisplayStrongBulletCountColor, true);
            this.bulletsText.Transparent = true;
            scoreCardSurface.Blit(bulletsText, new Point(xPosition, position.Y + this.font.LineSize * 2 + 1));

            xPosition = position.X + Configuration.InfoBar.SecondColumn_PixelsToIndent;

            this.killsText = font.Render("Kills:", Configuration.InfoBar.CounterTextColor, true);
            this.killsText.Transparent = true;
            scoreCardSurface.Blit(killsText, new Point(xPosition, position.Y));

            this.defeatsText = font.Render("Defeats:", Configuration.InfoBar.CounterTextColor, true);
            this.defeatsText.Transparent = true;
            scoreCardSurface.Blit(defeatsText, new Point(xPosition, position.Y + this.font.LineSize + 1));

            this.suicidesText = font.Render("Suicides:", Configuration.InfoBar.CounterTextColor, true);
            this.suicidesText.Transparent = true;
            scoreCardSurface.Blit(suicidesText, new Point(xPosition, position.Y + this.font.LineSize * 2 + 1));

            this.scoreCard = scoreCardSurface.Convert(Video.Screen, true, false);
        }
예제 #25
0
 private void DrawNormalLayer(Surface surface, int layerIndex, ScreenSection section)
 {
     // Draw each line from left to right.
     var layer = Map.Layers[layerIndex];
     for (var y = section.TileTop; y < section.TileTop + section.TileHeight; y++) {
         for (var x = section.TileLeft; x < section.TileLeft + section.TileWidth; x++) {
             var tileIndex = layer.GetTileIndex(x, y);
             var tile = Map.GetSurfaceForTileId(tileIndex);
             var position = section.GetTilePosition(x, y);
             surface.Blit(tile, position);
         }
     }
 }
예제 #26
0
        public Surface FillBackground()
        {
            Surface Buffer = new Surface(Width, Height);

            for (int i = 0; i < map.Rows; i++)
            {
                for (int j = 0; j < map.Columns; j++)
                {
                    Buffer.Blit(Textures[map.DefaultTileTexture], new Point(j * TileWidth, i * TileHeight));
                }
            }
            return Buffer;
        }
예제 #27
0
		protected override Surface CreateSurface ()
		{
			Surface surf = new Surface (Width, Height);

			surf.TransparentColor = Color.Black; /* XXX */

			text_surf = null;
			CalculateTextPosition ();

			surf.Blit (text_surf, new Point (text_x, text_y));

			return surf;
		}
예제 #28
0
        /// <summary>
        /// Actually reads the tiles from the file and returns the Tile at that location.
        /// </summary>
        /// <param name="fileName">File containing the Sprite Sheet</param>
        /// <param name="x">X Coordinate of the Tile (Unit: Tiles)</param>
        /// <param name="y">Y Coordinate of the Tile (Unit: Tiles)</param>
        /// <returns>Tile from fileName at X, Y</returns>
        public static Tile FromTilemap(string fileName, int x, int y)
        {
            if (m_Tilemap == null) { m_Tilemap = new Surface(fileName); }

            Surface tile = new Surface( 25, 25 );

            int offsetX = ( x * 25 ); // X offset into Tilemap
            int offsetY = ( y * 25 ); // Y offset into Tilemap

            tile.Blit(m_Tilemap, new Point(0, 0), new Rectangle(offsetX, offsetY, 25, 25));

            return new Tile( tile );
        }
예제 #29
0
파일: Cloudy.cs 프로젝트: blastboy/Client
        public Cloudy()
        {
            disposed = false;
            buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 20; x++) {
                for (int y = 0; y < 15; y++) {

                    buffer.Blit(GraphicsManager.Tiles[10][59 + (x % 2) + 2 * (y % 2)], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }
            buffer.AlphaBlending = true;
            buffer.Alpha = 50;
        }
예제 #30
0
 //TODO: Check for border size and width/height
 public void DrawCenteredWindow(int width, int height, Surface dest)
 {
     SdlDotNet.Graphics.Primitives.Box box = new SdlDotNet.Graphics.Primitives.Box(new Point((game.Width - width) / 2, (game.Height - height) / 2), new Size(width, height));
     dest.Draw(box, bgColor, false, true);
     for (int i = Border; i < width - Border; i += Border) {
         dest.Blit(surface, new Point(box.XPosition1 + i, box.YPosition1), new Rectangle(2 * Border, 0, Border, Border));
         dest.Blit(surface, new Point(box.XPosition1 + i, box.YPosition2 - Border + 1), new Rectangle(2 * Border, Border, Border, Border));
     }
     for (int i = Border; i < height - Border; i += Border) {
         dest.Blit(surface, new Point(box.XPosition1, box.YPosition1 + i), new Rectangle(3 * Border, 0, Border, Border));
         dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition1 + i), new Rectangle(3 * Border, Border, Border, Border));
     }
     dest.Blit(surface, new Point(box.XPosition1, box.YPosition1), new Rectangle(0, 0, Border, Border));
     dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition1), new Rectangle(Border, 0, Border, Border));
     dest.Blit(surface, new Point(box.XPosition1, box.YPosition2 - Border + 1), new Rectangle(0, Border, Border, Border));
     dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition2 - Border + 1), new Rectangle(Border, Border, Border, Border));
 }
예제 #31
0
		void TileRow (Surface surf, Grp grp, byte[] pal, int l, int c, int r, int y)
		{
			Surface lsurf = GuiUtil.CreateSurfaceFromBitmap (grp.GetFrame (l),
									 grp.Width, grp.Height,
									 pal,
									 41, 0);

			Surface csurf = GuiUtil.CreateSurfaceFromBitmap (grp.GetFrame (c),
									 grp.Width, grp.Height,
									 pal,
									 41, 0);


			Surface rsurf = GuiUtil.CreateSurfaceFromBitmap (grp.GetFrame (r),
									 grp.Width, grp.Height,
									 pal,
									 41, 0);


			surf.Blit (lsurf, new Point (0,y));
			for (int x = grp.Width; x < surf.Width - grp.Width; x += grp.Width)
				surf.Blit (csurf, new Point (x, y));
			surf.Blit (rsurf, new Point (surf.Width - grp.Width,y));
		}
 public void Draw(Surface sfcGameWindow, float x, float y, int alpha=255, bool fill=false)
 {
     if (sfc != null) {
         sfcGameWindow.Blit (sfc, new Point ((int)x, (int)y));
     } else {
         box = new Box (new Point ((int)x, (int)y), new Size (width, height));
         int r = colour.R;
         int g = colour.G;
         int b = colour.B;
         Color colour2 = Color.FromArgb (alpha, r, g, b);
         if (colour == Color.Transparent) {
             colour2 = colour;
         }
         sfcGameWindow.Draw (box, colour2, true, fill);
     }
 }
예제 #33
0
        public Sandstorm()
        {
            disposed = false;
            buffer = new Surface(24 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 24; x++)
            {
                for (int y = 0; y < 15; y++)
                {

                    buffer.Blit(GraphicsManager.Tiles[10][76 + 14 * (x % 4)], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }
            buffer.AlphaBlending = true;
            buffer.Alpha = 160;
            X = 0;
        }
예제 #34
0
 public void DrawWindow(SdlDotNet.Graphics.Primitives.Box box, Surface dest)
 {
     dest.Draw(box, bgColor, false, true);
     for (int i = Border; i < box.Width - Border; i += Border) {
         dest.Blit(surface, new Point(box.XPosition1 + i, box.YPosition1), new Rectangle(2 * Border, 0, Border, Border));
         dest.Blit(surface, new Point(box.XPosition1 + i, box.YPosition2 - Border + 1), new Rectangle(2 * Border, Border, Border, Border));
     }
     for (int i = Border; i < box.Height - Border; i += Border) {
         dest.Blit(surface, new Point(box.XPosition1, box.YPosition1 + i), new Rectangle(3 * Border, 0, Border, Border));
         dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition1 + i), new Rectangle(3 * Border, Border, Border, Border));
     }
     dest.Blit(surface, new Point(box.XPosition1, box.YPosition1), new Rectangle(0, 0, Border, Border));
     dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition1), new Rectangle(Border, 0, Border, Border));
     dest.Blit(surface, new Point(box.XPosition1, box.YPosition2 - Border + 1), new Rectangle(0, Border, Border, Border));
     dest.Blit(surface, new Point(box.XPosition2 - Border + 1, box.YPosition2 - Border + 1), new Rectangle(Border, Border, Border, Border));
 }
예제 #35
0
 private void Redraw()
 {
     try {
         base.Buffer.Fill(mBackColor);
         if (mBackground != null)
         {
             mBackground.Close();
             mBackground.Dispose();
         }
         mBackground = new SdlDotNet.Graphics.Surface(this.Size);
         mBackground.TransparentColor = Color.Transparent;
         mBackground.Transparent      = true;
         mBackground.Fill(mBackColor);
         int lastY = 2;
         // Draw each line
         for (int i = mVisibleY; i < mVisibleY + mMaxY; i++)
         {
             if (mLines.Count > i)
             {
                 SdlDotNet.Graphics.Surface lineSurf;
                 if (mPasswordChar == '\0')
                 {
                     lineSurf = mLines[i].Render();
                 }
                 else
                 {
                     lineSurf = mLines[i].RenderPassword(mPasswordChar);
                 }
                 mBackground.Blit(lineSurf, new Point(2, lastY));
                 lineSurf.Close();
                 lastY += mFont.Height;
             }
             else
             {
                 break;
             }
         }
         base.Buffer.Blit(mBackground);
         mBackground.Close();
         //if (mDoLineDraw) {
         //    Gfx.IPrimitive line = new Gfx.Primitives.Line(new Point((((mCursorLocX - mVisibleX) * (mLetterSize.Width))), (((((mCursorLocY) - mVisibleY) * mLetterSize.Height)) - 2)), new Point(((mCursorLocX - mVisibleX) * (mLetterSize.Width)), (((mCursorLocY) - mVisibleY) * mLetterSize.Height + mLetterSize.Height)));
         //    base.Buffer.Draw(line, Color.Blue);
         //}
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
     }
 }
예제 #36
0
        public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
        {
            if (chip < 0 || chip >= _chipSurfaces.Count) return;
            if (chip == 0) return;

            switch (m)
            {
                case ChipResizeMethod.Stretch:
                    Color c = _avgColors[chip];
                    s.Fill(r, c);
                    break;
                case ChipResizeMethod.Tile:
                    Surface ss = _chipSurfaces[(int)chip];
                    s.Blit(ss, r);
                    break;
            }
        }
예제 #37
0
        //Bepaalt hoe groot de rechthoek ShowPartImage is aan de hand van het aantal levens dat de held heeft.
        //De ShowPartImage rechthoek bepaalt dan weer hoeveel hartjes er op het scherm getekend zullen worden.
        public void Draw(Surface video, Hero held)
        {
            if (held.NumberOflives == 0)
            {
                ShowPartImage.Width = 0;
            }
            if (held.NumberOflives == 1)
            {
                ShowPartImage.Width = 57;
            }
            if (held.NumberOflives == 2)
            {
                ShowPartImage.Width = 114;
            }
            if (held.NumberOflives == 3)
            {
                ShowPartImage.Width = 171;
            }

            video.Blit(Image, Position, ShowPartImage);
        }
예제 #38
0
        public virtual void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            try {
                if (!mIsDisposing)
                {
//					Point totalAddLoc = GetTotalAddLocation(new Point(mBounds.X, mBounds.Y), this);
//					if (mScreenBounds.Location != totalAddLoc) {
//						mScreenBounds = new Rectangle(totalAddLoc, this.Size);
//					}
//					int addX = totalAddLoc.X;
//					int addY = totalAddLoc.Y;
                    if (mBuffer.Size != mBounds.Size)
                    {
                        ReinitBuffer();
                    }
                    dstSrf.Blit(mBuffer, this.Location);
                    UpdateControls(mBuffer, e);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
        public MapChangeInfoOverlay(string mapName, int minDisplayTime)
        {
            disposed = false;

            this.mapName = mapName;
            textFont = FontManager.LoadFont("PMU", 36);
            buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
            buffer.Fill(Color.Black);
            Surface textSurf = TextRenderer.RenderTextBasic(textFont, mapName, null, Color.WhiteSmoke, false, 0, 0, 0, 0);
            buffer.Blit(textSurf, new Point(DrawingSupport.GetCenterX(buffer.Width, textSurf.Width), 100));
            this.minDisplayTime = minDisplayTime;
            tickCount = new TickCount(SdlDotNet.Core.Timer.TicksElapsed);
            //TextRenderer.RenderText(buffer, textFont, mapName, Color.WhiteSmoke, true, 0, 0, 100, 50);
            //for (int x = 0; x < 20; x++) {
            //    for (int y = 0; y < 15; y++) {

            //        buffer.Blit(GraphicsManager.Tiles[10][59 + (x % 2) + 2 * (y % 2)], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
            //    }
            //}
            //buffer.AlphaBlending = true;
            //buffer.Alpha = 50;
        }
예제 #40
0
 public static Surface GetSurface(byte[] imgBytes, Size boxSize)
 {
     Surface boxSurf = new Surface(boxSize);
     boxSurf.Fill(Color.White);  //Fill background to white color
     //Get and resize image
     if (imgBytes != null)
     {
         Surface imgSurf = new Surface(imgBytes);
         double scale = Ratio.CalculateScale(imgSurf.Size,
                                             new Size(boxSize.Width, boxSize.Height),
                                             Ratio.RatioType.FitImage); //Calculate ratio
         Surface scaledSurf = imgSurf.CreateScaledSurface(scale, true);
         imgSurf.Dispose();
         Point pt = new Point((boxSize.Width - scaledSurf.Width) / 2,      //Left point
                              (boxSize.Height - scaledSurf.Height) / 2);   //Top point
         boxSurf.Blit(scaledSurf, pt);
         scaledSurf.Dispose();  //Clear imgSurf memory
     }
     //Draw border
     for(int i = 0; i < BORDER; i++)
         boxSurf.Draw(new Box(new Point(i, i), new Point(boxSize.Width - i - 1, boxSize.Height - i - 1)), Color.Gray);
     return boxSurf;
 }
예제 #41
0
        protected override void draw(SdlDotNet.Graphics.Surface s)
        {
            if (_prevSurface == null)
            {
                _prevSurface               = new Surface(s);
                _prevSurface.Transparent   = true;
                _prevSurface.AlphaBlending = true;
                _prevSurface.Alpha         = 64;
            }

            s.Fill(Color.Black);
            s.Blit(_prevSurface, Point.Empty);

            if (_errorMessageSurface == null && _errorMessages != null)
            {
                _errorMessageSurface = new SurfaceCollection();
                _errorMessageRects   = new Rectangle[_errorMessages.Length];
                ImageUtil.CreateStrMenu(_errorMessages, Color.White, ref _errorMessageSurface, ref _errorMessageRects, s.Width);
            }
            if (_errorMessageSurface != null)
            {
                ImageUtil.DrawSurfaces(s, _errorMessageSurface, _errorMessageRects, new Point(0, 100), MenuItemAlign.TopCenter);
            }
        }
예제 #42
0
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width, Height);

            Buffer.Blit(Background.Render(), new Point(0, 0));

            foreach (ButtonItem b in Buttons)
            {
                Rectangle bRect = new Rectangle(new Point(b.X + X, b.Y + Y), new Size(b.Width, b.Height));
                Surface bRender;
                if (bRect.Contains(MousePos) && !MousePos.IsEmpty)
                {
                    bRender = b.RenderHighlight();
                }
                else
                {
                    bRender = b.Render();
                }

                Buffer.Blit(bRender, new Point(b.X, b.Y));
            }

            Buffer.Blit(WinBar.Render(), new Point(0, 0));

            Buffer.AlphaBlending = true;
            Buffer.Alpha = 200;

            return Buffer;
        }
예제 #43
0
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width,Height);

            Buffer.Blit(Background.Render(),Background.GetPoint());

            Surface text1 = font.Render("GAME OVER !", Color.Black);
            Surface text2 = font.Render("Score : " + GameObj.Score , Color.Black);
            Surface text3 = font.Render("NOOB", Color.Black);
            Point pt = new Point((Width - text1.Width) / 2, 10);

            Buffer.Blit(text1,pt);

            pt = new Point((Width - text2.Width) /2, 50);

            Buffer.Blit(text2,pt);

            pt = new Point((Width - text2.Width) / 2, 90);

            for (int i = 0; i < GameObj.MapTop10.ScoreEntries.Count; i++)
            {
                ScoreEntry Entry = GameObj.MapTop10.ScoreEntries[i];
                String ScoreStr = (i+1)+" - "+Entry.PlayerName+"    "+Entry.Wave+"    "+Entry.Score;
                Surface ScoreText = DefaultStyle.GetFont().Render(ScoreStr,Color.Black);

                Point p = new Point(20, 160 + (i * 20));

                Buffer.Blit(ScoreText, new Rectangle(p, new Size(ScoreText.Width, ScoreText.Height)));
            }

            Buffer.Blit(text3, pt);

            if(bContinue.GetRect(GetPoint()).Contains(MousePos))
            {
                Buffer.Blit(bContinue.RenderHighlight(),bContinue.GetPoint());
                Buffer.Blit(bQuit.Render(),bQuit.GetPoint());
            }
            else if(bQuit.GetRect(GetPoint()).Contains(MousePos))
            {
                Buffer.Blit(bContinue.Render(),bContinue.GetPoint());
                Buffer.Blit(bQuit.RenderHighlight(),bQuit.GetPoint());
            }
            else
            {
                Buffer.Blit(bContinue.Render(),bContinue.GetPoint());
                Buffer.Blit(bQuit.Render(),bQuit.GetPoint());
            }

            Buffer.AlphaBlending = true;
            Buffer.Alpha = 175;

            return Buffer;
        }
예제 #44
0
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width, Height);

            Buffer.Blit(Background.Render(), Background.GetRect());

            Buffer.Blit(BoxTitle.Render(), BoxTitle.GetRect());

            int j = 0;
            for (int i = CurrentWave; i < WaveList.Wave.Count; i++)
            {
                if (j == 5)
                {
                    break;
                }
                XmlCreepWave wave = WaveList.Wave[i];
                //Surface label = DefaultStyle.GetFont().Render(wave.Name,Color.Black);

                //Point p = new Point((Width - label.Width) / 2, (j * INFOBOX_HEIGHT) + 20);

                if (j == 0)
                {
                    Rectangle bg = new Rectangle(new Point(10, (j * INFOBOX_HEIGHT) + 20), new Size(Width - 20, INFOBOX_HEIGHT - 10));
                    Buffer.Fill(bg, Color.LightYellow);
                }

                Box Border = new Box(new Point(10,(j*INFOBOX_HEIGHT) + 20),new Size(Width - 20, INFOBOX_HEIGHT - 10));

                Surface CreepGfx = WavesGfx[i];

                Rectangle GfxRect = new Rectangle(new Point((Width - CreepGfx.Width) / 2, (j * INFOBOX_HEIGHT) + 25), CreepGfx.Size);

                Surface HealthLabel = DefaultStyle.GetFont().Render("Health : " + wave.Health, Color.Black);

                Point HealthP = new Point((Width - HealthLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 55);

                Surface WeaknessLabel = DefaultStyle.GetFont().Render("Weakness : " + UnitDmg.GetDamageType(wave.Weakness), Color.Black);

                Point WeaknessP = new Point((Width - WeaknessLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 70);

                Surface ResistLabel = DefaultStyle.GetFont().Render("Resist : " + UnitDmg.GetDamageType(wave.Resist), Color.Black);

                Point ResistP = new Point((Width - ResistLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 85);

                Surface creepsNb = DefaultStyle.GetBoldFont().Render("x" + wave.Numbers, Color.OrangeRed);
                Point creepsNbP = new Point(GfxRect.X + GfxRect.Width + 5, (j * INFOBOX_HEIGHT) + 35);

                if (wave.StealAmount != 1)
                {
                    Surface stealLabel = DefaultStyle.GetFont().Render("Steal Multiple Crystal", Color.Red);
                    Point stealP = new Point((Width - stealLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 100);

                    Buffer.Blit(stealLabel, stealP);
                }
                else if (wave.Speed != 1)
                {
                    Surface speedLabel = DefaultStyle.GetFont().Render("Moving Faster", Color.Red);
                    Point speedP = new Point((Width - speedLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 100);

                    Buffer.Blit(speedLabel, speedP);
                }

                Buffer.Blit(CreepGfx, GfxRect);
                Buffer.Blit(HealthLabel, HealthP);

                Buffer.Blit(WeaknessLabel, WeaknessP);
                Buffer.Blit(ResistLabel, ResistP);

                Buffer.Blit(creepsNb, creepsNbP);

                Buffer.Draw(Border, Color.Black);

                j++;
            }

                return Buffer;
        }
예제 #45
0
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width, Height);

            Buffer.Blit(Background.Render(),new Point(0,0));

            Buffer.Blit(WinBar.Render(),new Point(0,0));

            Buffer.Blit(labelPhyDmg.Render(), labelPhyDmg.GetPoint());
            Buffer.Blit(labelMagDmg.Render(), labelMagDmg.GetPoint());
            Buffer.Blit(labelCritDmg.Render(), labelCritDmg.GetPoint());
            Buffer.Blit(labelCritTimes.Render(), labelCritTimes.GetPoint());
            Buffer.Blit(labelGoldStolen.Render(), labelGoldStolen.GetPoint());

            if (bOk.GetRect(GetPoint()).Contains(MousePos))
            {
                Buffer.Blit(bOk.RenderHighlight(), bOk.GetPoint());
            }
            else
            {
                Buffer.Blit(bOk.Render(), bOk.GetPoint());
            }

            Buffer.AlphaBlending = true;
            Buffer.Alpha = 200;

            return Buffer;
        }
예제 #46
0
        protected override void draw(SdlDotNet.Graphics.Surface s)
        {
            s.Fill(Constants.Color_Background);

            // タイトル
            if (_optSurface == null)
            {
                _optSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_Option, Constants.Color_Strong);
            }
            s.Blit(_optSurface, new Point(Constants.HeaderX, Constants.HeaderY));

            // 今選択中のドメイン
            if (_state == SelectionState.Device)
            {
                s.Fill(new Rectangle(_devHeadRect.Left, _devRect.Top, _devHeadRect.Width, _devRect.Height), Constants.Color_Selection);
            }
            else if (_state == SelectionState.Calibration)
            {
                s.Fill(new Rectangle(_calHeadRect.Left, _calMenuRect.Top, _calHeadRect.Width, _calMenuRect.Height), Constants.Color_Selection);
            }

            // Audio Device / Calibration Header
            if (_devHeadSurface == null)
            {
                _devHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_AudioDevices, Constants.Color_Foreground);
            }
            s.Blit(_devHeadSurface, _devHeadRect.Location);

            if (_calHeadSurface == null)
            {
                _calHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_Calibration, Constants.Color_Foreground);
            }
            s.Blit(_calHeadSurface, _calHeadRect.Location);

            if (_expSurface == null)
            {
                _expSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Explanation_Calibration, Constants.Color_Strong);
            }
            s.Blit(_expSurface, new Point(_calHeadRect.X, _calRect.Y));

            // 選択肢
            ImageUtil.DrawSelections(s, _endHeadSurfaces, _endHeadRects, _headCursor,
                                     _endHeadRect.Location,
                                     (_state == SelectionState.Back ? 0 : -1), MenuItemAlign.TopLeft);

            ImageUtil.DrawSelections(s, _calSurfaces, _calRects, _cursor,
                                     _calMenuRect.Location,
                                     (_state == SelectionState.Calibration ? _calSelectedIdx : -1),
                                     MenuItemAlign.TopLeft);

            ImageUtil.DrawSelections(s, _devDrawSurfaces, _devDrawRects, _cursor,
                                     _devRect.Location,
                                     _devSelectedIdx - _devDrawFirstIdx,
                                     MenuItemAlign.TopLeft);

            // 高音・低音の値
            Surface hs      = _calSurfaces[0];
            Surface ls      = _calSurfaces[1];
            double  maxFreq = Config.Instance.MaxFreq;
            double  minFreq = Config.Instance.MinFreq;

            if (_isCalStarted)
            {
                switch (_calSelectedIdx)
                {
                case IDX_MAXPITCH:
                    maxFreq = getAvgValue(IDX_MAXPITCH);
                    break;

                case IDX_MINPITCH:
                    minFreq = getAvgValue(IDX_MINPITCH);
                    break;
                }
            }
            using (Surface ts = ResourceManager.SmallPFont.Render(maxFreq.ToString("F1"), Constants.Color_Foreground))
            {
                s.Blit(ts, new Point(_calRects[0].X + hs.Width + _calMenuRect.X + 10, _calRects[0].Y + _calMenuRect.Y));
            }
            using (Surface ts = ResourceManager.SmallPFont.Render(minFreq.ToString("F1"), Constants.Color_Foreground))
            {
                s.Blit(ts,
                       new Point(_calRects[1].X + ls.Width + _calMenuRect.X + 10, _calRects[1].Y + _calMenuRect.Y));
            }

            // 計測中かどうか
            if (_isCalStarted)
            {
                using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Calibrating, Constants.Color_Strong))
                {
                    s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom));
                }
            }

            // 波形
            if (_audioInput.Capturing)
            {
                using (Surface ts = ResourceManager.SmallTTFont.Render(
                           _curToneResult.ToString(), Constants.Color_Strong))
                {
                    s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom + ResourceManager.SmallPFont.Height + 5));
                }
                drawWave(s, _parent.PitchResult, _parent.ToneResult, ResourceManager.SmallTTFont, _calWaveRect);
            }
        }
예제 #47
0
파일: Scene.cs 프로젝트: davinx/PitchPitch
        public virtual void SetAlert(bool on, string message)
        {
            _onAlert = on;
            if (_onAlert && string.IsNullOrEmpty(message)) _onAlert = false;
            if (_alertSurface != null) _alertSurface.Dispose();
            if (!_onAlert) _alertSurface = null;

            if (_onAlert)
            {
                message += "\n\n" + Properties.Resources.Str_AlertTail;
                string[] lines = message.Split('\n');
                Size[] sizes = Array.ConvertAll<string, Size>(lines, (l) => { return ResourceManager.SmallPFont.SizeText(l); });

                int maxWidth = 0; int height = 0;
                foreach (Size s in sizes)
                {
                    if (maxWidth < s.Width) maxWidth = s.Width;
                    height += (int)(s.Height * Constants.LineHeight);
                }

                _alertSurface = new Surface(maxWidth + Constants.WindowPadding * 2, height + Constants.WindowPadding * 2);
                SdlDotNet.Graphics.Primitives.Box box = new SdlDotNet.Graphics.Primitives.Box(
                    Point.Empty, new Size(maxWidth + Constants.WindowPadding * 2 - 1, height + Constants.WindowPadding * 2 - 1));

                _alertSurface.Lock();
                _alertSurface.Draw(box, Constants.Color_AlertBackground, false, true);
                _alertSurface.Draw(box, Constants.Color_AlertForeground, false, false);
                _alertSurface.Unlock();

                int y = Constants.WindowPadding; int idx = 0;
                foreach (string l in lines)
                {
                    using (Surface ts = ResourceManager.SmallPFont.Render(l, Constants.Color_AlertForeground))
                    {
                        if (idx == lines.Length - 1)
                        {
                            _alertSurface.Blit(ts, new Point((int)(_alertSurface.Width / 2.0 - ts.Width / 2.0), y));
                        }
                        else
                        {
                            _alertSurface.Blit(ts, new Point(Constants.WindowPadding, y));
                        }
                        y += (int)(ts.Height * Constants.LineHeight);
                    }
                    idx++;
                }
                _alertSurface.Update();
            }
        }
예제 #48
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            dstSrf.Blit(mBackground, this.ScreenLocation);

            base.Update(dstSrf, e);
        }
예제 #49
0
 private void DrawBackground(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     mBackground.Fill(Color.White);
     dstSrf.Blit(mBackground, new Point(this.ScreenLocation.X, this.ScreenLocation.Y + buttonHeight));
 }