if(reader.get("image", imagefile)
&& reader.get("speed", speed)) {
set_image(imagefile, speed);
+ } else {
+ std::vector <unsigned int> bkgd_top_color, bkgd_bottom_color;
+ if(reader.get_vector("top_color", bkgd_top_color) &&
+ reader.get_vector("bottom_color", bkgd_bottom_color))
+ set_gradient(Color(bkgd_top_color), Color(bkgd_bottom_color));
}
-
- std::vector <unsigned int> bkgd_top_color, bkgd_bottom_color;
- if(reader.get_vector("top_color", bkgd_top_color) &&
- reader.get_vector("bottom_color", bkgd_bottom_color))
- set_gradient(Color(bkgd_top_color), Color(bkgd_bottom_color));
}
Background::~Background()
gradient_bottom = bottom;
delete image;
- image = new Surface(top, bottom, screen->w, screen->h);
+ image = new Surface(top, bottom, SCREEN_WIDTH, SCREEN_HEIGHT);
}
void
int sy = int(-context.get_translation().y * speed) % image->h - image->h;
context.push_transform();
context.set_translation(Vector(0, 0));
- for(int x = sx; x < screen->w; x += image->w)
- for(int y = sy; y < screen->h; y += image->h)
+ for(int x = sx; x < SCREEN_WIDTH; x += image->w)
+ for(int y = sy; y < SCREEN_HEIGHT; y += image->h)
context.draw_surface(image, Vector(x, y), layer);
context.pop_transform();
}