January 20, 2021, 02:08:21 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Graphics
»
[bmx] DrawPoly(), filled or unfilled by Oddball [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bmx] DrawPoly(), filled or unfilled by Oddball [ 1+ years ago ] (Read 888 times)
BlitzBot
Jr. Member
Posts: 1
[bmx] DrawPoly(), filled or unfilled by Oddball [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:43 AM »
Title :
DrawPoly(), filled or unfilled
Author :
Oddball
Posted :
1+ years ago
Description :
Just add the function below to your project and it will override BlitzMaxs DrawPoly.
Function DrawPoly(xy
#[],fill%=True,x#=0,y#=0)
Draws a polygon at coordinates x# and y# with corners defined by an array of x#,y# coordinate pairs. Setting fill=False draws an unfilled polygon. If the optional parameters are left blank DrawPoly acts identically to the standard BlitzMax function.
BlitzMax commands that affect the drawing of polygons include #SetColor, #SetHandle, #SetScale, #SetRotation, #SetOrigin, #SetViewPort, #SetBlend and #SetAlpha.
Code :
Code: BlitzMax
Function
DrawPoly
(
xy:
Float
[
]
, fill:
Int
=
True
, x:
Float
=
0
, y:
Float
=
0
)
Local
origin_x:
Float
Local
origin_y:
Float
GetOrigin origin_x,origin_y
Local
handle_x:
Float
Local
handle_y:
Float
GetHandle handle_x,handle_y
If
fill
_max2dDriver.DrawPoly xy,..
-handle_x,-handle_y,..
x+origin_x,y+origin_y
Else
Local
x1:
Float
=xy
[
xy.Length-
2
]
Local
y1:
Float
=xy
[
xy.Length-
1
]
For
Local
i:
Int
=
0
Until
Len
xy
Step
2
Local
x2:
Float
=xy
[
i
]
Local
y2:
Float
=xy
[
i+
1
]
_max2dDriver.DrawLine..
-handle_x+x1,-handle_y+y1,..
-handle_x+x2,-handle_y+y2,..
x+origin_x-
0.5
,y+origin_y-
0.5
x1=x2
y1=y2
Next
EndIf
End
Function
Comments :
Oddball(Posted 1+ years ago)
Slight bugfix. Apparently handle position wasn't mimiced correctly. Not sure how that slipped by for so long.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
Graphics
»
[bmx] DrawPoly(), filled or unfilled by Oddball [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal