Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this.font != null)
             {
                 this.font.Dispose();
                 this.font = null;
             }
             if (this.surfaceGl1 != null)
             {
                 this.surfaceGl1.Dispose();
                 this.surfaceGl1 = null;
             }
             if (this.surfaceGl2 != null)
             {
                 this.surfaceGl2.Dispose();
                 this.surfaceGl2 = null;
             }
             if (this.surfaceGl3 != null)
             {
                 this.surfaceGl3.Dispose();
                 this.surfaceGl3 = null;
             }
         }
         this.disposed = true;
     }
 }
Пример #2
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));
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="textItem"></param>
 /// <param name="font"></param>
 /// <param name="size"></param>
 /// <param name="coordinates"></param>
 public BoundedTextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Point coordinates)
     : base(textItem, font, coordinates)
 {
 }
Пример #4
0
    //begin functions
    public static void Main(string[] args)
    {
        //init the stringbuilder
        mID2 = new StringBuilder();
        //args are the image(s) to load
        mBackgroundPath = args[0];
        mForegroundPath = args[1];
        if (args.Length > 2 && args[2] == "true") mStringReplace = true;

        //first, try to connect to arduino
        string arduino = GetArduinoSerial();
        if (!ConnectToArduino(arduino))
        {
            //Kill the program because we can't control the door like this
            System.Console.WriteLine("Could not connect to Arduino on port " + arduino);
            //Environment.Exit(1);
        }

        //select the font
        mFont = new SdlDotNet.Graphics.Font(@"font.ttf", 48);
        //set up the screen dimensions
        mVideoScreen = Video.SetVideoMode(1000/*width*/, 600/*height*/, false /*resize*/,
            false /*opengl*/, false /*fullscreen*/);

        //load the images or quit if they can't be loaded
        if (!LoadImages(mBackgroundPath, mForegroundPath)) Environment.Exit(1); //try to load the images, if cant, die

        Events.Fps = 30; //30 fps seems good for this application
        Events.Quit += new EventHandler<QuitEventArgs>(Events_Quit);
        //Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
        //Events.KeyboardDown += new EventHandler<KeyboardEventArgs>(Events_KeyboardDown);
        Events.KeyboardUp += new EventHandler<KeyboardEventArgs>(Events_KeyboardUp);
        PrintWelcomeMessage(); //Prints out the welcome message, should be able to grab updates from a file on disk
        Events.Run();
    }
Пример #5
0
        public Dialogs(Game game)
        {
            this.game = game;
            PropertyReader props = game.loader.GetPropertyReader().Select("dialog/dialog.xml");
            Border = props.GetInt("border");
            string fontName = props.GetString("font");
            int fontSize = props.GetInt("fontsize");
            Font = new SdlDotNet.Graphics.Font(game.loader.LoadRaw("dialog/" + fontName), fontSize);
            bgColor = Color.FromArgb(
                props.GetInt("background/alpha"),
                props.GetInt("background/red"),
                props.GetInt("background/green"),
                props.GetInt("background/blue"));
            selectedBorder = Color.FromArgb(
                props.GetInt("selectedborder/alpha"),
                props.GetInt("selectedborder/red"),
                props.GetInt("selectedborder/green"),
                props.GetInt("selectedborder/blue"));
            selectedBg = Color.FromArgb(
                props.GetInt("selectedbackground/alpha"),
                props.GetInt("selectedbackground/red"),
                props.GetInt("selectedbackground/green"),
                props.GetInt("selectedbackground/blue"));

            TextHeight = Font.SizeText(" ").Height;

            surface = new Surface(game.loader.LoadBitmap("dialog/windowborder.png"));
        }
Пример #6
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));
 }
Пример #7
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (buttonFont != null)
         {
             buttonFont.Dispose();
             buttonFont = null;
         }
         if (passButton != null)
         {
             passButton.Dispose();
             passButton = null;
         }
         if (passDot != null)
         {
             passDot.Dispose();
             passDot = null;
         }
         if (surf != null)
         {
             surf.Dispose();
             surf = null;
         }
         if (drawer != null)
         {
             drawer.Dispose();
             drawer = null;
         }
     }
 }
Пример #8
0
        /* Image Loading Method */
        private void LoadImages()
        {
            squareUnclicked  = new Surface(Properties.Resources.SquareUnclicked).Convert(surf, false, true);
            squareBackground = new Surface(Properties.Resources.SquareBackground).Convert(surf, false, true);

            squareBombFlag                  = new Surface(Properties.Resources.SquareBombFlag).Convert(surf, false, true);
            squareBombFlag.Transparent      = true;
            squareBombFlag.TransparentColor = Color.FromArgb(255, 000, 255);

            squareBomb                  = new Surface(Properties.Resources.SquareBomb).Convert(surf, false, true);
            squareBomb.Transparent      = true;
            squareBomb.TransparentColor = Color.FromArgb(255, 000, 255);

            squareBombExplode                  = new Surface(Properties.Resources.SquareBombExplode).Convert(surf, false, true);
            squareBombExplode.Transparent      = true;
            squareBombExplode.TransparentColor = Color.FromArgb(255, 000, 255);

            squareQuestionFlag                  = new Surface(Properties.Resources.SquareQuestionFlag).Convert(surf, false, true);
            squareQuestionFlag.Transparent      = true;
            squareQuestionFlag.TransparentColor = Color.FromArgb(255, 000, 255);

            squareNotBomb                  = new Surface(Properties.Resources.SquareNotBomb).Convert(surf, false, true);
            squareNotBomb.Transparent      = true;
            squareNotBomb.TransparentColor = Color.FromArgb(255, 000, 255);

            squareError                  = new Surface(Properties.Resources.SquareError).Convert(surf, false, true);
            squareError.Transparent      = true;
            squareError.TransparentColor = Color.FromArgb(255, 000, 255);

            squareClicked = new Surface(Properties.Resources.SquareClicked).Convert(surf, false, true);

            numberFont = new SdlDotNet.Graphics.Font(@"c:\Windows\Fonts\arial.ttf", 20);
        }
Пример #9
0
        public RendererSDL()
        {
            statusTimer          = new System.Timers.Timer(3000);
            statusTimer.Elapsed += new ElapsedEventHandler(statusTimer_Elapsed);

            fpsTimer          = new System.Timers.Timer(1000);
            fpsTimer.Elapsed += new ElapsedEventHandler(fpsTimer_Elapsed);

            statusFont = new SdlDotNet.Graphics.Font(Resources.c64font, 30);
            fpsFont    = new SdlDotNet.Graphics.Font(Resources.c64font, 16);
            menuFont   = new SdlDotNet.Graphics.Font(Resources.c64font, 24);

            statusLight = getTextSprite(statusFont, Color.LightGreen);
            statusDark  = getTextSprite(statusFont, Color.DarkGreen);
            fpsLight    = getTextSprite(fpsFont, Color.White);
            fpsDark     = getTextSprite(fpsFont, Color.Black);

            lastRender = new Color[C64WIDTH, C64HEIGHT];

            invalidateColor = Color.FromArgb(1, 1, 1);

            DisplayFPS = Settings.Default.ShowSpeed;

            Reset(
                Settings.Default.Fullscreen,
                Settings.Default.ResolutionWidth,
                Settings.Default.ResolutionHeight
                );
        }
Пример #10
0
 /// <summary>
 /// Creates a new TextSprite given the text, font and color.
 /// </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>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Color color)
     : this(textItem, font, color, true)
 {
 }
Пример #11
0
 public MenuTextEntry(int _textSize, Color _colour, string _text = "untitled")
 {
     text     = _text;
     textSize = _textSize;
     colour   = _colour;
     font     = new SdlDotNet.Graphics.Font(Constants.Constants.GetResourcePath("arial.ttf"), textSize);
 }
Пример #12
0
 /// <summary>
 /// Creates a new TextSprite given the text, font and position.
 /// </summary>
 /// <param name="textItem"></param>
 /// <param name="font">The font to use when rendering.</param>
 /// <param name="position"></param>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Point position)
     : this(textItem, font, true, position)
 {
 }
Пример #13
0
 private void CheckFont()
 {
     if (font == null)
     {
         font = new Font(SdlDotNet.Widgets.Widgets.DefaultFontPath, SdlDotNet.Widgets.Widgets.DefaultFontSize);
     }
 }
Пример #14
0
 private void CheckFont()
 {
     if (font == null)
     {
         font = FontManager.LoadFont("PMDCP", 24);
     }
 }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        public void Go()
        {
            if (File.Exists(fileName))
            {
                filePath      = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            Events.Tick +=
                new EventHandler <TickEventArgs>(Events_TickEvent);
            Events.KeyboardDown +=
                new EventHandler <KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler <QuitEventArgs>(this.Quit);

            font = new SdlDotNet.Graphics.Font(file, size);
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Font Example";
            screen = Video.SetVideoMode(width, height, true);

            Surface surf = screen.CreateCompatibleSurface(width, height, true);

            surf.Fill(new Rectangle(new Point(0, 0), surf.Size), Color.Black);
            Events.Run();
        }
Пример #16
0
        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);

            Events.Tick +=
                new EventHandler<TickEventArgs>(Events_TickEvent);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);

            font = new SdlDotNet.Graphics.Font(file, size);
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Font Example";
            screen = Video.SetVideoMode(width, height, true);

            Surface surf = screen.CreateCompatibleSurface(width, height, true);
            surf.Fill(new Rectangle(new Point(0, 0), surf.Size), Color.Black);
            Events.Run();
        }
