/**
* Draw all game objects.
*/
private void onDraw() {
BufferStrategy frameStrategy = frame.getBufferStrategy();
if (frameStrategy == null) {
// create the buffer strategy, its null.
frame.createBufferStrategy(3);
frameStrategy = frame.getBufferStrategy();
}
// clear and get our graphics object.
graphics = frameStrategy.getDrawGraphics();
graphics.clearRect(0, 0, width, height);
if (showFPS) {
graphics.setColor(Color.red);
graphics.drawString(Integer.toString(fps) + " fps", 50, 50);
}
// update stack.
stack.forEach(state -> state.onDraw(graphics));
graphics.dispose();
frameStrategy.show();
}
Game.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:Lunar
作者:
评论列表
文章目录