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


C++ SDL_StartTextInput函数代码示例

本文整理汇总了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" );
}
开发者ID:Hasimir,项目名称:ioq3,代码行数:40,代码来源:sdl_input.c

示例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
}
开发者ID:drone-pl,项目名称:ufoai,代码行数:31,代码来源:ui_node_textentry.cpp

示例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
}
开发者ID:Gallaecio,项目名称:0ad,代码行数:25,代码来源:GameSetup.cpp

示例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();
}
开发者ID:aonorin,项目名称:vkQuake,代码行数:29,代码来源:in_sdl.c

示例5: SDL_StartTextInput

void SDL2EventHandler::setTextInputMode(bool m)
{
    if(m)
        SDL_StartTextInput();
    else
        SDL_StopTextInput();
}
开发者ID:hbirchtree,项目名称:coffeecutie,代码行数:7,代码来源:csdl2_eventhandler.cpp

示例6: SDL_StartTextInput

void j1Input::StartTextInput(SDL_Rect* rect)
{
	text_input = true;
	SDL_StartTextInput();

	if(rect != NULL)
		SDL_SetTextInputRect(rect);
}
开发者ID:DRed96,项目名称:GameDevelopment,代码行数:8,代码来源:j1Input.cpp

示例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;
}
开发者ID:joeyGumer,项目名称:Inventory_System,代码行数:8,代码来源:j1Input.cpp

示例8: setKeyboardOptions

void System::showVirtualKeyboard(int flags)
{
    jnipp::Method<void, int> setKeyboardOptions(m_NidroidClass, "setKeyboardOptions", "(I)V");

    setKeyboardOptions(m_Nidroid, flags);

    SDL_StartTextInput();
}
开发者ID:nidium,项目名称:Nidium,代码行数:8,代码来源:System.cpp

示例9: SDL_StartTextInput

void ClientConsole::toggleConsole ()
{
	_active ^= true;
	if (_active)
		SDL_StartTextInput();
	else
		SDL_StopTextInput();
}
开发者ID:LibreGames,项目名称:caveexpress,代码行数:8,代码来源:ClientConsole.cpp

示例10: SDL_StartTextInput

void Connect::onEnter()
{
    SDL_StartTextInput();
    
    name = "Type Opponents Hostname ...";
    server->setText(font, name, 100);
    server->setPosition(1920 / 2, 500, Center);
}
开发者ID:william-taylor,项目名称:scepter,代码行数:8,代码来源:Connect.cpp

示例11: SDL_StartTextInput

/**
 * \brief Initializes the input event manager.
 */
void InputEvent::initialize() {

  // Initialize text events.
  SDL_StartTextInput();

  // Initialize the joypad.
  set_joypad_enabled(true);
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:11,代码来源:InputEvent.cpp

示例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();
}
开发者ID:noparity,项目名称:libsdlgui,代码行数:9,代码来源:TextBox.cpp

示例13: ui_console_toggle

void ui_console_toggle(bool enable)
{
	console_enabled = enable;
	if (console_enabled) {
		SDL_StartTextInput();
	} else {
		SDL_StopTextInput();
	}
}
开发者ID:Nuos,项目名称:crawler,代码行数:9,代码来源:ui.c

示例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
	}
}
开发者ID:wesulee,项目名称:mr,代码行数:9,代码来源:input_handler.cpp

示例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);
}
开发者ID:albertz,项目名称:sdl,代码行数:57,代码来源:testime.c


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