internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { if (id == "family") { if (wasFamily) { Family.AddRange(parser.ParseSFStringOrMFStringValue()); } else { Family = parser.ParseSFStringOrMFStringValue(); } wasFamily = true; } else if (id == "horizontal") { Horizontal = parser.ParseBoolValue(); } else if (id == "justify") { if (wasJustify) { Justify.AddRange(parser.ParseSFStringOrMFStringValue()); } else { Justify = parser.ParseSFStringOrMFStringValue(); } wasJustify = true; } else if (id == "language") { Language = parser.ParseStringValue(); } else if (id == "leftToRight") { LeftToRight = parser.ParseBoolValue(); } else if (id == "pointSize") { PointSize = parser.ParseDoubleValue(); } else if (id == "spacing") { Spacing = parser.ParseDoubleValue(); } else if (id == "style") { Style = parser.ParseStringValue(); } else if (id == "topToBottom") { TopToBottom = parser.ParseBoolValue(); } else { return(false); } return(true); }
public void Draw(SpriteBatch spriteBatch, Justify j, Align a) { spriteBatch.Begin(); Vector2 origin = Vector2.Zero; if (j == Justify.Top) { origin.Y = dims.Y; } if (j == Justify.Center) { origin.Y = dims.Y + dims.Height / 2 - font.MeasureString(format).Y *scale / 2; } if (a == Align.Left) { origin.X = dims.X; } if (a == Align.Center) { origin.X = dims.X + dims.Width / 2 - font.MeasureString(format).X *scale / 2; } if (isTypeEffect) { spriteBatch.DrawString(font, tfx, origin, c, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } else { spriteBatch.DrawString(font, format, origin, c, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } spriteBatch.End(); }
// GET: PersonnelManagement/Justifies/Create public JsonResult Create(JustifyDTO justify) { var userId = this.AuthenticationManager.User.Identity.GetUserId(); if (ModelState.IsValid) { justify.Id = Guid.NewGuid(); justify.PersonnelId = userId; Justify newJustify = new Justify { Id = justify.Id, PersonnelId = userId, Action = justify.Action, Comments = justify.Comments, Entity = justify.Entity, Reason = justify.Reason }; context.Justifies.Add(newJustify); context.SaveChanges(); return(Json(new { value = true }, JsonRequestBehavior.AllowGet)); } return(Json(new { value = false }, JsonRequestBehavior.AllowGet)); }
public static Vector2 JustifiedPosition(string text, Vector2 position, Justify justification, float scale, IFontBuddy font) { //Get the correct location Vector2 textSize = (!string.IsNullOrEmpty(text) ? (font.MeasureString(text) * scale) : Vector2.Zero); switch (justification) { //left = use teh x value (no cahnge) case Justify.Right: { //move teh x value position.X -= textSize.X; } break; case Justify.Center: { //move teh x value position.X -= (textSize.X / 2.0f); } break; } return(position); }
public static void SetJustifyContent(this VisualElement self, Justify v) { var c = self.style.justifyContent; c.value = v; self.style.justifyContent = c; }
public void Draw(long score, Vector2 loc, Color color, Justify justify) { int place = 0; if (justify == Justify.Left) { loc.X -= 17f; long s = score; if (s == 0) loc.X += 17f; else while (s > 0) { s /= 10; loc.X += 17f; } } while (true) { long digit = score % 10; score = score / 10; spriteBatch.Draw(spritesTex, loc + new Vector2((float)place * -17f, 0f), new Rectangle((int)digit * 16, 224, 16, 32), color); place++; if (score <= 0) return; } }
public static void DrawText(ScreenCanvas screenCanvas, string strText, Justify justification, int iTopLoc, int iLetterWidth, int iLetterHeight, int iPictX, int iPictY) { int iPrintStart; switch (justification) { case Justify.LEFT: iPrintStart = 100; break; case Justify.CENTER: iPrintStart = (int)((iMaxX - strText.Length * iLetterWidth) / 2.0); break; case Justify.RIGHT: iPrintStart = iMaxX - 100 - strText.Length * iLetterWidth; break; default: return; } for (int i = 0; i < strText.Length; i++) { TextDraw.DrawLetter(screenCanvas, strText[i], (int)((iPrintStart + i * iLetterWidth) / (double)iMaxX * iPictX), (int)(iTopLoc / (double)iMaxY * iPictY), (int)(iLetterWidth / (double)iMaxX * iPictX), (int)(iLetterHeight / (double)iMaxY * iPictY)); } }
public void AddText(string text, Justify justification, int iTopLoc, int charWidth, int charHeight, int x, int y) { int length; switch (justification) { case Justify.Left: length = 100; break; case Justify.Center: length = (int)((float)(10000 - text.Length * charWidth) / 2); break; case Justify.Right: length = 9900 - text.Length * charWidth; break; default: throw new ArgumentOutOfRangeException(nameof(justification)); } for (var i = 0; i < text.Length; i++) { AddLetter(text[i], (int)((float)(length + i * charWidth) / 10000 * x), (int)((float)iTopLoc / 7500 * y), (int)((float)charWidth / 10000 * x), (int)((float)charHeight / 7500 * y)); } }
// StyleSetJustifyContent sets justify content public void StyleSetJustifyContent(Justify justifyContent) { if (this.nodeStyle.JustifyContent != justifyContent) { this.nodeStyle.JustifyContent = justifyContent; Flex.nodeMarkDirtyInternal(this); } }
public ActionResult DeleteConfirmed(Guid id) { Justify justify = context.Justifies.Find(id); context.Justifies.Remove(justify); context.SaveChanges(); return(RedirectToAction("Index")); }
public void CheckJustifyClass(Justify justify, string expectedClass) { var stack = Context.RenderComponent <MudStack>(x => x.Add(c => c.Justify, justify)); var stackClass = stack.Find(".d-flex"); stackClass.ClassList.Should().ContainInOrder(new[] { "d-flex", "flex-column", $"justify-{expectedClass}", "gap-3" }); }
public override float Write(string text, Vector2 position, Justify justification, float scale, Color color, SpriteBatch spriteBatch, GameClock time) { if (string.IsNullOrEmpty(text)) { return(position.X); } //First draw the shadow Font.Write(text, position, justification, ShadowSize * scale, ShadowColor, spriteBatch, time); _timer.Update(time); var currentTime = _timer.CurrentTime; //Pulsate the size of the text var pulsate = PulsateSize * (float)(Math.Sin(currentTime - (Math.PI * 0.5)) + 1.0f); pulsate *= 0.15f; //make it waaay smaller pulsate += 1; //bump it up so it starts at 1 //adjust the y position so it pulsates straight out var textSize = Font.MeasureString(text.ToString()); var adjust = ((textSize * scale * pulsate) - (textSize * scale)) / 2f; if (StraightPulsate) { switch (justification) { case Justify.Left: { position.X -= adjust.X; } break; case Justify.Right: { position.X += adjust.X; } break; } ; } position.Y -= adjust.Y; //Draw the menu item, with the pulsing return(Font.Write(text, position, justification, scale * pulsate, color, spriteBatch, time)); }
public static VisualElement SetJustifyContent(this VisualElement self, Justify v) { var c = self.style.justifyContent; c.value = v; self.style.justifyContent = c; return(self); }
public virtual float Write(string text, Vector2 position, Justify justification, float scale, Color color, SpriteBatch spriteBatch, GameClock time) { return(DrawText(text, position, justification, scale, color, spriteBatch, time)); }
public Arranger(AsciiArtFont font, int maxWidth = int.MaxValue, Justify justify = Justify.Left) { _stagingArea = new List <StringBuilder>(); _font = font; _justify = justify; MaxWidth = maxWidth; SetCharSpacing(); NoSmush = false; ClearStage(); }
public Toggle(string text, bool value, Justify contentJustify, EventCallback <ChangeEvent <bool> > callback) { this[0].StyleJustifyContent(contentJustify); this[0][0].StyleMargin(0, 8, 0, 0); this.text = text; this.value = value; this.RegisterValueChangedCallback(callback); this.StyleFont(value ? FontStyle.Italic : FontStyle.Normal); this.RegisterValueChangedCallback((internalCallback) => { this.StyleFont(internalCallback.newValue ? FontStyle.Italic : FontStyle.Normal); }); }
public bool DrawString( OledFont font, int leftPixel, int width, int topRow, Justify justification, string s) { return(this.DrawStringFit(font, null, leftPixel, width, topRow, justification, s)); }
public ActionResult Edit([Bind(Include = "Id,PersonnelId,Action,Entity,Reason,Comments")] Justify justify) { if (ModelState.IsValid) { context.Entry(justify).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PersonnelId = new SelectList(context.Users, "Id", "Email", justify.PersonnelId); return(View(justify)); }
public void ApplyPatch(TextPatch patch) { Enabled = Enabled.ApplyPatch(patch.Enabled); Contents = Contents.ApplyPatch(patch.Contents); PixelsPerLine = PixelsPerLine.ApplyPatch(patch.PixelsPerLine); Height = Height.ApplyPatch(patch.Height); Anchor = Anchor.ApplyPatch(patch.Anchor); Justify = Justify.ApplyPatch(patch.Justify); Font = Font.ApplyPatch(patch.Font); Color = Color.ApplyPatch(patch.Color); }
/// <summary> /// Sets the alignment for an <see cref="IAlignable"/> object. /// </summary> /// <typeparam name="T">The alignable object type.</typeparam> /// <param name="obj">The alignable object.</param> /// <param name="alignment">The alignment.</param> /// <returns>The same instance so that multiple calls can be chained.</returns> public static T SetAlignment <T>(this T obj, Justify alignment) where T : class, IAlignable { if (obj is null) { throw new System.ArgumentNullException(nameof(obj)); } obj.Alignment = alignment; return(obj); }
public pb_UV(pb_UV uvs) { useWorldSpace = uvs.useWorldSpace; flipU = uvs.flipU; flipV = uvs.flipV; swapUV = uvs.swapUV; fill = uvs.fill; scale = uvs.scale; offset = uvs.offset; rotation = uvs.rotation; justify = uvs.justify; }
public pb_UV() { useWorldSpace = false; justify = Justify.None; flipU = false; flipV = false; swapUV = false; fill = Fill.Tile; scale = new Vector2(1f, 1f); offset = new Vector2(0f, 0f); rotation = 0f; }
public void Reset() { this.useWorldSpace = false; this.justify = Justify.None; this.flipU = false; this.flipV = false; this.swapUV = false; this.fill = Fill.Tile; this.scale = new Vector2(1f, 1f); this.offset = new Vector2(0f, 0f); this.rotation = 0f; }
public override float Write(string text, Vector2 position, Justify justification, float scale, Color color, SpriteBatch spriteBatch, GameClock time) { WriteShadow(text, position, justification, scale, spriteBatch, time); //draw my text return(Font.Write(text, position, justification, scale, color, spriteBatch, time)); }
public pb_UV(pb_UV uvs) { projectionAxis = uvs.projectionAxis; useWorldSpace = uvs.useWorldSpace; flipU = uvs.flipU; flipV = uvs.flipV; swapUV = uvs.swapUV; fill = uvs.fill; scale = uvs.scale; offset = uvs.offset; rotation = uvs.rotation; justify = uvs.justify; }
public override void Render(StringBuilder sb) { TagName = "FontStyle"; if (Justify != Justify.NONE) { AddProperty("justify", Justify.ToString()); if (Size != null) { AddProperty("size", Size.ToSlamString()); } base.Render(sb); } }
public Vector3 projectionValue; ///< If projectionAxis is set to Instance, this is the value that will be used to project UV coordinates. #endregion #region INITIALIZATION public pb_UV() { projectionAxis = ProjectionAxis.AUTO; useWorldSpace = false; justify = Justify.None; flipU = false; flipV = false; swapUV = false; fill = Fill.Tile; scale = new Vector2(1f, 1f); offset = new Vector2(0f, 0f); rotation = 0f; }
// GET: PersonnelManagement/Justifies/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Justify justify = context.Justifies.Find(id); if (justify == null) { return(HttpNotFound()); } return(View(justify)); }
// The pb_SerializedMesh constructor is used to deserialize values. public pb_UV(SerializationInfo info, StreamingContext context) { this.useWorldSpace = (bool)info.GetValue("useWorldSpace", typeof(bool)); this.flipU = (bool)info.GetValue("flipU", typeof(bool)); this.flipV = (bool)info.GetValue("flipV", typeof(bool)); this.swapUV = (bool)info.GetValue("swapUV", typeof(bool)); this.fill = (Fill)info.GetValue("fill", typeof(Fill)); this.scale = (Vector2)info.GetValue("scale", typeof(Vector2)); this.offset = (Vector2)info.GetValue("offset", typeof(Vector2)); this.rotation = (float)info.GetValue("rotation", typeof(float)); this.justify = (Justify)info.GetValue("justify", typeof(Justify)); this.localPivot = (Vector2)info.GetValue("localPivot", typeof(Vector2)); this.localSize = (Vector2)info.GetValue("localSize", typeof(Vector2)); }
// The pb_SerializedMesh constructor is used to deserialize values. public pb_UV(SerializationInfo info, StreamingContext context) { this.useWorldSpace = (bool) info.GetValue("useWorldSpace", typeof(bool)); this.flipU = (bool) info.GetValue("flipU", typeof(bool)); this.flipV = (bool) info.GetValue("flipV", typeof(bool)); this.swapUV = (bool) info.GetValue("swapUV", typeof(bool)); this.fill = (Fill) info.GetValue("fill", typeof(Fill)); this.scale = (Vector2) info.GetValue("scale", typeof(Vector2)); this.offset = (Vector2) info.GetValue("offset", typeof(Vector2)); this.rotation = (float) info.GetValue("rotation", typeof(float)); this.justify = (Justify) info.GetValue("justify", typeof(Justify)); this.localPivot = (Vector2) info.GetValue("localPivot", typeof(Vector2)); this.localSize = (Vector2) info.GetValue("localSize", typeof(Vector2)); }
/// <summary> /// Justify text based on enumerated value. /// </summary> private void JustifyText(SpriteFont font, String text, Justify justify, Vector2 inputPos, out Vector2 resultPos) { Vector2 textSize = font.MeasureString(text); // Default text to upper-left resultPos = inputPos; switch (justify) { case Justify.TOP_LEFT: break; case Justify.TOP_CENTER: resultPos.X -= (textSize.X / 2); break; case Justify.TOP_RIGHT: resultPos.X -= textSize.X; break; case Justify.MIDDLE_LEFT: resultPos.Y -= (textSize.Y / 2); break; case Justify.MIDDLE_CENTER: resultPos.X -= (textSize.X / 2); resultPos.Y -= (textSize.Y / 2); break; case Justify.MIDDLE_RIGHT: resultPos.X -= textSize.X; resultPos.Y -= (textSize.Y / 2); break; case Justify.BOTTOM_LEFT: resultPos.Y -= textSize.Y; break; case Justify.BOTTOM_CENTER: resultPos.X -= (textSize.X / 2); resultPos.Y -= textSize.Y; break; case Justify.BOTTOM_RIGHT: resultPos.X -= textSize.X; resultPos.Y -= textSize.Y; break; } }
// POST: PersonnelManagement/Justifies/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. //[HttpPost] //[ValidateAntiForgeryToken] //public ActionResult Create([Bind(Include = "Id,PersonnelId,Action,Entity,Reason,Comments")] Justify justify) //{ // if (ModelState.IsValid) // { // justify.Id = Guid.NewGuid(); // context.Justifies.Add(justify); // context.SaveChanges(); // return RedirectToAction("Index"); // } // ViewBag.PersonnelId = new SelectList(context.Users, "Id", "Email", justify.PersonnelId); // return View(justify); //} // GET: PersonnelManagement/Justifies/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Justify justify = context.Justifies.Find(id); if (justify == null) { return(HttpNotFound()); } ViewBag.PersonnelId = new SelectList(context.Users, "Id", "Email", justify.PersonnelId); return(View(justify)); }
/// <summary> /// Add text at 3D position. /// </summary> /// <param name="worldPos">3D world-space position for text</param> /// <param name="text">Text to draw</param> /// <param name="color">Color of text</param> public void AddText(Vector3 worldPos, String text, Justify justify, Color color) { if (sTextList.Count >= MAX_TEXT_LINES) { return; } TextData textData = new TextData(); textData.mPos = worldPos; textData.mText = text; textData.mColor = color; textData.mJustify = justify; textData.mIsTransformed = false; sTextList.Add(textData); }
// JustifyToString returns string version of Justify enum public static bool StringToJustify(string value, out Justify result) { switch (value) { case "flex-start": result = Justify.FlexStart; return(true); case "center": result = Justify.Center; return(true); case "flex-end": result = Justify.FlexEnd; return(true); case "space-between": result = Justify.SpaceBetween; return(true); case "space-around": result = Justify.SpaceAround; return(true); } result = Justify.FlexStart; return(false); }
public pb_UV( ProjectionAxis _projectionAxis, bool _useWorldSpace, bool _flipU, bool _flipV, bool _swapUV, Fill _fill, Vector2 _scale, Vector2 _offset, float _rotation, Justify _justify ) { projectionAxis = _projectionAxis; useWorldSpace = _useWorldSpace; flipU = _flipU; flipV = _flipV; swapUV = _swapUV; fill = _fill; scale = _scale; offset = _offset; rotation = _rotation; justify = _justify; }
/// <summary> /// Add text at 2D position. /// </summary> /// <param name="pos">XY screen coordinates (pixels)</param> /// <param name="text">Text to draw</param> /// <param name="color">Color of text</param> public void AddText(Vector2 pos, String text, Justify justify, Color color) { if (sTextList.Count >= MAX_TEXT_LINES) { return; } TextData textData = new TextData(); textData.mPos.X = pos.X; textData.mPos.Y = pos.Y; textData.mPos.Z = 0.0f; textData.mText = text; textData.mColor = color; textData.mJustify = justify; textData.mIsTransformed = true; sTextList.Add(textData); }
public void Initialize() { defaultFont = m_defaultFont; defaultMaterial = m_defaultMaterial; defaultColor = m_defaultColor; defaultResolution = m_defaultResolution; defaultSize = m_defaultSize; defaultDepth = m_defaultDepth; defaultLetterSpacing = m_defaultLetterSpacing; defaultLineSpacing = m_defaultLineSpacing; defaultJustification = m_defaultJustification; includeBackface = m_includeBackface; texturePerLetter = m_texturePerLetter; anchor = m_anchor; zAnchor = m_zAnchor; colliderType = m_colliderType; addRigidbodies = m_addRigidbodies; physicsMaterial = m_physicsMaterial; smoothingAngle = m_smoothingAngle; if (defaultMaterial == null) { var mat = Resources.Load ("VertexColored") as Material; if (mat) { defaultMaterial = mat; } else { var shader = Shader.Find ("Diffuse"); if (shader) { defaultMaterial = new Material(shader); } } } if (m_fontData.Count == 0) { _initialized = false; return; } _fontInfo = new TTFFontInfo[m_fontData.Count]; _fontNames = new string[m_fontData.Count]; for (int i = 0; i < m_fontData.Count; i++) { if (m_fontData[i].ttfFile != null) { _fontInfo[i] = new TTFFontInfo (m_fontData[i].ttfFile.bytes); var name = _fontInfo[i].name; name = name.Replace(" ", ""); name = name.ToLower(); _fontNames[i] = name; } } _colorDictionary = new Dictionary<string, Color>(){{"red", Color.red}, {"green", Color.green}, {"blue", Color.blue}, {"white", Color.white}, {"black", Color.black}, {"yellow", Color.yellow}, {"cyan", Color.cyan}, {"magenta", Color.magenta}, {"gray", Color.gray}, {"grey", Color.grey}}; DontDestroyOnLoad (this); _initialized = true; }
public pb_UV( // ProjectionAxis _projectionAxis, bool _useWorldSpace, bool _flipU, bool _flipV, bool _swapUV, Fill _fill, Vector2 _scale, Vector2 _offset, float _rotation, Justify _justify ) { this.useWorldSpace = _useWorldSpace; this.flipU = _flipU; this.flipV = _flipV; this.swapUV = _swapUV; this.fill = _fill; this.scale = _scale; this.offset = _offset; this.rotation = _rotation; this.justify = _justify; }
public LengthAttribute(int length) { this.length = length; this.justify = Justify.Left; }
public LengthAttribute(int length, Justify justify) { this.length = length; this.justify = justify; }