MCPcopy Create free account
hub / github.com/demoth/jake2 / DrawCenterString

Method DrawCenterString

client/src/main/java/jake2/client/SCR.java:286–335  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284 }
285
286 private static void DrawCenterString() {
287 String cs = scr_centerstring + "\0";
288 int start;
289 int l;
290 int j;
291 int x, y;
292 int remaining;
293
294 if (cs == null)
295 return;
296 if (cs.length() == 0)
297 return;
298
299 // the finale prints the characters one at a time
300 remaining = 9999;
301
302 scr_erase_center = 0;
303 start = 0;
304
305 if (scr_center_lines <= 4)
306 y = (int) (ClientGlobals.viddef.getHeight() * 0.35);
307 else
308 y = 48;
309
310 do {
311 // scan the width of the line
312 for (l = 0; l < 40; l++)
313 if (start + l == cs.length() - 1
314 || cs.charAt(start + l) == '\n')
315 break;
316 x = (ClientGlobals.viddef.getWidth() - l * 8) / 2;
317 SCR.AddDirtyPoint(x, y);
318 for (j = 0; j < l; j++, x += 8) {
319 ClientGlobals.re.DrawChar(x, y, cs.charAt(start + j));
320 if (remaining == 0)
321 return;
322 remaining--;
323 }
324 SCR.AddDirtyPoint(x, y + 8);
325
326 y += 8;
327
328 while (start < cs.length() && cs.charAt(start) != '\n')
329 start++;
330
331 if (start == cs.length())
332 break;
333 start++; // skip the \n
334 } while (true);
335 }
336
337 private static void CheckDrawCenterString() {
338 scr_centertime_off -= cls.frametime;

Callers 1

CheckDrawCenterStringMethod · 0.95

Calls 4

AddDirtyPointMethod · 0.95
getHeightMethod · 0.80
getWidthMethod · 0.80
DrawCharMethod · 0.65

Tested by

no test coverage detected