Hello dear friends and fellow coders.
I am sorry to bother you but I seem to have ran into a “brick wall” situation.
You see, my code here has a problem. I cant make it change the font size.
Could you maybe give me some pointers?
My code:
– text printer
– Use this function to perform your initial setup
function setup()
print(“Hello World!”)
– my text input box variable thingy
parameter.text(“TEXT”, “HELLO WORLD”)
–the font size parameter that doesn’t work
parameter.number(“fontsize”, 20, 80, 40 )
SizeOfFont = fontsize
end
– This function gets called once every frame
function draw()
background(0, 0, 0, 255)
fill(255)
fontSize(SizeOfFont)
font("AmericanTypewriter-Bold")
textWrapWidth(WIDTH)
text(TEXT, WIDTH/2, 450)
-- This sets a dark background color
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
end
For some reason the code isn’t Formatting itself properly so sorry for that inconvenience
Once again, thank you everyone.
-- text printer
--Use this function to perform your initial setup
function setup()
print("Hello World!") -- my text input box variable thingy
parameter.text("TEXT", "HELLO WORLD") --the font size parameter that doesn't work
parameter.number("fontsize", 20, 80, 40 )
SizeOfFont = fontsize
end
function draw()
background(0, 0, 0, 255)
fill(255)
fontSize(SizeOfFont)
font("AmericanTypewriter-Bold")
textWrapWidth(WIDTH)
text(TEXT, WIDTH/2, 450)
-- This sets a dark background color
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
end
@TheRogueBatcher, simply delete the line that says SizeOfFont = fontsize it’s useless because it isn’t being updated, only set on setup. Then change in draw to do fontSize(fontsize)
@TheRogueBatcher There is an edit button when you hover over one of your post, we would much appreciate it if you used that to test those sort of things :).