Hey, so I defined some functions to create some custom types I've defined (2dVector and 2dButton). I've tested create2dVector() and it works out fine, but when I attempt to use create2dButton, the compiler crashes when I attempt to compile my program.
Main.dba
#CONSTANT RGB_BLACK = RGB(0,0,0)
#CONSTANT RGB_WHITE = RGB(255,255,255)
#CONSTANT RGB_RED = RGB(255,0,0)
#CONSTANT RGB_GREEN = RGB(0,255,0)
#CONSTANT RGB_BLUE = RGB(0,0,255)
FLAG_Quit = 0
RESOLUTION_X = 800
RESOLUTION_Y = 600
RESOLUTION_DEPTH = 32
SYNC ON : SYNC RATE 30
SET Display Mode RESOLUTION_X,RESOLUTION_Y,RESOLUTION_DEPTH
SET TEXT TRANSPARENT
TYPE 2dVector
X,Y
ENDTYPE
TYPE 2dButton
position as 2dVector ,
size as 2dVector ,
caption$,
buttonColor as DWORD ,
textColor as DWORD
ENDTYPE
GOSUB MainMenu
MainMenu:
REM quitButton as 2dButton = createButton(create2dVector(400,300),create2dVector(50,20),"Quit",RGB_BLUE,RGB_WHITE)
WHILE FLAG_Quit <> 1
CLS
REM drawButton(quitButton)
if inkey$()="q" then FLAG_Quit = 1
ENDWHILE
RETURN
2D_Library.dba
function create2dVector(posX,posY)
newVector as 2dVector
newVector.X = posX
newVector.Y = posY
ENDFUNCTION newVector
Menu_Library.dba
function createButton(Position as 2dVector ,Size as 2dVector ,Caption$, ButtonColor as DWORD , TextColor as DWORD )
newButton as 2dButton
newButton.position.X = Position.X - Size.X/2
newButton.position.Y = Position.Y - Size.Y/2
newButton.size = Size
newButton.caption$ = Caption$
newButton.buttonColor = ButtonColor
newButton.textColor = TextColor
ENDFUNCTION newButton
function DrawButton( button as 2dButton )
BOX button.position.X,button.position.Y,button.size.X,button.size.Y,button.buttonColor,button.buttonColor,button.buttonColor,button.buttonColor
textX = button.position.X + button.size.X/2
textY = button.position.Y + button.size.Y/2
INK textColor,RGB_BLACK
CENTER TEXT textX,textY,caption$
ENDFUNCTION