MCPcopy Create free account
hub / github.com/EasyRPG/Player / Draw

Method Draw

src/background.cpp:118–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void 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}

Callers

nothing calls this directly

Calls 8

GetRectMethod · 0.80
GetShakeOffsetXMethod · 0.80
GetShakeOffsetYMethod · 0.80
TiledBlitMethod · 0.80
ToneBlitMethod · 0.80
ToneClass · 0.70
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected