[solved] HUD image element not displaying

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

[solved] HUD image element not displaying

by stu » Sun Aug 03, 2014 18:42

Could someone please tell me what is wrong with this 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
minetest.register_on_joinplayer(function(player)
   minetest.after(1, function(player)
      player:hud_add({
         hud_elem_type = "image",
         position = {x=0.5,y=0.5},
         scale = 1,
         text = "hud.png",
         alignment = {x=0,y=0},
      })
   end, player)
end)

No errors but no image is displayed (hud.png definitely does exist)
If I change element type to "text" I see hud.png written in the center of the window
If I change the image name to something non-existent then it reports that a dummy
image was generated but this is not displayed either.

Tested with 0.4.9 and 0.4.10
Last edited by stu on Sun Aug 03, 2014 19:02, edited 2 times in total.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: HUD image element not displaying

by kaeza » Sun Aug 03, 2014 18:54

stu wrote:
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
scale = 1

The scale parameter is a table {x=xscale, y=yscale}. See if that fixes the error.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: HUD image element not displaying

by stu » Sun Aug 03, 2014 19:01

kaeza wrote:
stu wrote:
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
scale = 1

The scale parameter is a table {x=xscale, y=yscale}. See if that fixes the error.

Thanks kaeza, looks like I misread the docs, although it seems a bit odd that it needs to be a table if only the x scale is used. nvm, it's working fine now :-)
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 8 guests