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


C++ SDL_EnableUNICODE函数代码示例

本文整理汇总了C++中SDL_EnableUNICODE函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_EnableUNICODE函数的具体用法?C++ SDL_EnableUNICODE怎么用?C++ SDL_EnableUNICODE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: IN_Init

/*
===============
IN_Init
===============
*/
void IN_Init( void )
{
	int appState;

	if( !SDL_WasInit( SDL_INIT_VIDEO ) )
	{
		Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
		return;
	}

	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_joystickDebug = Cvar_Get( "in_joystickDebug", "0", CVAR_TEMP );
	in_joystickThreshold = Cvar_Get( "in_joystickThreshold", "0.15", CVAR_ARCHIVE );

#ifdef MACOS_X_ACCELERATION_HACK
	in_disablemacosxmouseaccel = Cvar_Get( "in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE );
#endif

	SDL_EnableUNICODE( 1 );
	SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );
	keyRepeatEnabled = qtrue;

	if( in_mouse->value )
	{
		mouseAvailable = qtrue;
		IN_ActivateMouse( );
	}
	else
	{
		IN_DeactivateMouse( );
		mouseAvailable = qfalse;
	}

	appState = SDL_GetAppState( );
	Cvar_SetValue( "com_unfocused",	!( appState & SDL_APPINPUTFOCUS ) );
	Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );

	IN_InitJoystick( );
	Com_DPrintf( "------------------------------------\n" );
}
开发者ID:morsik,项目名称:war-territory,代码行数:53,代码来源:sdl_input.c

示例2: zinfo

void SDLManager::exec()
{
    d->loadSettings();

    // Initialize defaults, Video and Audio subsystems
    zinfo() << "Initializing SDL.";
    int ret = SDL_Init( SDL_INIT_VIDEO|
                        SDL_INIT_AUDIO|
                        SDL_INIT_TIMER|
                        SDL_INIT_JOYSTICK );
    if(ret==-1) {
        zerror() << "Could not initialize SDL:" << SDL_GetError();
        return;
    }

    zinfo() << "Creating display surface.";
    d->createPainter();
    d->setScreen( 640, 400, false );
    if (!d->display) return;

    SDL_WM_SetCaption("FreeZZT", "FreeZZT");
    SDL_EnableUNICODE(1);
    d->setKeyboardRepeatRate();
    d->openJoystick();

    // Create music stream
    AbstractMusicStream *musicStream = d->createMusicStream();
    d->pFreezztManager->setMusicStream( musicStream );

    // Create factory
    NormalFileModelFactory fileModelFactory;
    d->pFreezztManager->setFileModelFactory( &fileModelFactory );

    // Load speed from settings
    d->pFreezztManager->setSpeed( d->dotFile.getInt( "speed", 1, 4 ) );

    zinfo() << "Entering event loop";
    SDLEventLoop eventLoop;
    eventLoop.setFrameLatency( d->frameTime );
    eventLoop.setPainter( d->painter );
    eventLoop.setSDLManager( this );
    eventLoop.setZZTManager( d->pFreezztManager );
    eventLoop.exec();

    delete musicStream;
    d->closeJoystick();
    delete d->painter;
}
开发者ID:inmatarian,项目名称:freezzt,代码行数:48,代码来源:sdlManager.cpp

示例3: init_main

static void	init_main(SDL_Surface	*screen,
			  s_sound	**sounds,
			  s_perso	**persos,
			  s_game	*game)
{
  s_sound	*sounds_tmp = NULL;
  int		i = 0;

  SDL_Init(SDL_INIT_VIDEO);
  SDL_WM_SetCaption("Bomberman -- Rush Jeu", NULL);
  SDL_WM_SetIcon(IMG_Load("/u/all/peccau_s/public/data/perso.png"), NULL);

  sounds_tmp = malloc(sizeof (s_sound));
  if (Mix_OpenAudio(24000, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) < 0)
    perror(Mix_GetError());

  sounds_tmp->vol_music = MIX_MAX_VOLUME / 2;
  sounds_tmp->vol_fx = MIX_MAX_VOLUME / 4;
  if (game->custom_mus)
    sounds_tmp->music = Mix_LoadMUS(game->custom_mus);
  else
    sounds_tmp->music =
      Mix_LoadMUS("/u/all/peccau_s/public/data/blue_star.wav");

  if (!sounds_tmp->music)
    perror(Mix_GetError());

  Mix_VolumeMusic(sounds_tmp->vol_music);
  Mix_PlayMusic(sounds_tmp->music, -1);

  Mix_AllocateChannels(142);

  sounds_tmp->bomb = Mix_LoadWAV("/u/all/peccau_s/public/data/bomb.wav");
  sounds_tmp->step = Mix_LoadWAV("/u/all/peccau_s/public/data/step.wav");
  Mix_Volume(-1, sounds_tmp->vol_fx);
  sounds_tmp->planted = Mix_LoadWAV("/u/all/peccau_s/public/data/planted.wav");
  *sounds = sounds_tmp;

  SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 38, 51, 56));
  for (i = 0; i < game->max_players; i++)
    {
      persos[i] = malloc(sizeof (s_perso));
      create_perso(persos[i], i + 1);
    }

  SDL_Flip(screen);
  SDL_EnableUNICODE(SDL_ENABLE);
}
开发者ID:Nyarlygames,项目名称:Bomberman,代码行数:48,代码来源:main.c

示例4: SDL_GetError

SDL::SDL()
{
  Uint32 flags = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;

  if (SDL_Init(flags) < 0)
  {
    std::ostringstream msg;
    msg << "Couldn't initialize SDL: " << SDL_GetError();
    throw std::runtime_error(msg.str());
  }
  else
  {
    atexit(SDL_Quit);
    SDL_EnableUNICODE(1);
  }
}
开发者ID:BackupTheBerlios,项目名称:windstille-svn,代码行数:16,代码来源:sdl.cpp

示例5: initSDL

static void initSDL()
{
		SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
		SDL_EnableUNICODE(1);

		screenWidth = SDL_GetVideoInfo()->current_w;
		screenHeight = SDL_GetVideoInfo()->current_h;

		if ( ! SDL_SetVideoMode(screenWidth, screenHeight, 24, SDL_OPENGL|SDL_DOUBLEBUF|SDL_FULLSCREEN) )
		{
		 fprintf(stderr, "Couldn't set GL video mode: %s\n", SDL_GetError());
		 SDL_Quit();
		 exit(2);
		}
		SDL_WM_SetCaption("test", "test");
}
开发者ID:eriytt,项目名称:commandergenius,代码行数:16,代码来源:sdl_hello.cpp

示例6: SDL_FreeSurface

Application::~Application(){
	Object::deleteAll();

	if(this->displaySurface != NULL) {
		SDL_FreeSurface(displaySurface);
	}
	if(this->displayText != NULL){
		//SDL_FreeSurface(displayText);
	}
	SDL_EnableUNICODE(SDL_DISABLE); 
    TTF_CloseFont(font);

    TTF_Quit();

	SDL_Quit();
}
开发者ID:SlaviSotirov,项目名称:TankField,代码行数:16,代码来源:Application.cpp

示例7: SDL_EnableUNICODE

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

  // initialize the keyboard
  SDL_EnableUNICODE(SDL_ENABLE);
  SDL_EnableKeyRepeat(0, 0);

  // initialize the joypad
  if (SDL_NumJoysticks() > 0 && Configuration::get_value("enable_joystick", 1) == 1) {
    joystick = SDL_JoystickOpen(0);
  }
  else {
    joystick = NULL;
    SDL_JoystickEventState(SDL_IGNORE);
    SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
  }
}
开发者ID:Aerospyke,项目名称:solarus,代码行数:19,代码来源:InputEvent.cpp

示例8: InputManager

// *** Constructor
InputManagerSDL::InputManagerSDL()
:	InputManager(),
	m_rawRmb(false),
	m_emulatedRmb(false)
#ifdef TARGET_OS_LINUX
	,m_xineramaOffsetHack( g_preferences->GetInt("XineramaHack", 1) )
#endif // TARGET_OS_LINUX
{
	// Don't let SDL do mouse button emulation for us; we'll do it ourselves if
	// we want it.
	putenv("SDL_HAS3BUTTONMOUSE=1");
	m_shouldEmulateRmb = g_preferences->GetInt("UseOneButtonMouseModifiers", 0);

	SDL_EnableUNICODE(true);
	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 90);
}
开发者ID:cahocachi,项目名称:DEFCON,代码行数:17,代码来源:input_sdl.cpp

示例9: unicode_

	sdl_handler::sdl_handler(const bool auto_join) :
#if !SDL_VERSION_ATLEAST(2, 0, 0)
	unicode_(SDL_EnableUNICODE(1)),
#endif
	has_joined_(false)
{

#if !SDL_VERSION_ATLEAST(2, 0, 0)
	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL);
#endif
	if(auto_join) {
		assert(!event_contexts.empty());
		event_contexts.back().add_handler(this);
		has_joined_ = true;
	}
}
开发者ID:niegenug,项目名称:wesnoth,代码行数:16,代码来源:events.cpp

示例10: 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 )" );
	}

	window = (SDL_Window*) windowData;

	Com_DPrintf( "\n------- Input Initialization -------\n" );

	in_keyboardDebug = Cvar_Get( "in_keyboardDebug", "0", CVAR_TEMP );

	// mouse variables
	in_mouse = Cvar_Get( "in_mouse", "1", 0 );
	in_nograb = Cvar_Get( "in_nograb", "0", 0 );
	in_uigrab = Cvar_Get( "in_uigrab", "0", 0 );

	in_joystick = Cvar_Get( "in_joystick", "0",  CVAR_LATCH );
	in_joystickDebug = Cvar_Get( "in_joystickDebug", "0", CVAR_TEMP );
	in_joystickThreshold = Cvar_Get( "in_joystickThreshold", "0.15", 0 );

	in_xbox360Controller = Cvar_Get( "in_xbox360Controller", "1", CVAR_TEMP );
	in_xbox360ControllerAvailable = Cvar_Get( "in_xbox360ControllerAvailable", "0", CVAR_ROM );
	in_xbox360ControllerDebug = Cvar_Get( "in_xbox360ControllerDebug", "0", CVAR_TEMP );
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
	SDL_StartTextInput();
#else
	SDL_EnableUNICODE( 1 );
	SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );
	keyRepeatEnabled = qtrue;
#endif
	mouseAvailable = ( in_mouse->value != 0 );
	IN_DeactivateMouse( qtrue );

	appState = SDL_GetWindowFlags( window );
	Cvar_SetValue( "com_unfocused", !( appState & SDL_WINDOW_INPUT_FOCUS ) );
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
	Cvar_SetValue( "com_minimized", ( appState & SDL_WINDOW_MINIMIZED ) );
#else
	Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
#endif
	IN_InitJoystick();
	Com_DPrintf( "------------------------------------\n" );
}
开发者ID:lmumar,项目名称:Unvanquished,代码行数:52,代码来源:sdl_input.cpp

示例11: SDL_GetError

bool Renderer::Init()
{
	if (SDL_Init(SDL_INIT_VIDEO)<0)
	{
		//fprintf(stderr, "Unable to initialise SDL: %s", SDL_GetError());
		//exit(0);
		std::cout << "Unable to initialise SDL: " << SDL_GetError() << std::endl;
		return false;
	}

	//Here we initialise SDL with video support. We need this for CEGUI. O.K. now SDL is ready to go. So let's fire up OpenGL:

	//SCREEN_WIDTH, SCREEN_HEIGHT
	if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)
	{
		std::cout << "Unable to set OpenGL videomode: " << SDL_GetError() << std::endl;
		return false;
		//fprintf(stderr, "Unable to set OpenGL videomode: %s", SDL_GetError());
		SDL_Quit();
		//exit(0);
	}
	SDL_WM_SetCaption("MilesChat v1.0", NULL);

	//Now OpenGL is ready. But we still need to set a decent configuration:

	glEnable(GL_CULL_FACE);
	glDisable(GL_FOG);
	glClearColor(0.0f,0.0f,0.0f,1.0f);
	glViewport(0,0, 800,600);

	//The OpenGL renderer that comes with CEGUI sets the matrices itself, so if you're using CEGUI for all your rendering needs this would be fine. Normally you would want the normal perspective projection setup though:

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(45.0, 800.0/600.0, 0.1,100.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	//let sdl unicode symbols be recognised
	SDL_EnableUNICODE(1);

	//create renderer
	CEGUI::OpenGLRenderer* myRenderer = &CEGUI::OpenGLRenderer::bootstrapSystem();

	return true;
}
开发者ID:mwhiticker,项目名称:gam302-spacesim,代码行数:46,代码来源:Renderer_old.cpp

示例12: setFPS

void INKFrame::init(int iFps) {
	setFPS(iFps);

	//intialize SDL
	if(-1 == SDL_Init(SDL_INIT_VIDEO)) {
        throw std::runtime_error("Unable to initialize SDL");
    }

	SDL_WM_SetCaption(_strTitle.c_str(), 0);

	//open the window
	if(!SDL_SetVideoMode(_iW, _iH, _iBbp, SDL_OPENGL | SDL_GL_DOUBLEBUFFER )) {
        throw std::runtime_error("Unable to open a window");
    }

	SDL_EnableUNICODE(SDL_ENABLE);
}
开发者ID:Jijidici,项目名称:InkParty,代码行数:17,代码来源:INKFrame.cpp

示例13: initinput

