Functions:
-Utility-
angel.clear() - clears the screen and sets the cursor to 1,1
angel.setPos(x,y) - cursor set position alternative/shortcut
angel.disableTermination() - disables ctrl+t
angel.enableTermination() - enables ctrl+t
-Angel Wing Pixel-
angel.wingPixel(x,y,color)
-Angel Wing Line Creator-
angel.wingLine(x,y,line length,line type, line color)
(I will be adding more line types in later updates)
-Download-
having an issue with dropbox at the moment…
-Change Log-
Spoiler
AngelAPI v2.3[Fixed]
-TOB accidentally changed a vital part of Wing Line
AngelAPI v2.2
-Code Optimized (thanks to TheOriginalBIT)
AngelAPI v2.1
-removed an unnecessary section of code in the Wing Pixel function
AngelAPI v2.0
+Release
-CODE-
Spoiler
--+Angel API v2.3+--
---------------------
--Utility Functions--
---------------------
function wingLogo(x,y)
term.clear()
term.setCursorPos(x,y)
print(" _______ _______ ")
print(" {_____. .____. ._____} ")
print(" {____. .. .____} ")
print(" {____. .____} ")
print(" ___ ,____ ____, ____, _, ")
print(" ||_|| || || || __, ||___, || ")
print(" || || || || ||__|| ||___, ||___, ")
end
function clear()
term.clear()
term.setCursorPos(1,1)
end
--Slowly prints text to the screen
function slowP(text)
textutils.slowPrint(text)
end
--set cursor shortcut
function setPos(x,y)
term.setCursorPos(x,y)
end
--Funtions to disable and then re-enable program termination(ctrl+t)
function disableTermination()
pulloriginal = os.pullEvent
os.pullEvent = os.pullEventRaw
end
function enableTermination()
if os.pullEvent ~= pulloriginal then
os.pullEvent = pulloriginal
end
end
--[[
--------------
Angel Wing Pixel v1.1
--------------
Creates a pixel at x,y of the desired color
]]--
function wingPixel(x, y, color)
local colorcheck = term.isColor and term.isColor()
color = color % 16
setPos(x,y)
if colorcheck then
term.setBackgroundColor( 2 ^ ( color - 1 ) )
end
write(" ")
if colorcheck then
term.setBackgroundColor( colors.black )
end
end
--[[
-------------------
Angel Wing Line Creator v1.0
-------------------
\Line Types/
1 = ---------------------------
2 = ===========================
3 = +-------------------------+
\Math/
first off if you set the x to 1(left edge of screen) the most frames that will fit to the right edge is 50
the math for this function is configured to automatically adjust itself so it will stop at the edge of the
screen, even if you input something crazy like:
angel.wingLine(25,5,60,1) <-this will make a white line type 1 at 25,5 and will stop when it hits the edge of the screen
\Color/
*if you use this on a color terminal you can set a 5th parameter, color!
ex: angel.wingLine(4,8,25,2,4)
the colors are represented by numbers
1 - white
2 - orange
3 - magenta
4 - lightBlue
5 - yellow
6 - lime
7 - pink
8 - gray
9 - lightGray
10 - cyan
11 - purple
12 - blue
13 - brown
14 - green
15 - red
16 - black
*without a 5th parameter it will just default it to white
--]]
--(Xpos,Ypos,line length,line type,line color)
function wingLine(x,y,frames,wLType,color )
local colorcheck = term.isColor()
local sizeX, sizeY = term.getSize()
--sets a maximum of sizeX - 1 frames
if frames > ( sizeX - 1) then
frames = sizeX - 1
end
--sets a maximum of frames x
if x > 50 then
x = sizeX - 1
end
--sets a maximum of 19 y
if y > sizeY then
y = sizeY
end
--sets max line type number
if wLType > 3 then
wLType = 1
end
--Code for correcting the line
local offset = 0
local xframes = x + frames
local correction = xframes-50
if frames <= 50 and frames > x then
if xframes > 50 then
offset = correction
end
elseif frames <= 50 and frames < x then
if xframes > 50 then
offset = correction
end
end
setPos(x,y)
if colorcheck then
color = 2 ^ ( color - 1 )
end
framecorrection = frames-offset
function draw( char, tWingLine )
term.setTextColor(color)
write( char )
setPos( x + 2, y )
for loadframes = 1, framecorrection do
local a = loadframes + 1
if colorcheck then
term.setTextColor(color)
end
local tpos = { term.getCursorPos() }
setPos(tpos[1] - 1,tpos[2])
write(tWingLine[a]..tWingLine[1])
if colorcheck then
term.setTextColor(1)
end
end
end
---------------------------------------------------
--line type 1
if wLType == 1 then
local char = "-"
local wingline = {
"-","-","-","-","-","-","-","-","-","-","-","-","-","-","-",
"-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-",
"-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"
}
draw( char, wingline )
--line type 2
elseif wLType == 2 then
local char = "="
local wingline = {
"=","=","=","=","=","=","=","=","=","=","=","=","=","=","=",
"=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","=",
"=","=","=","=","=","=","=","=","=","=","=","=","=","=","=","="
}
draw( char, wingline )
--line type 3
elseif wLType == 3 then
local char = "+"
local wingline = {
"+","-","-","-","-","-","-","-","-","-","-","-","-","-","-",
"-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-",
"-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"
}
draw( char, wingline )
end
end