예제 #1
0
 void keyPressed(int key) {
     if(key == 'r') {
         recording = !recording;
     }
     if(key == 'f') {
         config["screen"]["fullscreen"] = !config["screen"]["fullscreen"];
         updateWindowShape();
     }
     if(key == '\t') {
         config["camera"]["rotate"] = config["camera"]["rotate"] == 0 ? 90 : 0;
         updateWindowShape();
     }
     if(key == 'g') {
         toggleGrayscale = !toggleGrayscale;
     }
 }
예제 #2
0
void KCommonDecoration::resizeEvent(QResizeEvent */*e*/)
{
    if (decorationBehaviour(DB_ButtonHide) )
        calcHiddenButtons();

    updateLayout();

    updateWindowShape();
    // FIXME: don't update() here! this would result in two paintEvent()s
    // because there is already "something" else triggering the repaint...
//     widget()->update();
}
예제 #3
0
void KCommonDecoration::maximizeChange()
{
    if( m_button[MaxButton] ) {
        m_button[MaxButton]->setOn( maximizeMode()==MaximizeFull);
        m_button[MaxButton]->setTipText( (maximizeMode()!=MaximizeFull) ?
                i18n("Maximize")
            : i18n("Restore"));
        m_button[MaxButton]->reset(KCommonDecorationButton::StateChange);
    }
    updateWindowShape();
    widget()->update();
}
예제 #4
0
 void setup() {
     ofSetVerticalSync(true);
     ofBackground(0);
     config = ofLoadJson("../../../SharedData/shared/config.json");
     float camWidth = config["camera"]["width"];
     float camHeight = config["camera"]["height"];
     float camFrameRate = config["camera"]["framerate"];
     device = config["camera"]["device"];
     if (device == "blackmagic") {
         cam = &blackmagicGrabber;
     } else {
         cam = &videoGrabber;
     }
     cam->setDesiredFrameRate(camFrameRate);
     cam->setup(camWidth, camHeight);
     clipping.allocate(camWidth, camHeight, OF_IMAGE_COLOR_ALPHA);
     toggleGrayscale = false;
     updateWindowShape();
 }
예제 #5
0
void Window::registerAttributes()
{
    _attribFunctions["fullscreen"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        switchFullscreen(args[0].asInt());
        return true;
    }, [&]() -> Values {
        return {_screenId};
    });

    _attribFunctions["decorated"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        _withDecoration = args[0].asInt() == 0 ? false : true;
        setWindowDecoration(_withDecoration);
        updateWindowShape();
        return true;
    }, [&]() -> Values {
        if (_screenId != -1)
            return Values();
        else
            return {(int)_withDecoration};
    });

    _attribFunctions["srgb"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        if (args[0].asInt() != 0)
            _srgb = true;
        else
            _srgb = false;
        return true;
    }, [&]() -> Values {
        return {_srgb};
    });

    _attribFunctions["gamma"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        _gammaCorrection = args[0].asFloat();
        return true;
    }, [&]() -> Values {
        return {_gammaCorrection};
    });

    // Attribute to configure the placement of the various texture input
    _attribFunctions["layout"] = AttributeFunctor([&](const Values& args) {
        if (args.size() < 1)
            return false;
        _layout = args;
        return true;
    }, [&]() {
        return _layout;
    });

    _attribFunctions["position"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 2)
            return false;
        _windowRect[0] = args[0].asInt();
        _windowRect[1] = args[1].asInt();
        updateWindowShape();
        return true;
    }, [&]() -> Values {
        if (_screenId != -1)
            return {};
        else
            return {_windowRect[0], _windowRect[1]};
    });

    _attribFunctions["size"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 2)
            return false;
        _windowRect[2] = args[0].asInt();
        _windowRect[3] = args[1].asInt();
        updateWindowShape();
        return true;
    }, [&]() -> Values {
        if (_screenId != -1)
            return {};
        else
            return {_windowRect[2], _windowRect[3]};
    });

    _attribFunctions["swapInterval"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        _swapInterval = max(-1, args[0].asInt());
        updateSwapInterval();
        return true;
    });

    _attribFunctions["swapTest"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 1)
            return false;
        _swapSynchronizationTesting = args[0].asInt();
        return true;
    });

    _attribFunctions["swapTestColor"] = AttributeFunctor([&](const Values& args) {
        if (args.size() != 4)
            return false;
        _swapSynchronizationColor = glm::vec4(args[0].asFloat(), args[1].asFloat(), args[2].asFloat(), args[3].asFloat());
        return true;
    });
}