Contents
- How to get your GapiDraw 3.0 application to compile with the GapiDraw 3.6 API
- How to get your GapiDraw 2.0 application to compile with the GapiDraw 3.6
API
- Always check the return codes
How to get your GapiDraw 3.0 application to compile with the GapiDraw 3.6 API
In GapiDraw 3.6 the SDK was modified to remove all global variables, which was necessary to deliver GapiDraw as a statically linked library. To get your current application up an running with the latest GapiDraw 3.6 you need to do the following changes to your code:
GapiDraw objects
- In GapiDraw 3.6 the default constructor for all GapiDraw classes has changed (all classes beginning with "CGapi". All constructors now require a pointer to a global "CGapiDraw" object, which is stored as a member variable to CGapiApplication named "m_pGapiDraw". This means that if you have any member variables such as "CGapiSurface m_surface;" you need to change these into pointers, "CGapiSurface* m_surface" and then allocate and free memory for the surfaces in the CGapiApplication constructor and destructor. You also need to change all calls to these surfaces from "m_surface." to "m_surface->".
How to get your GapiDraw 2.0 application to compile with the GapiDraw 3.6 API
As of GapiDraw 3.0, the API was unified to work on Palm, Symbian and
Win32 devices. This unfortunately introduced some minor changes in
the API. In GapiDraw 3.6 the SDK was further modified to remove all global variables, which was necessary to deliver GapiDraw as a statically linked library. To get your current application up an running with the latest GapiDraw
3.6 you need to do the following changes to your code:
GapiDraw objects
- In GapiDraw 3.6 the default constructor for all GapiDraw classes has changed (all classes beginning with "CGapi". All constructors now require a pointer to a global "CGapiDraw" object, which is stored as a member variable to CGapiApplication named "m_pGapiDraw". This means that if you have any member variables such as "CGapiSurface m_surface;" you need to change these into pointers, "CGapiSurface* m_surface" and then allocate and free memory for the surfaces in the CGapiApplication constructor and destructor. You also need to change all calls to these surfaces from "m_surface." to "m_surface->".
Files and paths
- GapiApplication.cpp, GapiApplication.h, and GapiDrawNet.h were all
moved to the folder "include\win32". Please add this folder
to the search path.
- The DLL and LIB file folders were changed. The "PocketPC2000-ARM"
folder is now called "PocketPC-ARM" (same goes for MIPS and
SH3). This change was applied to both the DLL and the LIB folder. The
folders "PocketPC2003-ARM" and "Smartphone2003-ARM" were removed since the core now contains ASM optimizations that no longer
benefits from WM2003 optimization in the compiler. Please adjust your
LIB search path in your project workspace.
CMyApplication
- If you do not have the "CreateVideoSurfaces" method implemented, you must add this operation in GapiDraw 3.0. It has changed name however, so please add "CreateVidMemSurfaces" to your subclass.
- Change ProcessNextFrame(CGapiSurface backbuffer, DWORD dwFags) to
ProcessNextFrame(CGapiSurface* pBackBuffer, DWORD dwFlags). Do a local
search/replace for "backbuffer." and replace with "pBackBuffer->".
- Change CreateSurfaces(CGapiDisplay display, HINSTANCE hInstance) to
CreateSysMemSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance). Do
a local search/replace for "display." and replace with "pDisplay->".
- Change CreateVideoSurfaces(CGapiDisplay display, HINSTANCE hInstance)
to CreateVidMemSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance).
Do a local search/replace for "display." and replace with "pDisplay->".
- CGapiApplication m_display, m_input, m_timer were changed to pointers
- m_pDisplay, m_pInput, m_pTimer. Do a global search/replace for myapplication.cpp.
- CGapiApplication m_backbuffer was removed. Do a global search/replace in myapplication.cpp for "m_backbuffer." and replace with "m_pDisplay->GetBackBuffer()->".
- config.bMinimizeOnLostFocus was removed and a new flag bRegainLostFocus
was added which defaults to FALSE. If you want the old behaviour where
GapiDraw always tries to recapture focus you should set config.bRegainLostFocus
to TRUE.
The above changes are not that many, and will hopefully only affect the
platform-dependent code in myapplication.cpp if you base your game on
CGapiApplication.
Always check the return codes
Question
I try to call CGapiSurface::CreateSurface to load an image from file
but it does not work!
Answer
You should always check the return codes from CreateSurface. If CreateSurface
returns 0xC8660060, this means GDERR_BITMAPNOTFOUND (as listed in GapiDraw.h), indicating
that the bitmap could not be found. You should then probably use a search
path that is relative to your executable file instead of the current path,
which is explained under the heading "Loading images relative
to the executable file location" in the GapiDraw Win32 readme file. All return codes are listed in
the file GapiDraw.h, where 0xC8660060 is defined as GDERR_BITMAPNOTFOUND.

|