Package squidpony.squidgrid.gui.gdx
Class ScreenSizeManager
java.lang.Object
squidpony.squidgrid.gui.gdx.ScreenSizeManager
public class ScreenSizeManager extends Object
A container that keeps tracks of the sizes of margins and cells. It is at the
screen-level, i.e. it is intended to keep track of the full screen, not of a
nested panel. Given the screen's size and the desired cell size, it computes
the margins around the usable part of the screen, and hence the position of
the full-screen SquidPanel (
(leftMargin,botMargin)
).- Author:
- smelC
-
Field Summary
Fields Modifier and Type Field Description int
botMargin
The bottom margin, which has at most a 1 pixel difference withtopMargin
.int
cellHeight
A cell's height, as given at creation time.int
cellWidth
A cell's width, as given at creation time.int
hCells
The number of cells, verticallyint
leftMargin
The left marginint
rightMargin
The right margin, which has at most a 1 pixel difference withleftMargin
.int
screenHeight
The screen's height, as given at creation time.int
screenWidth
The screen's width, as given at creation time.int
topMargin
The top marginint
wCells
The number of cells, horizontally -
Constructor Summary
Constructors Constructor Description ScreenSizeManager(int screenWidth, int screenHeight, int cellWidth, int cellHeight)
A fresh size manager, for the given screen size and the given cell size. -
Method Summary
Modifier and Type Method Description ScreenSizeManager
changeScreenSize(int x, int y)
void
log()
Coord
toScreenSize()
-
Field Details
-
screenWidth
The screen's width, as given at creation time. -
screenHeight
The screen's height, as given at creation time. -
topMargin
The top margin -
botMargin
The bottom margin, which has at most a 1 pixel difference withtopMargin
. -
leftMargin
The left margin -
rightMargin
The right margin, which has at most a 1 pixel difference withleftMargin
. -
cellWidth
A cell's width, as given at creation time. -
cellHeight
A cell's height, as given at creation time. -
wCells
The number of cells, horizontally -
hCells
The number of cells, vertically
-
-
Constructor Details
-
ScreenSizeManager
A fresh size manager, for the given screen size and the given cell size.- Parameters:
screenWidth
-screenHeight
-cellWidth
- The desired cell width.cellHeight
- The desired cell height.- Throws:
IllegalStateException
- If a size is negative.
-
-
Method Details