コード例 #1
0
bool ScreenshotService::executeService(TasCommandModel& model, TasResponse& response)
{
    if(model.service() == serviceName() ){
        TasLogger::logger()->debug("ScreenshotService::executeService in");
        QGuiApplication *app = qobject_cast<QGuiApplication*>(qApp);
        if(app){
            getScreenshot(model, response);
        }
        else{
            TasLogger::logger()->debug("ScreenshotService::executeService application has no ui!");
            response.setErrorMessage(NO_UI_ERROR);
        }
        return true;
    }
    else{
        return false;
    }
}
コード例 #2
0
int main(int argc, char* argv[]) {
    getScreenshot(std::string(SCRSHOT_NAME));
    std::this_thread::sleep_for(std::chrono::microseconds(10000)); //give the screenshot script time to run
    int h=0;
    if (SDL_Init(SDL_INIT_VIDEO) < 0 ) {
        printf("Unable to initialize SDL");
        return 1;
    }
    if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL))) {
        SDL_Quit();
        return 1;
    }
#if startFullscreen
    toggleFullscreen();
#endif
    //set up SDL's OpenGL defaults
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,            8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,          8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,           8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,          8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,          16);
    SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,         32);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,      8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,    8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,     8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,    8);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,  1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,  2);
    setScreenSize(getImageSize(SCRSHOT_NAME));
    WIDTH = getScreenSize().w;    HEIGHT = getScreenSize().h;
    printf("Screen size detected as: (%d,%d)\n",getScreenSize().w,getScreenSize().h);
    loadGame();
    running = true;
    startFPSCounter();
    startInputListener();
    startAutomaticFiring();
    while(running) {
        drawScreen(screen,h++);
    }
    SDL_Quit();
    return 0;
}
コード例 #3
0
void ServerVideoManager::refreshBlocks()
{
	// Send the changed rectangle to the sockets
	if(!first)
	{
		
		RECT shared_scaled=scaleRect(shared,scale_fact);

		for(int i=0;	i<NUM_BLOCKS;	i++)
		{				
			if(	rv[i].top	!=-1	&&
				rv[i].left	!=-1	&&
				rv[i].bottom!=-1	&&
				rv[i].right	!=-1 )
			{
				sendRect(rv[i],shared_scaled.left,shared_scaled.top);
			}
		}

	}else{
		first=false;
	}
	
	
	if(old_bmp != NULL)
		delete[] old_bmp;
	old_bmp = new_bmp;

	// New requests to Anlyzer threads
	completed = 0;
	current_block = 0;
	new_bmp = getScreenshot();
	int thr=0;
	for(int i=0;	i<NUM_BLOCKS;	i++)
	{
		newRequest(thr++);
		if(thr>=THREAD_NUM)
			thr=0;
	}	
}
コード例 #4
0
ServerVideoManager::ServerVideoManager(HWND hWnd) :
	Runnable(hWnd),
	first(true),
	enabled(false),
	completed(0),
	current_block(0),
	bytes_per_pixel(4),
	old_bmp(NULL),
	scale_fact(1)	//change the video scale (not 100% working)
{
	for(int i=0;	i<THREAD_NUM;	i++)
	{
		sv[i]=0;
		t[i]=0;
	}

	HWND desktop = GetDesktopWindow();
	GetWindowRect(desktop,&screen);
	shared=screen;
	new_bmp = getScreenshot();
	hCursor=LoadCursor(NULL,IDC_ARROW);
}