本文整理汇总了C++中CGUIWindow::GetCoordsRes方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIWindow::GetCoordsRes方法的具体用法?C++ CGUIWindow::GetCoordsRes怎么用?C++ CGUIWindow::GetCoordsRes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIWindow
的用法示例。
在下文中一共展示了CGUIWindow::GetCoordsRes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
g_cpuInfo.getUsedPercentage(); // must call it to recalculate pct values
static int yShift = 20;
static int xShift = 40;
static unsigned int lastShift = time(nullptr);
time_t now = time(nullptr);
if (now - lastShift > 10)
{
yShift *= -1;
if (now % 5 == 0)
xShift *= -1;
lastShift = now;
MarkDirtyRegion();
}
if (!m_layout)
{
CGUIFont *font13 = g_fontManager.GetDefaultFont();
CGUIFont *font13border = g_fontManager.GetDefaultFont(true);
if (font13)
m_layout = new CGUITextLayout(font13, true, 0, font13border);
}
if (!m_layout)
return;
std::string info;
if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel)
{
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&stat);
std::string profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : "";
std::string strCores = g_cpuInfo.GetCoresUsageString();
std::string lcAppName = CCompileInfo::GetAppName();
StringUtils::ToLower(lcAppName);
#if !defined(TARGET_POSIX)
info = StringUtils::Format("LOG: %s%s.log\nMEM: %" PRIu64"/%" PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", CSpecialProtocol::TranslatePath("special://logpath").c_str(), lcAppName.c_str(),
stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
#else
double dCPU = m_resourceCounter.GetCPUUsage();
std::string ucAppName = lcAppName;
StringUtils::ToUpper(ucAppName);
info = StringUtils::Format("LOG: %s%s.log\n"
"MEM: %" PRIu64"/%" PRIu64" KB - FPS: %2.1f fps\n"
"CPU: %s (CPU-%s %4.2f%%%s)",
CSpecialProtocol::TranslatePath("special://logpath").c_str(), lcAppName.c_str(),
stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(),
strCores.c_str(), ucAppName.c_str(), dCPU, profiling.c_str());
#endif
}
// render the skin debug info
if (g_SkinInfo->IsDebugging())
{
if (!info.empty())
info += "\n";
CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow());
CGUIWindow *pointer = g_windowManager.GetWindow(WINDOW_DIALOG_POINTER);
CPoint point;
if (pointer)
point = CPoint(pointer->GetXPosition(), pointer->GetYPosition());
if (window)
{
std::string windowName = CWindowTranslator::TranslateWindow(window->GetID());
if (!windowName.empty())
windowName += " (" + std::string(window->GetProperty("xmlfile").asString()) + ")";
else
windowName = window->GetProperty("xmlfile").asString();
info += "Window: " + windowName + "\n";
// transform the mouse coordinates to this window's coordinates
g_graphicsContext.SetScalingResolution(window->GetCoordsRes(), true);
point.x *= g_graphicsContext.GetGUIScaleX();
point.y *= g_graphicsContext.GetGUIScaleY();
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
}
info += StringUtils::Format("Mouse: (%d,%d) ", static_cast<int>(point.x), static_cast<int>(point.y));
if (window)
{
CGUIControl *control = window->GetFocusedControl();
if (control)
info += StringUtils::Format("Focused: %i (%s)", control->GetID(), CGUIControlFactory::TranslateControlType(control->GetControlType()).c_str());
}
}
float w, h;
if (m_layout->Update(info))
MarkDirtyRegion();
m_layout->GetTextExtent(w, h);
float x = xShift + 0.04f * g_graphicsContext.GetWidth();
float y = yShift + 0.04f * g_graphicsContext.GetHeight();
m_renderRegion.SetRect(x, y, x+w, y+h);
}
示例2: Process
void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
g_cpuInfo.getUsedPercentage(); // must call it to recalculate pct values
static int yShift = 20;
static int xShift = 40;
static unsigned int lastShift = time(NULL);
time_t now = time(NULL);
if (now - lastShift > 10)
{
yShift *= -1;
if (now % 5 == 0)
xShift *= -1;
lastShift = now;
MarkDirtyRegion();
}
if (!m_layout)
{
CGUIFont *font13 = g_fontManager.GetDefaultFont();
CGUIFont *font13border = g_fontManager.GetDefaultFont(true);
if (font13)
m_layout = new CGUITextLayout(font13, true, 0, font13border);
}
if (!m_layout)
return;
CStdString info;
if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel)
{
MEMORYSTATUS stat;
GlobalMemoryStatus(&stat);
CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : "";
CStdString strCores = g_cpuInfo.GetCoresUsageString();
#if !defined(_LINUX)
info.Format("LOG: %sxbmc.log\nMEM: %d/%d KB - FPS: %2.1f fps\nCPU: %s%s", g_settings.m_logFolder.c_str(),
stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
#else
double dCPU = m_resourceCounter.GetCPUUsage();
info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_settings.m_logFolder.c_str(),
stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
#endif
}
// render the skin debug info
if (g_SkinInfo->IsDebugging())
{
if (!info.IsEmpty())
info += "\n";
CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow());
CGUIWindow *pointer = g_windowManager.GetWindow(WINDOW_DIALOG_POINTER);
CPoint point;
if (pointer)
point = CPoint(pointer->GetXPosition(), pointer->GetYPosition());
if (window)
{
CStdString windowName = CButtonTranslator::TranslateWindow(window->GetID());
if (!windowName.IsEmpty())
windowName += " (" + window->GetProperty("xmlfile") + ")";
else
windowName = window->GetProperty("xmlfile");
info += "Window: " + windowName + " ";
// transform the mouse coordinates to this window's coordinates
g_graphicsContext.SetScalingResolution(window->GetCoordsRes(), true);
point.x *= g_graphicsContext.GetGUIScaleX();
point.y *= g_graphicsContext.GetGUIScaleY();
g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetResInfo(), false);
}
info.AppendFormat("Mouse: (%d,%d) ", (int)point.x, (int)point.y);
if (window)
{
CGUIControl *control = window->GetFocusedControl();
if (control)
info.AppendFormat("Focused: %i (%s)", control->GetID(), CGUIControlFactory::TranslateControlType(control->GetControlType()).c_str());
}
}
float w, h;
if (m_layout->Update(info))
MarkDirtyRegion();
m_layout->GetTextExtent(w, h);
float x = xShift + 0.04f * g_graphicsContext.GetWidth();
float y = yShift + 0.04f * g_graphicsContext.GetHeight();
m_renderRegion.SetRect(x, y, x+w, y+h);
}