コード例 #1
0
ファイル: module.cpp プロジェクト: boyjimeking/paintown
 explicit PaintownInstance(PP_Instance instance, pp::Core * core):
     pp::Instance(instance),
     core(core){
     the_instance = this;
     RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
     RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
 }
コード例 #2
0
void MoonlightInstance::OnConnectionStarted(uint32_t unused) {
    // Tell the front end
    pp::Var response("Connection Established");
    PostMessage(response);

    // Start receiving input events
    RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL);

    // Filtering is suboptimal but it ensures that we can pass keyboard events
    // to the browser when mouse lock is disabled. This is neccessary for Esc
    // to kick the app out of full-screen.
    RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
}
コード例 #3
0
ファイル: NaClApplication.cpp プロジェクト: ArEnSc/magnum
bool NaClApplication::tryCreateContext(const Configuration& configuration) {
    CORRADE_ASSERT(!c, "Platform::NaClApplication::tryCreateContext(): context already created", false);

    viewportSize = configuration.size();

    const std::int32_t attributes[] = {
        PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
        PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
        PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
        PP_GRAPHICS3DATTRIB_SAMPLES, configuration.sampleCount(),
        PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, configuration.sampleCount() > 1 ? 1 : 0,
        PP_GRAPHICS3DATTRIB_WIDTH, configuration.size().x(),
        PP_GRAPHICS3DATTRIB_HEIGHT, configuration.size().y(),
        PP_GRAPHICS3DATTRIB_NONE
    };

    graphics = new pp::Graphics3D(this, attributes);
    if(graphics->is_null()) {
        Error() << "Platform::NaClApplication::tryCreateContext(): cannot create context";
        delete graphics;
        graphics = nullptr;
        return false;
    }
    if(!BindGraphics(*graphics)) {
        Error() << "Platform::NaClApplication::tryCreateContext(): cannot bind graphics";
        delete graphics;
        graphics = nullptr;
        return false;
    }

    fullscreen = new pp::Fullscreen(this);

    glSetCurrentContextPPAPI(graphics->pp_resource());

    /* Enable input handling for mouse and keyboard */
    RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE|PP_INPUTEVENT_CLASS_WHEEL);
    RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);

    c = new Context;
    return true;
}
コード例 #4
0
ファイル: gbox.cpp プロジェクト: dale6john/dj_nacl
 void GboxInstance::Hello() {
   RequestInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD | PP_INPUTEVENT_CLASS_MOUSE);
   RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
 }