参考成果讲稿_第1页
参考成果讲稿_第2页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

GameLoft1 求下列代码执行以后expr的inta=8,b=4;intexpr=a++%++b*2intexpr=20/8*intexpr=4<<2+注意:+的优先级高于intexpr=-4321intexpr=123^321^intinta=intexpr=(byte)a+(((byte)a)&注意:byteintintexpr= ”.charAt(4)+Integera= newInteger(1234);Integerb= newInteger(1234);booleanexpr=a==Stringfunc(Stringreturns.length()>0?func(s.substring(1))+s.charAt(0):}Stringexpr=2 知识答案:回收(GC)是Java语言的一个重要特性,作用是释放不再被使用的内存。垃short的取值范围。什么是(obfuscate)?有什么好处?有哪些工具可以jar文件答案:是指通过对class文件中的变量名和部分方法名进行处理,来提高代码反编好处主要有2个:12class文件的大小。常见的器有Proguard和RetroGuard两种。答案:状态机(StateMachine)是根据对应状态进行处理的一种机制,在游戏开发中最典J2MEJavaPythonAntJavacJavaSubversionOpenGL3 const[j2me1]SCREEN_WIDTH=176;const[j2me2]TEXTWORD_SPACE=3;publicstaticvoidDrawString(StringstrText,intposX,intposY,intflagX){intwidth=GetTextWidth(strText);intx,int[j2me3]y=posY;if(flagX>0){x=}elseif(flagX==x=(SCREEN_WIDTH–width)/}}

x=SCREEN_WIDTH–x+=posX;bytefor(inti=0;i<=[j2me5]strText.length();i++){charTemp=strText.charAt(i);if(charTemp<‘!’|charTemp>‘z’){x+=}}

x+=flagXflagX的作用是决定对齐方式,大于0左对齐,等于0居中,小于0DrawCharater的返回值有什么意义?charTemp的宽度4 应用boolIsOverlapped(intx1,inty1,intr1,intx2,inty2,int

@paramx1x@paramy1y@paramr1@paramx2x@paramy2y@paramr2booleanIsOverlapped(intx1,inty1,intr1,intx2,inty2,intintl=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);if(l<(r1+r2)*(r1+r2)){return}}

return@params@returnStringdoString(StringStringtemp=""+s.charAt(0);for(inti=1;i<charc=if(c==''){if(s.charAt(i-1)!='temp+=}}

temp+=return}2、每个字符的像素宽度不一样,每个字符的像素宽度不一样。用intGetCharWidth(charc)获得每个字符的像素宽度。@params@paramscreenWidth@returnintcalcLineNum(Strings,intscreenWidth){intlength=0;intn=for(inti=0;i<intcharLen=lengthcharLen;if(lengthscreenWidth){n++;//行数lengthcharLen;}}if(length>0){}return}5 Anintegralapproachtocodeationistowritethecodesothatitsitself.Inotherwords,thecodeshouldbenaturallyreadableinsuchawayastomakeeasytounderstand.This plishedbypropernamingconventionsandstatementCollectionsarethedatastructuresthataremosteasilyalteredforperformance-tuningpurposes.Usingthecorrectormostappropriatecollectionclasscanimproveperformancewithlittlechangetocode.Forexample,ifalargeorderedcollectionhaselementsfrequentlydeletedorinsertedthroughoutit,itusuallycanprovidebetterperformanceifbasedonalinkedlistratherthananarray.Ontheotherhand,astatic(unchanging)collectionthatneedstobeaccessedbyindexperformsbetterwithanunderlyingimplement

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论