本文整理汇总了Java中com.googlecode.lanterna.screen.Screen.getTerminalSize方法的典型用法代码示例。如果您正苦于以下问题:Java Screen.getTerminalSize方法的具体用法?Java Screen.getTerminalSize怎么用?Java Screen.getTerminalSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.lanterna.screen.Screen
的用法示例。
在下文中一共展示了Screen.getTerminalSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doStartup
import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
/**
* Contains the main event loop that drives the game. This method will not
* return until {@link LanternaFrontend#shutdown} is called.
*/
final void doStartup() {
Vec2i screenSize = getSize();
if (isTTY) System.out.print("\033[8;" + screenSize.y + ";" + screenSize.x + "t");
Screen screen = TerminalFacade.createScreen();
screen.startScreen();
{
TerminalSize size = screen.getTerminalSize();
//onResize(new Vec2i(size.getColumns(),size.getRows()));
onResize(screenSize);
}
long time = new Date().getTime();
while (running) {
try {
// First do anything that we need to do for updating screen size.
/* if (screen.resizePending()) {
screen.refresh();
TerminalSize size = screen.getTerminalSize();
onResize(new Vec2i(size.getColumns(),size.getRows()));
} */
// First do anything that we need to do for updating screen size.
// Then we draw the screen.
screen.clear();
onDraw(new Section(screen, new Vec2i(0,0), screenSize));
screen.refresh();
// We can now give the program any key presses
Key key = screen.readInput();
if (key != null)
onKeyPressed(key);
// Then we take care of ticks.
long currentTime = new Date().getTime();
onTick(currentTime - time);
time = currentTime;
} catch (NullPointerException e) {
// For now, ignore it.
}
}
screen.stopScreen();
}