Пример #1
0
        private static void draw(object sender, TickEventArgs args)
        {
            IVideoSurface.Fill(Color.Black);                                      // flush background black

            Point HeaderPos  = new Point(5, 5);                                   // Point for header drawing
            var   HeaderText = myfont.Render("JAIMaker by XayrGA ", Color.White); // yay me.

            Video.Screen.Blit(HeaderText, HeaderPos);

            Point RAMPos = new Point(150, 5); // Point for header drawing

            var ramstring = string.Format("MEM: {0}MB ", me.PrivateMemorySize / (1024 * 1024));

            if (Root.currentProg != null && Root.currentBank != null)
            {
                ramstring = string.Format("MEM: {0}MB BNK: {1} PRG: {2}", me.PrivateMemorySize / (1024 * 1024), Root.currentBank.id, Root.ProgNumber);
            }

            var RAMText = myfont.Render(ramstring, Color.White); // yay me.

            Video.Screen.Blit(RAMText, RAMPos);

            RAMText.Dispose();
            HeaderText.Dispose();


            IVideoSurface.Update(); // Update the video surface.
        }
Пример #2
0
        /* Various Drawing Functions */
        internal void DrawScreen(SurfaceControl surfaceControl, Tableau tableau)
        {
            surf.Fill(Color.Green);

            DrawCards(tableau);

            if (GameOver == -1)
            {
                Font       = font.Render("You Lose !", Color.Red);
                FontShadow = font.Render("You Lose !", Color.DarkRed);
                surf.Blit(FontShadow, new Point((surf.Width - Font.Width) / 2 + 2, (surf.Height - Font.Height) / 2 + 2));
                surf.Blit(Font, new Point((surf.Width - Font.Width) / 2, (surf.Height - Font.Height) / 2));
            }
            else if (GameOver == 1)
            {
                Font       = font.Render("You Win !", Color.Red);
                FontShadow = font.Render("You Win !", Color.DarkRed);
                surf.Blit(FontShadow, new Point((surf.Width - Font.Width) / 2 + 2, (surf.Height - Font.Height) / 2 + 2));
                surf.Blit(Font, new Point((surf.Width - Font.Width) / 2, (surf.Height - Font.Height) / 2));
            }
            if (tableau.FireworksLeft >= 0)
            {
                particles.Update();
                particles.Render(surf);
            }
            surfaceControl.Blit(surf);
        }
Пример #3
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));
        }
Пример #4
0
 private void DrawGameText(string gameText, int x, int y)
 {
     GameFont       = gameFont.Render(gameText, Color.Red);
     GameFontShadow = gameFont.Render(gameText, Color.DarkRed);
     VideoScreen.Blit(GameFontShadow, new Point(x + 2, y + 2));
     VideoScreen.Blit(GameFont, new Point(x, y));
 }
 private void ShowFinish()
 {
     font         = new SdlDotNet.Graphics.Font(@"Assets\Fonts\Xeranthemum.ttf", 20);
     font_finish  = font.Render("Congratulations, you've saved yourself", Color.White);
     font_finish2 = font.Render("from this horrible appocalypse!", Color.White);
     rectStart    = new Rectangle(new Point(m_Video.Width / 2 - font_finish.Width / 2, m_Video.Height / 3), font_finish.Size);
     rectExit     = new Rectangle(new Point(m_Video.Width / 2 - font_finish2.Width / 2, m_Video.Height - m_Video.Height / 3), font_finish2.Size);
     m_Video.Fill(Color.Black);
     done = true;
     m_Video.Blit(font_finish, new Point(rectStart.X, rectStart.Y));
     m_Video.Blit(font_finish2, new Point(rectExit.X, rectExit.Y));
 }
Пример #6
0
 public Startscreen(Surface video) : base(video)
 {
     titlePosition        = new Point(50, 150);
     controls1Position    = new Point(250, 250);
     controls2Position    = new Point(250, 300);
     controls3Position    = new Point(250, 350);
     continuePosition     = new Point(150, 400);
     keypress             = false;
     Title                = fontBig.Render("Alien Terrorist Killer", Color.CornflowerBlue);
     Controls1            = fontSmall.Render("left/right: Q/D", Color.CornflowerBlue);
     Controls2            = fontSmall.Render("jump: space", Color.CornflowerBlue);
     Controls3            = fontSmall.Render("shoot: mouse click", Color.CornflowerBlue);
     Continue             = fontSmall.Render("PRESS ANY KEY TO CONTINUE", Color.CornflowerBlue);
     Events.KeyboardDown += Events_KeyboardDown;
 }
Пример #7
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;
            }
        }
Пример #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(Surface sfcGameWindow)
 {
     if (text != null)
     {
         sfcGameWindow.Blit(font.Render(text, colour), new Point((int)x, (int)y));
     }
 }
Пример #10
0
        public static void DrawText(RendererDestinationData destData, SdlDotNet.Graphics.Font font, string text, Color textColor, Point destinationPosition)
        {
            Surface textSurface = font.Render(text, textColor);

            destData.Blit(textSurface, destinationPosition);
            textSurface.Close();
        }
Пример #11
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));
 }
Пример #12
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));
        }
Пример #13
0
        private void UpdateTextBuffer()
        {
            try {
                base.Buffer.Fill(mBackColor);
                int addX = mXOffset;
                int addY = mYOffset;
                if (mText != "")
                {
                    if (mMultiLine)
                    {
                        for (int i = 0; i < lines.Length; i++)
                        {
                            base.Buffer.Blit(textSprites[i].Surface, new Point(textSprites[i].X + addX, textSprites[i].Y + addY), new Rectangle(0, 0, this.Width, this.Height));
                        }
                    }
                    else
                    {
                        if (mCentered)
                        {
                            if (mBackColor.A == 0)
                            {
                                Gfx.Surface fontSurf = mFont.Render(mText, mForeColor, mAntiAlias);
                                base.Buffer.Blit(fontSurf, GetCenter(base.Buffer, fontSurf.Size), new Rectangle(0, 0, this.Width, this.Height));
                            }
                            else
                            {
                                base.Buffer.Blit(mFont.Render(mText, mForeColor, mBackColor, mAntiAlias), new Point(addX, addY), new Rectangle(0, 0, this.Width, this.Height));
                            }
                        }
                        else
                        {
                            if (mBackColor.A == 0)
                            {
                                base.Buffer.Blit(mFont.Render(mText, mForeColor, mAntiAlias), new Point(addX, addY), new Rectangle(0, 0, this.Width, this.Height));
                            }
                            else
                            {
                                base.Buffer.Blit(mFont.Render(mText, mForeColor, mBackColor, mAntiAlias), new Point(addX, addY), new Rectangle(0, 0, this.Width, this.Height));
                            }
                        }
                    }
                }

                DrawBorder();
            } catch {}
        }
Пример #14
0
 public Endscreen(Surface video) : base(video)
 {
     CreateWorld();
     keypress             = false;
     thanksMessage        = fontBig.Render("thanks for playing", Color.CornflowerBlue);
     exitMessage          = fontSmall.Render("press escape to exit the game", Color.CornflowerBlue);
     escape               = SdlDotNet.Input.Key.Escape;
     Events.KeyboardDown += Events_KeyboardDown;
 }
Пример #15
0
        internal void SetText(string text)
        {
            fontSurface = textFont.Render(text, Color.Black, false);

            int px = this.Rectangle.Width / 2 - (fontSurface.Width / 2);
            int py = this.Rectangle.Height / 2 - (fontSurface.Height / 2);

            this.Surface.Blit(fontSurface, new Point(px, py));
        }
Пример #16
0
        public void Update()
        {
            if (!hero.win)
            {
                hero.Update(this);
            }

            if (!hero.dead)
            {
                for (int i = 0; i < rocketList.Count; i++)
                {
                    rocketList[i].UpdatePosition(this);
                }
                for (int i = 0; i < rocketList.Count; i++)
                {
                    if (rocketList[i].Y >= video.Height)
                    {
                        rocketList.Remove(rocketList[i]);
                    }
                }
            }

            if (!hero.dead)
            {
                IEnumerable <MovingEnemy> movingEnemyList = spriteArray.OfType <MovingEnemy>();
                foreach (MovingEnemy movingEnemy in movingEnemyList)
                {
                    movingEnemy.UpdatePosition(this);
                }
                tellerCannon++;
                IEnumerable <Cannon> cannonList = spriteArray.OfType <Cannon>();
                foreach (Cannon cannon in cannonList)
                {
                    if (tellerCannon % 20 == 0)
                    {
                        rocketList.Add(new Rocket(cannon.X - cannon.Width, cannon.Y, video));
                    }
                }
            }



            coinCountSurface = font.Render(Convert.ToString(CoinCount), Color.White);
        }
Пример #17
0
 private static void DispSDLText(Surface screen, string text, int x, int y)
 {
     mTextSurface = mFont.Render(text, Color.Red); //hardcoded, but should look up from a location
     if (x == -1)
     {
         x = mVideoScreen.Width / 2 - mTextSurface.Width / 2 + 2;
     }
     mVideoScreen.Blit(mTextSurface, new Point(x, y));
     mVideoScreen.Update();
 }
Пример #18
0
 private void HomeScreen()
 {
     if (!done)                                                                         // build homescreen
     {
         font       = new SdlDotNet.Graphics.Font(@"Assets\Fonts\Xeranthemum.ttf", 45); //      font type, font size
         font_start = font.Render("START", Color.White);
         font_exit  = font.Render("EXIT", Color.White);
         m_menuItemsList.Add(font_start);
         m_menuItemsList.Add(font_exit);
         rectStart = new Rectangle(new Point(m_Video.Width / 2 - font_start.Width / 2, m_Video.Height / 3), font_start.Size);                // startknop aanmaken
         rectExit  = new Rectangle(new Point(m_Video.Width / 2 - font_exit.Width / 2, m_Video.Height - m_Video.Height / 3), font_exit.Size); // exitknop
         rectMenuItemsList.Add(rectStart);                                                                                                   // knoppen worden in een rectangle lijst gestoken om te kunnen reageren op mouse input
         rectMenuItemsList.Add(rectExit);
         m_Video.Blit(background);
         done = true;
     }
     m_Video.Blit(font_start, new Point(rectStart.X, rectStart.Y));
     m_Video.Blit(font_exit, new Point(rectExit.X, rectExit.Y));
 }
Пример #19
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);
        }
Пример #20
0
 /// <summary>
 /// Initializes the OpenGL system
 /// </summary>
 protected void InitGL()
 {
     // Reset The Current Viewport
     Gl.glViewport(0, 0, width, height);
     // Select The Projection Matrix
     Gl.glMatrixMode(Gl.GL_PROJECTION);
     // Reset The Projection Matrix
     Gl.glLoadIdentity();
     Gl.glOrtho(-2.0, 2.0, -2.0, 2.0, -20.0, 20.0);
     // Select The Modelview Matrix
     Gl.glMatrixMode(Gl.GL_MODELVIEW);
     // Reset The Modelview Matrix
     Gl.glLoadIdentity();
     // Enable Smooth Shading
     Gl.glShadeModel(Gl.GL_SMOOTH);
     // Enables Depth Testing
     Gl.glEnable(Gl.GL_DEPTH_TEST);
     // The Type Of Depth Testing To Do
     Gl.glDepthFunc(Gl.GL_LEQUAL);
     // Really Nice Perspective Calculations
     Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
     surfaceGl1 = new SurfaceGl(font.Render(phrase1, Color.White, Color.Black));
     surfaceGl2 = new SurfaceGl(font.Render(phrase2, Color.White, Color.Black));
     surfaceGl3 = new SurfaceGl(font.Render(phrase3, Color.White, Color.Black));
 }
Пример #21
0
 public void RenderText()
 {
     if (selected)
     {
         colour = colourSelected;
     }
     else
     {
         colour = colourNotSelected;
     }
     sfcText = font.Render(text, colour);
     width   = sfcText.Width;
     height  = sfcText.Height;
 }
Пример #22
0
 public IntroScreen(Surface video)
 {
     title            = new Surface(@"Sprites\intro\FairMario.png");
     mario            = new Surface(@"Sprites\intro\introLeft.png");
     un               = new Surface(@"Sprites\intro\UN.png");
     unPosition       = new Point(250, 0);
     position         = new Point(0, 120);
     visibleRectangle = new Rectangle(0, 0, 171, mario.Height);
     this.video       = video;
     ended            = false;
     playTxt          = new SdlDotNet.Graphics.Font(@"Sprites\8-BIT WONDER.TTF", 35);
     play             = playTxt.Render("Start game", Color.Black);
     playPoint        = new Point(video.Width / 2 - play.Width / 2, video.Height / 2 - 3 * play.Height / 2);
 }
Пример #23
0
        public static void DrawMultilineString(Surface s, string[] lines, SdlDotNet.Graphics.Font font, Color c, Point p)
        {
            int y  = p.Y;
            int fh = (int)(font.Height * Constants.LineHeight);

            foreach (string line in lines)
            {
                if (!string.IsNullOrEmpty(line))
                {
                    using (Surface ts = font.Render(line, c))
                    {
                        s.Blit(ts, new Point(p.X, y));
                    }
                }
                y += fh;
            }
        }
Пример #24
0
        public static void CreateStrMenu(string[] items, Color c, SdlDotNet.Graphics.Font font, ref SurfaceCollection surfaces, ref Rectangle[] rects, int width = 300, int height = 30)
        {
            int y = 0; int idx = 0;

            if (height < 0)
            {
                height = (int)(font.Height * Constants.MenuLineHeight);
            }
            foreach (string mi in items)
            {
                Surface s = font.Render(mi, c, true);
                surfaces.Add(s);
                Rectangle r = new Rectangle(0, y, width, height);
                y            = r.Bottom;
                rects[idx++] = r;
            }
        }
Пример #25
0
        private void KeyboardDown(object sender, KeyboardEventArgs e)
        {
            screen.Fill(new Rectangle(0, 0, width, height), Color.Black);
            // Check if the key pressed was a Q or Escape
            if (e.Key == Key.Escape || e.Key == Key.Q)
            {
                Events.QuitApplication();
            }
            eventText  = "key: " + e.Key.ToString() + " char? " + e.KeyboardCharacter;
            font.Style = Styles.Bold;
            text       = font.Render(eventText, Color.Red, true);
            screen.Blit(text, new Rectangle(new Point(0, curY), text.Size));

            keyProcessAndRepaint(e.Key);
            Game.draw();
            screen.Update();
            //curY += 20;
        }
Пример #26
0
 /// <summary>
 /// Creates a new TextSprite given the text, font, color, anti-aliasing flag and position.
 /// </summary>
 /// <param name="textItem">Text to display</param>
 /// <param name="font">The font to use when rendering.</param>
 /// <param name="color">Color of Text</param>
 /// <param name="antiAlias">A flag determining if it's to use anti-aliasing when rendering. Defaults to true.</param>
 /// <param name="position">Position of Sprite</param>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Color color,
     bool antiAlias,
     Point position)
     : base()
 {
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     base.Surface   = font.Render(textItem, color);
     this.textItem  = textItem;
     this.font      = font;
     this.color     = color;
     this.antiAlias = antiAlias;
     base.Position  = position;
     this.RenderInternal();
 }
Пример #27
0
        private void Events_TickEvent(object sender, TickEventArgs e)
        {
            try
            {
                font.Style = (Styles)styleArray[rand.Next(styleArray.Length)];
                text       = font.Render(
                    textArray[rand.Next(textArray.Length)],
                    Color.FromArgb(0, (byte)rand.Next(255),
                                   (byte)rand.Next(255), (byte)rand.Next(255)));

                switch (rand.Next(4))
                {
                case 1:
                    text = text.CreateFlippedVerticalSurface();
                    break;

                case 2:
                    text = text.CreateFlippedHorizontalSurface();
                    break;

                case 3:
                    text = text.CreateRotatedSurface(rand.Next(360));
                    break;

                default:
                    break;
                }

                screen.Blit(
                    text,
                    new Rectangle(new Point(rand.Next(width - 100), rand.Next(height - 100)),
                                  text.Size));
                screen.Update();
                Thread.Sleep(500);
            }
            catch
            {
                //sdl.Dispose();
                throw;
            }
        }
Пример #28
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);
     }
 }
Пример #29
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));
 }
Пример #30
0
        public void Init()
        {
            //Init position of items in list
            /*
            itemY[0] = startY;
            itemY[1] = startY+12;//+12
            itemY[2] = startY+27;//+15
            itemY[3] = startY+42;//+15
            itemY[4] = startY+60;//+18
            itemY[5] = startY+80;//+20
            itemY[6] = startY+102;//+22
            itemY[7] = startY+126;//+24
            itemY[8] = startY+152;//+26
            itemY[9] = startY+184;//+32
            itemY[10] = startY+220;//+36 // center item
            itemY[11] = startY+266;//+46
            itemY[12] = startY+302;//+36
            itemY[13] = startY+334;//+32
            itemY[14] = startY+360;//+26
            itemY[15] = startY+384;//+24
            itemY[16] = startY+406;//+22
            itemY[17] = startY+426;//+20
            itemY[18] = startY+444;//+18
            itemY[19] = startY+459;//+15
            itemY[20] = startY+471;//+12
            */

            itemY[0] = startY;
            itemY[1] = startY+16;//+16
            itemY[2] = startY+35;//+19
            itemY[3] = startY+54;//+19
            itemY[4] = startY+76;//+22
            itemY[5] = startY+100;//+24
            itemY[6] = startY+126;//+26
            itemY[7] = startY+154;//+28
            itemY[8] = startY+184;//+30
            itemY[9] = startY+220;//+36
            itemY[10] = startY+260;//+40 // center item
            itemY[11] = startY+310;//+50
            itemY[12] = startY+350;//+40
            itemY[13] = startY+386;//+36
            itemY[14] = startY+416;//+30
            itemY[15] = startY+444;//+28
            itemY[16] = startY+470;//+26
            itemY[17] = startY+494;//+24
            itemY[18] = startY+516;//+22
            itemY[19] = startY+535;//+19
            itemY[20] = startY+554;//+19

            itemX[0] = startX;
            itemX[1] = startX+3;
            itemX[2] = startX+6;
            itemX[3] = startX+9;
            itemX[4] = startX+12;
            itemX[5] = startX+15;
            itemX[6] = startX+18;
            itemX[7] = startX+21;
            itemX[8] = startX+24;
            itemX[9] = startX+27;
            itemX[10] = startX+30;// center item
            itemX[11] = startX+27;
            itemX[12] = startX+24;
            itemX[13] = startX+21;
            itemX[14] = startX+18;
            itemX[15] = startX+15;
            itemX[16] = startX+12;
            itemX[17] = startX+9;
            itemX[18] = startX+6;
            itemX[19] = startX+3;
            itemX[20] = startX;

            sfError = new Surface (new Size (1, 1));
            sfErrorBackground = new Surface (new Size (1, 1));
            try {
                changeGame = new Sound (ConfigurationSettings.AppSettings ["ChangeGameSound"]);
                changeEmulator = new Sound (ConfigurationSettings.AppSettings ["ChangeEmulatorSound"]);
                music = new Sound (ConfigurationSettings.AppSettings ["MusicSound"]);
            } catch (Exception ex) {
                displayError = true;
                errorMessage += "Problem loading sounds, file may be missing... \n";
            }
            if (ConfigurationSettings.AppSettings ["PlayMusic"] == "true") {
                music.Play (true);
            }
            time = SdlDotNet.Core.Timer.TicksElapsed;
            emulators [0] = "Mame";
            emulators [1] = "Snes";
            rand = new Random ();
            currentEmulator = 0;
            try {
                _sfTitle = new Surface (ConfigurationSettings.AppSettings ["ApplicationLogo"]);
            } catch (Exception ex) {
                displayError = true;
                errorMessage += "Problem loading logo, file may be missing... \n";
                _sfTitle = new Surface (new Size (1, 1));
            }
            _ptTitle.X = (ScreenManager.ScreenSize.Width -
                _sfTitle.Width) / 2;
            _ptTitle.Y = 10;
            sfBackgroundImage = new Surface (ConfigurationSettings.AppSettings ["BackgroundImage"]);
            currentIndex = 0;
            // We load the mame game list
            switchEmulator ();
            fontXXSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 8);
            fontXSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 10);
            fontSmall = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 13);
            fontNormal = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 16);
            fontMedium = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 20);
            fontLarge = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 24);
            fontXL = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 32);
            fontXXL = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 44);

            font8 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 8);
            font10 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 10);
            font12 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 12);
            font14 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 14);
            font16 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 16);
            font18 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 18);
            font20 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 20);
            font24 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 24);
            font28 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 28);
            font32 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 32);
            font36 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 36);
            font40 = new SdlDotNet.Graphics.Font (ConfigurationSettings.AppSettings ["FontFile"], 40);
            //init starfield
            for (int i=0; i<512; i++) {
                starsX [i] = rand.Next (-1000, 1000);
                starsY [i] = rand.Next (-1000, 1000);
                starsZ [i] = rand.Next (100, 1000);
                starsZV [i] = rand.Next (1, 8);
            }
            pixels = new Surface (new Size (1280, 1024));
            if (displayError == true) {
                sfError = fontNormal.Render (errorMessage, Color.White);
                sfErrorBackground = new Surface (new Size (sfError.Width + 40, sfError.Height + 40));
                sfErrorBackground.Fill (Color.Gray);
                sfErrorBackground.Blit (sfError, new Point (((sfErrorBackground.Width - sfError.Width) / 2), 20));
                ScreenManager.MainScreen.Blit (sfErrorBackground, new Point (((ScreenManager.MainScreen.Width - sfErrorBackground.Width) / 2), 250));
            }
        }
Пример #31
0
        private void tick(object sender, TickEventArgs e)
        {
            video.Fill(Color.Black);

            drawLines();

            elapsed += e.SecondsElapsed;

            Video.WindowCaption = $"CanBusDisplay {elapsed}";

            SdlDotNet.Graphics.Font f = new SdlDotNet.Graphics.Font("C:\\Windows\\Fonts\\ARIAL.TTF", 20);

            // TODO: only update values on specified interval?

            foreach (Display d in config.Displays)
            {
                switch (d.Type)
                {
                case "text":
                    video.Blit(f.Render(d.Label, Color.FromName(d.Colour)), new Point(d.Location[0], d.Location[1]));
                    break;

                case "byte":
                    byte valByte = source.Data[int.Parse(d.Value[0], NumberStyles.HexNumber)][int.Parse(d.Value[1], NumberStyles.HexNumber)];
                    if (d.Graph)
                    {
                        queue(valByte, history[d.Label]);
                        drawGraph(history[d.Label], Color.FromName(d.Colour), d.Min, d.Max);
                    }
                    if (d.Location != null)
                    {
                        video.Blit(f.Render($"{d.Label} {valByte}", Color.FromName(d.Colour)), new Point(d.Location[0], d.Location[1]));
                    }
                    break;

                case "word":
                    byte hi      = source.Data[int.Parse(d.Value[0], NumberStyles.HexNumber)][int.Parse(d.Value[1], NumberStyles.HexNumber)];
                    byte lo      = source.Data[int.Parse(d.Value[2], NumberStyles.HexNumber)][int.Parse(d.Value[3], NumberStyles.HexNumber)];
                    int  valWord = hi << 8 | lo;
                    if (d.Scale != 0)
                    {
                        valWord = (int)(valWord * d.Scale);
                    }
                    if (d.Offset != 0)
                    {
                        valWord += d.Offset;
                    }
                    if (d.Graph)
                    {
                        queue(valWord, history[d.Label]);
                        drawGraph(history[d.Label], Color.FromName(d.Colour), d.Min, d.Max);
                    }
                    if (d.Location != null)
                    {
                        video.Blit(f.Render($"{d.Label} {valWord}", Color.FromName(d.Colour)), new Point(d.Location[0], d.Location[1]));
                    }
                    break;
                }
            }

            //video.Blit(f.Render($"ABS FL {source.ABSSpeedFL}", Color.Red), new Point(0, 140));
            //video.Blit(f.Render($"ABS FR {source.ABSSpeedFR}", Color.Red), new Point(0, 160));
            //video.Blit(f.Render($"ABS RL {source.ABSSpeedRL}", Color.Red), new Point(0, 180));
            //video.Blit(f.Render($"ABS RR {source.ABSSpeedRR}", Color.Red), new Point(0, 200));

            //video.Blit(f.Render($"MIL {source.MIL}", Color.Red), new Point(300, 20));

            video.Update();
        }
Пример #32
0
        private void Events_Tick(object sender, TickEventArgs e)
        {
            int gridSize = 200;
            int gridStep = 10;

            m_video.Fill(Color.Black);

            // update sim
            if (m_demo)
            {
                m_simulator.Update(e.SecondsElapsed);
            }
            else
            {
                m_simulator.Update(e.SecondsElapsed, m_xMove, m_yMove, m_zMove);
            }

            Servo[] s = m_simulator.GetServos();

            // origin (A) (side)
            Point sideA = new Point(550, 150);

            drawGrid(sideA.X - gridStep, sideA.Y - (gridSize / 2), gridSize, gridStep, "X-Y plane (rear, follows plane)");

            // knee (B) (side)
            double side_bx = Math.Cos(degreesToRadians(s[1].Angle)) * AB; // a = cos(theta)*h
            double side_by = Math.Sin(degreesToRadians(s[1].Angle)) * AB; // o = sin(theta)*h
            Point  sideB   = new Point((int)(side_bx * m_multiplier) + sideA.X, sideA.Y - (int)(side_by * m_multiplier));

            // foot (C) (side)
            double side_cx = Math.Sqrt(Math.Pow(m_simulator.X, 2) + Math.Pow(m_simulator.Y, 2));
            double side_cy = m_simulator.Z;
            Point  sideC   = new Point((int)(side_cx * m_multiplier) + sideA.X, sideA.Y - (int)(side_cy * m_multiplier));

            // draw AC (rear)
            m_video.Draw(new Line(sideA, sideC), Color.Green, true);
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0}) {2:0.00}°", 0, 0, s[1].Angle), Color.Red), sideA);

            // draw AB (rear)
            m_video.Draw(new Line(sideA, sideB), Color.Red, true);
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0}) {2:0.00}°", side_bx, side_by, s[2].Angle), Color.Blue), sideB);

            // draw BC (rear)
            m_video.Draw(new Line(sideB, sideC), Color.Blue, true);
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0})", side_cx, side_cy), Color.Green), sideC);

            // origin (A) (top)
            Point topA = new Point(sideA.X, sideA.Y + gridSize + (gridStep * 2));

            drawGrid(topA.X - gridStep, topA.Y - (gridSize / 2), gridSize, gridStep, "Z plane (above)");

            // knee (B) (top)
            double top_bh = side_bx;
            double top_bx = Math.Cos(degreesToRadians(s[0].Angle)) * top_bh; // cos(theta) * h = a
            double top_by = Math.Sin(degreesToRadians(s[0].Angle)) * top_bh; // sin(theta) * h = o
            Point  topB   = new Point((int)(top_bx * m_multiplier) + topA.X, topA.Y - (int)(top_by * m_multiplier));

            // foot (C) (top)
            double top_ch = side_cx;
            double top_cx = Math.Cos(degreesToRadians(s[0].Angle)) * top_ch; // cos(theta) * h = a
            double top_cy = Math.Sin(degreesToRadians(s[0].Angle)) * top_ch; // sin(theta) * h = o
            Point  topC   = new Point((int)(top_cx * m_multiplier) + topA.X, topA.Y - (int)(top_cy * m_multiplier));

            // draw BC (top)
            m_video.Draw(new Line(topB, topC), Color.Blue, true);
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0})", top_bx, top_by), Color.Blue), new Point(topB.X, topB.Y - 20));

            // draw AB (top) - draw after BC so it appears on top of
            m_video.Draw(new Line(topA, topB), Color.Red, true);
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0}) {2:0.00}°", 0, 0, s[0].Angle), Color.Red), topA);

            // draw AC (top)
            m_video.Blit(m_font.Render(string.Format("({0:0.0},{1:0.0})", top_cx, top_cy), Color.Green), topC);

            // text
            m_video.Blit(m_font.Render("Inverse Kinematics", Color.White), new Point(50, 50));
            m_video.Blit(m_font.Render(string.Format("Location (w,d,h) {0:0.0},{1:0.0},{2:0.0}", m_simulator.X, m_simulator.Y, m_simulator.Z), Color.White), new Point(50, 70));

            m_video.Blit(m_font.Render(string.Format("s0 (front/back hip) {0:0.00}°", s[0].Angle + 90), Color.White, s[0].Valid ? Color.Black : Color.Red), new Point(50, 90));
            m_video.Blit(m_font.Render(string.Format("s1 (up/down hip) {0:0.00}°", s[1].Angle + 90), Color.White, s[1].Valid ? Color.Black : Color.Red), new Point(50, 110));
            m_video.Blit(m_font.Render(string.Format("s2 (up/down knee) {0:0.00}°", s[2].Angle), Color.White, s[2].Valid ? Color.Black : Color.Red), new Point(50, 130));

            m_video.Blit(m_font.Render(string.Format("Origin location (a) {0:0.0},{1:0.0}", 0, 0), Color.White), new Point(300, 70));
            m_video.Blit(m_font.Render(string.Format("Knee location (b) {0:0.0},{1:0.0}", side_bx, side_by), Color.White), new Point(300, 90));
            m_video.Blit(m_font.Render(string.Format("Foot location (c) {0:0.0},{1:0.0}", side_cx, side_cy), Color.White), new Point(300, 110));
            m_video.Blit(m_font.Render(string.Format("ac_angle {0:0.00}°", 180 - (s[1].Angle + s[2].Angle)), Color.Green), new Point(300, 130));
            m_video.Blit(m_font.Render(string.Format("ab_angle {0:0.00}°", s[1].Angle), Color.Red), new Point(300, 150));
            m_video.Blit(m_font.Render(string.Format("bc_angle {0:0.00}°", s[2].Angle), Color.Blue), new Point(300, 170));

            m_video.Blit(m_font.Render(string.Format("Origin location (a) {0:0.0},{1:0.0}", 0, 0), Color.White), new Point(300, 290));
            m_video.Blit(m_font.Render(string.Format("Knee location (b) {0:0.0},{1:0.0}", top_bx, top_by), Color.White), new Point(300, 310));
            m_video.Blit(m_font.Render(string.Format("Foot location (c) {0:0.0},{1:0.0}", top_cx, top_cy), Color.White), new Point(300, 330));

            // update display
            m_video.Update();
        }
Пример #33
0
        public Demo()
        {

            Events.MouseButtonDown += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(Events_MouseButtonDown);
            Events.MouseButtonUp += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(Events_MouseButtonUp);
            Events.KeyboardDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardDown);
            Events.KeyboardUp += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Events_KeyboardUp);
            Events.MouseMotion += new EventHandler<SdlDotNet.Input.MouseMotionEventArgs>(Events_MouseMotion);
            objects = new List<OpenGlObject>();



            font = new Font(Path.Combine(dataDir, "FreeSans.ttf"), 40);
            font.Bold = true;
            font2 = new Font(Path.Combine(dataDir, "FreeSans.ttf"), 15);
            font2.Bold = true;
            pauseSprite = new SurfaceGl(font.Render("PAUSED", System.Drawing.Color.White, System.Drawing.Color.Black, true));
            upsSprite = new SurfaceGl(font2.Render("UPS:", System.Drawing.Color.White, System.Drawing.Color.Black, true));
            CreateNumbers();

            CreateEngine();
            timer = new PhysicsTimer(Update, .010f);

            CreateBomb();
            CreateAvatar();
            CreateClipper();
            Demo1();
        }
Пример #34
0
        /* Various Drawing Functions */
        internal void DrawScreen(SurfaceControl surfaceControl, PlayState playState, Hand userHand, AI[] computerPlayers,
                                 int[] clicked, bool passing, bool playing, bool showAll)
        {
            surf.Fill(Color.Green);

            name1 = buttonFont.Render(playState.UserName, Color.White);
            name2 = buttonFont.Render(computerPlayers[0].Name, Color.White);
            name3 = buttonFont.Render(computerPlayers[1].Name, Color.White);
            name4 = buttonFont.Render(computerPlayers[2].Name, Color.White);

            if (playing || passing || showAll)
            {
                surf.Blit(name1, new Point(247 - name1.Width, 582 - name1.Height));
                surf.Blit(name2, new Point(15, 114 - name2.Height));
                surf.Blit(name3, new Point(532, 18));
                surf.Blit(name4, new Point(782 - name4.Width, 476));
            }
            int temp = 0;

            for (int i = 0; i < 3; i++)
            {
                if (clicked[i] >= 0)
                {
                    temp++;
                }
            }
            passCount = temp;
            if (passCount == 3 && passing && !playing)
            {
                if (playState.PassingMode == 0)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Left", Color.Black);
                    surf.Blit(passButtonFont, new Point(411, 408));
                }
                if (playState.PassingMode == 1)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Across", Color.Black);
                    surf.Blit(passButtonFont, new Point(403, 408));
                }
                if (playState.PassingMode == 2)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Right", Color.Black);
                    surf.Blit(passButtonFont, new Point(409, 408));
                }
            }
            else if (passing && !playing)
            {
                if (playState.PassingMode == 0)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Left", Color.Gray);
                    surf.Blit(passButtonFont, new Point(411, 408));
                }
                if (playState.PassingMode == 1)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Across", Color.Gray);
                    surf.Blit(passButtonFont, new Point(403, 408));
                }
                if (playState.PassingMode == 2)
                {
                    surf.Blit(passButton, new Point(400, 400));
                    passButtonFont = buttonFont.Render("Pass Right", Color.Gray);
                    surf.Blit(passButtonFont, new Point(409, 408));
                }
            }

            int x = 250, y = 462;

            for (int j = 0; j < userHand.Cards.Count; j++)
            {
                if ((clicked[0] == j || clicked[1] == j || clicked[2] == j) && passing)
                {
                    DrawCardFaceUp(userHand.Cards[j], x, y, true);
                }
                else
                {
                    if (playState.Clicked == j)
                    {
                        DrawInverted(userHand.Cards[j], x, y);
                    }
                    else
                    {
                        DrawCardFaceUp(userHand.Cards[j], x, y, false);
                    }
                }
                x += 20;
            }

            if (!showAll)
            {
                x = 15; y = 120;
                for (int j = computerPlayers[0].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 1, passing, playState.CardsPassingContains(0, j));
                    y += 20;
                }

                x = 450; y = 15;
                for (int j = computerPlayers[1].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 2, passing, playState.CardsPassingContains(1, j));
                    x -= 20;
                }
                x = 706; y = 350;
                for (int j = computerPlayers[2].AIHand.Cards.Count - 1; j >= 0; j--)
                {
                    DrawCardFaceDown(x, y, 3, passing, playState.CardsPassingContains(2, j));
                    y -= 20;
                }
            }
            else
            {
                x = 15; y = 120;
                for (int j = 0; j < computerPlayers[0].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[0].AIHand.Cards[j], x, y, false);
                    y += 20;
                }
                x = 450; y = 15;
                for (int j = 0; j < computerPlayers[1].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[1].AIHand.Cards[j], x, y, false);
                    x -= 20;
                }
                x = 706; y = 350;
                for (int j = 0; j < computerPlayers[2].AIHand.Cards.Count; j++)
                {
                    DrawCardFaceUp(computerPlayers[2].AIHand.Cards[j], x, y, false);
                    y -= 20;
                }
            }

            if (playState.Trick.Count != 0)
            {
                DrawTricks(playState);
            }

            surfaceControl.Blit(surf);
        }