Ejemplo n.º 1
0
int main(int argc, char** argv) {
    printf("%s major:", argv[1]);
    scaler(argv[1], 0);

    printf("\n%s minor:", argv[1]);
    scaler(argv[1], 1);

    printf("\n");
    return 0;
}
Ejemplo n.º 2
0
/*private*/
void
ScaledNoder::scale(SegmentString::NonConstVect& segStrings) const
{
	Scaler scaler(*this);
	for (SegmentString::NonConstVect::const_iterator
		i0=segStrings.begin(), i0End=segStrings.end();
			i0!=i0End; ++i0)
	{
		SegmentString* ss=*i0;

		CoordinateSequence* cs=ss->getCoordinates();

#ifndef NDEBUG
		size_t npts = cs->size();
#endif
		cs->apply_rw(&scaler);
		assert(cs->size() == npts);

		// Actually, we should be creating *new*
		// SegmentStrings here, but who's going
		// to delete them then ? And is it worth
		// the memory cost ?
		cs->removeRepeatedPoints();

	}
}
Ejemplo n.º 3
0
void PdfView::setupPage(int newPage) {
  qDebug() << "setupPage" << newPage;
  if (_imagedPage == newPage && !_pageImage.isNull()) return;

  if (_imagedPage == (newPage - 1) && !_nextImage.isNull()) {
    qDebug() << "Flipping to _nextImage.";
    _pageImage = _nextImage;
    _nextImage = QPixmap();
  } else {
    qDebug() << "Re-rendering: _imagedPage =" << _imagedPage;
    _pageImage = QPixmap();
    _nextImage = QPixmap();
  }

  if (_pageImage.isNull()) {
    qDebug() << "Rendering current page image.";
    Poppler::Page *page = doc->page(newPage);
    QImage image = scaler()->scaleAndRender(page, this);

    _pageImage = QPixmap::fromImage(image);
    _imagedPage = newPage;
  }

  if (_nextImage.isNull() && (newPage + 1) < pageCount()) {
    if (!_renderScheduled) {
      _renderScheduled = true;
      QTimer::singleShot(0, this, SLOT(scheduleRender()));
    }
  }
}
Ejemplo n.º 4
0
void lar_solver::find_solution_signature_with_doubles(lar_solution_signature & signature) {
    static_matrix<double, double> A;
    std::vector<double> x, low_bounds, upper_bounds;
    prepare_core_solver_fields<double, double>(A, x, low_bounds, upper_bounds);
    std::vector<double> column_scale_vector;
    std::vector<double> right_side_vector(A.row_count(), 0);

    scaler<double, double > scaler(right_side_vector,
                                   A,
                                   m_lar_core_solver_params.m_settings.scaling_minimum,
                                   m_lar_core_solver_params.m_settings.scaling_maximum,
                                   column_scale_vector,
                                   m_lar_core_solver_params.m_settings);
    if (!scaler.scale()) {
        // the scale did not succeed, unscaling
        A.clear();
        create_matrix_A(A);
        for (auto & s : column_scale_vector)
            s = 1.0;
    }
    std::vector<double> costs(A.column_count());
    auto core_solver = lp_primal_core_solver<double, double>(A,
                                                             right_side_vector,
                                                             x,
                                                             m_lar_core_solver_params.m_basis,
                                                             costs,
                                                             m_lar_core_solver_params.m_column_types,
                                                             low_bounds,
                                                             upper_bounds,
                                                             m_lar_core_solver_params.m_settings,
                                                             m_lar_core_solver_params.m_column_names);
    core_solver.find_feasible_solution();
    extract_signature_from_lp_core_solver(core_solver, signature);
}
Ejemplo n.º 5
0
void PdfView::scheduleRender() {
  _renderScheduled = false;
  qDebug() << "Rendering next page image.";
  Poppler::Page *page = doc->page(_imagedPage + 1);
  QImage image = scaler()->scaleAndRender(page, this);

  _nextImage = QPixmap::fromImage(image);
}
Ejemplo n.º 6
0
void SceneWidget::slotToggleCloudScalers(void) {
  if (scalers_.empty()) {
    osg::ref_ptr<Scaler> scaler(new Scaler(point_cloud_));
    scalers_.push_back(scaler);
    addSceneChild(scaler);
  } else {
    for (size_t i = 0, i_end = scalers_.size(); i < i_end; ++i) {
      removeSceneChild(scalers_[i]);
    }
    scalers_.clear();
  }
}
		void shootingModes(){
			if (manShootMode == 0){
				updateShooter();
			}
			if (manShootMode == 1){
				if (stick2.GetRawAxis(triggerR) > 0){
					t_motor.Set(scaler(-1*(stick2.GetRawAxis(triggerR))));
				}
				else if (stick2.GetRawAxis(triggerL) > 0){
					t_motor.Set(scaler(stick2.GetRawAxis(triggerL)));
				}
				else if (stick2.GetRawAxis(triggerL) == 0 and stick2.GetRawAxis(triggerR) == 0){
					t_motor.Set(0);
				}

				if (stick2.GetRawButton(buttonX) == true){
					myServo->SetAngle(175);
				}
				if (stick2.GetRawButton(buttonX) == false){
					myServo->SetAngle(5);
				}
			}
		}
Ejemplo n.º 8
0
OP_STATUS ExtensionUtils::GetExtensionIcon(Image& img,
						   const OpGadgetClass* gadget_class,
						   UINT32 desired_width,
						   UINT32 desired_height)
{
	FallbackExtensionIconProvider fallback_provider(desired_width);
#ifdef PIXEL_SCALE_RENDERING_SUPPORT
	// try to scale size
	INT32 scale = static_cast<DesktopOpSystemInfo*>(g_op_system_info)->GetMaximumHiresScaleFactor();
	PixelScaler scaler(scale);
	desired_width = TO_DEVICE_PIXEL(scaler, desired_width);
	desired_height = TO_DEVICE_PIXEL(scaler, desired_height);
#endif
	return GadgetUtils::GetGadgetIcon(img, gadget_class, desired_width, desired_height, 0, 0, TRUE, FALSE, fallback_provider);
}
Ejemplo n.º 9
0
QImage ThumbnailProvider::makeThumbnail(Mlt::Producer &producer, int frameNumber, const QSize& requestedSize)
{
    Mlt::Filter scaler(MLT.profile(), "swscale");
    Mlt::Filter converter(MLT.profile(), "avcolor_space");
    int height = PlaylistModel::THUMBNAIL_HEIGHT * 2;
    int width = height * MLT.profile().dar();

    if (!requestedSize.isEmpty()) {
        width = requestedSize.width();
        height = requestedSize.height();
    }

    producer.attach(scaler);
    producer.attach(converter);
    return MLT.image(producer, frameNumber, width, height);
}
Ejemplo n.º 10
0
int main(int argc, char* argv[])
{
	if (argc != 4 && argc != 5)
	{
		usage();
		return 0;
	}

	std::string filter = "linear";
	if (argc == 5)
		filter = argv[4];

	float rate = std::atof(argv[3]);
	si::Scaler scaler(argv[1], argv[2], rate, filter);
	scaler.run();
	
	return 0;
}
Ejemplo n.º 11
0
 Mlt::Producer* tempProducer()
 {
     if (!m_tempProducer) {
         QString service = m_producer.get("mlt_service");
         if (service == "avformat-novalidate")
             service = "avformat";
         else if (service.startsWith("xml"))
             service = "xml-nogl";
         m_tempProducer = new Mlt::Producer(MLT.profile(), service.toUtf8().constData(), m_producer.get("resource"));
         if (m_tempProducer->is_valid()) {
             Mlt::Filter scaler(MLT.profile(), "swscale");
             Mlt::Filter converter(MLT.profile(), "avcolor_space");
             m_tempProducer->attach(scaler);
             m_tempProducer->attach(converter);
         }
     }
     return m_tempProducer;
 }
