JavaFx vs Flash vs Silverlight

这是一个很早以前就有的JavaFX、Flash、Silverlight应用速度对比测试,传到Blog上来做一个参考。不过,这个测试结果可信度并不太高,一是三者版本已经都提升了,二是原作者使用的JavaFX算法与Flash、Silverlight的不对等……

作者网站在此,里面有很多Flash、Silverlight的应用示例:http://www.shinedraw.com/

JavaFx

<!-- javafx( { archive: "http://www.shinedraw.com/wordpress/wp-content/uploads/FpsMeter/Carousel.jar", draggable: true, width: 550, height: 400, code: "carousel.Main", name: "Carousel" } ); // -->

Flash

Silverlight

作者的话:

开诚布公的说,我对于JavaFX没有什么好印象,我想这可能是以下原因造成的:

1、没有任何UI编辑工具,我总要与脚本打交道。如果只能用编码方式进行开发,那可就一点也不好玩了。

2、应用程序老是需要花费很长时间才能加载成功,我不知道为什么会这样,总之每次在IE中启动程序,都要过一小段才能显示出内容。

3、以JavaFX运行程序,不但需要.jar文件,还要去配置.jnlp。

4、我不知道哪些属性可以与特定对象相关联。

5、有些时候,调试器无法获得正确的错误位置。

6、JavaFx是一种全新的脚本,学习它需要很长时间。

7、当滚动页面时,JavaFX中可能会出现残像。

实际上,除此之外我还有一些不好的体验,就不一一列举了。

可能有人会说,JavaFX是一个相对较新的技术,这些都是很平常的问题,你需要耐心等待。我同意这一点,因此我将等待JavaFX的后续发展,然后再花时间学习它。

我还记得,Silverlight在它的第一版中也没什么吸引力。那么,JavaFX下面会怎么样呢?

————————————————————————————

另外,笔者自己再补充个LGame-Simple的实现:

package org.loon.test; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.geom.AffineTransform; import org.loon.framework.game.simple.GameScene; import org.loon.framework.game.simple.core.Deploy; import org.loon.framework.game.simple.core.LSystem; import org.loon.framework.game.simple.core.LTimerContext; import org.loon.framework.game.simple.core.Screen; import org.loon.framework.game.simple.utils.GraphicsUtils; /** * 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 FPS extends Screen { private final static int ycenter = 90; private final static int xcenter = 220; private final static double shift = Math.PI / 2; private double image_gap = Math.PI; private double angle; private double angle_rad = angle * Math.PI / 180; private int total; class Carousel { double x, y, scale; int width, height; Image image; public Carousel(String fileName) { this.image = GraphicsUtils.loadImage(fileName); this.width = image.getWidth(null); this.height = image.getHeight(null); } public void draw(Graphics2D g) { AffineTransform transform = new AffineTransform(); transform.translate(x, y); transform.scale(scale, scale); g.drawImage(image, transform, null); } public void update(double i, double angle) { scale = 0.8 + 0.5 * Math.sin(angle + i * image_gap + shift); x = Math.cos(angle + i * image_gap + shift) * xcenter + xcenter; y = Math.sin(angle + i * image_gap + shift) * ycenter + ycenter; } } private Carousel[] carousels = new Carousel[0]; public void alter(LTimerContext timer) { angle_rad = angle_rad + Math.PI / 60; for (int i = 0; i < total; i++) { carousels[i].update(i, angle_rad); } } public synchronized void addCarousel() { int index = total % 6; if (total == carousels.length) { carousels = (Carousel[]) LSystem.expand(carousels, (total + 1) * 5); } carousels[total++] = new Carousel("images/image" + index + ".png"); image_gap = Math.PI * 2 / total; } public void draw(Graphics2D g) { g.setColor(Color.white); g.drawString(("图片总数:" + total).intern(), 15, getHeight() - 25); for (int i = 0; i < total; i++) { carousels[i].draw(g); } } public void leftClick(MouseEvent e) { addCarousel(); } public void middleClick(MouseEvent e) { } public void rightClick(MouseEvent e) { } public void onKey(KeyEvent e) { } public void onKeyUp(KeyEvent e) { } public static void main(String[] args) { GameScene frame = new GameScene("LGame-Simple-FPS测试", 550, 400); Deploy deploy = frame.getDeploy(); deploy.setScreen(new FPS()); deploy.setShowFPS(true); deploy.setLogo(false); deploy.setFPS(100); deploy.mainLoop(); frame.showFrame(); } }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值