Example #1
0
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
    resize(800,800);

    QString filename = qApp->arguments().value(1,"");
    qDebug() << "arglength: " << qApp->arguments().length();
    if (filename == "artificial" || qApp->arguments().length() == 1) {
        qDebug() << "creating new artificial data";
        cons = new ArtificialConnections();

    } else if (arg("nodes")!=""){
        qDebug() << arg("nodes");
        cons = new Connections(arg("nodes"), arg("cons"));
    } else {
        qDebug() << filename;
        cons = new Connections(filename);
    }

    view = new GLfloat[16];
    stuffAlpha = 0.99;
    QVector3D size = cons->max-cons->min;
    float largest = qMax(size.x(),size.y());
    scale = (1/largest)*0.95;
    bg = 1;
    p1 = true;
    p2 = true;

    if (qApp->arguments().indexOf(QRegExp("-writefib"))!=-1) cons->writeBinaryVTK(filename+".fib");

    if (qApp->arguments().indexOf(QRegExp("-screenshot"))!=-1) screenshot(filename+".png");
    if (qApp->arguments().indexOf(QRegExp("-csv"))!=-1) cons->writeCSVs();
    setFocus();

}
Example #2
0
void MWState::StateManager::writeScreenshot(std::vector<char> &imageData) const
{
    int screenshotW = 259*2, screenshotH = 133*2; // *2 to get some nice antialiasing

    osg::ref_ptr<osg::Image> screenshot (new osg::Image);

    MWBase::Environment::get().getWorld()->screenshot(screenshot.get(), screenshotW, screenshotH);

    osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg");
    if (!readerwriter)
    {
        std::cerr << "Unable to write screenshot, can't find a jpg ReaderWriter" << std::endl;
        return;
    }

    std::ostringstream ostream;
    osgDB::ReaderWriter::WriteResult result = readerwriter->writeImage(*screenshot, ostream);
    if (!result.success())
    {
        std::cerr << "Unable to write screenshot: " << result.message() << " code " << result.status() << std::endl;
        return;
    }

    std::string data = ostream.str();
    imageData = std::vector<char>(data.begin(), data.end());

}
Example #3
0
/**
 * Handles screen key shortcuts.
 * @param action Pointer to an action.
 */
void Screen::handle(Action *action)
{
	if (Options::getBool("debug"))
	{
		if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == SDLK_F8)
		{
			switch(Timer::gameSlowSpeed)
			{
				case 1: Timer::gameSlowSpeed = 5; break;
				case 5: Timer::gameSlowSpeed = 15; break;
				default: Timer::gameSlowSpeed = 1; break;
			}				
		}
	}
	
	if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == SDLK_RETURN && (SDL_GetModState() & KMOD_ALT) != 0)
	{
		setFullscreen(!_fullscreen);
	}
	else if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == Options::getInt("keyScreenshot"))
	{
		std::stringstream ss;
		int i = 0;
		do
		{
			ss.str("");
			ss << Options::getUserFolder() << "screen" << std::setfill('0') << std::setw(3) << i << ".png";
			i++;
		}
		while (CrossPlatform::fileExists(ss.str()));
		screenshot(ss.str());
		return;
	}
}
Example #4
0
END_KEYBOARD_CB

START_KEYBOARD_CB( screenshot_cb )
{
    if ( release ) return;
    screenshot();
}
Example #5
0
void ExampleApplication::keyPressed(KeyCode keyCode, KeyModifier modifier)
{
	switch (keyCode)
	{
		case KeyCode::ESCAPE:
			close();
			break;

		case KeyCode::V:
			window->setSwapInterval(!window->getSwapInterval());
			break;
		
		case KeyCode::P:
			screenshot();
			break;

		case KeyCode::F11:
			window->setFullscreen(!window->isFullscreen());
			break;

		case KeyCode::RETURN:
			if ((modifier & KeyModifier::ALT) != KeyModifier::NONE)
			{
				window->setFullscreen(!window->isFullscreen());
			}
			break;

		case KeyCode::K:
			window->setSize(320, 240);
			break;

		default:
			break;
	}
}
Example #6
0
/* call from both exec and invoke */
static int screenshot_data_create(bContext *C, wmOperator *op)
{
	unsigned int *dumprect;
	int dumpsx, dumpsy;

	/* do redraw so we don't show popups/menus */
	WM_redraw_windows(C);
	
	dumprect = screenshot(C, &dumpsx, &dumpsy);

	if (dumprect) {
		ScreenshotData *scd = MEM_callocN(sizeof(ScreenshotData), "screenshot");
		ScrArea *sa = CTX_wm_area(C);
		
		scd->dumpsx = dumpsx;
		scd->dumpsy = dumpsy;
		scd->dumprect = dumprect;
		if (sa) {
			scd->crop = sa->totrct;
		}

		BKE_imformat_defaults(&scd->im_format);

		op->customdata = scd;

		return true;
	}
	else {
		op->customdata = NULL;
		return false;
	}
}
Example #7
0
/* based on screendump.c::screenshot_exec */
void BL_MakeScreenShot(bScreen *screen, ScrArea *curarea, const char *filename)
{
	unsigned int *dumprect;
	int dumpsx, dumpsy;
	
	dumprect = screenshot(curarea, &dumpsx, &dumpsy);

	if (dumprect) {
		/* initialize image file format data */
		Scene *scene = (screen)? screen->scene: NULL;
		ImageFormatData im_format;

		if (scene)
			im_format = scene->r.im_format;
		else
			BKE_imformat_defaults(&im_format);

		/* create file path */
		char path[FILE_MAX];
		BLI_strncpy(path, filename, sizeof(path));
		BLI_path_abs(path, G.main->name);
		BKE_add_image_extension_from_type(path, im_format.imtype);

		/* create and save imbuf */
		ImBuf *ibuf = IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
		ibuf->rect = dumprect;

		BKE_imbuf_write_as(ibuf, path, &im_format, false);

		ibuf->rect = NULL;
		IMB_freeImBuf(ibuf);
		MEM_freeN(dumprect);
	}
}
Example #8
0
/* based on screendump.c::screenshot_exec */
void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
{
	char path[MAX_FILE_LENGTH];
	strcpy(path,filename);

	unsigned int *dumprect;
	int dumpsx, dumpsy;
	
	dumprect= screenshot(curarea, &dumpsx, &dumpsy);
	if(dumprect) {
		ImBuf *ibuf;
		BLI_path_abs(path, G.main->name);
		/* BKE_add_image_extension() checks for if extension was already set */
		BKE_add_image_extension(path, R_IMF_IMTYPE_PNG); /* scene->r.im_format.imtype */
		ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
		ibuf->rect= dumprect;
		ibuf->ftype= PNG;

		IMB_saveiff(ibuf, path, IB_rect);

		ibuf->rect= NULL;
		IMB_freeImBuf(ibuf);
		MEM_freeN(dumprect);
	}
}
Example #9
0
/*
* Take the screenshots neccessary to later compile a gif.
*/
bool make_gif(std::string window_name, std::string gif_name, float duration_in_seconds, int fps, bool save_pngs,
              int childPID, float &elapsed, float& next_checkpoint, float seconds_to_run, 
              int& rss_memory, int allowed_rss_memory, int& memory_kill, int& time_kill,
              std::ostream &logfile){

  //iterations is seconds*fps. 
  int iterations = duration_in_seconds * fps;
  //delay is 1 second/fps
  float delay    = (1000000.0f/fps);
 
  std::vector<std::string> png_names;

  bool killed = false;
  for(int i = 0; i < iterations; i++){ 
    


    std::string iterative_gif_name = gif_name + "_" + pad_integer(i, 4) + ".png";
    std::cout << "taking gif screenshot " << iterative_gif_name << std::endl;
    bool successful_screenshot = screenshot(window_name, iterative_gif_name);

    if(!successful_screenshot){
      return false;
    }

    png_names.push_back(iterative_gif_name);

    //add a 1/10th second delay between each image capture.
    if(i != iterations-1){ 
      killed = delay_and_mem_check(delay, childPID, elapsed, next_checkpoint, 
        seconds_to_run, rss_memory, allowed_rss_memory, memory_kill,time_kill, logfile);
    }
    if(killed){
      return false;
    }
  }

  //let's just test the cost of this
  std::string target_gif_name = gif_name + "*.png";
  std::string outfile_name = gif_name + ".gif";

  //create a gif
  int refresh_rate_in_hundredths = (1.0f / fps) * 100.0f;
  std::string command = "convert -delay "+std::to_string(refresh_rate_in_hundredths)+" -loop 0 " + target_gif_name + " " + outfile_name;
  std::string output = output_of_system_command(command.c_str()); //get the string

  //If we are supposed to remove the png files, do so.
  // Do not use wildcards, only remove files we explicitly created.
  if(!save_pngs){
    for(int i = 0; i < png_names.size(); i++){
      std::string remove_png_name = png_names[i];
      std::string rm_command = "rm " + remove_png_name + " NULL: 2>&1";
      std::cout << rm_command << std::endl;
      std::string output = output_of_system_command(rm_command.c_str()); //get the string
    }
  }

  return true;
}
Example #10
0
void saveCapture(){
    ofPixels pixels;
    buffer.readToPixels(pixels);
    ofImage screenshot(pixels);
    //screenshot.grabScreen(0,0,ofGetWidth(),ofGetHeight());
    // TODO: either put the saveImage action into a separated thread, change the file format for something faster or find some sort of "save a little on each frame method".
    screenshot.saveImage("screenshot-"+ofToString(screenshotCount++)+".png");
}
Example #11
0
int main (int argc, char **argv)
{

  gtk_init (&argc, &argv);

  screenshot (argc == 2 ? argv[1] : NULL);

  return 0;
}
Example #12
0
File: main.c Project: likon/m2tklib
/* 
  event source for SDL
  this has been copied from m2ghsdl.c
  u8glib only replaces the graphics part, but not the event handling for sdl
  it is assumed, that SDL has been setup
*/
uint8_t m2_es_sdl(m2_p ep, uint8_t msg)
{
  switch(msg)
  {
    case M2_ES_MSG_GET_KEY:
    {
    	SDL_Event event;
	    /* http://www.libsdl.org/cgi/docwiki.cgi/SDL_PollEvent */
	    if ( SDL_PollEvent(&event) != 0 )
	    {
	      switch (event.type) 
	      {
	        case SDL_QUIT:
		        exit(0);
		        break;
	        case SDL_KEYDOWN:
		        switch( event.key.keysym.sym )
		        {
		          case SDLK_s:
		            return M2_KEY_EVENT(M2_KEY_SELECT);
		          case SDLK_x:
		            puts("SDLK_x");
		            return M2_KEY_EVENT(M2_KEY_EXIT);
		          case SDLK_n:
		            puts("SDLK_n");
		            return M2_KEY_EVENT(M2_KEY_NEXT);
		          case SDLK_p:
		            puts("SDLK_p");
		            return M2_KEY_EVENT(M2_KEY_PREV);
		          case SDLK_u:
		            puts("SDLK_u");
		            return M2_KEY_EVENT(M2_KEY_DATA_UP);
		          case SDLK_d:
		            puts("SDLK_d");
		            return M2_KEY_EVENT(M2_KEY_DATA_DOWN);
		          case SDLK_o:                  // screenshot
		            puts("SDLK_o (screenshOt)");
                            screenshot();
                            //screenshot100();
                            break;
		          case SDLK_q:
		            exit(0);
		            break;
		          default:
		            break;
		        }
		        break;
	        }
      	}
      }
      return M2_KEY_NONE;
    case M2_ES_MSG_INIT:
      break;
  }
  return 0;
}
Example #13
0
void VideoRecordDialog::maybeRecord(RenderDevice* rd) {
    if (m_video) {
        recordFrame(rd);
    }

    if (m_screenshotPending) {
        screenshot(rd);
        m_screenshotPending = false;
    }
}
Example #14
0
GreeterWindow::GreeterWindow(QWidget *parent)
    : QDeclarativeView(parent),
      m_greeter(new GreeterWrapper(this))
{
    setResizeMode(QDeclarativeView::SizeRootObjectToView);
    
    KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(engine());
    kdeclarative.initialize();
    //binds things like kconfig and icons
    kdeclarative.setupBindings();

    KConfig config(LIGHTDM_CONFIG_DIR "/lightdm-kde-greeter.conf");
    KConfigGroup configGroup = config.group("greeter");

    QString theme = configGroup.readEntry("theme-name", "userbar");

    QStringList dirs = KGlobal::dirs()->findDirs("appdata", "themes/");

    Plasma::PackageStructure::Ptr packageStructure(new LightDMPackageStructure(this));

    Plasma::Package package(dirs.last() + "/" + theme, packageStructure);

    if (!package.isValid()) {
        kError() << theme << " is not a valid theme. Falling back to \"userbar\" theme.";
        package = Plasma::Package(dirs.last() + "/" + "userbar", packageStructure);
    }
    if (!package.isValid()) {
        kFatal() << "Cannot find QML file for \"userbar\" theme. Something is wrong with this installation. Aborting.";
    }

    KGlobal::locale()->insertCatalog("lightdm_theme_" + theme);
    
    rootContext()->setContextProperty("config", new ConfigWrapper(package.filePath("configfile"), this));
    rootContext()->setContextProperty("greeter", m_greeter);

    setSource(package.filePath("mainscript"));
    // Prevent screen flickering when the greeter starts up. This really needs to be sorted out in QML/Qt...
    setAttribute(Qt::WA_OpaquePaintEvent);
    setAttribute(Qt::WA_NoSystemBackground);

    // Shortcut to take a screenshot of the screen. Handy because it is not
    // possible to take a screenshot of the greeter in test mode without
    // including the cursor.
    QShortcut* cut = new QShortcut(this);
    cut->setKey(Qt::CTRL + Qt::ALT + Qt::Key_S);
    connect(cut, SIGNAL(activated()), SLOT(screenshot()));

    connect(m_greeter, SIGNAL(aboutToLogin()), SLOT(setRootImage()));

    QRect screen = QApplication::desktop()->rect();
    setGeometry(screen);

    new PowerManagement(this);
}
Example #15
0
void Win3D::render() {
  if (mCapture) {
    capturing();
    glutSwapBuffers();
    screenshot();
    return;
  }

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(mPersp,
                 static_cast<double>(mWinWidth)/static_cast<double>(mWinHeight),
                 0.1, 10.0);
  gluLookAt(mEye[0], mEye[1], mEye[2], 0.0, 0.0, -1.0, mUp[0], mUp[1], mUp[2]);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  initGL();

  mTrackBall.applyGLRotation();

  glEnable(GL_DEPTH_TEST);
  glDisable(GL_TEXTURE_2D);
  glDisable(GL_LIGHTING);
  glLineWidth(2.0);
  if (mRotate || mTranslate || mZooming) {
    glColor3f(1.0f, 0.0f, 0.0f);
    glBegin(GL_LINES);
    glVertex3f(-0.1f, 0.0f, -0.0f);
    glVertex3f(0.15f, 0.0f, -0.0f);
    glEnd();

    glColor3f(0.0f, 1.0f, 0.0f);
    glBegin(GL_LINES);
    glVertex3f(0.0f, -0.1f, 0.0f);
    glVertex3f(0.0f, 0.15f, 0.0f);
    glEnd();

    glColor3f(0.0f, 0.0f, 1.0f);
    glBegin(GL_LINES);
    glVertex3f(0.0f, 0.0f, -0.1f);
    glVertex3f(0.0f, 0.0f, 0.15f);
    glEnd();
  }
  glScalef(mZoom, mZoom, mZoom);
  glTranslatef(mTrans[0]*0.001, mTrans[1]*0.001, mTrans[2]*0.001);

  initLights();
  draw();

  if (mRotate)
    mTrackBall.draw(mWinWidth, mWinHeight);

  glutSwapBuffers();
}
int luatpt_screenshot(lua_State* l)
{
	int captureUI = luaL_optint(l, 1, 0);
	int fileType = luaL_optint(l, 2, 0);
	std::vector<char> data;
	if(captureUI)
	{
		VideoBuffer screenshot(ui::Engine::Ref().g->DumpFrame());
		if(fileType == 1) {
			data = format::VideoBufferToBMP(screenshot);
		} else if(fileType == 2) {
			data = format::VideoBufferToPPM(screenshot);
		} else {
			data = format::VideoBufferToPNG(screenshot);
		}
	}
	else
	{
		VideoBuffer screenshot(luacon_ren->DumpFrame());
		if(fileType == 1) {
			data = format::VideoBufferToBMP(screenshot);
		} else if(fileType == 2) {
			data = format::VideoBufferToPPM(screenshot);
		} else {
			data = format::VideoBufferToPNG(screenshot);
		}
	}
	ByteString filename = ByteString::Build("screenshot_", Format::Width(screenshotIndex++, 6));
	if(fileType == 1) {
		filename += ".bmp";
	} else if(fileType == 2) {
		filename += ".ppm";
	} else {
		filename += ".png";
	}
	Client::Ref().WriteFile(data, filename);
	lua_pushstring(l, filename.c_str());
	return 1;
}
Example #17
0
/// keyboard event handler
void keyboard(unsigned char c, int x, int y) {
	switch(c) {
        case 27: exit(0); break;
        case 'h': print_help(); break;
        case '1': draw_opts.faces = not draw_opts.faces; break;
        case '2': draw_opts.edges = not draw_opts.edges; break;
        case '3': draw_opts.lines = not draw_opts.lines; break;
        case '4': draw_opts.control = not draw_opts.control; break;
        case '$': draw_opts.control_no_depth = not draw_opts.control_no_depth; break;
        case '5': draw_opts.gizmos = not draw_opts.gizmos; break;
        case '7': draw_opts.cameralights = not draw_opts.cameralights; break;
        case '8': tesselation_level = max(-1,tesselation_level-1); init(); break;
        case '9': tesselation_level = min(88,tesselation_level+1); init(); break;
        case '0': tesselation_smooth = !tesselation_smooth; init(); break;
        case '`': draw_opts.doublesided = not draw_opts.doublesided; break;
        case ' ': if(animating) animate_stop(); else animate_start(); break;
        case '/': init(); break;
        case '?': animate_loop = !animate_loop; break;
        case ',': animate_step(false); break;
        case '.': animate_step(true); break;
        case 'j': hud = not hud; break;
        case 'f': frame(); break;
        case 'r': reload(); break;
        case 'i': screenshot(filename_image.c_str()); break;
#ifdef AUTORELOAD
        case 'R': reload_auto = not reload_auto; break;
#endif
        case '[': selection_element_next(false); break;
        case ']': selection_element_next(true); break;
        case '\\': selection_element_clear(); break;
        case '{': selection_subelement_next(false); break;
        case '}': selection_subelement_next(true); break;
        case '|': selection_subelement_clear(); break;
        case 'a': selection_move( - x3f * selecion_speed_keyboard_translate ); break;
        case 'd': selection_move(   x3f * selecion_speed_keyboard_translate ); break;
        case 'w': selection_move(   z3f * selecion_speed_keyboard_translate ); break;
        case 's': selection_move( - z3f * selecion_speed_keyboard_translate ); break;
        case 'q': selection_move( - y3f * selecion_speed_keyboard_translate ); break;
        case 'e': selection_move(   y3f * selecion_speed_keyboard_translate ); break;
        case 'A': selection_rotate( - x3f * selecion_speed_keyboard_rotate ); break;
        case 'D': selection_rotate(   x3f * selecion_speed_keyboard_rotate ); break;
        case 'W': selection_rotate(   z3f * selecion_speed_keyboard_rotate ); break;
        case 'S': selection_rotate( - z3f * selecion_speed_keyboard_rotate ); break;
        case 'Q': selection_rotate( - y3f * selecion_speed_keyboard_rotate ); break;
        case 'E': selection_rotate(   y3f * selecion_speed_keyboard_rotate ); break;
		default: break;
	}
    
	glutPostRedisplay();
}
Example #18
0
void ofApp::keyReleased(int key) {
  switch (key) {
    case 'f':
      if (inputFrames->isPlaying()) {
        inputFrames->stop();
        outputFrames->stop();
      }
      else {
        inputFrames->play();
        outputFrames->play();
      }
      break;
    case 'h':
      inputFrames->prevFrame();
      outputFrames->prevFrame();
      currFrameChanged();
      break;
    case 'l':
      inputFrames->nextFrame();
      outputFrames->nextFrame();
      currFrameChanged();
      break;
    case 'p':
      screenshot();
      break;
    case '1':
      step(1);
      break;
    case '2':
      step(2);
      break;
    case '3':
      step(3);
      break;
    case '4':
      step(5);
      break;
    case '5':
      step(10);
      break;
    case '6':
      step(20);
      break;
    case 's':
      string outputName = getOutputName();
      outputFrames->saveFrames(outputName);
      break;
  }
}
Example #19
0
// Use event to update input system state before returning it.
static sodna_Event get_event(boolean consume) {
    sodna_Event e;
    // Consume means the event is expected to be used as input,
    // !consume means that it's being polled for breaking a sleep
    // and should be saved up for processing later.
    if (consume) {
        if (stored_event.type != SODNA_EVENT_NONE) {
            e = stored_event;
            memset(&stored_event, 0, sizeof(sodna_Event));
        } else {
            e = sodna_wait_event(100);
        }
    } else {
        e = sodna_poll_event();
        stored_event = e;
    }

    if (e.type == SODNA_EVENT_MOUSE_MOVED) {
        mouse_x = e.mouse.x;
        mouse_y = e.mouse.y;
    }

    if (e.type == SODNA_EVENT_KEY_DOWN) {
        // PrintScreen to save a screenshot.
        if (e.key.layout == SODNA_KEY_PRINT_SCREEN) {
            screenshot();
        }

        // Alt-enter to toggle fullscreen mode.
        if (e.key.layout == SODNA_KEY_ENTER && e.key.alt) {
            is_fullscreen_mode = !is_fullscreen_mode;
            sodna_set_fullscreen(is_fullscreen_mode);
        }

        if (e.key.layout == SODNA_KEY_PAGE_UP) { cycle_font(1); }
        if (e.key.layout == SODNA_KEY_PAGE_DOWN) { cycle_font(-1); }
    }

    if (e.type == SODNA_EVENT_KEY_UP || e.type == SODNA_EVENT_KEY_DOWN) {
        ctrl_pressed = e.key.ctrl;
        shift_pressed = e.key.shift;
        caps_lock = e.key.caps_lock;
    }

    return e;
}
Example #20
0
void GlfwApp::onKey(int key, int scancode, int action, int mods) {
  if (GLFW_PRESS != action) {
    return;
  }

  switch (key) {
  case GLFW_KEY_ESCAPE:
    glfwSetWindowShouldClose(window, 1);
    return;

#ifdef HAVE_OPENCV
    case GLFW_KEY_S:
    if (mods & GLFW_MOD_SHIFT) {
      screenshot();
    }
    return;
#endif
  }
}
Example #21
0
void MainWindow::initSignals(QObject *ctrl, QObject *dvctrl)
{
	/* slots & signals: GUI only */
	connect(docksButton, SIGNAL(clicked()),
	        this, SLOT(openContextMenu()));

	//	we decided to remove this functionality for now
	//	connect(bandDock, SIGNAL(topLevelChanged(bool)),
	//			this, SLOT(reshapeDock(bool)));

	/* buttons to alter label display dynamics */
	connect(ignoreButton, SIGNAL(toggled(bool)),
	        markButton, SLOT(setDisabled(bool)));
	connect(ignoreButton, SIGNAL(toggled(bool)),
	        nonmarkButton, SLOT(setDisabled(bool)));

	connect(ignoreButton, SIGNAL(toggled(bool)),
	        ctrl, SIGNAL(toggleIgnoreLabels(bool)));

	// label manipulation from current dist_view
	connect(addButton, SIGNAL(clicked()),
	        dvctrl, SLOT(addHighlightToLabel()));
	connect(remButton, SIGNAL(clicked()),
	        dvctrl, SLOT(remHighlightFromLabel()));

	connect(markButton, SIGNAL(toggled(bool)),
	        dvctrl, SIGNAL(toggleLabeled(bool)));
	connect(nonmarkButton, SIGNAL(toggled(bool)),
	        dvctrl, SIGNAL(toggleUnlabeled(bool)));

	//	connect(chief2, SIGNAL(normTargetChanged(bool)),
	//			this, SLOT(normTargetChanged(bool)));

	subscriptionsDebugButton->hide();

	connect(subscriptionsDebugButton, SIGNAL(clicked()),
	        ctrl, SLOT(debugSubscriptions()));

	/// global shortcuts
	QShortcut *scr = new QShortcut(Qt::CTRL + Qt::Key_S, this);
	connect(scr, SIGNAL(activated()), this, SLOT(screenshot()));
}
Example #22
0
bool screenshot(PluginManager::Manager<Trade::AbstractImageConverter>& manager, GL::AbstractFramebuffer& framebuffer, const std::string& filename) {
    /* Get the implementation-specific color read format for given framebuffer */
    const GL::PixelFormat format = framebuffer.implementationColorReadFormat();
    const GL::PixelType type = framebuffer.implementationColorReadType();
    auto genericFormat = [](GL::PixelFormat format, GL::PixelType type) -> Containers::Optional<PixelFormat> {
        #ifndef DOXYGEN_GENERATING_OUTPUT /* It gets *really* confused */
        #define _c(generic, glFormat, glType) if(format == GL::PixelFormat::glFormat && type == GL::PixelType::glType) return PixelFormat::generic;
        #define _s(generic) return {};
        #include "Magnum/GL/Implementation/pixelFormatMapping.hpp"
        #undef _c
        #undef _s
        #endif
        return {};
    }(format, type);
    if(!genericFormat) {
        Error{} << "DebugTools::screenshot(): can't map (" << Debug::nospace << format << Debug::nospace << "," << type << Debug::nospace << ") to a generic pixel format";
        return false;
    }

    return screenshot(manager, framebuffer, *genericFormat, filename);
}
Example #23
0
const wxBitmap& Pcsx2App::GetScreenshotBitmap()
{
	std::unique_ptr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
	if (screenshot) return *screenshot;

	wxFileName themeDirectory;
	bool useTheme = (g_Conf->DeskTheme != L"default");

	if (useTheme)
	{
		themeDirectory.Assign(wxFileName(PathDefs::GetThemes().ToString()).GetFullPath(), g_Conf->DeskTheme);
	}

	wxImage img;
	EmbeddedImage<res_ButtonIcon_Camera> temp;	// because gcc can't allow non-const temporaries.
	LoadImageAny(img, useTheme, themeDirectory, L"ButtonIcon_Camera", temp);
	float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
	screenshot = std::unique_ptr<wxBitmap>(new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH)));

	return *screenshot;
}
Example #24
0
/**
 * Handles screen key shortcuts.
 * @param action Pointer to an action.
 */
void Screen::handle(Action *action)
{
	if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == SDLK_RETURN && (SDL_GetModState() & KMOD_ALT) != 0)
	{
		setFullscreen(!_fullscreen);
	}
	else if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == Options::getInt("keyScreenshot"))
	{
		std::stringstream ss;
		int i = 0;
		do
		{
			ss.str("");
			ss << Options::getUserFolder() << "screen" << std::setfill('0') << std::setw(3) << i << ".png";
			i++;
		}
		while (CrossPlatform::fileExists(ss.str()));
		screenshot(ss.str());
		return;
	}
}
Example #25
0
const wxBitmap& Pcsx2App::GetScreenshotBitmap()
{
	ScopedPtr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
	if (screenshot) return *screenshot;

	wxFileName mess;
	bool useTheme = (g_Conf->DeskTheme != L"default");

	if (useTheme)
	{
		wxDirName theme(PathDefs::GetThemes() + g_Conf->DeskTheme);
		mess = theme.ToString();
	}

	wxImage img;
	EmbeddedImage<res_ButtonIcon_Camera> temp;	// because gcc can't allow non-const temporaries.
	LoadImageAny(img, useTheme, mess, L"ButtonIcon_Camera", temp);
	float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
	screenshot = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH));

	return *screenshot;
}
Example #26
0
    void Win2D::render()
    {
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho( -mWinWidth/2, mWinWidth/2-1, -mWinHeight/2, mWinHeight/2-1, -1, 1 );

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

        initGL();

        // transformation
        glTranslatef(mTransX,-mTransY,0.0);	
        draw();

        // draw axis
        // translate back to the center
        glTranslatef(-mTransX, mTransY, 0.0);
        if(mTranslate){
            glLineWidth(2.0);

            glColor3f( 1.0f, 0.0f, 0.0f );
            glBegin( GL_LINES );
            glVertex2f( -40.f, 0.0f );
            glVertex2f( 40.f, 0.0f );
            glEnd();		

            glColor3f( 0.0f, 1.0f, 0.0f );
            glBegin( GL_LINES );
            glVertex2f( 0.0f, -40.f );
            glVertex2f( 0.0f, 40.f );
            glEnd();
        }

        if(mCapture)
            screenshot();

        glutSwapBuffers();
    }
