示例#1
0
static void PlotAll (Scene& scene, Plotter& plotter)
{
  Vector x(1,steps), Pot(1,steps);
  for (int i = 1; i <= steps; i++) {
    x(i) = xmin + (i-1)*(xmax-xmin)/(steps-1);
    Pot(i) = V(x(i));
  }
  plotter.clear();
  double ymin = -1, ymax = min(6.0,max(1.0,Max(Pot))); // betwwen 1 and 6 !!
  plotter.axisframe(xmin,xmax,ymin,ymax, "x","V(x), Psi(x)");
  plotter.style(plotter.LINES);

  plotter.plot(x,Pot);			// potential
  scene.Line(xmin,ymin,xmin,ymax);
  scene.Line(xmax,ymin,xmax,ymax);

  scene.SetColor(ColorB(255,0,0));	// wave function
  plotter.plot(x,Psi);

  scene.SetColor(ColorB(0,0,255));	// eigen energy
  scene.Line(xmin,E,xmax,E);	
  scene.SetTextStyle(Standard);
  char label[60];
  sprintf(label,"E=%.8g",E);
  scene.Write(xmin+0.01,E+0.05,label);
}
示例#2
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Plotter w;
    w.show();
    return a.exec();
}
示例#3
0
void CMenuRecord::slot_do_boxing()
{
   // CDlgRecordWave *dlg = new CDlgRecordWave(this);

    Plotter *plotter = new Plotter(this);

    int numPoints = 100;
    QVector<QPointF> points0;
    QVector<QPointF> points1;
    for (int x = 0; x < numPoints; ++x) {
        points0.append(QPointF(x, uint(qrand()) % 100));
        points1.append(QPointF(x, uint(qrand()) % 100));
    }
    plotter->setCurveData(0, points0);
    plotter->setCurveData(1, points1);

    PlotSettings settings;
    settings.minX = 0.0;
    settings.maxX = 100.0;
    settings.minY = 0.0;
    settings.maxY = 100.0;
    plotter->setPlotSettings(settings);

   plotter->show();
}
示例#4
0
/* A dive plot widget prototype to show proof of concept.
 *
 * Based on example from GUI Programming with Qt4 (Summerfield/Blanchette).
 *
 * We read a dive in from a simple text file and render the dive plot on
 * a QWidget using basic QPainter operations.  We show the colour of the
 * depth profile changing with dy/dx, the ability to fill the enclosed area
 * with a gradient and some simple drawing and text placement.
 *
 * Panning and zooming are pretty much unaltered from the example, with the
 * exception of mods to reverse the direction of the vertical axis to use
 * a "going down means counting up" convention which makes more sense for
 * a dive.
 *
 * Aim is to show proof of concept to non-Qt programmers working on subsurface.
 * Question: what if any capabilities are needed that aren't on show here?
 *
*/
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Plotter plotter;
    plotter.setWindowTitle(QObject::tr("Dive Plotter"));
    readDive(&plotter, "dive.txt");
    plotter.show();
    return app.exec();
}
示例#5
0
 void paddleType::erase (Plotter& g)
 {
     if (oldLoc.getX() != loc.getX())
     {
         g.setColor(black);
         for(int i = -width/2; i <= width/2; i ++)
         {
             g.plot(oldLoc.getX() + i, oldLoc.getY(), SQUARE);
         }
     }
 }
示例#6
0
 void paddleType::draw (Plotter& g)
 {
     if (oldLoc.getX() != loc.getX())
     {
         g.setColor(color);
         for(int i = -width/2; i <= width/2; i ++)
         {
             g.plot(loc.getX() + i, loc.getY(), SQUARE);
         }
     }
     oldLoc = loc;
 }
示例#7
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Plotter plotter;
    plotter.setWindowTitle(QObject::tr("Plotter"));

	// function above - set data and paint plotter curves
    readFlightCurves(&plotter, "in1.txt");

    plotter.show();
    return app.exec();
}
示例#8
0
void SidePanel::start (void)
{
  if (parse_entries() == false) return;		// parsing error occured

  if (Shoot() == false) {			// make a shoot
    if (E < -1)    
      MpMessageDialog::Warning(title,"Reached E < -1", "Enter other start value"); 
    plotter->callback = NULL;                   // avoid redraw
    return;
  }

  char buf[64];                                 // update results strings

  sprintf(buf,"Eigen energy: %.8g", E);	
  energy_win->Set(buf);

  sprintf(buf,"Iterations: %d", iter); 
  iter_win->Set(buf);

  sprintf(buf,"Function calls:  %d", fcn_calls); 
  fcncalls_win->Set(buf);

  plotter->callback = PlotAll;			// now plot the stuff
  plotter->Redraw();  
}
void Ship::Draw(double x, double y)
{
    // draw ship
    Plotter p;




    for (int r = 0; r < 5; r++)
    {
        for (int c = 0; c < 5; c++)
        {
            p.setColor(rocket[r][c]);
            p.plot(x + c, y + r, SQUARE);
        }
    }

}
示例#10
0
float RateAlgo::getRate(float scaleFactor)
{

    if (plotter_)
        plotter_->scale(scaleFactor) ;

    return scaleFactor*getPrescaledCounts();

}
示例#11
0
文件: main.cpp 项目: ahmadyan/RRT
int main(int argc, char** argv) {
	if(argc<2){
		cout << "Configuration file is not specified." << endl ;
		return -1;
	}

	Configuration* config = new Configuration(argv[1]);
	Plotter* plot = new Plotter(gnuPlot, config);

	cout << "generating voronoi diagram..." << endl ;
	float* xValues = new float[100];
	float* yValues = new float[100];
	long count = 100;
	for(int i=0;i<count;i++){
		xValues[i] = utility::unifRand(-10, 10);
		yValues[i] = utility::unifRand(-10, 10);
	}

	VoronoiDiagramGenerator vdg;
	vdg.generateVoronoi(xValues,yValues,count, -10,10,-10,10,0);

	cout << "here it comes..." << endl ;
	vdg.resetIterator();

	float x1,y1,x2,y2;

	printf("\n-------------------------------\n");
	while(vdg.getNext(x1,y1,x2,y2))
	{
		plot->drawLine(x1,y1,x2, y2);
		printf("GOT Line (%f,%f)->(%f,%f)\n",x1,y1,x2, y2);

	}

	plot->close();
	delete config;
	delete plot;
	return 0;
}
示例#12
0
void Histogram::plot(Plotter& plotter) {
    const double tot = static_cast<double>(total());
    const double order_error = log10(error());

    std::ostringstream cmd;
    cmd << "set title 'O(Error) = " << order_error << "'\n"
        << "set xrange [-pi:pi]\n"
        << "set yrange [" << 0.0 << ":" << (maximum + minimum) << "]\n"
        << "plot '-' with linespoints pointtype 5"
        << " linecolor rgbcolor 'black' title 'Reference',"
        << " '-' with linespoints pointtype 7"
        << " linecolor rgbcolor 'blue' title 'Simulation'\n";
    for (unsigned k = 0; k < nbins; k++)
        cmd << angle(k, nbins) << " " << reference[k] << "\n";
    cmd << "\ne\n";
    for (unsigned k = 0; k < nbins; k++)
        cmd << angle(k, nbins) << " "
            << static_cast<double>(histogram[k]) / tot << "\n";
    cmd << "\ne\n";
    plotter.send(cmd.str());
}
示例#13
0
int draw_axes(Plotter& plot, WorldPt cross, Color col_ax, int ax_thickness,
		float x_tic, float y_tic, bool labels, int width, int prec,
		Color col_lab)
{
	int const EPS = 1.0e-6f;
	int const fontsize = 15;

	float tic_pos;
	float direction;
	float limit;
	float tic_length;

	WorldPt wl;
	WorldPt wu;
	WorldPt p;
	ScrPt pv;

	int labelPixs;

	Color col_prev;
	int thick_prev;

	String str;

	Font my_font;
	if (!my_font.LoadFromFile("FreeMono.ttf", fontsize))
	{
		return EXIT_FAILURE;
	}

	col_prev = plot.get_draw_col();
	plot.set_draw_col(col_ax);
	thick_prev = plot.get_draw_thick();
	plot.set_draw_thick(ax_thickness);

	plot.get_world_ext(wl, wu);

	p.x = wl.x;
	p.y = cross.y;
	plot.move(p);

	p.x = wu.x;
	plot.draw(p);

	p.x = cross.x;
	p.y = wl.y;
	plot.move(p);

	p.y = wu.y;
	plot.draw(p);

	direction = 1.0f;
	limit = wu.x * (1.0f + EPS);

	if (limit == 0.0f)
	{
		limit = EPS * abs(wl.x);
	}
	x_tic = abs(x_tic);
	tic_length = 0.01f * (wu.y - wl.y);

	while (true)
	{
		tic_pos = cross.x + x_tic;
		while (direction * tic_pos <= limit)
		{
			p.x = tic_pos;
			p.y = cross.y;

			if (labels)
			{
				plot.world2scr(p, pv);

				labelPixs = 6 * width * fontsize / 10;
				pv.x -= labelPixs / 2;

				ostringstream ss;
				ss << setw(width) << setprecision(prec) << fixed << right
						<< tic_pos;
				str.SetText(ss.str());
				str.SetFont(my_font);
				str.SetColor(col_lab);
				str.SetSize(fontsize);
				str.SetPosition(pv.x, pv.y);
				plot.Draw(str);
			}

			plot.move(p);
			p.y += tic_length;
			plot.draw(p);
			tic_pos += x_tic;
		}

		if (direction < 0.0f)
		{
			break;
		}

		direction = -1.0f;
		limit = direction * wl.x;
		if (limit == 0.0f)
		{
			limit = EPS * abs(wu.x);
		}
		x_tic = -x_tic;
	}

	tic_length = 0.02f * (wu.x - wl.x);

	direction = 1.0f;
	limit = wu.y * (1.0f + EPS);
	if (limit == 0.0)
	{
		limit = EPS;
	}
	y_tic = abs(y_tic);
	tic_length = 0.01f * (wu.x - wl.x);

	while (true)
	{
		tic_pos = cross.y + y_tic;
		while (direction * tic_pos <= limit)
		{
			p.x = cross.x;
			p.y = tic_pos;

			if (labels)
			{
				plot.world2scr(p, pv);
				pv.y -= fontsize * 6 / 10;
				pv.x -= width * fontsize * 2 / 3;

				ostringstream ss;
				ss << setw(width) << setprecision(prec) << fixed << right
						<< tic_pos;
				str.SetText(ss.str());
				str.SetFont(my_font);
				str.SetColor(col_lab);
				str.SetSize(fontsize);
				str.SetPosition(pv.x, pv.y);
				plot.Draw(str);
			}

			plot.move(p);
			p.x += tic_length;

			plot.draw(p);
			tic_pos += y_tic;
		}

		if (direction < 0.0)
		{
			break;
		}

		direction = -1.0f;
		limit = direction * wl.y;
		if (limit == 0.0f)
		{
			limit = EPS;
		}
		y_tic = -y_tic;
	}
	plot.set_draw_col(col_prev);
	plot.set_draw_thick(thick_prev);
	return 0;
}
示例#14
0
 inline type operator()(math::Int<2>& index)
 {
     plotter.setPos(index);
     return this->plotter;
 }
示例#15
0
int main() {
   float lumi = 2260.;
   TString dir = "/Users/dygyun/Top/HET_v763";
   //TString dir = "/xrootd/store/user/tjkim/ntuples/hep/V6";
   TFile * fA = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fB = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fC = TFile::Open(dir+"/hep_WJets.root");
   TFile * fD = TFile::Open(dir+"/hep_DYJets.root");
   TFile * fE = TFile::Open(dir+"/hep_DYJets_10to50.root");
   TFile * fI = TFile::Open(dir+"/hep_SingleTop_t.root");
   TFile * fJ = TFile::Open(dir+"/hep_SingleTbar_t.root");
   TFile * fK = TFile::Open(dir+"/hep_SingleTop_tW.root");
   TFile * fL = TFile::Open(dir+"/hep_SingleTbar_tW.root");
   TFile * fN = TFile::Open(dir+"/hep_WW.root");
   TFile * fO = TFile::Open(dir+"/hep_WZ.root");
   TFile * fM = TFile::Open(dir+"/hep_ZZ.root");
//   TFile * fP = TFile::Open(dir+"/hep_qcd.root");
   
   TH1F * hBsemi = (TH1F*) fA->Get("TopTree/EventSummary");
   TH1F * hB = (TH1F*) fB->Get("TopTree/EventSummary");
   TH1F * hC = (TH1F*) fC->Get("TopTree/EventSummary");
   TH1F * hD = (TH1F*) fD->Get("TopTree/EventSummary");
   TH1F * hE = (TH1F*) fE->Get("TopTree/EventSummary");
   TH1F * hI = (TH1F*) fI->Get("TopTree/EventSummary");
   TH1F * hJ = (TH1F*) fJ->Get("TopTree/EventSummary");
   TH1F * hK = (TH1F*) fK->Get("TopTree/EventSummary");
   TH1F * hL = (TH1F*) fL->Get("TopTree/EventSummary");
   TH1F * hN = (TH1F*) fN->Get("TopTree/EventSummary");
   TH1F * hO = (TH1F*) fO->Get("TopTree/EventSummary");
   TH1F * hM = (TH1F*) fM->Get("TopTree/EventSummary");
 //  TH1F * hP = (TH1F*) fP->Get("");
   int nevt = -1;

   MyAnalysis *A = new MyAnalysis();
   TChain* ch = new TChain("TopTree/events");
   ch->Add(Form("%s/hep_data_json.root",dir.Data()), nevt);
   ch->Process(A);
   
   MyAnalysis_others *B = new MyAnalysis_others(1,1,831.8,lumi,hB->GetBinContent(1));
   TChain* ch2 = new TChain("TopTree/events");
   ch2->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
   ch2->Process(B);
   //////
   MyAnalysis_Sig *Bsemi = new MyAnalysis_Sig(1,1,831.8,lumi,hBsemi->GetBinContent(1));
   TChain* ch2semi = new TChain("TopTree/events");
   ch2semi->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
ch2semi->Process(Bsemi);
///////// 
   MyAnalysis *C = new MyAnalysis(1,1,61524,lumi,hC->GetBinContent(2));
   TChain* ch3 = new TChain("TopTree/events");
   ch3->Add(Form("%s/hep_WJets.root",dir.Data()),nevt);
   ch3->Process(C);
   
   MyAnalysis *D = new MyAnalysis(1,1,6025.2,lumi,hD->GetBinContent(1));
   TChain* ch4 = new TChain("TopTree/events");
   ch4->Add(Form("%s/hep_DYJets.root",dir.Data()),nevt);
   ch4->Process(D);
  
   MyAnalysis *E = new MyAnalysis(1,1,18610.0,lumi,hE->GetBinContent(1));
   TChain* ch5 = new TChain("TopTree/events");
   ch5->Add(Form("%s/hep_DYJets_10to50.root",dir.Data()),nevt);
   ch5->Process(E);
 
   MyAnalysis *I = new MyAnalysis(1,1,44.33,lumi,hI->GetBinContent(1));
   TChain* ch6 = new TChain("TopTree/events");
   ch6->Add(Form("%s/hep_SingleTop_t.root",dir.Data()),nevt);
   ch6->Process(I);
  
   MyAnalysis *J = new MyAnalysis(1,1,26.38,lumi,hJ->GetBinContent(1));
   TChain* ch7 = new TChain("TopTree/events");
   ch7->Add(Form("%s/hep_SingleTbar_t.root",dir.Data()),nevt);
   ch7->Process(J);

   MyAnalysis *K = new MyAnalysis(1,1,35.6,lumi,hK->GetBinContent(1));
   TChain* ch8 = new TChain("TopTree/events");
   ch8->Add(Form("%s/hep_SingleTop_tW.root",dir.Data()),nevt);
   ch8->Process(K);

   MyAnalysis *L = new MyAnalysis(1,1,35.6,lumi,hL->GetBinContent(1));
   TChain* ch9 = new TChain("TopTree/events");
   ch9->Add(Form("%s/hep_SingleTbar_tW.root",dir.Data()),nevt);
   ch9->Process(L);
   
   MyAnalysis *N = new MyAnalysis(1,1,118.7,lumi,hN->GetBinContent(1));
   TChain* ch10 = new TChain("TopTree/events");
   ch10->Add(Form("%s/hep_WW.root",dir.Data()),nevt);
   ch10->Process(N);

   MyAnalysis *O = new MyAnalysis(1,1,47.13,lumi,hO->GetBinContent(1));
   TChain* ch11 = new TChain("TopTree/events");
   ch11->Add(Form("%s/hep_WZ.root",dir.Data()),nevt);
   ch11->Process(O);
   
   MyAnalysis *M = new MyAnalysis(1,1,16.523,lumi,hM->GetBinContent(1));
   TChain* ch12 = new TChain("TopTree/events");
   ch12->Add(Form("%s/hep_ZZ.root",dir.Data()),nevt);
   ch12->Process(M);
 
Plotter P;

   for (int i=0; i < 6 ;i++) {
   //for (int i=0; i < D->histograms.size() ;i++) {
     //merge for DY
     D->histograms[i]->Add(E->histograms[i]);
     //merge for SingleTop
     I->histograms[i]->Add(J->histograms[i]);
     I->histograms[i]->Add(K->histograms[i]);
     I->histograms[i]->Add(L->histograms[i]);
    //////merge for VV 
     N->histograms[i]->Add(O->histograms[i]);
     N->histograms[i]->Add(M->histograms[i]);
////tt bkg     
  //   B->histograms[i]->Add(Bhad->histograms[i]);

} 
   P.SetData(A->histograms, std::string("Data"));
   P.AddBg(Bsemi->histograms, std::string("TTbar"));
   P.AddBg(C->histograms, std::string("Wjets"));
   P.AddBg(D->histograms, std::string("DY"));
   P.AddBg(I->histograms, std::string("Single Top"));
   P.AddBg(N->histograms, std::string("VV"));
   
  P.AddBg(B->histograms, std::string("TTOthers"));

   P.Plot(string("results_ABCD.pdf"));

   TFile * outA = TFile::Open("hist_data.root","RECREATE");
   for(int i=0; i < A->histograms.size(); i++){
     TH1F * tmp = (TH1F *) A->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < A->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) A->histograms_2D[i];
     tmp->Write();
   }
   outA->Write();
   outA->Close();

   TFile * outB = TFile::Open("hist_TT_others.root","RECREATE");
   for(int i=0; i < B->histograms.size(); i++){
     TH1F * tmp = (TH1F *) B->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < B->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) B->histograms_2D[i];
     tmp->Write();
   }
   outB->Write();
   outB->Close();

   TFile * outBsemi = TFile::Open("hist_TT_SemiLeptonic.root","RECREATE");
   for(int i=0; i < Bsemi->histograms.size(); i++){
     TH1F * tmp = (TH1F *) Bsemi->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < Bsemi->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) Bsemi->histograms_2D[i];
     tmp->Write();
   }
   outBsemi->Write();
   outBsemi->Close();
   
  TFile * outC = TFile::Open("hist_WJets.root","RECREATE");
   for(int i=0; i < C->histograms.size(); i++){
     TH1F * tmp = (TH1F *) C->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < C->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) C->histograms_2D[i];
     tmp->Write();
   }
   outC->Write();
   outC->Close();

   TFile * outD = TFile::Open("hist_DY.root","RECREATE");
   for(int i=0; i < D->histograms.size(); i++){
     TH1F * tmp = (TH1F *) D->histograms[i];
     tmp->Write();
    }
   for(int i=0; i < D->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) D->histograms_2D[i];
     tmp->Write();
   }
   outD->Write();
   outD->Close();
   
    TFile * outI = TFile::Open("hist_SingleTop.root","RECREATE");
    for(int i=0; i < I->histograms.size(); i++){
      TH1F * tmp = (TH1F *) I->histograms[i];
      tmp->Write();
    }
   for(int i=0; i < I->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) I->histograms_2D[i];
     tmp->Write();
   }
    outI->Write();
    outI->Close();

  TFile * outN = TFile::Open("hist_VV.root","RECREATE");
   for(int i=0; i < N->histograms.size(); i++){
     TH1F * tmp = (TH1F *) N->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < N->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) N->histograms_2D[i];
     tmp->Write();
   }
   outN->Write();
   outN->Close();
}
示例#16
0
文件: main.cpp 项目: pyrech/telemetre
int main(int argc, char *argv[])
{

/************************************************* example as a standalone window ************************************************************/
/*	
	//create an application
	QApplication app(argc, argv);					
   
	// create and fill the data vector
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));

	// create and fill another data vector
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));

	//creat the plotter and set its data
	Plotter *plotter = new Plotter;							// create a plotter
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		//initialise the axis
	plotter->setCurveData(0,data1);							//set the first plotter data set
	plotter->setCurveData(1,data2);							//set the second plotter data set
	
	//show the plotter widget
	plotter->show();										
    
	//execute the application
	return app.exec();						
*/
/*********************************************************************************************************************************************/


/******************************************** example of use as a widget among others *********************************************************/
	
	//create an application
	QApplication app(argc, argv);				

	// create a window
    QWidget *window = new QWidget;
	window->setWindowTitle("Plotter widget application");

	// create a label
	QLabel *label = new QLabel("<h2><i><font color=blue> Plot example </font> </i></h2>");
	
	//create the plotter and its data
	Plotter *plotter = new Plotter;	
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		
	
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));
	
	plotter->setCurveData(0,data1);							
	plotter->setCurveData(1,data2);							
	

	//layout the widgets
	QVBoxLayout *layout = new QVBoxLayout;
	layout -> addWidget (label);
	layout -> addWidget (plotter);
	window->setLayout(layout);
	
	//show the window
	window->show();

	//execute the application
	return app.exec();	
	
/*********************************************************************************************************************************************/


}
/**
  * Creates an exact copy of this diagram.
  */
Plotter* Plotter::clone() const
{
    Plotter* newDiagram = new Plotter( new Private( *d ) );
    newDiagram->setType( type() );
    return newDiagram;
}
示例#18
0
void Frame::Resize (int w, int h)
{
  SetSize(w,h);
  panel->Configure(panel->Width(),h);  // fixed width of panel
  plotter->Resize(w-panel->Width(),h); // resize drawing area 
}
示例#19
0
文件: main.cpp 项目: vin/doeke-m4
int main(int argc, char *argv[]) {
  FILE* fp = fopen("config.txt", "r");
  if (fp) {
    int a, b;
    if (fscanf(fp," cores %d", &a) == 1) plotter.n_threads = a;
    if (fscanf(fp," def_res %d %d", &a, &b) == 2) {
      gfx.screen_w_default = a;
      gfx.screen_h_default = b;
    }
    if (fscanf(fp," max_iter %d", &a) == 1) plotter.max_iter = a;
  }

  if (SDL_Init(SDL_INIT_EVERYTHING) == -1 || !gfx.init()) return 1;

  plotter.init();
  plotter.resize(gfx.get_screen_w(), gfx.get_screen_h());
  plotter.plot();

  while (true) {
    frame_time = SDL_GetTicks();
    input.update();

    if (input.key_pressed(SDLK_ESCAPE) || input.is_quitting())
      break;

    if (input.key_down( SDLK_LCTRL ) &&
               input.mouse_pressed(SDL_BUTTON_LEFT)) {
      plotter.center();
    } else if (input.mouse_pressed(SDL_BUTTON_LEFT)) {
      if (input.key_down(SDLK_LSHIFT)) {
        plotter.zoom(zoom_factor * 5);
      } else {
        plotter.zoom(zoom_factor);
      }
    } else if (input.mouse_pressed(SDL_BUTTON_RIGHT)) {
      if (input.key_down(SDLK_LSHIFT)) {
        plotter.zoom(1/(zoom_factor * 5));
      } else {
        plotter.zoom(1/zoom_factor);
      }
    }

    if (input.key_pressed(SDLK_f)) {
      plotter.end_plotting();
      gfx.toggle_fullscreen();
      plotter.resize(gfx.get_screen_w(), gfx.get_screen_h());
      plotter.plot();
      //zoom_on();
    }

    if (input.key_pressed(SDLK_p)) {
      plotter.print_pos();
    }

    gfx.update();
    int time_rem = 1000 / FPS - (SDL_GetTicks() - frame_time);
    if (time_rem >= 5)
      SDL_Delay(time_rem);
  }
  plotter.end_plotting();

  SDL_Quit();
  return 0;
}
//Picture that prints rocket
void printPicture(char ch)
{
    Plotter screen;
    int x=200;
    int y=200;

    if(ch=='@')
      {
          screen.setColor(darkgreen);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }
      else if(ch=='0')
      {
          screen.setColor(darkgreen);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='8')
      {
          screen.setColor(green);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='b')
      {
          screen.setColor(blue);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='C')
      {
          screen.setColor(yellow);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='G')
      {
          screen.setColor(darkyellow);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
      else if(ch=='O')
      {
          screen.setColor(black);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }


      else if(ch=='#')
      {
          screen.setColor(red);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }
      else if (ch==';')
      {
          screen.setColor(red);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }

      else if(ch==',')
      {
          screen.setColor(white);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }

      else if(ch=='+')
      {
        screen.setColor(grey);
         screen.plot(x,y,SQUARE);
         x++;
          y++;
      }
      else if(ch=='`')
      {
         screen.setColor(grey);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
      else if (ch=='.')
      {
         screen.setColor(lightgrey);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
       else if (ch=='B')
      {
         screen.setColor(cyan);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
      else if (ch=='W')
      {
         screen.setColor(white);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
      else if (ch=='w')
      {
         screen.setColor(white);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
       else if(ch=='*')
      {
          cout<<endl;
          x++;
          y++;
      }
      else if (ch==' ')
      {
          screen.setColor(black);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }
}
//Function that prints names
bool backgroundIntro()
{
    ifstream data;
    POINT p;
    Plotter screen;
/*    HWND consoleWnd = GetConsoleWindow();*/

    Sleep(100);
    //PlaySound("C:\Users\Abril Resendiz\SkyDrive\Documents\ProjectFinal\ProjectFinal\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(yellow);
    screen.move(30,23);
    cout<<"Created By:";
    Sleep(2000);


    Sleep(100);
    //PlaySound("C:\Users\Abril Resendiz\SkyDrive\Documents\ProjectFinal\ProjectFinal\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(green);
    screen.move(30,25);
    cout<<"Abril Resendiz";
    Sleep(2000);


    // PlaySound("C:\Users\Abril Resendiz\SkyDrive\Documents\ProjectFinal\ProjectFinal\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(yellow);
    screen.move(30,27);
    cout<<"Daniel Holt";
    Sleep(2000);


  //  PlaySound("C:\\Users\\Alex\\Desktop\\CB\\ProjectFinal\\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(green);
    screen.move(30,29);
    cout<<"Maggie Schmeltekopf";
    Sleep(2000);



    //  PlaySound("C:\\Users\\Alex\\Desktop\\CB\\ProjectFinal\\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(yellow);
    screen.move(30,31);
    cout<<"Victoria Robinson";
    Sleep(2000);


    // PlaySound("C:\Users\Abril Resendiz\SkyDrive\Documents\ProjectFinal\ProjectFinal\\357mag.wav", NULL, SND_ASYNC);
    screen.setColor(green);
    screen.move(30,33);
    cout<<"Emily Peirce";
    Sleep(2000);
    screen.clear();

    return exit;

}