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

Method Draw

src/screen.cpp:32–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void Screen::Draw(Bitmap& dst) {
33 auto flash_color = Main_Data::game_screen->GetFlashColor();
34 if (flash_color.alpha > 0) {
35 if (!flash) {
36 flash = Bitmap::Create(dst.GetWidth(), dst.GetHeight(), flash_color);
37 } else {
38 flash->Fill(flash_color);
39 }
40 dst.Blit(0, 0, *flash, flash->GetRect(), 255);
41 }
42
43 if (viewport != Rect()) {
44 // Clear all parts of the screen that are out-of-bounds
45 Rect dst_rect = dst.GetRect();
46 int dx = viewport.x - dst_rect.x;
47 int dy = viewport.y - dst_rect.y;
48
49 if (dx > 0) {
50 // Left and Right
51 dst.ClearRect({0, 0, dx, dst.GetHeight()});
52 dst.ClearRect({dst.GetWidth() - dx, 0, dx, dst.GetHeight()});
53 }
54
55 if (dy > 0) {
56 // Top and Bottom
57 dst.ClearRect({0, 0, dst.GetWidth(), dy});
58 dst.ClearRect({0, dst.GetHeight() - dy, dst.GetWidth(), dy});
59 }
60 }
61}

Callers

nothing calls this directly

Calls 8

FillMethod · 0.80
BlitMethod · 0.80
GetRectMethod · 0.80
ClearRectMethod · 0.80
RectClass · 0.70
GetFlashColorMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected