public OverlayRenderer(PathOfExile poe, RenderingContext rc) { this.poe = poe; poe.Area.OnAreaChange += area => modelUpdatePeriod = 6; this.MinimapRenderer = new MinimapRenderer(); this.XphRenderer = new XPHRenderer(); this.PreloadAlert = new PreloadAlert(); this.hudRenderers = new List <HUDPlugin> { new HealthBarRenderer(), new ItemAlerter(), this.MinimapRenderer, new ItemLevelRenderer(), new ItemRollsRenderer(), new DangerAlert(), this.XphRenderer, new ClientHacks(), this.PreloadAlert }; if (Settings.GetBool("Window.ShowIngameMenu")) { #if !DEBUG this.hudRenderers.Add(new Menu.Menu()); #endif } rc.OnRender += this.rc_OnRender; this.hudRenderers.ForEach(x => x.Init(poe, this)); }
void Awake() { roomGridMesh = FindObjectOfType <RoomGridMesh>(); playerMovement = FindObjectOfType <PlayerMovement>(); playerStats = FindObjectOfType <PlayerStats>(); minimapRenderer = FindObjectOfType <MinimapRenderer>(); // Zip up POI prefabs (assume equal length) poiPrefabs = ZipPOIPrefabs(); }
private void minimapBox_Paint(object sender, PaintEventArgs e) { if (map == null || !big) { return; } Graphics graphics = e.Graphics; graphics.CompositingQuality = CompositingQuality.HighSpeed; graphics.CompositingMode = CompositingMode.SourceOver; graphics.Clear(Color.Black); Bitmap bitmap1; if (bitmap2 != null) { bitmap1 = bitmap2; } else { Bitmap bitmap2 = new Bitmap(256, 256); Rectangle clip = new Rectangle(new Point(0, 0), new Size(256, 256)); MinimapRenderer minimapRenderer = new MinimapRenderer(bitmap2, map, MainWindow.Instance.mapView.MapRenderer.FakeWalls); minimapRenderer.LockBitmap(); minimapRenderer.DrawMinimap(1, clip); bitmap1 = minimapRenderer.UnlockBitmap(); } bitmap2 = bitmap1; graphics.DrawImage(bitmap1, 0, 0, bitmap1.Width, bitmap1.Height); int num1 = MainWindow.Instance.mapView.scrollPanel.HorizontalScroll.Value + sqSize; int num2 = MainWindow.Instance.mapView.scrollPanel.VerticalScroll.Value + sqSize; int x = num1 / sqSize; int y = num2 / sqSize; int width = MainWindow.Instance.mapView.scrollPanel.Width / sqSize; int height = MainWindow.Instance.mapView.scrollPanel.Height / sqSize; screenRect = new Rectangle(new Point(x, y), new Size(width, height)); screenRect = new Rectangle(new Point(x, y), new Size(width, height)); relpoint = new Point(x + width / 2, y + height / 2); Pen pen = Opacity < 0.5 ? new Pen(Color.Gray, 2f) : new Pen(Color.Aqua, 2f); graphics.DrawRectangle(pen, screenRect); }
/// <summary> /// Called when a frame is to be drawn to the screen /// </summary> /// <param name="gameTime">The current time</param> public override void Render(DwarfTime gameTime) { Game.Graphics.GraphicsDevice.SetRenderTarget(null); Game.Graphics.GraphicsDevice.Clear(Color.Black); EnableScreensaver = !World.ShowingWorld; if (World.ShowingWorld) { World.Renderer.ValidateShader(); if (!MinimapFrame.Hidden && !Gui.RootItem.Hidden) { MinimapRenderer.PreRender(DwarfGame.SpriteBatch); } World.Renderer.Render(gameTime); CurrentTool.Render3D(Game, gameTime); VoxSelector.Render(); foreach (var obj in SelectedObjects) { if (obj.IsVisible && !obj.IsDead) { Drawer3D.DrawBox(obj.GetBoundingBox(), Color.White, 0.01f, true); } } CurrentTool.Render2D(Game, gameTime); foreach (CreatureAI creature in World.PersistentData.SelectedMinions) { foreach (Task task in creature.Tasks) { if (task.IsFeasible(creature.Creature) == Feasibility.Feasible) { task.Render(gameTime); } } if (creature.CurrentTask.HasValue(out var currentTask)) { currentTask.Render(gameTime); } } DwarfGame.SpriteBatch.Begin(); BodySelector.Render(DwarfGame.SpriteBatch); DwarfGame.SpriteBatch.End(); if (Gui.RenderData.RealScreen.Width != Gui.RenderData.Device.Viewport.Width || Gui.RenderData.RealScreen.Height != Gui.RenderData.Device.Viewport.Height) { Gui.RenderData.CalculateScreenSize(); Gui.RootItem.Rect = Gui.RenderData.VirtualScreen; Gui.ResetGui(); CreateGUIComponents(); } if (!MinimapFrame.Hidden && !Gui.RootItem.Hidden) { Gui.Draw(new Point(0, 0), false); MinimapRenderer.Render(new Rectangle(MinimapFrame.Rect.X, MinimapFrame.Rect.Bottom - 192, 192, 192), Gui); Gui.DrawMesh(MinimapFrame.GetRenderMesh(Gui.RenderMeshInvalidation), Gui.SpriteAtlas.Texture); Gui.RedrawPopups(); Gui.DrawMouse(); } else { Gui.Draw(); } } base.Render(gameTime); }