当前位置: 首页>>代码示例>>C++>>正文


C++ MouseInput::setX方法代码示例

本文整理汇总了C++中MouseInput::setX方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseInput::setX方法的具体用法?C++ MouseInput::setX怎么用?C++ MouseInput::setX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MouseInput的用法示例。


在下文中一共展示了MouseInput::setX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pushMouseWheelMovedDown

    void GenericInput::pushMouseWheelMovedDown(int x, int y)
    {
        MouseInput mouseInput;
        mouseInput.setX(x);
        mouseInput.setY(y);
        mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN);

        mMouseInputQueue.push(mouseInput);
    }
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:9,代码来源:genericinput.cpp

示例2: pushMouseMoved

    void GenericInput::pushMouseMoved(int x, int y)
    {
        MouseInput mouseInput;
        mouseInput.setX(x);
        mouseInput.setY(y);
        mouseInput.setType(MouseInput::MOVED);

        mMouseInputQueue.push(mouseInput);
    }
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:9,代码来源:genericinput.cpp

示例3: pushMotionInput

 void GLUTInput::pushMotionInput(int x, int y)
 {
     MouseInput mouseInput;
     mouseInput.setX(x);
     mouseInput.setY(y);
     mouseInput.setButton(MouseInput::EMPTY);
     mouseInput.setType(MouseInput::MOVED);
     mMouseInputQueue.push(mouseInput);
 }
开发者ID:weimingtom,项目名称:guichan_memory,代码行数:9,代码来源:glutinput.cpp

示例4: pushMouseButtonReleased

    void GenericInput::pushMouseButtonReleased(int x, int y, int button)
    {
        MouseInput mouseInput;
        mouseInput.setX(x);
        mouseInput.setY(y);
        mouseInput.setButton(button);
        mouseInput.setType(MouseInput::RELEASED);

        mMouseInputQueue.push(mouseInput);
    }
开发者ID:weimingtom,项目名称:guichan_cocos2dx,代码行数:10,代码来源:genericinput.cpp

示例5: simulateMouseClick

void SDLInput::simulateMouseClick(const int x, const int y,
                                  const MouseButton::Type button)
{
    MouseInput mouseInput;
    mouseInput.setX(x);
    mouseInput.setY(y);
    mouseInput.setReal(x, y);
    mouseInput.setButton(button);
    mouseInput.setType(MouseEventType::PRESSED);
    mouseInput.setTimeStamp(SDL_GetTicks());
    mMouseInputQueue.push(mouseInput);
    mouseInput.setType(MouseEventType::RELEASED);
    mouseInput.setTimeStamp(SDL_GetTicks());
    mMouseInputQueue.push(mouseInput);
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:15,代码来源:sdlinput.cpp

示例6: pushMouseInput

 void GLUTInput::pushMouseInput(int button, int state, int x, int y)
 {
     MouseInput mouseInput;
     mouseInput.setX(x);
     mouseInput.setY(y);
     mouseInput.setButton(convertMouseButton(button));

     if (state == GLUT_DOWN)
     {
         mouseInput.setType(MouseInput::PRESSED);
     }
     else
     {
         mouseInput.setType(MouseInput::RELEASED);
     }

     mMouseInputQueue.push(mouseInput);
 }
开发者ID:weimingtom,项目名称:guichan_memory,代码行数:18,代码来源:glutinput.cpp

示例7: pushInput

void SDLInput::pushInput(const SDL_Event &event)
{
    BLOCK_START("SDLInput::pushInput")
    KeyInput keyInput;
    MouseInput mouseInput;

    switch (event.type)
    {
        case SDL_KEYDOWN:
        {
            keyInput.setType(KeyEventType::PRESSED);
            convertKeyEventToKey(event, keyInput);
            mKeyInputQueue.push(keyInput);
            break;
        }

        case SDL_KEYUP:
        {
            keyInput.setType(KeyEventType::RELEASED);
            convertKeyEventToKey(event, keyInput);
            mKeyInputQueue.push(keyInput);
            break;
        }

#ifdef USE_SDL2
        case SDL_TEXTINPUT:
            keyInput.setType(KeyEventType::PRESSED);
            keyInput.setKey(Key(Key::TEXTINPUT));
            keyInput.setText(event.text.text);
            mKeyInputQueue.push(keyInput);
            break;

        case SDL_MOUSEWHEEL:
        {
            const int y = event.wheel.y;
            if (y)
            {
                mouseInput.setX(gui->getLastMouseX());
                mouseInput.setY(gui->getLastMouseY());
#ifdef ANDROID
                mouseInput.setReal(0, 0);
#endif
                mouseInput.setButton(MouseButton::WHEEL);
                if (y > 0)
                    mouseInput.setType(MouseEventType::WHEEL_MOVED_UP);
                else
                    mouseInput.setType(MouseEventType::WHEEL_MOVED_DOWN);
                mouseInput.setTimeStamp(SDL_GetTicks());
                mMouseInputQueue.push(mouseInput);
            }

            break;
        }
#endif

#ifdef ANDROID
#ifndef USE_SDL2
        case SDL_ACCELEROMETER:
            break;
#endif
#endif

        case SDL_MOUSEBUTTONDOWN:
        {
            mMouseDown = true;
            const int scale = mainGraphics->getScale();
            const int x = event.button.x / scale;
            const int y = event.button.y / scale;
            mouseInput.setX(x);
            mouseInput.setY(y);
#ifdef ANDROID
#ifdef USE_SDL2
            mouseInput.setReal(x, y);
#else
            mouseInput.setReal(event.button.realx / scale,
                event.button.realy / scale);
#endif
#endif
            mouseInput.setButton(convertMouseButton(event.button.button));

#ifndef USE_SDL2
            if (event.button.button == SDL_BUTTON_WHEELDOWN)
                mouseInput.setType(MouseEventType::WHEEL_MOVED_DOWN);
            else if (event.button.button == SDL_BUTTON_WHEELUP)
                mouseInput.setType(MouseEventType::WHEEL_MOVED_UP);
            else
#endif
                mouseInput.setType(MouseEventType::PRESSED);
            mouseInput.setTimeStamp(SDL_GetTicks());
            mMouseInputQueue.push(mouseInput);
            break;
        }
        case SDL_MOUSEBUTTONUP:
        {
            mMouseDown = false;
            const int scale = mainGraphics->getScale();
            const int x = event.button.x / scale;
            const int y = event.button.y / scale;
            mouseInput.setX(x);
            mouseInput.setY(y);
//.........这里部分代码省略.........
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:101,代码来源:sdlinput.cpp

示例8: pushInput

    void SDLInput::pushInput(SDL_Event event)
    {
        KeyInput keyInput;
        MouseInput mouseInput;

        switch (event.type)
        {
            case SDL_KEYDOWN:
            {
                int value = convertSDLEventToGuichanKeyValue(event);

                if (value == -1)
                {
                    value = (int)event.key.keysym.unicode;
                } 
               
                keyInput.setKey(Key(value));
                keyInput.setType(KeyInput::PRESSED);
                keyInput.setShiftPressed(event.key.keysym.mod & KMOD_SHIFT);
                keyInput.setControlPressed(event.key.keysym.mod & KMOD_CTRL);
                keyInput.setAltPressed(event.key.keysym.mod & KMOD_ALT);
                keyInput.setMetaPressed(event.key.keysym.mod & KMOD_META);
                keyInput.setNumericPad(event.key.keysym.sym >= SDLK_KP0
                                     && event.key.keysym.sym <= SDLK_KP_EQUALS);

                mKeyInputQueue.push(keyInput);
                break;
            }

            case SDL_KEYUP:
            {
                int value = convertSDLEventToGuichanKeyValue(event);

                if (value == -1)
                {
                    value = (int)event.key.keysym.sym;
                } 

                keyInput.setKey(Key(value));
                keyInput.setType(KeyInput::RELEASED);
                keyInput.setShiftPressed(event.key.keysym.mod & KMOD_SHIFT);
                keyInput.setControlPressed(event.key.keysym.mod & KMOD_CTRL);
                keyInput.setAltPressed(event.key.keysym.mod & KMOD_ALT);
                keyInput.setMetaPressed(event.key.keysym.mod & KMOD_META);
                keyInput.setNumericPad(event.key.keysym.sym >= SDLK_KP0
                                     && event.key.keysym.sym <= SDLK_KP_EQUALS);

                mKeyInputQueue.push(keyInput);
                break;
            }

            case SDL_MOUSEBUTTONDOWN:
                mMouseDown = true;
                mouseInput.setX(event.button.x);
                mouseInput.setY(event.button.y);
                mouseInput.setButton(convertMouseButton(event.button.button));

                if (event.button.button == SDL_BUTTON_WHEELDOWN)
                {
                  mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN);
                }
                else if (event.button.button == SDL_BUTTON_WHEELUP)
                {
                  mouseInput.setType(MouseInput::WHEEL_MOVED_UP);
                }
                else
                {
                  mouseInput.setType(MouseInput::PRESSED);
                }
                mouseInput.setTimeStamp(SDL_GetTicks());
                mMouseInputQueue.push(mouseInput);
                break;

            case SDL_MOUSEBUTTONUP:
                mMouseDown = false;
                mouseInput.setX(event.button.x);
                mouseInput.setY(event.button.y);
                mouseInput.setButton(convertMouseButton(event.button.button));
                mouseInput.setType(MouseInput::RELEASED);
                mouseInput.setTimeStamp(SDL_GetTicks());
                mMouseInputQueue.push(mouseInput);
                break;

            case SDL_MOUSEMOTION:
                mouseInput.setX(event.button.x);
                mouseInput.setY(event.button.y);
                mouseInput.setButton(MouseInput::EMPTY);
                mouseInput.setType(MouseInput::MOVED);
                mouseInput.setTimeStamp(SDL_GetTicks());
                mMouseInputQueue.push(mouseInput);
                break;

            case SDL_ACTIVEEVENT:
                /*
                * This occurs when the mouse leaves the window and the Gui-chan
                * application loses its mousefocus.
                */
                if ((event.active.state & SDL_APPMOUSEFOCUS)
                  && !event.active.gain)
                {
//.........这里部分代码省略.........
开发者ID:ArkBriar,项目名称:rlvm,代码行数:101,代码来源:sdlinput.cpp


注:本文中的MouseInput::setX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。