#define loadmenu
with obj_menubutton instance_destroy()
with obj_statictext instance_destroy()
with obj_guitextinput instance_destroy()
with obj_checkbox instance_destroy()
with obj_itemlistgui instance_destroy()
with obj_teebody_preview instance_destroy()
with obj_1_preview instance_destroy()
with obj_2_preview instance_destroy()
with obj_staticimage instance_destroy()
with obj_guirectangle instance_destroy()
script_execute(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10, argument11, argument2, argument13, argument14, argument15)

#define ShowTab
//ShowTab(tabname)
_visibleTab = str(argument0)

#define MenuButton
//MenuButton(string, x, y, width, height, onclick_code, tabname)
//tabname can be left empty
var texts, xx, yy, widths, heights, codes, tab;
texts = argument0
xx = argument1
yy = argument2
widths = argument3
heights = argument4
codes = argument5
tabs = str(argument6)

g = instance_create(xx, yy, obj_menubutton)
g.x_2 = xx+widths
g.y_2 = yy+heights
g.w = widths
g.h = heights
g.text = texts
g.code = codes
g.tab = tabs
g.xx = xx
g.yy = yy

return g

#define ItemList
//ItemList(list, string, x, y, width, height, clickable, onclick_code, tabname)
//tabname and clickable can be left empty if not needed
//if tabname is needed but not clickable, just use "false" and "" on the last 2 args before tabname
//on the onclick_code, argument0 is the name/value of the item clicked
var lists, texts, xx, yy, widths, heights, codes, tab, clickables;
lists = argument0
texts = argument1
xx = argument2
yy = argument3
widths = argument4
heights = argument5
clickables = argument6
codes = argument7
tabs = str(argument8)

g = instance_create(xx, yy, obj_itemlistgui)
g.x_2 = xx+widths
g.y_2 = yy+heights
g.w = widths
g.h = heights
g.text = texts
g.list = lists
g.code = codes
g.tab = tabs
g.clickable = clickables
g.xx = xx
g.yy = yy

return g

#define StaticText
//StaticText(text, x, y, halign, valign, color, size, tabname)
//size (optional argument): 0 = small (default), 1 = medium, 2 = large, 3 = larger
//tabname can be left empty
var texts, xx, yy, halign, valign, color, size, tab;
texts = argument0
xx = argument1
yy = argument2
halign = argument3
valign = argument4
color = argument5
size = argument6
tab = str(argument7)

g = instance_create(xx, yy, obj_statictext)
g.text = texts
g.col = color
g.halign = halign
g.valign = valign
g.size = size
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define StaticTextExt
//StaticTextExt(text, x, y, halign, valign, color, size, sep, w, tabname)
//size (optional argument): 0 = small (default), 1 = medium, 2 = large, 3 = larger
//tabname can be left empty
var texts, xx, yy, halign, valign, color, size, seps, w, tab;
texts = argument0
xx = argument1
yy = argument2
halign = argument3
valign = argument4
color = argument5
size = argument6
seps = argument7
w = argument8
tab = str(argument9)

g = instance_create(xx, yy, obj_statictext)
g.ext = true
g.sep = seps
g.w = w
g.text = texts
g.col = color
g.halign = halign
g.valign = valign
g.size = size
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define Rectangle
//Rectangle(x1, y1, x2, y2, tabname)
//tabname can be left empty
var xx, yy, widths, heights, tab;
xx = argument0
yy = argument1
widths = argument2
heights = argument3
tab = str(argument4)

g = instance_create(xx, yy, obj_guirectangle)
g.w = widths-xx
g.h = heights-yy
g.x_2 = widths
g.y_2 = heights
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define StaticImage
//StaticImage(type, ind, [subimg,] x, y, tabname)
//tabname can be left empty
//type can be "sprite" or "background"
//if type == "sprite", subimg is the sprite subimage to draw
var xx, yy, types, inds, subimgs, tab;
types = argument0
inds = argument1
if types == "sprite"
{
    subimgs = argument2
    xx = argument3
    yy = argument4
    tab = str(argument5)
}
else if types == "background"
{
    xx = argument2
    yy = argument3
    tab = str(argument4)
    subimgs = -1
}

g = instance_create(xx, yy, obj_staticimage)
g.subimg = subimgs
g.image = inds
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define TeePreview
//TeePreview(skinname, x, y, bodycolor, feetcolor0, feetcolor1, nameplate, tabname)
//tabname and nameplates can be left empty
//if you need tabname but not nameplates, just use "" as value
var skins, xx, yy, bodycolors, feetcolors, nameplates, tab, skinbg;
skins = argument0
skinbg = ds_list_find_value(skinslist[1], ds_list_find_index(skinslist[0], skins+".png"))
if skinbg == 0 then
    skinbg = ds_list_find_value(skinslist[1], ds_list_find_index(skinslist[0], "default.png"))
xx = argument1
yy = argument2
bodycolors = argument3
feetcolors[0] = argument4
feetcolors[1] = argument5
nameplates = argument6
tab = str(argument7)

g = instance_create(xx, yy, obj_teebody_preview)
g.skinbg = skinbg
g.bodycol = bodycolors
g.feetcol[0] = feetcolors[0]
g.feetcol[1] = feetcolors[1]
g.nameplate = nameplates
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define TextInput
//TextInput(varname, defstring, x, y, width, height, additional_code, tabname)
//tabname can be left empty
//additional_code is run after the enter key is pressed and the input is saved
var varnames, texts, xx, yy, widths, heights, tab, codes;
varnames = argument0
texts = argument1
xx = argument2
yy = argument3
widths = argument4
heights = argument5
codes = argument6
tab = str(argument7)

g = instance_create(xx, yy, obj_guitextinput)
g.x_2 = xx+widths
g.y_2 = yy+heights
g.w = widths
g.h = heights
g.text = texts
g.code = codes
g.varname = varnames
g.tab = tab
g.xx = xx
g.yy = yy

return g

#define CheckBox
//MenuButton(varname, string, x, y, tabname)
//tabname can be left empty
//varname must be the variable's name as a string
//"codes" is run after the varname's value is changed when clicking the checkbox, argument0 is the value set
var texts, xx, yy, widths, heights, codes, tab, varnames;
varnames = argument0
texts = argument1
xx = argument2
yy = argument3
codes = argument4
tabs = str(argument5)

g = instance_create(xx, yy, obj_checkbox)
g.text = texts
g.varname = varnames
g.tab = tabs
g.code = codes
g.xx = xx
g.yy = yy

return g

