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


C++ SDL_GetWMInfo函数代码示例

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


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

示例1: sdlwrap_get_wm_info

bool sdlwrap_get_wm_info(SDL_SysWMinfo *info)
{
#ifdef XENON
   (void)info;
   return false;
#elif SDL_MODERN
   if (g_window)
      return SDL_GetWindowWMInfo(g_window, info);
   else
      return SDL_GetWMInfo(info) == 1;
#else
   return SDL_GetWMInfo(info) == 1;
#endif
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:14,代码来源:sdlwrap.c

示例2: FnResourcesCallbackCreate

void FnResourcesCallbackCreate(const string& sPathname, void* pvCallbackData)
{
	static bool b = true;

	if ( b )
	{
		b = false;

		SDL_SysWMinfo wmi = { 0 };
		SDL_GetWMInfo(&wmi);
		SetWindowPos(wmi.window, HWND_TOP, NULL, NULL, NULL, NULL, SWP_NOMOVE|SWP_NOREPOSITION |SWP_NOSIZE);

		GetRender()->BeginProjection(eProjectionOrtho);
		{
//			GetUi()->FindWindow("splash")->FindChild("frame")->FindChild("frame")->FindChild("image")->ResizeBy(CVec2i(GetRandom(-2, 2), GetRandom(-2,2)));
			GetGlue()->HandleScript("[ui.splash.frame.frame.loading set text:'loading %s']", sPathname.c_str());
			GetUi()->Render();
		}
		GetRender()->EndProjection(eProjectionOrtho);
		GetRender()->Swap();
		GetRender()->Update();

		b = true;
	}
}
开发者ID:newobj,项目名称:taz,代码行数:25,代码来源:appbase.cpp

示例3: get_nearest_monitor_rect

int
get_nearest_monitor_rect( int  *x, int  *y, int  *width, int  *height )
{
    SDL_SysWMinfo  info;
    HMONITOR       monitor;
    MONITORINFO    monitorInfo;

    SDL_VERSION(&info.version);

    if ( !SDL_GetWMInfo(&info) ) {
        D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError());
        return -1;
    }

    monitor = MonitorFromWindow( info.window, MONITOR_DEFAULTTONEAREST );
    monitorInfo.cbSize = sizeof(monitorInfo);
    GetMonitorInfo( monitor, &monitorInfo );

    *x      = monitorInfo.rcMonitor.left;
    *y      = monitorInfo.rcMonitor.top;
    *width  = monitorInfo.rcMonitor.right - *x;
    *height = monitorInfo.rcMonitor.bottom - *y;

    D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__,
      *x, *y, *width, *height);

    return 0;
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:28,代码来源:display.c

示例4: GetNativeDisplay

/** @brief Obtain a reference to the system's native display
 * @param window : pointer to save the display reference
 * @return : 0 if the function passed, else 1
 */
int8_t GetNativeDisplay( void )
{
    if (eglSettings[CFG_MODE] == RENDER_RAW)        /* RAW FB mode */
    {
        printf( "EGLport: Using EGL_DEFAULT_DISPLAY\n" );
        nativeDisplay = EGL_DEFAULT_DISPLAY;
    }
    else if (eglSettings[CFG_MODE] == RENDER_SDL)   /* SDL/X11 mode */
    {
#if defined(USE_EGL_SDL)
        printf( "EGLport: Opening SDL/X11 display\n" );
        SDL_VERSION(&sysWmInfo.version);
        SDL_GetWMInfo(&sysWmInfo);
        nativeDisplay = (EGLNativeDisplayType)sysWmInfo.info.x11.display;

        if (nativeDisplay == 0)
        {
            printf( "EGLport ERROR: unable to get display!\n" );
            return 1;
        }
#else
        printf( "EGLport ERROR: SDL mode was not enabled in this compile!\n" );
#endif
    }

    return 0;
}
开发者ID:ptitSeb,项目名称:mupen64plus-pandora,代码行数:31,代码来源:eglport.c

示例5: defined

