本文整理汇总了C++中SDL_StartTextInput函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_StartTextInput函数的具体用法?C++ SDL_StartTextInput怎么用?C++ SDL_StartTextInput使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_StartTextInput函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IN_Init
/*
===============
IN_Init
===============
*/
void IN_Init( void *windowData )
{
int appState;
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )" );
return;
}
SDL_window = (SDL_Window *)windowData;
Com_DPrintf( "\n------- Input Initialization -------\n" );
in_keyboardDebug = Cvar_Get( "in_keyboardDebug", "0", CVAR_ARCHIVE );
// mouse variables
in_mouse = Cvar_Get( "in_mouse", "1", CVAR_ARCHIVE );
in_nograb = Cvar_Get( "in_nograb", "0", CVAR_ARCHIVE );
in_joystick = Cvar_Get( "in_joystick", "0", CVAR_ARCHIVE|CVAR_LATCH );
in_joystickThreshold = Cvar_Get( "joy_threshold", "0.15", CVAR_ARCHIVE );
SDL_StartTextInput( );
mouseAvailable = ( in_mouse->value != 0 );
IN_DeactivateMouse( );
appState = SDL_GetWindowFlags( SDL_window );
Cvar_SetValue( "com_unfocused", !( appState & SDL_WINDOW_INPUT_FOCUS ) );
Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );
IN_InitJoystick( );
Com_DPrintf( "------------------------------------\n" );
}
示例2: assert
/**
* @brief Called when the node got the focus
*/
void uiTextEntryNode::onFocusGained (uiNode_t* node)
{
assert(editedCvar == nullptr);
/* skip '*cvar ' */
const char* cvarRef = "*cvar:";
editedCvar = Cvar_GetOrCreate(&((const char*)node->text)[strlen(cvarRef)]);
assert(editedCvar);
Q_strncpyz(cvarValueBackup, editedCvar->string, sizeof(cvarValueBackup));
isAborted = false;
EXTRADATA(node).cursorPosition = UTF8_strlen(editedCvar->string);
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_StartTextInput();
vec2_t pos;
UI_GetNodeAbsPos(node, pos);
SDL_Rect r = {static_cast<int>(pos[0]), static_cast<int>(pos[1]), static_cast<int>(node->box.size[0]), static_cast<int>(node->box.size[1])};
SDL_SetTextInputRect(&r);
#else
#ifdef ANDROID
char buf[MAX_CVAR_EDITING_LENGTH];
Q_strncpyz(buf, editedCvar->string, sizeof(buf));
SDL_ANDROID_GetScreenKeyboardTextInput(buf, sizeof(buf));
Cvar_ForceSet(editedCvar->name, buf);
UI_TextEntryNodeValidateEdition(node);
UI_RemoveFocus();
#endif
#endif
}
示例3: InitSDL
static void InitSDL()
{
#if OS_LINUX
// In fullscreen mode when SDL is compiled with DGA support, the mouse
// sensitivity often appears to be unusably wrong (typically too low).
// (This seems to be reported almost exclusively on Ubuntu, but can be
// reproduced on Gentoo after explicitly enabling DGA.)
// Disabling the DGA mouse appears to fix that problem, and doesn't
// have any obvious negative effects.
setenv("SDL_VIDEO_X11_DGAMOUSE", "0", 0);
#endif
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) < 0)
{
LOGERROR(L"SDL library initialization failed: %hs", SDL_GetError());
throw PSERROR_System_SDLInitFailed();
}
atexit(SDL_Quit);
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_StartTextInput();
#else
SDL_EnableUNICODE(1);
#endif
}
示例4: 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();
}
示例5: SDL_StartTextInput
void SDL2EventHandler::setTextInputMode(bool m)
{
if(m)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
示例6: SDL_StartTextInput
void j1Input::StartTextInput(SDL_Rect* rect)
{
text_input = true;
SDL_StartTextInput();
if(rect != NULL)
SDL_SetTextInputRect(rect);
}
示例7: SDL_StartTextInput
void j1Input::StartInput(p2SString edit_input, int pos)
{
SDL_StartTextInput();
//so it can have lots of input boxes
input_text = edit_input;
cursor_pos = pos;
enable_input = true;
}
示例8: setKeyboardOptions
void System::showVirtualKeyboard(int flags)
{
jnipp::Method<void, int> setKeyboardOptions(m_NidroidClass, "setKeyboardOptions", "(I)V");
setKeyboardOptions(m_Nidroid, flags);
SDL_StartTextInput();
}
示例9: SDL_StartTextInput
void ClientConsole::toggleConsole ()
{
_active ^= true;
if (_active)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
示例10: SDL_StartTextInput
void Connect::onEnter()
{
SDL_StartTextInput();
name = "Type Opponents Hostname ...";
server->setText(font, name, 100);
server->setPosition(1920 / 2, 500, Center);
}
示例11: SDL_StartTextInput
/**
* \brief Initializes the input event manager.
*/
void InputEvent::initialize() {
// Initialize text events.
SDL_StartTextInput();
// Initialize the joypad.
set_joypad_enabled(true);
}
示例12: assert
void TextBox::OnFocusAcquired()
{
assert(SDL_IsTextInputActive() == SDL_FALSE);
m_caret.StartAnimation();
SetBorderColor(SDLColor(64, 64, 128, 0));
auto loc = GetLocation();
SDL_SetTextInputRect(&loc);
SDL_StartTextInput();
}
示例13: ui_console_toggle
void ui_console_toggle(bool enable)
{
console_enabled = enable;
if (console_enabled) {
SDL_StartTextInput();
} else {
SDL_StopTextInput();
}
}
示例14: SDL_StartTextInput
void InputHandler::startTextInput() {
if (!textInputEnabled) {
SDL_StartTextInput();
textInputEnabled = true;
#if defined(DEBUG_IH_TEXT_INPUT) && DEBUG_IH_TEXT_INPUT
DEBUG_BEGIN << DEBUG_IH_PREPEND << "TextInput ENABLED" << std::endl;
#endif
}
}
示例15: Redraw
void Redraw()
{
int w = 0, h = textRect.h;
SDL_Rect cursorRect, underlineRect;
SDL_FillRect(screen, &textRect, backColor);
#ifdef HAVE_SDL_TTF
if (strlen(text))
{
RenderText(screen, font, text, textRect.x, textRect.y, textColor);
TTF_SizeUTF8(font, text, &w, &h);
}
#endif
markedRect.x = textRect.x + w;
markedRect.w = textRect.w - w;
if (markedRect.w < 0)
{
SDL_Flip(screen);
// Stop text input because we cannot hold any more characters
SDL_StopTextInput();
return;
}
else
{
SDL_StartTextInput();
}
cursorRect = markedRect;
cursorRect.w = 2;
cursorRect.h = h;
SDL_FillRect(screen, &markedRect, backColor);
if (markedText)
{
#ifdef HAVE_SDL_TTF
RenderText(screen, font, markedText, markedRect.x, markedRect.y, textColor);
TTF_SizeUTF8(font, markedText, &w, &h);
#endif
underlineRect = markedRect;
underlineRect.y += (h - 2);
underlineRect.h = 2;
underlineRect.w = w;
cursorRect.x += w + 1;
SDL_FillRect(screen, &underlineRect, lineColor);
}
SDL_FillRect(screen, &cursorRect, lineColor);
SDL_Flip(screen);
SDL_SetTextInputRect(&markedRect);
}