本文整理汇总了C++中SDL_StopTextInput函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_StopTextInput函数的具体用法?C++ SDL_StopTextInput怎么用?C++ SDL_StopTextInput使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_StopTextInput函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyboard_startStopTextInput
/**
* @brief Check call to SDL_StartTextInput and SDL_StopTextInput
*
* @sa http://wiki.libsdl.org/moin.cgi/SDL_StartTextInput
* @sa http://wiki.libsdl.org/moin.cgi/SDL_StopTextInput
*/
int
keyboard_startStopTextInput(void *arg)
{
/* Start-Stop */
SDL_StartTextInput();
SDLTest_AssertPass("Call to SDL_StartTextInput()");
SDL_StopTextInput();
SDLTest_AssertPass("Call to SDL_StopTextInput()");
/* Stop-Start */
SDL_StartTextInput();
SDLTest_AssertPass("Call to SDL_StartTextInput()");
/* Start-Start */
SDL_StartTextInput();
SDLTest_AssertPass("Call to SDL_StartTextInput()");
/* Stop-Stop */
SDL_StopTextInput();
SDLTest_AssertPass("Call to SDL_StopTextInput()");
SDL_StopTextInput();
SDLTest_AssertPass("Call to SDL_StopTextInput()");
return TEST_COMPLETED;
}
示例2: SDL_StartTextInput
void SDL2EventHandler::setTextInputMode(bool m)
{
if(m)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
示例3: SDL_StartTextInput
void Keyboard::setTextInput(bool enable)
{
if (enable)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
示例4: mRenderer
Loop::Loop(const Renderer& renderer, Gui& gui) :
mRenderer(renderer),
mGui(gui),
MAT_SIZE(Config::get().getValue("matrix_size")),
PREGEN_BOIDS(Config::get().getValue("pregenerated_boids")),
SEPARATION_DISTANCE(Config::get().getValue("separation_distance")),
COHESION_DIVISOR(Config::get().getValue("cohesion_divisor")),
ALIGNMENT_DIVISOR(Config::get().getValue("alignment_divisor")),
GUI_WIDTH(Config::get().getValue("gui_width")),
SCREEN_WIDTH(Config::get().getValue("screen_width")),
SCREEN_HEIGHT(Config::get().getValue("screen_height")),
mDataStructure(MAT_SIZE, PREGEN_BOIDS),
mIsQuit(false),
mIsLeftClickPressed(false),
mIsRightClickPressed(false),
mIsLeaderOn(false),
mIsBoidVectorRendered(false),
mIsDelaunayRendered(true),
mIsDelaunayUpToDate(false),
mTimeScale(1.0f),
mFood(-10, -10),
mPathFinish(GUI_WIDTH + 30.0f, 30.0f),
mLeader(0),
mObjectPlacement(0)
{
SDL_StopTextInput();
initializeGui();
updateBoidCounter();
mGui.updateElementContent(1, mBoidRules.changeParameter(mBoidRules.SEPARATION, .0f));
mGui.updateElementContent(2, mBoidRules.changeParameter(mBoidRules.COHESION, .0f));
mGui.updateElementContent(3, mBoidRules.changeParameter(mBoidRules.ALIGNMENT, .0f));
mGui.updateElementContent(4, mTimeScale * 100);
}
示例5: SDL_JoystickClose
/**
* \brief Quits the input event manager.
*/
void InputEvent::quit() {
if (joystick != nullptr) {
SDL_JoystickClose(joystick);
}
SDL_StopTextInput();
}
示例6: main
int main( int argc, char* args[] )
{
//Start up SDL and create window
if (!init())
{
printf("Failed to initalize!\n");
}//end if
else
{
//Load Media
if (!loadMedia())
{
printf("Failed to load media!\n");
}//end if
else
{
// Main Loop Flag
bool quit = false;
//Event Handler
SDL_Event e;
//enable text input
SDL_StartTextInput();
//While application is running
while (!quit)
{
//Handle events on queue
while (SDL_PollEvent(&e) != 0)
{
//User request quite
if (e.type == SDL_QUIT)
{
quit = true;
}//end if
else if (e.type == SDL_TEXTINPUT)
{
int x = 0, y = 0;
SDL_GetMouseState(&x, &y);
handleKeys(e.text.text[0], x, y);
}
}//end while
//Render quad
render();
//Update screen
SDL_GL_SwapWindow(gWindow);
}//end main loop
SDL_StopTextInput();
}//end else
}//end if
//Free resources and close SDL
close();
system("pause");
return 0;
}// end main func
示例7: main
int main(int argc, char* args[])
{
if (!init(SCREEN_WIDTH, SCREEN_HEIGHT, "Lab 01", &gContext)) {
fprintf(stderr, "Failed to initialize\n");
return 1;
}
gProgram = gl_compileShaderProgram(VERTEX_SHADER, FRAGMENT_SHADER);
// gShape = shapes_makeTriangleStrip();
gShape = shapes_makeCircle(100, 0.4);
glUseProgram(gProgram);
SDL_Event e;
SDL_StartTextInput();
while (!gContext.quit) {
while(SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
gContext.quit = true;
} else if(e.type == SDL_TEXTINPUT) {
int x = 0, y = 0;
SDL_GetMouseState(&x, &y);
handleKeys(e.text.text[0], x, y);
}
}
render();
SDL_GL_SwapWindow(gContext.window);
}
SDL_StopTextInput();
shutdown(&gContext);
return 0;
}
示例8: StopTextInput
void StopTextInput(std::string* stream) {
_stoppingstream = stream;
if (_stoppingstream == _startingstream) {
SDL_StopTextInput();
_startingstream = nullptr;
}
}
示例9: textinput_focus
void textinput_focus(component *c, int focus) {
if(focus) {
SDL_StartTextInput();
} else {
SDL_StopTextInput();
}
}
示例10: SDL_StartTextInput
Input InputManager::get_input(){
static bool exit = false;
frame_text.resize(0);
SDL_Event evnt;
SDL_StartTextInput();
//Will keep looping until there are no more events to process
while (SDL_PollEvent(&evnt)) {
switch (evnt.type) {
case SDL_QUIT:
return Input::EXIT_REQUEST;
break;
case SDL_MOUSEMOTION:
set_mouse_coords((F32)evnt.motion.x, (F32)evnt.motion.y);
break;
case SDL_TEXTINPUT:
frame_text += evnt.text.text;
break;
case SDL_KEYDOWN:
key_press(evnt.key.keysym.sym , KEYBOARD);
break;
case SDL_KEYUP:
key_release(evnt.key.keysym.sym , KEYBOARD);
break;
case SDL_MOUSEBUTTONDOWN:
key_press(evnt.button.button , MOUSE);
break;
case SDL_MOUSEBUTTONUP:
key_release(evnt.button.button , MOUSE);
break;
case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */
key_press(evnt.jbutton.button , CONTROLLER);
break;
case SDL_JOYBUTTONUP: /* Handle Joystick Button Presses */
key_release(evnt.jbutton.button , CONTROLLER);
break;
case SDL_JOYAXISMOTION:
switch (evnt.jaxis.axis){
case 0: set_controller_axis_coord(&m_controller_LX_coords.x, evnt.jaxis.value); break;
case 1: set_controller_axis_coord(&m_controller_LX_coords.y, evnt.jaxis.value); break;
case 2: set_controller_axis_coord(&m_controller_RX_coords.x, evnt.jaxis.value); break;
case 3: set_controller_axis_coord(&m_controller_RX_coords.y, evnt.jaxis.value); break;
}
}
}
SDL_StopTextInput();
if (is_key_pressed(SDLK_ESCAPE,KEYBOARD))exit = !exit;
if(!exit)SDL_WarpMouseInWindow(m_window, WINDOW_WIDTH / 2.0f, WINDOW_HEIGHT / 2.0f);
return Input::OK;
}
示例11: SDL_StartTextInput
void Application::keyEvent(Context& context, const KeyPressEvent& event)
{
input.setPressed(event.getCode(), event.isPressed());
if (event.isPressed())
{
if (event.getCode() == SDLK_BACKQUOTE)
{
console.toggle();
if (console.isActive())
{
SDL_StartTextInput();
}
else if (context.is(*game))
{
SDL_StopTextInput();
}
}
if (console.isActive())
{
console.keyEvent(event.getCode(), event.getModifiers());
}
else
{
context.keyEvent(event);
}
}
}
示例12: grabText
void grabText(textbox *pTextbox, const SDL_Event& e)
{
if(pTextbox != NULL)
{
if(pTextbox->GetType() == "textbox")
{
SDL_StartTextInput();
do
{
//Loop until the text input events are done.
if(SDL_PollEvent((SDL_Event*)&e))
{
//check the input events
switch(e.type)
{
case SDL_TEXTINPUT:
if(e.text.text != "")
{
//If the text is not empty, we want to display it.
pTextbox->changeMsg(pTextbox->GetText() + std::string(e.text.text), pTextbox->GetRenderer());
pTextbox->Draw(*pTextbox->GetRenderer());
}
}
}
}while(e.key.keysym.scancode != SDL_SCANCODE_RETURN);
SDL_StopTextInput();
}
}
}
示例13: IN_Init
void IN_Init (void)
{
textmode = Key_TextEntry();
if (textmode)
SDL_StartTextInput();
else
SDL_StopTextInput();
if (safemode || COM_CheckParm("-nomouse"))
{
no_mouse = true;
/* discard all mouse events when input is deactivated */
IN_BeginIgnoringMouseEvents();
}
Cvar_RegisterVariable(&in_debugkeys);
Cvar_RegisterVariable(&joy_sensitivity_yaw);
Cvar_RegisterVariable(&joy_sensitivity_pitch);
Cvar_RegisterVariable(&joy_deadzone);
Cvar_RegisterVariable(&joy_deadzone_trigger);
Cvar_RegisterVariable(&joy_invert);
Cvar_RegisterVariable(&joy_exponent);
Cvar_RegisterVariable(&joy_swapmovelook);
Cvar_RegisterVariable(&joy_enable);
IN_Activate();
IN_StartupJoystick();
}
示例14: SDL_StartTextInput
void ClientConsole::toggleConsole ()
{
_active ^= true;
if (_active)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
示例15: StopTextInput
void StopTextInput()
{
SDL_StopTextInput(); // disable text events
CurrentKey = 0;
memset(text, 0x0, sizeof(text));
GetTextEvents = false;
debug(LOG_INPUT, "SDL text events stopped");
}