http://www.computercraft.info/forums2/index.php?/topic/14120-glass-v0002-pixel-api/
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
CCGlass v0.0001 alpha
Started by Geforce Fan, 17 June 2013 - 06:00 PMPosted 17 June 2013 - 08:00 PM
Moved to programs to get more attention, aswell as it belongs in there
http://www.computercraft.info/forums2/index.php?/topic/14120-glass-v0002-pixel-api/
http://www.computercraft.info/forums2/index.php?/topic/14120-glass-v0002-pixel-api/
Posted 17 June 2013 - 09:04 PM
Why is this in the media section?
Posted 17 June 2013 - 09:08 PM
Please read the OP before asking questions, because it's explained in the OP :)/>
Also, added stuff to the post.
Also, added stuff to the post.
Posted 17 June 2013 - 11:09 PM
/offtopic I agree with Bubba. Why is this in the Media section. I'd say it should be in General.
/ontopic
That GUI looks like the Plastic GUI.
/ontopic
That GUI looks like the Plastic GUI.
Posted 17 June 2013 - 11:21 PM
Yes, it is a bit like plastic. The home screen is anyway.(also the colors are copied from plastic's code, I don't know how to make them, so I just did that :P/>
For most practical applications(also the help screen) there is a function called tinyPrint that is all size 1 and allows for 5 lines on the screen. It also allows for customized colors. It's current use is Help, but it'll be super useful when I add a Books app.
For most practical applications(also the help screen) there is a function called tinyPrint that is all size 1 and allows for 5 lines on the screen. It also allows for customized colors. It's current use is Help, but it'll be super useful when I add a Books app.
Posted 17 June 2013 - 11:33 PM
also the colors are copied from plastic's code, I don't know how to make them, so I just did that :P/>
0xRRGGBB
where each set of two is 0-255 or 00-FF in HEX and represents either Red ( R ), Green ( G ), or Blue ( B ).
Use the hex values with a 0x in the font.
Posted 18 June 2013 - 10:25 AM
Is there any documentation? From what I gather, this is some sort of API.
Posted 18 June 2013 - 02:05 PM
Alright, I'll just tell you the functions & variables.
glass - The variable wrapped to the peripheral
tinyPrint("text", line, color) - prints up to 5 lines of text on the screen, like in help. Line can be 1-5
highPrint("text") - Prints texts in red like in the home screen, where it says "Welcome username!"
midPrint("text") - Prints text in green like in the home screen, where it says "Glass V0.0001"
lowPrint("text") - Prints text in light blue like in the home screen, where it says "Do $$help for help."
tinyClear() - Clears Tiny Text
bigClear() - Clears Big text(highPrint, midPrint and lowPrint text.)
bigBox - The gray box where text is printed.
ALSO: For Glass to able to launch your application it need to put in in the folder CCGlass/
C&Ping this into the OP.
glass - The variable wrapped to the peripheral
tinyPrint("text", line, color) - prints up to 5 lines of text on the screen, like in help. Line can be 1-5
highPrint("text") - Prints texts in red like in the home screen, where it says "Welcome username!"
midPrint("text") - Prints text in green like in the home screen, where it says "Glass V0.0001"
lowPrint("text") - Prints text in light blue like in the home screen, where it says "Do $$help for help."
tinyClear() - Clears Tiny Text
bigClear() - Clears Big text(highPrint, midPrint and lowPrint text.)
bigBox - The gray box where text is printed.
ALSO: For Glass to able to launch your application it need to put in in the folder CCGlass/
C&Ping this into the OP.
This is a program for Terminal Glasses, but it does have it's own API. It's sort of like a system for the Terminal Glasses so you don't need a ton of them do do all your tasks.Is there any documentation? From what I gather, this is some sort of API.
Posted 19 June 2013 - 06:53 AM
I got bored… so if you're still struggling with the HEX colours, and know RGB colours well enough, here is a function I wrote just for you :)/>also the colors are copied from plastic's code, I don't know how to make them, so I just did that :P/>
function rgb( _r, _g, _b )
return bit.bor( bit.blshift( bit.bor( bit.blshift( _r, 8 ), _g ), 8 ), _b )
end
Example usage:
--# previously you did this
glcolors.blue = 0x7dd2e4
glass.addBox(160, 0, 5, 60, glcolors.blue, 0.75)
--# now you could do this
glcolors.blue = rgb(125, 210, 228)
glass.addBox(160, 0, 5, 60, glcolors.blue, 0.75)
If you're curious
Spoiler
this is the inverse function
local function hex( _hex )
return bit.band( bit.brshift( _hex, 16 ), 0xff ), bit.band( bit.brshift( _hex, 8 ), 0xff ), bit.band( _hex, 0xff )
end
Example usage:
local r,g,b = hex( 0x7dd2e4 )
Posted 19 June 2013 - 08:53 AM
I got bored… so if you're still struggling with the HEX colours, and know RGB colours well enough, here is a function I wrote just for you :)/>also the colors are copied from plastic's code, I don't know how to make them, so I just did that :P/>function rgb( _r, _g, _b ) return bit.bor( bit.blshift( bit.bor( bit.blshift( _r, 8 ), _g ), 8 ), _b ) end
Example usage:--# previously you did this glcolors.blue = 0x7dd2e4 glass.addBox(160, 0, 5, 60, glcolors.blue, 0.75) --# now you could do this glcolors.blue = rgb(125, 210, 228) glass.addBox(160, 0, 5, 60, glcolors.blue, 0.75)
If you're curiousSpoiler
this is the inverse functionlocal function hex( _hex ) return bit.band( bit.brshift( _hex, 16 ), 0xff ), bit.band( bit.brshift( _hex, 8 ), 0xff ), bit.band( _hex, 0xff ) end
Example usage:local r,g,b = hex( 0x7dd2e4 )
Ha, I like that!
Posted 19 June 2013 - 09:03 AM
Thanks :)/>Ha, I like that!
I would have made an rgba version too, but your mod doesn't accept it in that format. :P/>
Posted 19 June 2013 - 06:35 PM
Thanks. I'll probably use this later on, I know a place where I can get colors from :3
(in RGB)
(in RGB)
Posted 19 June 2013 - 10:42 PM
Anyone know why this only displays "Welcome (your username)" on SMP then crashes?
Also: theoriginalbit, do you mind if I add that function to the GlassAPI?
Also: theoriginalbit, do you mind if I add that function to the GlassAPI?
Posted 19 June 2013 - 11:47 PM
Posted 20 June 2013 - 12:12 AM
Thanks. I'll probably use this later on, I know a place where I can get colors from :3 (in RGB)
That's fine. :)/> just put a little note like soAlso: theoriginalbit, do you mind if I add that function to the GlassAPI?
-- kindly created by TheOriginalBIT
:P/> :P/>Posted 20 June 2013 - 05:35 PM
Thanks! This will hopefuly make it easier for app makers to use their own custom colors! :)/>Thanks. I'll probably use this later on, I know a place where I can get colors from :3 (in RGB)That's fine. :)/> just put a little note like soAlso: theoriginalbit, do you mind if I add that function to the GlassAPI?:P/> :P/>-- kindly created by TheOriginalBIT
I put credits to you at the top credit thing, and right before the function.
Posted 21 June 2013 - 04:30 AM
You know, you could just use ColorHexa to choose colors (what I did) :P/>. It supports RGB to hex values and vice-verca: http://www.colorhexa.com/7dd2e4
Posted 21 June 2013 - 09:10 PM
You know, you could just use ColorHexa to choose colors (what I did) :P/>. It supports RGB to hex values and vice-verca: http://www.colorhexa.com/7dd2e4
And also words :P/> Like "sky blue", "crimson", "deep purple", etc…