protected override void draw(Surface s)
        {
            // ゲームオーバー時画面
            if (_prevSurface == null)
            {
                _prevSurface               = new Surface(s);
                _prevSurface.Transparent   = true;
                _prevSurface.AlphaBlending = true;
                _prevSurface.Alpha         = 64;
            }

            s.Fill(_backColor);
            s.Blit(_prevSurface);

            // 画像
            s.Blit(_overImgSurface, new Point(s.Size.Width - _overImgSurface.Width - 60, s.Size.Height - _overImgSurface.Height - 60));

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

            // メニュー
            ImageUtil.DrawSelections(s, _menuSurfaces, _menuRects, _cursor,
                                     new Point(Constants.HeaderX + Constants.UnderHeaderMargin + Constants.CursorMargin,
                                               Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin),
                                     _selectedIdx, MenuItemAlign.TopLeft);
        }
Esempio n. 2
0
        /// <summary>
        /// 画面の描画処理
        /// </summary>
        /// <param name="s">画面</param>
        public void Draw(Surface s)
        {
            try
            {
                if (_transitionStart)
                {
                    if (_transitionBeforeSurface == null)
                    {
                        _transitionBeforeSurface               = new Surface(s);
                        _transitionBeforeSurface.Transparent   = true;
                        _transitionBeforeSurface.AlphaBlending = true;
                        _transitionBeforeSurface.Alpha         = 0;
                    }
                    _transitionBeforeSurface.Alpha = (byte)(255 * _transitionTime / (double)_transitionTimeLong);
                    s.Fill(Constants.Color_Transition);
                    s.Blit(_transitionBeforeSurface);
                }
                else
                {
                    draw(s);
                }
            }
            catch (Exception ex)
            {
                SetAlert(true, ex.Message);
            }

            if (_onAlert && _alertSurface != null)
            {
                s.Blit(_alertSurface, new Point(
                           (int)(Constants.ScreenWidth / 2.0 - _alertSurface.Width / 2.0),
                           (int)(Constants.ScreenHeight / 2.0 - _alertSurface.Height / 2.0)));
            }
        }
Esempio n. 3
0
        public virtual void RenderInformation(Surface s, Rectangle rect)
        {
            // 結果値
            using (Surface sc = new Surface(rect.Size))
            {
                sc.Lock();
                sc.Alpha         = 100;
                sc.AlphaBlending = true;
                sc.Fill(Color.DarkGreen);
                sc.Unlock();
                s.Blit(sc, rect.Location);
            }

            using (Surface sc = new Surface(rect.Size))
            {
                sc.Transparent = true;
                sc.Draw(new SdlDotNet.Graphics.Primitives.Box(Point.Empty, new Size(rect.Width - 1, rect.Height - 1)),
                        Color.White, true, false);
                sc.Blit(ResourceManager.SmallTTFont.Render(
                            string.Format("({0},{1}), {2}x{3}", X, Y, Width, Height),
                            Color.White, true), new Point(10, 10));
                sc.Blit(ResourceManager.SmallTTFont.Render(
                            string.Format("HP: {0}", _hp),
                            Color.White, true), new Point(10, 13 + ResourceManager.SmallTTFont.Height));
                s.Blit(sc, rect.Location);
            }
        }
Esempio n. 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;
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
 private void drawPlayer(Surface dest, int playerNum, int frame, int x, int y, bool small)
 {
     if (small)
     {
         dest.Blit(
             charsSmall[(int)(game.Players[playerNum].Type) - 1],
             new Point(x, y),
             new Rectangle(
                 frame * (SMALLPLAYERWIDTH + SMALLPLAYERBUFFER),
                 (
                     game.Players[playerNum].Highlight ?
                     0 :
                     (int)(game.Players[playerNum].Color) * SMALLPLAYERHEIGHT
                 ),
                 SMALLPLAYERWIDTH,
                 SMALLPLAYERHEIGHT
                 ));
     }
     else
     {
         dest.Blit(
             chars[(int)(game.Players[playerNum].Type) - 1],
             new Point(x, y),
             new Rectangle(
                 frame * (PLAYERWIDTH + PLAYERBUFFER),
                 (
                     game.Players[playerNum].Highlight ?
                     0 :
                     (int)(game.Players[playerNum].Color) * PLAYERHEIGHT
                 ),
                 PLAYERWIDTH,
                 PLAYERHEIGHT
                 ));
     }
 }
Esempio n. 7
0
        public void DrawInfoPanel(Surface surface, LeadActor player, Skin[] skinGroup)
        {
            /* Draws the information panel on the surface.
             *
             *  surface: The area of the surface to draw into from the pygame window: surface class
             *  player: The lead actor being used for the player: lead_actor class
             *  skin_group: The group of skins to be used in the engines isometric view: skin class
             */
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            //draw titlebar
            Rectangle rect = surface.Blit(this.titleSprite.Surface, this.titleSprite.Rectangle);

            int[] draw_order;
            //draw inventory
            Object3d[] inventory_array = new Object3d[player.Inventory.Count];
            for (int i = 0; i < player.Inventory.Count; i++)
            {
                inventory_array[i] = (Object3d)player.Inventory[i];
            }
            if (player.Inventory.Count > 0)
            {
                Sprite[] sprite_group = Sprites.UpdateImages(skinGroup, inventory_array);
                int      p            = 155;
                draw_order = new int[player.Inventory.Count];
                int q = 0;
                for (int i = player.UsingObject; i < player.Inventory.Count; i++)
                {
                    draw_order[q] = i;
                    q++;
                }
                for (int i = 0; i < player.UsingObject; i++)
                {
                    draw_order[q] = i;
                    q++;
                }

                foreach (int i in draw_order)
                {
                    sprite_group[i].X = p;
                    sprite_group[i].Y = 38 - sprite_group[i].Height;
                    surface.Blit(sprite_group[i].Surface, sprite_group[i].Rectangle);
                    Surface text    = this.font.Render(skinGroup[inventory_array[i].ObjectType].Name, Color.FromArgb(255, 255, 255));
                    Point   textpos = new Point(0, 0);
                    textpos.X = p - skinGroup[inventory_array[i].ObjectType].Name.Length * 3 + sprite_group[i].Width / 2;
                    textpos.Y = 35;
                    surface.Blit(text, textpos);
                    p = p + sprite_group[i].Width + 20;
                }
            }
            //Update the display with the panel changes
            surface.Update(rect);
        }
 //A ticker is running to update the sprites constantly.
 //This method will fill the screen with black to clear it of the sprites.
 //Then it will Blit all of the sprites to the screen.
 //Then it will refresh the screen and display it.
 private void Tick(object sender, TickEventArgs args)
 {
     screen.Fill(Color.Black);
     screen.Draw(line, Color.White);
     screen.Blit(this.comboBoxNamespaces);
     screen.Blit(this.listBoxDemos);
     screen.Update();
 }
Esempio n. 9
0
File: Main.cs Progetto: crowell/Door
    private static void ResetScreen()
    {
        //mVideoScreen = Video.SetVideoMode(1366/*width*/, 768/*height*/, false /*resize*/,
        //    false /*opengl*/, true /*fullscreen*/);

        //if (!LoadImages(mBackgroundPath, mForegroundPath)) Environment.Exit(1); //try to load the images, if cant, die
        mVideoScreen.Blit(mBackground);
        //   PrintWelcomeMessage();
        mVideoScreen.Update();
    }
Esempio n. 10
0
        public override void paint(Surface surface, bool focused, Point offset)
        {
            Surface text = DisplaySettings.captionFont.Render(editingValue, DisplaySettings.captionColor);

            Rectangle r = new Rectangle(offset, new Size(Width, text.Height + Compound.BorderPadding.Height * 2));

            surface.Fill(r, DisplaySettings.atomForeground);
            r.X      += Compound.BorderPadding.Width;
            r.Y      += Compound.BorderPadding.Height;
            r.Width  -= Compound.BorderPadding.Width * 2;
            r.Height -= Compound.BorderPadding.Height * 2;
            surface.Fill(r, DisplaySettings.atomBackground);

            r.X     += Compound.Padding;
            r.Width -= Compound.Padding * 2;

            Rectangle oldClipper = surface.ClipRectangle;

            surface.ClipRectangle = r;

            if (focused)
            {
                int startOfText;

                if (text.Width + Compound.Padding + Compound.Seperator > r.Width)
                {
                    startOfText = r.X + r.Width - text.Width - Compound.Seperator - Compound.Padding - 1;
                }
                else
                {
                    startOfText = r.X;
                }

                surface.Blit(text, new Point(startOfText, r.Y));

                if ((SdlDotNet.Core.Timer.SecondsElapsed % 2) == 0)
                {
                    r.X       = startOfText + 1 + text.Width;
                    r.Width   = Compound.Seperator;
                    r.Y      += Compound.Padding;
                    r.Height -= Compound.Padding * 2;

                    surface.Fill(r, DisplaySettings.captionColor);
                }
            }
            else
            {
                surface.Blit(text, r.Location);
            }

            surface.ClipRectangle = oldClipper;
        }
Esempio n. 11
0
 private void blitTiles()
 {
     for (int y = 0; y < m_height; y++)
     {
         for (int x = 0; x < m_width; x++)
         {
             if (m_tiles.ContainsKey(m_grid[x, y]))
             {
                 m_video.Blit(m_tiles[m_grid[x, y]], new Point(x * m_scale, y * m_scale));
             }
         }
     }
 }
Esempio n. 12
0
        public override void paint(Surface surface, bool focused, Point offset)
        {
            Rectangle r = new Rectangle(offset, new Size(Width, DisplaySettings.spinnerArrows.Height));

            surface.Fill(r, DisplaySettings.atomForeground);
            r.X      += Compound.BorderPadding.Width;
            r.Y      += Compound.BorderPadding.Height;
            r.Width  -= Compound.BorderPadding.Width * 2;
            r.Height -= Compound.BorderPadding.Height * 2;
            surface.Fill(r, DisplaySettings.atomBackground);
            DisplaySettings.spinnerArrows.Blit(surface, offset);

            r.Width -= Compound.Padding;

            Surface text = DisplaySettings.captionFont.Render(selection.ToString(), DisplaySettings.captionColor);

            Point p = offset;

            p.X += Compound.Padding + DisplaySettings.spinnerArrows.Width;
            p.Y += (DisplaySettings.spinnerArrows.Height - text.Height) / 2;

            Rectangle oldClipper = surface.ClipRectangle;

            surface.ClipRectangle = r;
            surface.Blit(text, p);
            surface.ClipRectangle = oldClipper;
        }
Esempio n. 13
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);
            }
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        public override Surface RenderSurface()
        {
            this.Surface.Fill(Color.Black);
            foreach (Sprite s in this.Sprites)
            {
                Rectangle offsetRect = s.Rectangle;
                offsetRect.Offset(AdjustBoundedViewport(sprite1, surf1));
                surf1.Blit(s, offsetRect);
                offsetRect = s.Rectangle;
                offsetRect.Offset(AdjustBoundedViewport(sprite2, surf2));
                surf2.Blit(s, offsetRect);
                offsetRect = s.Rectangle;
                offsetRect.Offset(AdjustBoundedViewport(sprite3, surf3));
                surf3.Blit(s, offsetRect);
                offsetRect = s.Rectangle;
                offsetRect.Offset(AdjustBoundedViewport(sprite4, surf4));
                surf4.Blit(s, offsetRect);
            }
            this.Surface.Blit(surf1, new Point(10, 10));
            this.Surface.Blit(surf2, new Point(410, 10));
            this.Surface.Blit(surf3, new Point(10, 280));
            this.Surface.Blit(surf4, new Point(410, 280));

            return(this.Surface);
        }
Esempio n. 15
0
 public override void Draw(Surface sfcGameWindow)
 {
     if (text != null)
     {
         sfcGameWindow.Blit(font.Render(text, colour), new Point((int)x, (int)y));
     }
 }
Esempio n. 16
0
        private Surface CreateSurfaceFromClipRectangle(Surface source, Point pos, Size size)
        {
            Surface Sf = Rendering.Window.Instance.GenerateSurface(size);

            Sf.Blit(source, new Rectangle(pos, size));
            return(Sf);
        }
Esempio n. 17
0
        protected override Surface CreateSurface()
        {
            Surface surf = new Surface(Width, Height);

            int y = 0;

            for (int i = first_visible; i < first_visible + num_visible; i++)
            {
                if (i >= items.Count)
                {
                    break;
                }
                Surface item_surface = GuiUtil.ComposeText(items[i], Font, Palette,
                                                           (!selectable ||
                                                            (!selecting && cursor == i) ||
                                                            (selecting && selectionIndex == i)) ? 4 : 24);

                surf.Blit(item_surface, new Point(0, y));
                y += item_surface.Height;
            }

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

            return(surf);
        }
Esempio n. 18
0
        // ----------------------------------------------------------

        public void Blit(Surface src, Point p)
        {
            Prerender();

            DisplayIcon i = icon;

            if (i == null && defaultIcon)
            {
                i = DisplaySettings.defaultIcon;
            }

            if (i != null)
            {
                Point pI = p;

                if (caption != null)
                {
                    pI.Y += (caption.Height - i.Height) / 2;
                }
                i.Blit(src, pI);
                p.X += Compound.Padding + i.Width;
            }
            else if (sizeWithIcon)
            {
                p.X += Compound.Padding + Compound.IconSize.Width;
            }

            if (caption != null)
            {
                src.Blit(caption, p);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Draw the view to the specified point of the given surface.
        /// </summary>
        public void Draw(Surface target, Point pt)
        {
            try
            {
                UpdateScreen();
            }
            catch //( COMException e )
            {
                //if( DirectDraw.isSurfaceLostException(e) )
                //{
                //	PictureManager.onSurfaceLost(this,null);
                //	updateScreen();	// and retry
                //}
                //else
                //	throw e;	// unable to handle this exception
            }

            // just send the offscreen buffer to the primary surface
            // drawContext will be null if the client size is empty or the window is minimized.
            // no blitting necessary in that case.
            if (drawContext != null)
            {
                target.Blit(pt, drawContext.Surface);
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Draws all surfaces within the collection on the given destination.
        /// </summary>
        /// <param name="destination">The destination surface.</param>
        public virtual Collection <Rectangle> Draw(Surface destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            rects.Clear();
            if (!isSorted)
            {
                this.SortByZAxis();
                this.isSorted = true;
            }

            foreach (Sprite s in this)
            {
                if (s.Visible)
                {
                    rects.Add(s.LastBlitRectangle);
                    s.LastBlitRectangle = destination.Blit(s.Surface, s.Rectangle);
                    rects.Add(s.LastBlitRectangle);
                }
            }
            this.Remove(this.lostSprites);
            return(rects);
        }
Esempio n. 21
0
        public override void paint(Surface surface, bool focused, Point offset)
        {
            if (captionRendered == null)
            {
                captionRendered = new Surface[caption.Length];
                MaxTextWidth    = 0;

                for (int i = 0; i < caption.Length; i++)
                {
                    captionRendered[i] = font.Render(caption[i], color);
                    MaxTextWidth       = System.Math.Max(captionRendered[i].Width, MaxTextWidth);
                }
            }

            Point p = offset;

            for (int i = 0; i < captionRendered.Length; i++)
            {
                if (align == Alignment.RIGHT)
                {
                    p.X = Width - captionRendered[i].Width + offset.X;
                }
                else if (align == Alignment.CENTER)
                {
                    p.X = (Width - captionRendered[i].Width) / 2 + offset.X;
                }

                surface.Blit(captionRendered[i], p);
                p.Y += captionRendered[i].Height;
            }
        }
Esempio n. 22
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();
        }
Esempio n. 23
0
        /// <summary>
        /// 画面の描画処理
        /// </summary>
        /// <param name="s">画面</param>
        protected override void draw(Surface s)
        {
            // 背景枠描画
            s.Fill(_foreColor);

            using (Surface viewSurface = new Surface(_viewRect.Size.Width, _viewRect.Size.Height, 32))
            {
                // マップ描画
                _map.Render(viewSurface, new Rectangle(0, 0, _viewRect.Width, _viewRect.Height));

                // プレイヤー描画
                _parent.Player.Render(viewSurface, convertToViewCoord(_parent.Player.X, _parent.Player.Y).Round());

                if (_isPaused)
                {
                    // ポーズ画面描画
                    renderPause(viewSurface);
                }
                else if (_isCleared)
                {
                    // クリア画面描画
                    renderClear(viewSurface);
                }
                s.Blit(viewSurface, _viewRect.Location);
            }

            // 鍵盤描画
            renderKeyboard(s);

            // ミニマップ描画
            renderMiniMap(s);

            // プレイヤー情報描画
            renderPlayerInformation(s);
        }
Esempio n. 24
0
        public void Blit(Surface sourceSurface, System.Drawing.Point destinationPosition)
        {
            Surface destinationSurface = new Surface((Bitmap)this.Image);

            destinationSurface.Blit(sourceSurface, destinationPosition);
            this.Image = destinationSurface.Bitmap;
        }
Esempio n. 25
0
 void Events_Tick(object sender, TickEventArgs e)
 {
     s.Z  = rand.Next(100);
     s2.Z = rand.Next(100);
     screen.Fill(Color.Black);
     screen.Update(screen.Blit(manager));
 }
Esempio n. 26
0
        public void DrawTitleScreenVGA()
        {
            Rectangle rect = new Rectangle(0, 0, 640, 400);
            Surface   tmp  = Surface.CreateRGBSurface(0, rect.Width, rect.Height, 8, 0, 0, 0, 0);

            tmp.SetSurfacePalette(screen16.Format.palette);

            var bmp        = Properties.Resource.title;
            var bitmapData = bmp.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);

            int[] lookup = new int[bmp.Palette.Entries.Length];
            for (int i = 0; i < lookup.Length; i++)
            {
                lookup[i] = GetColorIndex(npalette, bmp.Palette.Entries[i]);
            }

            byte[] pixels = new byte[rect.Width * rect.Height];
            for (int i = 0; i < pixels.Length; i++)
            {
                pixels[i] = (byte)lookup[Marshal.ReadByte(bitmapData.Scan0, i)];
            }

            Marshal.Copy(pixels, 0, tmp.pixels, pixels.Length);
            bmp.UnlockBits(bitmapData);
            tmp.Blit(IntPtr.Zero, screen16, IntPtr.Zero);
            tmp.Free();
        }
Esempio n. 27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="surface"></param>
        protected override void DrawGameObject(Surface surface)
        {
            Surface image;

            switch (blockType)
            {
            case BlockType.Purple: image = Block.getPurpleBlock(); break;

            case BlockType.Red: image = Block.getRedBlock(); break;

            case BlockType.White: image = Block.getWhiteBlock(); break;

            case BlockType.Yellow: image = Block.getYellowBlock(); break;

            case BlockType.Blue: image = Block.getBlueBlock(); break;

            default: image = Block.getBlueBlock(); break;
            }

            if (!this.Destroy)
            {
                if (image != null)
                {
                    surface.Blit(image, this.ScreenRectangle);
                }
            }
            else
            {
                surface.Fill(this.ScreenRectangle, Color.SlateGray);
            }
        }
Esempio n. 28
0
 /// <summary>
 /// Renders the surface as the particle.
 /// </summary>
 /// <param name="destination">The surface to blit the particle.</param>
 public override void Render(Surface destination)
 {
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     destination.Blit(m_Surface, new Point((int)this.X, (int)this.Y), m_ClipRectangle);
 }
Esempio n. 29
0
        private void UpdateSurface()
        {
            Surface tempSurface = new Surface(this.graphArea.Size);

            tempSurface.Fill(Color.FromArgb(217, 224, 228));
            tempSurface.Blit(this.presentSurface, this.surfaceDisplacement);
            this.graphArea.Blit(tempSurface);
        }
Esempio n. 30
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));
        }
Esempio n. 31
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;
            }
        }
Esempio n. 32
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;
        }
Esempio n. 33
0
        void CreateDropdownSurface()
        {
            dropdownSurface = new Surface (Width, items.Count * Font.LineSize);

            int y = 0;
            for (int i = 0; i < items.Count; i ++) {
                Surface item_surface = GuiUtil.ComposeText (items[i], Font, Palette,
                                        i == selected_item ? 4 : 24);

                item_surface.TransparentColor = Color.Black;

                dropdownSurface.Blit (item_surface, new Point (0, y));
                y += item_surface.Height;
            }
        }
Esempio n. 34
0
        protected override Surface CreateSurface()
        {
            Surface surf = new Surface (Width, Height);

            /* XXX draw the arrow (and border) */

            if (cursor != -1) {
                Surface item_surface = GuiUtil.ComposeText (items[cursor], Font, Palette, 4);

                item_surface.TransparentColor = Color.Black;
                surf.Blit (item_surface, new Point (0, 0));
            }

            return surf;
        }
Esempio n. 35
0
        protected override Surface CreateSurface()
        {
            Surface surf = new Surface (Width, Height);

            int y = 0;
            for (int i = first_visible; i < first_visible + num_visible; i ++) {
                if (i >= items.Count)
                    break;
                Surface item_surface = GuiUtil.ComposeText (items[i], Font, Palette,
                                        (!selectable ||
                                         (!selecting && cursor == i) ||
                                         (selecting && selectionIndex == i)) ? 4 : 24);

                surf.Blit (item_surface, new Point (0, y));
                y += item_surface.Height;
            }

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

            return surf;
        }
