/[projectaxis]/projectaxis/projectAxis/src/visual/pgminimap.cpp
ViewVC logotype

Diff of /projectaxis/projectAxis/src/visual/pgminimap.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by leiavoia, Fri Aug 8 01:52:40 2003 UTC revision 1.2 by leiavoia, Wed Aug 20 18:25:14 2003 UTC
# Line 22  pgminimap.cpp Line 22  pgminimap.cpp
22    
23    
24    
25  static const int BOUNDS_HILITE = 65;  static const int BOUNDS_HILITE = 40;
26    
27    
28    
# Line 40  PG_MiniMap::PG_MiniMap(PG_Widget *parent Line 40  PG_MiniMap::PG_MiniMap(PG_Widget *parent
40    
41    
42    
43  PG_MiniMap::~PG_MiniMap() { /* do nothing */ }  PG_MiniMap::~PG_MiniMap() {     //std::cout << "killing minimap" << endl << flush;
44    
45            }
46    
47    
48    
# Line 57  void PG_MiniMap::DrawMap() { Line 59  void PG_MiniMap::DrawMap() {
59          for (int x=0; x < themap->GetRows(); x++) {          for (int x=0; x < themap->GetRows(); x++) {
60                  for (int y=0; y < themap->GetCols(); y++) {                  for (int y=0; y < themap->GetCols(); y++) {
61    
62                          if (themap->GetObst(x,y) == OBST_BLOCK) { rm->DrawPixel(srf, x, y, 0,0,0); }                          // draw obstacle
63                          else if ( themap->GetObst(x,y) == OBST_RED ) { rm->DrawPixel(srf, x, y, 255, 0, 0); }                          switch(themap->GetObst(x,y)) {
64                          else if ( themap->GetObst(x,y) == OBST_ORANGE ) { rm->DrawPixel(srf, x, y, 255, 100, 0); }                                  case OBST_BLOCK: rm->DrawPixel(srf, x, y, 60,60,60); break;
65                          else if ( themap->GetObst(x,y) == OBST_YELLOW ) { rm->DrawPixel(srf, x, y, 255, 255, 0); }                                  case OBST_RED: rm->DrawPixel(srf, x, y, 255, 0, 0); break;
66                          else if ( themap->GetObst(x,y) == OBST_GREEN ) { rm->DrawPixel(srf, x, y, 0, 255, 0); }                                  case OBST_ORANGE: rm->DrawPixel(srf, x, y, 255, 100, 0); break;
67                          else if ( themap->GetObst(x,y) == OBST_BLUE ) { rm->DrawPixel(srf, x, y, 0, 0, 255); }                                  case OBST_YELLOW: rm->DrawPixel(srf, x, y, 255, 255, 0); break;
68                          else if ( themap->GetObst(x,y) == OBST_VIOLET) { rm->DrawPixel(srf, x, y, 255, 0, 255); }                                  case OBST_GREEN: rm->DrawPixel(srf, x, y, 0, 255, 0); break;
69                          else if ( themap->GetObst(x,y) == OBST_WHITE) { rm->DrawPixel(srf, x, y, 255, 255, 255); }                                  case OBST_BLUE: rm->DrawPixel(srf, x, y, 0, 0, 255); break;
70                          else if ( themap->GetObst(x,y) == OBST_BLACK) { rm->DrawPixel(srf, x, y, 0, 0, 0); }                                  case OBST_VIOLET: rm->DrawPixel(srf, x, y, 200, 50, 255); break;
71                          else { rm->DrawPixel(srf, x, y, 128,128,128, 255); }                                  case OBST_WHITE: rm->DrawPixel(srf, x, y, 255, 255, 255); break;
72                                    case OBST_BLACK: rm->DrawPixel(srf, x, y, 0, 0, 0); break;
73                                    default: rm->DrawPixel(srf, x, y, 128, 128, 128);
74                                    }
75    
76                            // draw pod if any
77                          Pod* oc = themap->GetOccu(x,y);                          Pod* oc = themap->GetOccu(x,y);
78                          if (oc != NULL) {                          if (oc != NULL) {
79                                  if (oc->GetAlign() == 0) { rm->DrawPixel(srf, x, y, 0, 0, 255); }                                  switch (   Axis::GetAxis(oc->GetAlign())->GetColor()  ) { // get the color of the axis of the pod
80                                  else { rm->DrawPixel(srf, x, y, 0, 255, 0); }                                          case AXISCOLOR_R: rm->DrawPixel(srf, x, y, 255, 0, 0); break;
81                                            case AXISCOLOR_O: rm->DrawPixel(srf, x, y, 255, 100, 0); break;
82                                            case AXISCOLOR_Y: rm->DrawPixel(srf, x, y, 2550, 255, 0); break;
83                                            case AXISCOLOR_G: rm->DrawPixel(srf, x, y, 0, 255, 0); break;
84                                            case AXISCOLOR_BL: rm->DrawPixel(srf, x, y, 0, 0, 255); break;
85                                            case AXISCOLOR_V: rm->DrawPixel(srf, x, y, 200, 50, 255); break;
86                                            case AXISCOLOR_W: rm->DrawPixel(srf, x, y, 255, 255, 255); break;
87                                            case AXISCOLOR_BK: rm->DrawPixel(srf, x, y, 0, 0, 0); break;
88                                            default: rm->DrawPixel(srf, x, y, 100, 100, 100); break;
89                                            }
90                                  }                                  }
91    
92                          }                          }
# Line 97  void PG_MiniMap::DrawMapWithBounds(int x Line 112  void PG_MiniMap::DrawMapWithBounds(int x
112          // create the rawmap surface to the size of the map          // create the rawmap surface to the size of the map
113          SDL_Surface* srf = SDL_CreateRGBSurface(SDL_SWSURFACE, themap->GetCols(), themap->GetRows(), 32, 0, 0, 0, 0);          SDL_Surface* srf = SDL_CreateRGBSurface(SDL_SWSURFACE, themap->GetCols(), themap->GetRows(), 32, 0, 0, 0, 0);
114    
115          int z;          int z; // + for bounds hilite
116    
117          // draw the map          // draw the map
118          rm->SLock(srf);          rm->SLock(srf);
# Line 105  void PG_MiniMap::DrawMapWithBounds(int x Line 120  void PG_MiniMap::DrawMapWithBounds(int x
120                  for (int y=0; y < themap->GetCols(); y++) {                  for (int y=0; y < themap->GetCols(); y++) {
121    
122                          if (  (x >= x1) && (x < x2) && (y >= y1) && (y < y2)  ) { z=BOUNDS_HILITE; } else { z=0; }                          if (  (x >= x1) && (x < x2) && (y >= y1) && (y < y2)  ) { z=BOUNDS_HILITE; } else { z=0; }
 /*  
   
                         switch ( themap->GetObst(x,y) ) {  
                                 case OBST_BLOCK:  break;  
                                 case OBST_RED:  break;  
                                 case OBST_ORANGE:  break;  
                                 case OBST_YELLOW:  break;  
                                 case OBST_GREEN:  break;  
                                 case OBST_BLUE:  break;  
                                 case OBST_VIOLET:  break;  
                                 case OBST_WHITE:  break;  
                                 case OBST_BLACK:  break;  
                                 default: // get the empty tile graphics  
                                         switch ( themap->GetRoadQ() ) {  
   
                                                 }  
   
123    
124                            // draw obstacle
125                            switch(themap->GetObst(x,y)) {
126                                    case OBST_BLOCK: rm->DrawPixel(srf, x, y, 60+z,60+z,60+z); break;
127                                    case OBST_RED: rm->DrawPixel(srf, x, y, 255, 0+z, 0+z); break;
128                                    case OBST_ORANGE: rm->DrawPixel(srf, x, y, 255, 100+z, 0+z); break;
129                                    case OBST_YELLOW: rm->DrawPixel(srf, x, y, 255, 255, 0+z); break;
130                                    case OBST_GREEN: rm->DrawPixel(srf, x, y, 0+z, 255, 0+z); break;
131                                    case OBST_BLUE: rm->DrawPixel(srf, x, y, 0+z, 0+z, 255); break;
132                                    case OBST_VIOLET: rm->DrawPixel(srf, x, y, 200, 50+z, 255); break;
133                                    case OBST_WHITE: rm->DrawPixel(srf, x, y, 255, 255, 255); break;
134                                    case OBST_BLACK: rm->DrawPixel(srf, x, y, 0+z, 0+z, 0+z); break;
135                                    default: rm->DrawPixel(srf, x, y, 128+z, 128+z, 128+z,255);
136                                  }                                  }
 */  
                         if (themap->GetObst(x,y) == OBST_BLOCK) { rm->DrawPixel(srf, x, y, 0+z,0+z,0+z,0); }  
                         else if ( themap->GetObst(x,y) == OBST_RED ) { rm->DrawPixel(srf, x, y, 255, 0+z, 0+z,0); }  
                         else if ( themap->GetObst(x,y) == OBST_ORANGE ) { rm->DrawPixel(srf, x, y, 255, 100+z, 0+z,0); }  
                         else if ( themap->GetObst(x,y) == OBST_YELLOW ) { rm->DrawPixel(srf, x, y, 255, 255, 0+z,0); }  
                         else if ( themap->GetObst(x,y) == OBST_GREEN ) { rm->DrawPixel(srf, x, y, 0+z, 255, 0+z,0); }  
                         else if ( themap->GetObst(x,y) == OBST_BLUE ) { rm->DrawPixel(srf, x, y, 0+z, 0+z, 255,0); }  
                         else if ( themap->GetObst(x,y) == OBST_VIOLET) { rm->DrawPixel(srf, x, y, 255, 0+z, 255,0); }  
                         else if ( themap->GetObst(x,y) == OBST_WHITE) { rm->DrawPixel(srf, x, y, 255, 255, 255,0); }  
                         else if ( themap->GetObst(x,y) == OBST_BLACK) { rm->DrawPixel(srf, x, y, 0+z, 0+z, 0+z,0); }  
                         else { rm->DrawPixel(srf, x, y, 128+z, 128+z, 128+z,255); }  
137    
138                            // draw pod if any
139                          Pod* oc = themap->GetOccu(x,y);                          Pod* oc = themap->GetOccu(x,y);
140                          if (oc != NULL) {                          if (oc != NULL) {
141                                  if (oc->GetAlign() == 0) { rm->DrawPixel(srf, x, y, 0+z, 0+z, 255,0); }                                  switch (   Axis::GetAxis(oc->GetAlign())->GetColor()  ) { // get the color of the axis of the pod
142                                  else { rm->DrawPixel(srf, x, y, 0+z, 255, 0+z,0); }                                          case AXISCOLOR_R: rm->DrawPixel(srf, x, y, 255, 0+z, 0+z); break;
143                                            case AXISCOLOR_O: rm->DrawPixel(srf, x, y, 255, 100+z, 0+z); break;
144                                            case AXISCOLOR_Y: rm->DrawPixel(srf, x, y, 2550, 255, 0+z); break;
145                                            case AXISCOLOR_G: rm->DrawPixel(srf, x, y, 0+z, 255, 0+z); break;
146                                            case AXISCOLOR_BL: rm->DrawPixel(srf, x, y, 0+z, 0+z, 255); break;
147                                            case AXISCOLOR_V: rm->DrawPixel(srf, x, y, 200+z, 50+z, 255); break;
148                                            case AXISCOLOR_W: rm->DrawPixel(srf, x, y, 255, 255, 255); break;
149                                            case AXISCOLOR_BK: rm->DrawPixel(srf, x, y, 0+z, 0+z, 0+z); break;
150                                            default: rm->DrawPixel(srf, x, y, 100+z, 100+z, 100+z); break;
151                                            }
152                                  }                                  }
   
153                          }                          }
154                  }                  }
155          rm->SUnlock(srf);          rm->SUnlock(srf);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26