void PostGameScene::onFocus()
{
	std::shared_ptr<MouseEventDataShow> showMouse(new MouseEventDataShow(false));
	m_EventManager->queueEvent(showMouse);
	std::shared_ptr<MouseEventDataLock> lockMouse(new MouseEventDataLock(true));
	m_EventManager->queueEvent(lockMouse);
}
// Main thread of control for this active object
void InputWindowXWin::controlLoop()
{
   vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_STATE_LVL)
      << "gadget::InputWindowXWin::controlLoop: Thread started.\n"
      << vprDEBUG_FLUSH;

   while (NULL == vpr::Thread::self())
   {
      vpr::System::usleep(50);
      vprDEBUG(vprDBG_ALL,vprDBG_VERB_LVL)
         << "gadget::InputWindowXWin: Waiting for (thread::self() != NULL)\n"
         << vprDEBUG_FLUSH;
   }
   mThread = (vpr::Thread*) vpr::Thread::self();

   // Open the local X window
   openLocalWindow();

   // Obtain width and height info from windows
   setupWindowWidthAndHeight();

   // Sync up with window
   XSync(mXDisplay, 0);

   // If we have initial locked, then we need to lock the system
   if (mLockState == Lock_LockKey)      // Means that we are in the initially locked state
   {
      vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_STATE_LVL)
         << "gadget::InputWindowXWin::controlLoop: Mouse set to initial lock. Locking it now.\n"
         << vprDEBUG_FLUSH;
      lockMouse( NULL );                     // Lock the mouse
   }

   // Loop on updating
   while (!mExitFlag)
   {
      sample();
      long usleep_time(1); // to be set...

      usleep_time = mSleepTimeMS*1000;

      vpr::System::usleep(usleep_time);
   }

   XFlush(mXDisplay);

   if ( mEmptyCursorSet )
   {
      XFreeCursor(mXDisplay, mEmptyCursor);
   }

   // Exit, cleanup code
   XDestroyWindow(mXDisplay, mXWindow);
   XCloseDisplay((::Display*) mXDisplay);
}
Esempio n. 3
0
Window::Window(HINSTANCE p_hInstance, int p_width, int p_height, int p_showWindowFlag)
{
	m_hInstance = p_hInstance; 

	// Register class
	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX); 
	wcex.style          = CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc    = WndProc; // Callback function
	wcex.cbClsExtra     = 0;
	wcex.cbWndExtra     = 0;
	wcex.hInstance      = m_hInstance;
	wcex.hIcon          = 0;
	wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
	wcex.lpszMenuName   = NULL;
	wcex.lpszClassName  = "Amalgamation";
	wcex.hIconSm        = 0;

	if( !RegisterClassEx(&wcex) )
	{
		throw WindowException();
	}

	// Create window
	RECT rc = { 0, 0, p_width, p_height};
	AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );

	if(!(m_hWnd = CreateWindow(
		"Amalgamation",
		"Amalgamation",
		WS_OVERLAPPEDWINDOW,
		0,
		0,
		rc.right - rc.left,
		rc.bottom - rc.top,
		NULL,
		NULL,
		m_hInstance,
		NULL)))
	{
		throw WindowException();
	}
	m_autoResize=false;
	m_sizeIsDirty=false;
	m_shutDownRequest=false;
	m_isFullscreen=false;
	m_instance=this;
	ShowWindow( m_hWnd, p_showWindowFlag );
	m_windowRegistered=true;
	lockMouse();
}
Esempio n. 4
0
bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) {
    if (_npcFlags & NPCFLAG_40000)
        return true;

    CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(msg);
    switch (msg->_dialogueId) {
    case 41684:
    case 41686:
    case 41787:
    case 41788:
    case 41789:
        lockMouse();
        break;
    default:
        break;
    }

    return true;
}
Esempio n. 5
0
bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
    switch (msg->_action) {
    case 19:
        inc54();
        lockMouse();
        petSetArea(PET_CONVERSATION);
        playClip("ReprogramPETInHand", MOVIE_NOTIFY_OBJECT);
        _npcFlags |= NPCFLAG_10000;
        _classNum = (PassengerClass)msg->_param1;

        switch (_classNum) {
        case FIRST_CLASS:
            petDisplayMessage(UPGRADED_TO_FIRST_CLASS);
            setPassengerClass(_classNum);
            petReassignRoom(_classNum);
            break;
        case SECOND_CLASS:
            petDisplayMessage(UPGRADED_TO_SECOND_CLASS);
            setPassengerClass(_classNum);
            petReassignRoom(_classNum);
            break;
        case THIRD_CLASS:
            setPassengerClass(THIRD_CLASS);
            petReassignRoom(_classNum);
            break;
        default:
            break;
        }

    case 20:
        if (getPassengerClass() == 1) {
            CPetControl *petControl = getPetControl();
            if (petControl)
                petControl->changeLocationClass(UNCHECKED);
        }
        break;

    case 21:
        if (getPassengerClass() == FIRST_CLASS) {
            CPetControl *petControl = getPetControl();
            if (petControl)
                petControl->changeLocationClass(THIRD_CLASS);
        }
        break;

    case 22:
        if (getPassengerClass() == FIRST_CLASS) {
            CPetControl *petControl = getPetControl();
            if (petControl)
                petControl->changeLocationClass(SECOND_CLASS);
        }
        break;

    case 23:
        if (getPassengerClass() == FIRST_CLASS) {
            CPetControl *petControl = getPetControl();
            if (petControl)
                petControl->changeLocationClass(FIRST_CLASS);
        }
        break;

    case 26:
        _npcFlags |= NPCFLAG_80000;
        CTurnOff turnOff;
        turnOff.execute(this);
        lockMouse();
        break;
    }

    return true;
}
bool CMovePlayerInParrotRoom::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
	lockMouse();
	CPanningAwayFromParrotMsg awayMsg(this);
	awayMsg.execute("PerchedParrot");
	return true;
}