-
-
Save simsaens/1330041 to your computer and use it in GitHub Desktop.
Fixed drawchar bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use this function to perform your initial setup | |
function setup() | |
fontinfo={} | |
fontinfo["#"] = { points=11, width=21, ascii=35, | |
data={ 11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6 } } | |
end | |
-- This function gets called once every frame | |
function draw() | |
background(111, 157, 106, 255) | |
-- fill(255,0,0) | |
fill(0, 0, 0, 50) | |
--rect(0,0,WIDTH,HEIGHT) | |
stroke(223, 255, 0, 255) | |
strokeWidth(3) | |
drawchar("#", 10, 10) | |
--line(10,10,300,300) | |
--hardcoded() | |
end | |
function hardcoded() | |
line(11,25,4,-7) | |
line(17,25,10,-7) | |
line(4,12,18,12) | |
line(3,6,17,6) | |
end | |
function drawchar(c, ox, oy) | |
ax=-1 | |
ay=-1 | |
bx=-1 | |
by=-1 | |
fi=fontinfo | |
ch = fi[c] | |
for p=1, ch.points do | |
ax=bx | |
ay=by | |
bx=ch.data[p*2-1] | |
by=ch.data[p*2] | |
-- Don't override global draw function! | |
local draw=1 | |
if ((ax==-1) and (ay==-1)) then draw=0 end | |
if ((bx==-1) and (by==-1)) then draw=0 end | |
if (draw>0) then | |
print(ox+ax, oy+ay, ox+bx, oy+by) | |
line(ox+ax, oy+ay, ox+bx, oy+by) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment