Page 1 of 1

[solved] HUD image element not displaying

PostPosted: Sun Aug 03, 2014 18:42
by stu
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

Re: HUD image element not displaying

PostPosted: Sun Aug 03, 2014 18:54
by kaeza
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.

Re: HUD image element not displaying

PostPosted: Sun Aug 03, 2014 19:01
by stu
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 :-)