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

Method RefreshFrame

src/window.cpp:192–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void Window::RefreshFrame() {
193 frame_needs_refresh = false;
194
195 BitmapRef up_bitmap = Bitmap::Create(width, 8);
196 BitmapRef down_bitmap = Bitmap::Create(width, 8);
197
198 up_bitmap->Clear();
199 down_bitmap->Clear();
200
201 Rect src_rect, dst_rect;
202
203 // Border Up
204 src_rect = { 32 + 8, 0, 16, 8 };
205 dst_rect = { 8, 0, max(width - 16, 1), 8 };
206 up_bitmap->TiledBlit(8, 0, src_rect, *windowskin, dst_rect, 255);
207
208 // Border Down
209 src_rect = { 32 + 8, 32 - 8, 16, 8 };
210 dst_rect = { 8, 0, max(width - 16, 1), 8 };
211 down_bitmap->TiledBlit(8, 0, src_rect, *windowskin, dst_rect, 255);
212
213 // Upper left corner
214 up_bitmap->Blit(0, 0, *windowskin, Rect(32, 0, 8, 8), 255);
215
216 // Upper right corner
217 up_bitmap->Blit(width - 8, 0, *windowskin, Rect(64 - 8, 0, 8, 8), 255);
218
219 // Lower left corner
220 down_bitmap->Blit(0, 0, *windowskin, Rect(32, 32 - 8, 8, 8), 255);
221
222 // Lower right corner
223 down_bitmap->Blit(width - 8, 0, *windowskin, Rect(64 - 8, 32 - 8, 8, 8), 255);
224
225 frame_up = up_bitmap;
226 frame_down = down_bitmap;
227
228 if (height > 16) {
229 BitmapRef left_bitmap = Bitmap::Create(8, height - 16);
230 BitmapRef right_bitmap = Bitmap::Create(8, height - 16);
231
232 // Border Left
233 src_rect = { 32, 8, 8, 16 };
234 dst_rect = { 0, 0, 8, height - 16 };
235 left_bitmap->TiledBlit(0, 8, src_rect, *windowskin, dst_rect, 255);
236
237 // Border Right
238 src_rect = { 64 - 8, 8, 8, 16 };
239 dst_rect = { 0, 0, 8, height - 16 };
240 right_bitmap->TiledBlit(0, 8, src_rect, *windowskin, dst_rect, 255);
241
242 frame_left = left_bitmap;
243 frame_right = right_bitmap;
244 } else {
245 frame_left = BitmapRef();
246 frame_right = BitmapRef();
247 }
248}
249

Callers

nothing calls this directly

Calls 5

maxFunction · 0.85
TiledBlitMethod · 0.80
BlitMethod · 0.80
RectClass · 0.70
ClearMethod · 0.45

Tested by

no test coverage detected