Page 1 of 1

[Help] HUD API Images not rendering.

PostPosted: Thu Apr 18, 2013 18:31
by Traxie21
Here's the code I'm trying to use ATM, I've tried everything I can think of, but all that happens is the text string is rendered where the image should be.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
user:hud_add( {
                type = "image",
                position = {x=0.8, y=0.02},
                name = "Potion Effect Notification",
                text = "potions_hud_bg.png",
                scale = {x=2, y=2},
            })

PostPosted: Thu Apr 18, 2013 18:37
by BlockMen
Same problem. My hud def is:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local myhud =
{
    type = "image",
    position = {x=0.5, y=0.5},
    scale = {x=2, y=2},
    text = {"test_sand.png"},
}


When i use type = "text" and text = "test" it works fine

PostPosted: Thu Apr 18, 2013 19:25
by Traxie21
From IRC:

<hmmm>: [type field] is actually hud_elem_type.

The documentation is incorrect, submitting pull request.

Fixed code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
user:hud_add( {
               hud_elem_type = "image",
                position = {x=0.8, y=0.02},
                name = "Potion Effect Notification",
                text = "potions_hud_bg.png",
                scale = {x=2, y=2},
            })

PostPosted: Fri Apr 19, 2013 08:55
by 4aiman
Any screenshots of working HUDs? ;)

PostPosted: Fri Apr 19, 2013 10:54
by jojoa1997
Oh! HUDs can be used in armr and food mods.

PostPosted: Fri Apr 19, 2013 11:57
by Traxie21
Potions will have a HUD as soon as I finalize it.

PostPosted: Fri Apr 19, 2013 12:13
by jojoa1997
Nice. Maybe make a function where you can say what certain nodes drop xp maybe. Then you can use that to brew potions. I might be making an brewing stand for potions.

PostPosted: Fri Apr 19, 2013 13:13
by BlockMen
I made a simple test mod for the new LUA HUD: Hungry

---


Traxie21 wrote:From IRC:

<hmmm>: [type field] is actually hud_elem_type.

The documentation is incorrect, submitting pull request.

Fixed code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
user:hud_add( {
               hud_elem_type = "image",
                position = {x=0.8, y=0.02},
                name = "Potion Effect Notification",
                text = "potions_hud_bg.png",
                scale = {x=2, y=2},
            })



Thanks btw.