Esempio n. 36
0
        public static Surface ComposeText(string text, Fnt font, byte[] palette, int width, int height,
						   int offset)
        {
            if (font == null)
                Console.WriteLine ("aiiiieeee");

            int i;
            /* create a run of text, for now ignoring any control codes in the string */
            StringBuilder run = new StringBuilder ();
            for (i = 0; i < text.Length; i ++)
                if (text[i] == 0x0a /* allow newlines */||
                    !Char.IsControl (text[i]))
                    run.Append (text[i]);

            string rs = run.ToString ();
            byte[] r = Encoding.ASCII.GetBytes (rs);

            int x, y;
            int text_height, text_width;

            /* measure the text first, optionally wrapping at width */
            text_width = text_height = 0;
            x = y = 0;

            for (i = 0; i < r.Length; i ++) {
                int glyph_width = 0;

                if (r[i] != 0x0a) /* newline */ {
                    if (r[i] == 0x20) /* space */
                        glyph_width = font.SpaceSize;
                    else {
                        Glyph g = font[r[i]-1];

                        glyph_width = g.Width + g.XOffset;
                    }
                }

                if (r[i] == 0x0a ||
                    (width != -1 && x + glyph_width > width)) {
                    if (x > text_width)
                        text_width = x;
                    x = 0;
                    text_height += font.LineSize;
                }

                x += glyph_width;
            }

            if (x > text_width)
                text_width = x;
            text_height += font.LineSize;

            Surface surf = new Surface (text_width, text_height);
            surf.TransparentColor = Color.Black;

            /* the draw it */
            x = y = 0;
            for (i = 0; i < r.Length; i ++) {
                int glyph_width = 0;
                Glyph g = null;

                if (r[i] != 0x0a) /* newline */ {
                    if (r[i] == 0x20)  /* space */{
                        glyph_width = font.SpaceSize;
                    }
                    else {
                        g = font[r[i]-1];
                        glyph_width = g.Width + g.XOffset;

                        Surface gs = RenderGlyph (font, g, palette, offset);
                        surf.Blit (gs, new Point (x, y + g.YOffset));
                    }
                }

                if (r[i] == 0x0a ||
                    x + glyph_width > text_width) {
                    x = 0;
                    y += font.LineSize;
                }

                x += glyph_width;
            }

            return surf;
        }
Esempio n. 37
0
        protected override Surface CreateSurface()
        {
            if (player == null || player.Surface == null)
                return null;

            Surface surf;

            surf = new Surface (player.Surface);

            if (scale
                && (player.Width != Width
                || player.Height != Height)) {
                double horiz_zoom = (double)Width / player.Width;
                double vert_zoom = (double)Height / player.Height;
                double zoom;

                if (horiz_zoom < vert_zoom)
                    zoom = horiz_zoom;
                else
                    zoom = vert_zoom;

                surf.Scale (zoom);
            }

            if (dim != 0) {
                Surface dim_surf = new Surface (surf.Size);
                dim_surf.Alpha = dim;
                dim_surf.AlphaBlending = true;
                dim_surf.Blit (surf);
                surf.Dispose ();
                surf = dim_surf;
            }

            return surf;
        }
Esempio n. 38
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));
        }