Ejemplo n.º 1
0
ARGS()
{
	//int pdata;
	HDC hDC;
	HGLRC gc;
	THIS_CLASS();

	//printf( "DOING USE\n" );
	gc = (HGLRC)GET_INT_FIELD("renderContext");
	//pdata = (int) GET_INT_FIELD("pData");
	if( gc == 0 )
	{
		printf( "gc = 0\n" );
		return 0;
	}

	hDC = (HDC)GET_INT_FIELD("display");
	//printf( "USE - hDC: %d\n", hDC);

	if( !hDC )
	{
		printf( "use - hdc 0" );
		return 0;
	}

	if( wglGetCurrentContext() == NULL )
	{
		printf( "ERROR WITH CONTEXT" );

		wglMakeCurrent( NULL, NULL );
		wglDeleteContext( (HGLRC)GET_INT_FIELD("renderContext") );

		SetDCPixelFormat(hDC);          
		// Create palette if needed
		GetOpenGLPalette(hDC);
		gc = wglCreateContext( hDC );
		wglMakeCurrent( hDC, gc );
		SET_INT_FIELD("renderContext", (long)gc );

		return 0;
	}
	
	if( !gc )
		return 0;
	
	if( !wglMakeCurrent( hDC, gc ) ) 
	{
		wglMakeCurrent( NULL, NULL );
		printf( "Error in wglMakeCurrent: %d", GetLastError() );
		return 0;

	}
	return 1;
}
Ejemplo n.º 2
0
ARGS()
{
	int window;
	HDC hDC;
	HGLRC gc;
	THIS_CLASS();

	//if (GET_INT_FIELD("renderContext"))
	//	return 1;

	//pdata = (int)GET_INT_FIELD("pData");
	window = GET_INT_FIELD("window");
	//printf("Got window id: %d\n", window);
	hDC = GetDC((HWND)window);
	if( (gc = get_GC( window, hDC )) == 0 )	
	{
		printf( "getGC error" );
		return FALSE;
	}
	//printf( "got gc: %ld\n", gc );

	SET_INT_FIELD("display", (long)hDC );

	//printf( "setint field display: %ld\n", hDC );

	SET_INT_FIELD("renderContext", (long)gc );

	//printf( "setint field renderContext: %ld\n", gc );

//	setpData( pdata, env, this );

	return 1;
}
Ejemplo n.º 3
0
void Searches::simple () {
    std::string fromLang = "und";
    std::string toLang = "und";
    std::string query = "";

    unsigned int page = 0;//atoi(sizeStr.c_str());
    if (request().request_method() == "GET") {
        cppcms::http::request::form_type getData = request().get();
        cppcms::http::request::form_type::const_iterator it;
        
        GET_FIELD(fromLang, "from");
        GET_FIELD(toLang, "to");
        GET_FIELD(query, "query");

        GET_INT_FIELD(page, "page");
    }

    

	contents::SearchesShowResult c;
	contents::helpers::Sentences shc;

    init_content(c);

    c.queryStr = query;
    c.queryLang = fromLang;
    c.paginationSize = 10; //TODO MAGIC NUMBER
    shc.currentUserHelper = c.usersHelper;

    std::cout << "[DEBUG]" <<  query <<
        " in " << fromLang <<
        " to " << toLang << std::endl; 

    shc.sentences = searchesModel->advance(
        query,
        fromLang,
        toLang,
        page
    );
    
    c.shc = shc;

    render ("searches_simple_api", c);
}
Ejemplo n.º 4
0
ARGS()
{
	HDC hDC;
	THIS_CLASS();

//	printf( "DOING SWAP\n" );
	hDC = (HDC)GET_INT_FIELD("display");

	if( GET_BOOL_FIELD("doubleBuffer") )
	{
		if( SwapBuffers( hDC ) == FALSE )
			printf( "Error in swap buffer! hDC: %ld\n", hDC );
	} 
	else 
	{
		/* don't double buffer */
		printf( "No doublebuffer!\n" );
	}
	
}