Sorry to bother y’all but y’see my code here has a itty bitty problem… I cannot get the text to show inside the rounded rectangle. I haven’t been able to solve it… Can you help me?
--# Main
-- RoundRect
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
parameter.text("Text", "ExampleText")
parameter.number("xPosition", 0, 690, 0 )
parameter.number("yPosition", 0, HEIGHT - 60, 0)
parameter.number("Width", 60, WIDTH, 60)
parameter.number("Height", 60, HEIGHT, 21)
parameter.number("Radius", 0, 30, 30)
parameter.number("AmountofRed", 0, 250, 250)
parameter.number("AmountofGreen", 0, 250, 250)
parameter.number("AmountofBlue", 0, 250, 250)
parameter.number("AmountofOpacity", 0, 250, 250)
end
-- This function gets called once every frame
function draw()
background(100, 120, 160)
font("Georgia")
fill(0, 0, 0, 255)
fontSize(20)
textWrapWidth(70)
text(Text, xPosition, yPosition)
-- This sets a dark background color
background(0, 0, 0, 0)
-- This sets the line thickness
strokeWidth(10)
-- Do your drawing here
fill(255, 0, 0, 255)
fill(AmountofRed, AmountofGreen, AmountofBlue, AmountofOpacity)
strokeWidth(5)
roundRect(xPosition, yPosition, Width, Height, Radius)
end
--# RoundRect
function roundRect(x,y,w,h,r)
pushStyle()
insetPos = vec2(x+r,y+r)
insetSize = vec2(w-2*r,h-2*r)
--Copy fill into stroke
local red,green,blue,a = fill()
stroke(red,green,blue,a)
noSmooth()
rectMode(CORNER)
rect(insetPos.x,insetPos.y,insetSize.x,insetSize.y)
if r > 0 then
smooth()
lineCapMode(ROUND)
strokeWidth(r*2)
line(insetPos.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y)
line(insetPos.x, insetPos.y,
insetPos.x, insetPos.y + insetSize.y)
line(insetPos.x, insetPos.y + insetSize.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
line(insetPos.x + insetSize.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
end
popStyle()
end
Thank y’all in advance.