예제 #1
0
            private void DisplayPerformance(Surface surface)
            {
                /*
                 * display the last run times on the surface
                 */

                MySpriteDrawFrame frame    = surface.TextSurface.DrawFrame();
                RectangleF        viewRect = surface.ViewRect;
                Color             color    = surface.TextSurface.ScriptForegroundColor;

                spritePosition    = viewRect.Center;
                spritePosition.Y -= 20;

                sprite = new MySprite()
                {
                    Type = SpriteType.TEXT,
                    Data = $"last run: {parent.LastRunTime}ms ({parent.LastRunType})" +
                           $"\nlast average: {parent.LastAverage}ms ({parent.RunsPerAverage} runs)",
                    Position        = spritePosition,
                    RotationOrScale = 0.6f,
                    Color           = color,
                    Alignment       = TextAlignment.CENTER,
                    FontId          = "Monospace"
                };
                frame.Add(sprite);
                frame.Dispose();
            }
예제 #2
0
        void Draw(Canvas can)
        {
            MySpriteDrawFrame _frame = _textSurface.DrawFrame();

            if (can == null)
            {
                return;
            }

            foreach (BasePanel item in can.GetListChildrens())
            {
                if (item == null)
                {
                    return;
                }
                foreach (BaseCompo baseCompo in item.Content)
                {
                    foreach (var sprite in baseCompo.content.Sprites)
                    {
                        _frame.Add(sprite);
                    }
                }
            }

            _frame.Dispose();
        }
예제 #3
0
        private void UpdateLCD(IMyTextPanel surface)
        {
            RectangleF viewport = new RectangleF(
                (surface.TextureSize - surface.SurfaceSize) / 2,
                surface.SurfaceSize
                );
            MySpriteDrawFrame frame = surface.DrawFrame();

            DrawSprites(ref frame, viewport, surface);
            frame.Dispose();
        }
        public void Main(string argument, UpdateType updateSource)
        {
            frame = display.DrawFrame();
            VRage.MyFixedPoint totKg = 0;
            inventories.ForEach(delegate(IMyInventory i) {
                totKg += i.CurrentMass;
            });

            draw(totKg.ToIntSafe());
            frame.Dispose();
        }
예제 #5
0
            private void DisplayInventory(Surface surface)
            {
                /*
                 * currently unused
                 * displays inventory information on the surface
                 */

                MySpriteDrawFrame frame    = surface.TextSurface.DrawFrame();
                RectangleF        viewRect = surface.ViewRect;

                float xOffset = viewRect.Size.X / (outputColumns * 2);
                float cWidth  = viewRect.Size.X / outputColumns;
                float yOffset = viewRect.Size.Y / (outputRows * 2);
                float rHeight = viewRect.Size.Y / outputRows;

                double percent;
                int    bars;

                int entryIndex = 0;

                foreach (string name in inventoryManager.ActiveCategories.Keys) // category outputs
                {
                    Category category = inventoryManager.ActiveCategories[name];

                    spritePosition.X = viewRect.X + xOffset + (entryIndex / outputRows) * cWidth;
                    spritePosition.Y = viewRect.Y + yOffset + (entryIndex % outputRows) * rHeight;

                    percent = (double)category.CurrentVolume.RawValue / category.MaxVolume.RawValue;
                    bars    = (int)Math.Ceiling(percent * 9); // todo: fix this

                    AddEntry(ref frame, bars, name);

                    entryIndex++;
                }

                // misc. inventories
                spritePosition.X = viewRect.X + xOffset + (entryIndex / outputRows) * cWidth;
                spritePosition.Y = viewRect.Y + yOffset + (entryIndex % outputRows) * rHeight;

                percent = (double)inventoryManager.CurrentMiscVolume.RawValue / inventoryManager.MaxMiscVolume.RawValue;
                bars    = (int)Math.Ceiling(percent * 9); // todo: and this

                AddEntry(ref frame, bars, "Other");

                frame.Dispose();
            }
예제 #6
0
            private void setScreenContent(IMyTextPanel scr, float f)
            {
                scr.ContentType = ContentType.SCRIPT;
                MySpriteDrawFrame frame = scr.DrawFrame();

                frame.Add(new MySprite(SpriteType.TEXTURE, "SquareSimple", size: screenSize, color: BLACK));
                frame.Add(new MySprite(SpriteType.TEXTURE, "SquareSimple", size: barSize1, color: GRAY1));
                frame.Add(new MySprite(SpriteType.TEXTURE, "SquareSimple", size: barSize2, color: GRAY2));

                drawBox(frame, f, BLUE_COLOR, 1);
                drawBox(frame, f, GREEN_COLOR, BLUE_THRESH);
                drawBox(frame, f, YELLOW_COLOR, GREEN_THRESH);
                drawBox(frame, f, ORANGE_COLOR, YELLOW_THRESH);
                drawBox(frame, f, RED_COLOR, ORANGE_THRESH);
                drawBox(frame, f, DARKRED_COLOR, RED_THRESH);

                frame.Add(MySprite.CreateText(String.Format("{0:0.000}", (f * 100)) + "%", "monospace", WHITE, 3));

                frame.Dispose();
            }
예제 #7
0
파일: LCD.cs 프로젝트: kurtu5/K5-Kranes
 /// <summary>
 /// Draws any chained sprites
 /// </summary>
 /// <returns></returns>
 public LCD End()
 {
     _frame.Dispose();
     return(this);
 }
예제 #8
0
 /// <summary>
 /// Sets error text and proceeds to dispose of the DrawFrame.
 /// </summary>
 private void SetError(string text)
 {
     frame = lcd.DrawFrame();
     frame.Add(new MySprite(SpriteType.TEXT, text, centerScreen, null, lcd.ScriptForegroundColor, null, rotation: 0.6f));
     frame.Dispose();
 }