Velaptor.GameHelpers
Velaptor
Velaptor
GameHelpers Class
Provides extension helper methods for common game related operations.
public static class GameHelpers
Inheritance System.Object → GameHelpers
Methods
ApplySize(this float, float)
Returns the given value with the given size applied.
public static float ApplySize(this float value, float size);
Parameters
value
System.Single
The value to apply the size to.
size
System.Single
The size to apply.
Returns
System.Single
The value after the size has been applied.
Example
If the value was 3 and the size was 2, then the result would be 6.
Remarks
A size value of 1 represents 100% or the unchanged normal size of the value.
If the value of size is 2, then the result would be the given
value that is doubled.
ApplySize(this RectangleF, float)
Returns the given value with the given size applied.
public static System.Drawing.RectangleF ApplySize(this System.Drawing.RectangleF value, float size);
Parameters
value
System.Drawing.RectangleF
The System.Drawing.RectangleF to apply the size to.
size
System.Single
The size to apply.
Returns
System.Drawing.RectangleF
The result after the size has been applied.
Remarks
The size will be applied to the following:
- System.Drawing.RectangleF.X
- System.Drawing.RectangleF.Y
- System.Drawing.RectangleF.Width
- System.Drawing.RectangleF.Height
ApplySize(this SizeF, float)
Returns the given value with the given size applied.
public static System.Drawing.SizeF ApplySize(this System.Drawing.SizeF value, float size);
Parameters
value
System.Drawing.SizeF
The System.Drawing.SizeF to apply the size to.
size
System.Single
The size to apply.
Returns
System.Drawing.SizeF
The result after the size has been applied.
Remarks
The size will be applied to the following:
ApplySize(this uint, float)
Returns the given value with the given size applied.
public static float ApplySize(this uint value, float size);
Parameters
value
System.UInt32
The value to apply the size to.
size
System.Single
The size to apply.
Returns
System.Single
The value after the size has been applied.
Example
If the value was 3 and the size was 2, then the result would be 6.
Remarks
A size value of 1 represents 100% or the unchanged normal size of the value.
If the value of size is 2, then the result would be the given
value that is doubled.
ApplySize(this GlyphMetrics, float)
Returns the given value with the given size applied.
public static Velaptor.Graphics.GlyphMetrics ApplySize(this Velaptor.Graphics.GlyphMetrics value, float size);
Parameters
value
GlyphMetrics
The GlyphMetrics to apply the size to.
size
System.Single
The size to apply.
Returns
GlyphMetrics
The result after the size has been applied.
Remarks
The size will be applied to the following:
- GlyphMetrics.GlyphBounds
- GlyphMetrics.Ascender
- GlyphMetrics.Descender
- GlyphMetrics.HorizontalAdvance
- GlyphMetrics.HoriBearingX
- GlyphMetrics.HoriBearingY
- GlyphMetrics.GlyphWidth
- GlyphMetrics.GlyphHeight
- GlyphMetrics.XMin
- GlyphMetrics.XMax
- GlyphMetrics.YMin
- GlyphMetrics.YMax
The size will NOT be applied to the following:
DecreaseBrightness(this Color, float)
Decreases the brightness of the color using the given brightness value.
public static System.Drawing.Color DecreaseBrightness(this System.Drawing.Color clr, float brightness);
Parameters
The color to change.
brightness
System.Single
The amount of brightness to apply.
Returns
System.Drawing.Color
The new color with the brightness applied.
Example
var clr = Color.FromArgb(255, 10, 20, 30);
// Increase the brightness by 20%
clr = clr.IncreaseBrightness(0.2f);
In the example above, the values would equal the results below:
- Alpha value would be unchanged with a value of 255.
- Red component with brightness applied would result in a value of 8.
- Green component with brightness applied would result in a value of 16.
- Blue component with brightness applied would result in a value of 24.
Remarks
The brightness value must be a value between 0.0 and 1.0.
If a value lower than 0.0 or greater than 1.0, the brightness will automatically
be adjusted within the range of 0.0 to 1.0.
Think of the brightness value as a percentage between 0% and 100%.
The System.Drawing.Color.System.Drawing.Color.A color component is not effected.
DoesNotContain(this string, char)
Returns a value indicating whether a specified character occurs within this string.
public static bool DoesNotContain(this string stringToSearchIn, char value);
Parameters
stringToSearchIn
System.String
The string to search that may or may not contain the value.
value
System.Char
The character to seek.
Returns
System.Boolean
true
if the value parameter does not occur within this string.
DoesNotContain(this string, string)
Returns a value indicating whether a specified substring occurs within this string.
public static bool DoesNotContain(this string stringToSearchIn, string value);
Parameters
stringToSearchIn
System.String
The string to search that may or may not contain the value.
value
System.String
The string to seek.
Returns
System.Boolean
true
if the value parameter does not occur within this string.
DoesNotOnlyContainsLetters(this string)
Returns a value indicating whether this string does not only contain letters.
public static bool DoesNotOnlyContainsLetters(this string value);
Parameters
value
System.String
The string to check.