当前位置: 编程技术>移动开发
本页文章导读:
▪Titanium的2D游戏发动机模块-QuickTiGame2d Titanium的2D游戏引擎模块-QuickTiGame2d
What is QuickTiGame2d?QuickTiGame2d is a 2-dimensional game engine module for Titanium Mobile that provides quick and easy api to create casual 2d games on Titanium. QuickTiGame2d runs much faster on mobil.........
▪ jquery mobile 实现下载功能时的有关问题 jquery mobile 实现下载功能时的问题
开发环境
使用jquery mobile 来开发移动web页面
问题现象
有一文件名链接,点击后是触发js功能并对表单进行提交,希望返回的是文件下载的效果,结果是.........
▪ 运用BeanUtils类简化request和resultset转换 使用BeanUtils类简化request和resultset转换
转:http://xdwangiflytek.iteye.com/blog/1358275
当提交表单时,如果没有使用Struts等框架的话,你的代码可能是这样
Java代码
User user=new User();
user..........
[1]Titanium的2D游戏发动机模块-QuickTiGame2d
来源: 互联网 发布时间: 2014-02-18
Titanium的2D游戏引擎模块-QuickTiGame2d
What is QuickTiGame2d?
QuickTiGame2d is a 2-dimensional game engine module for Titanium Mobile that provides quick and easy api to create casual 2d games on Titanium. QuickTiGame2d runs much faster on mobile devices because it is based on OpenGL ES: the industry-standard graphics library on embedded systems. Currently QuickTiGame2d supports both iOS and Android.
http://code.google.com/p/quicktigame2d/
An addictive Whac-A-Mol like game "Kawaz-tan tataki!" is included as example of QuickTiGame2d.
What does it look like?
Performance Test
What is QuickTiGame2d?
QuickTiGame2d is a 2-dimensional game engine module for Titanium Mobile that provides quick and easy api to create casual 2d games on Titanium. QuickTiGame2d runs much faster on mobile devices because it is based on OpenGL ES: the industry-standard graphics library on embedded systems. Currently QuickTiGame2d supports both iOS and Android.
http://code.google.com/p/quicktigame2d/
An addictive Whac-A-Mol like game "Kawaz-tan tataki!" is included as example of QuickTiGame2d.
What does it look like?
// Obtain game module var quicktigame2d = require('com.googlecode.quicktigame2d'); // Create view for your game. var game = quicktigame2d.createGameView(); // Frame rate can be changed (fps can not be changed after the game is loaded) game.fps = 30; // Initialize your game scene var scene = quicktigame2d.createScene(); game.pushScene(scene); // Create your sprites and add them to the scene var background = quicktigame2d.createSprite( {image:'background.png', width:640, height:960, x:0, y:0} ); var sprite = quicktigame2d.createSprite({image:'ball.png'}); // Sprite sheet is supported var tiles = quicktigame2d.createSpriteSheet( {image:'tiles.png', width:32, height:32} ); // Add sprites to the scene scene.add(background); scene.add(sprite); scene.add(tiles); // Set sprite opacity to 50% sprite.alpha = 0.5; // Rotate sprite in 30 degree sprite.rotate(30); // Scale up the sprite by twice sprite.scale(2); // Z-order can be changed background.z = 0; sprite.z = 1; // Called when the game is loaded game.addEventListener('onload', function(e) { Ti.API.info("your game is loaded"); // Change position of your sprite sprite.x = game.screen.width * 0.5; sprite.y = game.screen.height * 0.5; // Select first frame of sprite sheet tiles.frame = 0; // sprite sheet animation is also supported tiles.animate([0, 1, 2], 500); game.start(); } // Called when the game enters frame game.addEventListener('enterframe', function(e) { // Change position of your sprite sprite.x = sprite.x + 1; // Rotate your sprite sprite.rotate(sprite.angle + 6); } // Called when user taps screen game.addEventListener('singletap', function(e) { // Note that Ti.UI.View returns non-retina coordinate even on retina devices, // so we have to take the scale into account to process touch event. var scale = game.screen.width / game.width; // Change position of your sprite sprite.x = e.x * scale; sprite.y = e.y * scale; }
Performance Test
[2] jquery mobile 实现下载功能时的有关问题
来源: 互联网 发布时间: 2014-02-18
jquery mobile 实现下载功能时的问题
开发环境
开发环境
使用jquery mobile 来开发移动web页面
问题现象
有一文件名链接,点击后是触发js功能并对表单进行提交,希望返回的是文件下载的效果,结果是返回一个undefind字符页面。
原因分析
在多方研究之后,将问题范围归结为jquery mobile默认的ajax提交设置。由于jquery mobile的使用是用于移动手机,设计思想又主要是以ajax交互为主。这样,即使我对一个form表单进行submit提交,但jquery mobile也会自动将其以ajax方式来交互,从后来传来的文件流后,jquery mobile无法对其进行正确解析而出错。
最后,我的是在form元素中加入data-ajax="false"使当前这个form不进行ajax提交。问题解决。
[3] 运用BeanUtils类简化request和resultset转换
来源: 互联网 发布时间: 2014-02-18
使用BeanUtils类简化request和resultset转换
User user=new User();
user.setUsername(request.getParameter("username"));
user.setPassword(request.getParameter("password"));
user.setEmail(request.getParameter("email"));
try {
Map params=request.getParameterMap();
BeanUtils.populate(user , params);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (rs.next()) {
User user = new User();
user.setId(rs.getLong("id"));
user.setUsercode(rs.getString("usercode"));
user.setSex(rs.getString("sex"));
user.setPassword(rs.getString("password"));
user.setPhone(rs.getString("phone"));
user.setEmail(rs.getString("email"));
users.add(user);
}
ResultSetDynaClass rsdc = new ResultSetDynaClass(rs);
Iterator rows = rsdc.iterator();
ArrayList lists = new ArrayList();
while (rows.hasNext()) {
User user = new User();
DynaBean row = (DynaBean) rows.next();
BeanUtils.copyProperties(user, row);
lists.add(user)
}
转:http://xdwangiflytek.iteye.com/blog/1358275
当提交表单时,如果没有使用Struts等框架的话,你的代码可能是这样
Java代码
User user=new User(); user.setUsername(request.getParameter("username")); user.setPassword(request.getParameter("password")); user.setEmail(request.getParameter("email"));
如果表单项比较多,每次都要这样写是不是很烦?
OK,使用commons-beanutils吧。你只需要这样写
Java代码
try { Map params=request.getParameterMap(); BeanUtils.populate(user , params); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
那么处理ResultSet时,如果没有Hibernate等框架,你的代码可能是这样
Java代码
if (rs.next()) { User user = new User(); user.setId(rs.getLong("id")); user.setUsercode(rs.getString("usercode")); user.setSex(rs.getString("sex")); user.setPassword(rs.getString("password")); user.setPhone(rs.getString("phone")); user.setEmail(rs.getString("email")); users.add(user); }
是不是也有点烦?OK,这样来写吧
Java代码
ResultSetDynaClass rsdc = new ResultSetDynaClass(rs); Iterator rows = rsdc.iterator(); ArrayList lists = new ArrayList(); while (rows.hasNext()) { User user = new User(); DynaBean row = (DynaBean) rows.next(); BeanUtils.copyProperties(user, row); lists.add(user) }
最新技术文章: