JAVA图形操作中FPS的计算 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-15
tNowFPS() { return nowFPS; } public void setNowFPS(double nowFPS) { this.nowFPS = nowFPS; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } public String getFPS(){ return df.format(nowFPS); }}
JAVA图形操作中FPS的计算(2)时间:2011-08-18球体类相关代码: package org.test;import java.awt.Color;import java.awt.Graphics;/** *//*** <p>Title: LoonFramework</p>* <p>Description:</p>* <p>Copyright: Copyright (c) 2007</p>* <p>Company: LoonFramework</p>* @author chenpeng * @email:ceponline@yahoo.com.cn* @version 0.1*/public class Ball { private static final int SIZE = 10; private int x, y; protected int vx, vy; public Ball(int x, int y, int vx, int vy) { this.x = x; this.y = y; this.vx = vx; this.vy = vy; } public void move() { x += vx; y += vy; if (x < 0 || x > BallPanel.WIDTH - SIZE) { vx = -vx; } if (y < 0 || y > BallPanel.HEIGHT - SIZE) { vy = -vy; } } public void draw(Graphics g) { g.setColor(Color.RED); g.fillOval(x, y, SIZE, SIZE); } } JAVA夕侘荷恬嶄FPS議柴麻(3)扮寂:2011-08-18FPS式白悶侃尖喘旗鷹泌和? package org.test;import java.awt.Color;import java.awt.Dimension;import java.awt.Frame;import java.awt.Graphics;import java.awt.Image;import java.awt.Panel;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.awt.image.BufferedImage;import java.util.Random;/** *//*** <p>* Title: LoonFramework* </p>* <p>* Description:參JAVA資函FPS喘處幣殻會式昧字伏撹岱方白悶。(厚單晒旗鷹坪崔噐loonframework-game崇尺嶄)* </p>* <p>* Copyright: Copyright (c) 2007* </p>* <p>* Company: LoonFramework* </p>** @author chenpeng* @email?ceponline@yahoo.com.cn* @version 0.1*/public class BallPanel extends Panel implements Runnable { /** *//** * */ private static final long serialVersionUID = 1L; public static final int WIDTH = 360; public static final int HEIGHT = 360; // 譜協恷寄白悶方楚 private static final int NUM_BALLS = 50; // 協吶白悶方怏 private Ball[] ball; // 塰佩彜蓑 private volatile boolean running = false; private Thread gameLoop; // 産贋喘夕侘 private Graphics bg; private Image screen = null; // 伏撹昧字方 private Random ra |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于JAVA图形操作中FPS的计算 - 编程入门网的所有评论