Class Resolution
public class Resolution
Represents the resolution of the game window consisting of the width and height and information about the ratio.
This class also provides access to predefined known resolutions of the different aspect ratios which can be used to
set the resolution of the GameWindow.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescribes an aspect ratio used to categorizeResolutioninstances.static classContains predefinedResolutionswith an aspect ratio of 16:10.static classContains predefinedResolutionswith an aspect ratio of 16:9.static classContains predefinedResolutionswith an aspect ratio of 4:3.static classContains predefinedResolutionswith an aspect ratio of 5:4. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResolutionCreates a customResolutionwith the given dimensions and ratio name.Gets the dimension of this resolution consisting of it's width and height.intGets the height of this resolution.getRatio()Gets the aspect ratio of this resolution.intgetWidth()Gets the width of this resolution.Returns the resolution dimensions as a string using"x"as the delimiter (e.g."1920x1080").toDimensionString(String delimiter) Returns the resolution dimensions as a string using the provided delimiter.toString()
-
Method Details
-
custom
Creates a customResolutionwith the given dimensions and ratio name.- Parameters:
width- the resolution width in pixelsheight- the resolution height in pixelsresolutionName- the display name of the ratio- Returns:
- a new custom resolution
-
getHeight
public int getHeight()Gets the height of this resolution.- Returns:
- The height of the resolution.
-
getWidth
public int getWidth()Gets the width of this resolution.- Returns:
- The width of the resolution.
-
getDimension
Gets the dimension of this resolution consisting of it's width and height.- Returns:
- The dimension of the resolution.
-
toDimensionString
Returns the resolution dimensions as a string using"x"as the delimiter (e.g."1920x1080").- Returns:
- the dimension string
-
toDimensionString
-
toString
-
getRatio
Gets the aspect ratio of this resolution.- Returns:
- The aspect ratio of this resolution.
-