This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gfcwfzkm's profile picture

OpenPeripheral Terminal Glass print a picture/icon

Started by gfcwfzkm, 28 March 2014 - 07:03 PM
gfcwfzkm #1
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
CometWolf #2
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)
gfcwfzkm #3
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" ?
CometWolf #4
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.gamepedia.com/Data_values
meta is the sub value, eg id 38 meta 15 would be black wool.
gfcwfzkm #5
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 on 29 March 2014 - 08:53 AM
CometWolf #6
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 on 29 March 2014 - 10:00 AM
theoriginalbit #7
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.
gfcwfzkm #8
Posted 29 March 2014 - 12:15 PM
=) Thanks

(problem solved) =D