I found where I am wrong, the DrawBox will always draw a non-rotated box
SetErrorMode(2)
SetWindowTitle( "average" )
SetWindowSize(1024, 768, 0)
SetWindowAllowResize(1)
SetVirtualResolution(1024, 768)
SetOrientationAllowed(1, 1, 1, 1)
SetSyncRate(30, 0)
SetScissor(0, 0, 0, 0)
UseNewDefaultFonts(1)
type _Center
iSpr as integer
endtype
tC as _Center
red as integer
centerCreate(tC, 512.0, 384.0, 256.0, 256.0)
centerSetAngle(tC, 45.0)
red = MakeColor(255, 0, 0)
do
centerDraw(tC, red)
Sync()
loop
function centerCreate(c ref as _Center, x as float, y as float, w as float, h as float)
c.iSpr = CreateDummySprite()
//c.iSpr = CreateSprite(0)
SetSpriteSize(c.iSpr, w, h)
SetSpriteOffset(c.iSpr, GetSpriteWidth(c.iSpr)*0.5, GetSpriteHeight(c.iSpr)*0.5)
SetSpritePositionByOffset(c.iSpr, x, y)
endfunction
function centerDraw(c ref as _Center, color as integer)
widthHalf as float
heightHalf as float
x0 as float
y0 as float
x1 as float
y1 as float
x2 as float
y2 as float
widthHalf = GetSpriteWidth(c.iSpr) * 0.5
heightHalf = GetSpriteHeight(c.iSpr) * 0.5
x0 = GetWorldXFromSprite(c.iSpr, -widthHalf, -heightHalf)
y0 = GetWorldYFromSprite(c.iSpr, -widthHalf, -heightHalf)
x1 = x0
y1 = y0
x2 = GetWorldXFromSprite(c.iSpr, widthHalf, -heightHalf)
y2 = GetWorldYFromSprite(c.iSpr, widthHalf, -heightHalf)
DrawLine(x1, y1, x2, y2, color, color)
x1 = GetWorldXFromSprite(c.iSpr, widthHalf, heightHalf)
y1 = GetWorldYFromSprite(c.iSpr, widthHalf, heightHalf)
DrawLine(x2, y2, x1, y1, color, color)
x2 = GetWorldXFromSprite(c.iSpr, -widthHalf, heightHalf)
y2 = GetWorldYFromSprite(c.iSpr, -widthHalf, heightHalf)
DrawLine(x1, y1, x2, y2, color, color)
DrawLine(x2, y2, x0, y0, color, color)
endfunction
function centerSetAngle(c ref as _Center, a as float)
SetSpriteAngle(c.iSpr, a)
endfunction