Modder Application

Status
Not open for further replies.

Doomsday31415

Member
Modder
Mar 31, 2026
2
1
230
Pronouns
He/him
Been working on a microgame pack for CoopWare, and ended up making a variation of Dragonary's Display Coordinates mod that also does Lakitu's position as well as Mario's rotation. Figured I'd upload it here, but need approval first.

Code:

LUA:
-- name: Display Coordinates DX
-- description: Display the XYZ coordinates of Mario and Lakitu, as well as Mario's rotation, on the HUD.\n\nMod created by Doomsday31415.\nBased on mod by Dragonary.

function DrawText(text, x, y)
    -- render to native screen space, with the MENU font
    djui_hud_set_resolution(RESOLUTION_DJUI);
    djui_hud_set_font(FONT_MENU);

    -- get width of screen and text
    local screenWidth = djui_hud_get_screen_width()
    local width = djui_hud_measure_text(text)

    -- get height of screen and text
    local screenHeight = djui_hud_get_screen_height()
    local height = 64

    -- negative means from the right/bottom
    if x < 0 then
        x = screenWidth - width + x
    end
    
    if y < 0 then
        y = screenHeight - height + y
    end

    -- set color and render
    djui_hud_set_color(255, 255, 255, 255);
    djui_hud_print_text(text, x, y, 1);
end

function OnHudRender()
    local rotation = gMarioStates[0].faceAngle.y
    
    if rotation < 0 then
        DrawText(string.format("ROT : -0X%04X", -rotation), 20, -190)
    else
        DrawText(string.format("ROT : 0X%04X", rotation), 20, -190)
    end
    
    DrawText(string.format("X : %.2f", gMarioStates[0].pos.x), 20, -130)
    DrawText(string.format("Y : %.2f", gMarioStates[0].pos.y), 20, -70)
    DrawText(string.format("Z : %.2f", gMarioStates[0].pos.z), 20, -10)
    
    DrawText(string.format("X : %.2f", gLakituState.pos.x), -20, -130)
    DrawText(string.format("Y : %.2f", gLakituState.pos.y), -20, -70)
    DrawText(string.format("Z : %.2f", gLakituState.pos.z), -20, -10)
end

hook_event(HOOK_ON_HUD_RENDER, OnHudRender)

Sample image:


Thanks!
 
  • Like
Reactions: Wahluigi
Status
Not open for further replies.

Users who are viewing this thread