Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 public Bomb(Surface bombSurface)
     : base(bombSurface)
 {
     base.Surface.TransparentColor = Color.White;
     base.Surface.Transparent = true;
     Reset();
 }
Exemple #2
0
        public SceneGameOver()
        {
            sceneType = SceneType.GameOver;

            _menuItems = new MenuItem[]
            {
                new MenuItem(Key.R, Properties.Resources.MenuItem_RetryStage),
                new MenuItem(Key.M, Properties.Resources.MenuItem_MapSelect),
                new MenuItem(Key.T, Properties.Resources.MenuItem_ReturnTitle)
            };

            _keys = new Key[]
            {
                Key.UpArrow, Key.DownArrow, Key.Return, Key.Escape,
                Key.M, Key.R, Key.T
            };

            _cursor = ResourceManager.GetColoredCursorGraphic(_foreColor);

            _overImgSurface = ResourceManager.LoadSurface(Constants.Filename_GameoverImage);
            ImageUtil.SetColor(_overImgSurface, _foreColor);

            _menuSurfaces = new SurfaceCollection();
            _menuRects = new Rectangle[_menuItems.Length];
            ImageUtil.CreateStrMenu(_menuItems, _foreColor, ref _menuSurfaces, ref _menuRects, Constants.ScreenWidth);
        }
 public TileGraphic(int tileSet, int tileNum, Surface tile, int sizeInBytes)
 {
     this.tileSet = tileSet;
     this.tileNum = tileNum;
     this.tile = tile;
     this.sizeInBytes = sizeInBytes;
 }
Exemple #4
0
        public override void paint(SdlDotNet.Graphics.Surface surface, bool focused, System.Drawing.Point offset)
        {
            display.Blit(atari.Display);
            surface.Blit(display, offset);

            atari.execute();
        }
Exemple #5
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));
        }
 protected override void renderMiniMapForeground(SdlDotNet.Graphics.Surface s, Rectangle r)
 {
     using (Surface ts = ResourceManager.LargePFont.Render("Endless Map", _backColor))
     {
         s.Blit(ts, new Point((int)(r.Width / 2.0 - ts.Width / 2.0), (int)(r.Height / 2.0 - ts.Height / 2.0)));
     }
 }
Exemple #7
0
        public SpriteSheet(string spriteSheetFilename, Color transparentColor, Size frameSize, int rotationPerFrameDeg, int firstFrameShipDirectionDeg, int rotationAnimationDelay, int cannonBarrelLength, int forwardThrusterEngineLength, int reverseThrusterEngineLength)
        {
            this.bitmap = new Bitmap(spriteSheetFilename);
            this.transparentColor = transparentColor;
            this.frameSize = frameSize;
            this.rotationPerFrameDeg = rotationPerFrameDeg;
            this.firstFrameShipDirectionDeg = firstFrameShipDirectionDeg;
            this.cannonBarrelLength = cannonBarrelLength;
            this.reverseThrusterEngineLength = reverseThrusterEngineLength;
            this.forwardThrusterEngineLength = forwardThrusterEngineLength;

            SurfaceCollection spriteSheet_SurfaceCollection = new SurfaceCollection();
            Surface spriteSheet_Surface = new Surface(this.bitmap).Convert(Video.Screen, true, false);

            spriteSheet_SurfaceCollection.Add(spriteSheet_Surface, this.frameSize);

            AnimationCollection animationCollection = new AnimationCollection();
            animationCollection.Add(spriteSheet_SurfaceCollection);
            animationCollection.Delay = rotationAnimationDelay;

            AnimatedSprite animatedSprite = new AnimatedSprite(animationCollection);

            animatedSprite.TransparentColor = this.transparentColor;
            animatedSprite.Transparent = true;

            this.animatedSprite = animatedSprite;
        }
        public Manager()
        {
            mVideo = Video.SetVideoMode(800, 300);
            p = new Publisher();

            mAchtergrond = new Achtergrond(mVideo);
            mEnemy = new Enemy(mVideo);
            mEnemy2 = new Enemy2(mVideo);
            p.AddVijand(mEnemy2);
            p.AddVijand(mEnemy);
            mHero = new Hero(mVideo, p);
            mHero = new ShootHero(mVideo, mHero);
            mHero = new FlyHero(mVideo, mHero);

            //Terug naar origine hero!
            ((FlyHero)mHero).theHero = null;
            mHero = new ShootHero(mVideo, mHero);
            collection = new SpriteCollection();
            collection.Add(mHero);
            //collection.Add(shootHero);
            collection.Add(mEnemy);
            collection.Add(mEnemy2);

            Events.KeyboardDown += Events_KeyboardDown;
            //collection.EnableTickEvent();
            //collection.EnableKeyboardEvent();

            init();

            Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
            Events.Run();
        }
Exemple #9
0
        private void Init()
        {
            if (base.ContainsControl(btnUp))
            {
                base.RemoveControl(btnUp);
            }
            btnUp           = new Button();
            btnUp.OnClick  += new EventHandler <SdlDotNet.Input.MouseButtonEventArgs>(btnUp_OnClick);
            btnUp.Location  = new Point(0, 0);
            btnUp.Size      = new Size(this.Width, buttonHeight);
            btnUp.Backcolor = SystemColors.Control;
            this.AddControl(btnUp);

            if (base.ContainsControl(btnDown))
            {
                base.RemoveControl(btnDown);
            }
            btnDown           = new Button();
            btnDown.OnClick  += new EventHandler <SdlDotNet.Input.MouseButtonEventArgs>(btnDown_OnClick);
            btnDown.Location  = new Point(0, this.Height - buttonHeight);
            btnDown.Size      = new Size(this.Width, 10);
            btnDown.Backcolor = SystemColors.Control;
            this.AddControl(btnDown);

            mBackground = new SdlDotNet.Graphics.Surface(this.Width, this.Height - (buttonHeight * 2));
            cursorSurf  = new SdlDotNet.Graphics.Surface(7, 12);
            cursorSurf.Fill(Color.Gray);
        }
        private void drawMaps(SdlDotNet.Graphics.Surface s)
        {
            s.Fill(Constants.Color_Background);

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

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

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

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

            // タイトルに戻るメニュー
            ImageUtil.DrawSelections(s, _escSurfaces, _escRects, _strongCursor,
                                     _escRect.Location, (_escFocus ? 0 : -1), MenuItemAlign.MiddleLeft);
        }
Exemple #11
0
        public void UpdateSurfaces()
        {
            mButtonUpBounds         = new Rectangle(0, 0, this.Width, 25);
            mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
            mButtonDownBounds       = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
            mScrollBarBounds        = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);

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

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

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

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

            mBackground.Blit(mButtonSurface);
            mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
        }
Exemple #12
0
        private string View; // View = XY, ZY or ZX (Front,Left or Top)

        #endregion Fields

        #region Constructors

        public View2D(SdlDotNet.Windows.SurfaceControl Control, string View, object _blocks, object _items, int _gridsize, object _layers)
        {
            this.View = View;
            this.Control = Control;
            this.layerStatus = (bool[])_layers;

            this.Surf = new Surface(this.Control.Width, this.Control.Height);

            this.GridSurf = new Surface(this.Control.Width, this.Control.Height);
            this.BlockSurf = new Surface(this.Control.Width, this.Control.Height);
            this.TempSurf = new Surface(this.Control.Width, this.Control.Height);

            this.GridSize = _gridsize;

            this.blocks = _blocks;
            this.items = _items;

            SdlDotNet.Core.Events.Tick +=  new EventHandler<TickEventArgs>(OnTick);

            this.levelSize = 256;

            this.scrollLocalX = this.levelSize*this.GridSize/2;
            this.scrollLocalY = this.levelSize*this.GridSize/ 2;

            this.UpdateGrid();
            this.UpdateBlocks();
            this.UpdateTemp();
        }
Exemple #13
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            DrawBackground(dstSrf, e);
            DrawCursor(dstSrf, e);

            base.Update(dstSrf, e);
        }
Exemple #14
0
        public Sunny()
        {
            disposed = false;

            buffer = new Surface[6];

            for (int i = 0; i < buffer.Length; i++)
            {
                int height = 8;
                int divide = 2;
                buffer[i] = new Surface(20 * Constants.TILE_WIDTH, height * Constants.TILE_HEIGHT / ((int)System.Math.Pow(divide, i)));
                for (int x = 0; x < 20; x++)
                {
                    for (int y = 0; y < height; y++)
                    {

                        buffer[i].Blit(GraphicsManager.Tiles[10][7/*132 + 14 * (x % 4)*/], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT / ((int)System.Math.Pow(divide, i))));
                    }
                }
                buffer[i].AlphaBlending = true;

                buffer[i].Alpha = 32;

            }
        }
Exemple #15
0
 /// <summary>
 /// Draw this instance.
 /// </summary>
 public void Draw()
 {
     cpt++;
     ScreenManager.MainScreen.Fill(_bgColor);
     srTxt = txtFont.Render(Convert.ToString(cpt),Color.Black);
     ScreenManager.MainScreen.Blit(srTxt,new Point(50,50));
 }
Exemple #16
0
        public void UpdateSurfaces()
        {
            mButtonUpBounds = new Rectangle(0, 0, this.Width, 25);
            mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
            mButtonDownBounds = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
            mScrollBarBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);

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

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

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

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

            mBackground.Blit(mButtonSurface);
            mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
        }
Exemple #17
0
        public Texture(Surface surface)
        {
            this.surface = surface;

            //this.surface.AlphaBlending = true;
            //this.Alpha = 255;
        }
Exemple #18
0
        public Enemy(int x, int y,bool moveright, bool moveleft)
        {
            try
            {
                Image = new Surface("Enemy_CommanderKeen_rechts.png");
                ImageLeft = new Surface("Enemy_CommanderKeen_links.png");
                ImageRight = new Surface("Enemy_CommanderKeen_rechts.png");
            }
            catch (Exception error)
            {
                Console.WriteLine(error);
            }

            Position = new Point(x, y);
            ShowPartImage = new Rectangle(0, 0,55,71 );
            BeginPositie = Position.X;
            Collisionrectangle = new Rectangle(Position.X, Position.Y, 55, 71);
            Leftcollisionrectangle = new Rectangle(Position.X, Position.Y, 3, 71);
            Rightcollisionrectangle = new Rectangle((Position.X + 55), Position.Y, 3, 71);
            Uppercollisionrectangle = new Rectangle(Position.X, Position.Y, 55, 3);
            Lowercollisionrectangle = new Rectangle(Position.X, (Position.Y + 71), 55, 3);

            MoveLeft = moveleft;
            MoveRight = moveright;
        }
Exemple #19
0
 public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
 {
     if (chip != 0)
     {
         s.Fill(r, _foreColor);
     }
 }
Exemple #20
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"));
        }
Exemple #21
0
        /// <summary>
        /// 
        /// </summary>
        public Program()
        {
            Screen = Video.SetVideoMode(ScreenWidth, ScreenHeight);

            map     = new MapDrawer(Screen);
            console = new BBConsole(Screen);
            gui     = new BBUI(Screen, console);
            TextDrawer.Initialize(Screen);
            
            // Data loading

            // Sounds initialization
            SoundHandler soundHandler = new SoundHandler();

            soundBox = soundHandler.initializeSounds();
            Console.WriteLine("Sounds Loading ");

            musicBox = soundHandler.initializeMusics();
            Console.WriteLine("Musics Loading");

            //MusicBox["dtowne"].Play();

            map.loadMap(MapPlayed); // Loading of the map
            Console.WriteLine("Map Loading");

            Video.WindowIcon();
            Video.WindowCaption = "BloodBox ! It roxes so much !";
            
            this.AddHandlers();
            Events.Run();
        }
Exemple #22
0
        private void DrawCursor(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            cursorArea.Height = System.Math.Max(20, mBackground.Height - System.Math.Max(20, max / 4));
            cursorArea.Width  = 12;

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

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

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

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

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

            //spriteBatch.Draw(cursorTex, cursorPos + new Vector2(cursorMidDest.Width, 0f), cursorRight, BackColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
Exemple #23
0
        public Sprite(Surface surface2)
        {
            this.surface = surface2;
            texture = new SurfaceGl(surface, true);
            texture.WrapS = WrapOption.Clamp;
            texture.WrapT = WrapOption.Clamp;
            //texture.MagFilter = MagnificationOption.GL_LINEAR;
            //texture.MinFilter = MinifyingOption.GL_LINEAR_MIPMAP_LINEAR;
            int blank = surface.TransparentColor.ToArgb();
            bool[,] bitmap = new bool[surface.Width, surface.Height];
            Color[,] pixels = surface.GetColors(new System.Drawing.Rectangle(0, 0, surface.Width, surface.Height));

            for (int x = 0; x < bitmap.GetLength(0); ++x)
            {
                for (int y = 0; y < bitmap.GetLength(1); ++y)
                {
                    bitmap[x, y] = !(pixels[x, y].A == 0 || pixels[x, y].ToArgb() == blank);
                }
            }
            vertexes = VertexHelper.CreateRangeFromBitmap(bitmap);
            Console.WriteLine("Before {0}", GetCount);
            vertexes = VertexHelper.ReduceRange(vertexes, 1);
            vertexes = VertexHelper.ReduceRange(vertexes, 2);
            vertexes = VertexHelper.ReduceRange(vertexes, 3);
            Console.WriteLine("After {0}", GetCount);
            vertexes = VertexHelper.SubdivideRange(vertexes, 10);
            Console.WriteLine("Subdivide {0}", GetCount);
            offset = VertexHelper.GetCentroidOfRange(vertexes);
            vertexes = VertexHelper.CenterVertexesRange(vertexes);
        }
Exemple #24
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();
        }
Exemple #25
0
        public override void Draw(SdlDotNet.Graphics.Surface screen)
        {
            // Draw the title
            titleTextSprite.X     = 20;
            titleTextSprite.Y     = _BaseY;
            titleTextSprite.Color = Color.Yellow;
            titleTextSprite.Text  = this.Name;
            screen.Blit(titleTextSprite);

            int item_y = _BaseY + _SpaceBetweenItems + 20;

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

                item_y += 15;
            }

            // Draw the item
            itemTextSprite.X     = 20;
            itemTextSprite.Y     = screen.Height - 40;
            itemTextSprite.Color = Color.LightYellow;
            itemTextSprite.Text  = Items[0].Text;
            screen.Blit(itemTextSprite);
        }
Exemple #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="surface"></param>
        /// <param name="location"></param>
        /// <param name="size"></param>
        /// <param name="color"></param>
        public static void DrawRect(Surface surface, Point location, Size size, Color color)
        {
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            int x;
            int y;

            //Draw top line...
            for (x = location.X; x < location.X + size.Width; x++)
            {
                surface.Draw(new Point(x, location.Y), color);
            }

            //Draw bottom line...
            for (x = location.X; x < location.X + size.Width; x++)
            {
                surface.Draw(new Point(x, location.Y + size.Height), color);
            }

            //Draw left line...
            for (y = location.Y; y < location.Y + size.Height; y++)
            {
                surface.Draw(new Point(location.X, y), color);
            }

            //Draw right line... 
            for (y = location.Y; y < location.Y + size.Height; y++)
            {
                surface.Draw(new Point(location.X + size.Width, y), color);
            }
        }
Exemple #27
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));
        }
        private Surface[] VerschillendeLevels = new Surface[5]; // //Verschillende keuzes(2de startscherm)

        #endregion Fields

        #region Constructors

        public Manager()
        {
            play = new Audio(); //aanmaken audio
            audioThread = new Thread(new ThreadStart(play.PlayAudio));//starten tread
            laadTextarrays();//Aanmaken van textblock voor beginscherm
            startaf = new Surface("motherload_logo.png");//toewijzen van afb(1ste startscherm)
            Levelkeuze = new Surface("motherload_logo2.png");//toewijzen van afb(2de startscherm)
            LoseScreen = new Surface("explosion.png"); //Toewijzen afb eindscherm
            mVideo = Video.SetVideoMode(750,600);//Grote van window instellen
            Video.WindowCaption = "Motherload"; //Titel in titelbalk instellen
            speler = new Player();//aanmaken van speler
            level = new Level();//aanmaken van level
            gameObjecten = new List<GameObject>();
            col = new CollisionDetection();//aanmaken van nieuw collisionDetection
            removeDirt = new RemoveDirt();//Aanmaken van Removedirt
            gameObjecten.Add(speler);
            laad = new LoadLevel();
            Cheater = new CheatEngin();
            audioThread.Start();
            CreerLevens();
            Events.Fps = 60;
            Events.KeyboardDown += Events_KeyboardDown;
            Events.Quit += Events_Quit;
            Events.Tick += Events_Tick;
            Events.Run();
        }
Exemple #29
0
 private void release()
 {
     if (_prevSurface != null) _prevSurface.Dispose();
     if (_errorMessageSurface != null) foreach (Surface s in _errorMessageSurface) s.Dispose();
     _prevSurface = null;
     _errorMessageSurface = null;
 }
Exemple #30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="surface"></param>
 protected void DrawGameObjects(Surface surface)
 {
     foreach (GameObject obj in objectList)
     {
         obj.Draw(surface);
     }
 }
Exemple #31
0
        public static void Main(string[] args)
        {
            Events.Quit += new EventHandler<QuitEventArgs>(ApplicationQuitEventHandler);

            Surface plate = Video.SetVideoMode(220, 220, 32, false, false, false, true);
            Surface pic = new Surface("nyanbig.png");
            pic.Update();

            Population fellows = new Population(15, 100);
            List<float> fitnesses;

            while (fellows.members[0].fitness < 700f)
            {
                fitnesses = new List<float>();
                foreach (Genome g in fellows.members)
                {
                    g.Draw(plate);
                    Console.Read();
                    float f = g.GetFitness(plate, pic);
                    fitnesses.Add(f);
                    g.fitness = f;
                }

                fellows.members.Sort();
                fellows.members[0].Draw(plate);
                Console.WriteLine(fellows.members[0].fitness);
                int x = 0;
            }
        }
Exemple #32
0
        public Hero()
        {
            try
            {
                Image = new Surface("Commander_Keen_links.png");
                ImageLeft = new Surface("Commander_Keen_links.png");
                ImageRight = new Surface("Commander_Keen_rechts.png");
            }
            catch (Exception error)
            {
                Console.WriteLine(error);

            }

            Position = new Point(300, ground);
            ShowPartImage = new Rectangle(0, 0,50,75 );
            Collisionrectangle = new Rectangle(Position.X, Position.Y, 45, 70);
            Leftcollisionrectangle = new Rectangle(Position.X, (Position.Y+10), 3, 60);
            Rightcollisionrectangle = new Rectangle((Position.X + 45), (Position.Y+10), 3, 60);
            Uppercollisionrectangle = new Rectangle((Position.X+5), Position.Y, 45, 3);
            Lowercollisionrectangle = new Rectangle((Position.X+5), (Position.Y + 75), 45, 15);

            Events.KeyboardDown += Events_KeyboardDown;
            Events.KeyboardUp += Events_KeyboardUp;
        }
Exemple #33
0
        public MapDrawer(Surface Screen)
        {
            MapX = 100;
            MapY = 100;

            WindowsScreen = Screen;
        }
        public override Surface Render()
        {
            Surface Buffer = new Surface(Width,Height);

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

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

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

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

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

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

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

            srfcMoveTargetUnknown = new Surface(Constants.TILE_WIDTH * 3, Constants.TILE_HEIGHT * 3);
            for (int i = 0; i < 9; i++)
            {
                srfcMoveTargetUnknown.Blit(GraphicsManager.Tiles[10][8 + i % 3 + i / 3 * 14], new Point(i % 3 * Constants.TILE_WIDTH, i / 3 * Constants.TILE_HEIGHT));
            }
            srfcMoveTargetUnknown.Transparent = true;
            srfcMoveTargetUnknown.Alpha = 150;
            srfcMoveTargetUnknown.AlphaBlending = true;
        }
 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));
 }
        public static Surface Render(PlayerUnit Unit)
        {
            Surface Buffer = new Surface(PUNIT_WIDTH_PX, PUNIT_WIDTH_PX);
            Color Bg = Color.WhiteSmoke;

            switch (Unit.Class)
            {
                case UnitClasses.Archer: Bg = Color.Orange;
                    break;
                case UnitClasses.Mage: Bg = Color.Blue;
                    break;
                case UnitClasses.Paladin: Bg = Color.DeepPink;
                    break;
                case UnitClasses.Soldier: Bg = Color.Brown;
                    break;
                case UnitClasses.Thieft: Bg = Color.Yellow;
                    break;

            }

            Rectangle UnitRect = new Rectangle(new Point(0,0), new Size(Buffer.Width, Buffer.Height));
            Box Border = new Box(new Point(0, 0), new Size(Buffer.Width - 1, Buffer.Height - 1));
            Buffer.Fill(UnitRect, Bg);
            Buffer.Draw(Border, Color.WhiteSmoke, true);
            Buffer.AlphaBlending = true;
            Buffer.Alpha = 230;
            return Buffer;
        }
Exemple #38
0
        public override void Draw(Surface video)
        {
            base.Draw(video);
            box0.Location = Leftcollisionrectangle.Location;
            box0.Width = 5;
            box0.Height = 71;
            box0.Draw(video, Color.Red);

            box1.Location = Rightcollisionrectangle.Location;
            box1.Width = 5;
            box1.Height = 71;
            box1.Draw(video, Color.Red);

            box2.Location = Uppercollisionrectangle.Location;
            box2.Width = 55;
            box2.Height = 5;
            box2.Draw(video, Color.Red);

            box3.Location = Lowercollisionrectangle.Location;
            box3.Width = 55;
            box3.Height = 5;
            box3.Draw(video, Color.Red);
            if (StaatOpBlok == false)
            {
                Position.Y += 7;

            }
        }
Exemple #39
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));
 }
        /// <summary>
        /// Initializes a new instance of the VictoryArea class.
        /// </summary>
        /// <param name="area">Area of victory zone</param>
        public VictoryArea(Rectangle area, Context context)
            : base(area)
        {
            this.UpperLeft = new Point(area.Left, area.Top);
            this.Area = area;

            Surface toFill = new Surface(new Size(32, 32));
            int x = 0;
            int y = 0;

            // Get left upper corner
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 1 * toFill.Height);
            this.Blit(toFill);

            // Upper separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 1 * toFill.Height);
            x += toFill.Width;
            while (x < this.Width)
            {
                this.Blit(toFill, new Point(x, 0));
                x += toFill.Width;
            }

            // Left separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 2 * toFill.Height);
            y += toFill.Height;
            while (y < this.Height)
            {
                this.Blit(toFill, new Point(0, y));
                y += toFill.Height;
            }

            // Center of the victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 2 * toFill.Width, 2 * toFill.Height);
            x = toFill.Width;
            y = toFill.Height;
            while (x < this.Width)
            {
                while (y < this.Height)
                {
                    this.Blit(toFill, new Point(x, y));
                    y += toFill.Height;
                }

                x += toFill.Width;
            }

            // Get left lower corner
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 3 * toFill.Height);
            this.Blit(toFill, new Point(0, this.Height - toFill.Height));

            // Lower separation of victory zone
            TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 3 * toFill.Height);
            x += toFill.Width;
            while (x < this.Width)
            {
                this.Blit(toFill, new Point(x, this.Height - toFill.Height));
                x += toFill.Width;
            }
        }
Exemple #41
0
        public DarknessOverlay(int newRange)
        {
            disposed = false;
            range = newRange;
            buffer = new Surface(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT);
            Surface holepart = new Surface(14 * Constants.TILE_WIDTH, 14 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 14; x++) {
                for (int y = 0; y < 14; y++) {
                    holepart.Blit(GraphicsManager.Tiles[10][210 + x + 14 * y], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }

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

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

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

            buffer.AlphaBlending = true;
            buffer.Alpha = 180;
        }
Exemple #42
0
        /// <summary>
        /// Inits this instance.
        /// </summary>
        public static void Initialize()
        {
            FadeSurface = new SdlDotNet.Graphics.Surface(SdlDotNet.Graphics.Video.Screen.Size);

            spriteCache  = new MultiNameLRUCache <string, SpriteSheet>(spriteCacheSize);
            spellCache   = new Cache <string, SpellSheet>(spellCacheSize);
            mugshotCache = new MultiNameLRUCache <string, Mugshot>(mugshotCacheSize);
            tileCache    = new TileCache(MAX_TILES);
        }
Exemple #43
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     if (e.Tick > lastTick + 35)
     {
         mGameLoop.DrawScreen(mGameSurface, e);
         lastTick = e.Tick;
     }
     dstSrf.Blit(mGameSurface, this.Location);
 }
Exemple #44
0
 private void Init()
 {
     //mForecolor = Color.Black;
     //mBackcolor = SystemColors.Control;
     //mHoverColor = Color.SteelBlue;
     //mBorderColor = Color.Black;
     mTexture = new SdlDotNet.Graphics.Surface(this.Size);
     mTexture.Fill(mBackcolor);
 }
Exemple #45
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     //int addX = 0;
     //int addY = 0;
     //if (this.Parent != null) {
     //    //addX += this.Parent.Location.X;
     //    //addY += this.Parent.Location.Y;
     //}
     base.Update(dstSrf, e);
 }
 private void drawLoading(SdlDotNet.Graphics.Surface s)
 {
     s.Fill(Constants.Color_Foreground);
     if (_loadingSurface == null)
     {
         _loadingSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_MapLoading, Constants.Color_Background);
     }
     s.Blit(_loadingSurface, new Point(
                (int)(Constants.ScreenWidth / 2.0 - _loadingSurface.Width / 2.0),
                (int)(Constants.ScreenHeight / 2.0 - _loadingSurface.Height / 2.0)));
 }
Exemple #47
0
 protected void ReinitBuffer()
 {
     if (mBuffer != null)
     {
         mBuffer.Close();
         mBuffer.Dispose();
     }
     mBuffer                  = new Surface(this.Size);
     mBuffer.Transparent      = true;
     mBuffer.TransparentColor = Color.Transparent;
     mBuffer.Fill(Color.Transparent);
 }
        private void drawOctaveSelecting(SdlDotNet.Graphics.Surface s)
        {
            if (_octaveSelectingSurface == null)
            {
                using (Surface ts = ImageUtil.CreateMultilineStringSurface(new string[] {
                    Properties.Resources.Str_OctaveSelecting,
                    null, null, null,
                    Properties.Resources.Str_OctaveSelecting_Operation
                },
                                                                           ResourceManager.SmallPFont, Constants.Color_Background, TextAlign.Center))
                {
                    _octaveSelectingSurface = new Surface(
                        ts.Width + Constants.WindowPadding * 2,
                        ts.Height + Constants.WindowPadding * 2);

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

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

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

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

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

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

            if (_octave > Constants.MinOctave)
            {
                s.Blit(_octaveDownSurface, new Point((int)(Constants.ScreenWidth / 2.0 - _octaveDownSurface.Width / 2.0), y));
            }
        }
 protected override void draw(SdlDotNet.Graphics.Surface s)
 {
     if (_loading)
     {
         drawLoading(s);
     }
     else
     {
         drawMaps(s);
         if (_octaveSelecting)
         {
             drawOctaveSelecting(s);
         }
     }
 }
Exemple #50
0
        private void Init()
        {
            base.Buffer.Fill(Color.Transparent);
            mTaskBarStartSurf                  = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbar.png"));
            mTaskBarStartSurf.Transparent      = true;
            mTaskBarStartSurf.TransparentColor = Color.Transparent;
            base.Buffer.Blit(mTaskBarStartSurf, new Point(0, 0));
            int lastX = mTaskBarStartSurf.Width;

            for (int i = 0; i < mButtons.Count; i++)
            {
                mButtons[i].Location = new Point(lastX, 3);
                base.Buffer.Blit(mButtons[i].Render(), new Point(lastX, 3));
                lastX += mButtons[i].Size.Width;
            }
        }
Exemple #51
0
 private void Redraw()
 {
     try {
         base.Buffer.Fill(mBackColor);
         if (mBackground != null)
         {
             mBackground.Close();
             mBackground.Dispose();
         }
         mBackground = new SdlDotNet.Graphics.Surface(this.Size);
         mBackground.TransparentColor = Color.Transparent;
         mBackground.Transparent      = true;
         mBackground.Fill(mBackColor);
         int lastY = 2;
         // Draw each line
         for (int i = mVisibleY; i < mVisibleY + mMaxY; i++)
         {
             if (mLines.Count > i)
             {
                 SdlDotNet.Graphics.Surface lineSurf;
                 if (mPasswordChar == '\0')
                 {
                     lineSurf = mLines[i].Render();
                 }
                 else
                 {
                     lineSurf = mLines[i].RenderPassword(mPasswordChar);
                 }
                 mBackground.Blit(lineSurf, new Point(2, lastY));
                 lineSurf.Close();
                 lastY += mFont.Height;
             }
             else
             {
                 break;
             }
         }
         base.Buffer.Blit(mBackground);
         mBackground.Close();
         //if (mDoLineDraw) {
         //    Gfx.IPrimitive line = new Gfx.Primitives.Line(new Point((((mCursorLocX - mVisibleX) * (mLetterSize.Width))), (((((mCursorLocY) - mVisibleY) * mLetterSize.Height)) - 2)), new Point(((mCursorLocX - mVisibleX) * (mLetterSize.Width)), (((mCursorLocY) - mVisibleY) * mLetterSize.Height + mLetterSize.Height)));
         //    base.Buffer.Draw(line, Color.Blue);
         //}
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
     }
 }
Exemple #52
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 {}
        }
Exemple #53
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     if (SdlDotNet.Core.Timer.TicksElapsed > mLastLineBlit + 500)
     {
         mDoLineDraw   = !mDoLineDraw;
         mLastLineBlit = e.Tick;
     }
     //if (base.Focused) {
     //    if (mDoLineDraw) {
     //        //if (base.PointInBounds(new Point(((mCursorLocX * (mPrevLetterSize.Width)) + 4) + addX, (((mCursorLine * mLineSize.Height))) + addY)) && base.PointInBounds(new Point((mCursorLocX * (mPrevLetterSize.Width) + 4) + addX, (mCursorLine * mLineSize.Height + mLineSize.Height) + addY))) {
     //        Redraw();
     //        mLineCleared = false;
     //        //}
     //    } else {
     //        if (mLineCleared == false) {
     //            Redraw();
     //            mLineCleared = true;
     //        }
     //    }
     //}
     base.Update(dstSrf, e);
 }
Exemple #54
0
        public virtual void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            try {
                if (!mIsDisposing)
                {
//					Point totalAddLoc = GetTotalAddLocation(new Point(mBounds.X, mBounds.Y), this);
//					if (mScreenBounds.Location != totalAddLoc) {
//						mScreenBounds = new Rectangle(totalAddLoc, this.Size);
//					}
//					int addX = totalAddLoc.X;
//					int addY = totalAddLoc.Y;
                    if (mBuffer.Size != mBounds.Size)
                    {
                        ReinitBuffer();
                    }
                    dstSrf.Blit(mBuffer, this.Location);
                    UpdateControls(mBuffer, e);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
        public static void SaveSurface(SdlDotNet.Graphics.Surface surfaceToSave, string filePath)
        {
            System.Drawing.Image img = surfaceToSave.Bitmap;
            switch (DetermineSaveType(filePath))
            {
            case SurfaceSaveType.png:
                img.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
                break;

            case SurfaceSaveType.gif:
                img.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
                break;

            case SurfaceSaveType.jpg:
                img.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
                break;

            case SurfaceSaveType.bmp:
                img.Save(filePath, System.Drawing.Imaging.ImageFormat.Bmp);
                break;

            case SurfaceSaveType.ico:
                img.Save(filePath, System.Drawing.Imaging.ImageFormat.Icon);
                break;

            case SurfaceSaveType.pmugfx:
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] encryptedBytes = EncryptSurface(ms.ToArray());
                    System.IO.File.WriteAllBytes(filePath, encryptedBytes);
                }
            }
            break;
            }
            img.Dispose();
        }
        protected override void draw(SdlDotNet.Graphics.Surface s)
        {
            if (_prevSurface == null)
            {
                _prevSurface               = new Surface(s);
                _prevSurface.Transparent   = true;
                _prevSurface.AlphaBlending = true;
                _prevSurface.Alpha         = 64;
            }

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

            if (_errorMessageSurface == null && _errorMessages != null)
            {
                _errorMessageSurface = new SurfaceCollection();
                _errorMessageRects   = new Rectangle[_errorMessages.Length];
                ImageUtil.CreateStrMenu(_errorMessages, Color.White, ref _errorMessageSurface, ref _errorMessageRects, s.Width);
            }
            if (_errorMessageSurface != null)
            {
                ImageUtil.DrawSurfaces(s, _errorMessageSurface, _errorMessageRects, new Point(0, 100), MenuItemAlign.TopCenter);
            }
        }
Exemple #57
0
        public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
        {
            dstSrf.Blit(mBackground, this.ScreenLocation);

            base.Update(dstSrf, e);
        }
Exemple #58
0
        public TIA(Controller CtrlA, Controller CtrlB)
        {
            // Initialize fast collision masking

            m_Collisions = new byte[15];

            m_ColorTranslate = new uint[192];
            m_ScanLine       = new byte[224];   // NOTE: extra +64 bytes for overflow
            m_LastScanLine   = new byte[224];   //

            m_CtrlA = CtrlA;
            m_CtrlB = CtrlB;

            m_Blanking = false;
            m_Syncing  = false;

            m_Clock       = 0;
            m_vPos        = 0;
            m_hPos        = 0;
            m_hDirty      = 0;
            m_BlankPeriod = 0;

            m_DrawMode = 0;

            m_ChromaPF = 0;
            m_ChromaP0 = 0;
            m_ChromaP1 = 0;
            m_ChromaBK = 0;

            m_MoveP0 = 0;
            m_MoveP1 = 0;
            m_MoveM0 = 0;
            m_MoveM1 = 0;
            m_MoveBL = 0;

            m_P0Pos = 0;
            m_P1Pos = 0;
            m_M0Pos = 0;
            m_M1Pos = 0;
            m_BLPos = 0;

            m_P0MidDelay = 0;
            m_P1MidDelay = 0;
            m_M0Size     = 0;
            m_M1Size     = 0;
            m_BLSize     = 0;

            m_GapP0     = 0;
            m_StretchP0 = 0;
            m_RepeatP0  = 0;
            m_GapP1     = 0;
            m_StretchP1 = 0;
            m_RepeatP1  = 0;

            m_RefPF = false;
            m_RefP0 = false;
            m_RefP1 = false;

            // Missle Lock registers
            m_M0Lock = false;
            m_M1Lock = false;

            // Enable and graphic registers
            m_EnaM0    = false;
            m_EnaM1    = false;
            m_EnaBL    = false;
            m_EnaBLDel = false;
            m_P0Grp    = 0;
            m_P0GrpDel = 0;
            m_P1Grp    = 0;
            m_P1GrpDel = 0;
            m_PF0Grp   = 0;
            m_PF1Grp   = 0;
            m_PF2Grp   = 0;

            // Delay Registers
            m_VDelP0 = false;
            m_VDelP1 = false;
            m_VDelBL = false;

            // Create audio channels
            m_SndChA = AudioMixer.OpenChannel();
            m_SndChB = AudioMixer.OpenChannel();

            m_VideoFrame = new SdlDotNet.Graphics.Surface(320, VideoFrameHeight, 32);
            m_VideoFrame.AlphaBlending = true;
            m_VideoFrame.Alpha         = 127;

            m_ScanLineBlitted = new uint[160 * VideoFrameHeight];
        }
Exemple #59
0
 private void DrawBackground(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     mBackground.Fill(Color.White);
     dstSrf.Blit(mBackground, new Point(this.ScreenLocation.X, this.ScreenLocation.Y + buttonHeight));
 }
Exemple #60
0
 public override void Update(SdlDotNet.Graphics.Surface dstSrf, SdlDotNet.Core.TickEventArgs e)
 {
     base.Update(dstSrf, e);
 }