您的位置:首页 > 编程语言 > Java开发

Java游戏开发组件LGame简易测试版发布(版本号:0.1.0)

2009-08-09 20:17 761 查看
LGame-Simple-0.1.0组件下载地址:


http://code.google.com/p/loon-simple/downloads/list





从2008年开始筹备LGame项目以来,大家都是只知道有个Loonframework-Game包,却谁也没见过它的庐山真面目,这是为什么呢?



原因其实很简单,因为吾辈就从没对外发布过……或者说吾辈一直都是光打烟雾弹,吃着空额不当兵,见了鬼子不拉弦≡(▔﹏▔)≡|||……总之一句话,就是偶一直是动嘴不动手的干活……



不过呢,即便是这样的吾辈,也总是有优点的,那就是即便天生MV低的吓人的偶,却干任何事情都绝不太监。我的做人原则就是,无论结果是好是坏,总会给大家一个说法,一个交待的~(虽然有时候时间会比较漫长……)



所以当吾辈活到了2009年,当吾辈离奔三又近一步之际,也总算要对外丢出一个可执行的Loonframework-Game包了。



——但是,各位网友大人还请不要高兴得太早……



事实上,这次发布的Loonframework-Game包,并不是传说中的Loonframework-Game包正式版,而只个对外寻求改进意见用的简易版本。



至于作用嘛,就是要请大家集思广益,看看有什么功能需要,有什么功能是不需要,还有什么功能是需要而没有添加的。



那么言归正传,偶先来大体上介绍一下这次发布的LGame-Simple包。



org.loon.framework.game.simple //LGame系统的简易测试版,此序列下LGame组件无法保证稳定性,也不能保证其与更高版本间的相互兼容。
org.loon.framework.game.simple.core //LGame核心包,无此包LGame将无法运行。
org.loon.framework.game.simple.window //以AWT为基础纯绘制生成的一系列窗体组件,不依赖于Swing。但可以实现大多数Swing特效,譬如
支持组件拖拽,半透明窗体等。
org.loon.framework.game.simple.utils //一系列常用的辅助工具类。
org.loon.framework.game.simple.utils.collection //一系列数据集合类,用以实现那些标准Java类库中没有提供的功能。
org.loon.framework.game.simple.extend //LGame的功能扩展包,LGame的基础功能不依赖于此包下组件实现,不需要时可删除。
org.loon.framework.game.simple.extend.db //一个微型的文本数据库系统,完全基于对象操作,支持简单的CRUD,支持数据库加密。
org.loon.framework.game.simple.extend.command //一个逐行解释的脚本系统,可以借此实现简单的脚本批处理。
org.loon.framework.game.simple.sound //一些相关的音乐播放类。






因为是征集意见用的测试版本,吾辈并没有把一些如LGraphics之类的开发中组件加入其中,甚至于精灵、碰撞、特效熏染等组件也因尚未整理完毕而并没有提供。



觉得可用功能太少了吗?



——那么我告诉您,即便这样的情况下,这个jar的体积也有203K,如果都加上弄不好会奔4甚至于5……



LGame并不是偶集中于一个时期写的,而是零零碎碎垒起来的,所以代码的冗余量就相对较高。



我之所以写了这个LGame-Simple版,就在于现在的LGame架构中还存在很多不合理及需要改进的地方,暂时还不适宜正式发布。



吾辈曾将N年来对于Java的认识,总结为这样一段句话:“Java并没什么做不到的,也并没什么做不好的。如果某件事你觉得用Java做不到,那只能说明你还没想好该怎样用Java去处理罢了;如果某件事你用Java做了却做不好,那也仅仅是因为你还不知道更好的Java解决方案而已。”



所谓贪多嚼不烂,吾辈以为,与其把N多代码一股脑的推出去,还不如一点点发,一点点改进要好些。



——否则发了正式版再改,闹得高版本无法兼容低版本,可就悲剧了……



因此在本次的LGame-Simple-0.1.0中,提供给大家的组件将围绕在一些LGame的基本功能及UI上,并希望大家能够就此方面内容给与相应的代码补充(这才是关键~
)或改进意见。





下面为了给大家一个明确的初步印象,笔者将简要介绍LGame-Simple的使用方式,而且此部分内容还将在以后的博文中逐渐补充。



改了以前发过的三个示例为LGame-Simple包开发,具体源码已放在Google上,等到正式版发布时代码量还能再精简N多……

















1、如何创建一个空窗体。



类名:HelloJavaGame.java



package org.loon.game.simple.test;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import org.loon.framework.game.simple.Deploy;
import org.loon.framework.game.simple.GameFrame;
import org.loon.framework.game.simple.Screen;
/**
 * 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:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class HelloJavaGame extends Screen {
	/**
	 * 绘图器接口
	 * 
	 * 在没有任何限制的情况下,此接口中数据会以最大FPS自动进行刷新。 LGame框架建议您以draw绘制图形,重载next以处理具体的业务数据。
	 */
	public void draw(Graphics2D g) {
	}
	/**
	 * 于Screen中点击鼠标左键
	 */
	public void leftClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标中间键
	 */
	public void middleClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标右键
	 */
	public void rightClick(MouseEvent e) {
	}
	/**
	 * 于Screen中按下键盘
	 */
	public void onKey(KeyEvent e) {
	}
	/**
	 * 于Screen中放开键盘
	 */
	public void onKeyUp(KeyEvent e) {
	}
	public static void main(String[] args) {
		// 获得一个游戏窗体
		GameFrame frame = new GameFrame("[LGame-simple-0.1.0使用范例]-建立一个空窗体",
				480, 360);
		// 得到此窗体所对应的游戏部署器
		Deploy deploy = frame.getDeploy();
		// 设定此游戏屏幕(在任何时候都可以通过Screen中的setCurrentControl函数切换游戏屏幕)
		deploy.setScreen(new HelloJavaGame());
		// 是否显示FPS
		deploy.setFPS(true);
		// 允许的最大刷新率
		deploy.setMaxFrames(60);
		// 开始游戏主循环体
		deploy.mainLoop();
		// 显示游戏
		frame.showFrame();
	}
}






效果图如下:









2、加载背景图并于Screen之上载入一个按钮,配合鼠标操作自动隐藏及显示该按钮。



类名:HelloJavaGame1.java



package org.loon.game.simple.test;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import org.loon.framework.game.simple.Deploy;
import org.loon.framework.game.simple.GameFrame;
import org.loon.framework.game.simple.Screen;
import org.loon.framework.game.simple.window.LButton;
/**
 * 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:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class HelloJavaGame1 extends Screen {
	// 设定按钮宽,设定按钮高
	private int btnWidth = 200, btnHeight = 40;
	// 创建一个按钮,宽200,高40,显示位置取Screen中心
	private LButton button = new LButton("Hello Java Game!", getWidth() / 2
			- btnWidth / 2, getHeight() / 2 - btnHeight / 2, btnWidth,
			btnHeight);
	public HelloJavaGame1() {
		// 设定当前Screen背景图片
		this.setBackground("images/background.jpg");
		// 加载一个按钮于Screen之上
		this.add(button);
	}
	/**
	 * 绘图器接口
	 * 
	 * 在没有任何限制的情况下,此接口中数据会以最大FPS自动进行刷新。 LGame框架建议您以draw绘制图形,重载next以处理具体的业务数据。
	 */
	public void draw(Graphics2D g) {
	}
	/**
	 * 于Screen中点击鼠标左键
	 */
	public void leftClick(MouseEvent e) {
		// 点击鼠标左键时按钮消失
		this.button.setVisible(false);
	}
	/**
	 * 于Screen中点击鼠标中间键
	 */
	public void middleClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标右键
	 */
	public void rightClick(MouseEvent e) {
		// 点击鼠标右键时按钮显示
		this.button.setVisible(true);
	}
	/**
	 * 于Screen中按下键盘
	 */
	public void onKey(KeyEvent e) {
	}
	/**
	 * 于Screen中放开键盘
	 */
	public void onKeyUp(KeyEvent e) {
	}
	public static void main(String[] args) {
		// 获得一个游戏窗体
		GameFrame frame = new GameFrame(
				"[LGame-simple-0.1.0使用范例]-载入背景图像,并显示一个按钮", 480, 360);
		// 得到此窗体所对应的游戏部署器
		Deploy deploy = frame.getDeploy();
		// 设定此游戏屏幕(在任何时候都可以通过Screen中的setCurrentControl函数切换游戏屏幕)
		deploy.setScreen(new HelloJavaGame1());
		// 是否显示FPS
		deploy.setFPS(true);
		// 允许的最大刷新率
		deploy.setMaxFrames(60);
		// 开始游戏主循环体
		deploy.mainLoop();
		// 显示游戏
		frame.showFrame();
	}
}





效果图如下:












2、加载一个子窗体于Screen当中,并于该窗体上添加一个按钮,此窗体可以被关闭、隐藏、拖拽。



类名:HelloJavaGame2.java



package org.loon.game.simple.test;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import org.loon.framework.game.simple.Deploy;
import org.loon.framework.game.simple.GameFrame;
import org.loon.framework.game.simple.Screen;
import org.loon.framework.game.simple.window.LButton;
import org.loon.framework.game.simple.window.LForm;
/**
 * 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:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class HelloJavaGame2 extends Screen {
	// 设定按钮宽,设定按钮高
	private int btnWidth = 200, btnHeight = 40,frmWidth=300,frmHeight=300;
	
//	 创建一个窗体,显示隐藏项及关闭项,宽300,高300,显示位置取Screen中心
	private LForm form = new LForm("我是一个纯绘制的窗体!",true,true, getWidth() / 2
			- frmWidth / 2, getHeight() / 2 - frmHeight / 2, frmWidth,
			frmHeight);
	
	// 创建一个按钮,宽200,高40,显示位置取form中心
	private LButton button = new LButton("Hello Java Game!", form.getWidth() / 2
			- btnWidth / 2, form.getHeight() / 2 - btnHeight / 2, btnWidth,
			btnHeight);
	public HelloJavaGame2() {
		// 设定当前Screen背景图片
		this.setBackground("images/background.jpg");
		// 加载一个按钮于form之上
		this.form.add(button);
		// 加载form于screen之上
		this.add(form);
	}
	/**
	 * 绘图器接口
	 * 
	 * 在没有任何限制的情况下,此接口中数据会以最大FPS自动进行刷新。 LGame框架建议您以draw绘制图形,重载next以处理具体的业务数据。
	 */
	public void draw(Graphics2D g) {
	}
	/**
	 * 于Screen中点击鼠标左键
	 */
	public void leftClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标中间键
	 */
	public void middleClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标右键
	 */
	public void rightClick(MouseEvent e) {
	}
	/**
	 * 于Screen中按下键盘
	 */
	public void onKey(KeyEvent e) {
	}
	/**
	 * 于Screen中放开键盘
	 */
	public void onKeyUp(KeyEvent e) {
	}
	public static void main(String[] args) {
		// 获得一个游戏窗体
		GameFrame frame = new GameFrame(
				"[LGame-simple-0.1.0使用范例]-在Screen中加载一个子窗体", 480, 360);
		// 得到此窗体所对应的游戏部署器
		Deploy deploy = frame.getDeploy();
		// 设定此游戏屏幕(在任何时候都可以通过Screen中的setCurrentControl函数切换游戏屏幕)
		deploy.setScreen(new HelloJavaGame2());
		// 是否显示FPS
		deploy.setFPS(true);
		// 允许的最大刷新率
		deploy.setMaxFrames(60);
		// 开始游戏主循环体
		deploy.mainLoop();
		// 显示游戏
		frame.showFrame();
	}
}





效果图如下:












2、加载多个子窗体于Screen当中,并于子窗体上添加相关组件,令窗体上按钮响应鼠标事件。



类名:HelloJavaGame3.java