std::string CClipboard::GetContents() const
{
	std::string contents;
#if defined(__APPLE__) || defined(HEADLESS)
	// Nothing for now
#elif defined(WIN32)
	OpenClipboard(NULL);
	const void* p = GetClipboardData(CF_TEXT);
	if (p != NULL) {
		contents = (char*)p;
	}
	CloseClipboard();
#else
	// only works with the cut-buffer method (xterm)
	// (and not with the more recent selections method)
	SDL_SysWMinfo sdlinfo;
	SDL_VERSION(&sdlinfo.version);
	if (SDL_GetWMInfo(&sdlinfo)) {
		sdlinfo.info.x11.lock_func();
		Display* display = sdlinfo.info.x11.display;
		int count = 0;
		char* msg = XFetchBytes(display, &count);
		if ((msg != NULL) && (count > 0)) {
			contents.append((char*)msg, count);
		}
		XFree(msg);
		sdlinfo.info.x11.unlock_func();
	}
#endif
	return contents;
};
开发者ID:AMDmi3,项目名称:spring,代码行数:31,代码来源:Clipboard.cpp

示例6: SDL_VERSION

bool SpringApp::GetDisplayGeometry()
{
	SDL_SysWMinfo info;
	SDL_VERSION(&info.version);
	if (!SDL_GetWMInfo(&info)) {
		return false;
	}

	gu->screenSizeX = GetSystemMetrics(SM_CXFULLSCREEN);
	gu->screenSizeY = GetSystemMetrics(SM_CYFULLSCREEN);
	
	RECT rect;
	if (!GetClientRect(info.window, &rect)) {
		return false;
	}

	if((rect.right - rect.left)==0 || (rect.bottom - rect.top)==0)
		return false;

	gu->winSizeX = rect.right - rect.left;
	gu->winSizeY = rect.bottom - rect.top;

	// translate from client coords to screen coords
	MapWindowPoints(info.window, HWND_DESKTOP, (LPPOINT)&rect, 2);
	gu->winPosX = rect.left;
	gu->winPosY = gu->screenSizeY - gu->winSizeY - rect.top;
	
	return true;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:29,代码来源:Main.cpp

示例7: setWindowIcon

/**
 * Sets the window titlebar icon.
 * For Windows, use the embedded resource icon.
 * For other systems, use a PNG icon.
 * @param winResource ID for Windows icon.
 * @param unixPath Path to PNG icon for Unix.
 */
void setWindowIcon(int winResource, const std::string &unixPath)
{
#ifdef _WIN32
	HINSTANCE handle = GetModuleHandle(NULL);
	HICON icon = LoadIcon(handle, MAKEINTRESOURCE(winResource));

	SDL_SysWMinfo wminfo;
	SDL_VERSION(&wminfo.version)
	if (SDL_GetWMInfo(&wminfo))
	{
		HWND hwnd = wminfo.window;
		SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)icon);
	}
#else
	// SDL only takes UTF-8 filenames
	// so here's an ugly hack to match this ugly reasoning
	std::string utf8 = Language::wstrToUtf8(Language::fsToWstr(unixPath));
	SDL_Surface *icon = IMG_Load(utf8.c_str());
	if (icon != 0)
	{
		SDL_WM_SetIcon(icon, NULL);
		SDL_FreeSurface(icon);
	}
#endif
}
开发者ID:BHSDuncan,项目名称:OpenXcom,代码行数:32,代码来源:CrossPlatform.cpp

示例8: init

static int init(void) {
	LOG_DEBUG(2,"Initialising SDL video driver\n");
#ifdef WINDOWS32
	if (!getenv("SDL_VIDEODRIVER"))
		putenv("SDL_VIDEODRIVER=windib");
#endif
	if (!SDL_WasInit(SDL_INIT_NOPARACHUTE)) {
		if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
			LOG_ERROR("Failed to initialise SDL: %s\n", SDL_GetError());
			return 1;
		}
	}
	if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
		LOG_ERROR("Failed to initialise SDL video driver: %s\n", SDL_GetError());
		return 1;
	}
	if (set_fullscreen(xroar_fullscreen))
		return 1;
#ifdef WINDOWS32
	{
		SDL_version sdlver;
		SDL_SysWMinfo sdlinfo;
		SDL_VERSION(&sdlver);
		sdlinfo.version = sdlver;
		SDL_GetWMInfo(&sdlinfo);
		windows32_main_hwnd = sdlinfo.window;
	}
#endif
	set_mode(0);
	return 0;
}
开发者ID:CrashSerious,项目名称:PS3Roar,代码行数:31,代码来源:vo_sdl.c

示例9: clippy_init

void clippy_init(void)
{
        SDL_SysWMinfo info;

        has_sys_clip = 0;
        memset(&info, 0, sizeof(info));
        SDL_VERSION(&info.version);
        if (SDL_GetWMInfo(&info)) {
#if defined(USE_X11)
                if (info.subsystem == SDL_SYSWM_X11) {
                        SDL_Display = info.info.x11.display;
                        SDL_Window = info.info.x11.window;
                        lock_display = info.info.x11.lock_func;
                        unlock_display = info.info.x11.unlock_func;
                        SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
                        SDL_SetEventFilter(_x11_clip_filter);
                        has_sys_clip = 1;

                        atom_sel = XInternAtom(SDL_Display, "SDL_SELECTION", False);
                        atom_clip = XInternAtom(SDL_Display, "CLIPBOARD", False);

                        orig_xlib_err = XSetErrorHandler(handle_xlib_err);
                }
                if (!lock_display) lock_display = __noop_v;
                if (!unlock_display) unlock_display = __noop_v;
#elif defined(WIN32)
                has_sys_clip = 1;
                SDL_Window = info.window;
#elif defined(__QNXNTO__)
                has_sys_clip = 1;
                inputgroup = PhInputGroup(NULL);
#endif
        }
}
开发者ID:CharlesLio,项目名称:schismtracker,代码行数:34,代码来源:clippy.c

示例10: wglGetCurrentContext

void Renderer::Init()
{
#ifdef _WIN32
    m_CurrentContext = wglGetCurrentContext();
    m_CurrentDC      = wglGetCurrentDC();
    // release current context
    wglMakeCurrent( nullptr, nullptr );
#endif
#ifdef __linux__
    // Rendering works fine under X in a separate thread, but quitting breaks some SDL internals. Haven't figured it out yet.
    if (!XInitThreads())
    {
    	THROW( "XLib is not thread safe." );
    }
    SDL_SysWMinfo wm_info;
    SDL_VERSION( &wm_info.version );
    if ( SDL_GetWMInfo( &wm_info ) ) {
        // TODO: drag-n-drop for non win32
        Display *display = wm_info.info.x11.gfxdisplay;
        m_CurrentContext = glXGetCurrentContext();
        ASSERT( m_CurrentContext, "Error! No current GL context!" );
        glXMakeCurrent( display, None, nullptr );
        XSync( display, false );
    }
#endif
}
开发者ID:juergen0815,项目名称:sdl-vbo,代码行数:26,代码来源:renderer.cpp

示例11: IN_ShutdownRawMouse

qboolean IN_ShutdownRawMouse(void)
{
	RAWINPUTDEVICE dev =
	{
		1,  // usUsagePage - generic desktop controls
		2,  // usUsage - mouse
		RIDEV_REMOVE,   // dwFlags
		NULL    // hwndTarget
	};
	if (!RegisterRawInputDevices(&dev, 1, sizeof(dev)))
	{
		Com_Printf("Mouse release failed. (0x%lx)\n", GetLastError());
		return qfalse;
	}
	mouseRaw = qfalse;
	Com_DPrintf("Released raw input mouse.\n");
	if (SDLWindowProc)
	{
		SDL_SysWMinfo wmInfo;
		SDL_VERSION(&wmInfo.version);
		SDL_GetWMInfo(&wmInfo);
		SetWindowLongPtr(wmInfo.window, GWLP_WNDPROC, (LONG_PTR)SDLWindowProc);
		SDLWindowProc = NULL;
	}
	return qtrue;
}
开发者ID:GenaSG,项目名称:etlegacy,代码行数:26,代码来源:sdl_input.c

示例12: IN_InitRawMouse

qboolean IN_InitRawMouse(void)
{
	// http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
	if (!SDLWindowProc)
	{
		SDL_SysWMinfo wmInfo;
		SDL_VERSION(&wmInfo.version);
		SDL_GetWMInfo(&wmInfo);
		SDLWindowProc = (WNDPROC)GetWindowLongPtr(wmInfo.window, GWLP_WNDPROC);
		SetWindowLongPtr(wmInfo.window, GWLP_WNDPROC, (LONG_PTR)RawWndProc);
	}

	{
		RAWINPUTDEVICE dev =
		{
			1,  // usUsagePage - generic desktop controls
			2,  // usUsage - mouse
			0,  // dwFlags
			0   // hwndTarget
		};
		if (!RegisterRawInputDevices(&dev, 1, sizeof(dev)))
		{
			Com_Printf("Raw input registration failed. (0x%lx)\n", GetLastError());
			return qfalse;
		}
	}
	Com_DPrintf("Registered for raw input.\n");
	mouseRaw = qtrue;
	return qtrue;
}
开发者ID:GenaSG,项目名称:etlegacy,代码行数:30,代码来源:sdl_input.c

示例13: resizeImage

void CHwX11Cursor::Finish()
{
	if (cimages.size()<1)
		return;

	//resize images
	for (std::vector<XcursorImage*>::iterator it = cimages.begin(); it < cimages.end(); ++it)
		resizeImage(*it, xmaxsize, ymaxsize);

	XcursorImages *cis = XcursorImagesCreate(cimages.size());
	cis->nimage = cimages.size();
	for (int i = 0; i < int(cimages.size()); ++i) {
		XcursorImage* ci = cimages[i];
		ci->xhot = (hotSpot==CMouseCursor::TopLeft) ? 0 : ci->width/2;
		ci->yhot = (hotSpot==CMouseCursor::TopLeft) ? 0 : ci->height/2;
		cis->images[i] = ci;
	}

	SDL_SysWMinfo info;
	SDL_VERSION(&info.version);
	if (!SDL_GetWMInfo(&info)) {
		XcursorImagesDestroy(cis);
		cimages.clear();
		logOutput.Print("SDL error: can't get X11 window info");
		return;
	}

	cursor = XcursorImagesLoadCursor(info.info.x11.display,cis);
	XcursorImagesDestroy(cis);
	cimages.clear();
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:31,代码来源:HwMouseCursor.cpp

示例14: SDL_GL_CreateThread

SDL_Thread* SDL_GL_CreateThread(int (*fn)(void *), void *data) {

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

  gl_thread_context = wglCreateContext(gl_thread_device);
  if (gl_thread_context == NULL) {
    // Could not create new OpenGL context
    return NULL;
  }
  
  BOOL err = wglShareLists(info.hglrc, gl_thread_context);
  if (err == 0) {
    int code = GetLastError();
    //Could not get OpenGL share lists: %i
    return NULL;
  }
  
  gl_thread_func = fn;
  gl_thread_data = data;
  
  return SDL_CreateThread(gl_thread_create, NULL);

}
开发者ID:AntonioCS,项目名称:Corange,代码行数:30,代码来源:SDL_local.c

示例15: SDL_WM_CreateTempContext

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

  temp_context = wglCreateContext(temp_device);
  if (temp_context == NULL) {
    // Could not create OpenGL context
    return 2;
  }

  if (!wglShareLists(info.hglrc, temp_context)) {
    // Could not share lists with temp context.
    return 3;
  }
  
  return 0;
  
}
开发者ID:AntonioCS,项目名称:Corange,代码行数:25,代码来源:SDL_local.c


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