mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 13:46:13 +00:00
merge, fixed build with NL_MAC_NATIVE
This commit is contained in:
commit
557081c7d8
14 changed files with 80 additions and 44 deletions
|
@ -187,7 +187,7 @@ public:
|
|||
virtual void setWindowTitle(const ucstring &title)=0;
|
||||
|
||||
/// Set the position of the NeL window
|
||||
virtual void setWindowPos(uint32 x, uint32 y)=0;
|
||||
virtual void setWindowPos(sint32 x, sint32 y)=0;
|
||||
|
||||
/// Show or hide the NeL window
|
||||
virtual void showWindow(bool show)=0;
|
||||
|
@ -748,7 +748,7 @@ public:
|
|||
virtual void getWindowSize (uint32 &width, uint32 &height) = 0;
|
||||
|
||||
/// Get the position of the window always (0,0) in fullscreen
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y) = 0;
|
||||
virtual void getWindowPos (sint32 &x, sint32 &y) = 0;
|
||||
|
||||
/** get the RGBA back buffer. After swapBuffers(), the content of the back buffer is undefined.
|
||||
*
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
virtual void setWindowTitle(const ucstring &title);
|
||||
|
||||
/// Set the position of the NeL window
|
||||
virtual void setWindowPos(uint32 x, uint32 y);
|
||||
virtual void setWindowPos(sint32 x, sint32 y);
|
||||
|
||||
/// Show or hide the NeL window
|
||||
virtual void showWindow(bool show);
|
||||
|
@ -396,7 +396,7 @@ public:
|
|||
virtual void getWindowSize (uint32 &width, uint32 &height);
|
||||
virtual uint getWindowWidth ();
|
||||
virtual uint getWindowHeight ();
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y);
|
||||
virtual void getWindowPos (sint32 &x, sint32 &y);
|
||||
virtual uint32 getAvailableVertexAGPMemory ();
|
||||
virtual uint32 getAvailableVertexVRAMMemory ();
|
||||
virtual void getBuffer (CBitmap &bitmap);
|
||||
|
|
|
@ -187,7 +187,7 @@ public:
|
|||
virtual void setWindowTitle(const ucstring &title)=0;
|
||||
|
||||
/// Set the position of the NeL window
|
||||
virtual void setWindowPos(uint32 x, uint32 y)=0;
|
||||
virtual void setWindowPos(sint32 x, sint32 y)=0;
|
||||
|
||||
/// Show or hide the NeL window
|
||||
virtual void showWindow(bool show = true)=0;
|
||||
|
@ -499,7 +499,7 @@ public:
|
|||
virtual uint getWindowHeight () =0;
|
||||
|
||||
/// Get the x and y coord of the windows always (0,0) in fullscreen
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y) = 0;
|
||||
virtual void getWindowPos (sint32 &x, sint32 &y) = 0;
|
||||
|
||||
/** Return the amount of AGP memory allocated by initVertexArrayRange() to store vertices.
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace NL3D
|
|||
{
|
||||
|
||||
// ***************************************************************************
|
||||
const uint32 IDriver::InterfaceVersion = 0x66; // added IEventEmitter::emulateMouseRawMode(bool)
|
||||
const uint32 IDriver::InterfaceVersion = 0x67; // changed window pos from uint32 to sint32
|
||||
|
||||
// ***************************************************************************
|
||||
IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )
|
||||
|
|
|
@ -1817,7 +1817,7 @@ void CDriverD3D::getWindowSize (uint32 &width, uint32 &height)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverD3D::getWindowPos (uint32 &x, uint32 &y)
|
||||
void CDriverD3D::getWindowPos (sint32 &x, sint32 &y)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_getWindowPos);
|
||||
x = _WindowX;
|
||||
|
@ -2187,10 +2187,10 @@ void CDriverD3D::setWindowTitle(const ucstring &title)
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverD3D::setWindowPos(uint32 x, uint32 y)
|
||||
void CDriverD3D::setWindowPos(sint32 x, sint32 y)
|
||||
{
|
||||
_WindowX = (sint32)x;
|
||||
_WindowY = (sint32)y;
|
||||
_WindowX = x;
|
||||
_WindowY = y;
|
||||
SetWindowPos(_HWnd, NULL, _WindowX, _WindowY, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
|
|
|
@ -753,14 +753,14 @@ public:
|
|||
virtual emptyProc getWindowProc();
|
||||
virtual NLMISC::IEventEmitter *getEventEmitter();
|
||||
virtual void getWindowSize (uint32 &width, uint32 &height);
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y);
|
||||
virtual void getWindowPos (sint32 &x, sint32 &y);
|
||||
virtual uint8 getBitPerPixel ();
|
||||
|
||||
/// Set the title of the NeL window
|
||||
virtual void setWindowTitle(const ucstring &title);
|
||||
|
||||
/// Set the position of the NeL window
|
||||
virtual void setWindowPos(uint32 x, uint32 y);
|
||||
virtual void setWindowPos(sint32 x, sint32 y);
|
||||
|
||||
/// Show or hide the NeL window
|
||||
virtual void showWindow(bool show);
|
||||
|
|
|
@ -287,6 +287,7 @@ public:
|
|||
virtual void disableHardwareVertexArrayAGP();
|
||||
virtual void disableHardwareTextureShader();
|
||||
|
||||
virtual void setWindowSize(uint32 width, uint32 height);
|
||||
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||
virtual bool setMode(const GfxMode& mode);
|
||||
virtual bool getModes(std::vector<GfxMode> &modes);
|
||||
|
@ -298,7 +299,7 @@ public:
|
|||
virtual void setWindowTitle(const ucstring &title);
|
||||
|
||||
/// Set the position of the NeL window
|
||||
virtual void setWindowPos(uint32 x, uint32 y);
|
||||
virtual void setWindowPos(sint32 x, sint32 y);
|
||||
|
||||
/// Show or hide the NeL window
|
||||
virtual void showWindow(bool show);
|
||||
|
@ -502,7 +503,7 @@ public:
|
|||
|
||||
virtual void getWindowSize (uint32 &width, uint32 &height);
|
||||
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y);
|
||||
virtual void getWindowPos (sint32 &x, sint32 &y);
|
||||
|
||||
virtual void getBuffer (CBitmap &bitmap);
|
||||
|
||||
|
|
|
@ -868,7 +868,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
|
|||
|
||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||
|
||||
// TODO
|
||||
return NL3D::MAC::setMode(mode);
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
|
@ -1197,9 +1197,8 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
|
|||
mode.AntiAlias = _AntiAliasing;
|
||||
|
||||
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
|
||||
# warning "OpenGL Driver: Temporary Mac Implementation"
|
||||
nlwarning("OpenGL Driver: Temporary Mac Implementation");
|
||||
mode.Depth = 24;
|
||||
|
||||
NL3D::MAC::getCurrentScreenMode(mode);
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
/*
|
||||
|
@ -1269,10 +1268,10 @@ void CDriverGL::setWindowTitle(const ucstring &title)
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL::setWindowPos(uint32 x, uint32 y)
|
||||
void CDriverGL::setWindowPos(sint32 x, sint32 y)
|
||||
{
|
||||
_WindowX = (sint32)x;
|
||||
_WindowY = (sint32)y;
|
||||
_WindowX = x;
|
||||
_WindowY = y;
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
|
@ -1541,7 +1540,7 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height)
|
|||
_WindowX = clientRect.left;
|
||||
_WindowY = clientRect.top;
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
#elif defined(NL_OS_UNIX) && !defined(NL_MAC_NATIVE)
|
||||
|
||||
// Resize and update the window
|
||||
XResizeWindow(_dpy, _win, width, height);
|
||||
|
@ -1575,7 +1574,7 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height)
|
|||
#endif // NL_OS_WINDOWS
|
||||
}
|
||||
|
||||
void CDriverGL::getWindowPos(uint32 &x, uint32 &y)
|
||||
void CDriverGL::getWindowPos(sint32 &x, sint32 &y)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_getWindowPos)
|
||||
|
||||
|
@ -1593,8 +1592,8 @@ void CDriverGL::getWindowPos(uint32 &x, uint32 &y)
|
|||
{
|
||||
if (_win)
|
||||
{
|
||||
x = (uint32)_WindowX;
|
||||
y = (uint32)_WindowY;
|
||||
x = _WindowX;
|
||||
y = _WindowY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,17 @@ bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable);
|
|||
/// mac specific stuff while calling CDriverGL::setMode()
|
||||
bool setMode(const GfxMode& mode);
|
||||
|
||||
/// mac specific stuff while calling CDriverGL::getCurrentScreenMode()
|
||||
void getCurrentScreenMode(GfxMode& mode);
|
||||
|
||||
/// mac specific stuff while calling CDriverGL::getWindowSize()
|
||||
void getWindowSize(uint32 &width, uint32 &height);
|
||||
|
||||
/// mac specific stuff while calling CDriverGL::getWindowPos()
|
||||
void getWindowPos(uint32 &x, uint32 &y);
|
||||
void getWindowPos(sint32 &x, sint32 &y);
|
||||
|
||||
/// mac specific stuff while calling CDriverGL::setWindowPos()
|
||||
void setWindowPos(uint32 x, uint32 y);
|
||||
void setWindowPos(sint32 x, sint32 y);
|
||||
|
||||
/// mac specific stuff while calling CDriverGL::setWindowTitle()
|
||||
void setWindowTitle(const ucstring &title);
|
||||
|
|
|
@ -237,11 +237,36 @@ bool setMode(const GfxMode& mode)
|
|||
return true;
|
||||
}
|
||||
|
||||
void getCurrentScreenMode(GfxMode& mode)
|
||||
{
|
||||
// the sceen with the menu bar
|
||||
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
|
||||
|
||||
mode.OffScreen = false;
|
||||
mode.Frequency = 0;
|
||||
mode.Depth = NSBitsPerPixelFromDepth([screen depth]);
|
||||
|
||||
// in fullscreen mode
|
||||
if([g_glview isInFullScreenMode])
|
||||
{
|
||||
// return the size of the back buffer (like having switched monitor mode)
|
||||
mode.Windowed = false;
|
||||
mode.Width = (uint16)g_bufferSize[0];
|
||||
mode.Height = (uint16)g_bufferSize[1];
|
||||
}
|
||||
|
||||
// in windowes mode
|
||||
else
|
||||
{
|
||||
// return the size of the screen with menu bar
|
||||
mode.Windowed = true;
|
||||
mode.Width = (uint16)[screen frame].size.width;
|
||||
mode.Height = (uint16)[screen frame].size.height;
|
||||
}
|
||||
}
|
||||
|
||||
void getWindowSize(uint32 &width, uint32 &height)
|
||||
{
|
||||
if(!g_glctx)
|
||||
return;
|
||||
|
||||
// A cocoa fullscreen view stays at the native resolution of the display.
|
||||
// When changing the rendering resolution, the size of the back buffer gets
|
||||
// changed, but the view still stays at full resolution. So the scaling of
|
||||
|
@ -313,10 +338,17 @@ void getWindowSize(uint32 &width, uint32 &height)
|
|||
#endif
|
||||
}
|
||||
|
||||
void getWindowPos(uint32 &x, uint32 &y)
|
||||
void getWindowPos(sint32 &x, sint32 &y)
|
||||
{
|
||||
// get the rect (position, size) of the screen
|
||||
NSRect screenRect = [[g_window screen] frame];
|
||||
// for IDriver conformity
|
||||
if([g_glview isInFullScreenMode])
|
||||
{
|
||||
x = y = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// get the rect (position, size) of the screen with menu bar
|
||||
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||
|
||||
// get the rect (position, size) of the window
|
||||
NSRect windowRect = [g_window frame];
|
||||
|
@ -328,12 +360,12 @@ void getWindowPos(uint32 &x, uint32 &y)
|
|||
y = screenRect.size.height - windowRect.size.height - windowRect.origin.y;
|
||||
}
|
||||
|
||||
void setWindowPos(uint32 x, uint32 y)
|
||||
void setWindowPos(sint32 x, sint32 y)
|
||||
{
|
||||
// get the size of the screen
|
||||
NSRect screenRect = [[g_window screen] frame];
|
||||
// get the rect (position, size) of the screen with menu bar
|
||||
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||
|
||||
// get the size of the window
|
||||
// get the rect (position, size) of the window
|
||||
NSRect windowRect = [g_window frame];
|
||||
|
||||
// convert y from NeL coordinates to cocoa coordinates
|
||||
|
|
|
@ -328,7 +328,7 @@ void CDriverUser::setWindowTitle(const ucstring &title)
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverUser::setWindowPos(uint32 x, uint32 y)
|
||||
void CDriverUser::setWindowPos(sint32 x, sint32 y)
|
||||
{
|
||||
NL3D_HAUTO_UI_DRIVER;
|
||||
_Driver->setWindowPos(x, y);
|
||||
|
@ -1530,7 +1530,7 @@ uint CDriverUser::getWindowHeight ()
|
|||
_Driver->getWindowSize (width, height);
|
||||
return height;
|
||||
}
|
||||
void CDriverUser::getWindowPos (uint32 &x, uint32 &y)
|
||||
void CDriverUser::getWindowPos (sint32 &x, sint32 &y)
|
||||
{
|
||||
NL3D_HAUTO_UI_DRIVER;
|
||||
|
||||
|
|
|
@ -2009,7 +2009,8 @@ void CClientConfig::release ()
|
|||
// Driver still alive ?
|
||||
if (Driver && Driver->isActive ())
|
||||
{
|
||||
uint32 x, y, width, height;
|
||||
sint32 x, y;
|
||||
uint32 width, height;
|
||||
|
||||
Driver->getWindowPos(x, y);
|
||||
Driver->getWindowSize(width, height);
|
||||
|
|
|
@ -61,8 +61,8 @@ struct CClientConfig
|
|||
bool SaveConfig;
|
||||
|
||||
/// Window position in windowed mode
|
||||
sint PositionX;
|
||||
sint PositionY;
|
||||
sint32 PositionX;
|
||||
sint32 PositionY;
|
||||
|
||||
/// Window frequency
|
||||
uint Frequency;
|
||||
|
|
|
@ -908,7 +908,7 @@ void prelogInit()
|
|||
// Set the title
|
||||
Driver->setWindowTitle(CI18N::get("TheSagaOfRyzom"));
|
||||
|
||||
uint32 posX = 0, posY = 0;
|
||||
sint32 posX = 0, posY = 0;
|
||||
|
||||
if (ClientCfg.Windowed)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue