本文整理汇总了C++中MainLoop函数的典型用法代码示例。如果您正苦于以下问题:C++ MainLoop函数的具体用法?C++ MainLoop怎么用?C++ MainLoop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MainLoop函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
UNUSED_PARAMETER(argc);
UNUSED_PARAMETER(argv);
if (!Startup())
{
Shutdown();
return 1;
}
MainLoop();
Shutdown();
return 0;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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
}
示例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();
}
示例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;
}
示例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();
}