|
Documentation
|
GapiDraw 3.6 Symbian Readme.txtThis document has been updated for use with GapiDraw 3.6 or later. |
ContentsPlease read the section known issues below before sending any bug reports.
Getting started with Symbian developmentWhat you need
Planning your installationThe Symbian SDKs must be on the same drive partition as your project files! For example, you cannot install the Symbian SDKs to C: and store project files on D:. If you store your project files on D:, remember to install the Symbian SDKs on the same drive (D:). Also, if you install the Symbian SDKs to another drive than C: and you want to use the emulator in Nokia Series 60 SDK 1.2, you must manually edit the file \Symbian\6.1\Series60\Epoc32\Data\epoc.ini to reflect this - otherwise the Series 60 emulator will stall! Simply set the key _EPOC_DRIVE_D to D: instead of C:. SDK ChoicesIt is recommended that you download and install the following SDKs:
GapiDraw BinariesBefore you begin to compile the sample applications you need to copy the GapiDraw LIB file to its correct location.
Depending on the SDKs you want to target you have to repeat the above file copy steps once for each of the SDKs you have installed, such as:
Environment SetupThe Nokia Series 60 SDK 1.2 changes several settings in the environment that are not compatible with other SDKs. Go to Start Menu -> Control Panel -> System -> Advanced -> Environment Variables and remove the following folders from the system search path:
All the above paths should be removed from the system path and will be set later. EnvironmentswitchMany people recommend the use of a tool called "environmentswitch" that is shipped with the Nokia Series 60 SDK 2.0. Using the environmentswitch tool you can easily create new shells where all the correct environment variables are set for you automatically. The disadvantage of using environmentswitch is that you can only build for one environment at a time - something that we probably do not want (in most cases we want to build for all target devices at once). However, if you want to use environmentswitch here is a sample configuration file to get you started (the program is located in the folder "C:\Symbian\7.0s\Series60_v20\Series60Tools\environmentswitch\"). Replace the contents of the file settings.xml in the same folder with this content:
BuildSample.cmd - the easy and better wayUsing environmentswitch it is assumed that you only want to build for one device at a time. If you want to build for multiple devices you would have to have two shells open and compile the same program twice, once for each shell. For each sample application shipped with GapiDraw there is a batch file called "BuildSample.cmd". If you start this file, GapiDraw will automatically set the necessary environment variables for you! So throw away environmentswitch and simply double click on "BuildSample.cmd" to get started! Please note that you may need to modify the "symbianroot" parameter on line #4 in the BuildSample.cmd file to match the folder of your Symbian installation. Compiling and running the "Simple" demoTo compile and run the "Simple" demo shipped with GapiDraw, start the windows explorer and navigate to the folder "\GapiDraw\Samples\Symbian\Simple". Edit the file "BuildSample.cmd" and change the key "symbianroot" to match the folder of your Symbian installation. Double click on the file "BuildSample.cmd" to compile the Series60 target, which will be placed in the folder "Release". To install the sample on your device, simply transfer the SIS file to the device using IR or USB transfer. Emulator notesTo start the emulator, you simply call "epoc.exe" after you have set the correct environment variables for the SDK you are using. Please review the file "BuildSample.cmd" shipped with each sample application for instructions on how to set the necessary environment variables. Please note that all images and resources have to be copied manually to the emulator. Simply select all images in the "res" folder and copy them manually to the %epocroot%/epoc32/release/wins/udeb/z/{PROJECT} folder.
GapiDraw / Symbian platform notesCGapiDrawBefore you use any of the classes in the GapiDraw library you must create an instance of the CGapiDraw class, which GapiDraw uses for initialization and cleanup. If youre using CGapiApplication this is done for you. Timers / animationTimers in Symbian are a real drawback. It is impossible to sleep with a greater accuracy than 15 ms, although the documentation for the Symbian equivalent of win32's Sleep() takes a microsecond argument so this is rather a limitation of current devices. Most cell phones running Symbian OS generates a clock tick every 1/64 of a second and the equivalent to Sleep(1) simply waits until the next clock tick. Therefore, it is virtually impossible to set a constant fps other than 16,21,32,64 so the approach used in CGapiApplication for Symbian is simply to render graphics when there are no other higher priority threads scheduled. This practically means that you should never base your in-game animation on how many frames that have passed, but rather on time. This approach is discussed in a few threads at http://forums.pocketmatrix.com Global variables and static member variablesGlobal variables are not supported in Symbian, which may cause issues for developers used to the Win32 environment. Since static member variables also are not available (preventing the use design patterns such as the Singleton pattern), it might not be clear how to work around this issue. The solution is to use a Thread Local Storage (TLS) to store one global pointer to a STRUCT created on the heap. This struct can contain unique pointers to all the global data in your application, and you can then define macros so that myglobalobject->myfunction will be replaced by Dll::Tls()->myglobalobject->myfunction. Using the TLS workaround, porting applications to Symbian is actually quite easy. The drawback is that there is a 20 cycle overhead in retreiving the TLS pointer, but in most cases this is not an issue. The solution of using a TLS is used in many cross-platform products such as Opera and GapiDraw. A DLL has it's own TLS so there should be no conflict between the GapiDraw TLS and the application TLS.
Known IssuesMenu program terminates on the Nokia 7650When running an application derived from CGapiApplication on the 7650, the menu program terminates about 10-15 seconds after starting, because of ViewSrv 11. It seems that the scheduler on the 7650 does not give enough priority to the menu program, and the menu program doesnt respond to the View server in time. The GapiDraw application does not crash however and this problem does not occur on any other Symbian device we have tested. Image loading does not work with exe filesThe imageloader does not work if you build an exe. If you need to build an exe instead of an app, and you want to load images, you would need to provide your own image loading, and convert the loaded image to a CGapiSurface using CGapiSurface::GetBuffer(). Some problems and solution suggestionsProblem: When I run my application in the emulator none of my images will load into surfacesSolution: You have probably just re-compiled your application without copying the images to the emulator. Just copy the images in the "res" folder into \Symbian\6.1\Series60\Epoc32\Release\wins\udeb\z\system\apps\ + the name of your application. Problem: I have problems linking to the GapiDraw library, I get lots of undefined symbol errorsSolution: You need to place "STATICLIBRARY GAPIDRAW.LIB" before all other libraries. See the MMP projects shipped with GapiDraw to see sample setups. Problem: the compiler/linker says that there are initialized data in my dllSolution: You are probably using global/static variables in your program. Apps/dlls in Symbian are not allowed to use these, so you have to organize thing differently to get rid of these, i.e. have them as member variables in your class rather than static variables in functions. Problem: I get "undefined symbol __chkstk" when I try to build my appSolution: You are putting to much on the stack. The stack size in Symbian is very limited so try to use the heap as much as possible. Problem: The menu program crashes 15 seconds after my app has started. My app runs fine though.Solution: Se section known issues Problem: I have a function LoadScore that returns a TBuf<15> and I want to display it using DrawText. So I need to convert it to a TCHAR*. I tried to use name.Ptr() which should have returned a pointer to the data (exactly what I need) but only the first letter is displayed! Do I miss something obvious? Solution: TBuf<15> is a pointer to a TUint16, and TEXT is an array of TUint8. So you should do something like this: TUint16 *uiPtr16 = buf15.Ptr(); It is assumed that your TBuf<15> variable is buf15. Now you can do DrawText(..., uiPtr8,...). The problem was in that TUint16* pointer which was returned from buf15.Ptr(). You received only the first letter because in upper byte of your TUint16* was a "0" which terminated string (null terminated string).
Useful links to some Symbian pagesForums:
General:
Steps to port a simple application to SymbianHere's a brief description of the steps required to port the simple example from win32 to Symbian. The Symbian SDK has to be installed on your computer. This description is not intended to be an introduction to Symbian programming, and it doesn't try to explain any Symbian specific details, its sole purpose is to show the amount of work to get a small existing application up and running using GapiDraw for Symbian. If you are interested in the various tools invoked in the build process for Symbian, check out the online documentation at symbian.com: http://www.symbian.com/developer/techlib/v70docs/SDL_v7.0/doc_source/ToolsAndUtilities/Build-ref/index.html
These are the steps that were used to create the simple Symbian example in the samples folder.
|
||||||||