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

Method Draw

src/window.cpp:60–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void Window::Draw(Bitmap& dst) {
61 if (width <= 0 || height <= 0) return;
62 if (x < -width || x > dst.GetWidth() || y < -height || y > dst.GetHeight()) return;
63
64 if (windowskin) {
65 if (width > 4 && height > 4 && (back_opacity * opacity / 255 > 0)) {
66 if (background_needs_refresh) RefreshBackground();
67
68 if (animation_frames > 0) {
69 int ianimation_count = (int)animation_count;
70
71 Rect src_rect(0, height / 2 - ianimation_count, width, ianimation_count * 2);
72
73 dst.Blit(x, y + src_rect.y, *background, src_rect, back_opacity * opacity / 255);
74 } else {
75 dst.Blit(x, y, *background, background->GetRect(), back_opacity * opacity / 255);
76 }
77 }
78
79 if (width > 0 && height > 0 && opacity > 0) {
80 if (frame_needs_refresh) RefreshFrame();
81
82 int fopacity = frame_opacity * opacity / 255;
83
84 if (animation_frames > 0) {
85 int ianimation_count = (int)animation_count;
86
87 if (ianimation_count > 8) {
88 Rect src_rect(0, height / 2 - ianimation_count, 8, ianimation_count * 2 - 16);
89
90 if (frame_left) {
91 dst.Blit(x, y + 8 + src_rect.y, *frame_left, src_rect, fopacity);
92 }
93
94 if (frame_right) {
95 dst.Blit(x + width - 8, y + 8 + src_rect.y, *frame_right, src_rect, fopacity);
96 }
97
98 dst.Blit(x, y + height / 2 - ianimation_count, *frame_up, frame_up->GetRect(), fopacity);
99 dst.Blit(x, y + height / 2 + ianimation_count - 8, *frame_down, frame_down->GetRect(), fopacity);
100 } else {
101 dst.Blit(x, y + height / 2 - ianimation_count, *frame_up, Rect(0, 0, width, ianimation_count), fopacity);
102 dst.Blit(x, y + height / 2 , *frame_down, Rect(0, 8 - ianimation_count, width, ianimation_count), fopacity);
103 }
104 } else {
105 dst.Blit(x, y, *frame_up, frame_up->GetRect(), fopacity);
106 dst.Blit(x, y + height - 8, *frame_down, frame_down->GetRect(), fopacity);
107
108 if (frame_left) {
109 dst.Blit(x, y + 8, *frame_left, frame_left->GetRect(), fopacity);
110 }
111
112 if (frame_right) {
113 dst.Blit(x + width - 8, y + 8, *frame_right, frame_right->GetRect(), fopacity);
114 }
115 }
116 }
117

Callers

nothing calls this directly

Calls 8

minFunction · 0.85
maxFunction · 0.85
BlitMethod · 0.80
GetRectMethod · 0.80
RotateZoomOpacityBlitMethod · 0.80
RectClass · 0.70
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected