Beispiel #1
0
bool DrasculaEngine::animate(const char *animationFile, int FPS) {
	int NFrames;
	int cnt = 2;

	Common::SeekableReadStream *stream = _archives.open(animationFile);

	if (!stream) {
		error("Animation file %s not found", animationFile);
	}

	NFrames = stream->readSint32LE();
	showFrame(stream, true);
	_system->delayMillis(1000 / FPS);
	while (cnt < NFrames) {
		showFrame(stream);
		_system->delayMillis(1000 / FPS);
		cnt++;
		byte key = getScan();
		if (key == Common::KEYCODE_ESCAPE)
			term_int = 1;
		if (key != 0)
			break;
	}
	delete stream;

	return ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE) || shouldQuit());
}
Beispiel #2
0
void DreamWebEngine::lookAtPlace() {
	commandOnlyCond(27, 224);

	if (!(_mouseButton & 1) ||
		_mouseButton == _oldButton ||
		_destPos >= 15)
		return; // noinfo

	delPointer();
	delTextLine();
	getUnderCentre();
	showFrame(_newplaceGraphics3, 60, 72, 0, 0);
	showFrame(_newplaceGraphics3, 60, 72 + 55, 4, 0);
	if (_foreignRelease)
		showFrame(_newplaceGraphics3, 60, 72+55+21, 4, 0);

	const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
	findNextColon(&string);
	uint16 y = (_foreignRelease) ? 84 + 4 : 84;
	printDirect(&string, 63, &y, 191, 191 & 1);
	workToScreenM();
	hangOnP(500);
	_pointerMode = 0;
	_pointerFrame = 0;
	putUnderCentre();
	workToScreenM();
}
Beispiel #3
0
void Menu::moveToCity(CityButton city, bool clicked) {
	uint32 time = (uint32)_cityButtonsInfo[city].time;

	// TODO Check if we have access (there seems to be more checks on some internal times) - probably : current_time (menu only) / game time / some other?
	if (_lowerTime < time || _time == time || _currentTime == time) {
		hideOverlays();
		return;
	}

	// Show city overlay
	showFrame((StartMenuOverlay)((_cityButtonsInfo[city].index >> 6) + 3), _cityButtonsInfo[city].index & 63, true);

	if (clicked) {
		showFrame(kOverlayTooltip, -1, true);
		getSound()->playSound(kEntityPlayer, "LIB046");
		goToTime(time);

		_handleTimeDelta = true;

		return;
	}

	// Special case of first and last cities
	if (city == kParis || city == kConstantinople) {
		showFrame(kOverlayTooltip, (city == kParis) ? kTooltipRewindParis : kTooltipForwardConstantinople, true);
		return;
	}

	showFrame(kOverlayTooltip, (_time <= time) ? _cityButtonsInfo[city].forward : _cityButtonsInfo[city].rewind, true);
}
Beispiel #4
0
void DreamWebEngine::obPicture() {
	if (_objectType == kSetObjectType1)
		return;
	uint8 frame = 3 * _command + 1;
	if (_objectType == kExObjectType)
		showFrame(_exFrames, 160, 68, frame, 0x80);
	else
		showFrame(_freeFrames, 160, 68, frame, 0x80);
}
Beispiel #5
0
void DreamWebEngine::obIcons() {
	uint8 slotSize, slotCount;
	getAnyAd(&slotSize, &slotCount);
	if (slotSize != 0xff) {
		// can open it
		showFrame(_icons2, 210, 1, 4, 0);
	}

	showFrame(_icons2, 260, 1, 1, 0);
}
Beispiel #6
0
//////////////////////////////////////////////////////////////////////////
// Handle events
void Menu::eventMouse(const Common::Event &ev) {
	if (!getFlags()->shouldRedraw)
		return;

	bool redraw = true;
	getFlags()->shouldRedraw = false;

	// Update coordinates
	setCoords(ev.mouse);
	//_mouseFlags = (Common::EventType)(ev.type & Common::EVENT_LBUTTONUP);

	if (_isShowingCredits) {
		if (ev.type == Common::EVENT_RBUTTONUP) {
			showFrame(kOverlayCredits, -1, true);
			_isShowingCredits = false;
		}

		if (ev.type == Common::EVENT_LBUTTONUP) {
			// Last frame of the credits
			if (_seqCredits && _creditsSequenceIndex == _seqCredits->count() - 1) {
				showFrame(kOverlayCredits, -1, true);
				_isShowingCredits = false;
			} else {
				++_creditsSequenceIndex;
				showFrame(kOverlayCredits, _creditsSequenceIndex, true);
			}
		}
	} else {
		// Check for hotspots
		SceneHotspot *hotspot = NULL;
		getScenes()->get(getState()->scene)->checkHotSpot(ev.mouse, &hotspot);

		if (_lastHotspot != hotspot || ev.type == Common::EVENT_LBUTTONUP) {
			_lastHotspot = hotspot;

			if (ev.type == Common::EVENT_MOUSEMOVE) { /* todo check event type */
				if (!_handleTimeDelta && hasTimeDelta())
					setTime();
			}

			if (hotspot) {
				redraw = handleEvent((StartMenuAction)hotspot->action, ev.type);
				getFlags()->mouseRightClick = false;
				getFlags()->mouseLeftClick = false;
			} else {
				hideOverlays();
			}
		}
	}

	if (redraw) {
		getFlags()->shouldRedraw = true;
		askForRedraw();
	}
}
Beispiel #7
0
void DreamWebEngine::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
	showFrame(_icons1, x - 2, y - 1, 10, 0);
	if (index == 0xff)
		return;

	if (flag == kExObjectType)
		showFrame(_exFrames, x + 18, y + 19, 3 * index + 1, 128);
	else
		showFrame(_freeFrames, x + 18, y + 19, 3 * index + 1, 128);

	const DynObject *object = (const DynObject *)getAnyAdDir(index, flag);
	bool worn = isItWorn(object);
	if (worn)
		showFrame(_icons1, x - 3, y - 2, 7, 0);
}
Beispiel #8
0
void DreamWebEngine::locationPic() {
	const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0 };
	byte picture = roomPics[_destPos];

	if (picture >= 6)
		showFrame(_newplaceGraphics2, 104, 138 + 14, picture - 6, 0);	// Second slot
	else
		showFrame(_newplaceGraphics,  104, 138 + 14, picture + 4, 0);

	if (_destPos == _realLocation)
		showFrame(_newplaceGraphics, 104, 140 + 14, 3, 0);	// Currently in this location

	const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
	printDirect(string, 50, 20, 241, 241 & 1);
}
Beispiel #9
0
void AnimationEdit::on_SetLeft_clicked()
{
    int x=-1;
    int y=-1;

    QList<QListWidgetItem *> selected = ui->FramesL->selectedItems();

    Matrix dialog(this);

    foreach(QListWidgetItem * item, selected)
    {
        dialog.setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint);
        dialog.setFrame(item->data(Qt::UserRole).toPoint().x(), item->data(Qt::UserRole).toPoint().y());
        if(dialog.exec()==QDialog::Accepted)
        {
            x = dialog.frameX;
            y = dialog.frameY;
            item->setData(Qt::UserRole, QPoint(x,y));
            item->setText( QString("X"+QString::number(x)+"-Y"+QString::number(y)) );
            applyFrameSet();
            showFrame(x, y);
            return;
        }
        else
            return;
    }
