Jump to content




OpenPeripheral Terminal Glass print a picture/icon


7 replies to this topic

#1 gfcwfzkm

  • Members
  • 32 posts

Posted 28 March 2014 - 08:03 PM

Hello Pro's

i have a little problem/question:
I want to use the OpenPeripheral Terminal Glass to print a picture/Icon. Is that possible?
I already found the command '.addIcon' but i dont understand how to use it :/

Can you pro's explain it to me (maybe a little tiny simple sample? thats the best way for me to understand something)

Thank you all =)

gfc

#2 CometWolf

  • Members
  • 1,283 posts

Posted 28 March 2014 - 08:21 PM

public ILuaObject addIcon(
  @Arg(name = "x", description = "The x position from the top left", type = LuaType.NUMBER) short x,
  @Arg(name = "y", description = "The y position from the top left", type = LuaType.NUMBER) short y,
  @Arg(name = "id", description = "The id of the item to draw", type = LuaType.NUMBER) short id,
  @Arg(name = "meta", description = "The meta of the item to draw", type = LuaType.NUMBER) short meta
){
  return addDrawable(new Drawable.ItemIcon(x, y, id, meta));
}
From what i can tell, addIcon is used to draw the picture of whatever item id you pass it, and the usage is farily straight forward.
bridge.addIcon(posX,posY,id,meta)


#3 gfcwfzkm

  • Members
  • 32 posts

Posted 28 March 2014 - 09:58 PM

And heres the problem: the usage.
i dont know how to use it. what do they mean with "id" and "meta" ?

#4 CometWolf

  • Members
  • 1,283 posts

Posted 28 March 2014 - 10:04 PM

I kinda figured you had enough of a grasp of Minecraft to know what an item id is...
http://minecraft.gam...com/Data_values
meta is the sub value, eg id 38 meta 15 would be black wool.

#5 gfcwfzkm

  • Members
  • 32 posts

Posted 29 March 2014 - 09:47 AM

ok. So the addIcon is not able to print own pics. hmm.... Its possible to set a pixel in TerminalGlass?
Oh and the addIcon-Command dont work. It just give error's back.

Edited by gfcwfzkm, 29 March 2014 - 09:53 AM.


#6 CometWolf

  • Members
  • 1,283 posts

Posted 29 March 2014 - 11:00 AM

Yes, that could be done with addBox.
I've never used addIcon myself, so i can't really diagnose that unless you give me the error message.

Edited by CometWolf, 29 March 2014 - 11:00 AM.


#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 March 2014 - 11:07 AM

addIcon is designed only for rendering Minecraft items/blocks (and mod ones too)
as CometWold said use addBox.
the syntax is
bridge.addBox(xPos, yPos, width, height, colour, opacity)
Notes:
  • width and height is effected by the players GUI scale, so setting a width and height of 1 pixel will not always be displayed this way on a clients computer.
  • colour is a hexadecimal number between 0x000000 and 0xFFFFFF you can use services such as colorhexa to get these values
  • opacity is a number between 0 and 1 and deems the percentage of transparency.


#8 gfcwfzkm

  • Members
  • 32 posts

Posted 29 March 2014 - 12:15 PM

=) Thanks

(problem solved) =D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users