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

C++ MainLoop函数代码示例

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

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



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

示例1: main

int main(int argc, char *argv[])
{
    UNUSED_PARAMETER(argc);
    UNUSED_PARAMETER(argv);

    if (!Startup())
    {
        Shutdown();
        return 1;
    }

    MainLoop();

    Shutdown();
    return 0;
}
开发者ID:DrShoo,项目名称:IonDrive,代码行数:16,代码来源:IonDrive.cpp


示例2: main

//------------------------------------------------------------  main()
//
int main(int argc, char **argv)
{		
	
	if ( !(subject_name = Parser(argc, argv)) ) 		// Parsea la linea de comandos: 	parser.c
		exit (1);			
	
	OnInit();						//Inicializa todo lo inicializable: sdlgl_control.h	
	
	ExperimentSetup(); 				//Configura el experimento
	MainLoop();						//Lanza el experimento propiamente dicho
	ExperimentSave();				//Salva los resultados en un archivo
	
	OnExit();						//Cierra limpiamente todico: sdlgl_control.h
	
	return APPSUCCESS;
}
开发者ID:jorjuato,项目名称:IORExperiments,代码行数:18,代码来源:main.c


示例3: main

int main(int argc, char *argv[]) {
	// set input_file, output_file
	strcpy(input_file, "data/small-data.txt");
	strcpy(input_file2, "data/rand-data.txt");
	if (argc == 2) strcpy(input_file, argv[1]);

	// MainLoop (for presentation)
	MainLoop();
	
	//build_test();
	//query_key_test();
	//query_range_test();
	//modify_test();
	//delete_test();
	return 0;
}
开发者ID:wlgus3018,项目名称:b-tree,代码行数:16,代码来源:main.c


示例4: wmain

int wmain(int argc, WCHAR* argv[])
{
    LARGE_INTEGER lint;
    DWORD Written;
    COORD Coord = { 0, 0 };

    myself = GetModuleHandle(NULL);

    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
                               &ScreenBufferInfo);
    ScreenBufferInfo.dwSize.X = ScreenBufferInfo.srWindow.Right - ScreenBufferInfo.srWindow.Left + 1;
    ScreenBufferInfo.dwSize.Y = ScreenBufferInfo.srWindow.Bottom - ScreenBufferInfo.srWindow.Top + 1;
    ScreenBuffer = CreateConsoleScreenBuffer(GENERIC_WRITE,
                                             0,
                                             NULL,
                                             CONSOLE_TEXTMODE_BUFFER,
                                             NULL);
    if (ScreenBuffer == INVALID_HANDLE_VALUE)
    {
        wprintf(L"%s: could not create a new screen buffer\n", app_name);
        return EXIT_FAILURE;
    }

    /* Fill buffer with black background */
    FillConsoleOutputAttribute(ScreenBuffer,
                               0,
                               ScreenBufferInfo.dwSize.X * ScreenBufferInfo.dwSize.Y,
                               Coord,
                               &Written);

    WaitableTimer = CreateWaitableTimer(NULL, FALSE, NULL);
    if (WaitableTimer == INVALID_HANDLE_VALUE)
    {
        wprintf(L"CreateWaitabletimer() failed\n");
        return 1;
    }
    lint.QuadPart = -2000000;
    if (!SetWaitableTimer(WaitableTimer, &lint, 200, NULL, NULL, FALSE))
    {
        wprintf(L"SetWaitableTimer() failed: 0x%lx\n", GetLastError());
        return 2;
    }
    SetConsoleActiveScreenBuffer(ScreenBuffer);
    MainLoop();
    CloseHandle(ScreenBuffer);
    return EXIT_SUCCESS;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:47,代码来源:notevil.c


示例5: main

int main(int argc, const char** argv)
{
	cfg::LoadParams(argc, argv);			

	GPUHandle::Init(cfg::dev_id);	

	LoadRawData(graph_data, raw_string, labels);
	LoadTrainIndexes(cfg::train_idx_file, train_idx, graph_data, raw_string, labels);
	LoadTestIndexes(cfg::test_idx_file, test_idx, inv_test_idx, graph_data, raw_string, labels);

	InitModel();

    MainLoop(); 
	
	GPUHandle::Destroy();
	return 0;
}
开发者ID:Hanjun-Dai,项目名称:kd_prediction,代码行数:17,代码来源:kernel_loopy_bp.cpp


示例6: listen

  i32 TCPServer::StartRoutine()
  {
    int status;

    // allow the socket to take connections listen(已建立、尚未连接的套接字号,连接队列的最大长度)
    status = listen(m_ServerSocket, 1);
    if(status == SOCKET_ERROR)
    {
      CLOG_ERROR("ERROR: listen unsuccessful\r\n");
      return (i32)SocketResult_CanotListen;
    }

    CLOG("Waiting for connection...\r\n");

    MainLoop();
    return 0;
  }
开发者ID:artint-liu,项目名称:Marimo,代码行数:17,代码来源:clSocketServer.cpp


示例7: main2

int main2() {
  // Install standard binary operators.
  // 1 is lowest precedence.
  BinopPrecedence['<'] = 10;
  BinopPrecedence['+'] = 20;
  BinopPrecedence['-'] = 20;
  BinopPrecedence['*'] = 40;  // highest.

  // Prime the first token.
  fprintf(stderr, "ready> ");
  getNextToken();

  // Run the main "interpreter loop" now.
  MainLoop();

  return 0;
}
开发者ID:kpdev42,项目名称:Kaleidoscope,代码行数:17,代码来源:Main.cpp


示例8: main

int
main(int argc, char** argv)
{
	gRequestPort = find_port(kPortNameReq);
	if (gRequestPort < B_OK) {
		fprintf(stderr, "%s\n", strerror(gRequestPort));
		return gRequestPort;
	}

	gReplyPort = find_port(kPortNameRpl);
	if (gReplyPort < B_OK) {
		fprintf(stderr, "%s\n", strerror(gReplyPort));
		return gReplyPort;
	}

	return MainLoop();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:17,代码来源:main.cpp


示例9: SDL_CreateWindow

Home::Home()
{
    //Initialize the window
    window = SDL_CreateWindow("Kagan III - Home", 0, 0, 0, 0, SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP);
    if(window == NULL)
        cout << "Failed to initialize the home window: " << SDL_GetError() << endl;

    //Initialize the renderer
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if(renderer == NULL)
        cout << "Failed to initialize the renderer: " << SDL_GetError() << endl;

    //Initialize the size of the cursor
    cursorRect.w = 35;
    cursorRect.h = 35;
    //Hide the default cursor
    SDL_ShowCursor(false);

    //Initialize the Chiller font
    font_chiller = TTF_OpenFont("Resources/Fonts/Chiller.ttf", 999);

    //Initialize the user-name input label texture
    InitTheUsernameLabel();

    //Initialize the character bar
    InitTheCharacterBar();

    //Initialize all the textures used in the home window
    InitTheTextures();

    //Initialize the play button
    InitThePlayButton();

    //Add the background texture to the renderer
    SDL_RenderCopy(renderer, backgroundTexture, NULL, NULL);

    //Add the user-name label texture to the renderer
    SDL_RenderCopy(renderer, usernameLabel, NULL, &usernameLabelRect);

    //And GOD said "Let there be light!". (aka show everything to the screen)
    SDL_RenderPresent(renderer);

    homeWindowIsActive = true;
    MainLoop();
}
开发者ID:nooro,项目名称:Kagan,代码行数:45,代码来源:Home.cpp


示例10: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
	HWND hWnd;
 
	int screenWidth = GetSystemMetrics(SM_CXSCREEN);
	int screenHeight = GetSystemMetrics(SM_CYSCREEN);

	hWnd = CreateMyWindow("Савельев", screenWidth, screenHeight, 1, true, hInstance);
 
	// Выходим при ошибке
	if(hWnd == NULL) return TRUE;
 
	// Инициализируем OpenGL
	Init(hWnd);
 
	// Запускаем игровой цикл
	return MainLoop();
}
开发者ID:emrakul,项目名称:WinGLEngine,代码行数:18,代码来源:Init.cpp


示例11: while

int BannerWindow::Run()
{
	int choice = -1;

	while(choice == -1)
	{
		usleep(50000);

		if (shutdown) //for power button
			Sys_Shutdown();
		else if (reset) //for reset button
			Sys_Reboot();

		choice = MainLoop();
	}

	return choice;
}
开发者ID:SuperrSonic,项目名称:ULGX-ICON-VIEW,代码行数:18,代码来源:BannerWindow.cpp


示例12: while

WPARAM
CGame::Start()
{
	m_quit = false;							// Bool Variable To Exit Loop
	bool fullscreen = false;

	// Create Our OpenGL Window
	if (!CGLRender::Instance().CreateGLWindow(m_windowTitle,1024,768,32,fullscreen))
	{
		return 0;									// Quit If Window Was Not Created
	}

	while(!m_quit)									// Loop That Runs While done=FALSE
	{
		
		if (CInputManager::Instance().CheckInput())
			;
		else {
			// Draw The Scene.  Watch For ESC Key And Quit Messages From DrawGLScene()
			if (CGLRender::Instance().getActive())						// Program Active?
			{
				CGLRender::Instance().StartGLScene();					// Draw The Scene
				MainLoop();
				//CGLRender::Instance().drawFloor();
				CGLRender::Instance().EndGLScene();	
				
			} if (CInputManager::Instance().KeyState(VK_F1)) {
				CInputManager::Instance().KeyUp(VK_F1);
				CGLRender::Instance().KillGLWindow();						// Kill Our Current Window
				fullscreen=!fullscreen;									// Toggle Fullscreen / Windowed Mode
				
				// Recreate Our OpenGL Window
				if (!CGLRender::Instance().CreateGLWindow(m_windowTitle,1024,768,32,fullscreen))
				{
					return 0;						// Quit If Window Was Not Created
				}
			}
		}
	}

	// Shutdown
	CGLRender::Instance().KillGLWindow();			// Kill The Window
	return 0;							// Exit The Program
}
开发者ID:rpmessner,项目名称:Marbles,代码行数:44,代码来源:CGame.cpp


示例13: srand

void Zoo::Run() {
  rank_ = communication_.Rank();

  srand(rand() + rank_);

  for (int i = 0; i < 4; i++) {
    ship_.requests_[i] = requests_[i];
    port_.requests_[i] = requests_[i];
  }

//  communication_.ReceiveAll(port_.requests_, Tag::kRequest);
//  communication_.ReceiveAll(port_.requests_, Tag::kReply);
//
  communication_.ReceiveAll(ship_.requests_[int(Tag::kRequest)], Tag::kRequest);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kReply)], Tag::kReply);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kAcquire)], Tag::kAcquire);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kRelease)], Tag::kRelease);
  MainLoop();
}
开发者ID:kareth,项目名称:mpi_penguins,代码行数:19,代码来源:zoo.cpp


示例14: main

int		main(int argc, char **argv)
	{
	#define mDNSRecord mDNSStorage
	mDNS_PlatformSupport	platformStorage;
	mStatus					err;

	bzero(&mDNSRecord, sizeof mDNSRecord);
	bzero(&platformStorage, sizeof platformStorage);

	ParseCmdLinArgs(argc, argv);

	err = mDNS_Init(&mDNSRecord, &platformStorage, gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses, 
					mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext); 

	if (mStatus_NoError == err)
		err = udsserver_init();
		
	Reconfigure(&mDNSRecord);

	// Now that we're finished with anything privileged, switch over to running as "nobody"
	if (mStatus_NoError == err)
		{
		const struct passwd *pw = getpwnam("nobody");
		if (pw != NULL)
			setuid(pw->pw_uid);
		else
			LogMsg("WARNING: mdnsd continuing as root because user \"nobody\" does not exist");
		}

	if (mStatus_NoError == err)
		err = MainLoop(&mDNSRecord);
 
	mDNS_Close(&mDNSRecord);

	if (udsserver_exit() < 0)
		LogMsg("ExitCallback: udsserver_exit failed");
 
 #if MDNS_DEBUGMSGS > 0
	printf("mDNSResponder exiting normally with %ld\n", err);
 #endif
 
	return err;
	}
开发者ID:HQarroum,项目名称:android-mdns,代码行数:43,代码来源:PosixDaemon.c


示例15: MainLoop

void MainProgram::Run()
{
  //Init stuff which are needed before the main loop
  if (InitSystems())
  {
    //if the systems initialized properly
    //Enter the loop
    MainLoop();
  }

  //end program
  SDL_DestroyRenderer(m_renderer.GetRenderer());
  SDL_DestroyWindow(m_window.GetWindow());

  m_window.SetNull();
  m_renderer.SetNull();

  SDL_Quit();
}
开发者ID:VasilStamatov,项目名称:Renderer3D,代码行数:19,代码来源:MainProgram.cpp


示例16: OnStart

//---------------------------------------------------------------------------
CATResult CATApp::Run()
{
    CATResult result = CAT_SUCCESS;

    result = OnStart();

    // If starting failed, then bail without entering main loop.
    if (CATFAILED(result))
    {
        return result;
    }

    result = MainLoop();

    // Pass the result from the MainLoop into OnEnd.
    result = OnEnd(result);

    return result;
}
开发者ID:michaelellison,项目名称:Mike-s-Demo-App,代码行数:20,代码来源:CATApp.cpp


示例17: main

void main(int argc, char **argv)
{
  MyProgram mydata;

  mydata.bitmap = (char *)malloc(100*100);  /* a 100x100 bitmap */
  if (mydata.bitmap == NULL)
   {
     fprintf(stderr, "Fooey, no memory for bitmap.\n");
     exit(10);
   }
  mydata.bitmap_width   = 100;
  mydata.bitmap_height  = 100;

  init_display(argc, argv, &mydata);  /* setup the display */

  fill_in_bitmap(&mydata);            /* put some stuff in the bitmap */

  MainLoop();                         /* go right into the main loop */
}
开发者ID:dervish77,项目名称:adgf,代码行数:19,代码来源:main.c


示例18: main

//====================================
// Main
//====================================
int main(int argc, char* argv[]){ 
    // Change this line to use your name!
    m_yourName = "Anda Li";

    if(Init(argc, argv) == true){
#if _WIN32
		// Glut callbacks
		glutDisplayFunc(MainLoop);
		glutKeyboardFunc(KeyCallback);

		// Start Glut's main loop
		glutMainLoop();
#else 
		MainLoop();
#endif
    }

    return 0;
}
开发者ID:DiracSea3921,项目名称:Project-0,代码行数:22,代码来源:main.cpp


示例19: WinMain

INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow )
{
	FILE *f=fopen("bass.dll","rb");
	if (f)
	{
		fclose(f);
		DebugStart=false;
		int MemUsage=0;
		if ((GetSystemMetrics(SM_CXSCREEN)>=1024 && GetSystemMetrics(SM_CYSCREEN)>=768) || strstr(GetCommandLine(),"-fullscreen") && !strstr(GetCommandLine(),"-windowed"))
		{
	#ifndef Public_Release
			LastClickedToolTip="ADVANCED DIGITAL DYNAMITE INTRO CREATION TOOL V1.97";
	#else
			LastClickedToolTip="ADVANCED DIGITAL DYNAMITE INTRO CREATION TOOL V1.97 PUBLIC RELEASE";
	#endif
			SetupEnvironment();
			if (strstr(GetCommandLine(),"-fullscreen") || (GetSystemMetrics(SM_CXSCREEN)==1024 && GetSystemMetrics(SM_CYSCREEN==768)) && !strstr(GetCommandLine(),"-windowed")) fullscreen=true;
	#ifndef Public_Release
			Intro_CreateWindow("a.D.D.i.c.t. V1.97 (Build Date: " __DATE__ " " __TIME__ ")\0", 1024, 768, 32, fullscreen, LoadIcon(hInstance, MAKEINTRESOURCE(101)));
	#else
			Intro_CreateWindow("a.D.D.i.c.t. V1.97 Public Release (Build Date: " __DATE__ " " __TIME__ ")\0", 1024, 768, 32, fullscreen, LoadIcon(hInstance, MAKEINTRESOURCE(101)));
	#endif
			InitRadiosityStuff();
			
			WGLSWAPINTERVALEXT wglSwapIntervalEXT = (WGLSWAPINTERVALEXT) wglGetProcAddress("wglSwapIntervalEXT");
			if (wglSwapIntervalEXT && fullscreen) wglSwapIntervalEXT(1); // enable vertical synchronisation
		
			//InitDemoSave();
			InitGUI();
			initVertexBlend();
			MainLoop();
			//DeinitDemoSave();
			ReleaseDC(hWnd,hDC);
			if (fullscreen)	ChangeDisplaySettings(NULL,0);
			return 0;
		}
		else
		MessageBox( 0, "Sorry a.D.D.i.c.t. 2 requires at least a screen resolution of 1024x768 pixels.", "Error!", MB_OK );
	}
	else MessageBox( 0, "bass.dll not found", "Error!", MB_OK );
	return 0;
}
开发者ID:ConspiracyHu,项目名称:2012SourcePack,代码行数:42,代码来源:aDDict2.cpp


示例20: Mutex

Client::Client(int delay, int memorySize, int numMessages, bool random, int msgSize){
	totalMem = memorySize;
	sleepTime = delay;
	msgsMax = numMessages;
	Mutex* mutex = new Mutex();
	mutex->Lock();
	hFileMap = CreateFileMapping(
		INVALID_HANDLE_VALUE,
		NULL,
		PAGE_READWRITE,
		(DWORD)0,
		memorySize,
		(LPCWSTR) "shared");

	size_t* help;
	mData = (char*)MapViewOfFile(hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
	help = (size_t*)mData;
	mControl = help;
	help += 101;
	mData = (char*)help;

	if (GetLastError() == ERROR_ALREADY_EXISTS)
		ownsMemory = false;
	else{
		ownsMemory = true;
		std::fill(mControl + 1, mControl + 100, 1);
	}

	bool foundTail=false;
	clientId = 0;
	while (foundTail == false){
		mControl++;
		clientId++;
		if (*mControl == 1){
			foundTail = true;
			*mControl = 0;
			mutex->~Mutex();
		}
	}
	
	MainLoop();
}
开发者ID:FredrikLindsten,项目名称:sharedmemory,代码行数:42,代码来源:client.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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