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

C++ checkInit函数代码示例

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

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



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

示例1: lst_InsertPred

lst_sEntry *
lst_InsertPred (
  thread_sMutex		*mp,
  lst_sEntry		*succ,		/* Insert before this element */
  lst_sEntry		*link,		/* Link to insert */
  void			*item		/* Item to insert */
)
{
  lst_sEntry		*pred;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  pred = succ->blink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(pred->flink == succ);

  link->flink = succ;
  link->blink = succ->blink;
  succ->blink = pred->flink = link;
  if (item != NULL)
    link->item = item;

  if (mp != NULL) sync_MutexUnlock(mp);

  return pred;  
}
开发者ID:jordibrus,项目名称:proview,代码行数:30,代码来源:rt_lst.c


示例2: draw_rotated

	//may cause a performace drop...
	void Image::draw_rotated(float x, float y, float ax, float ay, float angle, float from_x, float from_y, float w, float h)
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");

		//create a cropped surface from the original
		SDL_Surface* cropped = SDL_CreateRGBSurface(0, w, h, 32, 0, 0, 0, 0);
		srcrect.x = from_x; srcrect.y = from_y;
		srcrect.w = w; srcrect.h = h;
		SDL_BlitSurface(implementation->sdlSurface, &srcrect, cropped, null);

		//zoom the cropped fragment
		rotozoom_surface = rotozoomSurface(cropped, angle*toDegree, 1, 0);

		int w1 = implementation->sdlSurface->w,
			h1 = implementation->sdlSurface->h,
			w2 = rotozoom_surface->w,
			h2 = rotozoom_surface->h;

		int ax2 = w2/2 + (ax - w1/2)*cos(angle) - (ay - h1/2)*sin(angle);
		int ay2 = h2/2 + (ay - h1/2)*cos(angle) - (ax - w1/2)*sin(angle);

		dstrect.x = x-ax2;
		dstrect.y = y-ay2;

		//blit the rotated cropped fragment, leaving the original intact
		SDL_BlitSurface(rotozoom_surface, null, GameEngine::display->implementation->sdlDisplaySurface, &dstrect);
		SDL_FreeSurface(cropped);
		SDL_FreeSurface(rotozoom_surface);
	}
开发者ID:wentyl,项目名称:carse,代码行数:30,代码来源:sdl12_game_engine.cpp


示例3: lst_InsertSucc

lst_sEntry *
lst_InsertSucc (
  thread_sMutex		*mp,
  lst_sEntry		*pred,		/* Insert after this element */
  lst_sEntry		*link,		/* link to insert */
  void			*item		/* Item to insert */
)
{
  lst_sEntry		*succ;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  succ = pred->flink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(succ->blink == pred);

  link->blink = pred;
  link->flink = pred->flink;
  pred->flink = succ->blink = link;
  if (item != NULL)
    link->item = item;

  if (mp != NULL) sync_MutexUnlock(mp);

  return succ;  
}
开发者ID:jordibrus,项目名称:proview,代码行数:30,代码来源:rt_lst.c


示例4: checkInit

bool PlaylistHandler::createPlaylist(std::string name) {
    checkInit();
    QDomNode node = root.firstChild();
    while (!node.isNull()) {
        QDomElement element = node.toElement();
        if (!element.isNull()) {
            if (element.tagName() == "Playlist") {
                if (element.attribute("name").toStdString() == name) {
                    return false;
                }
            }
        }
        node = node.nextSibling();
    }
    QDomElement thisPlaylist = doc.createElement("Playlist");
    thisPlaylist.setAttribute("name", QString::fromStdString(name));
    boost::uuids::uuid uuidobj = boost::uuids::random_generator()();
    std::stringstream ss;
    ss << uuidobj;
    QString uuid = QString::fromStdString(ss.str());
    thisPlaylist.setAttribute("id", uuid);
    root.appendChild(thisPlaylist);
    save();
    emit playlistsChanged(getPlaylists());
    return true;
}
开发者ID:xxmicloxx,项目名称:GSPlayerQT,代码行数:26,代码来源:playlisthandler.cpp


示例5: checkInit

	Image::~Image()
	{
		checkInit();
		SDL_FreeSurface(this->implementation->sdlSurface);
		if(this->implementation != null) SDL_FreeSurface(this->implementation->cachedSdlSurface);
		delete implementation;
	}
开发者ID:hydren,项目名称:fgeal,代码行数:7,代码来源:image.cpp


示例6: waitForEvent

	Event* EventQueue::waitForEvent()
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
		Event* ev = new Event;
		SDL_WaitEvent(ev->implementation->sdlEvent);
		return ev;
	}
开发者ID:wentyl,项目名称:carse,代码行数:7,代码来源:sdl12_game_engine.cpp


示例7: implementation

	Image::Image(const string& filename)
	: implementation(new Implementation())
	{
		checkInit();
		this->implementation->sdlSurface = IMG_Load(filename.c_str() );
		if ( this->implementation->sdlSurface == null)
			throw AdapterException(string("Could not load image \"") + filename + "\": " + IMG_GetError());

		// attempt to use 32bit format, which are better suited to rotozoom
		if(this->implementation->sdlSurface->format->BitsPerPixel != 32)
		{
			SDL_PixelFormat format32 = *(this->implementation->sdlSurface->format);
			format32.BitsPerPixel = 32;
			SDL_Surface* surf = SDL_ConvertSurface(this->implementation->sdlSurface, &format32, 0);
			if(surf != null)  // if 32bit surf could not be obtained, move on
			{
				SDL_FreeSurface(this->implementation->sdlSurface);
				this->implementation->sdlSurface = surf;
			}
		}

		this->implementation->cachedSdlSurface = null;

		// todo make a bool flag on SDL 1.2 adapter image to toogle AA when rotozooming.
	}
开发者ID:hydren,项目名称:fgeal,代码行数:25,代码来源:image.cpp


示例8: checkInit

	Event* EventQueue::waitForEvent()
	{
		checkInit();
		Event* ev = new Event;
		al_wait_for_event(this->implementation->allegroEventQueue, ev->implementation->allegroEvent);
		return ev;
	}
开发者ID:hydren,项目名称:fgeal,代码行数:7,代码来源:event.cpp


示例9: lst_IsLinked

pwr_tBoolean
lst_IsLinked (
  thread_sMutex		*mp,
  lst_sEntry		*link
)
{
  pwr_tBoolean		is_linked;
  lst_sEntry		*pred;
  lst_sEntry		*succ;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  pred = link->blink;
  succ = link->flink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(pred->flink == link);
  pwr_Assert(succ->blink == link);

  is_linked = link->flink != link;

  if (mp != NULL) sync_MutexUnlock(mp);

  return is_linked;
}
开发者ID:jordibrus,项目名称:proview,代码行数:28,代码来源:rt_lst.c


示例10: Exception

	Image::Image(string filename)
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
		this->implementation = new Implementation;
		this->implementation->sdlSurface = IMG_Load(filename.c_str() );
		if ( this->implementation->sdlSurface == null)
			throw Exception("Could not load image \"" + filename + "\": " + IMG_GetError());
	}
开发者ID:wentyl,项目名称:carse,代码行数:8,代码来源:sdl12_game_engine.cpp


示例11: listenEvents

	//FIXME
	void EventQueue::listenEvents()
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
//		al_flush_event_queue(this->implementation->allegroEventQueue);
//		al_register_event_source(this->implementation->allegroEventQueue, al_get_display_event_source(GameEngine::display->implementation->allegroDisplay));
//		al_register_event_source(this->implementation->allegroEventQueue, al_get_keyboard_event_source());
//		al_register_event_source(this->implementation->allegroEventQueue, al_get_mouse_event_source());
	}
开发者ID:wentyl,项目名称:carse,代码行数:9,代码来源:sdl12_game_engine.cpp


示例12: serialConfig

char serialConfig(unsigned char * buffer, unsigned int length){
	unsigned long int i ;
	unsigned long int timer = 0;
	clearClk();
	setProgramm();
	__delay_cycles(10*CONFIG_CYCLES);	
	clearProgramm();
	__delay_cycles(5*CONFIG_CYCLES);		
	while(checkInit() > 0 && timer < 200) timer ++; // waiting for init pin to go down
	if(timer >= 200){
		 printf("Init pin not going down !");
		 setProgramm();
		 return -1;	
	}
	timer = 0;
	__delay_cycles(5*CONFIG_CYCLES);
	#ifndef MARK1
	setProgramm();
	while(checkInit() == 0 && timer < 0xFFFFFF){
		 timer ++; // waiting for init pin to go up
	}
	if(timer >= 0xFFFFFF){
		 printf("Init pin not going high ! \n");	
		 return -1;
	}
	#endif
	timer = 0;
	printf("Starting configuration ! \n");
	for(i = 0 ; i < length ; i ++){
		serialConfigWriteByte(buffer[i]);	
	}
	while(timer < 50){
		clearClk();
		__delay_cycles(CONFIG_CYCLES);
		setClk();	
		timer ++ ;
	}
	clearClk();
	clearDout();
	if(!checkDone() && timer >= 255){
		 printf("Done pin not going high ! \n");
		 return -1;	
	}
	return 1 ;
}
开发者ID:AshirogiMaxx,项目名称:fpga-cam,代码行数:45,代码来源:serial_fpga_loader.c


示例13: draw

	void Image::draw(float x, float y)
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");

		//draws all source region
		dstrect.x = x; dstrect.y = y;

		SDL_BlitSurface(this->implementation->sdlSurface, null, GameEngine::display->implementation->sdlDisplaySurface, &dstrect);
	}
开发者ID:wentyl,项目名称:carse,代码行数:9,代码来源:sdl12_game_engine.cpp


示例14: clear

	void Display::clear()
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
		if ( SDL_FillRect(this->implementation->sdlDisplaySurface, null, 0) == -1 )
		{
			string msg = string("SDL_FillRect error! ") + SDL_GetError();
			cout << msg << endl;
			throw Exception(msg);
		}
	}
开发者ID:wentyl,项目名称:carse,代码行数:10,代码来源:sdl12_game_engine.cpp


示例15: refresh

	void Display::refresh()
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
		//flip surface if double-buffered, update rect if single-buffered instead
		if( SDL_Flip(this->implementation->sdlDisplaySurface) == -1 )
		{
			string message = string("Failed to swap the buffers/refresh the display: ") + SDL_GetError();
			cout << message << endl;
			throw Exception(message);
		}
	}
开发者ID:wentyl,项目名称:carse,代码行数:11,代码来源:sdl12_game_engine.cpp


示例16: implementation

	Font::Font(const string& filename, int size, bool antialiasing, bool hinting, bool kerning)
	: implementation(new Implementation)
	{
		checkInit();

		//I know, pretty odd...
		int flags = (antialiasing? 0 : ALLEGRO_TTF_MONOCHROME)	| (hinting? 0 : ALLEGRO_TTF_NO_AUTOHINT) | (kerning? 0 : ALLEGRO_TTF_NO_KERNING);
		this->implementation->allegroFont = al_load_ttf_font(filename.c_str(), size, flags);

		if(this->implementation->allegroFont == null)
			throw AdapterException("Font %s could not be loaded: Error %d", filename.c_str(), al_get_errno());
	}
开发者ID:hydren,项目名称:fgeal,代码行数:12,代码来源:font.cpp


示例17:

	Event::MouseButton::value Event::getEventMouseButton()
	{
		if(checkInit()==false) throw Exception("Fatal error: attempt to use GameEngine library without initialization!");
		switch(this->implementation->sdlEvent->button.button)
		{
			case SDL_BUTTON_LEFT:		return Event::MouseButton::LEFT;
			case SDL_BUTTON_MIDDLE:		return Event::MouseButton::MIDDLE;
			case SDL_BUTTON_RIGHT:		return Event::MouseButton::RIGHT;

			default:	return Event::MouseButton::UNKNOWN;
		}
	}
开发者ID:wentyl,项目名称:carse,代码行数:12,代码来源:sdl12_game_engine.cpp


示例18: checkInit

PTYPE TSpaceGrid2D::getY(int j)
{
	
	checkInit();
	
	if(j>=0 && j<=NY)
		return j*hy + y0;
	else
	{
		printf("Error in TSpaceGrid2D::getY: Index out of bounds\n");
		exit(EXIT_FAILURE);
	}	
}
开发者ID:badalindia,项目名称:SimulationCM,代码行数:13,代码来源:grid2d.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ checkInputs函数代码示例发布时间:2022-05-30
下一篇:
C++ checkIndex函数代码示例发布时间: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