Ejemplo n.º 1
0
        void NRenderStatus::DrawStatus()
        {
            DWORD currentTime = ::GetTickCount();

            Base::NString status;
            if(currentTime <= lastTime_)
                status.Format(_T("Index: %d\r\nFPS: MAX"), ++ index_);
            else
                status.Format(_T("Index: %d\r\nFPS: %.2f"), ++ index_, (double)1000 / (currentTime - lastTime_));

            lastTime_ = currentTime;

            Base::NRect rcClient;
            ::GetClientRect(hWnd_, rcClient);

            HDC hDc = ::GetDC(hWnd_);

            Base::NRect rcText(rcClient);
            ::DrawText(hDc, status.GetData(), status.GetLength(), rcText, DT_EDITCONTROL | DT_CALCRECT);
            rcText.Offset(rcClient.Width() - rcText.Width() - 8, 8);

            CAlphaDC alphaDc;
            if(alphaDc.Init(hDc, rcText, rcClient.GetSize(), true))
            {
                ::SetBkColor(alphaDc, RGB(255, 255, 0));
                ::SetBkMode(alphaDc, OPAQUE);
                ::DrawText(alphaDc, status.GetData(), status.GetLength(), rcText, DT_EDITCONTROL);

                alphaDc.EndDraw(255);
            }
            ::ReleaseDC(hWnd_, hDc);
        }
Ejemplo n.º 2
0
 Base::NString CombinePath(const Base::NString& path, const Base::NString& pathAfter)
 {
     if(path.GetLength() == 0)
         return pathAfter;
     Base::NString result = path + _T("\\") + pathAfter;
     result.Replace(_T("/"), _T("\\")).Replace(_T("\\\\"), _T("\\"));
     return result;
 }