Merge branch releases/1.8 revisions r5369:r5387 into trunk.

- Fix bug in cursor positions when compiled with newer Windows SDK's (v110 in VS2012) and running on Systems >= Windows Vista in windowed mode.
- IOSOperator::getSysteMemory() no longer returns incorrect values with >2GB.
- Spelling fixes and documenation


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5388 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-04-01 16:26:31 +00:00
parent bd9ff4940b
commit 49cc0f54ad
7 changed files with 49 additions and 21 deletions

View File

@ -164,6 +164,9 @@ should now be fps independentn
--------------------------
Changes in 1.8.5
- Fix bug in cursor positions when compiled with newer Windows SDK's (v110 in VS2012) and running on Systems >= Windows Vista in windowed mode.
Thanks @Mustapha Tachouct for the bugreport and patch proposal. Also thanks @BakeMyCake for an earlier report.
- IOSOperator::getSysteMemory() no longer returns incorrect values with >2GB. Thanks @Eduline - human development for report and patch.
- Increase KEY_KEY_CODES_COUNT to fix problem with laptop keyboards which return the keycode 0xff for the function key. Thx @Klokancz for bugreport and patch.
- Fix bug when calling activateJoysticks on windows several times. It had appened joystick information instead of replacing it, thereby increasing joystick number on each call.
Only happened compiling with _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ (which is the default). Linux and SDL implementation not affected.

View File

@ -38,10 +38,10 @@ public:
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
//! Get the total and available system RAM
/** \param Total: will contain the total system memory
\param Avail: will contain the available memory
/** \param totalBytes: will contain the total system memory in bytes
\param availableBytes: will contain the available memory in bytes
\return True if successful, false if not */
virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0;
virtual bool getSystemMemory(u32* totalBytes, u32* availableBytes) const = 0;
};

View File

@ -1955,6 +1955,22 @@ void CIrrDeviceWin32::ReportLastWinApiError()
}
}
// Same function Windows offers in VersionHelpers.h, but we can't use that as it's not available in older sdk's (minimum is SDK 8.1)
bool CIrrDeviceWin32::isWindowsVistaOrGreater()
{
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 6; // Windows Vista
if ( !GetVersionEx((OSVERSIONINFO*)&osvi) )
{
return false;
}
return VerifyVersionInfo(&osvi, VER_MAJORVERSION, VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
}
// Convert an Irrlicht texture to a Windows cursor
// Based on http://www.codeguru.com/cpp/w-p/win32/cursors/article.php/c4529/
HCURSOR CIrrDeviceWin32::TextureToCursor(HWND hwnd, irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot)

View File

@ -118,13 +118,16 @@ namespace irr
return CIrrDeviceStub::checkSuccessiveClicks(mouseX, mouseY, inputEvent );
}
//! switchs to fullscreen
//! Switch to fullscreen
bool switchToFullScreen(bool reset=false);
//! Check for and show last Windows API error to help internal debugging.
//! Does call GetLastError and on errors formats the errortext and displays it in a messagebox.
//! Does call GetLastError and on errors formats the error text and displays it in a messagebox.
static void ReportLastWinApiError();
//! Same function Windows offers in VersionHelpers.h, but we can't use that as it's not available before SDK 8.1
static bool isWindowsVistaOrGreater();
// convert an Irrlicht texture to a windows cursor
HCURSOR TextureToCursor(HWND hwnd, irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot);
@ -282,15 +285,21 @@ namespace irr
{
if (!fullscreen)
{
s32 paddingBorder = 0;
#if defined (SM_CXPADDEDBORDER)
if (CIrrDeviceWin32::isWindowsVistaOrGreater())
paddingBorder = GetSystemMetrics(SM_CXPADDEDBORDER);
#endif
if (resizable)
{
BorderX = GetSystemMetrics(SM_CXSIZEFRAME);
BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYSIZEFRAME);
BorderX = GetSystemMetrics(SM_CXSIZEFRAME) + paddingBorder;
BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYSIZEFRAME) + paddingBorder;
}
else
{
BorderX = GetSystemMetrics(SM_CXDLGFRAME);
BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYDLGFRAME);
BorderX = GetSystemMetrics(SM_CXDLGFRAME) + paddingBorder;
BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYDLGFRAME) + paddingBorder;
}
}
else

View File

@ -206,16 +206,16 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
{
#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_)
MEMORYSTATUS MemoryStatus;
MemoryStatus.dwLength = sizeof(MEMORYSTATUS);
MEMORYSTATUSEX MemoryStatusEx;
MemoryStatusEx.dwLength = sizeof(MEMORYSTATUSEX);
// cannot fail
GlobalMemoryStatus(&MemoryStatus);
GlobalMemoryStatusEx(&MemoryStatusEx);
if (Total)
*Total = (u32)(MemoryStatus.dwTotalPhys>>10);
*Total = (u32)(MemoryStatusEx.ullTotalPhys>>10);
if (Avail)
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
*Avail = (u32)(MemoryStatusEx.ullAvailPhys>>10);
return true;
@ -234,7 +234,7 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
*Avail = (u32)((ps*(long long)ap)>>10);
return true;
#else
// TODO: implement for non-availablity of symbols/features
// TODO: implement for non-availability of symbols/features
return false;
#endif
#elif defined(_IRR_OSX_PLATFORM_)

View File

@ -132,7 +132,7 @@ inline u32 getTextureSizeFromSurfaceSize(u32 size)
wchar_t currentchar = ch;
if ( IsDBCSLeadByte((BYTE) ch))
continue; // surragate pairs unsupported
continue; // surrogate pairs unsupported
// get the dimensions
SIZE size;
@ -144,9 +144,9 @@ inline u32 getTextureSizeFromSurfaceSize(u32 size)
if (GetCharABCWidthsW(dc, currentchar, currentchar, &abc)) // for unicode fonts, get overhang, underhang, width
{
size.cx = abc.abcB;
fa.underhang = abc.abcA;
fa.overhang = abc.abcC;
size.cx = abc.abcB; // full font width (ignoring padding/underhang )
fa.underhang = abc.abcA; // underhang/padding left - can also be negative (in which case it's overhang left)
fa.overhang = abc.abcC; // overhang/padding right - can also be negative (in which case it's underhand right)
if (abc.abcB-abc.abcA+abc.abcC<1)
continue; // nothing of width 0
@ -236,7 +236,7 @@ inline u32 getTextureSizeFromSurfaceSize(u32 size)
{
s32 currentArea = (*it).getValue();
wchar_t wch = (*it).getKey();
// sloppy but I couldnt be bothered rewriting it
// sloppy but I couldn't be bothered rewriting it
if (Areas[currentArea].sourceimage == currentImage)
{
// draw letter

View File

@ -2,7 +2,7 @@
Tool for creating Irrlicht bitmap+vector fonts,
started by Gaz Davidson in December 2006
Due to my laziness and Microsoft's unituitive API, surragate pairs and
Due to my laziness and Microsoft's unintuitive API, surrogate pairs and
nonspacing diacritical marks are not supported!
Linux bitmap font support added by Neil Burlock Oct 2008