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


C++ SDL_VERSION函数代码示例

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


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

示例1: SDL_WM_DeleteTempContext

int SDL_WM_DeleteTempContext() {

  SDL_SysWMinfo info;
  SDL_VERSION(&info.version);
  if (SDL_GetWMInfo(&info) == -1) {
    // Could not get SDL version info
    return 1;
  }

  if (!wglShareLists(temp_context, info.hglrc)) {
    // Could share lists with OpenGL context
    return 2;
  }

  if (!wglDeleteContext(temp_context)) {
    // Could delete OpenGL context
    return 3;
  }
  
  return 0;
}
开发者ID:AntonioCS,项目名称:Corange,代码行数:21,代码来源:SDL_local.c

示例2: glewGetString

    void SDLHandler::PrintSoftwareVersions()
    {
        cout << "GLEW version: " << glewGetString(GLEW_VERSION) << endl << endl;

        SDL_version compiled;
        SDL_version linked;

        SDL_VERSION(&compiled);
        SDL_GetVersion(&linked);
        cout << "Compiled against SDL version "  << static_cast<int>(compiled.major) << "." << 
                                                     static_cast<int>(compiled.minor)  << "." <<  
                                                     static_cast<int>(compiled.patch) << endl;
        cout << "Linked against SDL version "  << static_cast<int>(linked.major) << "." << 
                                                   static_cast<int>(linked.minor)  << "." <<  
                                                   static_cast<int>(linked.patch) << endl << endl;

        cout << "OpenGL vendor: " << glGetString(GL_VENDOR) << endl;
        cout << "OpenGL renderer: " << glGetString(GL_RENDERER) << endl;
        cout << "OpenGL version: " << glGetString(GL_VERSION) << endl;
        cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << endl << endl;
    }
开发者ID:Bojanovski,项目名称:IG-Project,代码行数:21,代码来源:SDLHandler.cpp

示例3: SDL_VERSION

void * SDLWindow::getHandle() {
	
#if ARX_PLATFORM == ARX_PLATFORM_WIN32
	
	SDL_SysWMinfo wmi;
	SDL_VERSION(&wmi.version);
	
	if(!SDL_GetWMInfo(&wmi)) {
		return NULL;
	}
	
	return wmi.window;
	
#else
	
	// TODO X11 needs more than one pointer (display+window)
	return NULL;
	
#endif
	
}
开发者ID:EstrangedGames,项目名称:ArxLibertatis,代码行数:21,代码来源:SDLWindow.cpp

示例4: GetModuleHandle

void OSystem_Win32::setupIcon() {
	HMODULE handle = GetModuleHandle(NULL);
	HICON   ico    = LoadIcon(handle, MAKEINTRESOURCE(1001 /* IDI_ICON */));
	if (ico) {
		SDL_SysWMinfo  wminfo;
		SDL_VERSION(&wminfo.version);
		if (SDL_GetWMInfo(&wminfo)) {
			// Replace the handle to the icon associated with the window class by our custom icon
			SetClassLongPtr(wminfo.window, GCLP_HICON, (ULONG_PTR)ico);

			// Since there wasn't any default icon, we can't use the return value from SetClassLong
			// to check for errors (it would be 0 in both cases: error or no previous value for the
			// icon handle). Instead we check for the last-error code value.
			if (GetLastError() == ERROR_SUCCESS)
				return;
		}
	}

	// If no icon has been set, fallback to default path
	OSystem_SDL::setupIcon();
}
开发者ID:Harrypoppins,项目名称:grim_mouse,代码行数:21,代码来源:win32.cpp

示例5: sdlNativeWindowHandle

static void* sdlNativeWindowHandle(SDL_Window* _window)
{
	SDL_SysWMinfo wmi;
	SDL_VERSION(&wmi.version);
	if (!SDL_GetWindowWMInfo(_window, &wmi))
	{
		return nullptr;
	}

#   if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
	return (void*)wmi.info.x11.window;
#   elif BX_PLATFORM_OSX
	return wmi.info.cocoa.window;
#   elif BX_PLATFORM_WINDOWS
	return wmi.info.win.window;
#   elif BX_PLATFORM_STEAMLINK
	return wmi.info.vivante.window;
#   elif BX_PLATFORM_EMSCRIPTEN
	return nullptr;
#   endif // BX_PLATFORM_
}
开发者ID:p0nley,项目名称:mame,代码行数:21,代码来源:drawbgfx.cpp

示例6: sdl2_gfx_set_handles

static void sdl2_gfx_set_handles(sdl2_video_t *vid)
{
   // SysWMinfo headers are broken on OSX. :(
#if defined(_WIN32) || defined(HAVE_X11)
   SDL_SysWMinfo info;
   SDL_VERSION(&info.version);

   if (SDL_GetWindowWMInfo(vid->window, &info) == 1)
   {
#if defined(_WIN32)
      driver.display_type  = RARCH_DISPLAY_WIN32;
      driver.video_display = 0;
      driver.video_window  = (uintptr_t)info.info.win.window;
#elif defined(HAVE_X11)
      driver.display_type  = RARCH_DISPLAY_X11;
      driver.video_display = (uintptr_t)info.info.x11.display;
      driver.video_window  = (uintptr_t)info.info.x11.window;
#endif
   }
#endif
}
开发者ID:Markko,项目名称:RetroArch,代码行数:21,代码来源:sdl2_gfx.c

示例7: sdl2_gfx_set_handles

static void sdl2_gfx_set_handles(sdl2_video_t *vid)
{
   /* SysWMinfo headers are broken on OSX. */
#if defined(_WIN32) || defined(HAVE_X11)
   SDL_SysWMinfo info;
   SDL_VERSION(&info.version);

   if (SDL_GetWindowWMInfo(vid->window, &info) != 1)
      return;

#if defined(_WIN32)
   video_driver_display_type_set(RARCH_DISPLAY_WIN32);
   video_driver_display_set(0);
   video_driver_window_set((uintptr_t)info.info.win.window);
#elif defined(HAVE_X11)
   video_driver_display_type_set(RARCH_DISPLAY_X11);
   video_driver_display_set((uintptr_t)info.info.x11.display);
   video_driver_window_set((uintptr_t)info.info.x11.window);
#endif
#endif
}
开发者ID:dankcushions,项目名称:RetroArch,代码行数:21,代码来源:sdl2_gfx.c

示例8: system_window_init

//drag and drop support, call after window was initialized
void system_window_init(){

	//drag and drop
	#if TARGET_OS == WIN
		SDL_SysWMinfo wmInfo;

		//set SDL version to WMinfo struct
		//-> maybe problems when not calling this macro before
		SDL_VERSION(&wmInfo.version);  

		if(SDL_GetWMInfo(&wmInfo) != SDL_TRUE) {
			cerr << "Error on getting WMInfo" << endl;
			return;
		}

		SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
		DragAcceptFiles(wmInfo.window, true); //afxwin.h
	#endif
	
	//other OS ...
}
开发者ID:murkymark,项目名称:iffanimplay,代码行数:22,代码来源:system_specific.cpp

示例9: SDL_GetError

// --- Functions ---
bool the_Game::Init( std::string _title )
{
  // Initializing_SDL2:
  if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
    std::cout << "GAME :: !! Failed to initialize SDL : " << SDL_GetError() << " !!\n";  
    return false;
  }

  m_display_ptr = SDL_CreateWindow( _title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
				    the_World::Instance().Get_display_width(), 
				    the_World::Instance().Get_display_height(), 
				    SDL_WINDOW_RESIZABLE );
  if ( m_display_ptr == nullptr ) {
    std::cout << "GAME :: !! Failed to create window : " << SDL_GetError() << " !!\n";  
    return false;
  }

  m_renderer_ptr = SDL_CreateRenderer( m_display_ptr, -1, SDL_RENDERER_ACCELERATED );
  if ( m_renderer_ptr == nullptr ) {
    std::cout << "GAME :: !! Failed to create renderer : " << SDL_GetError() << " !!\n";  
    return false;
  }

  // SDL Version:
  SDL_version compiled, linked;
  SDL_VERSION( &compiled );
  SDL_GetVersion( &linked );
  std::cout <<"GAME :: We compiled against SDL version: "
	    << (int)compiled.major <<"."<< (int)compiled.minor <<"."<< (int)compiled.patch <<"\n";
  std::cout <<"GAME :: But we are linking against SDL version: " 
	    << (int)linked.major <<"."<< (int)linked.minor <<"."<< (int)linked.patch << "\n";

  // Opening Inputh Handler:
  the_Input_handler::Instance().Initialise_joysticks();

  // The Game State Machine:
  m_state_machine.To_do( SMF_parameters( SMF::CREATE_AT_FRONT, "State1", "", "" ));

  return true;
}
开发者ID:xxORVARxx,项目名称:SDL-Book,代码行数:41,代码来源:Game.cpp

示例10: SDL_Init

void	CoreEngine::StartUp()
{

	m_run=true;

	SDL_Init(0);
	SDL_version compiled;
	SDL_version linked;

	SDL_VERSION(&compiled);

	SDL_GetVersion(&linked);





	//CREO ELS SUBSISTEMES EN ORDRE
	m_logmngr 	= new LogManager();
	m_logmngr->m_IsLogEnabled = LOG_ENABLED;
	m_logmngr->StartUp();
	m_rendermngr = new RenderManager();
	m_rendermngr->StartUp();
	//		m_soundmngr = new SoundManager();
	//		m_soundmngr->StartUp();
	//		m_inputmngr = new InputManager();
	//		m_inputmngr->StartUp();
	m_game = new GameManager();
	m_game->StartUp();
	m_timermngr = new CTimer();
	m_timermngr->StartUp();

	m_logmngr->INFO_LOG(LOG_ENGINE,"We compiled against SDL version %i.%i.%i",(unsigned int) compiled.major,(unsigned int) compiled.minor,(unsigned int) compiled.patch);
	m_logmngr->INFO_LOG(LOG_ENGINE,"And we are linking against SDL version %i.%i.%i",(unsigned int)linked.major,(unsigned int)linked.minor,(unsigned int) linked.patch);



	m_logmngr->INFO_LOG(LOG_ENGINE,"Start all subsystems OK");

}
开发者ID:roig,项目名称:TD,代码行数:40,代码来源:CoreEngine.cpp

示例11: bgd_get_desktop_size

static int bgd_get_desktop_size( INSTANCE * my, int * params )
{
#ifdef WIN32
    RECT Rect;

    if ( GetClientRect( GetDesktopWindow(), &Rect ) )
    {
        *(( int * )( params[0] ) ) = Rect.right - Rect.left;
        *(( int * )( params[1] ) ) = Rect.bottom - Rect.top;
    }
#elif __linux
#ifdef SDL_VIDEO_DRIVER_X11
    int res ;
    Window root, parent, *children = NULL;
    XWindowAttributes wattr;
    unsigned int children_count;

    SDL_SysWMinfo wminfo ;

    SDL_VERSION( &wminfo.version );
    if ( SDL_GetWMInfo( &wminfo ) != 1 ) return -1 ;

    wminfo.info.x11.lock_func();
    if ( XQueryTree(wminfo.info.x11.display, wminfo.info.x11.window, &root, &parent, &children, &children_count ) != BadWindow )
    {
        if ( children ) XFree( children );

        res = XGetWindowAttributes( wminfo.info.x11.display, root, &wattr );
        if ( res != BadDrawable && res != BadWindow )
        {
            if ( params[0] ) *(( int * )( params[0] ) ) = wattr.width;
            if ( params[1] ) *(( int * )( params[1] ) ) = wattr.height;
        }
    }
    wminfo.info.x11.unlock_func();
#endif
#endif

    return 1 ;
}
开发者ID:GameMaker2k,项目名称:BennuGD,代码行数:40,代码来源:mod_wm.c

示例12: InitSDL

void InitSDL(SDL_Window **outSdlWindow) {
	auto currentDirectoryRead = GetCurrentDirectoryA(_countof(GWorkingDir), GWorkingDir);
	Check(currentDirectoryRead > 0 && currentDirectoryRead < _countof(GWorkingDir));
	for (auto i = 0u; i < GWorkingDirLength; ++i) {
		GWorkingDir[i] = tolower(GWorkingDir[i]);
	}
	GWorkingDirLength = currentDirectoryRead;

	SDL_Init(SDL_INIT_EVERYTHING);
	auto sdlWindow = SDL_CreateWindow(GDisplaySettings.window_title,
		SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
		GDisplaySettings.resolution.x, GDisplaySettings.resolution.y,
		SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_RESIZABLE);

	SDL_SysWMinfo info = {};
	SDL_VERSION(&info.version);
	auto getwininfo_ok = SDL_GetWindowWMInfo(sdlWindow, &info);
	SDL_assert(getwininfo_ok);

	GDisplaySettings.hwnd = info.info.win.window;
	*outSdlWindow = sdlWindow;
}
开发者ID:goskatopudel,项目名称:dx12sandbox,代码行数:22,代码来源:Application.cpp

示例13: pygame_scrap_init

int
pygame_scrap_init (void)
{
    SDL_SysWMinfo info;
    int retval = 0;

    /* Grab the window manager specific information */
    SDL_SetError ("SDL is not running on known window manager");

    SDL_VERSION (&info.version);
    if (SDL_GetWMInfo (&info))
    {
        /* Save the information for later use */
        SDL_Window = info.window;
        retval = 1;
    }
    if (retval)
        _scrapinitialized = 1;
    
    _format_MIME_PLAIN = RegisterClipboardFormat (PYGAME_SCRAP_TEXT);
    return retval;
}
开发者ID:IuryAlves,项目名称:pygame,代码行数:22,代码来源:scrap_win.c

示例14: ImGui_ImplSdlGL3_Init

bool    ImGui_ImplSdlGL3_Init(SDL_Window* window)
{
    ImGuiIO& io = ImGui::GetIO();
    io.KeyMap[ImGuiKey_Tab] = SDLK_TAB;                     // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
    io.KeyMap[ImGuiKey_LeftArrow] = SDL_SCANCODE_LEFT;
    io.KeyMap[ImGuiKey_RightArrow] = SDL_SCANCODE_RIGHT;
    io.KeyMap[ImGuiKey_UpArrow] = SDL_SCANCODE_UP;
    io.KeyMap[ImGuiKey_DownArrow] = SDL_SCANCODE_DOWN;
    io.KeyMap[ImGuiKey_PageUp] = SDL_SCANCODE_PAGEUP;
    io.KeyMap[ImGuiKey_PageDown] = SDL_SCANCODE_PAGEDOWN;
    io.KeyMap[ImGuiKey_Home] = SDL_SCANCODE_HOME;
    io.KeyMap[ImGuiKey_End] = SDL_SCANCODE_END;
    io.KeyMap[ImGuiKey_Delete] = SDLK_DELETE;
    io.KeyMap[ImGuiKey_Backspace] = SDLK_BACKSPACE;
    io.KeyMap[ImGuiKey_Enter] = SDLK_RETURN;
    io.KeyMap[ImGuiKey_Escape] = SDLK_ESCAPE;
    io.KeyMap[ImGuiKey_A] = SDLK_a;
    io.KeyMap[ImGuiKey_C] = SDLK_c;
    io.KeyMap[ImGuiKey_V] = SDLK_v;
    io.KeyMap[ImGuiKey_X] = SDLK_x;
    io.KeyMap[ImGuiKey_Y] = SDLK_y;
    io.KeyMap[ImGuiKey_Z] = SDLK_z;

    io.RenderDrawListsFn = ImGui_ImplSdlGL3_RenderDrawLists;   // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
    io.SetClipboardTextFn = ImGui_ImplSdlGL3_SetClipboardText;
    io.GetClipboardTextFn = ImGui_ImplSdlGL3_GetClipboardText;
    io.ClipboardUserData = NULL;

#ifdef _WIN32
    SDL_SysWMinfo wmInfo;
    SDL_VERSION(&wmInfo.version);
    SDL_GetWindowWMInfo(window, &wmInfo);
    io.ImeWindowHandle = wmInfo.info.win.window;
#else
    (void)window;
#endif

    return true;
}
开发者ID:ZakBlystone,项目名称:metacade,代码行数:39,代码来源:imgui_impl_sdl_gl3.cpp

示例15: defined

void Window::requestAttention(bool continuous)
{
#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP)

	if (hasFocus())
		return;

	SDL_SysWMinfo wminfo = {};
	SDL_VERSION(&wminfo.version);

	if (SDL_GetWindowWMInfo(window, &wminfo))
	{
		FLASHWINFO flashinfo = {};
		flashinfo.cbSize = sizeof(FLASHWINFO);
		flashinfo.hwnd = wminfo.info.win.window;
		flashinfo.uCount = 1;
		flashinfo.dwFlags = FLASHW_ALL;

		if (continuous)
		{
			flashinfo.uCount = 0;
			flashinfo.dwFlags |= FLASHW_TIMERNOFG;
		}

		FlashWindowEx(&flashinfo);
	}

#elif defined(LOVE_MACOSX)

	love::macosx::requestAttention(continuous);

#else

	LOVE_UNUSED(continuous);
	
#endif
	
	// TODO: Linux?
}
开发者ID:MikuAuahDark,项目名称:livesim4,代码行数:39,代码来源:Window.cpp


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