更换S60 SDK Emulator的skin(更正)

更换S60 SDK Emulator的skin”里我写到要是能动态更换Skin就好了,其实Emulator已经有这个功能了,就是它的System菜单下的Next Config项。不同的配置由epoc.ini中的configuration关键字指定。比如我现在的epoc.ini的内容是这样的:

configuration epoc_6630.ini
configuration epoc_NGage.ini

现在,点击Next Config…,就可以切换6630和NGage这两个Skin了。

bmconv的使用

用Carbide可以编辑一个mbmdef文件,加入要使用的bmp文件,make时会根据这个mbmdef文件生成mbm文件。不过,Carbide不会生成需要的mbg头文件。我用bmconv工具来创建mbg文件:

bmconv /hMyDemo.mbg mydemo.mbm cross.bmp not.bmp

可以把bmconv命令设为Pre-build step。

Drawing text on screen

来自SDK中文档Developer Guides >> Programming Games in C++

要加入gdi.h这个头文件,否则编译时会报错unresolved external symbol TFontSpec

#include <gdi.h>

同时还要修改mmp文件,加入LIBRARY gdi.lib。我用的IDE是Carbide c++ Express,新建的Project没有生成mmp文件,需要修改Project的build配置,把gdi.lib加到Linker的Libraries列表中。

格式化文本用TBuf::Format()

  1. // Get smallest possible arial font
  2. _LIT(KMyFontName,"Arial");
  3.  
  4. CFont* myFont;
  5.  
  6. TFontSpec myFontSpec(KMyFontName, TInt(1));
  7.  
  8. CGraphicsDevice* screenDevice = iCoeEnv->ScreenDevice();
  9.  
  10. screenDevice->GetNearestFontInTwips(myFont,myFontSpec);
  11. // Use new font
  12. gc.UseFont(myFont);
  13.  
  14. // Get the width and height of screen
  15. TInt width = aRect.Width();
  16. TInt height = aRect.Height();
  17.  
  18. // Draw a formated text
  19. TBuf<32> text;
  20. _LIT(KMyText, "width=%d, height=%d");
  21. text.Format(KMyText, width, height);
  22. gc.DrawText(text, TPoint(10, height) );
  23.  
  24. // Discard and release the font
  25. gc.DiscardFont();
  26. screenDevice->ReleaseFont(myFont);

用Eclipse远程调试(Remote debug)Tomcat

1. 配置Tomcat支持remote debugging

给JVM加上如下的启动参数:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

2. Eclipse里新建一个Remote Java Applications的debug

“Run->Debug…”, then “Remote Java Applications”, “New”,port添8000。

适合不想或没必要用任何插件的情形。

Ref: http://tomcat.apache.org/faq/development.html#rd-eclipse