MCPcopy Create free account
hub / github.com/devkitPro/3ds-hbmenu / networkDrawBot

Function networkDrawBot

source/network.c:43–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void networkDrawBot(StrId titleStrId, const char* other, bool transferring, size_t filelen, size_t filetotal)
44{
45 drawingSetMode(DRAW_MODE_DRAWING);
46 drawingSetZ(0.4f);
47
48 drawingWithColor(0x80FFFFFF);
49 drawingDrawQuad(0.0f, 60.0f, 320.0f, 120.0f);
50 drawingSubmitPrim(GPU_TRIANGLE_STRIP, 4);
51
52 textSetColor(0xFF545454);
53 textDrawInBox(textGetString(titleStrId), 0, 0.75f, 0.75f, 60.0f+25.0f, 8.0f, 320-8.0f);
54
55 char buf[256];
56 const char* text = other;
57 if (text == NULL)
58 {
59 text = buf;
60 u32 ip = gethostid();
61
62 if (ip == 0)
63 snprintf(buf, sizeof(buf), textGetString(StrId_NetworkOffline));
64 else
65 snprintf(buf, sizeof(buf), textGetString(StrId_NetworkTransferring), filetotal/1024, filelen/1024);
66 }
67
68 textDraw(8.0f, 60.0f+25.0f+8.0f, 0.5f, 0.5f, false, text);
69
70 if (transferring)
71 {
72 float progress = (float)filetotal / filelen;
73 float width = progress*320;
74
75 drawingWithColor(0xC000E000);
76 drawingDrawQuad(0.0f, 60.0f+120.0f-16.0f, width, 16.0f);
77 drawingWithColor(0xC0C0C0C0);
78 drawingDrawQuad(width, 60.0f+120.0f-16.0f, 320.0f-width, 16.0f);
79
80 snprintf(buf, sizeof(buf), "%.02f%%", progress*100);
81 textSetColor(0xFF000000);
82 textDrawInBox(buf, 0, 0.5f, 0.5f, 60.0f+120.0f-3.0f, 0.0f, 320.0f);
83 }
84}

Callers 2

netsenderDrawBotFunction · 0.85
netloaderDrawBotFunction · 0.85

Calls 9

drawingSetModeFunction · 0.85
drawingSetZFunction · 0.85
drawingWithColorFunction · 0.85
drawingDrawQuadFunction · 0.85
drawingSubmitPrimFunction · 0.85
textSetColorFunction · 0.85
textDrawInBoxFunction · 0.85
textGetStringFunction · 0.85
textDrawFunction · 0.85

Tested by

no test coverage detected