Exemple #1
0
        public static void DrawAllTasks()
        {
            lock (_lock_TaskDictEdit)
            {
                if (TaskDict.Count > 0)
                {
                    GFX.SpriteBatch.Begin();

                    int i = 0;
                    foreach (var kvp in TaskDict)
                    {
                        // Draw Task Rect
                        Rectangle thisTaskRect = new Rectangle(
                            GFX.Device.Viewport.Width - GuiTaskRectWidth - GuiDistFromEdgesOfScreen,
                            GuiDistFromEdgesOfScreen + ((GuiDistBetweenProgressRects + GuiTaskRectHeight) * i),
                            GuiTaskRectWidth, GuiTaskRectHeight);

                        GFX.SpriteBatch.Draw(Main.DEFAULT_TEXTURE_DIFFUSE, thisTaskRect, Color.Black * 0.75f);

                        // Draw Progress Background Rect

                        Rectangle progBackgroundRect = new Rectangle(thisTaskRect.X + GuiProgBarDistFromRectEdge,
                                                                     thisTaskRect.Y + GuiTaskRectHeight - GuiProgBarDistFromRectEdge - GuiProgBarHeight,
                                                                     thisTaskRect.Width - (GuiProgBarDistFromRectEdge * 2), GuiProgBarHeight);

                        GFX.SpriteBatch.Draw(Main.DEFAULT_TEXTURE_DIFFUSE, progBackgroundRect, new Color(0.25f, 0.25f, 0.25f) * 0.85f);

                        // Draw Progress Foreground Rect

                        Rectangle progForegroundRect = new Rectangle(
                            progBackgroundRect.X + GuiProgBarEdgeThickness,
                            progBackgroundRect.Y + GuiProgBarEdgeThickness,
                            (int)((progBackgroundRect.Width - (GuiProgBarEdgeThickness * 2)) * kvp.Value.ProgressRatio),
                            progBackgroundRect.Height - (GuiProgBarEdgeThickness * 2));

                        GFX.SpriteBatch.Draw(Main.DEFAULT_TEXTURE_DIFFUSE, progForegroundRect,
                                             kvp.Value.IsBeingKilledManually ? Color.Red : Color.White * 0.95f);

                        // Draw Task Name

                        Vector2 taskNamePos = new Vector2(thisTaskRect.X + GuiProgNameDistFromEdge, thisTaskRect.Y + GuiProgNameDistFromEdge);

                        DBG.DrawOutlinedText(kvp.Value.DisplayString, taskNamePos,
                                             Color.White, DBG.DEBUG_FONT_SMALL, startAndEndSpriteBatchForMe: false);

                        i++;
                    }

                    GFX.SpriteBatch.End();
                }
            }
        }
Exemple #2
0
        private void DrawMemoryUsage()
        {
            var str_managed   = GetMemoryUseString("CLR Mem:  ", MemoryUsage_Managed);
            var str_unmanaged = GetMemoryUseString("Process Mem:  ", MemoryUsage_Unmanaged);

            var strSize_managed   = DBG.DEBUG_FONT_SMALL.MeasureString(str_managed);
            var strSize_unmanaged = DBG.DEBUG_FONT_SMALL.MeasureString(str_unmanaged);

            DBG.DrawOutlinedText(str_managed, new Vector2(GFX.Device.Viewport.Width - 8,
                                                          GFX.Device.Viewport.Height - 8 - strSize_managed.Y - strSize_unmanaged.Y),
                                 Color.Yellow, DBG.DEBUG_FONT_SMALL, scaleOrigin: new Vector2(strSize_managed.X, 0));

            DBG.DrawOutlinedText(str_unmanaged, new Vector2(GFX.Device.Viewport.Width - 8,
                                                            GFX.Device.Viewport.Height - 8 - strSize_unmanaged.Y),
                                 Color.Yellow, DBG.DEBUG_FONT_SMALL, scaleOrigin: new Vector2(strSize_unmanaged.X, 0));
        }