Ignore:
Timestamp:
Nov 25, 2011, 12:30:26 AM (12 years ago)
Author:
sam
Message:

nacl: quick and dirty mouse support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/platform/nacl/nacl_instance.cpp

    r1084 r1087  
    1818#include <ppapi/cpp/module.h>
    1919#include <ppapi/cpp/completion_callback.h>
     20#include <ppapi/cpp/input_event.h>
    2021
    2122#include "core.h"
     
    3233      m_size(0, 0)
    3334{
    34     ;
     35    RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
    3536}
    3637
     
    102103}
    103104
     105bool NaClInstance::HandleInputEvent(const pp::InputEvent& event)
     106{
     107    switch (event.GetType())
     108    {
     109    case PP_INPUTEVENT_TYPE_MOUSEDOWN:
     110        Input::SetMouseButton(pp::MouseInputEvent(event).GetButton());
     111        break;
     112    case PP_INPUTEVENT_TYPE_MOUSEUP:
     113        Input::UnsetMouseButton(pp::MouseInputEvent(event).GetButton());
     114        break;
     115    case PP_INPUTEVENT_TYPE_MOUSEMOVE:
     116        Input::SetMousePos(ivec2(pp::MouseInputEvent(event).GetPosition().x(), opengl_context_->GetSize().height() - 1 - pp::MouseInputEvent(event).GetPosition().y()));
     117        break;
     118    default:
     119        break;
     120    }
     121    return true;
     122}
     123
    104124void NaClInstance::DrawSelf()
    105125{
Note: See TracChangeset for help on using the changeset viewer.