how do i draw a sprite on the HUD?

El3ctr0h3ll

recolours 👊
i want to make a mod pizza tower tv ui mod but i just cant find out how to draw the tv in the hud (because i dont kown lua code/srb2 lua functions i am new to moding and this is gonit to be my fist mod if i make it)
 

You'll have to know how to use the hud draw functions, how to cache a graphics patch and draw it on the screen.

HUD Draw example:
local function drawExample(v, player, cam)
    local patch = v.cachePatch("TVICON") --check if you have a graphic named TVICON in your file
    if (patch == nil) then return end --do not draw if it's missing

    --draw it to x=280, y=10, right aligned, in Sonic's skincolor
    --the screen area is assumed to be 320x200 pixels
    v.draw(280, 10, patch, V_SNAPTORIGHT, v.getColormap("sonic"))
end

addHook("HUD", drawExample, "game")

You'll also need to use the "HUD" hook to add it to the "game" hudtype. (The wiki says the argument order is "v, cam, player", though I believe it's supposed to be "v, player, cam").

If these sound too complicated, you might want to start by reading up on what hooks are, and how you connect functions to them.
 
thanks! i had the idea that i need to use the "HUD" hook and the "game" hudtype i just hade not idea how to put it together .thanks for the help :wonderful:
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top