public override void DrawDev(SpriteBatch spriteBatch) { BaseSheet blank = GraphicsManager.Pixel; int tileSize = ZoneManager.Instance.CurrentGround.TileSize; for (int jj = viewTileRect.Y; jj < viewTileRect.End.Y; jj++) { for (int ii = viewTileRect.X; ii < viewTileRect.End.X; ii++) { if (Collision.InBounds(ZoneManager.Instance.CurrentGround.Width, ZoneManager.Instance.CurrentGround.Height, new Loc(ii, jj))) { blank.Draw(spriteBatch, new Rectangle((int)((ii * tileSize - ViewRect.X) * windowScale * scale), (int)((jj * tileSize - ViewRect.Y) * windowScale * scale), (int)(tileSize * windowScale * scale), 1), null, Color.White * 0.5f); blank.Draw(spriteBatch, new Rectangle((int)((ii * tileSize - ViewRect.X) * windowScale * scale), (int)((jj * tileSize - ViewRect.Y) * windowScale * scale), 1, (int)(tileSize * windowScale * scale)), null, Color.White * 0.5f); } else if (ii == ZoneManager.Instance.CurrentGround.Width && Collision.InBounds(ZoneManager.Instance.CurrentGround.Height, jj)) { blank.Draw(spriteBatch, new Rectangle((int)((ii * tileSize - ViewRect.X) * windowScale * scale), (int)((jj * tileSize - ViewRect.Y) * windowScale * scale), 1, (int)(tileSize * windowScale * scale)), null, Color.White * 0.5f); } else if (jj == ZoneManager.Instance.CurrentGround.Height && Collision.InBounds(ZoneManager.Instance.CurrentGround.Width, ii)) { blank.Draw(spriteBatch, new Rectangle((int)((ii * tileSize - ViewRect.X) * windowScale * scale), (int)((jj * tileSize - ViewRect.Y) * windowScale * scale), (int)(tileSize * windowScale * scale), 1), null, Color.White * 0.5f); } } } base.DrawDev(spriteBatch); }
public override void Draw(SpriteBatch spriteBatch) { float window_scale = GraphicsManager.WindowZoom; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Matrix.CreateScale(new Vector3(window_scale, window_scale, 1))); BaseSheet bg = GraphicsManager.GetBackground(GraphicsManager.TitleBG); bg.Draw(spriteBatch, new Vector2(), null); if (!hideTitle) { BaseSheet title = GraphicsManager.Title; title.Draw(spriteBatch, new Vector2(GraphicsManager.ScreenWidth / 2 - title.Width / 2, 0), null); if ((GraphicsManager.TotalFrameTick - startTime) > (ulong)FrameTick.FrameToTick(ENTER_WAIT_TIME) && ((GraphicsManager.TotalFrameTick - startTime) / (ulong)FrameTick.FrameToTick(ENTER_FLASH_TIME / 2)) % 2 == 0) { BaseSheet subtitle = GraphicsManager.Subtitle; subtitle.Draw(spriteBatch, new Vector2(GraphicsManager.ScreenWidth / 2 - subtitle.Width / 2, GraphicsManager.ScreenHeight * 3 / 4), null); } } spriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch, Loc pos, ulong totalTick, Color color) { if (Frames.Count > 0) { int currentFrame = (int)(totalTick / (ulong)FrameTick.FrameToTick(FrameLength) % (ulong)Frames.Count); TileFrame frame = Frames[currentFrame]; if (frame != TileFrame.Empty) { BaseSheet texture = GraphicsManager.GetTile(frame); texture.Draw(spriteBatch, pos.ToVector2(), null, color); } } }
public override void DrawDebug(SpriteBatch spriteBatch) { BaseSheet blank = GraphicsManager.Pixel; ZoneManager.Instance.CurrentGround.DrawDebug(ViewRect.X, ViewRect.Y, ViewRect.Width, ViewRect.Height, (int x, int y, int w, int h, float alpha) => { blank.Draw(spriteBatch, new Rectangle((int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), (int)(w * windowScale * scale), 1), null, Color.White * alpha); blank.Draw(spriteBatch, new Rectangle((int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), 1, (int)(h * windowScale * scale)), null, Color.White * alpha); }, (AABB.IObstacle box) => { if (box is GroundWall) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Red * 0.3f); } else if (box is GroundChar) { if (((GroundChar)box).EntEnabled) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Yellow * 0.7f); } } else if (box is GroundObject) { if (((GroundObject)box).EntEnabled) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Cyan * 0.5f); } } else { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Gray * 0.5f); } }, (string message, int x, int y, float alpha) => { int size = GraphicsManager.SysFont.SubstringWidth(message); GraphicsManager.SysFont.DrawText(spriteBatch, (int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), message, null, DirV.None, DirH.None); }); if (FocusedCharacter != null) { GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 32, String.Format("Z:{0:D3} S:{1:D3} M:{2:D3}", ZoneManager.Instance.CurrentZoneID, ZoneManager.Instance.CurrentMapID.Segment, ZoneManager.Instance.CurrentMapID.ID), null, DirV.Up, DirH.Right, Color.White); GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 42, String.Format("X:{0:D3} Y:{1:D3}", FocusedCharacter.MapLoc.X, FocusedCharacter.MapLoc.Y), null, DirV.Up, DirH.Right, Color.White); MonsterID monId; Loc offset; int anim; int currentHeight, currentTime, currentFrame; FocusedCharacter.GetCurrentSprite(out monId, out offset, out currentHeight, out anim, out currentTime, out currentFrame); GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 52, String.Format("{0}:{1}:{2}", anim.ToString(), FocusedCharacter.CharDir.ToString(), currentFrame), null, DirV.Up, DirH.Right, Color.White); GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 62, String.Format("Frame {0:D3}", currentTime), null, DirV.Up, DirH.Right, Color.White); } }
public override void DrawDebug(SpriteBatch spriteBatch) { BaseSheet blank = GraphicsManager.Pixel; ZoneManager.Instance.CurrentGround.DrawDebug(ViewRect.X, ViewRect.Y, ViewRect.Width, ViewRect.Height, (int x, int y, int w, int h, float alpha) => { blank.Draw(spriteBatch, new Rectangle((int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), (int)(w * windowScale * scale), 1), null, Color.White * alpha); blank.Draw(spriteBatch, new Rectangle((int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), 1, (int)(h * windowScale * scale)), null, Color.White * alpha); }, (AABB.IObstacle box) => { if (box is GroundWall) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Red * 0.3f); } else if (box is GroundChar) { if (((GroundChar)box).EntEnabled) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Yellow * 0.7f); } } else if (box is GroundObject) { if (((GroundObject)box).EntEnabled) { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Cyan * 0.5f); } } else { blank.Draw(spriteBatch, new Rectangle((int)((box.Bounds.X - ViewRect.X) * windowScale * scale), (int)((box.Bounds.Y - ViewRect.Y) * windowScale * scale), (int)(box.Bounds.Width * windowScale * scale), (int)(box.Bounds.Height * windowScale * scale)), null, Color.Gray * 0.5f); } }, (string message, int x, int y, float alpha) => { int size = GraphicsManager.SysFont.SubstringWidth(message); GraphicsManager.SysFont.DrawText(spriteBatch, (int)((x - ViewRect.X) * windowScale * scale), (int)((y - ViewRect.Y) * windowScale * scale), message, null, DirV.None, DirH.None); }); base.DrawDebug(spriteBatch); if (FocusedCharacter != null) { GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 62, String.Format("Z:{0:D3} S:{1:D3} M:{2:D3}", ZoneManager.Instance.CurrentZoneID, ZoneManager.Instance.CurrentMapID.Segment, ZoneManager.Instance.CurrentMapID.ID), null, DirV.Up, DirH.Right, Color.White); GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 72, String.Format("X:{0:D3} Y:{1:D3}", FocusedCharacter.MapLoc.X, FocusedCharacter.MapLoc.Y), null, DirV.Up, DirH.Right, Color.White); MonsterID monId; Loc offset; int anim; int currentHeight, currentTime, currentFrame; FocusedCharacter.GetCurrentSprite(out monId, out offset, out currentHeight, out anim, out currentTime, out currentFrame); CharSheet charSheet = GraphicsManager.GetChara(FocusedCharacter.CurrentForm); Color frameColor = Color.White; string animName = GraphicsManager.Actions[anim].Name; int resultAnim = charSheet.GetReferencedAnimIndex(anim); if (resultAnim == -1) { frameColor = Color.Gray; } else if (resultAnim != anim) { animName += "->" + GraphicsManager.Actions[resultAnim].Name; frameColor = Color.Yellow; } GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 82, String.Format("{0}:{1}:{2:D2}", animName, FocusedCharacter.CharDir.ToString(), currentFrame), null, DirV.Up, DirH.Right, frameColor); GraphicsManager.SysFont.DrawText(spriteBatch, GraphicsManager.WindowWidth - 2, 92, String.Format("Frame {0:D3}", currentTime), null, DirV.Up, DirH.Right, Color.White); PortraitSheet sheet = GraphicsManager.GetPortrait(FocusedCharacter.CurrentForm); sheet.DrawPortrait(spriteBatch, new Vector2(0, GraphicsManager.WindowHeight - GraphicsManager.PortraitSize), new EmoteStyle(DebugEmote)); frameColor = Color.White; string emoteName = GraphicsManager.Emotions[DebugEmote].Name; int resultEmote = sheet.GetReferencedEmoteIndex(DebugEmote); if (resultEmote == -1) { frameColor = Color.Gray; } else if (resultEmote != DebugEmote) { emoteName += "->" + GraphicsManager.Emotions[resultEmote].Name; frameColor = Color.Yellow; } GraphicsManager.SysFont.DrawText(spriteBatch, 2, GraphicsManager.WindowHeight - GraphicsManager.PortraitSize - 2, emoteName, null, DirV.Down, DirH.Left, frameColor); } }