Posted 21 May 2015 - 03:06 AM
Oi! Have you ever wanted to draw a bar on a screen in computercraft? Probably Not!
Here, I have for you the most useless api Ever made! The Bar Api!
This api exposes two simple functions.
drawBar(x,y,time,color,color1)
x - X position on the screen
y - Y position on the screen
time - time it takes to load said bar to 100%
color - Background Color of the Bar
color1 - Front Color of the Bar
This function draws a bar on a timer.
and,
drawBarPercent(x,y,percent)
x - X position on the screen
y - Y position on the screen
percent - percent already done of the bar.
The Story behind this goes, I was sitting in class (Computer Class lol) and I felt like doing CC, so I went to the Mimic CC emulator, and I wrote this.
So, I figured I would post this even though It isn't the most useful api, but I figure someone can use it ;)/>
Pastebin: http://pastebin.com/eEAgUZuQ or simply pastebin get eEAgUZuQ bar
Example code:
BTW, sorry for my messy code and posts :lol:/>
Have a nice Day, XMedders
Here, I have for you the most useless api Ever made! The Bar Api!
This api exposes two simple functions.
drawBar(x,y,time,color,color1)
x - X position on the screen
y - Y position on the screen
time - time it takes to load said bar to 100%
color - Background Color of the Bar
color1 - Front Color of the Bar
This function draws a bar on a timer.
and,
drawBarPercent(x,y,percent)
x - X position on the screen
y - Y position on the screen
percent - percent already done of the bar.
The Story behind this goes, I was sitting in class (Computer Class lol) and I felt like doing CC, so I went to the Mimic CC emulator, and I wrote this.
So, I figured I would post this even though It isn't the most useful api, but I figure someone can use it ;)/>
Pastebin: http://pastebin.com/eEAgUZuQ or simply pastebin get eEAgUZuQ bar
Example code:
t = term
t.clear()
t.setCursorPos(1,1)
pos = {t.getCursorPos()}
t.write("Cursor Pos X: ")
i = read()
t.write("Cursor Pos Y: ")
i1 = read()
t.write("Percent: ")
i2 = read()
--term.setBackgroundColor(colors.green)
bar.drawBarPercent(i,i1,i2)
t.setCursorPos(2,3)
BTW, sorry for my messy code and posts :lol:/>
Have a nice Day, XMedders