快速业务通道

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-18

FPS式白悶侃尖喘旗鷹泌和?

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 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号