| 116 | } |
| 117 | |
| 118 | void Background::Draw(Bitmap& dst) { |
| 119 | Rect dst_rect = dst.GetRect(); |
| 120 | |
| 121 | // If the background doesn't fill the screen, center it to support custom resolutions |
| 122 | BitmapRef center_bitmap = bg_bitmap ? bg_bitmap : fg_bitmap; |
| 123 | if (center_bitmap) { |
| 124 | if (center_bitmap->GetWidth() < Player::screen_width) { |
| 125 | dst_rect.x += Player::menu_offset_x; |
| 126 | dst_rect.width = MENU_WIDTH; |
| 127 | } |
| 128 | if (center_bitmap->GetHeight() < Player::screen_height) { |
| 129 | dst_rect.y += Player::menu_offset_y; |
| 130 | dst_rect.height = MENU_HEIGHT; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | dst_rect.x += Main_Data::game_screen->GetShakeOffsetX(); |
| 135 | dst_rect.y += Main_Data::game_screen->GetShakeOffsetY(); |
| 136 | |
| 137 | if (bg_bitmap) |
| 138 | dst.TiledBlit(-Scale(bg_x), -Scale(bg_y), bg_bitmap->GetRect(), *bg_bitmap, dst_rect, 255); |
| 139 | |
| 140 | if (fg_bitmap) |
| 141 | dst.TiledBlit(-Scale(fg_x), -Scale(fg_y), fg_bitmap->GetRect(), *fg_bitmap, dst_rect, 255); |
| 142 | |
| 143 | if (tone_effect != Tone()) { |
| 144 | dst.ToneBlit(0, 0, dst, dst.GetRect(), tone_effect, Opacity::Opaque()); |
| 145 | } |
| 146 | } |
nothing calls this directly
no test coverage detected