CHANGED: #1471 CViewRenderer is now a separate Simpleton and not a part of CInterfaceManager.

This commit is contained in:
dfighter1985 2012-06-01 03:41:44 +02:00
parent 41134639db
commit 891859406f
58 changed files with 256 additions and 243 deletions

View file

@ -244,7 +244,7 @@ void checkUnderCursor()
return; return;
// No Op if screen minimized // No Op if screen minimized
if(IM->getViewRenderer().isMinimized()) if(CViewRenderer::getInstance()->isMinimized())
return; return;
// Get the pointer position (in pixel) // Get the pointer position (in pixel)
@ -258,7 +258,7 @@ void checkUnderCursor()
if(x < 0 || y <0) if(x < 0 || y <0)
return; return;
uint32 w, h; uint32 w, h;
CViewRenderer &viewRender = IM->getViewRenderer(); CViewRenderer &viewRender = *CViewRenderer::getInstance();
viewRender.getScreenSize(w, h); viewRender.getScreenSize(w, h);
if(x>=(sint32)w || y>=(sint32)h) if(x>=(sint32)w || y>=(sint32)h)
return; return;

View file

@ -190,7 +190,7 @@ void CDecal::setTexture(const std::string &fileName, bool clampU, bool clamp
if (getTextureFileName() != fileName) if (getTextureFileName() != fileName)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
UTexture *tex = vr.getGlobalTexture(fileName); UTexture *tex = vr.getGlobalTexture(fileName);
if (tex != NULL) if (tex != NULL)
{ {

View file

@ -464,7 +464,7 @@ void CInterfaceHelp::resetWindowPos(sint y)
sint maxHelpWindow= (sint)_InfoWindows.size(); sint maxHelpWindow= (sint)_InfoWindows.size();
uint32 w, h; uint32 w, h;
pIM->getViewRenderer().getScreenSize(w,h); CViewRenderer::getInstance()->getScreenSize(w,h);
// For all windows, reset pos // For all windows, reset pos
for(uint i=0;i<(uint)maxHelpWindow;i++) for(uint i=0;i<(uint)maxHelpWindow;i++)
@ -3978,7 +3978,7 @@ public:
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if (Driver) if (Driver)
{ {
HWND wnd = (HWND) Driver->getDisplay(); HWND wnd = (HWND) Driver->getDisplay();

View file

@ -520,7 +520,7 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin
// Build a viewport // Build a viewport
CViewport viewport; CViewport viewport;
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(),(float)(bottom-top)/Driver->getWindowHeight()); viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(),(float)(bottom-top)/Driver->getWindowHeight());
// Activate all this // Activate all this
@ -553,7 +553,7 @@ void renderSceneScreenShot (uint left, uint right, uint top, uint bottom, uint s
void getBuffer (CBitmap &btm) void getBuffer (CBitmap &btm)
{ {
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
// //
if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight) if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight)
{ {
@ -613,7 +613,7 @@ bool screenshotZBuffer(const std::string &filename)
std::string ext = filename.substr(pos+1); std::string ext = filename.substr(pos+1);
std::vector<float> z; std::vector<float> z;
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
Driver->getZBuffer(z); Driver->getZBuffer(z);

View file

@ -107,7 +107,7 @@ void CCtrlButton::draw ()
CRGBA color; CRGBA color;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA globalColor= pIM->getGlobalColorForContent(); CRGBA globalColor= pIM->getGlobalColorForContent();
// *** Detect Over // *** Detect Over
@ -204,7 +204,7 @@ void CCtrlButton::draw ()
if (!_Scale) if (!_Scale)
{ {
pIM->getViewRenderer().getTextureSizeFromId (nTxId, txw, txh); CViewRenderer::getInstance()->getTextureSizeFromId (nTxId, txw, txh);
if (_Align&1) if (_Align&1)
x = x + _WReal - txw; x = x + _WReal - txw;
if (_Align&2) if (_Align&2)
@ -249,7 +249,7 @@ void CCtrlButton::updateCoords()
if (!_Scale) if (!_Scale)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 txw, txh; sint32 txw, txh;
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh); rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
_W = txw; _W = txw;
@ -262,7 +262,7 @@ void CCtrlButton::updateCoords()
void CCtrlButton::setTexture(const std::string&name) void CCtrlButton::setTexture(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdNormal.setTexture(name.c_str()); _TextureIdNormal.setTexture(name.c_str());
} }
@ -270,7 +270,7 @@ void CCtrlButton::setTexture(const std::string&name)
void CCtrlButton::setTexturePushed(const std::string&name) void CCtrlButton::setTexturePushed(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdPushed.setTexture(name.c_str()); _TextureIdPushed.setTexture(name.c_str());
} }
@ -278,7 +278,7 @@ void CCtrlButton::setTexturePushed(const std::string&name)
void CCtrlButton::setTextureOver(const std::string&name) void CCtrlButton::setTextureOver(const std::string&name)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdOver.setTexture(name.c_str()); _TextureIdOver.setTexture(name.c_str());
} }
@ -286,7 +286,7 @@ void CCtrlButton::setTextureOver(const std::string&name)
std::string CCtrlButton::getTexture() const std::string CCtrlButton::getTexture() const
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdNormal); return rVR.getTextureNameFromId(_TextureIdNormal);
} }
@ -294,7 +294,7 @@ std::string CCtrlButton::getTexture() const
std::string CCtrlButton::getTexturePushed() const std::string CCtrlButton::getTexturePushed() const
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdPushed); return rVR.getTextureNameFromId(_TextureIdPushed);
} }
@ -302,7 +302,7 @@ std::string CCtrlButton::getTexturePushed() const
std::string CCtrlButton::getTextureOver() const std::string CCtrlButton::getTextureOver() const
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdOver); return rVR.getTextureNameFromId(_TextureIdOver);
} }
@ -311,7 +311,7 @@ sint32 CCtrlButton::getMaxUsedW() const
{ {
sint32 txw, txh; sint32 txw, txh;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh); rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
return txw; return txw;
} }
@ -326,7 +326,7 @@ sint32 CCtrlButton::getMinUsedW() const
void CCtrlButton::fitTexture() void CCtrlButton::fitTexture()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId(_TextureIdNormal, w, h); rVR.getTextureSizeFromId(_TextureIdNormal, w, h);
setW(w); setW(w);

View file

@ -41,7 +41,7 @@ CCtrlColPick::~CCtrlColPick()
if (_Texture>=0) if (_Texture>=0)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.deleteTexture (_Texture); rVR.deleteTexture (_Texture);
} }
} }
@ -56,7 +56,7 @@ bool CCtrlColPick::parse(xmlNodePtr node, CInterfaceGroup * parentGroup)
// Read textures // Read textures
prop = (char*) xmlGetProp( node, (xmlChar*)"texture" ); prop = (char*) xmlGetProp( node, (xmlChar*)"texture" );
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if(prop) if(prop)
{ {
string sTmp = NLMISC::strlwr((const char*)prop); string sTmp = NLMISC::strlwr((const char*)prop);
@ -84,7 +84,7 @@ bool CCtrlColPick::parse(xmlNodePtr node, CInterfaceGroup * parentGroup)
void CCtrlColPick::updateCoords() void CCtrlColPick::updateCoords()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 txw, txh; sint32 txw, txh;
rVR.getTextureSizeFromId (_Texture, txw, txh); rVR.getTextureSizeFromId (_Texture, txw, txh);
_W = txw; _W = txw;
@ -96,7 +96,7 @@ void CCtrlColPick::updateCoords()
void CCtrlColPick::draw() void CCtrlColPick::draw()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = CRGBA(255,255,255,(uint8)pIM->getGlobalColor().A); CRGBA col = CRGBA(255,255,255,(uint8)pIM->getGlobalColor().A);
@ -194,7 +194,7 @@ void CCtrlColPick::selectColor (sint32 x, sint32 y)
CRGBA CCtrlColPick::getColor (sint32 x, sint32 y) CRGBA CCtrlColPick::getColor (sint32 x, sint32 y)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (x < 0) x = 0; if (x < 0) x = 0;
if (y < 0) y = 0; if (y < 0) y = 0;

View file

@ -149,7 +149,7 @@ void CCtrlPolygon::draw()
if (_Tris.empty()) return; if (_Tris.empty()) return;
if (!_Parent) return; if (!_Parent) return;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
if (_Touched) if (_Touched)
{ {
_RealTris.clear(); _RealTris.clear();

View file

@ -61,7 +61,7 @@ void CCtrlQuad::draw()
H_AUTO(Rz_CCtrlQuad_draw) H_AUTO(Rz_CCtrlQuad_draw)
nlassert(_Parent); nlassert(_Parent);
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col; CRGBA col;
if(getModulateGlobalColor()) if(getModulateGlobalColor())
@ -297,7 +297,7 @@ void CCtrlQuad::setTexture(const std::string &texName)
{ {
H_AUTO(Rz_CCtrlQuad_setTexture) H_AUTO(Rz_CCtrlQuad_setTexture)
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureId.setTexture(texName.c_str()); _TextureId.setTexture(texName.c_str());
} }
@ -306,7 +306,7 @@ std::string CCtrlQuad::getTexture() const
{ {
H_AUTO(Rz_CCtrlQuad_getTexture) H_AUTO(Rz_CCtrlQuad_getTexture)
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId (_TextureId); return rVR.getTextureNameFromId (_TextureId);
} }
@ -357,7 +357,7 @@ void CCtrlQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo
H_AUTO(Rz_CCtrlQuad_setQuad) H_AUTO(Rz_CCtrlQuad_setQuad)
NLMISC::CVector pos = srcPos; NLMISC::CVector pos = srcPos;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h); rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h);
if (angle == 0.f) if (angle == 0.f)

View file

@ -227,7 +227,7 @@ void CCtrlScroll::updateCoords()
if (_Target->getActive()) if (_Target->getActive())
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId (_TxIdB, w, h); rVR.getTextureSizeFromId (_TxIdB, w, h);
@ -410,7 +410,7 @@ void CCtrlScroll::updateCoords()
void CCtrlScroll::draw() void CCtrlScroll::draw()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = pIM->getGlobalColorForContent(); CRGBA col = pIM->getGlobalColorForContent();
if (_Target) if (_Target)
@ -694,7 +694,7 @@ sint32 CCtrlScroll::moveTrackY (sint32 dy)
void CCtrlScroll::setTextureBottomOrLeft (const std::string &txName) void CCtrlScroll::setTextureBottomOrLeft (const std::string &txName)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TxIdB = rVR.getTextureIdFromName(txName); _TxIdB = rVR.getTextureIdFromName(txName);
} }
@ -702,7 +702,7 @@ void CCtrlScroll::setTextureBottomOrLeft (const std::string &txName)
void CCtrlScroll::setTextureMiddle (const std::string &txName) void CCtrlScroll::setTextureMiddle (const std::string &txName)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TxIdM = rVR.getTextureIdFromName(txName); _TxIdM = rVR.getTextureIdFromName(txName);
} }
@ -710,7 +710,7 @@ void CCtrlScroll::setTextureMiddle (const std::string &txName)
void CCtrlScroll::setTextureTopOrRight (const std::string &txName) void CCtrlScroll::setTextureTopOrRight (const std::string &txName)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TxIdT = rVR.getTextureIdFromName(txName); _TxIdT = rVR.getTextureIdFromName(txName);
} }

View file

@ -24,7 +24,7 @@
void CSheetSelectionGroup::setTexture(const std::string &texName) void CSheetSelectionGroup::setTexture(const std::string &texName)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIndex = rVR.getTextureIdFromName(texName); _TextureIndex = rVR.getTextureIdFromName(texName);
rVR.getTextureSizeFromId(_TextureIndex, _TextureWidth, _TextureHeight); rVR.getTextureSizeFromId(_TextureIndex, _TextureWidth, _TextureHeight);
} }

View file

@ -70,7 +70,7 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
CXMLAutoPtr prop; CXMLAutoPtr prop;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
//try to get props that can be inherited from groups //try to get props that can be inherited from groups
//if a property is not defined, try to find it in the parent group. //if a property is not defined, try to find it in the parent group.
@ -273,7 +273,7 @@ void CCtrlTextButton::draw ()
CRGBA color; CRGBA color;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA globalColor= pIM->getGlobalColorForContent(); CRGBA globalColor= pIM->getGlobalColorForContent();
// *** Detect Over // *** Detect Over

View file

@ -318,7 +318,7 @@ CCtrlSheetInfo::CCtrlSheetInfo()
void CDBCtrlSheet::release () void CDBCtrlSheet::release ()
{ {
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if (Driver) if (Driver)
Driver->deleteMaterial(_GuildMat); Driver->deleteMaterial(_GuildMat);
@ -367,7 +367,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
{ {
string TxName = (const char *) prop; string TxName = (const char *) prop;
TxName = strlwr (TxName); TxName = strlwr (TxName);
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_DispNoSheetBmpId = rVR.getTextureIdFromName (TxName); _DispNoSheetBmpId = rVR.getTextureIdFromName (TxName);
} }
@ -558,7 +558,7 @@ CDBCtrlSheet::CDBCtrlSheet(const TCtorParam &param)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
CDBCtrlSheet::~CDBCtrlSheet() CDBCtrlSheet::~CDBCtrlSheet()
{ {
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if (_GuildBack) if (_GuildBack)
{ {
@ -656,7 +656,7 @@ void CDBCtrlSheet::initSheet(const std::string &dbBranchId, const CCtrlSheetInfo
// get over for spell // get over for spell
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
_TextureIdOver = pIM->getViewRenderer().getTextureIdFromName ("w_slot_spell_over.tga"); _TextureIdOver = CViewRenderer::getInstance()->getTextureIdFromName ("w_slot_spell_over.tga");
} }
// Init size. // Init size.
@ -682,7 +682,7 @@ void CDBCtrlSheet::initSheetFast( const std::string &dbParentBranchId, int sheet
// get over for spell // get over for spell
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
_TextureIdOver = pIM->getViewRenderer().getTextureIdFromName ("w_slot_spell_over.tga"); _TextureIdOver = CViewRenderer::getInstance()->getTextureIdFromName ("w_slot_spell_over.tga");
} }
// Init size. // Init size.
@ -944,7 +944,7 @@ uint CDBCtrlSheet::getInventorySlot( const string &dbBranchId )
void CDBCtrlSheet::initSheetSize() void CDBCtrlSheet::initSheetSize()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// If the user type is auto, then select always item slot. // If the user type is auto, then select always item slot.
if(_Type==SheetType_Auto) if(_Type==SheetType_Auto)
{ {
@ -1030,7 +1030,7 @@ void CDBCtrlSheet::updateCoords ()
void CDBCtrlSheet::updateIconSize() void CDBCtrlSheet::updateIconSize()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (_DispSheetBmpId != -1) if (_DispSheetBmpId != -1)
{ {
rVR.getTextureSizeFromId(_DispSheetBmpId, _IconW, _IconH); rVR.getTextureSizeFromId(_DispSheetBmpId, _IconW, _IconH);
@ -1062,7 +1062,7 @@ void CDBCtrlSheet::setupPact()
if (_LastSheetId != sheet || _NeedSetup) if (_LastSheetId != sheet || _NeedSetup)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_LastSheetId = sheet; _LastSheetId = sheet;
CSheetId sheetId(sheet); CSheetId sheetId(sheet);
@ -1105,7 +1105,7 @@ void CDBCtrlSheet::setupItem ()
// If this is the same sheet, need to resetup // If this is the same sheet, need to resetup
if (_LastSheetId != sheet || _NeedSetup) if (_LastSheetId != sheet || _NeedSetup)
{ {
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_NeedSetup= false; _NeedSetup= false;
_LastSheetId = sheet; _LastSheetId = sheet;
@ -1324,7 +1324,7 @@ void CDBCtrlSheet::setupMission()
CMissionIconSheet *pMIS = (CMissionIconSheet*)pES; CMissionIconSheet *pMIS = (CMissionIconSheet*)pES;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_DispBackBmpId = rVR.getTextureIdFromName(pMIS->MainIconBg); _DispBackBmpId = rVR.getTextureIdFromName(pMIS->MainIconBg);
_DispSheetBmpId = rVR.getTextureIdFromName(pMIS->MainIconFg); _DispSheetBmpId = rVR.getTextureIdFromName(pMIS->MainIconFg);
@ -1375,7 +1375,7 @@ void CDBCtrlSheet::setupGuildFlag ()
sint8 nLastGuildBack = (sint8)(_MacroID&15); // 4 bits en pos 0 sint8 nLastGuildBack = (sint8)(_MacroID&15); // 4 bits en pos 0
sint8 nLastGuildSymbol = (sint8)((_MacroID>>4)&63); // 6 bits en pos 4 sint8 nLastGuildSymbol = (sint8)((_MacroID>>4)&63); // 6 bits en pos 4
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if (_GuildMat.empty()) if (_GuildMat.empty())
{ {
@ -1454,7 +1454,7 @@ void CDBCtrlSheet::setupDisplayAsSBrick(sint32 sheet, sint32 optSheet)
{ {
// Setup with the param sheet // Setup with the param sheet
CSBrickManager *pBM = CSBrickManager::getInstance(); CSBrickManager *pBM = CSBrickManager::getInstance();
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CSBrickSheet *pBR = pBM->getBrick (CSheetId(sheet)); CSBrickSheet *pBR = pBM->getBrick (CSheetId(sheet));
CSBrickSheet *pBROpt = pBM->getBrick (CSheetId(optSheet)); CSBrickSheet *pBROpt = pBM->getBrick (CSheetId(optSheet));
@ -1662,7 +1662,7 @@ void CDBCtrlSheet::setupOutpostBuilding()
// If this is the same sheet, need to resetup // If this is the same sheet, need to resetup
if (_LastSheetId != sheet || _NeedSetup) if (_LastSheetId != sheet || _NeedSetup)
{ {
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_NeedSetup= false; _NeedSetup= false;
_LastSheetId = sheet; _LastSheetId = sheet;
@ -1747,7 +1747,7 @@ void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar
// Use the optString for the Macro name // Use the optString for the Macro name
_OptString = strlwr(_OptString); _OptString = strlwr(_OptString);
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_CharBitmaps.clear(); _CharBitmaps.clear();
@ -1804,7 +1804,7 @@ void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar
void CDBCtrlSheet::displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, CRGBA color) void CDBCtrlSheet::displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, CRGBA color)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
for (uint i = 0; i < _CharBitmaps.size(); ++i) for (uint i = 0; i < _CharBitmaps.size(); ++i)
{ {
@ -1820,7 +1820,7 @@ void CDBCtrlSheet::draw()
H_AUTO( RZ_Interface_CDBCtrlSheet_draw ) H_AUTO( RZ_Interface_CDBCtrlSheet_draw )
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA color = CRGBA(255,255,255,255); CRGBA color = CRGBA(255,255,255,255);
if (_Type != SheetType_Macro) if (_Type != SheetType_Macro)
@ -2091,7 +2091,7 @@ static inline CRGBA fastMulRGB(CRGBA sheetColor, CRGBA iconColor)
void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelectionBorder /*= true*/) void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelectionBorder /*= true*/)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// The sheet is the slot-2 // The sheet is the slot-2
sint32 wSheet= _WReal-2; sint32 wSheet= _WReal-2;
sint32 hSheet= _HReal-2; sint32 hSheet= _HReal-2;
@ -2548,7 +2548,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
sint32 CDBCtrlSheet::drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 /* hSheet */, CRGBA color, sint32 value, bool rightAlign) sint32 CDBCtrlSheet::drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 /* hSheet */, CRGBA color, sint32 value, bool rightAlign)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 wDigit= rVR.getFigurTextureW(); sint32 wDigit= rVR.getFigurTextureW();
sint32 hDigit= rVR.getFigurTextureH(); sint32 hDigit= rVR.getFigurTextureH();
@ -3927,7 +3927,7 @@ void CDBCtrlSheet::setInvertGuildSymbol(bool b)
void CDBCtrlSheet::setSlot(const std::string &textureName) void CDBCtrlSheet::setSlot(const std::string &textureName)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_DispSlotBmpId = rVR.getTextureIdFromName (textureName); _DispSlotBmpId = rVR.getTextureIdFromName (textureName);
rVR.getTextureSizeFromId (_DispSlotBmpId, _W, _H); rVR.getTextureSizeFromId (_DispSlotBmpId, _W, _H);
_DrawSlot = true; _DrawSlot = true;
@ -4262,7 +4262,7 @@ void CDBCtrlSheet::updateArmourColor(sint8 col)
if(_ArmourColorIndex>=0 && _ArmourColorIndex<=7) if(_ArmourColorIndex>=0 && _ArmourColorIndex<=7)
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CViewRenderer &rVR= pIM->getViewRenderer(); CViewRenderer &rVR= *CViewRenderer::getInstance();
// if the BMP have not been correctly setuped // if the BMP have not been correctly setuped
if(!_ArmourColorBmpOk) if(!_ArmourColorBmpOk)

View file

@ -94,7 +94,7 @@ bool CDBGroupBuildPhrase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
// Init the disabled texture id // Init the disabled texture id
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdSlotDisabled= rVR.getTextureIdFromName ("w_slot_brick_disabled.tga"); _TextureIdSlotDisabled= rVR.getTextureIdFromName ("w_slot_brick_disabled.tga");
// Create now (before sons ctrl sheet parsing) the variables // Create now (before sons ctrl sheet parsing) the variables

View file

@ -141,7 +141,7 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
} }
// get item size. // get item size.
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 dispSlotBmpId = 0; sint32 dispSlotBmpId = 0;
switch(_CtrlInfo._Type) switch(_CtrlInfo._Type)
{ {

View file

@ -56,7 +56,7 @@ bool CDBGroupListSheetBonusMalus::parse (xmlNodePtr cur, CInterfaceGroup *parent
if (prop) if (prop)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextId= rVR.getTextureIdFromName ((const char *)prop); _TextId= rVR.getTextureIdFromName ((const char *)prop);
} }
@ -86,7 +86,7 @@ void CDBGroupListSheetBonusMalus::draw ()
CDBGroupListSheet::draw(); CDBGroupListSheet::draw();
// CInterfaceManager *pIM= CInterfaceManager::getInstance(); // CInterfaceManager *pIM= CInterfaceManager::getInstance();
// CViewRenderer &rVR= pIM->getViewRenderer(); // CViewRenderer &rVR= *CViewRenderer::getInstance();
// sint32 drl= getRenderLayer()+1; // sint32 drl= getRenderLayer()+1;

View file

@ -125,7 +125,7 @@ bool CDBGroupListSheetText::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
} }
// get item size. // get item size.
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 dispSlotBmpId = 0; sint32 dispSlotBmpId = 0;
switch(_CtrlInfo._Type) switch(_CtrlInfo._Type)
{ {

View file

@ -120,7 +120,7 @@ void CDBViewBar::setType (TViewBar vb)
// Get the Height Size. // Get the Height Size.
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
sint32 wBar; sint32 wBar;
pIM->getViewRenderer().getTextureSizeFromId(_TextureId, wBar, _HBar); CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, wBar, _HBar);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -180,7 +180,7 @@ void CDBViewBar::draw ()
_Slot.draw(); _Slot.draw();
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
color.A = (uint8)(((sint32)color.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8); color.A = (uint8)(((sint32)color.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8);

View file

@ -141,7 +141,7 @@ void CDBViewBar3::updateCoords ()
// get the height of the texture // get the height of the texture
sint32 dummy; sint32 dummy;
CInterfaceManager::getInstance()->getViewRenderer().getTextureSizeFromId(_TextureId, dummy, _BarH); CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, dummy, _BarH);
CViewBitmap::updateCoords(); CViewBitmap::updateCoords();
} }
@ -162,7 +162,7 @@ void CDBViewBar3::draw ()
_Slot.draw(); _Slot.draw();
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA gColor = pIM->getGlobalColorForContent(); CRGBA gColor = pIM->getGlobalColorForContent();
if (_Mini) if (_Mini)

View file

@ -45,7 +45,7 @@ bool CDBViewDigit::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
return false; return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// link to the db // link to the db
CXMLAutoPtr ptr; CXMLAutoPtr ptr;
@ -103,7 +103,7 @@ void CDBViewDigit::updateCoords()
void CDBViewDigit::draw () void CDBViewDigit::draw ()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 wDigit= rVR.getFigurTextureW(); sint32 wDigit= rVR.getFigurTextureW();
sint32 hDigit= rVR.getFigurTextureH(); sint32 hDigit= rVR.getFigurTextureH();

View file

@ -61,7 +61,7 @@ bool CGroupContainer::_ValidateCanDeactivate = true;
#ifdef DRAW_GC_TEST_QUADS #ifdef DRAW_GC_TEST_QUADS
static void drawGCTestQuad(sint renderLayer, sint32 xreal, sint32 yreal, sint32 wreal, sint32 hreal, CRGBA color) static void drawGCTestQuad(sint renderLayer, sint32 xreal, sint32 yreal, sint32 wreal, sint32 hreal, CRGBA color)
{ {
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if(rVR.isMinimized()) if(rVR.isMinimized())
return; return;
sint32 x, y, w, h; sint32 x, y, w, h;
@ -348,7 +348,7 @@ sint32 CCtrlResizer::resizeW (sint32 dx)
NLMISC::clamp(clippedNewW, WMin, WMax); NLMISC::clamp(clippedNewW, WMin, WMax);
// clip by screen // clip by screen
uint32 sw, sh; uint32 sw, sh;
CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.getScreenSize(sw, sh); vr.getScreenSize(sw, sh);
if (_Parent->getPosRef() & Hotspot_xR) if (_Parent->getPosRef() & Hotspot_xR)
{ {
@ -405,7 +405,7 @@ sint32 CCtrlResizer::resizeH (sint32 dy)
// clip by screen // clip by screen
uint32 sw, sh; uint32 sw, sh;
CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.getScreenSize(sw, sh); vr.getScreenSize(sw, sh);
if (_Parent->getPosRef() & Hotspot_Tx) if (_Parent->getPosRef() & Hotspot_Tx)
{ {
@ -483,7 +483,7 @@ void CCtrlMover::draw ()
// No Op if window is minimized // No Op if window is minimized
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(pIM->getViewRenderer().isMinimized()) if(CViewRenderer::getInstance()->isMinimized())
return; return;
// draw insertion position if moving in parent list // draw insertion position if moving in parent list
@ -491,14 +491,14 @@ void CCtrlMover::draw ()
{ {
COptionsContainerInsertion *options = getInsertionOptions(); COptionsContainerInsertion *options = getInsertionOptions();
if (!options) return; if (!options) return;
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 oldSciX, oldSciY, oldSciW, oldSciH; sint32 oldSciX, oldSciY, oldSciW, oldSciH;
rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH);
uint32 sw, sh; uint32 sw, sh;
rVR.getScreenSize(sw, sh); rVR.getScreenSize(sw, sh);
rVR.setClipWindow (0, 0, (sint32) sw, (sint32) sh); rVR.setClipWindow (0, 0, (sint32) sw, (sint32) sh);
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
// //
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent); CGroupContainer *gc = dynamic_cast<CGroupContainer *>(_Parent);
if (!gc) return; if (!gc) return;
@ -807,7 +807,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event)
{ {
// clip, in real coords space // clip, in real coords space
uint32 wScreen, hScreen; uint32 wScreen, hScreen;
pIM->getViewRenderer().getScreenSize(wScreen, hScreen); CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen);
x+= _MoveDeltaXReal; x+= _MoveDeltaXReal;
y+= _MoveDeltaYReal; y+= _MoveDeltaYReal;
@ -1067,7 +1067,7 @@ void CCtrlMover::setPoped(CGroupContainer *gc, sint32 x, sint32 y, CInterfaceMan
sint32 newX = gc->getXReal() + deltaX; sint32 newX = gc->getXReal() + deltaX;
sint32 newY = gc->getYReal() + deltaY; sint32 newY = gc->getYReal() + deltaY;
uint32 wScreen, hScreen; uint32 wScreen, hScreen;
pIM->getViewRenderer().getScreenSize(wScreen, hScreen); CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen);
clamp(newX, 0, (sint32)wScreen - gc->getWReal()); clamp(newX, 0, (sint32)wScreen - gc->getWReal());
clamp(newY, 0, (sint32)hScreen - gc->getHReal()); clamp(newY, 0, (sint32)hScreen - gc->getHReal());
// move window // move window
@ -1516,7 +1516,7 @@ void CGroupContainer::updateCoords()
{ {
// Clip by screen // Clip by screen
uint32 sw, sh; uint32 sw, sh;
CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.getScreenSize(sw, sh); vr.getScreenSize(sw, sh);
// ensure the maxH is > minH and < sh (prioritary > minH, in case of sh<minh) // ensure the maxH is > minH and < sh (prioritary > minH, in case of sh<minh)
_PopupMaxH= min(_PopupMaxH, (sint32)sh); _PopupMaxH= min(_PopupMaxH, (sint32)sh);
@ -1530,7 +1530,7 @@ void CGroupContainer::updateCoords()
clamp(_H, _PopupMinH, _PopupMaxH); clamp(_H, _PopupMinH, _PopupMaxH);
// Clip by screen (but minw/minh is prioritary) // Clip by screen (but minw/minh is prioritary)
uint32 sw, sh; uint32 sw, sh;
CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.getScreenSize(sw, sh); vr.getScreenSize(sw, sh);
if((sint32)sw>_PopupMinW && _W>(sint32)sw) _W= sw; if((sint32)sw>_PopupMinW && _W>(sint32)sw) _W= sw;
if((sint32)sh>_PopupMinH && _H>(sint32)sh) _H= sh; if((sint32)sh>_PopupMinH && _H>(sint32)sh) _H= sh;
@ -1725,7 +1725,7 @@ void CGroupContainer::updateCoords()
{ {
// test if must clip // test if must clip
uint32 wScreen, hScreen; uint32 wScreen, hScreen;
CInterfaceManager::getInstance()->getViewRenderer().getScreenSize(wScreen, hScreen); CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen);
if (_WReal <= (sint32) wScreen && _HReal <= (sint32) hScreen) if (_WReal <= (sint32) wScreen && _HReal <= (sint32) hScreen)
{ {
sint32 newX = _XReal; sint32 newX = _XReal;
@ -1849,7 +1849,7 @@ void CGroupContainer::draw ()
makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH);
// Draw the container // Draw the container
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col = pIM->getGlobalColor(); CRGBA col = pIM->getGlobalColor();
bool bGrayed = isGrayed(); bool bGrayed = isGrayed();

View file

@ -109,7 +109,7 @@ bool CGroupEditBox::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
return false; return false;
CXMLAutoPtr prop; CXMLAutoPtr prop;
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
if (! CInterfaceGroup::parse(cur,parentGroup) ) if (! CInterfaceGroup::parse(cur,parentGroup) )
{ {
@ -219,7 +219,7 @@ void CGroupEditBox::draw ()
{ {
// //
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// //
/*CRGBA col; /*CRGBA col;
col.modulateFromColor(CRGBA(64,64,64,255), pIM->getGlobalColorForContent()); col.modulateFromColor(CRGBA(64,64,64,255), pIM->getGlobalColorForContent());
@ -335,7 +335,7 @@ void CGroupEditBox::copy()
stopParentBlink(); stopParentBlink();
// get the selection and copy it // get the selection and copy it
if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->copyTextToClipboard(getSelection())) if (CViewRenderer::getInstance()->getDriver()->copyTextToClipboard(getSelection()))
nlinfo ("Chat input was copied in the clipboard"); nlinfo ("Chat input was copied in the clipboard");
} }
@ -353,7 +353,7 @@ void CGroupEditBox::paste()
ucstring sString; ucstring sString;
if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->pasteTextFromClipboard(sString)) if (CViewRenderer::getInstance()->getDriver()->pasteTextFromClipboard(sString))
{ {
// append string now // append string now
appendStringFromClipboard(sString); appendStringFromClipboard(sString);

View file

@ -72,7 +72,7 @@ bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
// Get the borders texture // Get the borders texture
_DispTypeDefined= false; _DispTypeDefined= false;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
CInterfaceOptions *pIO = NULL; CInterfaceOptions *pIO = NULL;
@ -160,7 +160,7 @@ void CGroupFrame::draw ()
if (_DisplayFrame) if (_DisplayFrame)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// get global color // get global color
CRGBA col; CRGBA col;

View file

@ -2737,7 +2737,7 @@ CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/
{ {
// search in the compressed texture // search in the compressed texture
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 id = rVR.getTextureIdFromName(normal); sint32 id = rVR.getTextureIdFromName(normal);
if(id == -1) if(id == -1)
{ {
@ -2757,7 +2757,7 @@ CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/
{ {
// search in the compressed texture // search in the compressed texture
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 id = rVR.getTextureIdFromName(pushed); sint32 id = rVR.getTextureIdFromName(pushed);
if(id == -1) if(id == -1)
{ {
@ -3031,7 +3031,7 @@ bool CGroupHTML::lookupLocalFile (string &result, const char *url, bool isUrl)
{ {
// Is it a texture in the big texture ? // Is it a texture in the big texture ?
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (pIM->getViewRenderer().getTextureIdFromName (result) >= 0) if (CViewRenderer::getInstance()->getTextureIdFromName (result) >= 0)
{ {
return true; return true;
} }

View file

@ -78,7 +78,7 @@ void CGroupInScene::computeWindowPos(sint32 &newX, sint32 &newY, CVector &newPro
if(getActive()) if(getActive())
{ {
CViewRenderer &pVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &pVR = *CViewRenderer::getInstance();
nlassert(isValidDouble(Position.x) && isValidDouble(Position.y) && isValidDouble(Position.z)); nlassert(isValidDouble(Position.x) && isValidDouble(Position.y) && isValidDouble(Position.z));
CVector tmp = MainSceneViewMatrix * Position; CVector tmp = MainSceneViewMatrix * Position;
if (tmp.y>=0.001) if (tmp.y>=0.001)
@ -86,8 +86,8 @@ void CGroupInScene::computeWindowPos(sint32 &newX, sint32 &newY, CVector &newPro
tmp = pVR.getFrustum().projectZ (tmp); tmp = pVR.getFrustum().projectZ (tmp);
// Get the width and height // Get the width and height
tmp.x *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowWidth(); tmp.x *= (float)CViewRenderer::getInstance()->getDriver()->getWindowWidth();
tmp.y *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowHeight(); tmp.y *= (float)CViewRenderer::getInstance()->getDriver()->getWindowHeight();
// position without offset, in float // position without offset, in float
newProjCenter.x= tmp.x; newProjCenter.x= tmp.x;
@ -156,7 +156,7 @@ void CGroupInScene::draw()
if (_ProjCenter.z > NearDrawClip) if (_ProjCenter.z > NearDrawClip)
{ {
CViewRenderer &pVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &pVR = *CViewRenderer::getInstance();
// Set the current Z, and projCenter / scale // Set the current Z, and projCenter / scale
if(_UserScale) if(_UserScale)

View file

@ -667,7 +667,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont
if (target) if (target)
{ {
// Find a position // Find a position
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
const uint width = Driver->getWindowWidth(); const uint width = Driver->getWindowWidth();
const uint height = Driver->getWindowHeight(); const uint height = Driver->getWindowHeight();
h = (target->getXReal() < ((sint)width-target->getXReal()-target->getWReal()))?"l":"r"; h = (target->getXReal() < ((sint)width-target->getXReal()-target->getWReal()))?"l":"r";

View file

@ -566,12 +566,12 @@ void CGroupList::updateCoords()
void CGroupList::draw () void CGroupList::draw ()
{ {
// TEMP TEMP // TEMP TEMP
//CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); //CViewRenderer &rVR = *CViewRenderer::getInstance();
//rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0, 255, 0, 255) ); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0, 255, 0, 255) );
if (_Over) if (_Over)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (CWidgetManager::getInstance()->getModalWindow() == NULL) if (CWidgetManager::getInstance()->getModalWindow() == NULL)
{ {

View file

@ -257,7 +257,7 @@ float CGroupMap::getActualMaxScale() const
void CGroupMap::CPolyButton::drawPolyButton() void CGroupMap::CPolyButton::drawPolyButton()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
float oow, ooh; float oow, ooh;
rVR.getScreenOOSize(oow, ooh); rVR.getScreenOOSize(oow, ooh);
@ -1470,7 +1470,7 @@ void CGroupMap::draw()
sint32 oldSciX, oldSciY, oldSciW, oldSciH; sint32 oldSciX, oldSciY, oldSciW, oldSciH;
makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH);
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
uint8 alpha = im->getGlobalColorForContent().A; uint8 alpha = im->getGlobalColorForContent().A;
updateScale(); updateScale();

View file

@ -208,7 +208,7 @@ void CGroupSubMenu::initOptions(CInterfaceGroup *parent)
{ {
_SelectionView = new CViewBitmap(CViewBase::TCtorParam()); _SelectionView = new CViewBitmap(CViewBase::TCtorParam());
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_SelectionView->setParent (this); _SelectionView->setParent (this);
_SelectionView->setActive (false); _SelectionView->setActive (false);
_SelectionView->setTexture ("blank.tga"); _SelectionView->setTexture ("blank.tga");
@ -437,7 +437,7 @@ void CGroupSubMenu::updateCoords ()
setY(_GroupMenu->SpawnMouseY); setY(_GroupMenu->SpawnMouseY);
CGroupFrame::updateCoords(); CGroupFrame::updateCoords();
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 screenW, screenH; uint32 screenW, screenH;
rVR.getScreenSize(screenW, screenH); rVR.getScreenSize(screenW, screenH);
if ((_XReal+_WReal) > (sint32)screenW) if ((_XReal+_WReal) > (sint32)screenW)
@ -458,7 +458,7 @@ void CGroupSubMenu::updateCoords ()
CGroupFrame::updateCoords(); CGroupFrame::updateCoords();
// get screen size // get screen size
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 screenW, screenH; uint32 screenW, screenH;
rVR.getScreenSize(screenW, screenH); rVR.getScreenSize(screenW, screenH);
@ -673,7 +673,7 @@ void CGroupSubMenu::updateCoords ()
_SubMenus[RALineNb]->setParentPos (this); _SubMenus[RALineNb]->setParentPos (this);
// According to mouse position, set the sub menu on the left or right, begin at top or bottom // According to mouse position, set the sub menu on the left or right, begin at top or bottom
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 screenW, screenH; uint32 screenW, screenH;
rVR.getScreenSize(screenW, screenH); rVR.getScreenSize(screenW, screenH);
if ((_GroupMenu->SpawnMouseX <= ((sint32)screenW/2)) && (_GroupMenu->SpawnMouseY <= ((sint32)screenH/2))) if ((_GroupMenu->SpawnMouseX <= ((sint32)screenW/2)) && (_GroupMenu->SpawnMouseY <= ((sint32)screenH/2)))
@ -875,7 +875,7 @@ void CGroupSubMenu::checkCoords()
(yMouse <= (_YReal+ _HReal)))) (yMouse <= (_YReal+ _HReal))))
_Selected= -1; _Selected= -1;
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
// Highlight (background under the selection) // Highlight (background under the selection)
if (_Selected != -1) if (_Selected != -1)
@ -2060,7 +2060,7 @@ void CGroupMenu::recurseDraw(CGroupSubMenu *pSubMenu)
if (pGSM != NULL) if (pGSM != NULL)
{ {
recurseDraw(pGSM); recurseDraw(pGSM);
CInterfaceManager::getInstance()->getViewRenderer().flush(); CViewRenderer::getInstance()->flush();
} }
} }
} }
@ -2071,7 +2071,7 @@ void CGroupMenu::draw ()
if (!_Active) return; if (!_Active) return;
// TEMP TEMP // TEMP TEMP
//CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); //CViewRenderer &rVR = *CViewRenderer::getInstance();
//rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(255, 0, 0, 255) ); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(255, 0, 0, 255) );
_RootMenu->_Active = true; _RootMenu->_Active = true;
@ -2105,7 +2105,7 @@ void CGroupMenu::setActive (bool state)
{ {
if (SpawnOnMousePos) if (SpawnOnMousePos)
{ {
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 w,h; uint32 w,h;
rVR.getScreenSize(w,h); rVR.getScreenSize(w,h);
setW(w); setW(w);

View file

@ -100,7 +100,7 @@ void CGroupModal::updateCoords ()
if(SpawnOnMousePos) if(SpawnOnMousePos)
{ {
// Special for menu for instance: If the size is bigger or equal to the screen, keep 0, because will be clipped just after // Special for menu for instance: If the size is bigger or equal to the screen, keep 0, because will be clipped just after
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 w,h; uint32 w,h;
rVR.getScreenSize(w,h); rVR.getScreenSize(w,h);
if(_W>=(sint32)w && _H>=(sint32)h) if(_W>=(sint32)w && _H>=(sint32)h)

View file

@ -766,12 +766,12 @@ void CGroupParagraph::checkCoords ()
void CGroupParagraph::draw () void CGroupParagraph::draw ()
{ {
// TEMP TEMP // TEMP TEMP
//CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); //CViewRenderer &rVR = *CViewRenderer::getInstance();
//rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,0,255) ); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,0,255) );
if (_Over) if (_Over)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (CWidgetManager::getInstance()->getModalWindow() == NULL) if (CWidgetManager::getInstance()->getModalWindow() == NULL)
{ {

View file

@ -195,7 +195,7 @@ void CGroupCell::draw ()
if (DebugUICell) if (DebugUICell)
{ {
// Draw cell // Draw cell
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) );
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, 1, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, 1, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) );
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal+_HReal-1, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal+_HReal-1, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) );
@ -205,7 +205,7 @@ void CGroupCell::draw ()
// Draw the background // Draw the background
if (_UserTexture || BgColor.A != 0) if (_UserTexture || BgColor.A != 0)
{ {
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (_UserTexture) if (_UserTexture)
{ {
CRGBA col; CRGBA col;
@ -950,7 +950,7 @@ void CGroupTable::draw ()
finalColor.A = CurrentAlpha; finalColor.A = CurrentAlpha;
// Draw the top and bottom lines // Draw the top and bottom lines
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor);
rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal-border+_HReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal-border+_HReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor);

View file

@ -476,7 +476,7 @@ bool CGroupTree::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
_RootNode->Opened = true; _RootNode->Opened = true;
_ResizeFromChildW = _ResizeFromChildH = true; _ResizeFromChildW = _ResizeFromChildH = true;
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 id = rVR.getTextureIdFromName(_ArboOpenFirst); sint32 id = rVR.getTextureIdFromName(_ArboOpenFirst);
if (id != -1) if (id != -1)
rVR.getTextureSizeFromId(id, _BmpW, _BmpH); rVR.getTextureSizeFromId(id, _BmpW, _BmpH);
@ -522,7 +522,7 @@ void CGroupTree::updateCoords()
void CGroupTree::drawSelection(sint x, sint y, sint w, CRGBA col) void CGroupTree::drawSelection(sint x, sint y, sint w, CRGBA col)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if(!_RectangleOutlineMode) if(!_RectangleOutlineMode)
{ {
@ -557,7 +557,7 @@ CGroupTree::SNode *CGroupTree::getNodeUnderMouse() const
void CGroupTree::draw() void CGroupTree::draw()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
// get the clip area // get the clip area
sint32 clipx, clipy, clipw, cliph; sint32 clipx, clipy, clipw, cliph;

View file

@ -163,13 +163,13 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
UserControls.stopFreeLook(); UserControls.stopFreeLook();
} }
// be nice with other app : let the mouse reappear (useful in direct 3D mode with no hardware cursor) // be nice with other app : let the mouse reappear (useful in direct 3D mode with no hardware cursor)
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(true); CViewRenderer::getInstance()->getDriver()->showCursor(true);
// Driver->setSystemArrow(); // Driver->setSystemArrow();
} }
else else
{ {
_RecoverFocusLost = true; // force to update mouse pos on next click or move _RecoverFocusLost = true; // force to update mouse pos on next click or move
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(IsMouseCursorHardware()); CViewRenderer::getInstance()->getDriver()->showCursor(IsMouseCursorHardware());
_Focus = true; _Focus = true;
} }

View file

@ -78,7 +78,7 @@ CInterface3DScene::~CInterface3DScene()
for (i = 0; i < _FXs.size(); ++i) for (i = 0; i < _FXs.size(); ++i)
delete _FXs[i]; delete _FXs[i];
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if (_Scene != NULL) if (_Scene != NULL)
Driver->deleteScene (_Scene); Driver->deleteScene (_Scene);
@ -172,7 +172,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
return true; return true;
} }
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
nlassert ( Driver != NULL); nlassert ( Driver != NULL);
_Scene = Driver->createScene(true); _Scene = Driver->createScene(true);
@ -299,7 +299,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
if (!animName.empty()) if (!animName.empty())
{ {
if (_AutoAnimSet == NULL) if (_AutoAnimSet == NULL)
_AutoAnimSet = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet(); _AutoAnimSet = CViewRenderer::getInstance()->getDriver()->createAnimationSet();
uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ()); uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ());
if (id == UAnimationSet::NotFound) if (id == UAnimationSet::NotFound)
{ {
@ -378,14 +378,14 @@ void CInterface3DScene::draw ()
{ {
H_AUTO( RZ_Interface_CInterface3DScene_draw ) H_AUTO( RZ_Interface_CInterface3DScene_draw )
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver();
if ( Driver == NULL) if ( Driver == NULL)
return; return;
// No Op if screen minimized // No Op if screen minimized
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if(rVR.isMinimized()) if(rVR.isMinimized())
return; return;
@ -438,7 +438,7 @@ void CInterface3DScene::draw ()
float vpW = (float) clipw / iavoid0(wsw); float vpW = (float) clipw / iavoid0(wsw);
float vpH = (float) cliph / iavoid0(wsh); float vpH = (float) cliph / iavoid0(wsh);
newVP.init(vpX, vpY, vpW, vpH); newVP.init(vpX, vpY, vpW, vpH);
NL3D::CFrustum oldFrustum = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getFrustum(); NL3D::CFrustum oldFrustum = CViewRenderer::getInstance()->getDriver()->getFrustum();
NL3D::CFrustum newFrustum; NL3D::CFrustum newFrustum;
newFrustum.initPerspective (pI3DCam->getFOV() * (float) (NLMISC::Pi / 180), (float) _WReal / iavoid0(_HReal), 0.1f, 100.f); newFrustum.initPerspective (pI3DCam->getFOV() * (float) (NLMISC::Pi / 180), (float) _WReal / iavoid0(_HReal), 0.1f, 100.f);
@ -540,7 +540,7 @@ void CInterface3DScene::draw ()
Driver->setFrustum(oldFrustum); Driver->setFrustum(oldFrustum);
// Restaure render states // Restaure render states
pIM->getViewRenderer().setRenderStates(); CViewRenderer::getInstance()->setRenderStates();
restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); restoreClip (oldSciX, oldSciY, oldSciW, oldSciH);
} }
@ -1097,7 +1097,7 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
setRotX (_Rot.x); setRotX (_Rot.x);
setRotY (_Rot.y); setRotY (_Rot.y);
setRotZ (_Rot.z); setRotZ (_Rot.z);
_IG->addToScene (*parentGroup->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); _IG->addToScene (*parentGroup->getScene(), CViewRenderer::getInstance()->getDriver() );
parentGroup->getScene()->setToGlobalInstanceGroup (_IG); parentGroup->getScene()->setToGlobalInstanceGroup (_IG);
return true; return true;
@ -1218,7 +1218,7 @@ void CInterface3DIG::setName (const std::string &ht)
_IG = UInstanceGroup::createInstanceGroup(_Name); _IG = UInstanceGroup::createInstanceGroup(_Name);
if (_IG == NULL) return; if (_IG == NULL) return;
_IG->setPos (_Pos); _IG->setPos (_Pos);
_IG->addToScene (*pI3DS->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); _IG->addToScene (*pI3DS->getScene(), CViewRenderer::getInstance()->getDriver() );
pI3DS->getScene()->setToGlobalInstanceGroup (_IG); pI3DS->getScene()->setToGlobalInstanceGroup (_IG);
} }
} }

View file

@ -1001,7 +1001,7 @@ void CInterfaceElement::center()
{ {
// center the pc // center the pc
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
uint32 sw, sh; uint32 sw, sh;
vr.getScreenSize(sw, sh); vr.getScreenSize(sw, sh);
setX(sw / 2 - getWReal() / 2); setX(sw / 2 - getWReal() / 2);
@ -1025,7 +1025,7 @@ void CInterfaceElement::renderWiredQuads(TRenderWired type, const std::string &u
) )
return; return;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.drawWiredQuad(_XReal, _YReal, _WReal, _HReal); vr.drawWiredQuad(_XReal, _YReal, _WReal, _HReal);
drawHotSpot(_PosRef, CRGBA::Red); drawHotSpot(_PosRef, CRGBA::Red);
if (_Parent) _Parent->drawHotSpot(_ParentPosRef, CRGBA::Blue); if (_Parent) _Parent->drawHotSpot(_ParentPosRef, CRGBA::Blue);
@ -1064,7 +1064,7 @@ void CInterfaceElement::drawHotSpot(THotSpot hs, CRGBA col)
px = _XReal + _WReal - radius; px = _XReal + _WReal - radius;
} }
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.drawFilledQuad(px - radius, py - radius, radius * 2, radius * 2, col); vr.drawFilledQuad(px - radius, py - radius, radius * 2, radius * 2, col);
} }

View file

@ -787,7 +787,7 @@ void CInterfaceGroup::draw ()
makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH);
// Display sons only if not total clipped // Display sons only if not total clipped
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if( !rVR.isClipWindowEmpty() ) if( !rVR.isClipWindowEmpty() )
{ {
// Draw all decorative elements // Draw all decorative elements
@ -807,7 +807,7 @@ void CInterfaceGroup::draw ()
void CInterfaceGroup::drawNoClip() void CInterfaceGroup::drawNoClip()
{ {
// Display sons only if not total clipped // Display sons only if not total clipped
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if( !rVR.isClipWindowEmpty() ) if( !rVR.isClipWindowEmpty() )
{ {
// Draw all decorative elements // Draw all decorative elements
@ -1417,7 +1417,7 @@ void CInterfaceGroup::computeCurrentClipContribution(sint32 oldSciX, sint32 oldS
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::makeNewClip (sint32 &oldSciX, sint32 &oldSciY, sint32 &oldSciW, sint32 &oldSciH) void CInterfaceGroup::makeNewClip (sint32 &oldSciX, sint32 &oldSciY, sint32 &oldSciW, sint32 &oldSciH)
{ {
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH);
sint32 newSciX, newSciY, newSciW, newSciH; sint32 newSciX, newSciY, newSciW, newSciH;
@ -1428,7 +1428,7 @@ void CInterfaceGroup::makeNewClip (sint32 &oldSciX, sint32 &oldSciY, sint32 &old
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const void CInterfaceGroup::getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const
{ {
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 sw, sh; uint32 sw, sh;
rVR.getScreenSize(sw, sh); rVR.getScreenSize(sw, sh);
sint32 sciX = 0, sciY = 0, sciW = sw, sciH =sh; sint32 sciX = 0, sciY = 0, sciW = sw, sciH =sh;
@ -1447,7 +1447,7 @@ void CInterfaceGroup::getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::restoreClip (sint32 oldSciX, sint32 oldSciY, sint32 oldSciW, sint32 oldSciH) void CInterfaceGroup::restoreClip (sint32 oldSciX, sint32 oldSciY, sint32 oldSciW, sint32 oldSciH)
{ {
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.setClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); rVR.setClipWindow (oldSciX, oldSciY, oldSciW, oldSciH);
} }

View file

@ -254,11 +254,14 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG )
#endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS #endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) : CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext )
_ViewRenderer( driver, textcontext )
{ {
this->driver = driver; this->driver = driver;
this->textcontext = textcontext; this->textcontext = textcontext;
CViewRenderer::setDriver( driver );
CViewRenderer::setTextContext( textcontext );
CViewRenderer::getInstance();
_Instance = this; _Instance = this;
NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS ); NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS );
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater(); interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
@ -298,8 +301,8 @@ _ViewRenderer( driver, textcontext )
// ********************* // *********************
// Interface Manager init // Interface Manager init
_ViewRenderer.checkNewScreenSize(); CViewRenderer::getInstance()->checkNewScreenSize();
_ViewRenderer.init(); CViewRenderer::getInstance()->init();
_CurrentMode = 0; _CurrentMode = 0;
@ -370,7 +373,7 @@ CInterfaceManager::~CInterfaceManager()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::reset() void CInterfaceManager::reset()
{ {
_ViewRenderer.reset(); CViewRenderer::getInstance()->reset();
_CtrlsUnderPointer.clear(); _CtrlsUnderPointer.clear();
CWidgetManager::getInstance()->setCurContextHelp( NULL ); CWidgetManager::getInstance()->setCurContextHelp( NULL );
_ViewsUnderPointer.clear(); _ViewsUnderPointer.clear();
@ -645,7 +648,7 @@ void CInterfaceManager::uninitOutGame()
void badXMLParseMessageBox() void badXMLParseMessageBox()
{ {
NL3D::UDriver *driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); NL3D::UDriver *driver = CViewRenderer::getInstance()->getDriver();
NL3D::UDriver::TMessageBoxId ret = driver->systemMessageBox( "Interface XML reading failed!\n" NL3D::UDriver::TMessageBoxId ret = driver->systemMessageBox( "Interface XML reading failed!\n"
"Some XML files are corrupted and may have been removed.\n" "Some XML files are corrupted and may have been removed.\n"
"Ryzom may need to be restarted to run properly.\n" "Ryzom may need to be restarted to run properly.\n"
@ -1366,7 +1369,7 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera)
H_AUTO ( RZ_Interface_updateFrameViews ) H_AUTO ( RZ_Interface_updateFrameViews )
if (!camera.empty()) if (!camera.empty())
_ViewRenderer.setWorldSpaceFrustum (camera.getFrustum()); CViewRenderer::getInstance()->setWorldSpaceFrustum (camera.getFrustum());
checkCoords(); checkCoords();
drawViews(camera); drawViews(camera);
@ -1452,7 +1455,7 @@ bool CInterfaceManager::parseInterface (const std::vector<std::string> &xmlFileN
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::loadTextures (const string &textFileName, const string &uvFileName, bool uploadDXTC) void CInterfaceManager::loadTextures (const string &textFileName, const string &uvFileName, bool uploadDXTC)
{ {
_ViewRenderer.loadTextures (textFileName, uvFileName, uploadDXTC); CViewRenderer::getInstance()->loadTextures (textFileName, uvFileName, uploadDXTC);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1473,7 +1476,7 @@ bool CInterfaceManager::loadConfig (const string &filename)
{ {
uint32 w,h; uint32 w,h;
// NB: even if minimzed, getScreenSize() no more return 0 values (return the last setuped screen size) // NB: even if minimzed, getScreenSize() no more return 0 values (return the last setuped screen size)
_ViewRenderer.getScreenSize(w, h); CViewRenderer::getInstance()->getScreenSize(w, h);
// Windows are positioned according to resolution, and we must backup W/H for the system that move windows when the resolution change // Windows are positioned according to resolution, and we must backup W/H for the system that move windows when the resolution change
_LastInGameScreenW= w; _LastInGameScreenW= w;
_LastInGameScreenH= h; _LastInGameScreenH= h;
@ -1912,7 +1915,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
{ {
H_AUTO ( RZ_Interface_DrawViews_Setup ) H_AUTO ( RZ_Interface_DrawViews_Setup )
_ViewRenderer.activateWorldSpaceMatrix (false); CViewRenderer::getInstance()->activateWorldSpaceMatrix (false);
IngameDbMngr.flushObserverCalls(); IngameDbMngr.flushObserverCalls();
NLGUI::CDBManager::getInstance()->flushObserverCalls(); NLGUI::CDBManager::getInstance()->flushObserverCalls();
@ -1934,12 +1937,12 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
} }
// Check if screen size changed // Check if screen size changed
uint32 w, h; uint32 w, h;
_ViewRenderer.checkNewScreenSize (); CViewRenderer::getInstance()->checkNewScreenSize ();
_ViewRenderer.getScreenSize (w, h); CViewRenderer::getInstance()->getScreenSize (w, h);
if ((w != _ScreenW) || (h != _ScreenH)) if ((w != _ScreenW) || (h != _ScreenH))
{ {
// No Op if screen minimized // No Op if screen minimized
if(w!=0 && h!=0 && !_ViewRenderer.isMinimized()) if(w!=0 && h!=0 && !CViewRenderer::getInstance()->isMinimized())
{ {
updateAllLocalisedElements (); updateAllLocalisedElements ();
_ScreenW = w; _ScreenW = w;
@ -2006,7 +2009,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
driver->setViewMatrix(CMatrix::Identity); driver->setViewMatrix(CMatrix::Identity);
driver->setModelMatrix(CMatrix::Identity); driver->setModelMatrix(CMatrix::Identity);
driver->setFrustum(camera.getFrustum()); driver->setFrustum(camera.getFrustum());
_ViewRenderer.activateWorldSpaceMatrix (true); CViewRenderer::getInstance()->activateWorldSpaceMatrix (true);
} }
list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority]; list<CInterfaceGroup*> &rList = rMG.PrioritizedWindows[nPriority];
@ -2022,7 +2025,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
// Draw all the elements of this window in the layers in ViewRendered // Draw all the elements of this window in the layers in ViewRendered
pIG->draw (); pIG->draw ();
// flush the layers // flush the layers
_ViewRenderer.flush (); CViewRenderer::getInstance()->flush ();
} }
} }
} }
@ -2030,7 +2033,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty()) if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty())
{ {
driver->setMatrixMode2D11(); driver->setMatrixMode2D11();
_ViewRenderer.activateWorldSpaceMatrix (false); CViewRenderer::getInstance()->activateWorldSpaceMatrix (false);
} }
} }
} }
@ -2066,7 +2069,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
// if the control support CopyDrag, and if copy key pressed, display a tiny "+" // if the control support CopyDrag, and if copy key pressed, display a tiny "+"
if(pCS->canDragCopy() && testDragCopyKey()) if(pCS->canDragCopy() && testDragCopyKey())
{ {
CViewRenderer &rVR = getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint w= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture); sint w= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture);
sint h= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture); sint h= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture);
rVR.draw11RotFlipBitmap (pCS->getRenderLayer()+1, x-w/2, y-h/2, 0, false, rVR.draw11RotFlipBitmap (pCS->getRenderLayer()+1, x-w/2, y-h/2, 0, false,
@ -2083,7 +2086,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
} }
// flush layers // flush layers
_ViewRenderer.flush(); CViewRenderer::getInstance()->flush();
// todo hulud remove Return in 2d world // todo hulud remove Return in 2d world
driver->setMatrixMode2D11(); driver->setMatrixMode2D11();
@ -2374,7 +2377,7 @@ void CInterfaceManager::drawContextHelp ()
groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw (); groupContextHelp->draw ();
// flush layers // flush layers
_ViewRenderer.flush(); CViewRenderer::getInstance()->flush();
} }
} }
else else
@ -2382,7 +2385,7 @@ void CInterfaceManager::drawContextHelp ()
groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw (); groupContextHelp->draw ();
// flush layers // flush layers
_ViewRenderer.flush(); CViewRenderer::getInstance()->flush();
} }
} }
else else
@ -2390,7 +2393,7 @@ void CInterfaceManager::drawContextHelp ()
groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw (); groupContextHelp->draw ();
// flush layers // flush layers
_ViewRenderer.flush(); CViewRenderer::getInstance()->flush();
} }
} }
} }
@ -3023,7 +3026,7 @@ bool CInterfaceManager::handleMouseMoveEvent( const NLGUI::CEventDescriptor &eve
nlassert( e.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousemove ); nlassert( e.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousemove );
uint32 screenW, screenH; uint32 screenW, screenH;
_ViewRenderer.getScreenSize( screenW, screenH ); CViewRenderer::getInstance()->getScreenSize( screenW, screenH );
sint32 oldX = CWidgetManager::getInstance()->getPointer()->getX(); sint32 oldX = CWidgetManager::getInstance()->getPointer()->getX();
sint32 oldY = CWidgetManager::getInstance()->getPointer()->getY(); sint32 oldY = CWidgetManager::getInstance()->getPointer()->getY();
@ -3054,7 +3057,7 @@ void CInterfaceManager::movePointer (sint32 dx, sint32 dy)
uint32 nScrW, nScrH; uint32 nScrW, nScrH;
sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy; sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy;
_ViewRenderer.getScreenSize (nScrW, nScrH); CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
_Pointer->getPointerPos (oldpx, oldpy); _Pointer->getPointerPos (oldpx, oldpy);
olddisppx = oldpx; olddisppx = oldpx;
@ -3089,7 +3092,7 @@ void CInterfaceManager::movePointerAbs(sint32 px, sint32 py)
{ {
if (!CWidgetManager::getInstance()->getPointer()) return; if (!CWidgetManager::getInstance()->getPointer()) return;
uint32 nScrW, nScrH; uint32 nScrW, nScrH;
_ViewRenderer.getScreenSize (nScrW, nScrH); CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH);
clamp(px, 0, (sint32) nScrW); clamp(px, 0, (sint32) nScrW);
clamp(py, 0, (sint32) nScrH); clamp(py, 0, (sint32) nScrH);
// //
@ -3256,8 +3259,8 @@ void CInterfaceManager::updateAllLocalisedElements()
uint32 nMasterGroup; uint32 nMasterGroup;
uint32 w, h; uint32 w, h;
_ViewRenderer.checkNewScreenSize (); CViewRenderer::getInstance()->checkNewScreenSize ();
_ViewRenderer.getScreenSize (w, h); CViewRenderer::getInstance()->getScreenSize (w, h);
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
@ -3268,7 +3271,7 @@ void CInterfaceManager::updateAllLocalisedElements()
rMG.Group->setW (w); rMG.Group->setW (w);
rMG.Group->setH (h); rMG.Group->setH (h);
} }
_ViewRenderer.setClipWindow(0, 0, w, h); CViewRenderer::getInstance()->setClipWindow(0, 0, w, h);
// If all conditions are OK, move windows so they fit correctly with new screen size // If all conditions are OK, move windows so they fit correctly with new screen size
// Do this work only InGame when Config is loaded // Do this work only InGame when Config is loaded
@ -3464,13 +3467,13 @@ void CInterfaceManager::getViewsUnder (sint32 x, sint32 y, std::vector<CViewBase
vVB.clear (); vVB.clear ();
// No Op if screen minimized // No Op if screen minimized
if(_ViewRenderer.isMinimized()) if(CViewRenderer::getInstance()->isMinimized())
return; return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh; uint32 sw, sh;
_ViewRenderer.getScreenSize(sw, sh); CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{ {
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
@ -3502,13 +3505,13 @@ void CInterfaceManager::getCtrlsUnder (sint32 x, sint32 y, std::vector<CCtrlBase
vICL.clear (); vICL.clear ();
// No Op if screen minimized // No Op if screen minimized
if(_ViewRenderer.isMinimized()) if(CViewRenderer::getInstance()->isMinimized())
return; return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh; uint32 sw, sh;
_ViewRenderer.getScreenSize(sw, sh); CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{ {
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
@ -3542,13 +3545,13 @@ void CInterfaceManager::getGroupsUnder (sint32 x, sint32 y, std::vector<CInterfa
vIGL.clear (); vIGL.clear ();
// No Op if screen minimized // No Op if screen minimized
if(_ViewRenderer.isMinimized()) if(CViewRenderer::getInstance()->isMinimized())
return; return;
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
uint32 sw, sh; uint32 sw, sh;
_ViewRenderer.getScreenSize(sw, sh); CViewRenderer::getInstance()->getScreenSize(sw, sh);
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{ {
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
@ -4744,7 +4747,7 @@ void CInterfaceManager::drawOverExtendViewText()
// draw // draw
groupOver->draw (); groupOver->draw ();
// flush layers // flush layers
_ViewRenderer.flush(); CViewRenderer::getInstance()->flush();
} }
} }
@ -6126,7 +6129,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext ) void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext )
{ {
this->textcontext = textcontext; this->textcontext = textcontext;
_ViewRenderer.setTextContext( textcontext ); CViewRenderer::getInstance()->setTextContext( textcontext );
} }

View file

@ -49,6 +49,8 @@
#include "../string_manager_client.h" #include "../string_manager_client.h"
#include "yubo_chat.h" #include "yubo_chat.h"
#include "../ingame_database_manager.h"
static const float ROLLOVER_MIN_DELTA_PER_MS = 0.28f; static const float ROLLOVER_MIN_DELTA_PER_MS = 0.28f;
static const float ROLLOVER_MAX_DELTA_PER_MS = 0.12f; static const float ROLLOVER_MAX_DELTA_PER_MS = 0.12f;
@ -302,7 +304,6 @@ public:
void drawContextHelp (); void drawContextHelp ();
//void drawContextMenu (); //void drawContextMenu ();
CViewRenderer &getViewRenderer () { return _ViewRenderer; }
void setGlobalColor (NLMISC::CRGBA col); void setGlobalColor (NLMISC::CRGBA col);
NLMISC::CRGBA getGlobalColor() { return _GlobalColor; } NLMISC::CRGBA getGlobalColor() { return _GlobalColor; }
void setContentAlpha(uint8 alpha); void setContentAlpha(uint8 alpha);
@ -821,8 +822,6 @@ private:
}; };
std::vector<SIDStringWaiter*> _IDStringWaiters; std::vector<SIDStringWaiter*> _IDStringWaiters;
/// Renderer
CViewRenderer _ViewRenderer;
uint32 _ScreenW, _ScreenH; // Change res detection uint32 _ScreenW, _ScreenH; // Change res detection
NLMISC::CRGBA _GlobalColor; NLMISC::CRGBA _GlobalColor;
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface

View file

@ -169,7 +169,7 @@ bool COptionsLayer::parse (xmlNodePtr cur)
return false; return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
Tile_Blank = getValSInt32("tile_blank"); Tile_Blank = getValSInt32("tile_blank");
Tile_M_Header = getValSInt32("tile_m_header"); Tile_M_Header = getValSInt32("tile_m_header");
@ -267,7 +267,7 @@ bool COptionsContainerInsertion::parse(xmlNodePtr cur)
return false; return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
TxId_T_Arrow = rVR.getTextureIdFromName (getValStr("arrow_top")); TxId_T_Arrow = rVR.getTextureIdFromName (getValStr("arrow_top"));
TxId_B_Arrow = rVR.getTextureIdFromName (getValStr("arrow_down")); TxId_B_Arrow = rVR.getTextureIdFromName (getValStr("arrow_down"));
TxId_L_Arrow = rVR.getTextureIdFromName (getValStr("arrow_left")); TxId_L_Arrow = rVR.getTextureIdFromName (getValStr("arrow_left"));
@ -355,7 +355,7 @@ bool CMissionIconList::parse(xmlNodePtr cur)
bool result = CInterfaceOptions::parse(cur); bool result = CInterfaceOptions::parse(cur);
if (!result) return false; if (!result) return false;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
for(std::map<std::string, CInterfaceOptionValue>::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it) for(std::map<std::string, CInterfaceOptionValue>::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it)
{ {
int index; int index;
@ -414,7 +414,7 @@ COptionsAnimationSet::~COptionsAnimationSet()
BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList
(see deleteAnimationSet() doc) (see deleteAnimationSet() doc)
*/ */
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->deleteAnimationSet(AnimationSet); CViewRenderer::getInstance()->getDriver()->deleteAnimationSet(AnimationSet);
AnimationSet= NULL; AnimationSet= NULL;
} }
} }
@ -424,10 +424,10 @@ bool COptionsAnimationSet::parse (xmlNodePtr cur)
{ {
bool result = CInterfaceOptions::parse(cur); bool result = CInterfaceOptions::parse(cur);
if (!result) return false; if (!result) return false;
nlassert( CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); nlassert( CViewRenderer::getInstance()->getDriver() );
// create the animation set // create the animation set
AnimationSet= CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet(); AnimationSet= CViewRenderer::getInstance()->getDriver()->createAnimationSet();
nlassert(AnimationSet); nlassert(AnimationSet);
AnimMale.clear(); AnimMale.clear();

View file

@ -122,7 +122,7 @@ using namespace NLMISC;
void badLuaParseMessageBox() void badLuaParseMessageBox()
{ {
NL3D::UDriver::TMessageBoxId ret = NL3D::UDriver::TMessageBoxId ret =
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->systemMessageBox( "LUA files reading failed!\n" CViewRenderer::getInstance()->getDriver()->systemMessageBox( "LUA files reading failed!\n"
"Some LUA files are corrupted, moved or may have been removed.\n" "Some LUA files are corrupted, moved or may have been removed.\n"
"Ryzom may need to be restarted to run properly.\n" "Ryzom may need to be restarted to run properly.\n"
"Would you like to quit now?", "Would you like to quit now?",

View file

@ -1112,7 +1112,7 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
} }
// reset display of left hand // reset display of left hand
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("hand_left.tga")); pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("hand_left.tga"));
pCSLeftHand->setGrayed(false); pCSLeftHand->setGrayed(false);
pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("LEFT_HAND")); pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("LEFT_HAND"));
@ -1187,7 +1187,7 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node)
CDBCtrlSheet *pCSLeftHand = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); CDBCtrlSheet *pCSLeftHand = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT));
if ( pCSLeftHand ) if ( pCSLeftHand )
{ {
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
pCSLeftHand->setActionOnLeftClick("proc"); pCSLeftHand->setActionOnLeftClick("proc");
pCSLeftHand->setGrayed(false); pCSLeftHand->setGrayed(false);

View file

@ -1608,7 +1608,7 @@ int CLuaIHMRyzom::getWindowSize(CLuaState &ls)
CLuaIHM::checkArgCount(ls, "getWindowSize", 0); CLuaIHM::checkArgCount(ls, "getWindowSize", 0);
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
uint32 w, h; uint32 w, h;
pIM->getViewRenderer().getScreenSize(w, h); CViewRenderer::getInstance()->getScreenSize(w, h);
ls.push((double) w); ls.push((double) w);
ls.push((double) h); ls.push((double) h);
return 2; return 2;

View file

@ -204,7 +204,7 @@ void CMacroCmdManager::initInGame()
{ {
// Get all custom icon bitmaps // Get all custom icon bitmaps
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CInterfaceOptions *pIO = pIM->getOptions("macro_custom_icon"); CInterfaceOptions *pIO = pIM->getOptions("macro_custom_icon");
if (pIO != NULL) if (pIO != NULL)
{ {

View file

@ -80,7 +80,7 @@ bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
TxName = strlwr (TxName); TxName = strlwr (TxName);
setTexture (TxName); setTexture (TxName);
//CInterfaceManager *pIM = CInterfaceManager::getInstance(); //CInterfaceManager *pIM = CInterfaceManager::getInstance();
//CViewRenderer &rVR = pIM->getViewRenderer(); //CViewRenderer &rVR = *CViewRenderer::getInstance();
//_TextureId = rVR.getTextureIdFromName (TxName); //_TextureId = rVR.getTextureIdFromName (TxName);
} }
@ -145,7 +145,7 @@ bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
void CViewBitmap::draw () void CViewBitmap::draw ()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col; CRGBA col;
if(getModulateGlobalColor()) if(getModulateGlobalColor())
@ -209,7 +209,7 @@ void CViewBitmap::updateCoords()
if (!_Scale) if (!_Scale)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 txw, txh; sint32 txw, txh;
rVR.getTextureSizeFromId (_TextureId, txw, txh); rVR.getTextureSizeFromId (_TextureId, txw, txh);
_W = txw; _W = txw;
@ -222,7 +222,7 @@ void CViewBitmap::updateCoords()
void CViewBitmap::setTexture(const std::string & TxName) void CViewBitmap::setTexture(const std::string & TxName)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false); _TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false);
} }
@ -231,7 +231,7 @@ void CViewBitmap::setTexture(const std::string & TxName)
std::string CViewBitmap::getTexture () const std::string CViewBitmap::getTexture () const
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId (_TextureId); return rVR.getTextureNameFromId (_TextureId);
} }
@ -239,7 +239,7 @@ std::string CViewBitmap::getTexture () const
void CViewBitmap::fitTexture() void CViewBitmap::fitTexture()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId(_TextureId, w, h); rVR.getTextureSizeFromId(_TextureId, w, h);
setW(w); setW(w);
@ -287,7 +287,7 @@ sint32 CViewBitmap::getMaxUsedW() const
{ {
sint32 txw, txh; sint32 txw, txh;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.getTextureSizeFromId (_TextureId, txw, txh); rVR.getTextureSizeFromId (_TextureId, txw, txh);
return txw; return txw;
} }

View file

@ -276,7 +276,7 @@ void CViewBitmapCombo::draw()
sint32 mx = 0, my = 0; sint32 mx = 0, my = 0;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
const std::vector<CViewBase *> &rVB = pIM->getViewsUnderPointer(); const std::vector<CViewBase *> &rVB = pIM->getViewsUnderPointer();
if (!CWidgetManager::getInstance()->getPointer()) return; if (!CWidgetManager::getInstance()->getPointer()) return;
CWidgetManager::getInstance()->getPointer()->getPointerDispPos(mx, my); CWidgetManager::getInstance()->getPointer()->getPointerDispPos(mx, my);
@ -377,7 +377,7 @@ void CViewBitmapCombo::draw()
textId = getTexId(_TexsId, texIndex); textId = getTexId(_TexsId, texIndex);
color = getCol(_Col, texIndex); color = getCol(_Col, texIndex);
} }
pIM->getViewRenderer().drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, CViewRenderer::getInstance()->drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false,
textId, textId,
color); color);
} }
@ -454,7 +454,7 @@ void CViewBitmapCombo::draw()
} }
} }
pIM->getViewRenderer().drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, CViewRenderer::getInstance()->drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false,
textId, textId,
color); color);
} }

View file

@ -119,7 +119,7 @@ void CViewBitmapFaberMp::draw ()
*/ */
//get the item //get the item
CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
uint32 sheet = (uint32)_SheetId.getSInt64(); uint32 sheet = (uint32)_SheetId.getSInt64();
CSheetId sheetId(sheet); CSheetId sheetId(sheet);

View file

@ -170,7 +170,7 @@ void CViewPointer::draw ()
return; return;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
if (pIM->isInGame()) if (pIM->isInGame())
if (!_StringCursor) if (!_StringCursor)
@ -573,7 +573,7 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
nlinfo(tooltip.c_str()); nlinfo(tooltip.c_str());
setString(ucstring(tooltip)); setString(ucstring(tooltip));
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 texId = rVR.getTextureIdFromName (texName); sint32 texId = rVR.getTextureIdFromName (texName);
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor; CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
@ -596,7 +596,7 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
else else
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 texId = rVR.getTextureIdFromName (texName); sint32 texId = rVR.getTextureIdFromName (texName);
drawCursor(texId, col, 0); drawCursor(texId, col, 0);
return true; return true;
@ -760,7 +760,7 @@ void CViewPointer::setString (const ucstring &str)
void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot) void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 xPos = _XReal + _OffsetX; sint32 xPos = _XReal + _OffsetX;
sint32 yPos = _YReal + _OffsetY; sint32 yPos = _YReal + _OffsetY;
if (!IsMouseCursorHardware()) if (!IsMouseCursorHardware())

View file

@ -77,7 +77,7 @@ void CViewPolygon::draw()
if (_Tris.empty()) return; if (_Tris.empty()) return;
if (!_Parent) return; if (!_Parent) return;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
if (_Touched) if (_Touched)
{ {
_RealTris.clear(); _RealTris.clear();

View file

@ -58,7 +58,7 @@ void CViewQuad::draw()
{ {
nlassert(_Parent); nlassert(_Parent);
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CRGBA col; CRGBA col;
if(getModulateGlobalColor()) if(getModulateGlobalColor())
@ -280,7 +280,7 @@ void CViewQuad::setAlpha(sint32 a)
void CViewQuad::setTexture(const std::string &texName) void CViewQuad::setTexture(const std::string &texName)
{ {
// CInterfaceManager *pIM = CInterfaceManager::getInstance(); // CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = pIM->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureId.setTexture(texName.c_str()); _TextureId.setTexture(texName.c_str());
} }
@ -288,7 +288,7 @@ void CViewQuad::setTexture(const std::string &texName)
std::string CViewQuad::getTexture() const std::string CViewQuad::getTexture() const
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId (_TextureId); return rVR.getTextureNameFromId (_TextureId);
} }
@ -335,7 +335,7 @@ void CViewQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo
{ {
NLMISC::CVector pos = srcPos; NLMISC::CVector pos = srcPos;
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h; sint32 w, h;
rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h); rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h);
if (angle == 0.f) if (angle == 0.f)

View file

@ -60,7 +60,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
// Spot textures // Spot textures
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// Large missions Icons // Large missions Icons
const char *spotTextureNames[NbRadarSpotIds] = { "texture_std", "texture_missionlist", "texture_missionauto", "texture_missionstep" }; const char *spotTextureNames[NbRadarSpotIds] = { "texture_std", "texture_missionlist", "texture_missionauto", "texture_missionstep" };
@ -105,7 +105,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
void CViewRadar::draw () void CViewRadar::draw ()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CEntityCL *user = EntitiesMngr.entity(0); CEntityCL *user = EntitiesMngr.entity(0);
if (user == NULL) return; if (user == NULL) return;

View file

@ -14,28 +14,26 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "view_renderer.h" #include "view_renderer.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/uv.h" #include "nel/misc/uv.h"
#include "nel/misc/hierarchical_timer.h" #include "nel/misc/hierarchical_timer.h"
#include "interface_manager.h"
#include "../client_cfg.h" #include "../client_cfg.h"
using namespace NLMISC; using namespace NLMISC;
using namespace std; using namespace std;
using namespace NL3D; using namespace NL3D;
CViewRenderer::CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) CViewRenderer* CViewRenderer::instance = NULL;
{ NL3D::UDriver* CViewRenderer::driver = NULL;
setup(); NL3D::UTextContext* CViewRenderer::textcontext = NULL;
this->driver = driver; CViewRenderer::CViewRenderer()
this->textcontext = textcontext; {
nlassert( driver != NULL );
nlassert( textcontext != NULL );
setup();
} }
CViewRenderer::~CViewRenderer() CViewRenderer::~CViewRenderer()
@ -49,6 +47,13 @@ CViewRenderer::~CViewRenderer()
} }
CViewRenderer* CViewRenderer::getInstance()
{
if( instance == NULL )
instance = new CViewRenderer;
return instance;
}
/* /*
* setClipWindow : set the current clipping window * setClipWindow : set the current clipping window
* (this window do not inherit properties from parent or whatever) * (this window do not inherit properties from parent or whatever)
@ -203,7 +208,12 @@ NL3D::UDriver* CViewRenderer::getDriver(){
void CViewRenderer::setTextContext(NL3D::UTextContext *textcontext) void CViewRenderer::setTextContext(NL3D::UTextContext *textcontext)
{ {
this->textcontext = textcontext; CViewRenderer::textcontext = textcontext;
}
void CViewRenderer::setDriver( NL3D::UDriver *driver )
{
CViewRenderer::driver = driver;
} }
// *************************************************************************** // ***************************************************************************
@ -1732,10 +1742,8 @@ void CViewRenderer::drawCustom (sint32 x, sint32 y, sint32 width, sint32 height,
CViewRenderer::CTextureId::~CTextureId () CViewRenderer::CTextureId::~CTextureId ()
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer();
if (_TextureId>=0) if (_TextureId>=0)
rVR.deleteTexture(_TextureId); CViewRenderer::getInstance()->deleteTexture(_TextureId);
_TextureId = -1; _TextureId = -1;
} }
@ -1744,8 +1752,7 @@ CViewRenderer::CTextureId::~CTextureId ()
bool CViewRenderer::CTextureId::setTexture (const char *textureName, sint32 offsetX, sint32 offsetY, sint32 width, sint32 height, bool CViewRenderer::CTextureId::setTexture (const char *textureName, sint32 offsetX, sint32 offsetY, sint32 width, sint32 height,
bool uploadDXTC, bool bReleasable) bool uploadDXTC, bool bReleasable)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer();
if (_TextureId>=0) if (_TextureId>=0)
rVR.deleteTexture(_TextureId); rVR.deleteTexture(_TextureId);
_TextureId = rVR.getTextureIdFromName(textureName); _TextureId = rVR.getTextureIdFromName(textureName);
@ -1766,8 +1773,7 @@ void CViewRenderer::CTextureId::serial(NLMISC::IStream &f)
} }
else else
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer();
texName = rVR.getTextureNameFromId(_TextureId); texName = rVR.getTextureNameFromId(_TextureId);
f.serial(texName); f.serial(texName);
} }

View file

@ -26,8 +26,6 @@
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/misc/uv.h" #include "nel/misc/uv.h"
#include "nel/3d/frustum.h" #include "nel/3d/frustum.h"
#include "../ingame_database_manager.h"
// *************************************************************************** // ***************************************************************************
#define VR_NUM_LAYER 32 #define VR_NUM_LAYER 32
@ -104,9 +102,12 @@ public:
sint32 _TextureId; sint32 _TextureId;
}; };
CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ); private:
CViewRenderer();
~CViewRenderer();
~CViewRenderer (); public:
static CViewRenderer* getInstance();
/// setup the default values for everything /// setup the default values for everything
void setup(); void setup();
@ -121,10 +122,13 @@ public:
void reset(); void reset();
/// Retrieves the 3d driver we are using /// Retrieves the 3d driver we are using
NL3D::UDriver* getDriver(); static NL3D::UDriver* getDriver();
/// Sets the current TextContext. /// Sets the current TextContext.
void setTextContext( NL3D::UTextContext *textcontext ); static void setTextContext( NL3D::UTextContext *textcontext );
/// Sets the current driver
static void setDriver( NL3D::UDriver *driver );
/* /*
* setClipWindow : set the current clipping window * setClipWindow : set the current clipping window
@ -564,8 +568,9 @@ private:
bool _WorldSpaceScale; bool _WorldSpaceScale;
NL3D::UDriver *driver; static CViewRenderer *instance;
NL3D::UTextContext *textcontext; static NL3D::UDriver *driver;
static NL3D::UTextContext *textcontext;
}; };

View file

@ -418,7 +418,7 @@ void CViewText::draw ()
H_AUTO( RZ_Interface_CViewText_draw ) H_AUTO( RZ_Interface_CViewText_draw )
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CViewRenderer &rVR = pIM->getViewRenderer(); CViewRenderer &rVR = *CViewRenderer::getInstance();
// *** Out Of Clip? // *** Out Of Clip?
sint32 ClipX, ClipY, ClipW, ClipH; sint32 ClipX, ClipY, ClipW, ClipH;
@ -1559,7 +1559,7 @@ void CViewText::getCharacterPositionFromIndex(sint index, bool cursorAtPreviousL
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
height = getFontHeight(); height = getFontHeight();
// //
if (_MultiLine) if (_MultiLine)
@ -1691,7 +1691,7 @@ void CViewText::getCharacterIndexFromPosition(sint x, sint y, uint &index, bool
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow);
TextContext->setFontSize (_FontSize); TextContext->setFontSize (_FontSize);
// find the line where the character is // find the line where the character is
// CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); // CViewRenderer &rVR = *CViewRenderer::getInstance();
uint charPos = 0; uint charPos = 0;
if (_MultiLine) if (_MultiLine)
{ {

View file

@ -1735,7 +1735,7 @@ bool mainLoop()
H_AUTO_USE ( RZ_Client_Main_Loop_Cursor ) H_AUTO_USE ( RZ_Client_Main_Loop_Cursor )
// Change only if screen is not minimized // Change only if screen is not minimized
if(!pIMinstance->getViewRenderer().isMinimized()) if(!CViewRenderer::getInstance()->isMinimized())
{ {
// Get the cursor instance // Get the cursor instance
CViewPointer *cursor = CWidgetManager::getInstance()->getPointer(); CViewPointer *cursor = CWidgetManager::getInstance()->getPointer();
@ -1746,7 +1746,7 @@ bool mainLoop()
cursor->getPointerPos(x, y); cursor->getPointerPos(x, y);
uint32 w, h; uint32 w, h;
CViewRenderer &viewRender = pIMinstance->getViewRenderer(); CViewRenderer &viewRender = *CViewRenderer::getInstance();
viewRender.getScreenSize(w, h); viewRender.getScreenSize(w, h);
if(w) if(w)

View file

@ -598,7 +598,7 @@ void CDisplayerVisualActivitySequence::onUpdate(CGroupMap &owner)
//H_AUTO(R2_CDisplayerVisualActivitySequence_onUpdate) //H_AUTO(R2_CDisplayerVisualActivitySequence_onUpdate)
nlassert(_AddedToWorldMap); nlassert(_AddedToWorldMap);
nlassert(_FootSteps.size() == _WorldMapEdges.size()); nlassert(_FootSteps.size() == _WorldMapEdges.size());
CViewRenderer &vr = getEditor().getUI().getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
sint32 id = vr.getTextureIdFromName(CV_FootStepMapTexture.get()); sint32 id = vr.getTextureIdFromName(CV_FootStepMapTexture.get());
sint32 width, height; sint32 width, height;
vr.getTextureSizeFromId(id, width, height); vr.getTextureSizeFromId(id, width, height);

View file

@ -141,7 +141,7 @@ void CIslandCollision::releaseAccessibilityTexture()
//H_AUTO(R2_CIslandCollision_releaseAccessibilityTexture) //H_AUTO(R2_CIslandCollision_releaseAccessibilityTexture)
delete _AccessibilityTexture; delete _AccessibilityTexture;
_AccessibilityTexture = NULL; _AccessibilityTexture = NULL;
CViewRenderer &vr = getEditor().getUI().getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
vr.setExternalTexture(_AccessibilityTextureId, NULL, 0, 0, 0, 0); vr.setExternalTexture(_AccessibilityTextureId, NULL, 0, 0, 0, 0);
} }
@ -460,7 +460,7 @@ CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::C
uint height = std::max(_HeightMap.getHeight() / MapSizeDivisor, 1u); uint height = std::max(_HeightMap.getHeight() / MapSizeDivisor, 1u);
uint realWidth = NLMISC::raiseToNextPowerOf2(width); uint realWidth = NLMISC::raiseToNextPowerOf2(width);
uint realHeight = NLMISC::raiseToNextPowerOf2(height); uint realHeight = NLMISC::raiseToNextPowerOf2(height);
CViewRenderer &vr = getEditor().getUI().getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
// create / update texture // create / update texture
vr.setExternalTexture(_AccessibilityTextureId, _AccessibilityTexture, realWidth, realHeight, width, height); vr.setExternalTexture(_AccessibilityTextureId, _AccessibilityTexture, realWidth, realHeight, width, height);
if (vr.getTextureIdFromName(_AccessibilityTextureId) == -1) if (vr.getTextureIdFromName(_AccessibilityTextureId) == -1)

View file

@ -157,7 +157,7 @@ void CPrimRender::setLook(const CPrimLook &look)
if (!look.EdgeLook.WorldMapTexture.empty()) if (!look.EdgeLook.WorldMapTexture.empty())
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
CViewRenderer &vr = im->getViewRenderer(); CViewRenderer &vr = *CViewRenderer::getInstance();
sint32 width, height; sint32 width, height;
sint32 id = vr.getTextureIdFromName(look.EdgeLook.WorldMapTexture); sint32 id = vr.getTextureIdFromName(look.EdgeLook.WorldMapTexture);
vr.getTextureSizeFromId(id, width, height); vr.getTextureSizeFromId(id, width, height);

View file

@ -130,7 +130,7 @@ CInterfaceManager &CTool::getUI()
void CTool::getScreenSize(uint32 &scrW, uint32 &scrH) void CTool::getScreenSize(uint32 &scrW, uint32 &scrH)
{ {
//H_AUTO(R2_CTool_getScreenSize) //H_AUTO(R2_CTool_getScreenSize)
getUI().getViewRenderer().getScreenSize(scrW, scrH); CViewRenderer::getInstance()->getScreenSize(scrW, scrH);
} }
// *************************************************************** // ***************************************************************
@ -138,7 +138,7 @@ uint32 CTool::getScreenWidth()
{ {
//H_AUTO(R2_CTool_getScreenWidth) //H_AUTO(R2_CTool_getScreenWidth)
uint32 scrW, scrH; uint32 scrW, scrH;
getUI().getViewRenderer().getScreenSize(scrW, scrH); CViewRenderer::getInstance()->getScreenSize(scrW, scrH);
return scrW; return scrW;
} }
@ -147,7 +147,7 @@ uint32 CTool::getScreenHeight()
{ {
//H_AUTO(R2_CTool_getScreenHeight) //H_AUTO(R2_CTool_getScreenHeight)
uint32 scrW, scrH; uint32 scrW, scrH;
getUI().getViewRenderer().getScreenSize(scrW, scrH); CViewRenderer::getInstance()->getScreenSize(scrW, scrH);
return scrH; return scrH;
} }