void OUGUIObject::RenderGUI() { if(!GetShowMode()) return; /** 渲染自身 */ OnRender(); /** 渲染子控件 */ for(GUIList::iterator it = m_pControlList.begin(); it != m_pControlList.end(); it++) { (*it)->m_pObject->RenderGUI(); } }
/********************************************************************************* *Function: Display(const VMatrix3& mat,bool flag) *Description:绘制网格 *Input: mat-网格姿态矩阵 *Return: 无 *CREATED BY: [8/17/2015 niewenchao] **********************************************************************************/ void VMesh::Display(const VMatrix3& mat,bool flag) { VRender* render = VRender::GetSingleton(); int showMod = GetShowMode(); render->SetTransform(mat);//设置变换矩阵 if (flag) { render->DrawBoundBox(m_bBox); } ////////////////////////////////////////////////////////////////////////// switch (showMod) //网格的显示方式 { case MESH_POINT: //点显示 render->DrawPoints(m_iNumVerts,m_pVerts,m_pVertColors); break; case MESH_LINE: //线显示 render->DrawLines(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors,true); break; case MESH_SOLID: //实体面显示,用三角形,默认填充 render->DrawTriangles(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors); break; case MESH_POINT_LINE: //点线混合显示 render->DrawPoints(m_iNumVerts,m_pVerts,m_pVertColors); render->DrawLines(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors); break; case MESH_POINT_SOLID: //点面混合显示 render->DrawPoints(m_iNumVerts,m_pVerts,m_pVertColors); render->DrawTriangles(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors); break; case MESH_LINE_SOLID: //线面混合显示 render->DrawLines(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors,true); render->DrawTriangles(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors); break; case MESH_POINT_LINE_SOLID: //点线面混合显示 render->DrawPoints(m_iNumVerts,m_pVerts,m_pVertColors); render->DrawLines(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors,true); render->DrawTriangles(m_iNumFaces,m_pFaces,m_pVerts,m_pVertColors); break; } ////////////////////////////////////////////////////////////////////////// render->RemoveTransform(mat); }
void OUGUIObject::UpdateSelf(float fDeltaTime, float fMX, float fMY) { /** 如果鼠标不在HGE窗口内 */ //if(!m_pHGE->Input_IsMouseOver()) return; bool bLButton = m_pHGE->Input_GetKeyState(HGEK_LBUTTON); bool bRButton = m_pHGE->Input_GetKeyState(HGEK_RBUTTON); bool bMButton = m_pHGE->Input_GetKeyState(HGEK_MBUTTON); int nWheel = m_pHGE->Input_GetMouseWheel(); OnUpdate(fDeltaTime, fMX, fMY); /** 若控件不可用 */ if(!GetEnableMode()) return; if(!GetShowMode()) return; /** 若有鼠标捕获的控件 */ if(OUGUIObject::m_pMouseCaptureControl && OUGUIObject::m_pMouseCaptureControl != this && !IsParent(OUGUIObject::m_pMouseCaptureControl)) { return; } /** 若有模式窗口 */ if(OUGUIObject::m_pModalControl && OUGUIObject::m_pModalControl != this && !IsParent(OUGUIObject::m_pModalControl)) { return; } /** 若有控件在激活状态下 */ if(OUGUIObject::m_pActiveControl && OUGUIObject::m_pActiveControl != this) { return; } /** 如果鼠标没有被按下,则检测是不是OnEnter */ if(!bLButton && OnCheckCollision(fMX, fMY)) { //SetMouseEnter(OnCheckCollision(fMX, fMY)); SetMouseEnter(true); } /** 如果鼠标抬起,则检测是不是OnLeave */ else if(!bLButton && !OnCheckCollision(fMX, fMY) && GetMouseEnter()) { SetMouseEnter(false); this->m_bMouseLButton = false; this->m_bMouseMButton = false; this->m_bMouseRButton = false; this->m_nMouseWheel = 0; if(OUGUIObject::GetActiveControl() == this) { OUGUIObject::SetActiveControl(NULL); } return; } if(GetMouseEnter() || OUGUIObject::GetMouseCaptureControl() == this) { SetMousePos(fMX, fMY); SetMouseLButton(bLButton); SetMouseRButton(bRButton); SetMouseMButton(bMButton); SetMouseWheel(nWheel); /** 键盘响应 */ for(int i = 0; i < 256; i++) { if(i == HGEK_LBUTTON) continue; if(i == HGEK_RBUTTON) continue; if(i == HGEK_MBUTTON) continue; if(m_pHGE->Input_KeyDown(i)) OnKeyDown(i); else if(m_pHGE->Input_KeyUp(i)) OnKeyUp(i); } OnIdle(); } else { /** 清空状态 */ SetMouseLButton(false); SetMouseRButton(false); SetMouseMButton(false); SetMouseWheel(nWheel); } }