예제 #1
0
파일: uwrapc.c 프로젝트: FXIhub/hawk
int uwrapc_network_main(int argc, char ** argv){
#ifndef NETWORK_SUPPORT
  hawk_fatal("uwrapc_network_main reached without network support!");
#else
  init_qt(argc,argv);
  char * server = 0;
  int server_port = 0;
  int key = 0;
  if(argc == 1){
    /* don't try to connect to any server*/
    return uwrapc_from_file(argc,argv);
  }else if(argc == 2){
    server = argv[1];
    server_port = rpcDefaultPort;
  }else if(argc == 3){
    server = argv[1];
    server_port = atoi(argv[2]);
  }else if(argc == 3){
    server = argv[1];
    server_port = atoi(argv[2]);
  }else if(argc == 4){
    server = argv[1];
    server_port = atoi(argv[2]);
    key = atoi(argv[3]);
  }else{
    printf("Usage: uwrapc [server [port [key]]]\n");
    return 0;
  }
  attempt_connection(server,server_port,key);  
  return start_event_loop();
#endif
}
예제 #2
0
int main(int argc, char **argv)
{
	int i;
	bool no_filenames = true;

	init_qt(&argc, &argv);
	QStringList files;
	QStringList importedFiles;
	QStringList arguments = QCoreApplication::arguments();

	bool dedicated_console = arguments.length() > 1 &&
				 (arguments.at(1) == QString("--win32console"));
	subsurface_console_init(dedicated_console);

	for (i = 1; i < arguments.length(); i++) {
		QString a = arguments.at(i);
		if (a.at(0) == '-') {
			parse_argument(a.toLocal8Bit().data());
			continue;
		}
		if (imported) {
			importedFiles.push_back(a);
		} else {
			no_filenames = false;
			files.push_back(a);
		}
	}
#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR < 22
	git_threads_init();
#else
	git_libgit2_init();
#endif
	setup_system_prefs();
	prefs = default_prefs;
	fill_profile_color();
	parse_xml_init();
	taglist_init_global();
	init_ui();
	if (no_filenames) {
		QString defaultFile(prefs.default_filename);
		if (!defaultFile.isEmpty())
			files.push_back(QString(prefs.default_filename));
	}

	MainWindow *m = MainWindow::instance();
	m->setLoadedWithFiles(!files.isEmpty() || !importedFiles.isEmpty());
	m->loadFiles(files);
	m->importFiles(importedFiles);
	if (!quit)
		run_ui();
	exit_ui();
	taglist_free(g_tag_list);
	parse_xml_exit();
	subsurface_console_exit();
	free_prefs();
	return 0;
}
예제 #3
0
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
    WNDCLASS wc;
    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    wc.lpfnWndProc = (WNDPROC)window_proc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon( NULL, IDI_WINLOGO );
    wc.hCursor = LoadCursor( NULL, IDC_ARROW );
    wc.hbrBackground = NULL;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "Win32GL";
    RegisterClass( &wc );

    RECT window_rect;
    SetRect( &window_rect, 0, 0, mAppWindowWidth, mAppWindowHeight );

    DWORD ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
    DWORD style = WS_OVERLAPPEDWINDOW;
    AdjustWindowRectEx( &window_rect, style, FALSE, ex_style );

    HWND hWnd = CreateWindowEx( ex_style, "Win32GL", "Win32GL LLQtWebKit test", style | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                            80, 0, window_rect.right - window_rect.left, window_rect.bottom - window_rect.top,
                                NULL, NULL, hInstance, NULL );

    static  PIXELFORMATDESCRIPTOR pfd =
    {
        sizeof( PIXELFORMATDESCRIPTOR ),
        1,
        PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA,
        32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0
    };

    HDC hDC = GetDC( hWnd );

    GLuint pixel_format = ChoosePixelFormat( hDC, &pfd );
    SetPixelFormat( hDC, pixel_format, &pfd );
    HGLRC hRC = wglCreateContext( hDC );
    wglMakeCurrent( hDC, hRC );

    ShowWindow( hWnd,SW_SHOW );
    SetForegroundWindow( hWnd );
    SetFocus( hWnd );

    resize_gl_screen( mAppWindowWidth, mAppWindowHeight );

    GLuint texture_handle = 0;
    glGenTextures( 1, &texture_handle );

    glBindTexture( GL_TEXTURE_2D, texture_handle );
    glTexImage2D( GL_TEXTURE_2D, 0, 3, gTextureWidth, gTextureHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, 0 );
    glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR );
    init_qt( hWnd );

    bool done = false;
    while( ! done )
    {
        MSG msg;
        if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
        {
            if ( WM_QUIT == msg.message )
            {
                done = true;
            }
            else
            {
                TranslateMessage( &msg );
                DispatchMessage( &msg );
            };
        }
        else
        {
            draw_gl_scene( texture_handle );
            SwapBuffers( hDC );
        };
    };

    wglMakeCurrent( NULL,NULL );
    wglDeleteContext( hRC );
    ReleaseDC( hWnd,hDC );
    DestroyWindow( hWnd );
    UnregisterClass( "Win32GL", hInstance );

    reset_qt();

    return 0;
}