Пример #17
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();
        }
Пример #18
0
 public static void CreateStrMenu(MenuItem[] items, Color c, SdlDotNet.Graphics.Font font, ref SurfaceCollection surfaces, ref Rectangle[] rects, int width = 300, int height = -1)
 {
     CreateStrMenu(Array.ConvertAll <MenuItem, string>(items, (mi) =>
     {
         return(mi.ToString());
     }), c, font, ref surfaces, ref rects, width, height);
 }
Пример #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="player"></param>
        /// <param name="skin_group"></param>
        /// <param name="surface"></param>
        /// <param name="keys"></param>
        /// <param name="titlefile"></param>
        public Engine(LeadActor player, Skin[] skinGroup, Surface surface, Keys keys, string titleFile)
        {
            /* Initialise the Isotope Engine */
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            //Game Control
            //the lower limit of msec per frame
            this.timeLimit = 100;
            //define the keys using default values, users can redefine the keys by changing the key codes
            this.keys = keys;

            //Physical simulation elements
            //this.simulator = new Simulator();
            //Pick the players actor object and remember it
            this.player = player;

            //Graphical display elements
            //load the titlebar graphic as a sprite for drawing later. Users can reload their own image.
            this.titleSprite         = new Sprite();
            this.titleSprite.Surface = new Surface(titleFile);

            int[] offset = { 200, 170 };
            this.display = new View(surface, this.player.Scene, skinGroup, offset);
            //Isometric display elements
            this.skinGroup = skinGroup;
            //remember the surface
            this.surface = surface;

            //Load the default font: Do we need some tester here to ensure we find a font?
            //if (font==None)
            this.font    = new SdlDotNet.Graphics.Font(Path.Combine(IsotopeMain.FilePath, "FreeSans.ttf"), 10);
            Events.Quit += new EventHandler <QuitEventArgs>(Events_Quit);
        }
Пример #20
0
 /// <summary>
 /// Creates a new TextSprite given the text, font, color and anti-aliasing flag.
 /// </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>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Color color, bool antiAlias)
     : this(textItem, font, color, antiAlias, new Point(0, 0))
 {
 }
Пример #21
0
 /// <summary>
 /// Creates a new TextSprite given the text, font, 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="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,
     bool antiAlias,
     Point position)
     : this(textItem, font, Color.White, antiAlias, position)
 {
 }
Пример #22
0
        public Lable(Compound gui, Rectangle bounds, string text, Alignment a, Color c, SdlDotNet.Graphics.Font f)
            : base(gui, bounds, null)
        {
            Text = text;

            font  = f;
            align = a;
            color = c;
        }
Пример #23
0
 /// <summary>
 /// Creates a new TextSprite given the text, font, color and background color.
 /// </summary>
 /// <param name="textItem">Text to display</param>
 /// <param name="font">The font to use when rendering.</param>
 /// <param name="textColor">Text Color</param>
 /// <param name="backgroundColor">Background color</param>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Color textColor,
     Color backgroundColor)
     : this(textItem, font, textColor)
 {
     this.backgroundColor = backgroundColor;
 }
Пример #24
0
        private void LoadImages()
        {
            cellBackground = new Surface(Properties.Resources.CellBackground);
            KingLeft       = new Surface(Properties.Resources.KingLeft);
            KingRight      = new Surface(Properties.Resources.KingRight);
            KingSmile      = new Surface(Properties.Resources.KingSmile);

            font = new SdlDotNet.Graphics.Font(@"c:\Windows\Fonts\arial.ttf", 72);
        }
Пример #25
0
        public void Reset(bool fullscreen, int width, int height)
        {
            isSwitching = true;

            this.fullscreen = fullscreen;

            resetLastBuffer();

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

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

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

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

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

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

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

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

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

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

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

            isSwitching = false;
        }
Пример #26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="textItem"></param>
 /// <param name="font"></param>
 /// <param name="size"></param>
 /// <param name="horizontal"></param>
 /// <param name="vertical"></param>
 public BoundedTextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     double horizontal,
     double vertical)
     : base(textItem, font)
 {
     this.horizontal = horizontal;
     this.vertical   = vertical;
 }
Пример #27
0
        /* Load Images */
        private void LoadImages()
        {
            passDot                  = new Surface(Properties.Resources.passDot);
            passDot.Transparent      = true;
            passDot.TransparentColor = Color.FromArgb(255, 000, 255);

            passButton = new Surface(Properties.Resources.passButton);

            buttonFont = new SdlDotNet.Graphics.Font(@"c:\Windows\Fonts\arial.ttf", 14);
        }
Пример #28
0
        private TextSprite getTextSprite(SdlDotNet.Graphics.Font font, Color color)
        {
            TextSprite ret = new TextSprite(
                " ",
                font,
                color);

            ret.AntiAlias = false;

            return(ret);
        }
Пример #29
0
        public MainTitle()
        {
            this.mainTitleFont = new Font(Configuration.MainTitleFontFilename, Configuration.MainTitleFontSize);
            this.mainTitleSurface = this.mainTitleFont.Render(Configuration.Title, Configuration.MainTitleFontColor, true);

            this.creditMessageFont = new Font(Configuration.CreditMessageFontFilename, Configuration.CreditMessageFontSize);
            this.creditMessageSurface = this.creditMessageFont.Render(Configuration.CreditMessage, Configuration.CreditMessageFontColor, true);

            this.startMessageFont = new Font(Configuration.StartMessageFontFilename, Configuration.StartMessageFontSize);
            this.startMessageSurface = this.startMessageFont.Render(Configuration.StartMessage, Configuration.StartMessageFontColor, true);
        }
Пример #30
0
 /* Constructor */
 internal Button()
 {
     try
     {
         textFont = new SdlDotNet.Graphics.Font(@"c:\Windows\Fonts\trebuc.ttf", 16);
     }
     catch (SdlException)
     {
         textFont = new SdlDotNet.Graphics.Font(@"c:\Windows\Fonts\arial.ttf", 14);
     }
 }
Пример #31
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);
        }
Пример #32
0
 public Textbox()
     : base()
 {
     //mChars = new List<TextBoxChar>();
     mLines = new List<TextboxLine>();
     mFont = Logic.Graphics.FontManager.TextBoxFont;
     mLetterSize = mFont.SizeText(" ");
     mText = new StringBuilder();
     this.OnKeyDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Textbox_OnKeyDown);
     this.OnClick += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(Textbox_OnClick);
     Redraw();
 }
Пример #33
0
 public Textbox()
     : base()
 {
     //mChars = new List<TextBoxChar>();
     mLines          = new List <TextboxLine>();
     mFont           = Logic.Graphics.FontManager.TextBoxFont;
     mLetterSize     = mFont.SizeText(" ");
     mText           = new StringBuilder();
     this.OnKeyDown += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(Textbox_OnKeyDown);
     this.OnClick   += new EventHandler <SdlDotNet.Input.MouseButtonEventArgs>(Textbox_OnClick);
     Redraw();
 }
Пример #34
0
 public static void Init()
 {
     Events.TargetFps     = 60;                                         // 60 fps
     Events.Quit         += (QuitEventHandler);                         // pizzaz, to make it so when we press the exit button it does.
     Events.Tick         += (draw);                                     // Drawing handler
     Events.KeyboardDown += KeyDown;                                    // a
     Events.KeyboardUp   += KeyUp;
     myfont       = new SdlDotNet.Graphics.Font("tahoma.ttf", 12);      // Load the font
     RenderThread = new Thread(new ThreadStart(startDrawWindowThread)); // Create render thread
     me           = Process.GetCurrentProcess();
     RenderThread.Start();                                              // Start it
 }
Пример #35
0
 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));
 }
Пример #36
0
 public void FreeResources()
 {
     if (buffer != null)
     {
         buffer.Close();
         buffer = null;
     }
     if (font != null)
     {
         font.Close();
         font = null;
     }
 }
Пример #37
0
        /// <summary>
        /// 
        /// </summary>
        public void Initialize()
        {
            if (File.Exists(Path.Combine(dataDirectory, "FreeSans.ttf")))
            {
                filePath = "";
            }
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - OpenGlFont Example";
            Video.SetVideoMode(this.width, this.height, true, true);
            Events.KeyboardDown += new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            font = new SdlDotNet.Graphics.Font(Path.Combine(filePath, Path.Combine(dataDirectory, fontName)), 18);
            Video.GLDoubleBufferEnabled = true;

        }
Пример #38
0
        void Initialize(int numberOfSnowflakes)
        {
            for (int i = 0; i < numberOfSnowflakes; i++)
            {
                snowflakes.Add(new Snowflake());
            }
            SdlDotNet.Graphics.Font font = new SdlDotNet.Graphics.Font(Path.Combine(filePath, Path.Combine(dataDirectory, fontName)), 24);

            textItems.Add(new TextItem(textArray[0], font, 25, 0));
            for (int i = 1; i < textArray.Length; i++)
            {
                textItems.Add(
                    new TextItem(textArray[i],
                    font, i * 50,
                    i * 2));
            }
            snowflakes.EnableTickEvent();
            textItems.EnableTickEvent();
        }
Пример #39
0
 /// <summary>
 /// Starts the SDL Renderer
 /// </summary>
 public static void StartRenderer()
 {
     m_VideoScreen = Video.SetVideoMode(500, 500, 32, true, false, false, true, true);
     m_FpsFont = new SdlDotNet.Graphics.Font(@"C:\Windows\Fonts\Arial.ttf", 14);
     #region Events Hooks
     Events.TargetFps = 2000;
     Events.Quit += new EventHandler<QuitEventArgs>(Renderer_Quit);
     Events.Tick += new EventHandler<TickEventArgs>(Renderer_Tick);
     Events.KeyboardDown += new EventHandler<KeyboardEventArgs>(Renderer_KeyDown);
     Keyboard.EnableKeyRepeat(0, 10);
     Keyboard.KeyRepeat = true;
     #endregion
     #region Size
     Rectangle tempRectangle;
     GetWindowRect(Video.WindowHandle, out tempRectangle);
     m_WindowPosition.Left = tempRectangle.Left; m_WindowPosition.Top = tempRectangle.Top;
     m_WindowSize = new Size(tempRectangle.Width, tempRectangle.Height);
     #endregion
     MapManager.BuildWorld();
     m_ViewSpace = MapManager.GetViewSpace(m_ViewSpaceOffset, m_VideoScreen.Size);
     Events.Run();
 }
        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;
        }
Пример #41
0
 private void CheckFont()
 {
     if (font == null) {
         font = new Font(SdlDotNet.Widgets.Widgets.DefaultFontPath, SdlDotNet.Widgets.Widgets.DefaultFontSize);
     }
 }
Пример #42
0
 public Button(Gfx.Font font)
     : base()
 {
     mFont = font;
     Init();
 }
Пример #43
0
 public Button()
     : base()
 {
     mFont = new SdlDotNet.Graphics.Font(IO.IO.CreateOSPath("Fonts\\PMU.ttf"), 12);
     Init();
 }
Пример #44
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();
        }
Пример #45
0
 private void CheckFont()
 {
     if (font == null) {
         font = FontManager.LoadFont("PMDCP", 24);
     }
 }
Пример #46
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this.font != null)
             {
                 this.font.Dispose();
                 this.font = null;
             }
         }
         this.disposed = true;
     }
 }
Пример #47
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));
            }
        }
Пример #48
0
 /// <summary>
 /// Init this instance.
 /// </summary>
 public void Init()
 {
     _bgColor = Color.Beige;
     txtFont = new SdlDotNet.Graphics.Font(ConfigurationSettings.AppSettings["FontFile"],30);
     cpt=0;
 }
Пример #49
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="player"></param>
        /// <param name="skin_group"></param>
        /// <param name="surface"></param>
        /// <param name="keys"></param>
        /// <param name="titlefile"></param>
        public Engine(LeadActor player, Skin[] skinGroup, Surface surface, Keys keys, string titleFile)
        {
            /* Initialise the Isotope Engine */
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            //Game Control
            //the lower limit of msec per frame
            this.timeLimit = 100;
            //define the keys using default values, users can redefine the keys by changing the key codes
            this.keys = keys;

            //Physical simulation elements
            //this.simulator = new Simulator();
            //Pick the players actor object and remember it
            this.player = player;

            //Graphical display elements
            //load the titlebar graphic as a sprite for drawing later. Users can reload their own image.
            this.titleSprite = new Sprite();
            this.titleSprite.Surface = new Surface(titleFile);

            int[] offset ={ 200, 170 };
            this.display = new View(surface, this.player.Scene, skinGroup, offset);
            //Isometric display elements
            this.skinGroup = skinGroup;
            //remember the surface
            this.surface = surface;

            //Load the default font: Do we need some tester here to ensure we find a font?
            //if (font==None)
            this.font = new SdlDotNet.Graphics.Font(Path.Combine(IsotopeMain.FilePath, "FreeSans.ttf"), 10);
            Events.Quit += new EventHandler<QuitEventArgs>(Events_Quit);
        }
Пример #50
0
        public Playfield(int size, string bitmap = "")
        {
            var fpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial.ttf");
            f = new Font(fpath, 10);
            this.size = size;
            _fields = new bool[size, size];
            _pfields = new bool[size, size];
            _ufields = new bool[size, size];

            if (!String.IsNullOrEmpty(bitmap))
            {
                Bitmap bmp = new Bitmap(bitmap);
                _fields = new bool[bmp.Width, bmp.Height];
                _pfields = new bool[bmp.Width, bmp.Height];
                _ufields = new bool[bmp.Width, bmp.Height];

                this.size = bmp.Width;

                for (int row = 0; row < bmp.Height; row++)
                {
                    for (int col = 0; col < bmp.Width; col++)
                    {
                        _fields[col, row] = (bmp.GetPixel(col, row).GetBrightness() > 0.3);
                    }
                }
            }
            else
            {
                for (int row = 0; row < size; row++)
                {
                    for (int col = 0; col < size; col++)
                    {
                        if (Rnd.NextDouble() > 0.4D) _fields[col, row] = true;
                    }
                }
            }
        }
Пример #51
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();
 }
Пример #52
0
 /// <summary>
 /// Destroys the surface object and frees its memory
 /// </summary>
 /// <param name="disposing">If ture, dispose unmanaged resources</param>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (!this.disposed)
         {
             if (disposing)
             {
                 if (this.font != null)
                 {
                     this.font.Dispose();
                     this.font = null;
                 }
             }
             this.disposed = true;
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Пример #53
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));
 }
Пример #54
0
 public MenuText(string _text, Color _selected, Color _notSelected, int _textSize)
 {
     text = _text;
     colourSelected = _selected;
     colourNotSelected = _notSelected;
     textSize = _textSize;
     font = new SdlDotNet.Graphics.Font (Constants.Constants.GetResourcePath("arial.ttf"), textSize);
     colour = colourNotSelected;
     lastSelected = selected;
     RenderText ();
     width = sfcText.Width;
     height = sfcText.Height;
 }
Пример #55
0
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                // We haven't been disposed yet.

                if (disposing)
                {
                    /* The method has been called directly or indirectly by a
                     * user's code.  Dispose of managed resources here.
                     */
                    if (this.mainTitleFont != null)
                    {
                        this.mainTitleFont.Dispose();
                        this.mainTitleFont = null;
                    }

                    if (this.creditMessageFont != null)
                    {
                        this.creditMessageFont.Dispose();
                        this.creditMessageFont = null;
                    }

                    if (this.startMessageFont != null)
                    {
                        this.startMessageFont.Dispose();
                        this.startMessageFont = null;
                    }
                }

                // Dispose of unmanaged resources _only_ out here.

                this.disposed = true;
            }
        }
Пример #56
0
 public MenuTextEntry( int _textSize, Color _colour, string _text="untitled")
 {
     text = _text;
     textSize = _textSize;
     colour = _colour;
     font = new SdlDotNet.Graphics.Font (Constants.Constants.GetResourcePath ("arial.ttf"), textSize);
 }
