• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GHOST_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getNumDisplaySettings

GHOST_TSuccess
GHOST_DisplayManagerX11::
getNumDisplaySettings(
		GHOST_TUns8 display,
		GHOST_TInt32& numSettings) const
{
#ifdef WITH_X11_XF86VMODE
	int majorVersion, minorVersion;
	XF86VidModeModeInfo **vidmodes;
	Display *dpy = m_system->getXDisplay();

	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");

	if (dpy == NULL)
		return GHOST_kFailure;

	majorVersion = minorVersion = 0;
	if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
		fprintf(stderr, "Error: XF86VidMode extension missing!\n");
		return GHOST_kFailure;
	}

	if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) {
		XFree(vidmodes);
	}

#else
	/* We only have one X11 setting at the moment. */
	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
	numSettings = 1;
#endif

	return GHOST_kSuccess;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:34,代码来源:GHOST_DisplayManagerX11.cpp


示例2: getDisplaySetting

GHOST_TSuccess
GHOST_DisplayManagerX11::
getDisplaySetting(
		GHOST_TUns8 display,
		GHOST_TInt32 index,
		GHOST_DisplaySetting& setting) const
{
	Display *dpy = m_system->getXDisplay();

	if (dpy == NULL)
		return GHOST_kFailure;

	(void)display;

#ifdef WITH_X11_XF86VMODE
	int majorVersion, minorVersion;

	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");

	majorVersion = minorVersion = 0;
	if (XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
		XF86VidModeModeInfo **vidmodes;
		int numSettings;

		if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes)) {
			GHOST_ASSERT(index < numSettings, "Requested setting outside of valid range.\n");

			setting.xPixels = vidmodes[index]->hdisplay;
			setting.yPixels = vidmodes[index]->vdisplay;
			setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
			setting.frequency = calculate_rate(vidmodes[index]);
			XFree(vidmodes);

			return GHOST_kSuccess;
		}
	}
	else {
		fprintf(stderr, "Warning: XF86VidMode extension missing!\n");
		/* fallback to non xf86vmode below */
	}
#endif  /* WITH_X11_XF86VMODE */

	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
	GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
	(void)index;

	setting.xPixels  = DisplayWidth(dpy, DefaultScreen(dpy));
	setting.yPixels = DisplayHeight(dpy, DefaultScreen(dpy));
	setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
	setting.frequency = 60.0f;

	return GHOST_kSuccess;
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:53,代码来源:GHOST_DisplayManagerX11.cpp


示例3: while

void GHOST_EventManager::disposeEvents()
{
	while (m_handled_events.empty() == false) {
		GHOST_ASSERT(m_handled_events[0], "invalid event");
		delete m_handled_events[0];
		m_handled_events.pop_front();
	}

	while (m_events.empty() == false) {
		GHOST_ASSERT(m_events[0], "invalid event");
		delete m_events[0];
		m_events.pop_front();
	}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:14,代码来源:GHOST_EventManager.cpp


示例4: GHOST_ASSERT

GHOST_TSuccess GHOST_WindowManager::beginFullScreen(GHOST_IWindow *window,
		bool /*stereoVisual*/)
{
	GHOST_TSuccess success = GHOST_kFailure;
	GHOST_ASSERT(window, "GHOST_WindowManager::beginFullScreen(): invalid window");
	GHOST_ASSERT(window->getValid(), "GHOST_WindowManager::beginFullScreen(): invalid window");
	if (!getFullScreen()) {
		m_fullScreenWindow = window;
		m_activeWindowBeforeFullScreen = getActiveWindow();
		setActiveWindow(m_fullScreenWindow);
		m_fullScreenWindow->beginFullScreen();
		success = GHOST_kSuccess;
	}
	return success;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:15,代码来源:GHOST_WindowManager.cpp


示例5: GHOST_ASSERT

GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
{
	GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::getDisplaySetting(): only main display is supported");
	GHOST_TSuccess success;
	DEVMODE dm;
	if (::EnumDisplaySettings(NULL, index, &dm)) {
#ifdef GHOST_DEBUG
		printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
#endif // GHOST_DEBUG
		setting.xPixels		= dm.dmPelsWidth;
		setting.yPixels		= dm.dmPelsHeight;
		setting.bpp			= dm.dmBitsPerPel;
		/* When you call the EnumDisplaySettings function, the dmDisplayFrequency member
		 * may return with the value 0 or 1. These values represent the display hardware's
		 * default refresh rate. This default rate is typically set by switches on a display 
		 * card or computer motherboard, or by a configuration program that does not use 
		 * Win32 display functions such as ChangeDisplaySettings. 
		 */
		/* First, we tried to explicitly set the frequency to 60 if EnumDisplaySettings
		 * returned 0 or 1 but this doesn't work since later on an exact match will
		 * be searched. And this will never happen if we change it to 60. Now we rely
		 * on the default h/w setting.
		 */
		setting.frequency = dm.dmDisplayFrequency;
		success = GHOST_kSuccess;
	}
	else {
		success = GHOST_kFailure;
	}
	return success;
}
开发者ID:MakersF,项目名称:BlenderDev,代码行数:31,代码来源:GHOST_DisplayManagerWin32.cpp


示例6: GHOST_ASSERT

GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
                                             const bool stereoVisual, const bool alphaBackground, const GHOST_TUns16 numOfAASamples)
{
	GHOST_TSuccess success = GHOST_kFailure;
	GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager");
	if (m_displayManager) {
		if (!m_windowManager->getFullScreen()) {
			m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);

			//GHOST_PRINT("GHOST_System::beginFullScreen(): activating new display settings\n");
			success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
			if (success == GHOST_kSuccess) {
				//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
				success = createFullScreenWindow((GHOST_Window **)window, setting, stereoVisual, alphaBackground, numOfAASamples);
				if (success == GHOST_kSuccess) {
					m_windowManager->beginFullScreen(*window, stereoVisual);
				}
				else {
					m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);
				}
			}
		}
	}
	if (success == GHOST_kFailure) {
		GHOST_PRINT("GHOST_System::beginFullScreen(): could not enter full-screen mode\n");
	}
	return success;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:28,代码来源:GHOST_System.cpp


示例7: GHOST_WindowCarbon

GHOST_IWindow *GHOST_SystemCarbon::createWindow(
		const STR_String& title,
		GHOST_TInt32 left,
		GHOST_TInt32 top,
		GHOST_TUns32 width,
		GHOST_TUns32 height,
		GHOST_TWindowState state,
		GHOST_TDrawingContextType type,
		bool stereoVisual,
		const GHOST_TUns16 numOfAASamples,
		const GHOST_TEmbedderWindowID parentWindow)
{
	GHOST_IWindow *window = 0;

	window = new GHOST_WindowCarbon(title, left, top, width, height, state, type);

	if (window) {
		if (window->getValid()) {
			// Store the pointer to the window
			GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
			m_windowManager->addWindow(window);
			m_windowManager->setActiveWindow(window);
			pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
		}
		else {
			GHOST_PRINT("GHOST_SystemCarbon::createWindow(): window invalid\n");
			delete window;
			window = 0;
		}
	}
	else {
		GHOST_PRINT("GHOST_SystemCarbon::createWindow(): could not create window\n");
	}
	return window;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:35,代码来源:GHOST_SystemCarbon.cpp


示例8: GHOST_ASSERT

void GHOST_WindowCarbon::setTitle(const STR_String& title)
{
    GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
    Str255 title255;
    gen2mac(title, title255);
	::SetWTitle(m_windowRef, title255);
}
开发者ID:MakersF,项目名称:BlenderDev,代码行数:7,代码来源:GHOST_WindowCarbon.cpp


示例9: GHOST_ASSERT

GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
{
	GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): only main display is supported");

#ifdef GHOST_DEBUG
	printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): requested settings:\n");
	printf("  setting.xPixels=%d\n", setting.xPixels);
	printf("  setting.yPixels=%d\n", setting.yPixels);
	printf("  setting.bpp=%d\n", setting.bpp);
	printf("  setting.frequency=%d\n", setting.frequency);
#endif // GHOST_DEBUG

	CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
		m_displayIDs[display],
		(size_t)setting.bpp,
		(size_t)setting.xPixels,
		(size_t)setting.yPixels,
		(CGRefreshRate)setting.frequency,
		NULL);

#ifdef GHOST_DEBUG
	printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): switching to:\n");
	printf("  setting.xPixels=%d\n", getValue(displayModeValues, kCGDisplayWidth));
	printf("  setting.yPixels=%d\n", getValue(displayModeValues, kCGDisplayHeight));
	printf("  setting.bpp=%d\n", getValue(displayModeValues, kCGDisplayBitsPerPixel));
	printf("  setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate));
#endif // GHOST_DEBUG

	CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
        
	return err == CGDisplayNoErr ? GHOST_kSuccess : GHOST_kFailure;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:32,代码来源:GHOST_DisplayManagerCarbon.cpp


示例10: GHOST_ASSERT

void
GHOST_SystemSDL::addDirtyWindow(GHOST_WindowSDL *bad_wind)
{
	GHOST_ASSERT((bad_wind != NULL), "addDirtyWindow() NULL ptr trapped (window)");

	m_dirty_windows.push_back(bad_wind);
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:7,代码来源:GHOST_SystemSDL.cpp


示例11: while

void GHOST_EventManager::disposeEvents()
{
	while (m_events.size() > 0) {
		GHOST_ASSERT(m_events[0], "invalid event");
		delete m_events[0];
		m_events.pop_front();
	}
}
开发者ID:mik0001,项目名称:Blender,代码行数:8,代码来源:GHOST_EventManager.cpp


示例12: m_modifierMask

GHOST_SystemCarbon::GHOST_SystemCarbon() :
	m_modifierMask(0)
{
	m_displayManager = new GHOST_DisplayManagerCarbon();
	GHOST_ASSERT(m_displayManager, "GHOST_SystemCarbon::GHOST_SystemCarbon(): m_displayManager==0\n");
	m_displayManager->initialize();

	UnsignedWide micros;
	::Microseconds(&micros);
	m_start_time = UnsignedWideToUInt64(micros) / 1000;
	m_ignoreWindowSizedMessages = false;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:12,代码来源:GHOST_SystemCarbon.cpp


示例13: GHOST_ASSERT

GHOST_TSuccess
GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
        GHOST_TInt32 index,
        GHOST_DisplaySetting& setting) const
{
    GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");

    int i;
    SDL_Rect **vidmodes;
    /* NULL is passed in here to get the modes for the current bit depth.
     * Other bit depths may be possible; in that case, an SDL_PixelFormat struct
     * should be passed in. To get a complete profile, all possible bit depths
     * would need to be iterated over. - z0r */
    vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
                             SDL_FULLSCREEN | SDL_HWPALETTE);
    if (!vidmodes) {
        fprintf(stderr, "Could not get available video modes: %s.\n",
                SDL_GetError());
        return GHOST_kFailure;
    }
    for (i = 0; vidmodes[i]; i++);
    GHOST_ASSERT(index < i, "Requested setting outside of valid range.\n");

    setting.xPixels = vidmodes[index]->w;
    setting.yPixels = vidmodes[index]->h;

    SDL_Surface *surf;
    surf = SDL_GetVideoSurface();
    if (surf == NULL) {
        fprintf(stderr, "Getting display setting: %s\n", SDL_GetError());
        /* Just guess the bit depth */
        setting.bpp = 32;
    } else {
        setting.bpp = surf->format->BitsPerPixel;
    }
    /* Just guess the frequency :( */
    setting.frequency = 60;

    return GHOST_kSuccess;
}
开发者ID:ruesp83,项目名称:Blender---AMA,代码行数:40,代码来源:GHOST_DisplayManagerSDL.cpp


示例14: GHOST_ASSERT

GHOST_TSuccess GHOST_EventManager::pushEvent(GHOST_IEvent* event)
{
	GHOST_TSuccess success;
	GHOST_ASSERT(event, "invalid event");
	if (m_events.size() < m_events.max_size()) {
		m_events.push_front(event);
		success = GHOST_kSuccess;
	}
	else {
		success = GHOST_kFailure;
	}
	return success;
}
开发者ID:mik0001,项目名称:Blender,代码行数:13,代码来源:GHOST_EventManager.cpp


示例15: GHOST_ASSERT

GHOST_TSuccess
GHOST_DisplayManager::findMatch(
		GHOST_TUns8 display,
		const GHOST_DisplaySetting& setting,
		GHOST_DisplaySetting& match) const
{
	GHOST_TSuccess success = GHOST_kSuccess;
	GHOST_ASSERT(m_settingsInitialized, "GHOST_DisplayManager::findMatch(): m_settingsInitialized=false");

	int criteria[4] = {
		(int)setting.xPixels,
		(int)setting.yPixels,
		(int)setting.bpp,
		(int)setting.frequency
	};
	int capabilities[4];
	double field, score;
	double best = 1e12; // A big number
	int found = 0;

	// Look at all the display modes
	for (int i = 0; (i < (int)m_settings[display].size()); i++) {
		// Store the capabilities of the display device
		capabilities[0] = m_settings[display][i].xPixels;
		capabilities[1] = m_settings[display][i].yPixels;
		capabilities[2] = m_settings[display][i].bpp;
		capabilities[3] = m_settings[display][i].frequency;

		// Match against all the fields of the display settings
		score = 0;
		for (int j = 0; j < 4; j++) {
			field = capabilities[j] - criteria[j];
			score += field * field;
		}

		if (score < best) {
			found = i;
			best = score;
		}
	}
	
	match = m_settings[display][found];
	
	GHOST_PRINT("GHOST_DisplayManager::findMatch(): settings of match:\n");
	GHOST_PRINT("  setting.xPixels=" << match.xPixels << "\n");
	GHOST_PRINT("  setting.yPixels=" << match.yPixels << "\n");
	GHOST_PRINT("  setting.bpp=" << match.bpp << "\n");
	GHOST_PRINT("  setting.frequency=" << match.frequency << "\n");

	return success;
}
开发者ID:Aligorith,项目名称:blender,代码行数:51,代码来源:GHOST_DisplayManager.cpp


示例16: GHOST_ASSERT

void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_TUns64 time, GHOST_IWindow *window)
{
	GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
	             "rogue button trying to escape NDOF manager");

	GHOST_EventNDOFButton *event = new GHOST_EventNDOFButton(time, window);
	GHOST_TEventNDOFButtonData *data = (GHOST_TEventNDOFButtonData *) event->getData();

	data->action = press ? GHOST_kPress : GHOST_kRelease;
	data->button = button;

#ifdef DEBUG_NDOF_BUTTONS
	printf("%s %s\n", ndof_button_names[button], press ? "pressed" : "released");
#endif

	m_system.pushEvent(event);
}
开发者ID:JimStar,项目名称:OctaneBlender,代码行数:17,代码来源:GHOST_NDOFManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GIMP_COLOR_TOOL函数代码示例发布时间:2022-05-30
下一篇:
C++ GGadgetGetWindow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap