Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. #include "testApp.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5. using namespace std;
  6.  
  7. //--------------------------------------------------------------------------------
  8. void testApp::setup(){
  9. skyScraper.loadImage("images/1_3d2.jpg");
  10. women.loadImage("images/New_pict.jpg");
  11. }
  12.  
  13. //---------------------------------------------------------------------------------
  14.  
  15. void testApp::draw(){
  16. ofSetColor(255);
  17.  
  18. ifstream file("hand_in_4.txt");
  19.  
  20. //--------------------------Loop
  21.  
  22. for(int i = 1; i < 10; i++){
  23. file >> type;
  24.  
  25. //--------------------------Images
  26.  
  27. if(type == "Image")
  28. {
  29. file >> imageName;
  30.  
  31. //--------------------------First picture
  32.  
  33. if (imageName=="1_3d2.jpg")
  34. {
  35. file >> x >> y >> w >> h;
  36. ofSetColor(255);
  37. skyScraper.draw(x,y,1024,768);
  38. }
  39.  
  40. //--------------------------Second picture
  41.  
  42. if(imageName=="New_pict.jpg")
  43. {
  44. file >> x >> y >> w >> h;
  45. ofSetColor(255);
  46. women.draw(x,y,1600,1200);
  47. }
  48. }
  49.  
  50. //--------------------------Circle
  51.  
  52. if(type=="circle")
  53. {
  54. file >> x >> y >> w;
  55. ofSetColor(0, 255, 0);
  56. ofCircle(x, y, w);
  57. }
  58.  
  59. //--------------------------Rectangle
  60.  
  61. if(type=="rect")
  62. {
  63. file >> x >> y >> w >> h;
  64. ofSetColor(255,0,0);
  65. ofRect(x,y,w,h);
  66. }
  67.  
  68. //--------------------------Square
  69.  
  70. if(type=="square")
  71. {
  72. file >> x >> y >> w;
  73. ofSetColor(255,0,0);
  74. ofRect(x,y,w,w);
  75. }
  76.  
  77. //--------------------------Triangle
  78.  
  79. if(type=="triangle")
  80. {
  81. file >> x >> y >> x2 >> y2 >> x3 >> y3;
  82. ofSetColor(255,0,0);
  83. ofTriangle(x, y, x2, y2, x3, y3);
  84. }
  85.  
  86. //--------------------------Color
  87.  
  88. if(type=="setColor")
  89. {
  90. file >> x >> y >> z;
  91. ofSetColor(x, y, z);
  92. }
  93.  
  94. //--------------------------NoFill
  95.  
  96. if(type=="NoFill")
  97. {
  98. ofNoFill();
  99. }
  100.  
  101. //--------------------------Fill
  102.  
  103. if(type=="Fill")
  104. {
  105. ofFill();
  106. }
  107.  
  108. //--------------------------Line
  109.  
  110. if(type=="Line")
  111. {
  112. file >> x >> y >> x2 >> y2;
  113. ofSetColor(255, 0, 0);
  114. ofLine(x, y, x2, y2);
  115. }
  116.  
  117. //--------------------------Ellipse
  118.  
  119. if(type=="Ellipse")
  120. {
  121. file >> x >> y >> w >> h;
  122. ofEllipse(x, y, w, h);
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement