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

Method Menu_AdjustCursor

client/src/main/java/jake2/client/Menu.java:4385–4423  ·  view source on GitHub ↗
(menuframework_s m, int dir)

Source from the content-addressed store, hash-verified

4383 * next available * slot.
4384 */
4385 static void Menu_AdjustCursor(menuframework_s m, int dir) {
4386 menucommon_s citem;
4387
4388 /*
4389 * * see if it's in a valid spot
4390 */
4391 if (m.cursor >= 0 && m.cursor < m.nitems) {
4392 if ((citem = Menu_ItemAtCursor(m)) != null) {
4393 if (citem.type != MTYPE_SEPARATOR)
4394 return;
4395 }
4396 }
4397
4398 /*
4399 * * it's not in a valid spot, so crawl in the direction indicated until
4400 * we * find a valid spot
4401 */
4402 if (dir == 1) {
4403 while (true) {
4404 citem = Menu_ItemAtCursor(m);
4405 if (citem != null)
4406 if (citem.type != MTYPE_SEPARATOR)
4407 break;
4408 m.cursor += dir;
4409 if (m.cursor >= m.nitems)
4410 m.cursor = 0;
4411 }
4412 } else {
4413 while (true) {
4414 citem = Menu_ItemAtCursor(m);
4415 if (citem != null)
4416 if (citem.type != MTYPE_SEPARATOR)
4417 break;
4418 m.cursor += dir;
4419 if (m.cursor < 0)
4420 m.cursor = m.nitems - 1;
4421 }
4422 }
4423 }
4424
4425 static void Menu_Center(menuframework_s menu) {
4426 int height;

Callers 8

Default_MenuKeyMethod · 0.95
Multiplayer_MenuDrawMethod · 0.95
Keys_MenuDraw_fMethod · 0.95
Options_MenuDrawMethod · 0.95
Game_MenuDrawMethod · 0.95
SaveGame_MenuDrawMethod · 0.95
MenuDrawMethod · 0.95
MenuKeyMethod · 0.95

Calls 1

Menu_ItemAtCursorMethod · 0.95

Tested by

no test coverage detected