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 intbotMarginThe bottom margin, which has at most a 1 pixel difference withtopMargin.intcellHeightA cell's height, as given at creation time.intcellWidthA cell's width, as given at creation time.inthCellsThe number of cells, verticallyintleftMarginThe left marginintrightMarginThe right margin, which has at most a 1 pixel difference withleftMargin.intscreenHeightThe screen's height, as given at creation time.intscreenWidthThe screen's width, as given at creation time.inttopMarginThe top marginintwCellsThe 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 ScreenSizeManagerchangeScreenSize(int x, int y)voidlog()CoordtoScreenSize()
-
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