Beispiel #10
0
void Display::convertShow(cv::Mat RGBtemp)
{
    image = QImage((const unsigned char*)(RGBtemp.data),
                      RGBtemp.cols,RGBtemp.rows,QImage::Format_RGB888);

    emit showFrame(image); //signal to show processed image
}
void BalloonServer::init()
{
 try
  {
   svrSem = new ONSem(BALL_SEM);
  }
 catch(OVioException ex)
  {
   throw OPMException(SERVER_RUNNING, 0);
  }

 Buffer = &pipeMessage;
 if (!beginPiping(BALL_PIPE))
   throw OPMException(PIPE_FAILED, 0);

 Pages.add(&firstPage);
 Pages.add(&secondPage);
 Pages.add(&thirdPage);

 try 
  {
   createBook("Balloons Server", 270, 170, NB_STANDARD);
  }

 catch(OPMException err)
  {
   err.viewError();
   throw err;
  }

 showFrame();
}
// navigation
void TTMpeg2MainWnd::nextFrameAction()
{
  uint next_index;

  //qDebug("next frame: %d / %d",step_frame,step_order);

  switch ( step_frame )
    {
      // I-Frame
    case 1:
      next_index = video_stream->moveToNextIFrame();
      break;

      // P-Frame
    case 2:
      next_index = video_stream->moveToNextPFrame();
      break;

      // B-Frame
    case 3:
      next_index = video_stream->moveToNextFrame( 3 );
      break;

    default:
      next_index = video_stream->moveToNextFrame();
      break;
    }
  showFrame( next_index );
  slider_update = false;
  sbFrames->setValue( next_index );
}
Beispiel #13
0
/** 
 * setInput	-	set the name of the expected video file
 *
 * @param fileName	-	the name of the video file
 *
 * @return True if success. False otherwise
 */
