Fix keyboard input on Blackberry and enable on Qt frontend. Make Qt open a window instead of fullscreen for non-mobile systems. Make the window resizable (updates pixel_*res and dp_*res).
This commit is contained in:
parent
e01acb48da
commit
472cf6af1a
3 changed files with 83 additions and 4 deletions
|
@ -20,15 +20,32 @@ void LaunchBrowser(const char *url)
|
|||
QDesktopServices::openUrl(QUrl(url));
|
||||
}
|
||||
|
||||
void SimulateGamepad(InputState *input) {
|
||||
input->pad_lstick_x = 0;
|
||||
input->pad_lstick_y = 0;
|
||||
input->pad_rstick_x = 0;
|
||||
input->pad_rstick_y = 0;
|
||||
|
||||
if (input->pad_buttons | (1<<14))
|
||||
input->pad_lstick_y=1;
|
||||
else if (input->pad_buttons | (1<<15))
|
||||
input->pad_lstick_y=-1;
|
||||
if (input->pad_buttons | (1<<16))
|
||||
input->pad_lstick_x=-1;
|
||||
else if (input->pad_buttons | (1<<17))
|
||||
input->pad_lstick_x=1;
|
||||
}
|
||||
|
||||
float CalculateDPIScale()
|
||||
{
|
||||
// Calculate DPI from TWIPS on Symbian
|
||||
#ifdef __SYMBIAN32__
|
||||
TSize sizeTwips = CEikonEnv::Static()->ScreenDevice()->SizeInTwips();
|
||||
TSize sTwips = CEikonEnv::Static()->ScreenDevice()->SizeInTwips();
|
||||
float dpi = sqrt((float)(pixel_xres*pixel_xres + pixel_yres*pixel_yres))
|
||||
/ (sqrt((float)(sizeTwips.iHeight*sizeTwips.iHeight + sizeTwips.iWidth*sizeTwips.iWidth)) / KTwipsPerInch);
|
||||
/ (sqrt((float)(sTwips.iHeight*sTwips.iHeight + sTwips.iWidth*sTwips.iWidth)) / KTwipsPerInch);
|
||||
return dpi / 170.0f;
|
||||
#else
|
||||
// Sane default for Blackberry and Meego
|
||||
return 1.2f;
|
||||
#endif
|
||||
}
|
||||
|
@ -41,10 +58,16 @@ int main(int argc, char *argv[])
|
|||
QT_TRAP_THROWING(dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi())->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
|
||||
#endif
|
||||
QSize res = QApplication::desktop()->screenGeometry().size();
|
||||
#ifdef USING_GLES2
|
||||
if (res.width() < res.height())
|
||||
res.transpose();
|
||||
pixel_xres = res.width();
|
||||
pixel_yres = res.height();
|
||||
#else
|
||||
// Set resolution to half of the monitor on desktop systems
|
||||
pixel_xres = res.width() / 2;
|
||||
pixel_yres = res.height() / 2;
|
||||
#endif
|
||||
float dpi_scale = CalculateDPIScale();
|
||||
dp_xres = (int)(pixel_xres * dpi_scale); dp_yres = (int)(pixel_yres * dpi_scale);
|
||||
net::Init();
|
||||
|
@ -55,9 +78,14 @@ int main(int argc, char *argv[])
|
|||
#else
|
||||
NativeInit(argc, (const char **)argv, "./", "/tmp", "BADCOFFEE");
|
||||
#endif
|
||||
|
||||
MainUI w(dpi_scale);
|
||||
w.resize(pixel_xres, pixel_yres);
|
||||
#ifdef USING_GLES2
|
||||
w.showFullScreen();
|
||||
#else
|
||||
w.show();
|
||||
#endif
|
||||
|
||||
MainAudio *audio = new MainAudio();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue