// draw workplaces tabs and [+] symbol
var _xx = x;
var _yy = y;
for (var l=0; l<array_length(workplace_room); l+=1)
{
// position for tabs
var _tt = workplace_room[l];
var _ww = string_width(_tt) + 22;
var _hh = 32;
var _sep = 16;
var _button_col = c_white;
var _button_txt_col = c_white;
// detect position based on tab_index
if (workplace_room_index == l) {_button_col = global.col_window_bg; _button_txt_col = global.col_text;} else {_button_col = global.col_window_inside; _button_txt_col = global.col_text_darker;}
// mouse click action
if point_in_rectangle(gui_mouse_x(), gui_mouse_y(), _xx, _yy, _xx+_ww+_sep-4, _yy+_hh)
{
// change color if mouse over
if !(workplace_room_index == l) {_button_col = global.col_window_bg;}
// click
if mouse_check_button_pressed(mb_left)
{
workplace_room_index = l;
}
}
// tab bg
draw_set_color(_button_col);
draw_rectangle(_xx, _yy, _xx+_ww+_sep-4, _yy+_hh, false);
// tab text
draw_set_color(_button_txt_col);
draw_text(_xx+6, _yy+7, _tt);
draw_set_color(c_white);
// delete workplace icon
if draw_sprite_button(spr_window_icons, 2, _xx+_ww, _yy+16, 24, 24, 1)
{
workplace_room_index = l;
array_delete(workplace_room, workplace_room_index, 1);
workplace_room_index = array_length(workplace_room)-1;
show_debug_message("DELETED");
}
_xx += (_ww + _sep);
}
// add workplace icon
if draw_sprite_button(spr_window_icons, 3, _xx+16, _yy+16, 24, 24, 1)
{
workplace_room_index = array_length(workplace_room);
array_insert(workplace_room, array_length(workplace_room), "WP "+string(irandom(999)));
show_debug_message("ADDED");
}