Example #27
0
bool
Racing::keyPressEvent(SDLKey key)
{
	switch(key){
		case 'q':
			gameMgr->abortRace();
	    		set_game_mode( GAME_OVER );
	    		return true;
		case SDLK_ESCAPE: 
			set_game_mode( PAUSED );
			return true;	
		case '1':
    		set_view_mode( players[0], ABOVE );
    		setparam_view_mode( ABOVE );
			return true;
		case '2':
			set_view_mode( players[0], FOLLOW );
			setparam_view_mode( FOLLOW );
			return true;
		case '3':
			set_view_mode( players[0], BEHIND );
			setparam_view_mode( BEHIND );
			return true;	
		case 's':
    		screenshot();
			return true;
		case 'p':
			set_game_mode( PAUSED );
			return true;
		default:
			if(key==getparam_reset_key()){
				set_game_mode( RESET );
				return true;
			}
	}
		
	return false;
}
Example #28
0
void Scene::timer(int id) {
	static unsigned long ticks = -1;
	ticks++;
	if (!paused) {
		Animation::nextTick(ticks);
		if (!Fish::moveAll()) {
			fishList->removeNode();
			for (int i = 0; i < sharkList->size(); i++) {
				((Shark*)sharkList->getNode(i))->nextTarget();
			}
		}

		if (!calculateFishCount) {
			glutPostRedisplay();
		}
	}

	if (tgaWriter) {
		screenshot();
	}

	// Reset timer
	glutTimerFunc(40, timer, 1);
}
Example #29
0
BitmapPtr OffscreenCanvas::screenshot() const
{
    return screenshot(false);
}
Example #30
0
void ConfigMenu::shareMenuCallback( CCObject* sender )
{
	CCLOG("share click");
	screenshot();
}