本文整理汇总了C++中Input::OnRelease方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::OnRelease方法的具体用法?C++ Input::OnRelease怎么用?C++ Input::OnRelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::OnRelease方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseButtonCallback
void MouseButtonCallback(int aIndex, int aState)
{
if (aState == GLFW_PRESS)
input.OnPress(Input::TYPE_MOUSE_BUTTON, 0, aIndex);
else
input.OnRelease(Input::TYPE_MOUSE_BUTTON, 0, aIndex);
}
示例2: KeyCallback
void KeyCallback(int aIndex, int aState)
{
if (aState == GLFW_PRESS)
{
input.OnPress(Input::TYPE_KEYBOARD, 0, aIndex);
switch (aIndex)
{
case GLFW_KEY_F4:
if (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT))
setgamestate = STATE_QUIT;
break;
case GLFW_KEY_ENTER:
if (glfwGetKey(GLFW_KEY_LALT) || glfwGetKey(GLFW_KEY_RALT))
{
CloseWindow();
SCREEN_FULLSCREEN = !SCREEN_FULLSCREEN;
OpenWindow();
}
break;
case GLFW_KEY_ESC:
if (curgamestate == STATE_PLAY)
{
if (escape)
EscapeMenuExit();
else
EscapeMenuEnter();
}
break;
case 'P':
if (glfwGetKey(GLFW_KEY_LSHIFT) || glfwGetKey(GLFW_KEY_RSHIFT))
{
paused = true;
singlestep = true;
}
else
{
paused = !paused;
}
if (paused)
Pause();
else
Resume();
break;
}
}
else
{
input.OnRelease(Input::TYPE_KEYBOARD, 0, aIndex);
}
}
示例3: RunState
//.........这里部分代码省略.........
break;
case SDLK_ESCAPE:
if (curgamestate == STATE_PLAY)
{
if (escape)
EscapeMenuExit();
else
EscapeMenuEnter();
}
break;
case SDLK_PAUSE:
if (event.key.keysym.mod & KMOD_SHIFT)
{
paused = true;
singlestep = true;
}
else
{
paused = !paused;
}
if (paused)
Pause();
else
Resume();
break;
case SDLK_PRINT:
Screenshot();
break;
}
break;
case SDL_KEYUP:
input.OnRelease( Input::TYPE_KEYBOARD, event.key.which, event.key.keysym.sym );
break;
case SDL_MOUSEMOTION:
input.OnAxis( Input::TYPE_MOUSE_AXIS, event.motion.which, 0, float(event.motion.x * 2 - SCREEN_WIDTH) / float(SCREEN_HEIGHT) );
input.OnAxis( Input::TYPE_MOUSE_AXIS, event.motion.which, 1, float(event.motion.y * 2 - SCREEN_HEIGHT) / float(SCREEN_HEIGHT) );
input.OnAxis( Input::TYPE_MOUSE_AXIS, event.motion.which, 2, event.motion.xrel / 32.0f );
input.OnAxis( Input::TYPE_MOUSE_AXIS, event.motion.which, 3, event.motion.yrel / 32.0f );
break;
case SDL_MOUSEBUTTONDOWN:
input.OnPress( Input::TYPE_MOUSE_BUTTON, event.button.which, event.button.button );
break;
case SDL_MOUSEBUTTONUP:
input.OnRelease( Input::TYPE_MOUSE_BUTTON, event.button.which, event.button.button );
break;
case SDL_JOYAXISMOTION:
input.OnAxis( Input::TYPE_JOYSTICK_AXIS, event.jaxis.which, event.jaxis.axis, event.jaxis.value / 32767.0f );
break;
case SDL_JOYBUTTONDOWN:
input.OnPress( Input::TYPE_JOYSTICK_BUTTON, event.jaxis.which, event.jbutton.button );
break;
case SDL_JOYBUTTONUP:
input.OnRelease( Input::TYPE_JOYSTICK_BUTTON, event.jbutton.which, event.jbutton.button );
break;
case SDL_QUIT:
setgamestate = STATE_QUIT;
break;
}
}
// get loop time in ticks
unsigned int nextticks = SDL_GetTicks();
float delta = (nextticks - ticks) / 1000.0f;
ticks = nextticks;