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

Method RefreshCursor

src/window.cpp:250–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void Window::RefreshCursor() {
251 cursor_needs_refresh = false;
252
253 int cw = cursor_rect.width;
254 int ch = cursor_rect.height;
255
256 BitmapRef cursor1_bitmap = Bitmap::Create(cw, ch);
257 BitmapRef cursor2_bitmap = Bitmap::Create(cw, ch);
258
259 cursor1_bitmap->Clear();
260 cursor2_bitmap->Clear();
261
262 Rect dst_rect;
263
264 // Border Up
265 dst_rect = { 8, 0, cw - 16, 8 };
266 cursor1_bitmap->TiledBlit(8, 0, Rect(64 + 8, 0, 16, 8), *windowskin, dst_rect, 255);
267 cursor2_bitmap->TiledBlit(8, 0, Rect(96 + 8, 0, 16, 8), *windowskin, dst_rect, 255);
268
269 // Border Down
270 dst_rect = { 8, ch - 8, cw - 16, 8 };
271 cursor1_bitmap->TiledBlit(8, 0, Rect(64 + 8, 32 - 8, 16, 8), *windowskin, dst_rect, 255);
272 cursor2_bitmap->TiledBlit(8, 0, Rect(96 + 8, 32 - 8, 16, 8), *windowskin, dst_rect, 255);
273
274 // Border Left
275 dst_rect = { 0, 8, 8, ch - 16 };
276 cursor1_bitmap->TiledBlit(0, 8, Rect(64, 8, 8, 16), *windowskin, dst_rect, 255);
277 cursor2_bitmap->TiledBlit(0, 8, Rect(96, 8, 8, 16), *windowskin, dst_rect, 255);
278
279 // Border Right
280 dst_rect = { cw - 8, 8, 8, ch - 16 };
281 cursor1_bitmap->TiledBlit(0, 8, Rect(96 - 8, 8, 8, 16), *windowskin, dst_rect, 255);
282 cursor2_bitmap->TiledBlit(0, 8, Rect(128 - 8, 8, 8, 16), *windowskin, dst_rect, 255);
283
284 // Upper left corner
285 cursor1_bitmap->Blit(0, 0, *windowskin, Rect(64, 0, 8, 8), 255);
286 cursor2_bitmap->Blit(0, 0, *windowskin, Rect(96, 0, 8, 8), 255);
287
288 // Upper right corner
289 cursor1_bitmap->Blit(cw - 8, 0, *windowskin, Rect(96 - 8, 0, 8, 8), 255);
290 cursor2_bitmap->Blit(cw - 8, 0, *windowskin, Rect(128 - 8, 0, 8, 8), 255);
291
292 // Lower left corner
293 cursor1_bitmap->Blit(0, ch - 8, *windowskin, Rect(64, 32 - 8, 8, 8), 255);
294 cursor2_bitmap->Blit(0, ch - 8, *windowskin, Rect(96, 32 - 8, 8, 8), 255);
295
296 // Lower right corner
297 cursor1_bitmap->Blit(cw - 8, ch - 8, *windowskin, Rect(96 - 8, 32 - 8, 8, 8), 255);
298 cursor2_bitmap->Blit(cw - 8, ch - 8, *windowskin, Rect(128 - 8, 32 - 8, 8, 8), 255);
299
300 // Background
301 dst_rect = { 8, 8, cw - 16, ch - 16 };
302 cursor1_bitmap->TiledBlit(8, 8, Rect(64 + 8, 8, 16, 16), *windowskin, dst_rect, 255);
303 cursor2_bitmap->TiledBlit(8, 8, Rect(96 + 8, 8, 16, 16), *windowskin, dst_rect, 255);
304
305 cursor1 = cursor1_bitmap;
306 cursor2 = cursor2_bitmap;
307}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected