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)); }
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); }
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)); }
public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m) { if (chip != 0) { s.Fill(r, _foreColor); } }
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; }
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); }
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)); }
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); }
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)); }
public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m) { if (chip != 0) { if (chip >= 0 && chip < _colors.Length) s.Fill(r, _colors[chip]); } }
public virtual void Render(Surface s, Point p) { s.Blit(_graphic, new Point(p.X - (int)(_width / 2.0), p.Y - (int)(_height / 2.0))); foreach (Point offset in _collisionPoints) { s.Fill(new Rectangle(p.X - offset.X, p.Y - offset.Y, 1, 1), Color.Red); } }
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); }
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))); }
private void UpdateTexture() { if (mBackcolor.A != 0) { mTexture.Fill(mBackcolor); } else { mTexture.Transparent = true; mTexture.TransparentColor = Color.Transparent; mTexture.Fill(Color.Transparent); } mBackgroundTexture.Fill(mHoverColor); mTexture.Blit(mBackgroundTexture, new Point(1, 1)); mTexture.Blit(mFont.Render(mText, mForecolor), new Point(((mTexture.Width / 2) - (mTextSize.Width / 2)) + mXOffset, ((mTexture.Height / 2) - (mTextSize.Height / 2)) + mYOffset)); for (int i = 0; i < mBorderWidth; i++) { Gfx.IPrimitive border = new Gfx.Primitives.Box((short)(i + 1), (short)(i + 1), (short)(this.Width - (2 + i)), (short)(this.Height - (2 + i))); mTexture.Draw(border, mBorderColor); } }
public override void Init() { Surface temp = new Surface("Data/intro.bmp"); bg = temp.CreateResizedSurface(Video.Screen.Size); fader = new Surface(bg.Width, bg.Height, bg.BitsPerPixel, bg.RedMask, bg.GreenMask, bg.BlueMask, bg.AlphaMask); fader.Alpha = 255; fader.Fill(System.Drawing.Color.Black); fader.AlphaBlending = true; }
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); }
public InfoForm() { InitializeComponent(); surface = new Surface(surfaceControl.Width, surfaceControl.Height); surface.Fill(this.BackColor); surfaceControl.Blit(surface); this.surfaceControl.MouseMove += new MouseEventHandler(surfaceControl_MouseMove); this.surfaceControl.MouseClick += new MouseEventHandler(surfaceControl_MouseMove); this.surfaceControl.MouseEnter += new EventHandler(surfaceControl_MouseEnter); this.surfaceControl.MouseLeave += new EventHandler(surfaceControl_MouseLeave); }
public EditorGrid() { sfcGrid = new Surface (new Size (Constants.Constants.MAP_WIDTH + Constants.Constants.MAP_WIDTH * Tile.WIDTH, Constants.Constants.MAP_HEIGHT + Constants.Constants.MAP_HEIGHT * Tile.HEIGHT)); sfcGrid.Fill (Color.Transparent); Graphic vertical = new Graphic (Color.Black, 1, Tile.HEIGHT * Constants.Constants.MAP_HEIGHT + Constants.Constants.MAP_HEIGHT * 2); Graphic horizont = new Graphic (Color.Black, Tile.WIDTH * Constants.Constants.MAP_WIDTH + Constants.Constants.MAP_WIDTH * 2, 1); for (int x=0; x < Constants.Constants.MAP_WIDTH; x++) { vertical.Draw (sfcGrid, x * 2 + x * Tile.WIDTH, 0, 255, true); } for (int y=0; y < Constants.Constants.MAP_HEIGHT; y++) { horizont.Draw (sfcGrid, 0, y * 2 + y * Tile.HEIGHT, 255, true); } }
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()); } }
public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m) { if (chip < 0 || chip >= _chipSurfaces.Count) return; if (chip == 0) return; switch (m) { case ChipResizeMethod.Stretch: Color c = _avgColors[chip]; s.Fill(r, c); break; case ChipResizeMethod.Tile: Surface ss = _chipSurfaces[(int)chip]; s.Blit(ss, r); break; } }
public override Surface Render() { Surface buffer = new Surface(Width, Height); buffer.Fill(Background); Line Top = new Line(new Point(0, 0), new Point(Width - 1, 0)); Line Bottom = new Line(new Point(0, Height - 1), new Point(Width - 1, Height - 1)); Line Left = new Line(new Point(0, 0), new Point(0, Height - 1)); Line Right = new Line(new Point(Width - 1, 0), new Point(Width - 1, Height - 1)); Top.Draw(buffer, Color.LightGray); Left.Draw(buffer, Color.LightGray); Bottom.Draw(buffer, Color.DarkGray); Right.Draw(buffer, Color.DarkGray); return buffer; }
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; }
public static Surface GetSurface(byte[] imgBytes, Size boxSize) { Surface boxSurf = new Surface(boxSize); boxSurf.Fill(Color.White); //Fill background to white color //Get and resize image if (imgBytes != null) { Surface imgSurf = new Surface(imgBytes); double scale = Ratio.CalculateScale(imgSurf.Size, new Size(boxSize.Width, boxSize.Height), Ratio.RatioType.FitImage); //Calculate ratio Surface scaledSurf = imgSurf.CreateScaledSurface(scale, true); imgSurf.Dispose(); Point pt = new Point((boxSize.Width - scaledSurf.Width) / 2, //Left point (boxSize.Height - scaledSurf.Height) / 2); //Top point boxSurf.Blit(scaledSurf, pt); scaledSurf.Dispose(); //Clear imgSurf memory } //Draw border for(int i = 0; i < BORDER; i++) boxSurf.Draw(new Box(new Point(i, i), new Point(boxSize.Width - i - 1, boxSize.Height - i - 1)), Color.Gray); return boxSurf; }
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); } }
public Surface Render(CreepUnitList ToRender, Map map) { Surface CreepsLayer = new Surface(map.Columns*Tile.TILE_WIDTH,map.Rows*Tile.TILE_HEIGHT); CreepsLayer.Fill(Color.Magenta); CreepsLayer.TransparentColor = Color.Magenta; CreepsLayer.Transparent = true; foreach (CreepUnit Unit in ToRender) { if (!Unit.Position.IsEmpty && Unit.Health > 0) { if (!Sprites.ContainsKey(Unit)) { Sprites.Add(Unit, new DirectionnalSprite(Textures)); } /*Surface Creep = new Surface(CreepUnit.CREEP_WIDTH_PX, CreepUnit.CREEP_HEIGHT_PX); Creep.Fill(Color.Red); Circle c = new Circle(11, 11, 3); Creep.Draw(c, Color.SeaGreen, true); Rectangle Clip = new Rectangle(Unit.Position, Creep.Size); CreepsLayer.Blit(Creep, Clip);*/ } else if (Unit.Health <= 0 || Unit.Position.IsEmpty) { if (Sprites.ContainsKey(Unit)) { Sprites[Unit].Visible = false; Sprites.Remove(Unit); } } else if (Unit.Position.X == 0 && Unit.Position.Y == 0 && !Unit.Position.IsEmpty) { if (Sprites.ContainsKey(Unit)) { Sprites[Unit].Visible = false; Sprites.Remove(Unit); } } } foreach(CreepUnit Unit in Sprites.Keys) { Sprites[Unit].Direction = Unit.Direction; Sprites[Unit].X = Unit.Position.X; Sprites[Unit].Y = Unit.Position.Y; Sprites[Unit].UpdateFrame(); if(Sprites[Unit].Position.X != 0 && Sprites[Unit].Position.Y != 0) { CreepsLayer.Blit(Sprites[Unit]); } } //Healh Bar Render foreach (CreepUnit Unit in ToRender) { if (!Unit.Position.IsEmpty && Unit.Health != 0) { if (Unit.Health != 0) { Surface HealthBSur = RenderHealthBar(Unit.TotalHealth, Unit.Health); Point HealthBarP = new Point(Unit.Position.X, Unit.Position.Y - 6); Rectangle Clip = new Rectangle(HealthBarP, HealthBSur.Size); CreepsLayer.Blit(RenderHealthBar(Unit.TotalHealth, Unit.Health), Clip); } } } return CreepsLayer; }
public static void DrawMiniMap(RendererDestinationData destData, Map activeMap) { int tileRatio = 3; int mapPadding = 20; int mapWidth = tileRatio * activeMap.Tile.GetLength(0); int mapHeight = tileRatio * activeMap.Tile.GetLength(1); int startX = destData.Location.X + destData.Size.Width - mapWidth - mapPadding; int startY = destData.Location.Y + mapPadding; Surface miniMapSurface = new Surface(mapWidth, mapHeight); miniMapSurface.Alpha = 155; miniMapSurface.AlphaBlending = true; miniMapSurface.Fill(Color.Gray); for (int x = 0; x < activeMap.Tile.GetLength(0); x++) { for (int y = 0; y < activeMap.Tile.GetLength(1); y++) { Tile tile = activeMap.Tile[x, y]; if (PlayerManager.MyPlayer.X == x && PlayerManager.MyPlayer.Y == y) { miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.LightCyan); continue; } if (tile.SeenBySelf) { switch (tile.Type) { case Enums.TileType.Blocked: case Enums.TileType.MobileBlock: miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.Black); break; case Enums.TileType.RDungeonGoal: miniMapSurface.Fill(new Rectangle(x * tileRatio, y * tileRatio, tileRatio, tileRatio), Color.Cyan); break; default: break; } } } } foreach (MapItem item in activeMap.MapItems) { if (item.Num != -1 && activeMap.Tile[item.X, item.Y].SeenBySelf) { miniMapSurface.Fill(new Rectangle(item.X * tileRatio, item.Y * tileRatio, tileRatio, tileRatio), Color.Yellow); } } foreach (MapNpc npc in activeMap.MapNpcs) { if (npc.X >= 0 && npc.X < activeMap.Tile.GetLength(0) && npc.Y >= 0 && npc.Y < activeMap.Tile.GetLength(1)) { if (npc.Sprite != 0 && (npc.ScreenActive) && activeMap.Tile[npc.X, npc.Y].SeenBySelf) { miniMapSurface.Fill(new Rectangle(npc.X * tileRatio, npc.Y * tileRatio, tileRatio, tileRatio), Color.Red); } } } destData.Blit(miniMapSurface, new Point(startX, startY)); }
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); }
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)); }
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> /// 画面の描画処理 /// </summary> /// <param name="s">画面</param> public void Draw(Surface s) { try { if (_transitionStart) { if (_transitionBeforeSurface == null) { _transitionBeforeSurface = new Surface(s); _transitionBeforeSurface.Transparent = true; _transitionBeforeSurface.AlphaBlending = true; _transitionBeforeSurface.Alpha = 0; } _transitionBeforeSurface.Alpha = (byte)(255 * _transitionTime / (double)_transitionTimeLong); s.Fill(Constants.Color_Transition); s.Blit(_transitionBeforeSurface); } else { draw(s); } } catch (Exception ex) { SetAlert(true, ex.Message); } if (_onAlert && _alertSurface != null) { s.Blit(_alertSurface, new Point( (int)(Constants.ScreenWidth / 2.0 - _alertSurface.Width / 2.0), (int)(Constants.ScreenHeight / 2.0 - _alertSurface.Height / 2.0))); } }
public void Dibujar(Laberinto laberinto,bool pausa) { Video.Screen.Fill(Color.Black); for (int x = 0; x < laberinto.getAncho(); x+=Laberinto.TBloque) for (int y = 0; y < laberinto.getAlto(); y+=Laberinto.TBloque) { if(laberinto.bloqueEn(x,y) is Pared) Dibujar((Pared)laberinto.bloqueEn(x, y),laberinto.Pared); } if(!laberinto.enTransicion()) screen.Blit(new TextSprite("Nivel "+laberinto.NumeroNivel.ToString(), fuente, Color.White, new Point(ancho / 2 - 50, alto - (laberinto.getAlto()+5) * unidad))); foreach (IEnemigo enemigo in laberinto.Enemigos) { if (enemigo is PersonajeTerrestre) Dibujar((PersonajeTerrestre)enemigo); } foreach (Jugador jugador in laberinto.Jugadores) { if(jugador.Vidas>=0) Dibujar(jugador); } foreach (ObjetoDisparado ob in laberinto.ObjetosDisparados) { Dibujar(ob); } foreach (Burbuja b in laberinto.Burbujas) { Dibujar(b); } foreach (Fruta fruta in laberinto.Frutas) { if (fruta is Cereza) Dibujar((Cereza)fruta); else Dibujar(fruta); } if (pausa) { Rectangle rect = new Rectangle(0, 0, screen.Width, screen.Height); Surface srf = new Surface(rect); srf.Fill(Color.Black); srf.Alpha = 128; srf.AlphaBlending = true; screen.Blit(srf); Dibujar(menu); } particles.Update(); particles.Render(Video.Screen); Video.Update(); }
public virtual Surface CustomItemRender(GuiItem Item) { Surface buffer = new Surface(Item.Width, Item.Height); buffer.Fill(Color.Aqua); return buffer; }
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)); } }
public Surface CloseButtonRenderHighlight() { Surface Buffer = new Surface(18, 18); Buffer.Fill(Color.Snow); Line Top = new Line(new Point(0, 0), new Point(18 - 1, 0)); Line Bottom = new Line(new Point(0, 18 - 1), new Point(18 - 1, 18 - 1)); Line Left = new Line(new Point(0, 0), new Point(0, 18 - 1)); Line Right = new Line(new Point(18 - 1, 0), new Point(18 - 1, 18 - 1)); Buffer.Draw(Top, Color.Black); Buffer.Draw(Bottom, Color.Black); Buffer.Draw(Left, Color.Black); Buffer.Draw(Right, Color.Black); Surface Caption = DefaultStyle.GetFont().Render("X", Color.Black); int x = (Buffer.Width - Caption.Width) / 2; int y = (Buffer.Height - Caption.Height) / 2; Buffer.Blit(Caption, new Point(x + 1, y + 1)); return Buffer; }
protected override void draw(SdlDotNet.Graphics.Surface s) { s.Fill(Constants.Color_Background); // タイトル if (_optSurface == null) { _optSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_Option, Constants.Color_Strong); } s.Blit(_optSurface, new Point(Constants.HeaderX, Constants.HeaderY)); // 今選択中のドメイン if (_state == SelectionState.Device) { s.Fill(new Rectangle(_devHeadRect.Left, _devRect.Top, _devHeadRect.Width, _devRect.Height), Constants.Color_Selection); } else if (_state == SelectionState.Calibration) { s.Fill(new Rectangle(_calHeadRect.Left, _calMenuRect.Top, _calHeadRect.Width, _calMenuRect.Height), Constants.Color_Selection); } // Audio Device / Calibration Header if (_devHeadSurface == null) { _devHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_AudioDevices, Constants.Color_Foreground); } s.Blit(_devHeadSurface, _devHeadRect.Location); if (_calHeadSurface == null) { _calHeadSurface = ResourceManager.MiddlePFont.Render(Properties.Resources.HeaderTitle_Calibration, Constants.Color_Foreground); } s.Blit(_calHeadSurface, _calHeadRect.Location); if (_expSurface == null) { _expSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Explanation_Calibration, Constants.Color_Strong); } s.Blit(_expSurface, new Point(_calHeadRect.X, _calRect.Y)); // 選択肢 ImageUtil.DrawSelections(s, _endHeadSurfaces, _endHeadRects, _headCursor, _endHeadRect.Location, (_state == SelectionState.Back ? 0 : -1), MenuItemAlign.TopLeft); ImageUtil.DrawSelections(s, _calSurfaces, _calRects, _cursor, _calMenuRect.Location, (_state == SelectionState.Calibration ? _calSelectedIdx : -1), MenuItemAlign.TopLeft); ImageUtil.DrawSelections(s, _devDrawSurfaces, _devDrawRects, _cursor, _devRect.Location, _devSelectedIdx - _devDrawFirstIdx, MenuItemAlign.TopLeft); // 高音・低音の値 Surface hs = _calSurfaces[0]; Surface ls = _calSurfaces[1]; double maxFreq = Config.Instance.MaxFreq; double minFreq = Config.Instance.MinFreq; if (_isCalStarted) { switch (_calSelectedIdx) { case IDX_MAXPITCH: maxFreq = getAvgValue(IDX_MAXPITCH); break; case IDX_MINPITCH: minFreq = getAvgValue(IDX_MINPITCH); break; } } using (Surface ts = ResourceManager.SmallPFont.Render(maxFreq.ToString("F1"), Constants.Color_Foreground)) { s.Blit(ts, new Point(_calRects[0].X + hs.Width + _calMenuRect.X + 10, _calRects[0].Y + _calMenuRect.Y)); } using (Surface ts = ResourceManager.SmallPFont.Render(minFreq.ToString("F1"), Constants.Color_Foreground)) { s.Blit(ts, new Point(_calRects[1].X + ls.Width + _calMenuRect.X + 10, _calRects[1].Y + _calMenuRect.Y)); } // 計測中かどうか if (_isCalStarted) { using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Calibrating, Constants.Color_Strong)) { s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom)); } } // 波形 if (_audioInput.Capturing) { using (Surface ts = ResourceManager.SmallTTFont.Render( _curToneResult.ToString(), Constants.Color_Strong)) { s.Blit(ts, new Point(_calMenuRect.X, _calMenuRect.Bottom + ResourceManager.SmallPFont.Height + 5)); } drawWave(s, _parent.PitchResult, _parent.ToneResult, ResourceManager.SmallTTFont, _calWaveRect); } }
protected virtual void renderPlayerInformation(Surface s) { #region ヘッダ部分初期化 if (_playerInfoSurface == null) { _playerInfoHeaderMaxWidth = 0; _playerInfoSurface = new Surface(_playerInfoRect.Width, _playerInfoRect.Height); _playerInfoSurface.Fill(_foreColor); int dh = (int)((_playerInfoRect.Height - Constants.PlayerInfoPadding * 2) / 3.0); int x = Constants.PlayerInfoPadding; int y = Constants.PlayerInfoPadding + (int)(dh / 2.0 - ResourceManager.SmallPFont.Height / 2.0); using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Life + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) _playerInfoHeaderMaxWidth = ts.Width; } y += dh; using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Pitch + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) _playerInfoHeaderMaxWidth = ts.Width; } y += dh; using (Surface ts = ResourceManager.SmallPFont.Render(Properties.Resources.Str_Distance + Properties.Resources.Str_Separator, _backColor)) { _playerInfoSurface.Blit(ts, new Point(x, y)); if (_playerInfoHeaderMaxWidth < ts.Width) _playerInfoHeaderMaxWidth = ts.Width; } } #endregion s.Blit(_playerInfoSurface, _playerInfoRect.Location); #region 現在の情報を描画 { int dh = (int)((_playerInfoRect.Height - Constants.PlayerInfoPadding * 2) / 3.0); int x = _playerInfoRect.X + Constants.PlayerInfoPadding + _playerInfoHeaderMaxWidth; int y = _playerInfoRect.Y + Constants.PlayerInfoPadding + (int)(dh / 2.0 - ResourceManager.SmallTTFont.Height / 2.0); int px = x; int py = _playerInfoRect.Y + Constants.PlayerInfoPadding + (int)(dh / 2.0); for (int i = 0; i < _parent.Player.Hp; i++) { s.Blit(_coloredLifeSurfaces[0], new Point(px, (int)(py - _coloredLifeSurfaces[0].Height / 2.0))); px += _coloredLifeSurfaces[0].Width; } for (int i = _parent.Player.Hp; i < _parent.Player.MaxHp; i++) { s.Blit(_coloredLifeSurfaces[1], new Point(px, (int)(py - _coloredLifeSurfaces[1].Height / 2.0))); px += _coloredLifeSurfaces[1].Width; } y += dh; using (Surface ts = ResourceManager.SmallTTFont.Render(_toneResult.ToString(), _backColor)) { s.Blit(ts, new Point(x, y)); } y += dh; if (_map.HasEnd) { using (Surface ts = ResourceManager.SmallTTFont.Render(string.Format("{0:F0} / {1}", _parent.Player.X, _map.Width), _backColor)) { s.Blit(ts, new Point(x, y)); } } else { using (Surface ts = ResourceManager.SmallTTFont.Render(string.Format("{0:F0}", _parent.Player.X), _backColor)) { s.Blit(ts, new Point(x, y)); } } } #endregion }
/// <summary>クリア画面を描画する</summary> protected virtual void renderClear(Surface s) { using (Surface vs = new Surface(s.Size)) { vs.Alpha = 180; vs.AlphaBlending = true; vs.Fill(_backColor); s.Blit(vs, Point.Empty); } if (_clearSurface == null) { _clearSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_Clear, _foreColor); } s.Blit(_clearSurface, new Point(Constants.HeaderX, Constants.HeaderY)); ImageUtil.DrawSelections(s, _clearMenuSurfaces, _clearMenuRects, _foreCursor, new Point( Constants.HeaderX + Constants.UnderHeaderMargin + Constants.CursorMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin), _clearSelectedIdx, MenuItemAlign.MiddleLeft); }
/// <summary> /// 画面の描画処理 /// </summary> /// <param name="s">画面</param> protected override void draw(Surface s) { // 背景枠描画 s.Fill(_foreColor); using (Surface viewSurface = new Surface(_viewRect.Size.Width, _viewRect.Size.Height, 32)) { // マップ描画 _map.Render(viewSurface, new Rectangle(0, 0, _viewRect.Width, _viewRect.Height)); // プレイヤー描画 _parent.Player.Render(viewSurface, convertToViewCoord(_parent.Player.X, _parent.Player.Y).Round()); if (_isPaused) { // ポーズ画面描画 renderPause(viewSurface); } else if (_isCleared) { // クリア画面描画 renderClear(viewSurface); } s.Blit(viewSurface, _viewRect.Location); } // 鍵盤描画 renderKeyboard(s); // ミニマップ描画 renderMiniMap(s); // プレイヤー情報描画 renderPlayerInformation(s); }
protected override void draw(Surface s) { // ゲームオーバー時画面 if (_prevSurface == null) { _prevSurface = new Surface(s); _prevSurface.Transparent = true; _prevSurface.AlphaBlending = true; _prevSurface.Alpha = 64; } s.Fill(_backColor); s.Blit(_prevSurface); // 画像 s.Blit(_overImgSurface, new Point(s.Size.Width - _overImgSurface.Width - 60, s.Size.Height - _overImgSurface.Height - 60)); // タイトル if (_overSurface == null) { _overSurface = ResourceManager.LargePFont.Render(Properties.Resources.HeaderTitle_GameOver, _foreColor); } s.Blit(_overSurface, new Point(Constants.HeaderX, Constants.HeaderY)); // メニュー ImageUtil.DrawSelections(s, _menuSurfaces, _menuRects, _cursor, new Point(Constants.HeaderX + Constants.UnderHeaderMargin + Constants.CursorMargin, Constants.HeaderY + ResourceManager.LargePFont.Height + Constants.HeaderBottomMargin), _selectedIdx, MenuItemAlign.TopLeft); }
public static Surface RenderHealthBar(int TotalHealth, int Health) { Surface Buffer = new Surface(HEALTHBAR_WIDTH, HEALTHBAR_HEIGHT); Buffer.Fill(Color.Red); int CurHealthWidth = (Buffer.Width * Health) / TotalHealth; Rectangle LifeRect = new Rectangle(new Point(0, 0), new Size(CurHealthWidth, HEALTHBAR_HEIGHT)); Buffer.Fill(LifeRect, Color.LimeGreen); Box Border = new Box(new Point(0, 0), new Size(Buffer.Width - 1, Buffer.Height - 1)); Buffer.Draw(Border, Color.Black, true); return Buffer; }
protected override void draw(Surface s) { s.Fill(Constants.Color_Background); if(_titleSurface == null) _titleSurface = ResourceManager.LoadSurface(Constants.Filename_TitleLogoImage); s.Blit(_coloredTitleSurface == null ? _titleSurface : _coloredTitleSurface, new Point((int)(s.Width / 2.0 - _titleSurface.Width / 2.0), 50)); ImageUtil.DrawSelections(s, _menuSurfaces, _menuRects, _cursor, new Point(0, 70 + _titleSurface.Height), _selectedIdx, MenuItemAlign.MiddleCenter); if (_alertSurface == null) { _alertSurface = ResourceManager.SmallPFont.Render( Properties.Resources.Explanation_TitleAlert, Constants.Color_Strong); } s.Blit(_alertSurface, new Point((int)(s.Width / 2.0 - _alertSurface.Width / 2.0), s.Height - _alertSurface.Height - 30)); }
protected override void renderMiniMapBackground(Surface s, Rectangle r) { s.Fill(r, _foreColor); }
public override Surface Render() { Surface Buffer = new Surface(Width, Height); Buffer.Blit(Background.Render(), Background.GetRect()); Buffer.Blit(BoxTitle.Render(), BoxTitle.GetRect()); int j = 0; for (int i = CurrentWave; i < WaveList.Wave.Count; i++) { if (j == 5) { break; } XmlCreepWave wave = WaveList.Wave[i]; //Surface label = DefaultStyle.GetFont().Render(wave.Name,Color.Black); //Point p = new Point((Width - label.Width) / 2, (j * INFOBOX_HEIGHT) + 20); if (j == 0) { Rectangle bg = new Rectangle(new Point(10, (j * INFOBOX_HEIGHT) + 20), new Size(Width - 20, INFOBOX_HEIGHT - 10)); Buffer.Fill(bg, Color.LightYellow); } Box Border = new Box(new Point(10,(j*INFOBOX_HEIGHT) + 20),new Size(Width - 20, INFOBOX_HEIGHT - 10)); Surface CreepGfx = WavesGfx[i]; Rectangle GfxRect = new Rectangle(new Point((Width - CreepGfx.Width) / 2, (j * INFOBOX_HEIGHT) + 25), CreepGfx.Size); Surface HealthLabel = DefaultStyle.GetFont().Render("Health : " + wave.Health, Color.Black); Point HealthP = new Point((Width - HealthLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 55); Surface WeaknessLabel = DefaultStyle.GetFont().Render("Weakness : " + UnitDmg.GetDamageType(wave.Weakness), Color.Black); Point WeaknessP = new Point((Width - WeaknessLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 70); Surface ResistLabel = DefaultStyle.GetFont().Render("Resist : " + UnitDmg.GetDamageType(wave.Resist), Color.Black); Point ResistP = new Point((Width - ResistLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 85); Surface creepsNb = DefaultStyle.GetBoldFont().Render("x" + wave.Numbers, Color.OrangeRed); Point creepsNbP = new Point(GfxRect.X + GfxRect.Width + 5, (j * INFOBOX_HEIGHT) + 35); if (wave.StealAmount != 1) { Surface stealLabel = DefaultStyle.GetFont().Render("Steal Multiple Crystal", Color.Red); Point stealP = new Point((Width - stealLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 100); Buffer.Blit(stealLabel, stealP); } else if (wave.Speed != 1) { Surface speedLabel = DefaultStyle.GetFont().Render("Moving Faster", Color.Red); Point speedP = new Point((Width - speedLabel.Width) / 2, (j * INFOBOX_HEIGHT) + 100); Buffer.Blit(speedLabel, speedP); } Buffer.Blit(CreepGfx, GfxRect); Buffer.Blit(HealthLabel, HealthP); Buffer.Blit(WeaknessLabel, WeaknessP); Buffer.Blit(ResistLabel, ResistP); Buffer.Blit(creepsNb, creepsNbP); Buffer.Draw(Border, Color.Black); j++; } return Buffer; }
/// <summary> /// /// </summary> /// <param name="surface"></param> protected override void DrawGameObject(Surface surface) { surface.Fill(this.Rectangle, Color.Red); }