bool VideoProcessor::setInput(const std::string &fileName)
{
    fnumber = 0;
    tempFile = fileName;

    // In case a resource was already
    // associated with the VideoCapture instance
    if (isOpened()){
        capture.release();
    }

    // Open the video file
    if(capture.open(fileName)){
        // read parameters
        length = capture.get(CV_CAP_PROP_FRAME_COUNT);
        rate = getFrameRate();
        cv::Mat input;
        // show first frame
        getNextFrame(input);
        emit showFrame(input);
        emit updateBtn();
        return true;
    } else {
        return false;
    }
}
void TTMpeg2MainWnd::prevFrameAction()
{
  uint prev_index;

  //qDebug("prev frame: %d / %d",step_frame,step_order);

  switch ( step_frame )
    {
      // I-Frame
    case 1:
      prev_index = video_stream->moveToPrevIFrame();
      break;

      // P-Frame
    case 2:
      prev_index = video_stream->moveToPrevPFrame();
      break;

      // B-Frame
    case 3:
      prev_index = video_stream->moveToPrevFrame( 3 );
      break;

    default:
      prev_index = video_stream->moveToPrevFrame();
      break;
    }
  showFrame( prev_index );
  slider_update = false;
  sbFrames->setValue( prev_index );
}
Beispiel #15
0
void Builder::showWnds(VisualHolder const& vs_holder){


	VideoLib::FrameBufferPtr const& framebuf = vs_holder.getStabilizer()->getFrameBuf();

	for(VisualFlags::const_iterator it = vs_holder.getFlags().begin(); it != vs_holder.getFlags().end(); it++){
		if(it->second != ShowFlags::NONE){
			cv::Mat img;

			if(it->second & ShowFlags::FRAME) showFrame(it->first,vs_holder.getStabilizer(),img);

			if(it->second & ShowFlags::PREV_FEATURES) showFeatures(framebuf->getDelayed(DEFAULT_DELAY)->features(),CV_RGB(255,0,0),img,1);//img.cols/320);
			if(it->second & ShowFlags::CURR_FEATURES) showFeatures(framebuf->getCurrent()->features(),CV_RGB(0,300,0),img,1);//img.cols/320);
			if(it->second & ShowFlags::OPTICAL_FLOW) showOpticalFlow(framebuf->getCurrent(),CV_RGB(0,300,0),img);
			//if(it->second & ShowFlags::PROJ_TRANSFORM) showTransform(it->first,vs_holder,img);
			//if(it->second & ShowFlags::BUFFER_MAP) showBufferMap(it->first,vs_holder,img);

			if(created_wnds.find(it->first) == created_wnds.end()){
				createWnd(it->first);
			}
			//cv::imshow(getWndName(it->first),framebuf->getCurrent()->matGray());
			cv::imshow(getWndName(it->first),img);
		}
	}
}
MenuSample::MenuSample()
  : OFrame(MENU_MAIN, FCF_STANDARD & ~FCF_MENU)
{
 createFrame("OMenu - Sample Application");
 menu = new OMenu(MENU_MENU, frame, client, NULLHANDLE);
 showFrame();
}
Beispiel #17
0
int main(int argc, char** argv)
{
    // Try opening camera
    cv::VideoCapture camera(0);
    if (!camera.isOpened()) {
        std::cout << "Error getting camera...\n";
        exit(1);
    }

    // Create cascade classifier
    cascade_classifier = new cv::CascadeClassifier(CASCADE_FILE);
    if (cascade_classifier->empty()) {
        std::cout << "Error creating cascade classifier. Make sure the file \n"
            "\t" << CASCADE_FILE << "\n"
            "is in working directory.\n";
        exit(1);
    }

    cv::namedWindow(WINDOW_NAME, cv::WINDOW_KEEPRATIO|cv::WINDOW_AUTOSIZE);

    // Find initial face on screen...
    while (! found_face)
    {
        startMeasuringTime();
        camera >> frame;
        detectFaceAllSizes(frame); // Detect using cascades over whole image
        drawRectAroundFace(frame);
        showFrame(frame);
        stopMeasuringTime();

        // Once the face is found...
        while (found_face)
        {
            startMeasuringTime();
            camera >> frame;
            detectFaceAroundRoi(frame); // Detect using cascades only in ROI
            if (template_matching_running) { // If Haar detection failed...
                detectFacesTemplateMatching(frame); // Detect using template matching
            }
            drawRectAroundFace(frame);
            showFrame(frame);
            stopMeasuringTime();
        }
    }
    delete cascade_classifier;
    return 0;
}
Beispiel #18
0
void ShowVictimDialog::nextFrame()
{
    if(actualFrame < images.size() -1)
        actualFrame++;
    else
        actualFrame = 0;
    if(images.size() > 0)
        showFrame();
}
Beispiel #19
0
void CVWidget::setImage( Mat img ) {
    QImage out = QGLWidget::convertToGLFormat( QImage( (const unsigned char*) img.data, img.cols, img.rows, img.step, QImage::Format_RGB888 ).rgbSwapped() );
    {
        lock_guard<mutex> lock( m );
        qframe = out;
    }
    // Usar Mutex para evitar tentar atualizar frame depois do programa fechado?
    emit( showFrame() );
}
Beispiel #20
0
void ShowVictimDialog::previousFrame()
{
    if(actualFrame > 0)
        actualFrame--;
    else
        actualFrame = images.size()-1;
    if(images.size() > 0)
        showFrame();
}
Beispiel #21
0
void Menu::hideOverlays() {
	_lastHotspot = NULL;

	// Hide all menu overlays
	for (MenuFrames::iterator it = _frames.begin(); it != _frames.end(); it++)
		showFrame(it->_key, -1, false);

	getScenes()->drawFrames(true);
}
void ofxGenericAnimatedImageView::timer_fired( ofPtr< ofxGenericTimer > timer )
{
    if ( timer == _frameTimer )
    {
        int newFrame = _currentFrame + _animationDirection;
        
        if ( newFrame >= (int) _frames.size() )
        {
            if ( _delegate )
            {
                _delegate.lock()->animatedImage_animationEnded( dynamic_pointer_cast< ofxGenericAnimatedImageView >( _this ) );
            }
            
            if ( _loopMode == ofxGenericAnimatedImageLoopTypeWrap )
            {
                newFrame = 0;
            }
            else if ( _loopMode == ofxGenericAnimatedImageLoopTypePingPong )
            {
                _animationDirection = -1;
                newFrame = _frames.size() - 1;
            }
            else if ( _loopMode == ofxGenericAnimatedImageLoopTypeClamp )
            {
                newFrame = _frames.size() - 1;
                clearTimer();
            }
            else if ( _loopMode == ofxGenericAnimatedImageLoopTypeOnce )
            {
                newFrame = 0;
                clearTimer();
            }
        }
        else if ( newFrame < 0 )
        {
            if ( _loopMode == ofxGenericAnimatedImageLoopTypePingPong )
            {
                _animationDirection = 1;
            }
            else if ( _loopMode == ofxGenericAnimatedImageLoopTypeClamp )
            {
                clearTimer();
            }
            
            if ( _animationDirection < 0 && _delegate )
            {
                _delegate.lock()->animatedImage_animationEnded( dynamic_pointer_cast< ofxGenericAnimatedImageView >( _this ) );
            }
            
            newFrame = 0;
        }
        
        _currentFrame = newFrame;
        showFrame( _currentFrame );
    }
}
void Procstat::init()
{
 createFrame("OS/2 Processes");
 
 cnr = new PContainer(this);
 cnr->createContainer();
 cnr->setFont("8.Helv");

 showFrame();
}
void TTMpeg2MainWnd::videoSliderChanged( int iSliderPos )
{
  uint slide_index;

  if ( slider_update )
  {
    slide_index = video_stream->moveToIndexPos( iSliderPos );
    showFrame( slide_index );
  }
  else
    slider_update = true;
}
Beispiel #25
0
void ComponentDock::entityEdit(Kite::KEntityManager *Eman, Kite::KEntity *Entity, bool isPrefab) {
	if (Entity->getHandle() == currEntity && Eman == eman) {
		return;
	}
	this->setDisabled(false);
	eman = Eman;
	actClear();

	// entity info
	currEntity = Entity->getHandle();

	// set callbacks
	Entity->setAddComCallback(addComCallb, this);
	Entity->setRemoveComCallback(remComCallb, this);
	// prefab frame
	showFrame(Entity, isPrefab);

	// components
	for (auto it = types.begin(); it != types.end(); ++it) {
		if (it->first == Kite::CTypes::Logic) {
			// load logic components at the end
			continue;
		} else {
			// is visible
			if (it->second) {
				auto has = Entity->hasComponent(it->first);
				if (has) {
					auto comp = Entity->getComponent(it->first);
					fetchFromPool(comp);
				}
			}
		}
	}

	std::vector<Kite::KHandle> compList;
	Entity->getScriptComponents(compList);
	for (auto it = compList.begin(); it != compList.end(); ++it) {
		auto comp = Entity->getComponentByHandle((*it));
		fetchFromPool(comp);
	}

	actionsControl(AS_ON_LOAD);
	QString name(Entity->getName().c_str());
	//hlabel->setText("Components Editor (" + name + ")");
	// lua table
	llabel->setText(QString("Lua Table: <font color = \"orange\">") + Entity->getLuaTName().c_str() + "</font>");
	chkStatic->setChecked(Entity->getStatic());
	spnLayer->setValue(Entity->getLayer());
	spnZOrder->setValue(Entity->getZOrder());

	actSearch(ledit->text());
}
Beispiel #26
0
//draws the bomb animation frames from the bomb sprites array based on the bombs state (alive, ignition, dead, blast)
sf::Sprite Bomb::bombFrame(){

    //if last frame of animation set bomb ignite to true
    if(frame == 14){

        setIgnite(true);
        loopMode( 6, 10);
    }

    //once at final blast frame set used to true so bomb can be marked for removal from the bomb list by another function
    //once an isBlast is false && ignition and used is true then the function to create a set amount of blastlets is called in the player function
    //these will be handled differently, this is also the case for a blastlet
    if(frame == 9){

        setUsed(true);
    }

    if(frame == 4){

        setUsed(true);
    }

    //if the last frame in bomb fuse animation is not rolling then play the bomb fuse anim
    if(!getIgnite()){

        //animates the first 5 frames of bomb to iterate over 1 fifth of each set amount
        //of time it takes before bomb detonation, last frame is miscounted because I think its ugly
        if(getTicks(getBombTicks()/4)){

        //the array Frames has a bomb image stored at index 10 to 15 this will get the next frame
        return getNext();

        //else return the normal static frame, this function cannot fail to return a
        //sprite to the function that called it else the program will crash
        }else{

            //returns present frame and not next frame
            return showFrame();
        }


    //now that the bomb frame anim is over the bomb has detonated, play the blast animation, set the bomb type to deadly and
    //call used after the animation is over, ignition set to true is the trigger for the create blast event in player, this too will
    // be on the bomb array however, so all players can either be killed or collide with bombs when all bomb collisions are checked against every
    //future player
    }else{

        return getNext();
    }
}
Beispiel #27
0
void Preview::start(Buffer *buf, int numbe)
{

    buffer = buf;
    number = numbe;

    QResizeEvent* resize;
    resizeEvent(resize);

    setWindowTitle(QString("Buffer %1").arg(numbe));

    input = buffer->Open(number);

    connect(buffer->clock,SIGNAL(timeout()),this,SLOT(showFrame()));

}
Beispiel #28
0
/** 
 * jumpTo	-	Jump to a position
 *
 * @param index	-	frame index
 *
 * @return True if success. False otherwise
 */
bool VideoProcessor::jumpTo(long index)
{
    if (index >= length){
        return 1;
    }

    cv::Mat frame;
    bool re = capture.set(CV_CAP_PROP_POS_FRAMES, index);

    if (re && !isStop()){
        capture.read(frame);
        emit showFrame(frame);
    }

    return re;
}
/**
 * @brief SingleFrameVideoViewer::SingleFrameVideoViewer Constructs a SingleFrameVideoViewer.
 */
SingleFrameVideoViewer::SingleFrameVideoViewer() : ViewerPageWidget(), mIsPlaying(false),
    mSFVideo("", QList<QPair<int, Annotation*>>()), mFrameIndex(-1), mIsLooping(false)
{
    Q_INIT_RESOURCE(application);
    connect(ui->mPlayOrPauseButton, SIGNAL(clicked()), this, SLOT(playOrPause()));
    connect(ui->mStopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(ui->mLoopButton, SIGNAL(clicked()), this, SLOT(loop()));

    connect(&mTimer, SIGNAL(timeout()), this, SLOT(showFrame()));
    mVideoTime.setInterval(1000);
    connect(&mVideoTime, SIGNAL(timeout()), this, SLOT(showTime()));

    ui->mSlider->setSingleStep(1);
    connect(ui->mSlider, SIGNAL(sliderPressed()), this, SLOT(pause()));
    connect(ui->mSlider, SIGNAL(sliderMoved(int)), this, SLOT(slide(int)));
    connect(ui->mSlider, SIGNAL(sliderReleased()), this, SLOT(play()));
}
void ofxGenericAnimatedImageView::setImageFrames( const std::vector< ofPtr< ofxGenericImage > >& frames, bool reverse )
{
    clearFrames();
    
    _singleFrame = false;
    _frames = frames;
    if ( reverse )
    {
        _currentFrame = frames.size() - 1;
        _animationDirection = -1;
    }
    else
    {
        _currentFrame = 0;
        _animationDirection = 1;
    }
    
    showFrame( _currentFrame );
}