//
// initinput() -- init input system
//
int initinput(void)
{
	int i,j;
	
#ifdef __APPLE__
	// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
	if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1");
#endif
	
	if (SDL_EnableKeyRepeat(250, 30)) buildputs("Error enabling keyboard repeat.\n");
	inputdevices = 1|2;	// keyboard (1) and mouse (2)
	mouseacquired = 0;

	SDL_EnableUNICODE(1);	// let's hope this doesn't hit us too hard

	memset(keynames,0,sizeof(keynames));
	for (i=0; i<SDLK_LAST; i++) {
		if (!keytranslation[i]) continue;
		strncpy(keynames[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(keynames[i])-1);
	}

	if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK)) {
		i = SDL_NumJoysticks();
		buildprintf("%d joystick(s) found\n",i);
		for (j=0;j<i;j++) buildprintf("  %d. %s\n", j+1, SDL_JoystickName(j));
		joydev = SDL_JoystickOpen(0);
		if (joydev) {
			SDL_JoystickEventState(SDL_ENABLE);
			inputdevices |= 4;

			joynumaxes    = SDL_JoystickNumAxes(joydev);
			joynumbuttons = min(32,SDL_JoystickNumButtons(joydev));
			joynumhats    = SDL_JoystickNumHats(joydev);
			buildprintf("Joystick 1 has %d axes, %d buttons, and %d hat(s).\n",
				joynumaxes,joynumbuttons,joynumhats);

			joyaxis = Bcalloc(joynumaxes, sizeof(int));
            if (joynumhats > 0) {
                joyhat = malloc(joynumhats * sizeof(int));
                memset(joyhat, -1, sizeof(int)*joynumhats);
            }
		}
	}

	return 0;
}
开发者ID:Hendricks266,项目名称:jfbuild,代码行数:49,代码来源:sdlayer.c

示例14: error

void OSystem_SDL::initSDL() {
    // Check if SDL has not been initialized
    if (!_initedSDL) {
        uint32 sdlFlags = 0;
        if (ConfMan.hasKey("disable_sdl_parachute"))
            sdlFlags |= SDL_INIT_NOPARACHUTE;

        // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
        if (SDL_Init(sdlFlags) == -1)
            error("Could not initialize SDL: %s", SDL_GetError());

        // Enable unicode support if possible
        SDL_EnableUNICODE(1);

        _initedSDL = true;
    }
}
开发者ID:MatChung,项目名称:scummvm-ps3,代码行数:17,代码来源:sdl.cpp

示例15: create_window

static void create_window(int w, int h, bool fullscreen) {
	if ( fullscreen  ) {
		find_resolution();
#ifndef NO_OPENGL	
		if (TCOD_ctx.renderer != TCOD_RENDERER_SDL ) {
			TCOD_opengl_init_attributes();
			screen=SDL_SetVideoMode(TCOD_ctx.actual_fullscreen_width,TCOD_ctx.actual_fullscreen_height,32,SDL_FULLSCREEN|SDL_OPENGL);
			if ( screen && TCOD_opengl_init_state(w, h, charmap) && TCOD_opengl_init_shaders() ) {
				TCOD_LOG(("Using %s renderer...\n",TCOD_ctx.renderer == TCOD_RENDERER_GLSL ? "GLSL" : "OPENGL"));
			} else {
				TCOD_LOG(("Fallback to SDL renderer...\n"));
				TCOD_ctx.renderer = TCOD_RENDERER_SDL;
			}
		} 
#endif		
		if (TCOD_ctx.renderer == TCOD_RENDERER_SDL ) {
			screen=SDL_SetVideoMode(TCOD_ctx.actual_fullscreen_width,TCOD_ctx.actual_fullscreen_height,32,SDL_FULLSCREEN);
			if ( screen == NULL ) TCOD_fatal_nopar("SDL : cannot set fullscreen video mode");
		}
		SDL_ShowCursor(0);
		TCOD_ctx.actual_fullscreen_width=screen->w;
		TCOD_ctx.actual_fullscreen_height=screen->h;
		TCOD_sys_init_screen_offset();
		SDL_FillRect(screen,0,0);
	} else {
#ifndef NO_OPENGL	
		if (TCOD_ctx.renderer != TCOD_RENDERER_SDL ) {
			TCOD_opengl_init_attributes();
			screen=SDL_SetVideoMode(w*TCOD_ctx.font_width,h*TCOD_ctx.font_height,32,SDL_OPENGL);
			if ( screen && TCOD_opengl_init_state(w, h, charmap) && TCOD_opengl_init_shaders() ) {
				TCOD_LOG(("Using %s renderer...\n",TCOD_ctx.renderer == TCOD_RENDERER_GLSL ? "GLSL" : "OPENGL"));
			} else {
				TCOD_LOG(("Fallback to SDL renderer...\n"));
				TCOD_ctx.renderer = TCOD_RENDERER_SDL;
			}
		} 
#endif		
		if (TCOD_ctx.renderer == TCOD_RENDERER_SDL ) {
			screen=SDL_SetVideoMode(w*TCOD_ctx.font_width,h*TCOD_ctx.font_height,32,0);
			TCOD_LOG(("Using SDL renderer...\n"));
		}
		if ( screen == NULL ) TCOD_fatal_nopar("SDL : cannot create window");
	}
	SDL_EnableUNICODE(1);
	TCOD_ctx.fullscreen=fullscreen;
}
开发者ID:FabianWolff,项目名称:libtcod-debian,代码行数:46,代码来源:sys_sdl12_c.c


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