Ejemplo n.º 12
0
void SWSpriteRenderer::render( SWCamera* camera )
{
	if ( getMaterial() && m_sprite.isValid() )
	{
		SWTransform* transform = gameObject()->getComponent<SWTransform>();
		const TMatrix4x4& model = transform->getWorldMatrix();
		const TMatrix4x4& VPMat = camera->getVPMatrix();
		const tvec2& offset = m_sprite()->getScaledOffset();
		const tvec2& size   = m_sprite()->getScaledSize();

		tquat scaler( offset.x, offset.y, size.x, size.y );

		SWMaterial* material = getMaterial();
		material->setTexture( "TEXTURE_0", m_sprite()->getTexture() );
		material->setMatrix4x4( "MATRIX_MVP", ( model * VPMat ) );
		material->setVector4( "SCALER", scaler );
		material->apply();
	}

	if ( getMesh() ) getMesh()->draw();
}
Ejemplo n.º 13
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler1024(real *a) { scaler(a,1024,0.0009765625); }
Ejemplo n.º 14
0
int main(void)
{

	uint move_index = 0;
	uint frame_index = 0;
	uint last_ant_id = 0;
	uint arrived_count = 0;
	t_map *map = create_map();
	Scaler scaler(map);
	std::vector<std::vector<Move> > moves;
	create_moves(moves);
	sf::RenderWindow window(sf::VideoMode(WIN_SZ, WIN_SZ), "lem_in Visualizer");
	sf::Font font;

	if (!font.loadFromFile("font.otf"))
		std::cout << "failed to load font!" << std::endl;

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::Black);
        draw_tubes(map, window, scaler);
        for (uint i = 0; i < map->rooms->size; i++)
        	draw_room((t_room*)array_get(map->rooms, i), window, font, map, arrived_count, last_ant_id, scaler);
        draw_move_list(moves[move_index], frame_index, map, window, last_ant_id, font, scaler);
        if (frame_index < FRAME_COUNT)
        	frame_index++;
        else
        {
        	arrived_count += apply_move_list(moves[move_index], map, last_ant_id);
        	move_index++;
        	frame_index = 0;
        	if (move_index >= moves.size())
        	{
        		window.clear(sf::Color::Black);
        		draw_tubes(map, window, scaler);
		        for (uint i = 0; i < map->rooms->size; i++)
		        	draw_room((t_room*)array_get(map->rooms, i), window, font, map, arrived_count, last_ant_id, scaler);
		        window.display();
        		sf::sleep(sf::milliseconds(2000));
        		//
        		arrived_count = 0;
        		last_ant_id = 0;
        		reset_map(map);
        		move_index = 0;
        		//
        		window.clear(sf::Color::Black);
        		draw_tubes(map, window, scaler);
		        for (uint i = 0; i < map->rooms->size; i++)
		        	draw_room((t_room*)array_get(map->rooms, i), window, font, map, arrived_count, last_ant_id, scaler);
		        window.display();
        		sf::sleep(sf::milliseconds(2000));
        	}
        }
        window.display();
        sf::sleep(sf::milliseconds(10));
    }
	return (0);
}
Ejemplo n.º 15
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler2048(real *a) { scaler(a,2048,0.00048828125); }
Ejemplo n.º 16
0
void CMatrix::matalg(double *C, int r, int s,int m, int n, int p, int opt, double eps)
{
	double *R,*Z;
	int i,j,Det, ii,jj, k, psrank;
	bool Done;
	if (opt==1) //inverse calculation;
	{
		ident(C,r,s,1,n+1,n,1);
	}
	R=new double[(r)*(s)];
	Z=new double[3];
	for(i=1;i<=r;i++) //random error initialization
	{
		for(int j=1;j<=s;j++)
		{
			R[s*i+j]=0.000000000001*(rand()-500000000000)*eps*C[s*i+j];
		}
	}
	for(j=1;j<=n;j++) // Set row permutation matrix to identity
	{
		C[s*r+j]=j;
	}
	//forward solution
	Det=1; Done=false; i=0;
	while((i<m)&&(!Done))
	{
		Z=searchmat(C,r,s,i+1,i+1,m,n);jj=Z[1];ii=Z[2];
		if(sqrt(Z[0]*Z[0])>sqrt(R[s*ii+jj]*R[s*ii+jj]))
		{
			i++;
		//switch row
		Det=Det*switchrow(C,r,s,i,ii,i,s);
		switchrow(R,r,s,i,ii,i,s);
		// switch columns
		Det=Det*switchcol(C,r,s,i,jj,1,r);
		switchcol(R,r,s,i,jj,1,r);
		// divide by pivot element
		scaler(C,R,r,s,i,i);
		Det=Det*scale(C,r,s,i,i);
			for (int k=i+1 ;k<=m; k++)
			{
			// reduce row k against row i
				pivotr(C,R,r,s,i,k,i+1);
				pivot(C,r,s,i,k,i+1);
			}
		}
		else
		{
			Done=true ;
		}
	}
	psrank=i;
		// end forward solution; begin consistency check
		if (psrank<m)
		{
			Det=0;
			for (j=1;j<=p;j++)
			{

				// check that right hand sides are 0 for i>psrank
				Z=searchmat(C,r,s,psrank+1,n+j,m,n+j);
				int a=Z[1];
				int b=Z[2];

				if(sqrt(Z[0]*Z[0])>sqrt(R[a*s+b]*R[a*s+b]))
				{		;//printf("Right hand side %d is inconsistent",j);

				}
			}
		}
	// equations are consistent, do back solution
		for (j=psrank;j>=2;j--)
		{
			for(i=1;i<=j-1;i++)
			{				
				pivotr(C,R,r,s,j,i,psrank+1);
				pivot(C,r,s,j,i,psrank+1);
				C[(s)*i+j]=0; R[(s)*i+j]=0;
			}
		}
	// end back solution, insert minus identity in basis
	if (psrank<n)
	{
	// fill bottom of basis matrix with -I
		ident(C,r,s,psrank+1,psrank+1,n-psrank,-1);
	// fill under right-hand sides with zeroes
		for(i=psrank+1 ;i<=n;i++)
		{
			for (j=n+1 ;j<=s;j++)
			{
				C[s*i+j]=0; 
			}
		}
	// fill under R matrix with zeroes
		for(i=psrank+1;i<=n;i++)
		{
			for(j=n-psrank;j<=s;j++)
			{
				R[s*i+j]=0;
			}
		}
	}
	// permute rows prior to output
	*Z=scramble(C,r,s,n);
	// copy row r of C to row r of R
	for(j=1;j<=n;j++)
	{
		R[(s)*r+j]=C[(s)*r+j];
	}
	scramble(R,r,s,n);
//	return(Det,psrank,evalm(R));
	
	}
