Hi,
I am developper on windows ce platform and I have tried to compile it on
windows mobile 5 platform.
Here is my feedback :
When compiling here are the errors I get :
------ Build started: Project: SDL, Configuration: Release Windows
Mobile 5.0 Pocket PC SDK (ARMV4I) ------
Compiling…
SDL_dibevents.c
A - …\src\video\windib\SDL_dibevents.c(279) : warning C4133:
‘function’ : incompatible types - from ‘char [256]’ to 'LPWSTR’
B - …\src\video\windib\SDL_dibevents.c(282) : warning C4133:
‘function’ : incompatible types - from ‘char [9]’ to 'LPCWSTR’
C - …\src\video\windib\SDL_dibevents.c(282) : error C2065:
‘KLF_NOTELLSHELL’ : undeclared identifier
D - …\src\video\windib\SDL_dibevents.c(287) : warning C4133:
‘function’ : incompatible types - from ‘char [256]’ to 'LPCWSTR’
E - …\src\video\windib\SDL_dibevents.c(421) : warning C4013:
‘MapVirtualKeyEx’ undefined; assuming extern returning int
Build log was saved at
"file://d:\Smartdev\SDL-1.2.11\VisualCE\SDL\Windows Mobile 5.0 Pocket PC
SDK (ARMV4I)\Release\BuildLog.htm"
SDL - 1 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
About incompatible types I don’t know how you handle encoding type in SDL.
You have two solutions :
1)First you can declare a macro _T("") and a TCHAR type.
- You can do ANSI->UNICODE / UNICODE->ANSI conversion using
mbcstowcs/wcstombs.
The first solution would be the best solution as it would allow SDL to
be compiled on platform
using UNICODE natively without any loss in performance but it will force
you to make too many changes for now.
If some maintainer could give me his opinion about this topic.
So I will use the second solution for now :
void DIB_InitOSKeymap(_THIS)
{
int i;
char current_layout[256];
#if defined(_WIN32_WCE)
TCHAR wszCurLayout[256];
GetKeyboardLayoutName(wszCurLayout);
::wcstombs( current_layout, wszCurLayout, 256);
//LoadKeyboardLayout is not directly supported
#else
GetKeyboardLayoutName(current_layout);
//printf(“Initial Keyboard Layout Name: ‘%s’\n”, current_layout);
hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL);
if (!hLayoutUS) {
//printf("Failed to load US keyboard layout. Using current.\n");
hLayoutUS = GetKeyboardLayout(0);
}
LoadKeyboardLayout(current_layout, KLF_ACTIVATE);
#endif
…
}
static int SDL_MapVirtualKey(int scancode, int vkey)
{
#if defined(_WIN32_WCE)
int mvke = MapVirtualKey(scancode & 0xFF, 1);
#else
int mvke = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS);
#endif
…
}
After these modifications I had a linker error :
Creating library Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)\Release/SDL.lib and object Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)\Release/SDL.exp
SDL_dibvideo.obj : error LNK2001: unresolved external symbol GetMenu
Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\Release/SDL.dll : fatal error
LNK1120: 1 unresolved externals
GetMenu doesn’t exist on windows ce platforms to my knowledge. You could
use HMENU CommandBar_GetMenu() but
menu on wince are specific. Don’t know if it helps.
I have found someone who has already worked on this subject, don’t know
if you have integrated his work.
Please look here : http://arisme.free.fr/ports/SDL.php