Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "testApp.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- //--------------------------------------------------------------------------------
- void testApp::setup(){
- skyScraper.loadImage("images/1_3d2.jpg");
- women.loadImage("images/New_pict.jpg");
- }
- //---------------------------------------------------------------------------------
- void testApp::draw(){
- ofSetColor(255);
- ifstream file("hand_in_4.txt");
- //--------------------------Loop
- for(int i = 1; i < 10; i++){
- file >> type;
- //--------------------------Images
- if(type == "Image")
- {
- file >> imageName;
- //--------------------------First picture
- if (imageName=="1_3d2.jpg")
- {
- file >> x >> y >> w >> h;
- ofSetColor(255);
- skyScraper.draw(x,y,1024,768);
- }
- //--------------------------Second picture
- if(imageName=="New_pict.jpg")
- {
- file >> x >> y >> w >> h;
- ofSetColor(255);
- women.draw(x,y,1600,1200);
- }
- }
- //--------------------------Circle
- if(type=="circle")
- {
- file >> x >> y >> w;
- ofSetColor(0, 255, 0);
- ofCircle(x, y, w);
- }
- //--------------------------Rectangle
- if(type=="rect")
- {
- file >> x >> y >> w >> h;
- ofSetColor(255,0,0);
- ofRect(x,y,w,h);
- }
- //--------------------------Square
- if(type=="square")
- {
- file >> x >> y >> w;
- ofSetColor(255,0,0);
- ofRect(x,y,w,w);
- }
- //--------------------------Triangle
- if(type=="triangle")
- {
- file >> x >> y >> x2 >> y2 >> x3 >> y3;
- ofSetColor(255,0,0);
- ofTriangle(x, y, x2, y2, x3, y3);
- }
- //--------------------------Color
- if(type=="setColor")
- {
- file >> x >> y >> z;
- ofSetColor(x, y, z);
- }
- //--------------------------NoFill
- if(type=="NoFill")
- {
- ofNoFill();
- }
- //--------------------------Fill
- if(type=="Fill")
- {
- ofFill();
- }
- //--------------------------Line
- if(type=="Line")
- {
- file >> x >> y >> x2 >> y2;
- ofSetColor(255, 0, 0);
- ofLine(x, y, x2, y2);
- }
- //--------------------------Ellipse
- if(type=="Ellipse")
- {
- file >> x >> y >> w >> h;
- ofEllipse(x, y, w, h);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement