public static RelativeSize operator /(RelativeSize o, float factor) { RelativeSize loc = new RelativeSize(o, 0); loc.Paramater /= factor; return(loc); }
public static RelativeSize GetRelativeHeightInAspect(RelativeSize width, float aspectWidth, float aspectHeight) { RelativeSize height = new RelativeSize(); height.UseWidth = width.UseWidth; if (aspectWidth == 0 || aspectHeight == 0) { return(height); } float aspect = aspectWidth / aspectHeight; height.Paramater = width.Paramater / aspect; return(height); }
public static RelativeSize GetRelativeWidthInAspect(RelativeSize height, float aspectWidth, float aspectHeight) { RelativeSize width = new RelativeSize(); width.UseWidth = height.UseWidth; if (aspectWidth == 0 || aspectHeight == 0) { return(width); } float aspect = aspectWidth / aspectHeight; width.Paramater = height.Paramater * aspect; return(width); }
public static RelativeSizeXY GetImageRect(string texture, RelativeSize fixedSize, bool useWidth = true) { RelativeSizeXY size = new RelativeSizeXY(); TextureInfo info = TextureManager.GetTexture(texture); if (info != null && info.PixelSize.X > 0 && info.PixelSize.Y != 0) { if (useWidth) { size.Width = fixedSize; size.Height = GetRelativeHeightInAspect(fixedSize, info.PixelSize.X, info.PixelSize.Y); } else { size.Width = GetRelativeWidthInAspect(fixedSize, info.PixelSize.X, info.PixelSize.Y); size.Height = fixedSize; } } return(size); }
public virtual void SetSize(RelativeSize w, RelativeSize h) { Width = w.Clone(); Height = h.Clone(); }
public virtual void Set(RelativeLoc x, RelativeLoc y, RelativeSize w, RelativeSize h, OriginLocation anchor) { SetLocation(x, y); SetSize(w, h); AnchorLocation = anchor; }
public virtual void Set(RelativeLoc x, RelativeLoc y, RelativeSize w, RelativeSize h) { SetLocation(x, y); SetSize(w, h); }
public RelativeRect(RelativeLoc x, RelativeLoc y, RelativeSize w, RelativeSize h, OriginLocation anchor) { Set(x, y, w, h); AnchorLocation = anchor; }
public RelativeRect(RelativeLoc x, RelativeLoc y, RelativeSize w, RelativeSize h) { Set(x, y, w, h); }
public RelativeSize(RelativeSize o, float offset) { Paramater = o.Paramater - offset; UseWidth = o.UseWidth; Raw = o.Raw; }
public RelativeSize(RelativeSize o, float offset) { Paramater = o.Paramater - offset; Mode = o.Mode; }
public RelativeSizeXY(Vector2 size) { Width = new RelativeSize(size.X); Height = new RelativeSize(size.Y); }
public RelativeSizeXY(float widht, float height) { Width = new RelativeSize(widht); Height = new RelativeSize(height); }
public RelativeSizeXY(RelativeSize widht, RelativeSize height) { Width = widht; Height = height; }
public static RelativeSize FixedPixelSize(int pixels) { RelativeSize r = new RelativeSize(); r.Paramater = pixels; r.Raw = true; return(r); }
public void Shift(RelativeSize offset) { Paramater += offset.Paramater; }
public virtual void SetSize(RelativeSize w, RelativeSize h) { Width = w; Height = h; }