本文整理汇总了C++中OBSBasic::GetProgramSource方法的典型用法代码示例。如果您正苦于以下问题:C++ OBSBasic::GetProgramSource方法的具体用法?C++ OBSBasic::GetProgramSource怎么用?C++ OBSBasic::GetProgramSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBSBasic
的用法示例。
在下文中一共展示了OBSBasic::GetProgramSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDoubleClickEvent
void OBSProjector::mouseDoubleClickEvent(QMouseEvent *event)
{
OBSQTDisplay::mouseDoubleClickEvent(event);
if (!mouseSwitching)
return;
if (!transitionOnDoubleClick)
return;
OBSBasic *main = (OBSBasic*)obs_frontend_get_main_window();
if (!main->IsPreviewProgramMode())
return;
if (event->button() == Qt::LeftButton) {
int pos = getSourceByPosition(event->x(), event->y(), ratio);
if (pos < 0 || pos >= (int)numSrcs)
return;
OBSSource src = OBSGetStrongRef(multiviewScenes[pos]);
if (!src)
return;
if (main->GetProgramSource() != src)
main->TransitionToScene(src);
}
}
示例2: OBSRenderMultiview
void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
{
OBSProjector *window = (OBSProjector *)data;
if (updatingMultiview || !window->ready)
return;
OBSBasic *main = (OBSBasic *)obs_frontend_get_main_window();
uint32_t targetCX, targetCY;
int x, y;
float scale;
targetCX = (uint32_t)window->fw;
targetCY = (uint32_t)window->fh;
GetScaleAndCenterPos(targetCX, targetCY, cx, cy, x, y, scale);
OBSSource previewSrc = main->GetCurrentSceneSource();
OBSSource programSrc = main->GetProgramSource();
bool studioMode = main->IsPreviewProgramMode();
auto renderVB = [&](gs_vertbuffer_t *vb, int cx, int cy,
uint32_t colorVal)
{
if (!vb)
return;
matrix4 transform;
matrix4_identity(&transform);
transform.x.x = cx;
transform.y.y = cy;
gs_load_vertexbuffer(vb);
gs_matrix_push();
gs_matrix_mul(&transform);
gs_effect_set_color(window->color, colorVal);
while (gs_effect_loop(window->solid, "Solid"))
gs_draw(GS_LINESTRIP, 0, 0);
gs_matrix_pop();
};
auto drawBox = [&](float cx, float cy, uint32_t colorVal)
{
gs_effect_set_color(window->color, colorVal);
while (gs_effect_loop(window->solid, "Solid"))
gs_draw_sprite(nullptr, 0, (uint32_t)cx, (uint32_t)cy);
};
auto setRegion = [&](float bx, float by, float cx,
float cy)
{
float vX = int(x + bx * scale);
float vY = int(y + by * scale);
float vCX = int(cx * scale);
float vCY = int(cy * scale);
float oL = bx;
float oT = by;
float oR = (bx + cx);
float oB = (by + cy);
startRegion(vX, vY, vCX, vCY, oL, oR, oT, oB);
};
auto calcBaseSource = [&](size_t i)
{
switch (multiviewLayout) {
case MultiviewLayout::HORIZONTAL_TOP_24_SCENES:
window->sourceX = (i % 6) * window->scenesCX;
window->sourceY = window->pvwprgCY +
(i / 6) * window->scenesCY;
break;
case MultiviewLayout::VERTICAL_LEFT_8_SCENES:
window->sourceX = window->pvwprgCX;
window->sourceY = (i / 2 ) * window->scenesCY;
if (i % 2 != 0)
window->sourceX += window->scenesCX;
break;
case MultiviewLayout::VERTICAL_RIGHT_8_SCENES:
window->sourceX = 0;
window->sourceY = (i / 2 ) * window->scenesCY;
if (i % 2 != 0)
window->sourceX = window->scenesCX;
break;
case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES:
if (i < 4) {
window->sourceX = (float(i) * window->scenesCX);
window->sourceY = 0;
} else {
window->sourceX = (float(i - 4) *
window->scenesCX);
window->sourceY = window->scenesCY;
}
break;
default: // MultiviewLayout::HORIZONTAL_TOP_8_SCENES:
if (i < 4) {
window->sourceX = (float(i) * window->scenesCX);
//.........这里部分代码省略.........