﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-看看海，喝喝咖啡，写写程序——我的最爱Java-文章分类-游戏移植</title><link>http://www.blogjava.net/jiansong/category/7250.html</link><description>&lt;a target=blank href=http://wpa.qq.com/msgrd?V=1&amp;Uin=5410999&amp;Site=www.blogjava.net/jiansong&amp;Menu=yes&gt;&lt;img border="0" SRC=http://wpa.qq.com/pa?p=1:5410999:1 alt="点击这里给我发消息"&gt;&lt;/a&gt;</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 07:46:50 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 07:46:50 GMT</pubDate><ttl>60</ttl><item><title>从日本DOJA平台移植到Nokia S60平台的经验之谈</title><link>http://www.blogjava.net/jiansong/articles/29524.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sat, 04 Feb 2006 06:20:00 GMT</pubDate><guid>http://www.blogjava.net/jiansong/articles/29524.html</guid><wfw:comment>http://www.blogjava.net/jiansong/comments/29524.html</wfw:comment><comments>http://www.blogjava.net/jiansong/articles/29524.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/jiansong/comments/commentRss/29524.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jiansong/services/trackbacks/29524.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 今天我来谈谈手机游戏移植的一些小问题，我刚刚进去一个手机游戏公司时，公司给我的第一个任务就是从日本DOJA平台移植到Nokia S60平台，移植这个游戏时难度不是很大，经过两天时间对源代码的分析，理解，基本上摸清了思路。<BR>&nbsp;&nbsp;&nbsp;&nbsp; 接下来就是先修改MIDP与DOJA平台不同的下面四个方法：<BR><SPAN lang=EN-US><FONT color=#0000ff>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT color=#0000ff>javax.microedition.lcdui.Graphics<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">translate</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">(int&nbsp;x, int&nbsp;y)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">drawImage</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(</FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">Image</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">&nbsp;img, int&nbsp;x, int&nbsp;y, int&nbsp;anchor)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">setColor</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">(int&nbsp;RGB)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">drawRegion</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(</FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">Image</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">&nbsp;src, int&nbsp;x_src, int&nbsp;y_src, int&nbsp;width, int&nbsp;height, int&nbsp;transform, int&nbsp;x_dest, int&nbsp;y_dest, int&nbsp;anchor)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p>&nbsp;</o:p></SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT color=#0000ff>com.nttdocomo.ui.Graphics<o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21.25pt; TEXT-INDENT: -21.25pt; mso-list: l0 level1 lfo2; tab-stops: list 21.25pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">setOrigin</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">(int&nbsp;x, int&nbsp;y)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21.25pt; TEXT-INDENT: -21.25pt; mso-list: l0 level1 lfo2; tab-stops: list 21.25pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">drawImage</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(</FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">Image</SPAN></CODE><FONT face=宋体><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt">&nbsp;image, int&nbsp;x, int&nbsp;y)</SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21.25pt; TEXT-INDENT: -21.25pt; mso-list: l0 level1 lfo2; tab-stops: list 21.25pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">setColor</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(int&nbsp;c),</FONT></SPAN></CODE><CODE><SPAN style="FONT-SIZE: 12pt"><FONT face=宋体>其中参数</FONT><SPAN lang=EN-US><FONT face=宋体>c=</FONT><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt">getColorOfRGB</SPAN><FONT face=宋体>(int&nbsp;r, int&nbsp;g, int&nbsp;b)</FONT></SPAN></SPAN></CODE><SPAN lang=EN-US style="mso-bidi-font-weight: bold"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21.25pt; TEXT-INDENT: -21.25pt; mso-list: l0 level1 lfo2; tab-stops: list 21.25pt"><FONT color=#000000><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold"><SPAN style="mso-list: Ignore">4.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">if(</SPAN><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>anchor==</FONT></SPAN></CODE><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Tahoma; mso-font-kerning: 0pt"> Graphics.LEFT|Graphics.TOP</SPAN><SPAN lang=EN-US style="mso-bidi-font-weight: bold">){</SPAN><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体> </FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">setFlipMode</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(transform); </FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">drawImage</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>(</FONT></SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'; mso-ansi-font-size: 10.5pt">Image</SPAN></CODE><CODE><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT face=宋体>&nbsp;image, int&nbsp;dx, int&nbsp;dy, int&nbsp;sx, int&nbsp;sy, int&nbsp;width, int&nbsp;height)</FONT></SPAN></CODE><SPAN lang=EN-US> <SPAN style="mso-bidi-font-weight: bold">}<BR><BR>把<SPAN lang=EN-US><FONT color=#0000ff>javax.microedition.lcdui.Graphics </FONT><FONT color=#000000>中列出的4个方法替换<SPAN lang=EN-US><FONT color=#0000ff>com.nttdocomo.ui.Graphics </FONT><FONT color=#000000>中列出的4个方法就可以了。</FONT></SPAN></FONT></SPAN>修改完后，游戏基本上就没多大的问题了，OK，那我们就先来试运行一下吧！。。。哈哈，游戏可以正常运行，多么高兴的一件事啊，游戏能够运行，剩下的事就好办了，无非就是修改一下坐标啊，按照公司的要求重新做一个新的地图之类的。。。OK了，第一个游戏搞定！</SPAN></SPAN></FONT></P></FONT></SPAN><img src ="http://www.blogjava.net/jiansong/aggbug/29524.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jiansong/" target="_blank">Alex</a> 2006-02-04 14:20 <a href="http://www.blogjava.net/jiansong/articles/29524.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>