package org.loon.game.simple.test;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import org.loon.framework.game.simple.Deploy;
import org.loon.framework.game.simple.GameFrame;
import org.loon.framework.game.simple.Screen;
import org.loon.framework.game.simple.window.LButton;
import org.loon.framework.game.simple.window.LForm;
import org.loon.framework.game.simple.window.LPaper;
/**
 * 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:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class HelloJavaGame3 extends Screen {
	// 创建一张空纸,在其上加载指定图像
	private LPaper paper = new LPaper("images/dialog.png", 40, 40);
	// 创建窗口1
	private LForm form1 = new LForm("新建窗口1", true, true, 10, 10, 202, 220);
	// 创建窗口2
	private LForm form2 = new LForm("新建窗口2", true, true, 90, 135, 202, 220);
	public HelloJavaGame3() {
		this.setBackground("images/background.jpg");
		LButton button1 = new LButton("显示Paper", 25, 25, 150, 25) {
			public void doClick() {
				paper.setVisible(true);
			}
		};
		LButton button2 = new LButton("隐藏Paper", 25, 65, 150, 25) {
			public void doClick() {
				paper.setVisible(false);
			}
		};
		LButton button3 = new LButton("禁止Paper被拖拽", 25, 25, 150, 25) {
			public void doClick() {
				paper.setLocked(true);
			}
		};
		LButton button4 = new LButton("允许Paper被拖拽", 25, 65, 150, 25) {
			public void doClick() {
				paper.setLocked(false);
			}
		};
		// 设定窗体1透明度为0.5f
		this.form1.setAlpha(0.5f);
		// 窗体1加载两个按钮
		this.form1.add(button1);
		this.form1.add(button2);
		// 窗体2加载两个按钮
		this.form2.add(button3);
		this.form2.add(button4);
		// 设定paper透明度为0.9f
		this.paper.setAlpha(0.9f);
		// 设定paper初始状态为不可见
		this.paper.setVisible(false);
		// 载入Screen
		this.add(form1);
		this.add(form2);
		this.add(paper);
	}
	/**
	 * 绘图器接口
	 * 
	 * 在没有任何限制的情况下,此接口中数据会以最大FPS自动进行刷新。 LGame框架建议您以draw绘制图形,重载next以处理具体的业务数据。
	 */
	public void draw(Graphics2D g) {
	}
	/**
	 * 于Screen中点击鼠标左键
	 */
	public void leftClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标中间键
	 */
	public void middleClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标右键
	 */
	public void rightClick(MouseEvent e) {
	}
	/**
	 * 于Screen中按下键盘
	 */
	public void onKey(KeyEvent e) {
	}
	/**
	 * 于Screen中放开键盘
	 */
	public void onKeyUp(KeyEvent e) {
	}
	public static void main(String[] args) {
		// 获得一个游戏窗体
		GameFrame frame = new GameFrame(
				"[LGame-simple-0.1.0使用范例]-在Screen中加载多个子窗体,并设定其上的按钮事件", 480, 360);
		// 得到此窗体所对应的游戏部署器
		Deploy deploy = frame.getDeploy();
		// 设定此游戏屏幕(在任何时候都可以通过Screen中的setCurrentControl函数切换游戏屏幕)
		deploy.setScreen(new HelloJavaGame3());
		// 是否显示FPS
		deploy.setFPS(true);
		// 允许的最大刷新率
		deploy.setMaxFrames(60);
		// 开始游戏主循环体
		deploy.mainLoop();
		// 显示游戏
		frame.showFrame();
	}
}






效果图如下:












3、绘制简单开始菜单界面,并以键盘事件控制游标进行移动。



类名:HelloJavaGame4.java



package org.loon.game.simple.test;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import org.loon.framework.game.simple.Deploy;
import org.loon.framework.game.simple.GameFrame;
import org.loon.framework.game.simple.Screen;
import org.loon.framework.game.simple.core.LTimer;
import org.loon.framework.game.simple.utils.GraphicsUtils;
import org.loon.framework.game.simple.window.LText;
/**
 * 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:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class HelloJavaGame4 extends Screen {
	private LText text = new LText("尚未进行任何选择", 150, 40, 140, 50);
	private Image[] arrows = GraphicsUtils.getSplitImages("images/arrow.png",
			9, 9);
	private int option, blinkType;
	private LTimer lTimer = new LTimer(400);
	public HelloJavaGame4() {
		this.setBackground("images/background.jpg");
		this.text.setAlpha(0.5f);
		this.add(text);
	}
	public void alter(long timer) {
		if (lTimer.action(timer)) {
			blinkType++;
			if (blinkType > 2) {
				blinkType = 0;
			}
		}
	}
	/**
	 * 绘图器接口
	 * 
	 * 在没有任何限制的情况下,此接口中数据会以最大FPS自动进行刷新。 LGame框架建议您以draw绘制图形,重载next以处理具体的业务数据。
	 */
	public void draw(Graphics2D g) {
		GraphicsUtils.setAntialias(g, true);
		g.setFont(GraphicsUtils.getFont("华文新魏", 20));
		GraphicsUtils.drawStyleString(g, "开始游戏", 180, 190, Color.WHITE,
				Color.BLACK);
		GraphicsUtils.drawStyleString(g, "读取记录", 180, 220, Color.WHITE,
				Color.BLACK);
		GraphicsUtils.drawStyleString(g, "环境设定", 180, 250, Color.WHITE,
				Color.BLACK);
		GraphicsUtils.drawStyleString(g, "结束游戏", 180, 280, Color.WHITE,
				Color.BLACK);
		GraphicsUtils.setAntialias(g, false);
		switch (option) {
		case 0:
			g.drawImage(arrows[blinkType], 160, 180, null);
			break;
		case 1:
			g.drawImage(arrows[blinkType], 160, 210, null);
			break;
		case 2:
			g.drawImage(arrows[blinkType], 160, 240, null);
			break;
		case 3:
			g.drawImage(arrows[blinkType], 160, 270, null);
			break;
		}
	}
	/**
	 * 于Screen中点击鼠标左键
	 */
	public void leftClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标中间键
	 */
	public void middleClick(MouseEvent e) {
	}
	/**
	 * 于Screen中点击鼠标右键
	 */
	public void rightClick(MouseEvent e) {
	}
	/**
	 * 于Screen中按下键盘
	 */
	public void onKey(KeyEvent e) {
		switch (e.getKeyCode()) {
		case KeyEvent.VK_ENTER:
			if (option == 0) {
				text.setText("选中[开始游戏]");
			} else if (option == 1) {
				text.setText("选中[读取记录]");
			} else if (option == 2) {
				text.setText("选中[环境设定]");
			} else if (option == 3) {
				text.setText("选中[结束游戏]");
			}
			break;
		case KeyEvent.VK_UP:
			option--;
			if (option < 0) {
				option = 3;
			}
			break;
		case KeyEvent.VK_DOWN:
			option++;
			if (option > 3) {
				option = 0;
			}
			break;
		}
	}
	/**
	 * 于Screen中放开键盘
	 */
	public void onKeyUp(KeyEvent e) {
	}
	public static void main(String[] args) {
		// 获得一个游戏窗体
		GameFrame frame = new GameFrame("[LGame-simple-0.1.0使用范例]-键盘菜单选择", 480,
				360);
		// 得到此窗体所对应的游戏部署器
		Deploy deploy = frame.getDeploy();
		// 设定此游戏屏幕(在任何时候都可以通过Screen中的setCurrentControl函数切换游戏屏幕)
		deploy.setScreen(new HelloJavaGame4());
		// 是否显示FPS
		deploy.setFPS(true);
		// 允许的最大刷新率
		deploy.setMaxFrames(60);
		// 开始游戏主循环体
		deploy.mainLoop();
		// 显示游戏
		frame.showFrame();
	}
}







效果图如下:










暂时先写这些,等过两天我将精灵与碰撞组件添加上后会继续增加相关示例。



实际上Java开发2D或3D游戏并没什么难的,从性价比的角度来说Java开发游戏,至少比现阶段的Flash更强。但在现实中,Java游戏开发却主要维持在手机领域及贪食蛇一类的小游戏之上,实在令人扼腕叹息。归结其原因,一是相关的盈利企业太少,没有多少人需要此方面人才。二是相关示例及第三方组件太少,导致很多人不知从何处入手,另外效率问题也非常令人困扰。



所以LGame 2D组件未来的发展方向将集中在解决Java绘图效率问题及组件支持方面,目前阶段又以添加相应组件为主,效率问题搁置。(实际上,鄙人已写了一套基于象素操作的LGraphics组件,但是运行效果还不太稳定,并且有很多Graphics2D特效也没有实现,所以暂不发布。对了,偶提这件事是为了表示一下偶没忘了效率问题……)



另外说句题外话,前一阵曾很想开发对应JavaFX语法的版本,但可惜JavaFX的用户体验实在差强意义,所以此计划被无限期搁置了。



即便以最新的JavaFX1.2来说,其jar加载速度之慢、程序启动速度之慢、软件运行速度之慢,在同类产品中都可谓是独占鳌头了。甚至比标准的Applet更甚,最不能容忍的是那些与Applet如出一辙,却更加繁琐的简直是见了鬼的安全提示框……

Sun的大虾们啊,不修改或执行本地文件

安全提示框

你就别出来了吧……我们设身处地的想象一下,如果Youku或者YouTube(想看?请***)之类的视频网站每次浏览视频都会出现安全提示,还有多少普通用户敢使用它们呢?Flash还能有现在规模的市场吗?……放着现成的成功经验却视而不见,恐怕连如来佛祖、基督耶稣都搞不清楚JavaFX的开发人员大脑究竟是怎么构成的了|||……

刨除运行效率与用户体验不谈,即便单说JavaFX的部署问题。谁能知道那群大侠究竟想干什么?不要说在别处测试,即便在我这个Java相关组件一应俱全的机器上运行官方示例,尚且很少看见Java控制台中一个错也不报的时候,更不要说运行其他人写的JavaFX程序了。前一阵我曾收集了一些JavaFX的应用,其中居然有超过1/5不能在我机器上直接运行,你们让那些普通用户可怎么玩啊……

还有啊,还有,支持JavaFX的消费型运行库到底要再过几个世纪才能出来啊?额滴神啊,让Oracle或Sun的其中一方想起来它们正在使用的运行库究竟有多么庞大吧……

我一直认为,如果能保证系统运行基本稳定这一大前提,那么程序的启动与运行速度就应该被放在第一位,其次才是UI以及具体的业务处理,最后也应适当考虑到执行程序的大小及其下载安装速度。要知道,在这个时间就是金钱,效率就是生命的现代社会里,即便你的UI再华丽,业务处理能力再强大,却连运行个时钟程序都要花十几二十秒启动,按一个按钮要隔N久才反馈回信息,又有多少人会想要去相信并使用它呢?



不得不说,本来大有可为的JavaFX,目前并没能带动整个Java社区更进一步,甚至与之相反,有了拉Java社区后退,乃至成为整个Java社区耻辱的可能性存在。



身为Java程序员,我们都异常不希望看见JavaFX的失败,我们都希望它能达到甚至于超越Flash今时今日的普及程度。然而,就JavaFX目前的发展态势而言,却实在凶多吉少,JavaFX的开发团队完全有必要也有能力将它做的更好,可惜他们目前还没能做到。



我只能说,JavaFX的目标或许很远大,然而它却走得很慢,差不多是乌龟爬行……

所以目前阶段LGame的开发还是以AWT为基础组件,暂时不考虑支持JavaFX与Swing(在以前的文章中解释过原因)。





LGame-Simple-0.1.0组件下载地址:


http://code.google.com/p/loon-simple/downloads/list





___________________________________________



原本预计周日一天能写完简介的,但现在看起来没戏了,起因是某个歹人在今天上午把我硬叫去义务维修电脑……



等明后天我回家后有空再继续此文,预计周三前肯定能写完。暂时先把组件的jar丢上去,至于程序源码会在此文写完后与示例代码一起发布,想提前看就反编译吧,反正也没加密……另外以前常看我博文的朋友可以直接用早前的游戏示例往里套,只要少许修改即可在此框架下重用。



___________________________________________



两天之后,在一个月黑风高的夜晚,偶突然想起来此文仅写了一半,于是迷迷糊糊的从床上爬起来将此文“补完”,继而踏踏实实的睡觉去了……

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: