/[enigma]/enigma/src/game.cc
ViewVC logotype

Diff of /enigma/src/game.cc

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

revision 1.34 by reallysoft, Sun Jul 6 12:41:34 2003 UTC revision 1.35 by reallysoft, Sun Jul 6 15:37:23 2003 UTC
# Line 141  GameMenu::draw_background(px::GC &gc) { Line 141  GameMenu::draw_background(px::GC &gc) {
141          const int PART_HEIGHT      = SCREEN_HEIGHT/PART;          const int PART_HEIGHT      = SCREEN_HEIGHT/PART;
142    
143          // randomly choose upper-left corner (zoomxypos is always visible)          // randomly choose upper-left corner (zoomxypos is always visible)
144          int x = zoomxpos - IntegerRand(16, PART_WIDTH-16-1);          int x, y;
145          int y = zoomypos - IntegerRand(16, PART_HEIGHT-16-1);          for (int trials = 0; trials<5; ++trials) {
146                x = zoomxpos - IntegerRand(16, PART_WIDTH-16-1);
147                y = zoomypos - IntegerRand(16, PART_HEIGHT-16-1);
148    
149                x = min(max(8, x), WIDTH-(PART_WIDTH+24));
150                if (zoomypos<48 || zoomypos >= (GAME_HEIGHT-48))
151                    y = min(max(16, y), GAME_HEIGHT-(PART_HEIGHT+16));
152                else
153                    y = min(max(48, y), GAME_HEIGHT-(PART_HEIGHT+48)); // skip first and last row
154    
155                x = (x/32)*32+24;
156                y = (y/32)*32+16;
157    
158          x = min(max(0, x), WIDTH-(PART_WIDTH+16-1));              int xoff = zoomxpos-x;
159          y = min(max(0, y), GAME_HEIGHT-(PART_HEIGHT+16-1));              int yoff = zoomypos-y;
160    
161          x = (x/32)*32+24;              // fprintf(stderr, "xoff=%i, yoff=%i\n", xoff, yoff);
162          y = (y/32)*32+16;  
163                if (xoff<72 || xoff>136 || yoff<37 || yoff>96)
164                    break; // no overlap with menu -> take it
165            }
166    
167          Surface  back(video::GetScreen()->get_surface());          Surface  back(video::GetScreen()->get_surface());
168          Rect     src_area(x, y, PART_WIDTH, PART_HEIGHT);          Rect     src_area(x, y, PART_WIDTH, PART_HEIGHT);
169          Surface *src = Grab(&back, src_area);          Surface *src = Grab(&back, src_area);
170    
171          // zoom 3 times to get softer image :          const double stepsize = 0.3; // zoom multiple times for softer image
172          {          for (double zoom = stepsize; zoom <= (1.0-stepsize/2); zoom += stepsize) {
173              Surface *zoom1 = src->zoom(WIDTH/3, SCREEN_HEIGHT/3);              int      sx  = int(zoom*WIDTH+0.5);
174              Surface *zoom2 = src->zoom(WIDTH/6, SCREEN_HEIGHT/6);              int      sy  = int(zoom*SCREEN_HEIGHT+0.5);
175              zoomed         = zoom1->zoom(WIDTH, SCREEN_HEIGHT);              Surface *tmp = src->zoom(sx, sy);
176              delete zoom2;  
177              delete zoom1;              delete src;
178                src = tmp;
179          }          }
180    
181            zoomed = src->zoom(WIDTH, SCREEN_HEIGHT);
182          delete src;          delete src;
183      }      }
184    

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

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