Java游戏开发中怎样才能获得更快的FPS

               

 Java游戏开发中怎样才能获得更快的FPS


场景图1、角色图100 FPS 20 - 25

Java游戏开发中怎样才能获得更快的FPS


场景图1、角色图1000 FPS 13 - 17

Java游戏开发中怎样才能获得更快的FPS

 

场景图1、角色图100 FPS 25 - 35

Java游戏开发中怎样才能获得更快的FPS

场景图1、角色图1000 FPS 3 - 6

Java游戏开发中怎样才能获得更快的FPS

 

场景图1、角色图100 FPS 115 - 125

Java游戏开发中怎样才能获得更快的FPS

场景图1、角色图1000 FPS 55 - 70

Java游戏开发中怎样才能获得更快的FPS

 

简单应用:

 

package test1;import java.awt.Color;import java.awt.Dimension;import java.awt.Frame;import java.awt.Graphics;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;/** *  * Copyright 2008 - 2009 *  * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at *  * http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. *  * @project loonframework * @author chenpeng * @email:[email protected] * @version 0.1 */public class Sample extends Frame implements Runnable{ /**  *   */ private static final long serialVersionUID = 1L; private SimpleIntBufferImage simple1 = new SimpleIntBufferImage("back.gif"); private SimpleIntBufferImage simple2 = new SimpleIntBufferImage(   "idle0_0.png"); private int width = 480; private int height = 360; public Sample() {  super("自制SimpleIntBufferImage示例");  this.setBackground(Color.black);  simple1.convertToXor();  simple1.convertToXor();  this.setPreferredSize(new Dimension(width, height));  this.requestFocus();  this.addWindowListener(new WindowAdapter() {   public void windowClosing(WindowEvent e) {    System.exit(0);   }  });  this.pack();  this.setResizable(false);  this.setLocationRelativeTo(null);  this.setIgnoreRepaint(true);  Thread thread = new Thread(this);  thread.start(); }  public void run() {  for(;;){   repaint();   try {    Thread.sleep(20L);   } catch (InterruptedException e) {   }  } }  public void update(Graphics g) {  paint(g); } public void paint(Graphics g) {  simple1.copyImage(simple2,15,50);  g.drawImage(simple1.getBufferedImage(), 0, 0, null); } public static void main(String[] args) {  Sample frm = new Sample();  frm.setVisible(true); }}

 

效果如下:

Java游戏开发中怎样才能获得更快的FPS

 

 

 

 

 

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.****.net/jiangjunshow