Ejemplo n.º 17
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler64(real *a) { scaler(a,64,0.015625); }
Ejemplo n.º 18
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler32(real *a) { scaler(a,32,0.03125); }
Ejemplo n.º 19
0
int main()
{
    // setup window
    sf::Vector2i screenDimensions(576,272);
    sf::RenderWindow window(sf::VideoMode(screenDimensions.x, screenDimensions.y), "Rainsford");
    window.setFramerateLimit(60);
    
    sf::Vector2f scaler(screenDimensions.x/72, screenDimensions.y/34);
    
    /*background setup
    There are 3 copies of each background layer (z-score), one is drawn in left and one is drawn right of
     the default background that is automatically drawn. After the any of the 3 copies moves its entire width left
     (position.x is negative width) it is assigned position.x = positive width. This "shuffles" the copies
     and gives an illusion of continuity.
     
     */
    sf::RectangleShape titlescreen (sf::Vector2f(screenDimensions.x, screenDimensions.y));
    sf::Texture title;
    if (!title.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Rainsford Titlescreen.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    titlescreen.setTexture(&title); // texture is a sf::Texture
    titlescreen.setTextureRect(sf::IntRect(0, 0, 576,272));

    
    
    sf::RectangleShape titleback (sf::Vector2f(screenDimensions.x, screenDimensions.y));
    sf::Texture titlebackTex;
    if (!titlebackTex.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Titleback.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    titleback.setTexture(&titlebackTex); // texture is a sf::Texture
    titleback.setTextureRect(sf::IntRect(0, 0, 576,272));
    
    
    
    sf::RectangleShape moon (sf::Vector2f(screenDimensions.x, screenDimensions.y));
    sf::Texture moonT;
    if (!moonT.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Moon.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    moon.setTexture(&moonT); // texture is a sf::Texture
    moon.setTextureRect(sf::IntRect(0, 0, 576,272));

    
    

    //back1
    sf::RectangleShape back1(sf::Vector2f(72,34));
    sf::Texture textureBack1;
    if (!textureBack1.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background1.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back1.setTexture(&textureBack1); // texture is a sf::Texture
    back1.setTextureRect(sf::IntRect(0, 0, 72,34));
    
    //back2
    sf::RectangleShape back2(sf::Vector2f(128,32));
    sf::Texture textureBack2;
    if (!textureBack2.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background2.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back2.setTexture(&textureBack2); // texture is a sf::Texture
    back2.setTextureRect(sf::IntRect(0, 0, 128,32));

    sf::RectangleShape back2a(sf::Vector2f(128,32));
    back2a.setTexture(&textureBack2); // texture is a sf::Texture
    back2a.setTextureRect(sf::IntRect(0, 0, 128,32));
    back2a.setPosition(-128*8, 0);
    
    sf::RectangleShape back2b(sf::Vector2f(128,32));
    back2b.setTexture(&textureBack2); // texture is a sf::Texture
    back2b.setTextureRect(sf::IntRect(0, 0, 128,32));
    back2b.setPosition(128*8, 0);
    
    //back3
    sf::RectangleShape back3(sf::Vector2f(128,32));
    sf::Texture textureBack3;
    if (!textureBack3.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background3.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back3.setTexture(&textureBack3); // texture is a sf::Texture
    back3.setTextureRect(sf::IntRect(0, 0, 128,32));

    sf::RectangleShape back3a(sf::Vector2f(128,32));
    back3a.setTexture(&textureBack3); // texture is a sf::Texture
    back3a.setTextureRect(sf::IntRect(0, 0, 128,32));
    back3a.setPosition(-128*8, 0);
    
    sf::RectangleShape back3b(sf::Vector2f(128,32));
    back3b.setTexture(&textureBack3); // texture is a sf::Texture
    back3b.setTextureRect(sf::IntRect(0, 0, 128,32));
    back3b.setPosition(128*8, 0);
    
    //back4
    sf::RectangleShape back4(sf::Vector2f(112,32));
    sf::Texture textureBack4;
    if (!textureBack4.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background4.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back4.setTexture(&textureBack4); // texture is a sf::Texture
    back4.setTextureRect(sf::IntRect(0, 0, 112,32));

    sf::RectangleShape back4a(sf::Vector2f(112,32));
    back4a.setTexture(&textureBack4); // texture is a sf::Texture
    back4a.setTextureRect(sf::IntRect(0, 0, 112,32));
    back4a.setPosition(-112*8, 0);
    
    sf::RectangleShape back4b(sf::Vector2f(112,32));
    back4b.setTexture(&textureBack4); // texture is a sf::Texture
    back4b.setTextureRect(sf::IntRect(0, 0, 112,32));
    back4b.setPosition(112*8, 0);
    
    //back5
    sf::RectangleShape back5(sf::Vector2f(96,32));
    sf::Texture textureBack5;
    if (!textureBack5.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background5.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back5.setTexture(&textureBack5); // texture is a sf::Texture
    back5.setTextureRect(sf::IntRect(0, 0, 96,32));
    
    sf::RectangleShape back5a(sf::Vector2f(96,32));
    back5a.setTexture(&textureBack5); // texture is a sf::Texture
    back5a.setTextureRect(sf::IntRect(0, 0, 96,32));
    back5a.setPosition(-96*8, 0);
    
    sf::RectangleShape back5b(sf::Vector2f(96,32));
    back5b.setTexture(&textureBack5); // texture is a sf::Texture
    back5b.setTextureRect(sf::IntRect(0, 0, 96,32));
    back5b.setPosition(96*8, 0);
    
    //back6
    sf::RectangleShape back6(sf::Vector2f(72,32));
    sf::Texture textureBack6;
    if (!textureBack6.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Background6.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    back6.setTexture(&textureBack6); // texture is a sf::Texture
    back6.setTextureRect(sf::IntRect(0, 0, 72,32));

    sf::RectangleShape back6a(sf::Vector2f(72,32));
    back6a.setTexture(&textureBack6); // texture is a sf::Texture
    back6a.setTextureRect(sf::IntRect(0, 0, 72,32));
    back6a.setPosition(-72*8, 0);
    
    sf::RectangleShape back6b(sf::Vector2f(72,32));
    back6b.setTexture(&textureBack6); // texture is a sf::Texture
    back6b.setTextureRect(sf::IntRect(0, 0, 72,32));
    back6b.setPosition(72*8, 0);
    
    //moonlight
    sf::RectangleShape moonlight(sf::Vector2f(96,32));
    sf::Texture textureMoon;
    if (!textureMoon.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Moonlight.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    moonlight.setTexture(&textureMoon); // texture is a sf::Texture
    moonlight.setTextureRect(sf::IntRect(0, 0, 96,32));
    
    sf::RectangleShape moonlighta(sf::Vector2f(96,32));
    moonlighta.setTexture(&textureBack6); // texture is a sf::Texture
    moonlighta.setTextureRect(sf::IntRect(0, 0, 96,32));
    moonlighta.setPosition(-96*8, 0);
    
    sf::RectangleShape moonlightb(sf::Vector2f(96,32));
    moonlightb.setTexture(&textureMoon); // texture is a sf::Texture
    moonlightb.setTextureRect(sf::IntRect(0, 0, 96,32));
    moonlightb.setPosition(96*8, 0);

    
    //vines
    sf::RectangleShape vines(sf::Vector2f(96,32));
    sf::Texture textureVines;
    if (!textureVines.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Vines.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    vines.setTexture(&textureVines); // texture is a sf::Texture
    vines.setTextureRect(sf::IntRect(0, 0, 96,32));
    
    sf::RectangleShape vinesa(sf::Vector2f(96,32));
    vinesa.setTexture(&textureVines); // texture is a sf::Texture
    vinesa.setTextureRect(sf::IntRect(0, 0, 96,32));
    vinesa.setPosition(-96*8, 0);
    
    sf::RectangleShape vinesb(sf::Vector2f(96,32));
    vinesb.setTexture(&textureVines); // texture is a sf::Texture
    vinesb.setTextureRect(sf::IntRect(0, 0, 96,32));
    vinesb.setPosition(96*8, 0);

    
    //end of backgrounds ***********************************************************
    
    back1.scale(scaler);
    back2.scale(scaler);
    back3.scale(scaler);
    back4.scale(scaler);
    back5.scale(scaler);
    back6.scale(scaler);
    vines.scale(scaler);
    back2a.scale(scaler);
    back3a.scale(scaler);
    back4a.scale(scaler);
    back5a.scale(scaler);
    back6a.scale(scaler);
    vinesa.scale(scaler);
    back2b.scale(scaler);
    back3b.scale(scaler);
    back4b.scale(scaler);
    back5b.scale(scaler);
    back6b.scale(scaler);
    vinesb.scale(scaler);
    moonlight.scale(scaler);
    moonlighta.scale(scaler);
    moonlightb.scale(scaler);
    
    //flickering stormlamp spritesheet
    sf::Texture stormLamp;
    
    if (!stormLamp.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/RainsfordStormLamp_Spritesheet.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    
    Animation flicker;
    flicker.setSpriteSheet(stormLamp);
    flicker.addFrame(sf::IntRect (0, 0, 160, 90));
    flicker.addFrame(sf::IntRect (0, 90, 160, 90));
    flicker.addFrame(sf::IntRect (0, 180, 160, 90));
    flicker.addFrame(sf::IntRect (0, 90, 160, 90));


    AnimatedSprite flickerSprite(sf::seconds(.3), true, false);
    flickerSprite.scale(scaler);
    flickerSprite.setPosition(((-160/scaler.x)*18), -120*scaler.y/4);
    
    //IVAN STUFF
    // load texture (spritesheet)
    sf::Texture textureIvan;
    if (!textureIvan.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Spritesheet_Ivan.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    
    // set up the animations for all four directions (set spritesheet and push frames)
    
    Animation ivan_standingRight;
    ivan_standingRight.setSpriteSheet(textureIvan);
    ivan_standingRight.addFrame(sf::IntRect(0, 0, 8, 8));
    ivan_standingRight.addFrame(sf::IntRect(8, 0, 8, 8));
    ivan_standingRight.addFrame(sf::IntRect(16, 0, 8, 8));
    ivan_standingRight.addFrame(sf::IntRect( 24, 0, 8, 8));
    ivan_standingRight.addFrame(sf::IntRect(32, 0, 8, 8));
    ivan_standingRight.addFrame(sf::IntRect( 40, 0, 8, 8));
    
    Animation ivan_standingLeft;
    ivan_standingLeft.setSpriteSheet(textureIvan);
    ivan_standingLeft.addFrame(sf::IntRect(0, 8, 8, 8));
    ivan_standingLeft.addFrame(sf::IntRect(8, 8, 8, 8));
    ivan_standingLeft.addFrame(sf::IntRect(16, 8, 8, 8));
    ivan_standingLeft.addFrame(sf::IntRect( 24, 8, 8, 8));
    ivan_standingLeft.addFrame(sf::IntRect(32, 8, 8, 8));
    ivan_standingLeft.addFrame(sf::IntRect(40, 8, 8, 8));
    
    Animation ivan_walkingRight;
    ivan_walkingRight.setSpriteSheet(textureIvan);
    ivan_walkingRight.addFrame(sf::IntRect(0, 16, 8, 8));
    ivan_walkingRight.addFrame(sf::IntRect(8, 16, 8, 8));
    ivan_walkingRight.addFrame(sf::IntRect(16, 16, 8, 8));
    ivan_walkingRight.addFrame(sf::IntRect( 24, 16, 8, 8));
    ivan_walkingRight.addFrame(sf::IntRect(32, 16, 8, 8));
    ivan_walkingRight.addFrame(sf::IntRect( 40, 16, 8, 8));
    
    Animation ivan_walkingLeft;
    ivan_walkingLeft.setSpriteSheet(textureIvan);
    ivan_walkingLeft.addFrame(sf::IntRect(0, 24, 8, 8));
    ivan_walkingLeft.addFrame(sf::IntRect(8, 24, 8, 8));
    ivan_walkingLeft.addFrame(sf::IntRect(16, 24, 8, 8));
    ivan_walkingLeft.addFrame(sf::IntRect( 24, 24, 8, 8));
    ivan_walkingLeft.addFrame(sf::IntRect(32, 24, 8, 8));
    ivan_walkingLeft.addFrame(sf::IntRect( 40, 24, 8, 8));

    Animation* currentIvanAnimation = &ivan_standingRight;
    
    AnimatedSprite ivan(sf::seconds(.07), true, false);
    ivan.setPosition(sf::Vector2f(screenDimensions.x / 2 - 264, 192));
    ivan.scale(scaler);
    
    
    // DOG load texture (spritesheet)
    sf::Texture textureDog;
    if (!textureDog.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Spritesheet_Dog.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    

    //dog spritesheet animation setup
    Animation dog_standingRight;
    dog_standingRight.setSpriteSheet(textureDog);
    dog_standingRight.addFrame(sf::IntRect(0, 0, 8, 8));
    dog_standingRight.addFrame(sf::IntRect(8, 0, 8, 8));
    dog_standingRight.addFrame(sf::IntRect(16, 0, 8, 8));
    dog_standingRight.addFrame(sf::IntRect( 24, 0, 8, 8));
    
    Animation dog_standingLeft;
    dog_standingLeft.setSpriteSheet(textureDog);
    dog_standingLeft.addFrame(sf::IntRect(0, 8, 8, 8));
    dog_standingLeft.addFrame(sf::IntRect(8, 8, 8, 8));
    dog_standingLeft.addFrame(sf::IntRect(16, 8, 8, 8));
    dog_standingLeft.addFrame(sf::IntRect( 24, 8, 8, 8));

    Animation dog_walkingRight;
    dog_walkingRight.setSpriteSheet(textureDog);
    dog_walkingRight.addFrame(sf::IntRect(0, 16, 8, 8));
    dog_walkingRight.addFrame(sf::IntRect(8, 16, 8, 8));
    dog_walkingRight.addFrame(sf::IntRect(16, 16, 8, 8));
    dog_walkingRight.addFrame(sf::IntRect( 24, 16, 8, 8));
    
    Animation dog_walkingLeft;
    dog_walkingLeft.setSpriteSheet(textureDog);
    dog_walkingLeft.addFrame(sf::IntRect(0, 24, 8, 8));
    dog_walkingLeft.addFrame(sf::IntRect(8, 24, 8, 8));
    dog_walkingLeft.addFrame(sf::IntRect(16, 24, 8, 8));
    dog_walkingLeft.addFrame(sf::IntRect( 24, 24, 8, 8));

    Animation dog_walkingRightHostile;
    dog_walkingRightHostile.setSpriteSheet(textureDog);
    dog_walkingRightHostile.addFrame(sf::IntRect(0, 32, 8, 8));
    dog_walkingRightHostile.addFrame(sf::IntRect(8, 32, 8, 8));
    dog_walkingRightHostile.addFrame(sf::IntRect(16, 32, 8, 8));
    dog_walkingRightHostile.addFrame(sf::IntRect( 24, 32, 8, 8));
    
    Animation dog_walkingLeftHostile;
    dog_walkingLeftHostile.setSpriteSheet(textureDog);
    dog_walkingLeftHostile.addFrame(sf::IntRect(0, 40, 8, 8));
    dog_walkingLeftHostile.addFrame(sf::IntRect(8, 40, 8, 8));
    dog_walkingLeftHostile.addFrame(sf::IntRect(16, 40, 8, 8));
    dog_walkingLeftHostile.addFrame(sf::IntRect( 24, 40, 8, 8));

    Animation* currentDogAnimation = &dog_standingRight;
    
    AnimatedSprite dog(sf::seconds(.07), true, false);
    dog.setPosition(sf::Vector2f(screenDimensions.x / 2 - 200, 192));
    dog.scale(scaler);
    
    
    // load texture (spritesheet)
    sf::Texture texture;
    if (!texture.loadFromFile("/Users/Bloopton/Desktop/Programs/TestAnimation/TestAnimation/Spritesheet_Rainsford.png"))
    {
        std::cout << "Failed to load player spritesheet!" << std::endl;
        return 1;
    }
    
    // set up the animations for all directions (set spritesheet and push frames)
    
    Animation standingRight;
    standingRight.setSpriteSheet(texture);
    standingRight.addFrame(sf::IntRect(0, 0, 8, 8));
    standingRight.addFrame(sf::IntRect(8, 0, 8, 8));
    standingRight.addFrame(sf::IntRect(16, 0, 8, 8));
    standingRight.addFrame(sf::IntRect( 24, 0, 8, 8));
   // standingRight.addFrame(sf::IntRect(32, 0, 8, 8));
   // standingRight.addFrame(sf::IntRect( 40, 0, 8, 8));
    
    Animation standingLeft;
    standingLeft.setSpriteSheet(texture);
    standingLeft.addFrame(sf::IntRect(0, 8, 8, 8));
    standingLeft.addFrame(sf::IntRect(8, 8, 8, 8));
    standingLeft.addFrame(sf::IntRect(16, 8, 8, 8));
    standingLeft.addFrame(sf::IntRect( 24, 8, 8, 8));
   // standingLeft.addFrame(sf::IntRect(32, 8, 8, 8));
   // standingLeft.addFrame(sf::IntRect(40, 8, 8, 8));

    Animation walkingRight;
    walkingRight.setSpriteSheet(texture);
    walkingRight.addFrame(sf::IntRect(0, 16, 8, 8));
    walkingRight.addFrame(sf::IntRect(8, 16, 8, 8));
    walkingRight.addFrame(sf::IntRect(16, 16, 8, 8));
    walkingRight.addFrame(sf::IntRect( 24, 16, 8, 8));
    //walkingRight.addFrame(sf::IntRect(32, 16, 8, 8));
    //walkingRight.addFrame(sf::IntRect( 40, 16, 8, 8));
    
    Animation walkingLeft;
    walkingLeft.setSpriteSheet(texture);
    walkingLeft.addFrame(sf::IntRect(0, 24, 8, 8));
    walkingLeft.addFrame(sf::IntRect(8, 24, 8, 8));
    walkingLeft.addFrame(sf::IntRect(16, 24, 8, 8));
    walkingLeft.addFrame(sf::IntRect( 24, 24, 8, 8));
    //walkingLeft.addFrame(sf::IntRect(32, 24, 8, 8));
    //walkingLeft.addFrame(sf::IntRect( 40, 24, 8, 8));
  
    Animation jumpingRight;
    jumpingRight.setSpriteSheet(texture);
    jumpingRight.addFrame(sf::IntRect(0, 32, 8, 8));
    jumpingRight.addFrame(sf::IntRect(8, 32, 8, 8));
    jumpingRight.addFrame(sf::IntRect(16, 32, 8, 8));
    jumpingRight.addFrame(sf::IntRect( 24, 32, 8, 8));
    //jumpingRight.addFrame(sf::IntRect(32, 32, 8, 8));
    //jumpingRight.addFrame(sf::IntRect( 40, 32, 8, 8));

    
    Animation jumpingLeft;
    jumpingLeft.setSpriteSheet(texture);
    jumpingLeft.addFrame(sf::IntRect(0, 40, 8, 8));
    jumpingLeft.addFrame(sf::IntRect(8, 40, 8, 8));
    jumpingLeft.addFrame(sf::IntRect(16, 40, 8, 8));
    jumpingLeft.addFrame(sf::IntRect( 24, 40, 8, 8));
    //jumpingLeft.addFrame(sf::IntRect(32, 40, 8, 8));
    //jumpingLeft.addFrame(sf::IntRect( 40, 40, 8, 8));

    
    Animation crawlingRight;
    crawlingRight.setSpriteSheet(texture);
    crawlingRight.addFrame(sf::IntRect(0, 64, 8, 8));
    crawlingRight.addFrame(sf::IntRect(8, 64, 8, 8));
    crawlingRight.addFrame(sf::IntRect(16, 64, 8, 8));
    crawlingRight.addFrame(sf::IntRect( 24, 64, 8, 8));
    //jumpingRight.addFrame(sf::IntRect(32, 32, 8, 8));
    //jumpingRight.addFrame(sf::IntRect( 40, 32, 8, 8));
    
    
    Animation crawlingLeft;
    crawlingLeft.setSpriteSheet(texture);
    crawlingLeft.addFrame(sf::IntRect(0, 72, 8, 8));
    crawlingLeft.addFrame(sf::IntRect(8, 72, 8, 8));
    crawlingLeft.addFrame(sf::IntRect(16, 72, 8, 8));
    crawlingLeft.addFrame(sf::IntRect( 24, 72, 8, 8));
    //jumpingLeft.addFrame(sf::IntRect(32, 40, 8, 8));
    //jumpingLeft.addFrame(sf::IntRect( 40, 40, 8, 8));

    
    Animation disguise1;
    disguise1.setSpriteSheet(texture);
    disguise1.addFrame(sf::IntRect(0, 48, 8, 8));
    Animation disguise2;
    disguise2.setSpriteSheet(texture);
    disguise2.addFrame(sf::IntRect(8, 48, 8, 8));
    Animation disguise3;
    disguise3.setSpriteSheet(texture);
    disguise3.addFrame(sf::IntRect(16, 48, 8, 8));
    Animation disguise4;
    disguise4.setSpriteSheet(texture);
    disguise4.addFrame(sf::IntRect(24, 48, 8, 8));
    
    Animation crouchedRight;
    crouchedRight.setSpriteSheet(texture);
    crouchedRight.addFrame(sf::IntRect(0, 56, 8, 8));
    
    Animation crouchedLeft;
    crouchedLeft.setSpriteSheet(texture);
    crouchedLeft.addFrame(sf::IntRect(8, 56, 8, 8));


    Animation* currentAnimation = &standingRight;
    
    
    
    float rainsfordAnimationSpeed = .07;
    
    
    // set up AnimatedSprite
    AnimatedSprite animatedSprite(sf::seconds(rainsfordAnimationSpeed), true, false);
    animatedSprite.setPosition(sf::Vector2f(screenDimensions.x / 2 - 64, 192));
    animatedSprite.scale(scaler);
    sf::Clock frameClock;
    
    float speed = 650.f;
    bool noKeyWasPressed = true;
    
    
    enum direction { left, right};
    direction currentDir = right;
    
    
       while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
                window.close();
        }
        
        sf::Time frameTime = frameClock.restart();
        
        
        // if a key was pressed set the correct animation and move correctly
        sf::Vector2f movement(0.f, 0.f);
        
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        {
            if(currentDir == left)
            {
                currentAnimation = &jumpingLeft;
                noKeyWasPressed = false;
            }
            if(currentDir == right)
            {
                currentAnimation = &jumpingRight;
                noKeyWasPressed = false;
            }
 
        }
        
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) || sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
    {
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
        {
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
            {
                currentAnimation = &crawlingLeft;
                currentDogAnimation = &dog_walkingLeft; //DOG ANIMATION
                currentIvanAnimation = &ivan_walkingLeft; //Ivan ANIMATION

                movement.x += .2*speed;
                noKeyWasPressed = false;
                currentDir = left;
            }
            else
            {
                currentAnimation = &walkingLeft;
                currentDogAnimation = &dog_walkingLeftHostile; //DOG ANIMATION
                currentIvanAnimation = &ivan_walkingLeft; //Ivan ANIMATION

                movement.x += speed;
                noKeyWasPressed = false;
                currentDir = left;

            }
        }
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
        {
           

            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
            {
                currentAnimation = &crawlingRight;
                currentDogAnimation = &dog_walkingRight; //DOG ANIMATION
                currentIvanAnimation = &ivan_walkingRight; //Ivan ANIMATION

                movement.x -= .2*speed;
                noKeyWasPressed = false;
                currentDir = right;
            }
            else
            {
                currentAnimation = &walkingRight;
                currentDogAnimation = &dog_walkingRightHostile; //DOG ANIMATION
                currentIvanAnimation = &ivan_walkingRight; //Ivan ANIMATION

                movement.x -= speed;
                noKeyWasPressed = false;
                currentDir = right;
            }
        }
        
    }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
        {
            if(currentDir == left)
            {
                currentAnimation = &crouchedLeft;
                noKeyWasPressed = false;
            }
            if(currentDir == right)
            {
                currentAnimation = &crouchedRight;
                noKeyWasPressed = false;
            }
            
        }
        

        
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::E))
        {
            currentAnimation = &disguise1;
            noKeyWasPressed = false;
            movement.x = 0;
        }
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::R))
        {
            currentAnimation = &disguise2;
            noKeyWasPressed = false;
            movement.x = 0;
        }
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::T))
        {
            currentAnimation = &disguise3;
            noKeyWasPressed = false;
            movement.x = 0;
        }
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Y))
        {
            currentAnimation = &disguise4;
            noKeyWasPressed = false;
            movement.x = 0;
        }
        
        

        
        // if no key was pressed
        if (noKeyWasPressed)
        {
            sf::Time slowerFrameTime = sf::seconds(.3);
            
            animatedSprite.setFrameTime(slowerFrameTime);
            dog.setFrameTime(slowerFrameTime); //DOG WUZ HERE
            ivan.setFrameTime(slowerFrameTime); //IVAn

            if (currentDir == left)
            {
                currentAnimation = &standingLeft;
                currentDogAnimation = &dog_standingLeft;// DAWG HERE TOO DOG
                currentIvanAnimation = &ivan_standingLeft;// IVAN

            }
            if (currentDir == right)
            {
                currentAnimation = &standingRight;
                currentDogAnimation = &dog_standingRight; // DAWG HERE TOO 2 DOG
                currentIvanAnimation = &ivan_standingRight;// IVAN

            }
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
        {
            animatedSprite.setFrameTime(sf::seconds(.15));
            dog.setFrameTime(sf::seconds(.15));//DOOOOOOOGGGGEEE DOG
            ivan.setFrameTime(sf::seconds(.15));//IVAN

        }
        else
        {
            animatedSprite.setFrameTime(sf::seconds(.07));
            dog.setFrameTime(sf::seconds(.07));//DOOOOOOOGGGGEEEDOOOOOOOGGGGEEEDOOOOOOOGGGGEEE DOG
            ivan.setFrameTime(sf::seconds(.07));//IVAN
        }
        
        
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
    {
               //EDGE EFFECT HERE
        if (back2.getPosition().x <= back2.getSize().x*-8)
        {
            back2.setPosition(back2.getSize().x*8, 0);
        }
        if (back2a.getPosition().x <= back2a.getSize().x*-8)
        {
            back2a.setPosition(back2a.getSize().x*8, 0);
        }
 
        if (back2b.getPosition().x <= back2b.getSize().x*-8)
        {
            back2b.setPosition(back2b.getSize().x*8, 0);
        }
        
        if (back3.getPosition().x <= back3.getSize().x*-8)
        {
            back3.setPosition(back3.getSize().x*8, 0);
        }
        if (back3a.getPosition().x <= back3a.getSize().x*-8)
        {
            back3a.setPosition(back3a.getSize().x*8, 0);
        }
        
        if (back3b.getPosition().x <= back3b.getSize().x*-8)
        {
            back3b.setPosition(back3b.getSize().x*8, 0);
        }

        
        if (back4.getPosition().x <= back4.getSize().x*-8)
        {
            back4.setPosition(back4.getSize().x*8, 0);
        }
        if (back4a.getPosition().x <= back4a.getSize().x*-8)
        {
            back4a.setPosition(back4a.getSize().x*8, 0);
        }
        
        if (back4b.getPosition().x <= back4b.getSize().x*-8)
        {
            back4b.setPosition(back4b.getSize().x*8, 0);
        }

        
        if (back5.getPosition().x <= back5.getSize().x*-8)
        {
            back5.setPosition(back5.getSize().x*8, 0);
        }
        if (back5a.getPosition().x <= back5a.getSize().x*-8)
        {
            back5a.setPosition(back5a.getSize().x*8, 0);
        }
        
        if (back5b.getPosition().x <= back5b.getSize().x*-8)
        {
            back5b.setPosition(back5b.getSize().x*8, 0);
        }

        
        if (back6.getPosition().x <= back6.getSize().x*-8)
        {
            back6.setPosition(back6.getSize().x*8, 0);
        }
        if (back6a.getPosition().x <= back6a.getSize().x*-8)
        {
            back6a.setPosition(back6a.getSize().x*8, 0);
        }
        
        if (back6b.getPosition().x <= back6b.getSize().x*-8)
        {
            back6b.setPosition(back6b.getSize().x*8, 0);
        }
        
        
            //vines
        if (vines.getPosition().x <= vines.getSize().x*-8)
        {
            vines.setPosition(vines.getSize().x*8, 0);
        }
        if (vinesa.getPosition().x <= vinesa.getSize().x*-8)
        {
            vinesa.setPosition(vinesa.getSize().x*8, 0);
        }
        
        if (vinesb.getPosition().x <= vinesb.getSize().x*-8)
        {
            vinesb.setPosition(vinesb.getSize().x*8, 0);
        }

            //moonlight
        if (moonlight.getPosition().x <= moonlight.getSize().x*-8)
        {
            moonlight.setPosition(moonlight.getSize().x*8, 0);
        }
        if (moonlighta.getPosition().x <= moonlighta.getSize().x*-8)
        {
            moonlighta.setPosition(moonlighta.getSize().x*8, 0);
        }
        
        if (moonlightb.getPosition().x <= moonlightb.getSize().x*-8)
        {
            moonlightb.setPosition(moonlightb.getSize().x*8, 0);
        }

        
    }
        
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
    {
        
        //positive
        /*
        if (back2.getPosition().x >= back2.getSize().x*8)
        {
            back2.setPosition(back2.getSize().x*-8, 0);
        }
        if (back2a.getPosition().x >= back2a.getSize().x*8)
        {
            back2a.setPosition(back2a.getSize().x*-8, 0);
        }
        
        if (back2b.getPosition().x >= back2b.getSize().x*8)
        {
            back2b.setPosition(back2b.getSize().x*-8, 0);
        }
        
        if (back3.getPosition().x >= back3.getSize().x*8)
        {
            back3.setPosition(back3.getSize().x*-8, 0);
        }
        if (back3a.getPosition().x >= back3a.getSize().x*8)
        {
            back3a.setPosition(back3a.getSize().x*-8, 0);
        }
        
        if (back3b.getPosition().x >= back3b.getSize().x*8)
        {
            back3b.setPosition(back3b.getSize().x*-8, 0);
        }
        */
        
        if (back4.getPosition().x >= back4.getSize().x*8)
        {
            back4.setPosition(back4.getSize().x*-8, 0);
        }
        if (back4a.getPosition().x >= back4a.getSize().x*8)
        {
            back4a.setPosition(back4a.getSize().x*-8, 0);
        }
        
        if (back4b.getPosition().x >= back4b.getSize().x*8)
        {
            back4b.setPosition(back4b.getSize().x*-8, 0);
        }
        
        
        if (back5.getPosition().x >= back5.getSize().x*8)
        {
            back5.setPosition(back5.getSize().x*-8, 0);
        }
        if (back5a.getPosition().x >= back5a.getSize().x*8)
        {
            back5a.setPosition(back5a.getSize().x*-8, 0);
        }
        
        if (back5b.getPosition().x >= back5b.getSize().x*8)
        {
            back5b.setPosition(back5b.getSize().x*-8, 0);
        }
        
        
        if (back6.getPosition().x >= back6.getSize().x*8)
        {
            back6.setPosition(back6.getSize().x*-8, 0);
        }
        if (back6a.getPosition().x >= back6a.getSize().x*8)
        {
            back6a.setPosition(back6a.getSize().x*-8, 0);
        }
        
        if (back6b.getPosition().x >= back6b.getSize().x*8)
        {
            back6b.setPosition(back6b.getSize().x*-8, 0);
        }
            //vines
         if (vines.getPosition().x >= vines.getSize().x*8)
         {
         vines.setPosition(vines.getSize().x*-8, 0);
         }
         if (vinesa.getPosition().x >= vinesa.getSize().x*8)
         {
         vinesa.setPosition(vinesa.getSize().x*-8, 0);
         }
         
         if (vinesb.getPosition().x >= vinesb.getSize().x*8)
         {
         vinesb.setPosition(vinesb.getSize().x*-8, 0);
         }
        
        //moonlight
        if (moonlight.getPosition().x >= moonlight.getSize().x*8)
        {
            moonlight.setPosition(moonlight.getSize().x*-8, 0);
        }
        if (moonlighta.getPosition().x >= moonlighta.getSize().x*8)
        {
            moonlighta.setPosition(moonlighta.getSize().x*-8, 0);
        }
        
        if (moonlightb.getPosition().x >= moonlightb.getSize().x*8)
        {
            moonlightb.setPosition(moonlightb.getSize().x*-8, 0);
        }

        
    }
        
        
        float timeMov = 1;
        timeMov = frameTime.asSeconds();
        
        ivan.play(*currentIvanAnimation);
        dog.play(*currentDogAnimation);//dog animation here
        animatedSprite.play(*currentAnimation);
        flickerSprite.play(flicker);
        animatedSprite.move(0,0);
        back2.move(-16 * timeMov, 0);
        back3.move(-32 * timeMov, 0);
        back4.move(.3*movement.x * timeMov, 0);
        moonlight.move(.45*movement.x * timeMov, 0);
        back5.move(.55*movement.x * timeMov, 0);
        vines.move(.65*movement.x * timeMov, 0);
        back6.move(.8*movement.x * timeMov, 0);
        back2a.move(-16 * timeMov, 0);
        back3a.move(-32 * timeMov, 0);
        back4a.move(.3*movement.x * timeMov, 0);
        moonlighta.move(.45*movement.x * timeMov, 0);
        back5a.move(.55*movement.x * timeMov, 0);
        vinesa.move(.65*movement.x * timeMov, 0);
        back6a.move(.8*movement.x * timeMov, 0);
        back2b.move(-16 * timeMov, 0);
        back3b.move(-32 * timeMov, 0);
        back4b.move(.3*movement.x * timeMov, 0);
        moonlightb.move(.45*movement.x * timeMov, 0);
        back5b.move(.55*movement.x * timeMov, 0);
        vinesb.move(.65*movement.x * timeMov, 0);
        back6b.move(.8*movement.x * timeMov, 0);
        noKeyWasPressed = true;

        
        // update AnimatedSprite
        dog.update(frameTime);//dog
        ivan.update(frameTime);//ivan
        animatedSprite.update(frameTime);
        flickerSprite.update(sf::seconds(.03f));
        
        
        // draw
        window.clear();
        window.draw(titleback);
        window.draw(moon);
        //window.draw(back1);
        window.draw(back2);
        window.draw(back2a);
        window.draw(back2b);
        window.draw(back3);
        window.draw(back3a);
        window.draw(back3b);
        /*window.draw(back4);
        window.draw(back4a);
        window.draw(back4b);
        window.draw(back5);
        window.draw(back5a);
        window.draw(back5b);
        window.draw(back6);
        window.draw(back6a);
        window.draw(back6b);
        window.draw(animatedSprite);
        window.draw(dog);//dog
        window.draw(ivan);//ivan
         */
        
        window.draw(titlescreen);
        
        
        int flickerCounter = 0;
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::F))
        {
            if(flickerCounter==0) flickerCounter++;
            else flickerCounter--;
        }
        if(flickerCounter!=0)
        window.draw(flickerSprite);
        
        window.display();
    }
    
    return 0;
}
Ejemplo n.º 20
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler128(real *a) { scaler(a,128,0.0078125); }
Ejemplo n.º 21
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler512(real *a) { scaler(a,512,0.001953125); }
	void OperatorControl()
		{
			while (IsOperatorControl() && IsEnabled())
			{
				robotDrive.ArcadeDrive(scaler(stick.GetZ()),scaler(stick.GetY()));
				SmartDashboard::PutNumber("StickZ",stick.GetZ());
				SmartDashboard::PutNumber("StickZscaled",scaler(stick.GetZ()));


				finger_Motor.Set(scaler(stick2.GetRawAxis(thumbpadL_Y)));
//				scalerValue = stick.GetRawAxis(3);
				arm_Motor.Set(scaler(stick2.GetRawAxis(thumbpadR_Y)));
				manualShooter();
				shootingModes();
				toggleIntake();
				toggleIntakeMode();
				setScalerValue();
//				double volts = ourRangefinder->GetVoltage();
//				SmartDashboard::PutNumber("Voltage",volts);
				//t_motor.Set(stick2.GetZ());
				//t_motor.Set(stick.GetAxis(Joystick::kDefaultThrottleAxis));
//				t_motor.Set(stick.GetAxis(Joystick::kThrottleAxis));
//				finger_Motor.Set(stick2.GetAxis(Joystick::kThrottleAxis));
//				arm_Motor.Set(stick2.GetY());

		//		Current Control mode Debug
				SmartDashboard::PutNumber("Motor30 Current",t_motor.GetOutputCurrent());
				SmartDashboard::PutNumber("Position",t_motor.GetPosition());
//				t_motor.Set(stick.GetAxis(Joystick::Slider));
//				if (stick.GetRawButton(3) == true){
//					t_motor.SetPosition(10000);
//				}

//			if (stick2.GetRawButton(7) == true and buttonpress == false){
//

//									}
//			else if (stick2.GetRawButton(3) == false and buttonpress == true){
//					buttonpress = false;// drive with arcade style (use right stick)
//
//						}
			SmartDashboard::PutBoolean("buttonpress state",buttonpress);

			if (stick2.GetRawButton(buttonBack) == true){
				stateDisarmed = true;
				stateArming1 = false;
				stateArming2 = false;
				stateArmed = false;
				stateFiring1 = false;
				stateFiring2 = false;
				t_motor.SetPosition(0);

			}
			toggleIntake();
//			if (stick2.GetRawButton(5) == true){
//				intake_Spin_Motor.Set(1);
//			}
//			if (stick2.GetRawButton(5) == false){
//				intake_Spin_Motor.Set(0);
//			}
			if (stick.GetRawButton(2) == true and buttonpress2 == false){
				myServo->SetAngle(175);
			}
			if (stick.GetRawButton(2) == false and buttonpress2 == true){
				myServo->SetAngle(5);


			}
//			servoSetPos(servoState);
//			myServo->Set(.5);
			Wait(0.005);// wait for a motor update time
//			motorSetPos(launcherState);
		}
	}
Ejemplo n.º 23
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler16(real *a) { scaler(a,16,0.0625); }
Ejemplo n.º 24
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler4096(real *a) { scaler(a,4096,0.000244140625); }
Ejemplo n.º 25
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler8(real *a) { scaler(a,8,0.125); }
Ejemplo n.º 26
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler8192(real *a) { scaler(a,8192,0.0001220703125); }
void SpeedDialConfigController::InitPageViewsL()
{
	m_suggestions_model.Populate();

	GenericGrid* grid = m_dialog->GetWidgetCollection()->GetL<QuickGrid>("suggestions_grid");

	for (unsigned i = 0; i < ARRAY_SIZE(m_page_views); ++i)
	{
		ANCHORD(OpString8, composite_name);
		LEAVE_IF_ERROR(composite_name.AppendFormat("Page%d", i));
		QuickComposite* composite = m_dialog->GetWidgetCollection()->GetL<QuickComposite>(composite_name);
		composite->AddOpWidgetListener(*this);

		ANCHORD(OpString8, button_name);
		LEAVE_IF_ERROR(button_name.AppendFormat("PageButton%d", i));
		QuickButton* button = m_dialog->GetWidgetCollection()->GetL<QuickButton>(button_name);
		m_page_views[i].m_button = button;
		button->GetOpWidget()->SetButtonTypeAndStyle(OpButton::TYPE_CUSTOM, OpButton::STYLE_IMAGE);
		button->GetOpWidget()->GetBorderSkin()->SetImage("Speed Dial Configuration Dialog Image");
		button->GetOpWidget()->GetAction()->SetActionData(i);
		grid->RegisterToButtonGroup(button->GetOpWidget());
		composite->GetOpWidget()->SetActionButton(button->GetOpWidget());

		ANCHORD(OpString8, name_name);
		LEAVE_IF_ERROR(name_name.AppendFormat("PageName%d", i));
		QuickButton* name = m_dialog->GetWidgetCollection()->GetL<QuickButton>(name_name);
		m_page_views[i].m_name = name;
		name->GetOpWidget()->SetButtonTypeAndStyle(OpButton::TYPE_CUSTOM, OpButton::STYLE_TEXT);
		name->GetOpWidget()->SetJustify(JUSTIFY_CENTER, TRUE);
		name->GetOpWidget()->SetEllipsis(g_pcui->GetIntegerPref(
					PrefsCollectionUI::EllipsisInCenter) == 1 ? ELLIPSIS_CENTER : ELLIPSIS_END);
		name->GetOpWidget()->SetRelativeSystemFontSize(95);
		name->GetOpWidget()->GetBorderSkin()->SetImage("Speed Dial Configuration Dialog Page Title");

		SpeedDialSuggestionsModelItem* item = m_suggestions_model.GetItemByIndex(i);
		if (!item)
			continue;

		if (!DocumentView::IsUrlRestrictedForViewFlag(item->GetURL().CStr(), DocumentView::ALLOW_ADD_TO_SPEED_DIAL))
			continue;

		LEAVE_IF_ERROR(m_page_views[i].m_name->SetText(item->GetTitle()));

		ANCHORD(URL, url);
		url = g_url_api->GetURL(item->GetURL());
		m_page_views[i].m_url = url;
		m_page_views[i].m_original_url.Set(item->HasDisplayURL() ? item->GetURL().CStr() : UNI_L(""));
		LEAVE_IF_ERROR(m_page_views[i].m_name->SetText(item->GetTitle()));
		button->GetOpWidget()->SetFixedImage(TRUE);

		if (DocumentView::GetType(item->GetURL().CStr()) != DocumentView::DOCUMENT_TYPE_BROWSER)
		{
			Image img;
			DocumentView::GetThumbnailImage(item->GetURL().CStr(), img);
			button->GetOpWidget()->GetForegroundSkin()->SetBitmapImage(img);
		}
		else
		{
			// Opera redirect urls may not point to particular partner;
			// we don't want to allow such generic redirects to land in speeddial.
			if (item->GetURL().Find(OPERA_REDIRECT_URL) == 0)
				LEAVE_IF_ERROR(m_page_views[i].StartResolvingURL());

			OpRect size(0, 0, button->GetPreferredWidth(), button->GetPreferredHeight());
			button->GetOpWidget()->AddPadding(size);

#ifdef PIXEL_SCALE_RENDERING_SUPPORT
			INT32 scale = static_cast<DesktopOpSystemInfo*>(g_op_system_info)->GetMaximumHiresScaleFactor();
			PixelScaler scaler(scale);
			size = TO_DEVICE_PIXEL(scaler, size);
#endif // PIXEL_SCALE_RENDERING_SUPPORT

			LEAVE_IF_ERROR(g_thumbnail_manager->RequestThumbnail(
				url,
				FALSE, // check_if_expired
				FALSE, // reload
				OpThumbnail::SpeedDial, // mode
				size.width, size.height // target size
				));
		}

		OpInputAction* action = button->GetOpWidget()->GetAction();
		action->SetActionData(i);
		action->SetActionDataString(item->GetDisplayURL());
		action->SetActionDataStringParameter(item->GetTitle());
		action->SetActionObject(m_page_views[i].m_button->GetOpWidget());
	}
}
Ejemplo n.º 28
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler4(real *a) { scaler(a,4,0.25); }
Ejemplo n.º 29
0
Archivo: sr.c Proyecto: gdkar/djbfft
void scaler256(real *a) { scaler(a,256,0.00390625); }