public void Main(string argument, UpdateType updateSource) { Dictionary <string, object> inputs = Me.GetProperty("ControlModule.Inputs")?.As <Dictionary <string, object> >()?.GetValue(Me); if (inputs != null) { blocks.Clear(); foreach (long key in spritesPreviewers.Keys) { missingSpritePreviewers.Add(key); } GridTerminalSystem.GetBlocks(blocks); foreach (IMyTerminalBlock block in blocks) { if (block is IMyTextPanel) { IMyTextPanel text_panel = (IMyTextPanel)block; if (text_panel.CustomData.Trim() == "previewSprites") { if (!(spritesPreviewers.ContainsKey(text_panel.EntityId))) { List <string> sprites = new List <string>(); text_panel.GetSprites(sprites); spritesPreviewers.Add(text_panel.EntityId, new SpritesPreviewer(text_panel, sprites)); } missingSpritePreviewers.Remove(text_panel.EntityId); } } } foreach (long key in missingSpritePreviewers) { spritesPreviewers.Remove(key); } missingSpritePreviewers.Clear(); foreach (string input in inputs.Keys) { if (spritesPreviewersKeyInputActions.ContainsKey(input)) { SpritesPreviewerKeyInputActionDelegate sprites_previewers_key_input_action = spritesPreviewersKeyInputActions[input]; foreach (SpritesPreviewer sprite_previewer in spritesPreviewers.Values) { sprites_previewers_key_input_action(sprite_previewer); } } } foreach (SpritesPreviewer sprite_previewer in spritesPreviewers.Values) { string selected_sprite = sprite_previewer.SelectedSprite; if (selected_sprite != null) { sprite_previewer.TextPanel.ContentType = ContentType.SCRIPT; using (MySpriteDrawFrame sprite_draw_frame = sprite_previewer.TextPanel.DrawFrame()) { sprite_draw_frame.Add(MySprite.CreateSprite(selected_sprite, sprite_previewer.TextPanel.SurfaceSize * 0.5f, sprite_previewer.TextPanel.SurfaceSize * sprite_previewer.ZoomFactor)); sprite_draw_frame.Add(MySprite.CreateText(selected_sprite, "DEBUG", Color.White, 1.0f, TextAlignment.CENTER)); } } } } }
internal void PlayNextFrame(string[] strings, int offset, int width, int stride, int height) { if (m_Surface == null) { return; } sprites.Clear(); SetFontSize(width, height); //var strings = getString(data, offset, width, stride, height); var xcenter = m_Surface.SurfaceSize.X / 2f; var ystep = m_Surface.SurfaceSize.Y / (float)height; MySprite line; Vector2 pos = m_Surface.SurfaceSize / 2; pos.Y -= (0.04f * m_FontSizeRatio * ADJ * (float)height); for (int i = 0; i < height; i++) { line = new MySprite(SpriteType.TEXT, strings[i], pos, m_Surface.SurfaceSize, fontId: "Mono Color") { RotationOrScale = 0.08f * m_FontSizeRatio }; pos.Y += line.RotationOrScale * ADJ; sprites.Add(line); } //Following is Gwindalmir hax. if (sprites?.Count > 0) { //var comp = (panel.Render as MyRenderComponentScreenAreas); (m_Panel.Render as MyRenderComponentScreenAreas)?.RenderSpritesToTexture(0, sprites, new Vector2I(m_Surface.TextureSize), m_screenAspectRatio, Color.Black, 0); } }
public void DrawBar(ref MySpriteDrawFrame frame, Vector2 position, float value) { // Display 10 lines of text by 20 columns int bar_width = 21; var filled_blocks = (int)(bar_width * value); var empty_blocks = Math.Max(bar_width - filled_blocks, 0); var bar_top = new string('═', bar_width); var bar_mid = new string(' ', bar_width); var bar_bot = new string('═', bar_width); var bar_filled = new string('▓', filled_blocks); var bar_empty = new string(' ', empty_blocks); var line1 = $"╔{bar_top}╗\n"; var line2 = $"║{bar_filled}{bar_empty}║ {value:P}\n"; var line3 = $"╚{bar_top}╝"; // Create our first bar var bar_outline = new MySprite() { Type = SpriteType.TEXT, Data = $"{line1}{line2}{line3}", Position = position, RotationOrScale = 0.8f /* 80 % of the font's default size */, Color = Color.Red, Alignment = TextAlignment.LEFT /* Center the text on the position */, FontId = "Monospace" }; // Add the sprite to the frame frame.Add(bar_outline); }
public override void Run() { using (MySpriteDrawFrame frame = m_surface.DrawFrame()) { AddBackground(frame, new Color?(new Color(m_foregroundColor, 0.66f))); num1 = num1 + 1; string str = "HELLO\n" + "MOD BY FROSTY\n" + num1.ToString(); Vector2 vector2 = m_surface.MeasureStringInPixels(new StringBuilder(str), m_fontId, m_fontScale); MySprite sprite = new MySprite() { Position = new Vector2?(new Vector2(m_halfSize.X, m_halfSize.Y - vector2.Y * 0.5f)), Size = new Vector2?(new Vector2(m_innerSize.X, m_innerSize.Y)), Type = SpriteType.TEXT, FontId = m_fontId, Alignment = TextAlignment.CENTER, Color = new Color?(m_foregroundColor), RotationOrScale = m_fontScale, Data = str }; frame.Add(sprite); float scale = (float)(m_innerSize.Y / 256.0 * 0.899999976158142); //AddBrackets(frame, new Vector2(64f, 256f), scale); } }
public void WriteToPanel(string message, IMyTextSurface surface) { // Calculate the viewport by centering the surface size onto the texture size var _viewport = new RectangleF( (surface.TextureSize - surface.SurfaceSize) / 2f, surface.SurfaceSize); PrepareTextSurfaceForSprites(surface); using (var frame = surface.DrawFrame()) { // Set up the initial position - and add viewport offset var position = new Vector2(256, 125) + _viewport.Position; // Create line of text var sprite = new MySprite() { Type = SpriteType.TEXT, Data = message, Position = position, RotationOrScale = 1.2f, Color = Color.White, Alignment = TextAlignment.CENTER, FontId = "White" }; frame.Add(sprite); } }
private void DrawProduction(List <MySprite> productionSpriteList, float screenOffset) { Vector2 b_pos = new Vector2(130.5f + screenOffset, 130); Vector2 b_size = new Vector2(241, 124); var background = MySprite.CreateSprite("SquareSimple", b_pos, b_size); background.Color = Constants.COLOR_BACKGROUND_MASK; Vector2 h_pos = new Vector2(130.5f + screenOffset, 78); Vector2 h_size = new Vector2(241, 20); var header = MySprite.CreateSprite("SquareSimple", h_pos, h_size); header.Color = Constants.COLOR_GREEN; var headerText = MySprite.CreateText("PRODUCTION INFO", "White", Constants.COLOR_WHITE, 0.6f, TextAlignment.LEFT); headerText.Position = new Vector2(20 + screenOffset, 69); Vector2 gb_pos = new Vector2(130.5f + screenOffset, 116.5f); Vector2 gb_size = new Vector2(221, 37); var generatorsBackground = MySprite.CreateSprite("SquareSimple", gb_pos, gb_size); generatorsBackground.Color = Constants.COLOR_BACKGROUND_LIGHT; Vector2 ofb_pos = new Vector2(130.5f + screenOffset, 163.5f); Vector2 ofb_size = new Vector2(221, 37); var oxygenFarmBackground = MySprite.CreateSprite("SquareSimple", ofb_pos, ofb_size); oxygenFarmBackground.Color = Constants.COLOR_BACKGROUND_LIGHT; Vector2 gs_pos = new Vector2(30 + screenOffset, 116.5f); Vector2 gs_size = new Vector2(20, 37); var generatorsSwitch = MySprite.CreateSprite("SquareSimple", gs_pos, gs_size); generatorsSwitch.Color = myProgram.productionController.LifeSupportInfo.IsGeneratorsWorking ? Constants.COLOR_GREEN : Constants.COLOR_RED; Vector2 ofs_pos = new Vector2(30 + screenOffset, 163.5f); Vector2 ofs_size = new Vector2(20, 37); var oxygenFarmSwitch = MySprite.CreateSprite("SquareSimple", ofs_pos, ofs_size); oxygenFarmSwitch.Color = myProgram.productionController.LifeSupportInfo.IsOxygenFarmWorking ? Constants.COLOR_GREEN : Constants.COLOR_RED; var generatorsSwitchText = MySprite.CreateText($"H2/O2 GENERATORS\n{myProgram.productionController.WorkingGenerators}", "White", Constants.COLOR_WHITE, 0.6f, TextAlignment.LEFT); generatorsSwitchText.Position = new Vector2(47 + screenOffset, 98.5f); var oxygenFarmSwitchText = MySprite.CreateText($"OXYGEN FARMS\n{myProgram.productionController.WorkingOxygenFarms}", "White", Constants.COLOR_WHITE, 0.6f, TextAlignment.LEFT); oxygenFarmSwitchText.Position = new Vector2(47 + screenOffset, 145.5f); productionSpriteList.Add(background); productionSpriteList.Add(header); productionSpriteList.Add(headerText); productionSpriteList.Add(generatorsBackground); productionSpriteList.Add(oxygenFarmBackground); productionSpriteList.Add(generatorsSwitch); productionSpriteList.Add(oxygenFarmSwitch); productionSpriteList.Add(generatorsSwitchText); productionSpriteList.Add(oxygenFarmSwitchText); }
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(); }
public MeterBar(SurfaceMath sm, MeterDefinition def, Dictionary <Data, IData> shipData) { this.sm = sm; sm.PostionInterpreter(def); this.def = def; this.shipData = shipData; def.position += sm.Center; if (def.min == 0 && def.max == 0) { UseDataMinMax = true; } else { total = def.max - def.min; } sprite = new MySprite(SpriteType.TEXTURE, "SquareSimple", color: def.color); sprite.Position = sm.AdjustToRotation(sm.AdjustToAnchor(def.anchor, def.position, def.size), def.position, def.rotation); spriteSize.Y = def.size.Y; sprite.RotationOrScale = def.rotation; if (def.backgroundSet) { background = new MySprite(SpriteType.TEXTURE, "SquareSimple", color: def.background); background.Position = sm.AdjustToRotation(sm.AdjustToAnchor(def.anchor, def.position, def.size), def.position, def.rotation); background.Size = def.size; background.RotationOrScale = def.rotation; } }
public void DrawText() { var display = new Program.Display(this.surface, offset: new Vector2(10f, 30f), scale: 2); using (Program.Display.Frame frame = display.DrawFrame()) { frame.DrawText("Some text 1", new Vector2(20, 20), scale: 0.5f); frame.DrawText("Some text 2", new Vector2(50, 50), this.scheme.MedLight, 2, TextAlignment.LEFT); } var sprites = new List <MySprite>(this.surface.SpriteBuffer); Assert.AreEqual(4, sprites.Count, "Background + grid pattern + whatever other sprites were added"); MySprite sprite = sprites[1]; Assert.AreEqual("Some text 1", sprite.Data); Assert.AreEqual("Monospace", sprite.FontId); Assert.AreEqual(new Vector2(50f, 70f), sprite.Position); Assert.AreEqual(1, sprite.RotationOrScale); Assert.AreEqual(TextAlignment.CENTER, sprite.Alignment); sprite = sprites[2]; Assert.AreEqual("Some text 2", sprite.Data); Assert.AreEqual("Monospace", sprite.FontId); Assert.AreEqual(new Vector2(110f, 130f), sprite.Position); Assert.AreEqual(4, sprite.RotationOrScale); Assert.AreEqual(TextAlignment.LEFT, sprite.Alignment); }
/// <summary>Draws some text on the frame</summary> /// <param name="text">Text to draw</param> /// <param name="position">Where to draw the text, in conjunction with <paramref name="alignment"/>. Affected by the display's scale</param> /// <param name="color">Color of the text, by default it will be the <see cref="d"/>'s <see cref="ColorScheme.Light"/> color</param> /// <param name="scale">Scale of the text. Compounded with the display's scale</param> /// <param name="alignment">Alignment</param> public void DrawText(string text, Vector2 position, Color?color = null, float scale = 1, TextAlignment alignment = TextAlignment.CENTER) { var sprite = MySprite.CreateText(text, "Monospace", color ?? this.d.scheme.Light, scale * this.d.scale, alignment); sprite.Position = (position * this.d.scale) + this.d.offset; this.f.Add(sprite); }
public void flush() { if (renderTarget_ != null && newMesssages_ == true) { float offset = (messages_.Count * lineHeight_ + lineCorrection_) - (renderTarget_.Size.Y + renderTarget_.Position.Y); int lineCount = 0; newMesssages_ = false; using (MySpriteDrawFrame frame = renderTarget_.getRenderFrame()) { // Workaround to fix the MP Sprite issue if (drawEmpty_) { frame.Add(new MySprite()); } drawEmpty_ = !drawEmpty_; // background renderTarget_.clearDrawArea(sprite => frame.Add(sprite)); // flush message lines foreach (var message in messages_) { MySprite line = MySprite.CreateText(message.Value, font_, getFontColor(message.Key), fontSize_, TextAlignment.LEFT); line.Position = new Vector2(renderTarget_.Position.X, lineCount++ *lineHeight_ - offset); frame.Add(line); } } } }
public void DrawCollectionTransform() { var collection = new Program.ShapeCollections(); collection.Parse(@" =Collection Triangle: light: 30,40: 10,10: 0: center Circle : dark : 10,30: 5, 5: 1.570796326794896619: center "); var display = new Program.Display(this.surface, offset: new Vector2(10f, 50f), scale: 0.5f, sprites: collection); using (Program.Display.Frame frame = display.DrawFrame()) { frame.DrawCollection("Collection", new Vector2(10, 20), Convert.ToSingle(Math.PI) / 2, this.scheme.MedDark); } var sprites = new List <MySprite>(this.surface.SpriteBuffer); Assert.AreEqual(4, sprites.Count, "Background + grid pattern + whatever other sprites were added"); MySprite sprite = sprites[1]; Assert.AreEqual("Triangle", sprite.Data); Assert.AreEqual(this.scheme.MedDark, sprite.Color); this.checkVector(new Vector2(-5, 75), sprite.Position.Value); Assert.AreEqual(Convert.ToSingle(Math.PI) / 2, sprite.RotationOrScale); sprite = sprites[2]; Assert.AreEqual("Circle", sprite.Data); Assert.AreEqual(this.scheme.MedDark, sprite.Color); Assert.AreEqual(new Vector2(0, 65), sprite.Position); Assert.AreEqual(Convert.ToSingle(Math.PI), sprite.RotationOrScale); }
public void DrawSprites(ref MySpriteDrawFrame frame, RectangleF _viewport) { var background = MySprite.CreateSprite("SquareSimple", _viewport.Center, _viewport.Size); background.Color = new Color(26, 28, 32); frame.Add(background); Vector2 ocSize = percentageSize(80, _viewport); var outerCircle = MySprite.CreateSprite("Circle", _viewport.Center, ocSize); outerCircle.Color = new Color(29, 229, 128); frame.Add(outerCircle); Vector2 icSize = percentageSize(60, _viewport); var innerCircle = MySprite.CreateSprite("Circle", _viewport.Center, icSize); innerCircle.Color = new Color(37, 39, 45); frame.Add(innerCircle); float size = TextSize(40, _viewport); float offset = TextSizeOffset(size); var platformCode = MySprite.CreateText("01", "White", Color.White, size, TextAlignment.CENTER); // Vector2 pcPos = new Vector2(_viewport.Center.X, _viewport.Center.Y - 100); Vector2 pcPos = new Vector2(_viewport.Size.X / 2, _viewport.Size.Y / 2 - offset) + _viewport.Position; platformCode.Position = pcPos; frame.Add(platformCode); }
protected virtual void ApplyOffsets(ref MySprite s) { if (s.Position.HasValue) { s.Position = s.Position.Value - cornerOffset; } }
public override void Run() { using (MySpriteDrawFrame frame = m_surface.DrawFrame()) { AddBackground(frame, new Color?(new Color(m_foregroundColor, 0.66f))); string str = "No file found"; if (MyAPIGateway.Utilities.FileExistsInGlobalStorage("OutputHere.txt")) { var read = MyAPIGateway.Utilities.ReadFileInGlobalStorage("OutputHere.txt"); str = read.ReadToEnd(); read.Dispose(); } Vector2 vector2 = m_surface.MeasureStringInPixels(new StringBuilder(str), m_fontId, m_fontScale); MySprite sprite = new MySprite() { Position = new Vector2?(new Vector2(0, m_halfSize.Y * 2f - vector2.Y)), Size = new Vector2?(new Vector2(m_innerSize.X, m_innerSize.Y)), Type = SpriteType.TEXT, FontId = m_fontId, Alignment = TextAlignment.LEFT, Color = new Color?(m_foregroundColor), RotationOrScale = m_fontScale, Data = str }; frame.Add(sprite); float scale = (float)(m_innerSize.Y / 256.0 * 0.899999976158142); //AddBrackets(frame, new Vector2(64f, 256f), scale); } }
public void BuildSprites(List <MySprite> sprites, Vector2 center, Vector2 size, float frame = 0, Color?color = null, Color?bgColor = null) { Color fcolor = color ?? Color.White; Color bcolor = bgColor ?? Color.Black; MySprite sprite; foreach (SpriteData d in dlist) { if (d.Next == null) { Vector2 pos = d.Pos; pos.Rotate(d.PosRot); sprite = MySprite.CreateSprite(d.Id, pos * size + center, d.Size * size); sprite.Color = new Color(fcolor.ToVector3() * d.Alpha + bcolor.ToVector3() * (1.0f - d.Alpha)); sprite.RotationOrScale = d.Rotate; } else { Vector2 pos = Vector2.SmoothStep(d.Pos, d.Next.Pos, frame); pos.Rotate(d.PosRot + d.Next.PosRot * frame); sprite = MySprite.CreateSprite(d.Id, pos * size + center, d.Size * size); float alpha = d.Alpha + (d.Next.Alpha - d.Alpha) * frame; sprite.Color = new Color(fcolor.ToVector3() * alpha + bcolor.ToVector3() * (1.0f - alpha)); sprite.RotationOrScale = d.Rotate + d.Next.Rotate * frame; } sprites.Add(sprite); } }
public void Adjust(ref MySprite s) { if (s.Type == SpriteType.TEXT) { s.RotationOrScale /= (Math.Max(density.X, density.Y) * 0.5f); } else { Vector2 size; if (s.Size.HasValue) { size = s.Size.Value; } else { size = globalSize; } s.Size = size / density; } Vector2 pos; if (s.Position.HasValue) { pos = s.Position.Value; } else { pos = globalSize * 0.5f; } s.Position = (pos - offset) / density; }
public static void DrawScaledSpriteText(this IMyTextSurface textSurface, StringBuilder text, String fontId, Color color, Single?scale = null, TextAlignment textAlignment = TextAlignment.CENTER) { textSurface.Script = ""; textSurface.ContentType = ContentType.SCRIPT; using (var frame = textSurface.DrawFrame()) { var fillArea = textSurface.TextureSize - new Vector2(textSurface.TextPadding * 2); if (scale == null) { var tryScale = 10f; var currentSize = textSurface.MeasureStringInPixels(text, fontId, tryScale); while (currentSize.X > fillArea.X || currentSize.Y > fillArea.Y) { tryScale *= 0.9f; currentSize = textSurface.MeasureStringInPixels(text, fontId, tryScale); } scale = tryScale; } var sprite = MySprite.CreateText(text.ToString(), fontId, color, scale.Value, textAlignment); sprite.Position = new Vector2(textSurface.TextPadding, textSurface.TextPadding); frame.Add(sprite); } }
public void DrawString(Vector2 position, string value, string font, Color c, TextAlignment alignment = TextAlignment.LEFT, float scale = 1) { MySprite s = MySprite.CreateText(value, font, c, scale, alignment); s.Position = position; AddObject(s); }
void Awake() { // load animation foreach (string path in prefab.animationPath) { AnimationObject obj = GameObject.Find(path).GetComponent <AnimationObject>(); animationList.Add(obj); } //load trigger foreach (string path in prefab.triggerPath) { TriggerObject obj = GameObject.Find(path).GetComponent <TriggerObject>(); triggerList.Add(obj); } // init sprite list spriteList = new List <MySprite>(); MySprite sprite1 = GameObject.Find("Sprite1").GetComponent <MySprite>(); MySprite sprite2 = GameObject.Find("Sprite2").GetComponent <MySprite>(); spriteList.Add(sprite1); spriteList.Add(sprite2); int id = data.playerId; mainSprite = GameObject.Find("Sprite" + id).GetComponent <MySprite>(); mainSprite.SetMainPlayer(); // init id rpc.SetMainSpriteId(mainSprite.Id); rpc.initPlayerList(); rpc.SetStatus("Id", mainSprite.Id); }
public ProgressBar(Vector2 position, Vector2 size, Color backgroundColor, Color progressColor, Color borderColor, float borderSize, float value, IUIControl parent) : base(position, size, borderColor, borderSize, parent) { backgroundSprite = MySprite.CreateSprite(backgroundSpriteName, position, size); progressSprite = MySprite.CreateSprite(progressSpriteName, position, Vector2.Zero); BackgroundColor = backgroundColor; ForegroundColor = progressColor; Value = value; }
public static void DrawText(Vector2 position, Color color, string text, float fontSize = 1.0f, TextAlignment textAlignment = TextAlignment.CENTER) { MySprite sprite; sprite = MySprite.CreateText(text, paint.Font, color, fontSize, textAlignment); sprite.Position = position + paint.Offset; frame.Add(sprite); }
private void DrawSectionBackground(float posX, float posY, out MySprite sectionBackground) { Vector2 ib_pos = new Vector2(posX, posY); Vector2 ib_size = new Vector2(241, 66); sectionBackground = MySprite.CreateSprite("SquareSimple", ib_pos, ib_size); sectionBackground.Color = Constants.COLOR_BACKGROUND_MASK; }
public MySprite AddSprite(SpriteType type = SpriteType.TEXTURE, string data = null, Vector2?position = null, Vector2?size = null, Color?color = null, string fontId = null, TextAlignment alignment = TextAlignment.LEFT, float rotation = 0) { MySprite sprite = new MySprite(type, data, position, size, color, fontId, alignment, rotation); // Add the sprite to the frame frame.Add(sprite); return(sprite); }
public static void TextEx(Vector2 position, Color color, string text, float fontSize = 1.0f, TextAlignment textAlignment = TextAlignment.CENTER) { MySprite sprite; sprite = MySprite.CreateText(text, _surface.Font, color, fontSize, textAlignment); sprite.Position = position + _offset; _frame.Add(sprite); }
public static bool Collides(MySprite a, MySprite b) { Vector2 pa = a.Position.Value, pb = b.Position.Value, sa = a.Size.Value, sb = b.Size.Value; return((pa.X + sa.X >= pb.X && pa.X <= pb.X + sb.X) && (pa.Y + sa.Y >= pb.Y && pa.Y <= pb.Y + sb.Y)); }
protected override void AddObject(MySprite s) { if (s.Position.HasValue) { s.Position = s.Position.Value - sizeOffset; } currentFrame.Add(s); }
MySprite AddSprite(string spriteType, Vector2 wallPosition, Vector2 size, Color?color = null) { var sprite = MySprite.CreateSprite(spriteType, wallPosition, size); sprite.Color = color == null ? Color.White : color; SpriteScratchpad.Add(sprite); return(sprite); }
public MyBlinkingIcon(int x, int y, MySprite Graphics) : base(null, x, y, true) { Sprite = new MyStatefulAnimatedSprite(0, 0) .WithState("Off", new MyStatefulAnimatedSpriteState(new MySprite[] { Graphics })) .WithState("On", new MyStatefulAnimatedSpriteState(new MySprite[] { new MySprite(Graphics.width, Graphics.height, DrawingFrameworkUtils.NegateBoolArray(Graphics.data)) })); AddChild(Sprite); }
private void DrawOxygenInfo(Airlock airlock, List <MySprite> oxygenInfoSpriteList) { Vector2 orl_pos = new Vector2(112.5f, 390); Vector2 orl_size = new Vector2(205, 30); var outerRectLeft = MySprite.CreateSprite("SquareSimple", orl_pos, orl_size); outerRectLeft.Color = Constants.COLOR_WHITE; Vector2 orlm_pos = new Vector2(112.5f, 390); Vector2 orlm_size = new Vector2(201, 26); var outerRectLeftMask = MySprite.CreateSprite("SquareSimple", orlm_pos, orlm_size); outerRectLeftMask.Color = Constants.COLOR_BACKGROUND; Vector2 bfl_pos = new Vector2(112.5f, 390); Vector2 bfl_size = new Vector2((197 * float.Parse(airlock.OxygenLevelDecimals)), 22); var barFillLeft = MySprite.CreateSprite("SquareSimple", bfl_pos, bfl_size); barFillLeft.Color = Constants.COLOR_WHITE; var oxigenText = MySprite.CreateText("AIRLOCK OXYGEN", "Debug", Constants.COLOR_WHITE, 0.5f, TextAlignment.CENTER); oxigenText.Position = new Vector2(112.5f, 410); Vector2 orr_pos = new Vector2(399.5f, 390); Vector2 orr_size = new Vector2(205, 30); var outerRectRight = MySprite.CreateSprite("SquareSimple", orr_pos, orr_size); outerRectRight.Color = Constants.COLOR_WHITE; Vector2 orrm_pos = new Vector2(399.5f, 390); Vector2 orrm_size = new Vector2(201, 26); var outerRectRightMask = MySprite.CreateSprite("SquareSimple", orrm_pos, orrm_size); outerRectRightMask.Color = Constants.COLOR_BACKGROUND; Vector2 bfr_pos = new Vector2(399.5f, 390); Vector2 bfr_size = new Vector2((197 * float.Parse(airlock.OxygenTankFillDecimals)), 22); var barFillRight = MySprite.CreateSprite("SquareSimple", bfr_pos, bfr_size); barFillRight.Color = Constants.COLOR_WHITE; var tankText = MySprite.CreateText("02 TANKS STORAGE", "Debug", Constants.COLOR_WHITE, 0.5f, TextAlignment.CENTER); tankText.Position = new Vector2(399.5f, 410); oxygenInfoSpriteList.Add(outerRectLeft); oxygenInfoSpriteList.Add(outerRectLeftMask); oxygenInfoSpriteList.Add(barFillLeft); oxygenInfoSpriteList.Add(oxigenText); oxygenInfoSpriteList.Add(outerRectRight); oxygenInfoSpriteList.Add(outerRectRightMask); oxygenInfoSpriteList.Add(barFillRight); oxygenInfoSpriteList.Add(tankText); }