Advertisement
maddie_dlt

background.cpp

Nov 19th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. #include "background.h" //included for Background Functions
  2. #include "SDL_Plotter.h"
  3. #include <fstream>
  4. #include <vector>
  5.  
  6.  
  7. /*void displayBackground(string fileName)
  8. {
  9.  
  10. ifstream in;
  11. int colBound, rowBound;
  12. int R = 120; //red pigment
  13. int G = 120; //green pigment
  14. int B = 120; //blue pigment
  15.  
  16.  
  17. in.open (fileName.c_str());
  18.  
  19. if (in.is_open())
  20. {
  21. in >> colBound >> rowBound;
  22.  
  23. SDL_Plotter g(colBound, rowBound);
  24. vector< vector<colBound> > vec(colbound, vector<int>(colBound * 3));
  25. //Display Map to Monitor
  26. for(int col = 0; col < colBound; col++)
  27. {
  28. for(int row = 0; row < rowBound; row++)
  29. {
  30. //Read in Red, Green, and Blue values from text file
  31. in >> R >> G >> B;
  32. g.plotPixel( row , col , R , G , B);
  33.  
  34. if( row < rowBound )
  35. {
  36. //Multiplying Column by Three
  37. col *= 3;
  38. vec[row][col] = R;
  39. vec[row][col + 1] = G;
  40. vec[row][col + 2] = B;
  41. //Undo the Multiplying Column by Three
  42. col /= 3;
  43. }
  44. }
  45. }
  46. }
  47. //Close Input File (MAP)
  48. in.close();
  49. }*/
  50.  
  51. bool isBoundary(int r, int g, int b)
  52. {
  53. bool isBoundary = false;
  54.  
  55. //Roof House
  56. if (r < 211 && r > 120 && g < 152 && g > 59 && b < 184 && b > 46)
  57. isBoundary = true;
  58. //Trees
  59. else if (r < 136 && r > 56 && g < 218 && g > 101 && b < 227 && b > 19)
  60. isBoundary = true;
  61.  
  62.  
  63. return isBoundary;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement