mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 15:11:20 +02:00
first steps for sdl2 ( still many compile errors )
This commit is contained in:
@@ -1539,270 +1539,116 @@ void createDirectoryPaths(string Path) {
|
||||
}
|
||||
|
||||
void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight,bool isFullscreen) {
|
||||
// Get the current video hardware information
|
||||
//const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
//colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
//screenWidth = vidInfo->current_w;
|
||||
//screenHeight = vidInfo->current_h;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
/* Get available fullscreen/hardware modes */
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
|
||||
int flags = 0;
|
||||
|
||||
#else
|
||||
|
||||
int flags = SDL_RESIZABLE;
|
||||
|
||||
#endif
|
||||
if(isFullscreen) flags = SDL_FULLSCREEN;
|
||||
SDL_Rect**modes = SDL_ListModes(NULL, SDL_OPENGL|flags);
|
||||
|
||||
/* Check if there are any modes available */
|
||||
if (modes == (SDL_Rect**)0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] no hardware modes available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
screenWidth = vidInfo->current_w;
|
||||
screenHeight = vidInfo->current_h;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
}
|
||||
/* Check if our resolution is restricted */
|
||||
else if (modes == (SDL_Rect**)-1) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] all resolutions available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
screenWidth = vidInfo->current_w;
|
||||
screenHeight = vidInfo->current_h;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
}
|
||||
else{
|
||||
/* Print valid modes */
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] available Modes are:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
int bestW = -1;
|
||||
int bestH = -1;
|
||||
for(int i=0; modes[i]; ++i) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h);
|
||||
|
||||
if(bestW < modes[i]->w) {
|
||||
bestW = modes[i]->w;
|
||||
bestH = modes[i]->h;
|
||||
}
|
||||
}
|
||||
|
||||
if(bestW > screenWidth) {
|
||||
screenWidth = bestW;
|
||||
screenHeight = bestH;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
}
|
||||
// TTSDL What does this method do ? I have no clue...
|
||||
//
|
||||
// // Get the current video hardware information
|
||||
// //const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
// //colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
// //screenWidth = vidInfo->current_w;
|
||||
// //screenHeight = vidInfo->current_h;
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//
|
||||
// /* Get available fullscreen/hardware modes */
|
||||
//
|
||||
// #if defined(WIN32) || defined(__APPLE__)
|
||||
//
|
||||
// int flags = 0;
|
||||
//
|
||||
// #else
|
||||
//
|
||||
// int flags = SDL_WINDOW_RESIZABLE;
|
||||
//
|
||||
// #endif
|
||||
// if(isFullscreen) flags = SDL_WINDOW_FULLSCREEN;
|
||||
// SDL_Rect**modes = SDL_ListModes(NULL, SDL_OPENGL|flags);
|
||||
//
|
||||
// /* Check if there are any modes available */
|
||||
// if (modes == (SDL_Rect**)0) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] no hardware modes available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//
|
||||
// const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
// colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
// screenWidth = vidInfo->current_w;
|
||||
// screenHeight = vidInfo->current_h;
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
// }
|
||||
// /* Check if our resolution is restricted */
|
||||
// else if (modes == (SDL_Rect**)-1) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] all resolutions available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//
|
||||
// const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
// colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
// screenWidth = vidInfo->current_w;
|
||||
// screenHeight = vidInfo->current_h;
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
// }
|
||||
// else{
|
||||
// /* Print valid modes */
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] available Modes are:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//
|
||||
// int bestW = -1;
|
||||
// int bestH = -1;
|
||||
// for(int i=0; modes[i]; ++i) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h);
|
||||
//
|
||||
// if(bestW < modes[i]->w) {
|
||||
// bestW = modes[i]->w;
|
||||
// bestH = modes[i]->h;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(bestW > screenWidth) {
|
||||
// screenWidth = bestW;
|
||||
// screenHeight = bestH;
|
||||
// }
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] using current resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,screenWidth,screenHeight);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
void getFullscreenVideoModes(vector<ModeInfo> *modeinfos, bool isFullscreen) {
|
||||
// Get the current video hardware information
|
||||
//const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
//colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
//screenWidth = vidInfo->current_w;
|
||||
//screenHeight = vidInfo->current_h;
|
||||
// Get the current video hardware information
|
||||
//const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
//colorBits = vidInfo->vfmt->BitsPerPixel;
|
||||
//screenWidth = vidInfo->current_w;
|
||||
//screenHeight = vidInfo->current_h;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_PixelFormat format;
|
||||
//SDL_Rect **modes;
|
||||
int loops(0);
|
||||
int bpp(0);
|
||||
std::map<std::string,bool> uniqueResList;
|
||||
SDL_PixelFormat format;
|
||||
//SDL_Rect **modes;
|
||||
int loops(0);
|
||||
int bpp(0);
|
||||
std::map<std::string,bool> uniqueResList;
|
||||
|
||||
do
|
||||
{
|
||||
//format.BitsPerPixel seems to get zeroed out on my windows box
|
||||
switch(loops)
|
||||
{
|
||||
case 0://32 bpp
|
||||
format.BitsPerPixel = 32;
|
||||
bpp = 32;
|
||||
break;
|
||||
case 1://24 bpp
|
||||
format.BitsPerPixel = 24;
|
||||
bpp = 24;
|
||||
break;
|
||||
case 2://16 bpp
|
||||
format.BitsPerPixel = 16;
|
||||
bpp = 16;
|
||||
break;
|
||||
// case 3://8 bpp
|
||||
// format.BitsPerPixel = 8;
|
||||
// bpp = 8;
|
||||
// break;
|
||||
///////////////////////////
|
||||
vector<pair<int,int> > allResoltuions;
|
||||
SDL_DisplayMode mode = {SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0};
|
||||
int max=SDL_GetNumDisplayModes(0);
|
||||
for (int i = 0; i < max; ++i) {
|
||||
if(0==SDL_GetDisplayMode(0,i,&mode)) {
|
||||
int bpp;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
SDL_PixelFormatEnumToMasks(mode.format,&bpp,&Rmask,&Gmask,&Bmask,&Amask);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",allResoltuions[i].first, allResoltuions[i].second,bpp);
|
||||
string lookupKey = intToStr(mode.w) + "_" + intToStr(mode.h) + "_" + intToStr(bpp);
|
||||
if(uniqueResList.find(lookupKey) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey] = true;
|
||||
modeinfos->push_back(ModeInfo(mode.w,mode.h,bpp));
|
||||
}
|
||||
}
|
||||
|
||||
/* Get available fullscreen/hardware modes */
|
||||
//SDL_Rect**modes = SDL_ListModes(NULL, SDL_OPENGL|SDL_RESIZABLE);
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
|
||||
int flags = 0;
|
||||
|
||||
#else
|
||||
|
||||
int flags = SDL_RESIZABLE;
|
||||
|
||||
#endif
|
||||
if(isFullscreen) flags = SDL_FULLSCREEN;
|
||||
SDL_Rect**modes = SDL_ListModes(&format, SDL_OPENGL|flags);
|
||||
|
||||
/* Check if there are any modes available */
|
||||
if (modes == (SDL_Rect**)0) {
|
||||
//printf("NO resolutions are usable for format = %d\n",format.BitsPerPixel);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] no hardware modes available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
string lookupKey = intToStr(vidInfo->current_w) + "_" + intToStr(vidInfo->current_h) + "_" + intToStr(vidInfo->vfmt->BitsPerPixel);
|
||||
if(uniqueResList.find(lookupKey) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey] = true;
|
||||
modeinfos->push_back(ModeInfo(vidInfo->current_w,vidInfo->current_h,vidInfo->vfmt->BitsPerPixel));
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding only current resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,vidInfo->current_w,vidInfo->current_h,vidInfo->vfmt->BitsPerPixel);
|
||||
}
|
||||
/* Check if our resolution is restricted */
|
||||
else if (modes == (SDL_Rect**)-1) {
|
||||
//printf("ALL resolutions are usable for format = %d\n",format.BitsPerPixel);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] all resolutions available.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo();
|
||||
string lookupKey = intToStr(vidInfo->current_w) + "_" + intToStr(vidInfo->current_h) + "_" + intToStr(vidInfo->vfmt->BitsPerPixel);
|
||||
if(uniqueResList.find(lookupKey) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey] = true;
|
||||
modeinfos->push_back(ModeInfo(vidInfo->current_w,vidInfo->current_h,vidInfo->vfmt->BitsPerPixel));
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding only current resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,vidInfo->current_w,vidInfo->current_h,vidInfo->vfmt->BitsPerPixel);
|
||||
|
||||
// Lets add these resolutions since sdl said all are supported
|
||||
/*
|
||||
240x160 4:3 GameboyAdvanced
|
||||
256x192 4:3 NintendoDS
|
||||
320x240 4:3 GP2x
|
||||
480x272 ~16:9 PSP
|
||||
480x320 3:2 iPhone
|
||||
640x480 4:3 numerous PDA use this resolution
|
||||
800x480 5:3 ASUS Eee PC, Nokia N800
|
||||
1024x600 ~16:9 ASUS Eee PC 1000
|
||||
1024x768 4:3 common LCD format
|
||||
1200x900 4:3 OLPC
|
||||
1280x1024 5:4 common LCD format
|
||||
1440x900 16:10 common LCD format
|
||||
1680x1050 16:10 common LCD format
|
||||
1600x1200 4:3 common LCD format
|
||||
1366x768 ~16:9 common resolution of HD-TVs, even so its not actually an official HD-TV resolution
|
||||
1368x768 ~16:9 common resolution of HD-TVs, even so its not actually an official HD-TV resolution
|
||||
1920x1200 16:10 common LCD format
|
||||
2560x1600 16:10 30" LCD
|
||||
1280x720 16:9 HD-TV (720p)
|
||||
1920x1080 16:9 HD-TV (1080p)
|
||||
2560x1440 16:9 Apple iMac
|
||||
2560x1600 16:10 Largest Available Consumer Monitor
|
||||
*/
|
||||
|
||||
vector<pair<int,int> > allResoltuions;
|
||||
if(SDL_VideoModeOK(640, 480, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(640, 480));
|
||||
}
|
||||
if(SDL_VideoModeOK(800, 480, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(800, 480));
|
||||
}
|
||||
if(SDL_VideoModeOK(800, 600, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(800, 600));
|
||||
}
|
||||
if(SDL_VideoModeOK(1024, 600, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1024, 600));
|
||||
}
|
||||
if(SDL_VideoModeOK(1024, 768, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1024, 768));
|
||||
}
|
||||
if(SDL_VideoModeOK(1280, 720, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1280, 720));
|
||||
}
|
||||
if(SDL_VideoModeOK(1200, 900, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1200, 900));
|
||||
}
|
||||
if(SDL_VideoModeOK(1280, 1024, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1280, 1024));
|
||||
}
|
||||
if(SDL_VideoModeOK(1440, 900, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1440, 900));
|
||||
}
|
||||
if(SDL_VideoModeOK(1680, 1050, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1680, 1050));
|
||||
}
|
||||
if(SDL_VideoModeOK(1600, 1200, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1600, 1200));
|
||||
}
|
||||
if(SDL_VideoModeOK(1366, 768, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1366, 768));
|
||||
}
|
||||
if(SDL_VideoModeOK(1920, 1080, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1920, 1080));
|
||||
}
|
||||
if(SDL_VideoModeOK(1920, 1200, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(1920, 1200));
|
||||
}
|
||||
if(SDL_VideoModeOK(2560, 1600, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(2560, 1600));
|
||||
}
|
||||
if(SDL_VideoModeOK(2560, 1440, bpp, SDL_OPENGL|flags) == bpp) {
|
||||
allResoltuions.push_back(make_pair(2560, 1440));
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i < allResoltuions.size(); ++i) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",allResoltuions[i].first, allResoltuions[i].second,bpp);
|
||||
string lookupKey = intToStr(allResoltuions[i].first) + "_" + intToStr(allResoltuions[i].second) + "_" + intToStr(bpp);
|
||||
if(uniqueResList.find(lookupKey) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey] = true;
|
||||
modeinfos->push_back(ModeInfo(allResoltuions[i].first, allResoltuions[i].second,bpp));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,allResoltuions[i].first, allResoltuions[i].second,bpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//printf("SOME resolutions are usable for format = %d\n",format.BitsPerPixel);
|
||||
|
||||
/* Print valid modes */
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] available Modes are:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
for(int i=0; modes[i]; ++i) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h,bpp);
|
||||
string lookupKey = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(bpp);
|
||||
if(uniqueResList.find(lookupKey) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey] = true;
|
||||
modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,bpp));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h,bpp);
|
||||
}
|
||||
// fake the missing 16 bit resolutions
|
||||
string lookupKey16 = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(16);
|
||||
if(uniqueResList.find(lookupKey16) == uniqueResList.end()) {
|
||||
uniqueResList[lookupKey16] = true;
|
||||
modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,16));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h,16);
|
||||
}
|
||||
}
|
||||
}
|
||||
//} while(++loops != 4);
|
||||
} while(++loops != 3);
|
||||
|
||||
std::sort(modeinfos->begin(),modeinfos->end());
|
||||
}
|
||||
}
|
||||
//////////////////////////////////
|
||||
std::sort(modeinfos->begin(),modeinfos->end());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1810,22 +1656,21 @@ void changeVideoModeFullScreen(bool value) {
|
||||
Private::shouldBeFullscreen = value;
|
||||
}
|
||||
|
||||
void restoreVideoMode(bool exitingApp) {
|
||||
void restoreVideoMode(SDL_Window *sdlWindow,bool exitingApp) {
|
||||
//SDL_Quit();
|
||||
if(exitingApp == true && SDL_WasInit(SDL_INIT_VIDEO)) {
|
||||
SDL_ShowCursor(1);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
SDL_SetGamma(1, 1, 1);
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_SetWindowBrightness(sdlWindow, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
int getScreenW() {
|
||||
return SDL_GetVideoSurface()->w;
|
||||
}
|
||||
|
||||
int getScreenH() {
|
||||
return SDL_GetVideoSurface()->h;
|
||||
}
|
||||
//int getScreenW() {
|
||||
// return SDL_GetVideoSurface()->w; //SDL_GetWindowSurface()
|
||||
//}
|
||||
//
|
||||
//int getScreenH() {
|
||||
// return SDL_GetVideoSurface()->h;
|
||||
//}
|
||||
|
||||
void sleep(int millis) {
|
||||
SDL_Delay(millis);
|
||||
@@ -1845,7 +1690,7 @@ void showCursor(bool b) {
|
||||
}
|
||||
|
||||
//bool isKeyDown(SDLKey key) {
|
||||
// const Uint8* keystate = SDL_GetKeyState(0);
|
||||
// const Uint8* keystate = SDL_GetKeyboardState(0);
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
|
||||
//
|
||||
@@ -1861,7 +1706,7 @@ void showCursor(bool b) {
|
||||
|
||||
bool isKeyDown(int virtualKey) {
|
||||
char key = static_cast<char> (virtualKey);
|
||||
const Uint8* keystate = SDL_GetKeyState(0);
|
||||
const Uint8* keystate = SDL_GetKeyboardState(0);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
|
||||
|
||||
@@ -1871,36 +1716,36 @@ bool isKeyDown(int virtualKey) {
|
||||
return (keystate[(unsigned char)key] != 0);
|
||||
}
|
||||
switch(key) {
|
||||
case vkAdd:
|
||||
return (keystate[SDLK_PLUS] != 0 || keystate[SDLK_KP_PLUS] != 0);
|
||||
//SDLTT case vkAdd:
|
||||
// return (keystate[SDL_SCANCODE_PLUS] != 0 || keystate[SDL_SCANCODE_KP_PLUS] != 0);
|
||||
case vkSubtract:
|
||||
return (keystate[SDLK_MINUS] != 0 || keystate[SDLK_KP_MINUS] != 0);
|
||||
return (keystate[SDL_SCANCODE_MINUS] != 0 || keystate[SDL_SCANCODE_KP_MINUS] != 0);
|
||||
case vkAlt:
|
||||
return (keystate[SDLK_LALT] != 0 || keystate[SDLK_RALT] != 0);
|
||||
return (keystate[SDL_SCANCODE_LALT] != 0 || keystate[SDL_SCANCODE_RALT] != 0);
|
||||
case vkControl:
|
||||
return (keystate[SDLK_LCTRL] != 0 || keystate[SDLK_RCTRL] != 0);
|
||||
return (keystate[SDL_SCANCODE_LCTRL] != 0 || keystate[SDL_SCANCODE_RCTRL] != 0);
|
||||
case vkShift:
|
||||
return (keystate[SDLK_LSHIFT] != 0 || keystate[SDLK_RSHIFT] != 0);
|
||||
return (keystate[SDL_SCANCODE_LSHIFT] != 0 || keystate[SDL_SCANCODE_RSHIFT] != 0);
|
||||
case vkEscape:
|
||||
return (keystate[SDLK_ESCAPE] != 0);
|
||||
return (keystate[SDL_SCANCODE_ESCAPE] != 0);
|
||||
case vkUp:
|
||||
return (keystate[SDLK_UP] != 0);
|
||||
return (keystate[SDL_SCANCODE_UP] != 0);
|
||||
case vkLeft:
|
||||
return (keystate[SDLK_LEFT] != 0);
|
||||
return (keystate[SDL_SCANCODE_LEFT] != 0);
|
||||
case vkRight:
|
||||
return (keystate[SDLK_RIGHT] != 0);
|
||||
return (keystate[SDL_SCANCODE_RIGHT] != 0);
|
||||
case vkDown:
|
||||
return (keystate[SDLK_DOWN] != 0);
|
||||
return (keystate[SDL_SCANCODE_DOWN] != 0);
|
||||
case vkReturn:
|
||||
return (keystate[SDLK_RETURN] != 0 || keystate[SDLK_KP_ENTER] != 0);
|
||||
return (keystate[SDL_SCANCODE_RETURN] != 0 || keystate[SDL_SCANCODE_KP_ENTER] != 0);
|
||||
case vkBack:
|
||||
return (keystate[SDLK_BACKSPACE] != 0);
|
||||
return (keystate[SDL_SCANCODE_BACKSPACE] != 0);
|
||||
case vkDelete:
|
||||
return (keystate[SDLK_DELETE] != 0);
|
||||
return (keystate[SDL_SCANCODE_DELETE] != 0);
|
||||
case vkPrint:
|
||||
return (keystate[SDLK_PRINT] != 0);
|
||||
return (keystate[SDL_SCANCODE_PRINTSCREEN] != 0);
|
||||
case vkPause:
|
||||
return (keystate[SDLK_PAUSE] != 0);
|
||||
return (keystate[SDL_SCANCODE_PAUSE] != 0);
|
||||
default:
|
||||
std::cerr << "isKeyDown called with unknown key.\n";
|
||||
break;
|
||||
|
@@ -73,9 +73,9 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
|
||||
|
||||
//printf("In [%s::%s %d] PlatformCommon::Private::shouldBeFullscreen = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,PlatformCommon::Private::shouldBeFullscreen);
|
||||
|
||||
int flags = SDL_OPENGL;
|
||||
int flags = SDL_WINDOW_OPENGL;
|
||||
if(PlatformCommon::Private::shouldBeFullscreen) {
|
||||
flags |= SDL_FULLSCREEN;
|
||||
flags |= SDL_WINDOW_FULLSCREEN;
|
||||
Window::setIsFullScreen(true);
|
||||
}
|
||||
else {
|
||||
@@ -93,13 +93,18 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,resW,resH,colorBits);
|
||||
|
||||
if(screen != NULL) {
|
||||
SDL_FreeSurface(screen);
|
||||
SDL_FreeSurface(SDL_GetWindowSurface(screen));
|
||||
screen = NULL;
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
screen = SDL_SetVideoMode(resW, resH, colorBits, flags);
|
||||
//screen = SDL_CreateWindow(resW, resH, colorBits, flags);
|
||||
screen = SDL_CreateWindow("MG",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
resW, resH, flags);
|
||||
|
||||
if(screen == 0) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -112,51 +117,37 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
|
||||
for(int i = 32; i >= 8; i-=8) {
|
||||
// try different color bits
|
||||
screen = SDL_SetVideoMode(resW, resH, i, flags);
|
||||
if(screen != 0) {
|
||||
glViewport( 0, 0, resW, resH ) ;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
//screen = SDL_SetVideoMode(resW, resH, i, flags);
|
||||
screen = SDL_CreateWindow("MG",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
resW, resH, flags);
|
||||
|
||||
if(screen == 0) {
|
||||
for(int i = 32; i >= 8; i-=8) {
|
||||
// try to revert to 800x600
|
||||
screen = SDL_SetVideoMode(800, 600, i, flags);
|
||||
if(screen != 0) {
|
||||
resW = 800;
|
||||
resH = 600;
|
||||
|
||||
glViewport( 0, 0, resW, resH ) ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// try to switch to native desktop resolution
|
||||
screen = SDL_CreateWindow("MG",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
0, 0,
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP|flags);
|
||||
}
|
||||
if(screen == 0) {
|
||||
for(int i = 32; i >= 8; i-=8) {
|
||||
// try to revert to 640x480
|
||||
screen = SDL_SetVideoMode(640, 480, i, flags);
|
||||
if(screen != 0) {
|
||||
resW = 640;
|
||||
resH = 480;
|
||||
|
||||
glViewport( 0, 0, resW, resH ) ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// try to revert to 640x480
|
||||
screen = SDL_CreateWindow("MG",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
650, 480,
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
}
|
||||
|
||||
if(screen == 0) {
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
glViewport( 0, 0, resW, resH ) ;
|
||||
//printf("Reset resolution to [%d] x [%d]\n",resW, resH);
|
||||
}
|
||||
|
||||
int h;
|
||||
int w;
|
||||
SDL_GetWindowSize(screen, &w, &h);
|
||||
glViewport( 0, 0, w, h ) ;
|
||||
|
||||
#ifndef WIN32
|
||||
string mg_icon_file = "";
|
||||
@@ -224,18 +215,19 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
|
||||
|
||||
//uint32 colorkey = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
//SDL_SetColorKey(icon, SDL_SRCCOLORKEY, colorkey);
|
||||
if(SDL_SetColorKey(icon, SDL_SRCCOLORKEY, SDL_MapRGB(icon->format, 255, 0, 255))) {
|
||||
if(SDL_SetColorKey(icon, SDL_TRUE, SDL_MapRGB(icon->format, 255, 0, 255))) {
|
||||
printf("Icon Load Error #2: %s\n", SDL_GetError());
|
||||
}
|
||||
else {
|
||||
SDL_WM_SetIcon(icon, NULL);
|
||||
SDL_SetWindowIcon(screen,icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d] BEFORE glewInit call\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -265,13 +257,15 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,
|
||||
if(gammaValue != 0.0) {
|
||||
//printf("Attempting to call SDL_SetGamma using value %f\n", gammaValue);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if (SDL_SetGamma(gammaValue, gammaValue, gammaValue) < 0) {
|
||||
printf("WARNING, SDL_SetGamma failed using value %f [%s]\n", gammaValue,SDL_GetError());
|
||||
if (SDL_SetWindowBrightness(screen, gammaValue) < 0) {
|
||||
printf("WARNING, SDL_SetWindowBrightness failed using value %f [%s]\n", gammaValue,SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
// SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
// SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +284,7 @@ void PlatformContextGl::end() {
|
||||
if(screen != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_FreeSurface(screen);
|
||||
SDL_DestroyWindow(screen);
|
||||
screen = NULL;
|
||||
}
|
||||
|
||||
@@ -302,7 +296,7 @@ void PlatformContextGl::makeCurrent() {
|
||||
|
||||
void PlatformContextGl::swapBuffers() {
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapWindow(screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -79,7 +79,8 @@ static HWND GetSDLWindow()
|
||||
|
||||
#endif
|
||||
|
||||
Window::Window() {
|
||||
Window::Window(SDL_Window *sdlWindow) {
|
||||
this->sdlWindow=sdlWindow;
|
||||
// Default to 1x1 until set by caller to avoid divide by 0
|
||||
this->w = 1;
|
||||
this->h = 1;
|
||||
@@ -157,9 +158,7 @@ bool Window::handleEvent() {
|
||||
codeLocation = "f";
|
||||
|
||||
if(global_window) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
global_window->handleMouseDown(event);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP: {
|
||||
@@ -174,6 +173,14 @@ bool Window::handleEvent() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEWHEEL: {
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
codeLocation = "g2";
|
||||
if(global_window) {
|
||||
global_window->handleMouseWheel(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEMOTION: {
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//MouseState ms;
|
||||
@@ -207,8 +214,8 @@ bool Window::handleEvent() {
|
||||
keystate = event.key.keysym;
|
||||
|
||||
string keyName = SDL_GetKeyName(event.key.keysym.sym);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] unicode [%d - %c] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.scancode,keyName.c_str());
|
||||
|
||||
/* handle ALT+Return */
|
||||
if((keyName == "return" || keyName == "enter")
|
||||
@@ -255,7 +262,7 @@ bool Window::handleEvent() {
|
||||
|
||||
keystate = event.key.keysym;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] scancode [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.scancode);
|
||||
|
||||
if(global_window) {
|
||||
//char key = getKey(event.key.keysym,true);
|
||||
@@ -266,15 +273,15 @@ bool Window::handleEvent() {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYUP ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
case SDL_WINDOWEVENT:
|
||||
{
|
||||
// codeLocation = "k";
|
||||
codeLocation = "k";
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
//
|
||||
// // Check if the program has lost window focus
|
||||
// if ((event.active.state & SDL_APPACTIVE) == SDL_APPACTIVE) {
|
||||
// if ((event.active.state & (SDL_APPACTIVE | SDL_APPINPUTFOCUS))) {
|
||||
// if (event.active.gain == 0) {
|
||||
// Window::isActive = false;
|
||||
// }
|
||||
@@ -289,47 +296,7 @@ bool Window::handleEvent() {
|
||||
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
// showCursor(willShowCursor);
|
||||
// }
|
||||
// // Check if the program has lost window focus
|
||||
// if ((event.active.state & SDL_APPMOUSEFOCUS) != SDL_APPMOUSEFOCUS &&
|
||||
// (event.active.state & SDL_APPINPUTFOCUS) != SDL_APPINPUTFOCUS &&
|
||||
// (event.active.state & SDL_APPACTIVE) != SDL_APPACTIVE) {
|
||||
// if (event.active.gain == 0) {
|
||||
// Window::isActive = false;
|
||||
// }
|
||||
// //else if (event.active.gain == 1) {
|
||||
// else {
|
||||
// Window::isActive = true;
|
||||
// }
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
// showCursor(willShowCursor);
|
||||
// }
|
||||
// }
|
||||
|
||||
codeLocation = "k";
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
|
||||
// Check if the program has lost window focus
|
||||
if ((event.active.state & (SDL_APPACTIVE | SDL_APPINPUTFOCUS))) {
|
||||
if (event.active.gain == 0) {
|
||||
Window::isActive = false;
|
||||
}
|
||||
else {
|
||||
Window::isActive = true;
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
}
|
||||
showCursor(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -357,8 +324,8 @@ bool Window::handleEvent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Window::revertMousePos() {
|
||||
SDL_WarpMouse(oldX, oldY);
|
||||
void Window::revertMousePos(SDL_Window *sdlwindow) {
|
||||
SDL_WarpMouseInWindow( sdlwindow,oldX, oldY);
|
||||
}
|
||||
|
||||
Vec2i Window::getOldMousePos() {
|
||||
@@ -366,8 +333,9 @@ Vec2i Window::getOldMousePos() {
|
||||
}
|
||||
|
||||
string Window::getText() {
|
||||
char* c = 0;
|
||||
SDL_WM_GetCaption(&c, 0);
|
||||
const char* c = 0;
|
||||
//SDL_WM_GetCaption(&c, 0);
|
||||
c=SDL_GetWindowTitle(sdlWindow);
|
||||
|
||||
return string(c);
|
||||
}
|
||||
@@ -378,7 +346,8 @@ float Window::getAspect() {
|
||||
|
||||
void Window::setText(string text) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_WM_SetCaption(text.c_str(), 0);
|
||||
//SDL_WM_SetCaption(text.c_str(), 0);
|
||||
SDL_SetWindowTitle(sdlWindow,text.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
@@ -471,7 +440,8 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||
#ifdef SDL_GL_SWAP_CONTROL
|
||||
if(Window::tryVSynch == true) {
|
||||
/* we want vsync for smooth scrolling */
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
||||
//SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -488,146 +458,52 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||
}
|
||||
}
|
||||
|
||||
void Window::toggleFullscreen() {
|
||||
void Window::toggleFullscreen(SDL_Window *sdlwindow) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
Window::isFullScreen = !Window::isFullScreen;
|
||||
#ifdef WIN32
|
||||
/* -- Portable Fullscreen Toggling --
|
||||
As of SDL 1.2.10, if width and height are both 0, SDL_SetVideoMode will use the
|
||||
width and height of the current video mode (or the desktop mode, if no mode has been set).
|
||||
Use 0 for Height, Width, and Color Depth to keep the current values. */
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(Window::allowAltEnterFullscreenToggle == true) {
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||
if(cur_surface != NULL) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
Window::isFullScreen = !((cur_surface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||
//SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||
if(sdlwindow != NULL) {
|
||||
if(isFullScreen){
|
||||
SDL_SetWindowFullscreen(sdlwindow,SDL_WINDOW_FULLSCREEN);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_Surface *sf = SDL_GetVideoSurface();
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_Surface **surface = &sf;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
uint32 *flags = NULL;
|
||||
//void *pixels = NULL;
|
||||
//SDL_Color *palette = NULL;
|
||||
SDL_Rect clip;
|
||||
//int ncolors = 0;
|
||||
Uint32 tmpflags = 0;
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
int bpp = 0;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if ( (!surface) || (!(*surface)) ) // don't bother if there's no surface.
|
||||
return;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
tmpflags = (*surface)->flags;
|
||||
w = (*surface)->w;
|
||||
h = (*surface)->h;
|
||||
bpp = (*surface)->format->BitsPerPixel;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,w,h,bpp);
|
||||
|
||||
if (flags == NULL) // use the surface's flags.
|
||||
flags = &tmpflags;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
//
|
||||
if ( *flags & SDL_FULLSCREEN )
|
||||
*flags &= ~SDL_FULLSCREEN;
|
||||
//
|
||||
else
|
||||
*flags |= SDL_FULLSCREEN;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_GetClipRect(*surface, &clip);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
*surface = SDL_SetVideoMode(w, h, bpp, (*flags));
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if (*surface == NULL) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
*surface = SDL_SetVideoMode(w, h, bpp, tmpflags);
|
||||
} // if
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_SetClipRect(*surface, &clip);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
HWND handle = GetSDLWindow();
|
||||
if(Window::isFullScreen == true) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle);
|
||||
ShowWindow(handle, SW_MAXIMIZE);
|
||||
//if(Window::getUseDefaultCursorOnly() == false) {
|
||||
// showCursor(false);
|
||||
//}
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle);
|
||||
ShowWindow(handle, SW_RESTORE);
|
||||
//showCursor(true);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
#else
|
||||
if(Window::allowAltEnterFullscreenToggle == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||
if(cur_surface != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_WM_ToggleFullScreen(cur_surface);
|
||||
else {
|
||||
SDL_SetWindowFullscreen(sdlwindow,0);
|
||||
}
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
void Window::handleMouseWheel(SDL_Event event) {
|
||||
int x;
|
||||
int y;
|
||||
|
||||
if (event.type != SDL_MOUSEWHEEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_GetMouseState(&x, &y);
|
||||
|
||||
// // windows implementation uses 120 for the resolution of a standard mouse
|
||||
// // wheel notch. However, newer mice have finer resolutions. I dunno if SDL
|
||||
// // handles those, but for now we're going to say that each mouse wheel
|
||||
// // movement is 120.
|
||||
eventMouseWheel(x, y, event.wheel.y * 120);
|
||||
return;
|
||||
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
}
|
||||
|
||||
void Window::handleMouseDown(SDL_Event event) {
|
||||
static const Uint32 DOUBLECLICKTIME = 500;
|
||||
|
||||
@@ -635,24 +511,6 @@ void Window::handleMouseDown(SDL_Event event) {
|
||||
|
||||
MouseButton button = getMouseButton(event.button.button);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
// windows implementation uses 120 for the resolution of a standard mouse
|
||||
// wheel notch. However, newer mice have finer resolutions. I dunno if SDL
|
||||
// handles those, but for now we're going to say that each mouse wheel
|
||||
// movement is 120.
|
||||
if(button == mbWheelUp) {
|
||||
//printf("button == mbWheelUp\n");
|
||||
eventMouseWheel(event.button.x, event.button.y, 120);
|
||||
return;
|
||||
} else if(button == mbWheelDown) {
|
||||
//printf("button == mbWheelDown\n");
|
||||
eventMouseWheel(event.button.x, event.button.y, -120);
|
||||
return;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
Uint32 ticks = SDL_GetTicks();
|
||||
int n = (int) button;
|
||||
|
||||
@@ -692,10 +550,6 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
||||
return mbRight;
|
||||
case SDL_BUTTON_MIDDLE:
|
||||
return mbCenter;
|
||||
case SDL_BUTTON_WHEELUP:
|
||||
return mbWheelUp;
|
||||
case SDL_BUTTON_WHEELDOWN:
|
||||
return mbWheelDown;
|
||||
default:
|
||||
//throw std::runtime_error("Mouse Button > 3 not handled.");
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sdlButton);
|
||||
@@ -792,74 +646,86 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
||||
bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,vector<int> modifiersToCheck) {
|
||||
Uint16 c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(input.keysym.unicode > 0) {
|
||||
string unicodeKeyName = SDL_GetKeyName((SDLKey)input.keysym.unicode);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
|
||||
// When modifiers are pressed the unicode result is wrong
|
||||
// example CTRL-3 will give the ESCAPE vslue 27 in unicode
|
||||
if( !(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) &&
|
||||
!(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) &&
|
||||
!(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) ) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
//c = toupper(c);
|
||||
}
|
||||
else if((input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) &&
|
||||
(input.keysym.unicode == SDLK_QUESTION ||
|
||||
input.keysym.unicode == SDLK_AT ||
|
||||
input.keysym.unicode == SDLK_COLON ||
|
||||
input.keysym.unicode == SDLK_LESS ||
|
||||
input.keysym.unicode == SDLK_GREATER ||
|
||||
input.keysym.unicode == SDLK_CARET ||
|
||||
input.keysym.unicode == SDLK_UNDERSCORE ||
|
||||
input.keysym.unicode == SDLK_BACKQUOTE ||
|
||||
input.keysym.unicode == SDLK_EXCLAIM ||
|
||||
input.keysym.unicode == SDLK_QUOTEDBL ||
|
||||
input.keysym.unicode == SDLK_HASH ||
|
||||
input.keysym.unicode == SDLK_DOLLAR ||
|
||||
input.keysym.unicode == SDLK_AMPERSAND ||
|
||||
input.keysym.unicode == SDLK_QUOTE ||
|
||||
input.keysym.unicode == SDLK_LEFTPAREN ||
|
||||
input.keysym.unicode == SDLK_RIGHTPAREN ||
|
||||
input.keysym.unicode == SDLK_ASTERISK ||
|
||||
input.keysym.unicode == SDLK_KP_MULTIPLY ||
|
||||
input.keysym.unicode == SDLK_PLUS ||
|
||||
input.keysym.unicode == SDLK_COMMA ||
|
||||
input.keysym.unicode == SDLK_MINUS ||
|
||||
input.keysym.unicode == SDLK_PERIOD ||
|
||||
input.keysym.unicode == SDLK_SLASH ||
|
||||
// Need to allow Shift + # key for AZERTY style keyboards
|
||||
(input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9))) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
}
|
||||
else if(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if( (input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9) ||
|
||||
(input.keysym.unicode >= SDLK_KP0 && input.keysym.unicode <= SDLK_KP9)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
}
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
}
|
||||
//if(c == 0) {
|
||||
if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
if(input.keysym.sym > 0) {
|
||||
c = input.keysym.sym;
|
||||
}
|
||||
//// string unicodeKeyName = SDL_GetKeyName((SDLKey)input.keysym.unicode);
|
||||
////
|
||||
//// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
//// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
//
|
||||
// // When modifiers are pressed the unicode result is wrong
|
||||
// // example CTRL-3 will give the ESCAPE vslue 27 in unicode
|
||||
// if( !(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) &&
|
||||
// !(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) &&
|
||||
// !(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) ) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//
|
||||
// c = input.keysym.sym;
|
||||
// //c = toupper(c);
|
||||
// }
|
||||
// else if((input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) &&
|
||||
// (input.keysym.sym == SDLK_QUESTION ||
|
||||
// input.keysym.sym == SDLK_AT ||
|
||||
// input.keysym.sym == SDLK_COLON ||
|
||||
// input.keysym.sym == SDLK_LESS ||
|
||||
// input.keysym.sym == SDLK_GREATER ||
|
||||
// input.keysym.sym == SDLK_CARET ||
|
||||
// input.keysym.sym == SDLK_UNDERSCORE ||
|
||||
// input.keysym.sym == SDLK_BACKQUOTE ||
|
||||
// input.keysym.sym == SDLK_EXCLAIM ||
|
||||
// input.keysym.sym == SDLK_QUOTEDBL ||
|
||||
// input.keysym.sym == SDLK_HASH ||
|
||||
// input.keysym.sym == SDLK_DOLLAR ||
|
||||
// input.keysym.sym == SDLK_AMPERSAND ||
|
||||
// input.keysym.sym == SDLK_QUOTE ||
|
||||
// input.keysym.sym == SDLK_LEFTPAREN ||
|
||||
// input.keysym.sym == SDLK_RIGHTPAREN ||
|
||||
// input.keysym.sym == SDLK_ASTERISK ||
|
||||
// input.keysym.sym == SDLK_KP_MULTIPLY ||
|
||||
// input.keysym.sym == SDLK_PLUS ||
|
||||
// input.keysym.sym == SDLK_COMMA ||
|
||||
// input.keysym.sym == SDLK_MINUS ||
|
||||
// input.keysym.sym == SDLK_PERIOD ||
|
||||
// input.keysym.sym == SDLK_SLASH ||
|
||||
// // Need to allow Shift + # key for AZERTY style keyboards
|
||||
// input.keysym.sym == SDLK_0 ||
|
||||
// input.keysym.sym == SDLK_1 ||
|
||||
// input.keysym.sym == SDLK_2 ||
|
||||
// input.keysym.sym == SDLK_3 ||
|
||||
// input.keysym.sym == SDLK_4 ||
|
||||
// input.keysym.sym == SDLK_5 ||
|
||||
// input.keysym.sym == SDLK_6 ||
|
||||
// input.keysym.sym == SDLK_7 ||
|
||||
// input.keysym.sym == SDLK_8 ||
|
||||
// input.keysym.sym == SDLK_9
|
||||
// )) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//
|
||||
// c = input.keysym.sym;
|
||||
// }
|
||||
// else if(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//
|
||||
// if( (input.keysym.sym >= SDLK_0 && input.keysym.sym <= SDLK_9) ||
|
||||
// (input.keysym.sym >= SDLK_KP_0 && input.keysym.sym <= SDLK_KP_9)) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//
|
||||
// c = input.keysym.sym;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
// }
|
||||
// //if(c == 0) {
|
||||
// if(c <= SDLK_UNKNOWN.sym || c >= SDLK_LAST.sym) {
|
||||
// c = input.keysym.sym;
|
||||
// }
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
@@ -896,67 +762,67 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,vector<int> modifie
|
||||
else if( compareKey >= SDLK_0 && compareKey <= SDLK_9) {
|
||||
switch(compareKey) {
|
||||
case SDLK_0:
|
||||
result = (c == SDLK_KP0);
|
||||
result = (c == SDLK_KP_0);
|
||||
break;
|
||||
case SDLK_1:
|
||||
result = (c == SDLK_KP1);
|
||||
result = (c == SDLK_KP_1);
|
||||
break;
|
||||
case SDLK_2:
|
||||
result = (c == SDLK_KP2);
|
||||
result = (c == SDLK_KP_2);
|
||||
break;
|
||||
case SDLK_3:
|
||||
result = (c == SDLK_KP3);
|
||||
result = (c == SDLK_KP_3);
|
||||
break;
|
||||
case SDLK_4:
|
||||
result = (c == SDLK_KP4);
|
||||
result = (c == SDLK_KP_4);
|
||||
break;
|
||||
case SDLK_5:
|
||||
result = (c == SDLK_KP5);
|
||||
result = (c == SDLK_KP_5);
|
||||
break;
|
||||
case SDLK_6:
|
||||
result = (c == SDLK_KP6);
|
||||
result = (c == SDLK_KP_6);
|
||||
break;
|
||||
case SDLK_7:
|
||||
result = (c == SDLK_KP7);
|
||||
result = (c == SDLK_KP_7);
|
||||
break;
|
||||
case SDLK_8:
|
||||
result = (c == SDLK_KP8);
|
||||
result = (c == SDLK_KP_8);
|
||||
break;
|
||||
case SDLK_9:
|
||||
result = (c == SDLK_KP9);
|
||||
result = (c == SDLK_KP_9);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(compareKey >= SDLK_KP0 && compareKey <= SDLK_KP9) {
|
||||
else if(compareKey >= SDLK_KP_0 && compareKey <= SDLK_KP_9) {
|
||||
switch(compareKey) {
|
||||
case SDLK_KP0:
|
||||
case SDLK_KP_0:
|
||||
result = (c == SDLK_0);
|
||||
break;
|
||||
case SDLK_KP1:
|
||||
case SDLK_KP_1:
|
||||
result = (c == SDLK_1);
|
||||
break;
|
||||
case SDLK_KP2:
|
||||
case SDLK_KP_2:
|
||||
result = (c == SDLK_2);
|
||||
break;
|
||||
case SDLK_KP3:
|
||||
case SDLK_KP_3:
|
||||
result = (c == SDLK_3);
|
||||
break;
|
||||
case SDLK_KP4:
|
||||
case SDLK_KP_4:
|
||||
result = (c == SDLK_4);
|
||||
break;
|
||||
case SDLK_KP5:
|
||||
case SDLK_KP_5:
|
||||
result = (c == SDLK_5);
|
||||
break;
|
||||
case SDLK_KP6:
|
||||
case SDLK_KP_6:
|
||||
result = (c == SDLK_6);
|
||||
break;
|
||||
case SDLK_KP7:
|
||||
case SDLK_KP_7:
|
||||
result = (c == SDLK_7);
|
||||
break;
|
||||
case SDLK_KP8:
|
||||
case SDLK_KP_8:
|
||||
result = (c == SDLK_8);
|
||||
break;
|
||||
case SDLK_KP9:
|
||||
case SDLK_KP_9:
|
||||
result = (c == SDLK_9);
|
||||
break;
|
||||
}
|
||||
@@ -991,10 +857,10 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,vector<int> modifie
|
||||
wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) {
|
||||
wchar_t c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(input.keysym.unicode > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
if(input.keysym.sym > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.sym = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.sym,input.keysym.mod);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
c = input.keysym.sym;
|
||||
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
// c = SDLKey(c & 0xFF);
|
||||
// }
|
||||
@@ -1057,10 +923,10 @@ vector<int> extractKeyPressedUnicodeLength(string text) {
|
||||
SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
||||
SDLKey c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(input.keysym.unicode > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
if(input.keysym.sym > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.sym = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.sym,input.keysym.mod);
|
||||
|
||||
c = (SDLKey)input.keysym.unicode;
|
||||
c = (SDLKey)input.keysym.sym;
|
||||
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
// c = SDLKey(c & 0xFF);
|
||||
// }
|
||||
@@ -1070,7 +936,7 @@ SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
}
|
||||
if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
if(c <= SDLK_UNKNOWN) {
|
||||
c = input.keysym.sym;
|
||||
}
|
||||
|
||||
@@ -1128,24 +994,22 @@ bool isAllowedInputTextKey(wchar_t &key) {
|
||||
key != SDLK_F13 &&
|
||||
key != SDLK_F14 &&
|
||||
key != SDLK_F15 &&
|
||||
key != SDLK_NUMLOCK &&
|
||||
key != SDLK_NUMLOCKCLEAR &&
|
||||
key != SDLK_CAPSLOCK &&
|
||||
key != SDLK_SCROLLOCK &&
|
||||
key != SDLK_SCROLLLOCK &&
|
||||
key != SDLK_RSHIFT &&
|
||||
key != SDLK_LSHIFT &&
|
||||
key != SDLK_RCTRL &&
|
||||
key != SDLK_LCTRL &&
|
||||
key != SDLK_RALT &&
|
||||
key != SDLK_LALT &&
|
||||
key != SDLK_RMETA &&
|
||||
key != SDLK_LMETA &&
|
||||
key != SDLK_LSUPER &&
|
||||
key != SDLK_RSUPER &&
|
||||
key != SDLK_RGUI &&
|
||||
key != SDLK_LGUI &&
|
||||
key != SDLK_MODE &&
|
||||
key != SDLK_HELP &&
|
||||
key != SDLK_PRINT &&
|
||||
key != SDLK_PRINTSCREEN &&
|
||||
key != SDLK_SYSREQ &&
|
||||
key != SDLK_BREAK &&
|
||||
key != SDLK_PAUSE &&
|
||||
key != SDLK_MENU &&
|
||||
key != SDLK_POWER);
|
||||
|
||||
@@ -1192,24 +1056,22 @@ bool isAllowedInputTextKey(SDLKey key) {
|
||||
key != SDLK_F13 &&
|
||||
key != SDLK_F14 &&
|
||||
key != SDLK_F15 &&
|
||||
key != SDLK_NUMLOCK &&
|
||||
key != SDLK_NUMLOCKCLEAR &&
|
||||
key != SDLK_CAPSLOCK &&
|
||||
key != SDLK_SCROLLOCK &&
|
||||
key != SDLK_SCROLLLOCK &&
|
||||
key != SDLK_RSHIFT &&
|
||||
key != SDLK_LSHIFT &&
|
||||
key != SDLK_RCTRL &&
|
||||
key != SDLK_LCTRL &&
|
||||
key != SDLK_RALT &&
|
||||
key != SDLK_LALT &&
|
||||
key != SDLK_RMETA &&
|
||||
key != SDLK_LMETA &&
|
||||
key != SDLK_LSUPER &&
|
||||
key != SDLK_RSUPER &&
|
||||
key != SDLK_RGUI &&
|
||||
key != SDLK_LGUI &&
|
||||
key != SDLK_MODE &&
|
||||
key != SDLK_HELP &&
|
||||
key != SDLK_PRINT &&
|
||||
key != SDLK_PRINTSCREEN &&
|
||||
key != SDLK_SYSREQ &&
|
||||
key != SDLK_BREAK &&
|
||||
key != SDLK_PAUSE &&
|
||||
key != SDLK_MENU &&
|
||||
key != SDLK_POWER);
|
||||
|
||||
@@ -1232,10 +1094,10 @@ bool Window::isKeyStateModPressed(int mod) {
|
||||
wchar_t Window::extractLastKeyPressed() {
|
||||
wchar_t c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(keystate.unicode > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,keystate.unicode,keystate.mod);
|
||||
if(keystate.sym > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.sym = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,keystate.sym,keystate.mod);
|
||||
|
||||
c = keystate.unicode;
|
||||
c = keystate.sym;
|
||||
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
// c = SDLKey(c & 0xFF);
|
||||
// }
|
||||
|
Reference in New Issue
Block a user