Пример #57
0
        public Vista(int ancho, int alto)
        {
            pared = new Dictionary<string, Sprite>();
            pared.Add("pared01",new Sprite(new Surface(Resource1.pared01)));
            pared.Add("pared2", new Sprite(new Surface(Resource1.pared2)));
            pared.Add("pared3", new Sprite(new Surface(Resource1.pared3)));
            pared.Add("pared4", new Sprite(new Surface(Resource1.pared4)));
            pared.Add("pared5", new Sprite(new Surface(Resource1.pared5)));

            #region spritesBub
            bub = new Dictionary<string, Sprite>();
            Sprite bubc1 = new Sprite(new Surface(Resource1.bubc1));
            Sprite bubc2 = new Sprite(new Surface(Resource1.bubc2));
            Sprite bubc3 = new Sprite(new Surface(Resource1.bubc3));
            Sprite bubc1i = new Sprite(new Surface(Resource1.bubc1i));
            Sprite bubc2i = new Sprite(new Surface(Resource1.bubc2i));
            Sprite bubc3i = new Sprite(new Surface(Resource1.bubc3i));
            Sprite bubm1 = new Sprite(new Surface(Resource1.bubm1));
            Sprite bubm2 = new Sprite(new Surface(Resource1.bubm2));
            Sprite bubm3 = new Sprite(new Surface(Resource1.bubm3));
            Sprite bubm4 = new Sprite(new Surface(Resource1.bubm4));
            Sprite frente = new Sprite(new Surface(Resource1.bubfte));

            bub.Add("derecha1", bubc1);
            bub.Add("derecha2", bubc2);
            bub.Add("derecha3", bubc3);
            bub.Add("izquierda1", bubc1i);
            bub.Add("izquierda2", bubc2i);
            bub.Add("izquierda3", bubc3i);
            bub.Add("muerto1", bubm1);
            bub.Add("muerto2", bubm2);
            bub.Add("muerto3", bubm3);
            bub.Add("muerto4", bubm4);
            bub.Add("frente", frente);

            foreach (KeyValuePair<string, Sprite> par in bub)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }

            #endregion spritesBub

            #region spritesBob
            bob = new Dictionary<string, Sprite>();

            bubc1 = new Sprite(new Surface(Resource1.bobc1));
            bubc2 = new Sprite(new Surface(Resource1.bobc2));
            bubc3 = new Sprite(new Surface(Resource1.bobc3));
            bubc1i = new Sprite(new Surface(Resource1.bobc1i));
            bubc2i = new Sprite(new Surface(Resource1.bobc2i));
            bubc3i = new Sprite(new Surface(Resource1.bobc3i));
            bubm1 = new Sprite(new Surface(Resource1.bobm1));
            bubm2 = new Sprite(new Surface(Resource1.bobm2));
            bubm3 = new Sprite(new Surface(Resource1.bobm3));
            bubm4 = new Sprite(new Surface(Resource1.bobm4));
            frente = new Sprite(new Surface(Resource1.bobfte));

            bob.Add("derecha1", bubc1);
            bob.Add("derecha2", bubc2);
            bob.Add("derecha3", bubc3);
            bob.Add("izquierda1", bubc1i);
            bob.Add("izquierda2", bubc2i);
            bob.Add("izquierda3", bubc3i);
            bob.Add("muerto1", bubm1);
            bob.Add("muerto2", bubm2);
            bob.Add("muerto3", bubm3);
            bob.Add("muerto4", bubm4);
            bob.Add("frente", frente);

            foreach (KeyValuePair<string, Sprite> par in bob)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }

            #endregion spritesBob

            #region burbujaVerde
            bvd1 = new Sprite(new Surface(Resource1.bvd1));
            bvd2 = new Sprite(new Surface(Resource1.bvd2));
            bvd3 = new Sprite(new Surface(Resource1.bvd3));
            bvd4 = new Sprite(new Surface(Resource1.bvd4));
            bv = new Sprite(new Surface(Resource1.bv));
            bvr1 = new Sprite(new Surface(Resource1.bvr1));
            bvr2 = new Sprite(new Surface(Resource1.bvr2));

            bvd1.Transparent = true;
            bvd1.TransparentColor = Color.Magenta;
            bvd2.Transparent = true;
            bvd2.TransparentColor = Color.Magenta;
            bvd3.Transparent = true;
            bvd3.TransparentColor = Color.Magenta;
            bvd4.Transparent = true;
            bvd4.TransparentColor = Color.Magenta;
            bv.Transparent = true;
            bv.TransparentColor = Color.Magenta;
            bvr1.Transparent = true;
            bvr1.TransparentColor = Color.Magenta;
            bvr2.Transparent = true;
            bvr2.TransparentColor = Color.Magenta;
            #endregion burbujaVerde

            #region spriteRobotito
            Sprite rob0 = new Sprite(new Surface(Resource1.rt0));
            Sprite rob0i = new Sprite(new Surface(Resource1.rt0i));
            Sprite rob1 = new Sprite(new Surface(Resource1.rt1));
            Sprite rob1i = new Sprite(new Surface(Resource1.rt1i));
            Sprite rob2 = new Sprite(new Surface(Resource1.rt2));
            Sprite rob2i = new Sprite(new Surface(Resource1.rt2i));
            Sprite rob3 = new Sprite(new Surface(Resource1.rt3));
            Sprite rob3i = new Sprite(new Surface(Resource1.rt3i));
            Sprite renc = new Sprite(new Surface(Resource1.renc));
            Sprite renc1 = new Sprite(new Surface(Resource1.renc1));
            Sprite renc2 = new Sprite(new Surface(Resource1.renc2));
            Sprite rfrente = new Sprite(new Surface(Resource1.rtf));

            robotito = new Dictionary<string, Sprite>();
            robotito.Add("derecha0", rob0);
            robotito.Add("derecha1", rob1);
            robotito.Add("derecha2", rob2);
            robotito.Add("derecha3", rob3);
            robotito.Add("izquierda0", rob0i);
            robotito.Add("izquierda1", rob1i);
            robotito.Add("izquierda2", rob2i);
            robotito.Add("izquierda3", rob3i);
            robotito.Add("encerradomedio", renc);
            robotito.Add("encerrado1", renc1);
            robotito.Add("encerrado2", renc2);
            robotito.Add("frente", rfrente);
            foreach (KeyValuePair<string, Sprite> par in robotito)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }
            #endregion spriteRobotito

            #region spriteViejita
            Sprite viej0=new Sprite(new Surface(Resource1.vi1));
            Sprite viej1 = new Sprite(new Surface(Resource1.vi2));
            Sprite viej2 = new Sprite(new Surface(Resource1.vi3));
            Sprite viej3 = new Sprite(new Surface(Resource1.vi4));
            Sprite viej0i = new Sprite(new Surface(Resource1.vii1));
            Sprite viej1i = new Sprite(new Surface(Resource1.vii2));
            Sprite viej2i = new Sprite(new Surface(Resource1.vii3));
            Sprite viej3i = new Sprite(new Surface(Resource1.vii4));
            Sprite vieje = new Sprite(new Surface(Resource1.vienc));
            Sprite vieje1 = new Sprite(new Surface(Resource1.vienc1));
            Sprite vieje2 = new Sprite(new Surface(Resource1.vienc2));
            Sprite vif = new Sprite(new Surface(Resource1.vif));

            viejita = new Dictionary<string, Sprite>();
            viejita.Add("derecha0", viej0);
            viejita.Add("derecha1", viej1);
            viejita.Add("derecha2", viej2);
            viejita.Add("derecha3", viej3);
            viejita.Add("izquierda0", viej0i);
            viejita.Add("izquierda1", viej1i);
            viejita.Add("izquierda2", viej2i);
            viejita.Add("izquierda3", viej3i);
            viejita.Add("encerradomedio", vieje);
            viejita.Add("encerrado1", vieje1);
            viejita.Add("encerrado2", vieje2);
            viejita.Add("frente", vif);

            fireball = new Sprite(new Surface(Resource1.fireball));

            foreach(KeyValuePair<string,Sprite> par in viejita)
            {
                par.Value.Transparent = true;
                par.Value.TransparentColor = Color.Magenta;
            }
            #endregion spriteViejita

            particles = new ParticleSystem();

            #region frutas
            sprcereza = new Sprite(new Surface(Resource1.fruta001));
            sprcereza.TransparentColor = Color.Magenta;
            sprcereza.Transparent = true;
            #endregion frutas

            vidaBub = new Sprite(new Surface(Resource1.vidaBub));
            vidaBub.TransparentColor = Color.Magenta;
            vidaBub.Transparent = true;

            vidaBob = new Sprite(new Surface(Resource1.vidaBob));
            vidaBob.TransparentColor = Color.Magenta;
            vidaBob.Transparent = true;

            this.alto = alto;
            this.ancho = ancho;
            this.unidad = 5;
            fullscreen = false;

            screen=Video.SetVideoMode(ancho, alto, false, false, fullscreen);
            Video.WindowCaption = "Re-Bubble Bobble";
            Video.WindowIcon(Resource1.icono);

            fuente = new SdlDotNet.Graphics.Font(Resource1.arial, 20);
        }
Пример #58
0
 /// <summary>
 /// 
 /// </summary>
 public Scoreboard()
 {
     font = new SdlDotNet.Graphics.Font(Path.Combine(Path.Combine(TriadMain.FilePath, TriadMain.FileDirectory), "FreeSans.ttf"), 18);
 }
Пример #59
0
        public GameOverBox(GameObject GameObj,List<GuiItem> Garbage)
            : base("GameOverBox")
        {
            Width = 400;
            Height = 400;
            this.Garbage = Garbage;
            this.GameObj = GameObj;
            MousePos = new Point();
            Background = new BackgroundItem(Color.WhiteSmoke);
            Background.Width = Width;
            Background.Height = Height;
            font = new SdlDotNet.Graphics.Font("../../../../assets/GameData/VeraSe.ttf", 36);
            bContinue = new ButtonItem("Continue",120,22,"Try Again");
            bContinue.X = 100;
            bContinue.Y = 300;

            bQuit = new ButtonItem("Quit",120,22,"Quit");
            bQuit.X = 230;
            bQuit.Y = 300;
        }
Пример #60
0
 /// <summary>
 /// Initializes the textbox font.
 /// </summary>
 public static void InitFonts()
 {
     GameFont = LoadFont("PMU.ttf", 24);
     GameFontSmall = LoadFont("PMU.ttf", 16);
 }