mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 09:28:45 +00:00
Changed: #970 Move all window and input related methods to a new file from OpenGL driver
This commit is contained in:
parent
2c17643d10
commit
0bc2be9691
2 changed files with 89 additions and 59 deletions
|
@ -1248,6 +1248,7 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
// Disable feature ???
|
// Disable feature ???
|
||||||
if(!ext.DisableHardwareVertexArrayAGP)
|
if(!ext.DisableHardwareVertexArrayAGP)
|
||||||
ext.NVVertexArrayRange= setupNVVertexArrayRange(glext);
|
ext.NVVertexArrayRange= setupNVVertexArrayRange(glext);
|
||||||
|
|
||||||
if(ext.NVVertexArrayRange)
|
if(ext.NVVertexArrayRange)
|
||||||
{
|
{
|
||||||
GLint nverts;
|
GLint nverts;
|
||||||
|
@ -1255,7 +1256,6 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
ext.NVVertexArrayRangeMaxVertex= nverts;
|
ext.NVVertexArrayRangeMaxVertex= nverts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Compression S3TC OK iff ARBTextureCompression.
|
// Compression S3TC OK iff ARBTextureCompression.
|
||||||
ext.EXTTextureCompressionS3TC= (ext.ARBTextureCompression && setupEXTTextureCompressionS3TC(glext));
|
ext.EXTTextureCompressionS3TC= (ext.ARBTextureCompression && setupEXTTextureCompressionS3TC(glext));
|
||||||
|
|
||||||
|
@ -1268,7 +1268,6 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
// Check NVTextureEnvCombine4.
|
// Check NVTextureEnvCombine4.
|
||||||
ext.NVTextureEnvCombine4= setupNVTextureEnvCombine4(glext);
|
ext.NVTextureEnvCombine4= setupNVTextureEnvCombine4(glext);
|
||||||
|
|
||||||
|
|
||||||
// Check for cube mapping
|
// Check for cube mapping
|
||||||
ext.ARBTextureCubeMap = setupARBTextureCubeMap(glext);
|
ext.ARBTextureCubeMap = setupARBTextureCubeMap(glext);
|
||||||
|
|
||||||
|
@ -1304,8 +1303,6 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
ext.ARBFragmentProgram = false;
|
ext.ARBFragmentProgram = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// For now, the only way to know if emulation, is to test some extension which exist only on GeForce3.
|
// For now, the only way to know if emulation, is to test some extension which exist only on GeForce3.
|
||||||
// if GL_NV_texture_shader is not here, then we are not on GeForce3.
|
// if GL_NV_texture_shader is not here, then we are not on GeForce3.
|
||||||
ext.NVVertexProgramEmulated= ext.NVVertexProgram && (strstr(glext, "GL_NV_texture_shader")==NULL);
|
ext.NVVertexProgramEmulated= ext.NVVertexProgram && (strstr(glext, "GL_NV_texture_shader")==NULL);
|
||||||
|
@ -1318,6 +1315,7 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
|
|
||||||
// Check NVVertexArrayRange2
|
// Check NVVertexArrayRange2
|
||||||
ext.NVVertexArrayRange2= setupNVVertexArrayRange2(glext);
|
ext.NVVertexArrayRange2= setupNVVertexArrayRange2(glext);
|
||||||
|
|
||||||
// if supported
|
// if supported
|
||||||
if(ext.NVVertexArrayRange2)
|
if(ext.NVVertexArrayRange2)
|
||||||
// VBHard swap without flush of the VAR.
|
// VBHard swap without flush of the VAR.
|
||||||
|
|
|
@ -1570,26 +1570,32 @@ NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_enableLowLevelMouse)
|
H_AUTO_OGL(CDriverGL_enableLowLevelMouse)
|
||||||
|
|
||||||
|
NLMISC::IMouseDevice *res = NULL;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if (_EventEmitter.getNumEmitters() < 2) return NULL;
|
|
||||||
NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
NLMISC::CDIEventEmitter *diee = NULL;
|
||||||
|
|
||||||
|
if (_EventEmitter.getNumEmitters() > 1)
|
||||||
|
diee = NLMISC::safe_cast<CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NLMISC::IMouseDevice *md = diee->getMouseDevice(exclusive);
|
if (diee)
|
||||||
return md;
|
res = diee->getMouseDevice(exclusive);
|
||||||
}
|
}
|
||||||
catch (EDirectInput &)
|
catch (EDirectInput &)
|
||||||
{
|
{
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (diee)
|
||||||
diee->releaseMouse();
|
diee->releaseMouse();
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||||
# warning "OpenGL Driver: Missing Mac Implementation"
|
# warning "OpenGL Driver: Missing Mac Implementation"
|
||||||
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
||||||
|
@ -1597,33 +1603,41 @@ NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
|
NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_enableLowLevelKeyboard)
|
H_AUTO_OGL(CDriverGL_enableLowLevelKeyboard)
|
||||||
|
|
||||||
|
NLMISC::IKeyboardDevice *res = NULL;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if (_EventEmitter.getNumEmitters() < 2) return NULL;
|
|
||||||
NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
NLMISC::CDIEventEmitter *diee = NULL;
|
||||||
|
|
||||||
|
if (_EventEmitter.getNumEmitters() > 1)
|
||||||
|
diee = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NLMISC::IKeyboardDevice *md = diee->getKeyboardDevice();
|
if (diee)
|
||||||
return md;
|
res = diee->getKeyboardDevice();
|
||||||
}
|
}
|
||||||
catch (EDirectInput &)
|
catch (EDirectInput &)
|
||||||
{
|
{
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (diee)
|
||||||
diee->releaseKeyboard();
|
diee->releaseKeyboard();
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||||
# warning "OpenGL Driver: Missing Mac Implementation"
|
# warning "OpenGL Driver: Missing Mac Implementation"
|
||||||
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
||||||
|
@ -1631,17 +1645,22 @@ NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
NLMISC::IInputDeviceManager* CDriverGL::getLowLevelInputDeviceManager()
|
NLMISC::IInputDeviceManager* CDriverGL::getLowLevelInputDeviceManager()
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_getLowLevelInputDeviceManager)
|
H_AUTO_OGL(CDriverGL_getLowLevelInputDeviceManager)
|
||||||
|
|
||||||
|
NLMISC::IInputDeviceManager *res = NULL;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if (_EventEmitter.getNumEmitters() < 2) return NULL;
|
|
||||||
NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
if (_EventEmitter.getNumEmitters() > 1)
|
||||||
return diee;
|
res = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||||
# warning "OpenGL Driver: Missing Mac Implementation"
|
# warning "OpenGL Driver: Missing Mac Implementation"
|
||||||
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
||||||
|
@ -1649,7 +1668,8 @@ NLMISC::IInputDeviceManager* CDriverGL::getLowLevelInputDeviceManager()
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -1657,8 +1677,12 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_getDoubleClickDelay)
|
H_AUTO_OGL(CDriverGL_getDoubleClickDelay)
|
||||||
|
|
||||||
|
uint res = 250;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
NLMISC::IMouseDevice *md = NULL;
|
NLMISC::IMouseDevice *md = NULL;
|
||||||
|
|
||||||
if (_EventEmitter.getNumEmitters() >= 2)
|
if (_EventEmitter.getNumEmitters() >= 2)
|
||||||
{
|
{
|
||||||
NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast<CDIEventEmitter *>(_EventEmitter.getEmitter(1));
|
||||||
|
@ -1674,20 +1698,28 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md)
|
if (md)
|
||||||
{
|
{
|
||||||
return md->getDoubleClickDelay();
|
res = md->getDoubleClickDelay();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// try to read the good value from windows
|
// try to read the good value from windows
|
||||||
return ::GetDoubleClickTime();
|
res = ::GetDoubleClickTime();
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||||
# warning "OpenGL Driver: Missing Mac Implementation"
|
# warning "OpenGL Driver: Missing Mac Implementation"
|
||||||
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
nlwarning("OpenGL Driver: Missing Mac Implementation");
|
||||||
|
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
// TODO for Linux FIXME: FAKE FIX
|
|
||||||
return 250;
|
// TODO for Linux
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue