CheckBox

CheckBox ы различной формы и цветов. Всё рисуется посредством draw_shape, кастомизация делается прямо в редакторе.

 

 

/// @description Create Event
//Site:   MidaDev.ru
//Author: Dimusikus
	
draw_set_valign(fa_middle);
if _caption_font !=0 then draw_set_font(_caption_font);
	

 

/// @description DrawEvent
//Site:   MidaDev.ru
//Author: Dimusikus
	
draw_set_halign(fa_left);
draw_set_valign(fa_middle);
	
draw_shapes_checkbox(_type_shape, _fill, _color, _check_color, _uncheck_color, _border, _checked, _caption);	
	
/// @description LeftReleased
//Site:   MidaDev.ru
//Author: Dimusikus

_checked = !_checked;
	
if script_exists(_checked_action) then script_execute(_checked_action);
	
if(_sound_onclick) then audio_play_sound(_sound_onclick,0,false);
/// @description Отображает кнопку фигурой и рисует рядом нуный текст
function draw_shapes_checkbox(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7) 
{	

	//argument0 = тип фигуры
	//argument1 = параметр fill
	//argument2 = checkbox_color

	//argument3 = check_checkbox_color
	//argument4 = uncheckbox_color

	//argument5 = border
	//argument6 = checked

	//argument7 = caption

		
			var _x = 0;
			var _y = 0;
			var _type = argument0;
			var _fill = argument1;
			var _color = argument2;
			var _color_check = argument3;
			var _color_uncheck = argument4;
			var b = argument5;
			var ch = argument6;
			var _txt = argument7;
		
		
			draw_set_color(_color);
			//draw_set_color(checkbox_color);
			draw_text(bbox_right + b, y, _txt);
	
			switch(_type)
			{
				case "none": break;
				case "rectangle":	
									draw_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, !_fill);
									draw_set_color(_color_uncheck);
									draw_rectangle(bbox_left+b, bbox_top+b, bbox_right-b, bbox_bottom-b, false);
									draw_set_color(_color_check);
									if ch then draw_rectangle(bbox_left+b*2, bbox_top+b*2, bbox_right-b*2, bbox_bottom-b*2, false);								
									break;
				case "roundrect":	
									draw_roundrect(bbox_left, bbox_top, bbox_right, bbox_bottom, !_fill);
									draw_set_color(_color_uncheck);
									draw_roundrect(bbox_left+b, bbox_top+b, bbox_right-b, bbox_bottom-b, false);
									draw_set_color(_color_check);
									if ch then draw_roundrect(bbox_left+b*2, bbox_top+b*2, bbox_right-b*2, bbox_bottom-b*2, false);								
									break;
				case "circle":
									draw_circle(x,y,(bbox_right - bbox_left) / 2, !_fill);
									draw_set_color(_color_uncheck);
									draw_circle(x,y,(bbox_right - bbox_left) / 2-b, !_fill);
									draw_set_color(_color_check);
									if ch then draw_circle(x,y,(bbox_right - bbox_left) / 2-b*2, !_fill);
									break;
				case "triangle_up":								
									draw_triangle(bbox_left, bbox_bottom, mean(bbox_left,bbox_right), bbox_top, bbox_right, bbox_bottom, !_fill);
									draw_set_color(_color_uncheck);
									draw_triangle(bbox_left+b, bbox_bottom-b, mean(bbox_left,bbox_right), bbox_top+b, bbox_right-b, bbox_bottom-b, !_fill);
									draw_set_color(_color_check);
									if ch then draw_triangle(bbox_left+b*2, bbox_bottom-b*2, mean(bbox_left,bbox_right), bbox_top+b*2, bbox_right-b*2, bbox_bottom-b*2, !_fill);
									break;
				case "triangle_down":
									draw_triangle(bbox_left, bbox_top, mean(bbox_left,bbox_right), bbox_bottom, bbox_right, bbox_top, !_fill);
									draw_set_color(_color_uncheck);
									draw_triangle(bbox_left+b, bbox_top+b, mean(bbox_left,bbox_right), bbox_bottom-b, bbox_right-b, bbox_top+b, !_fill);
									draw_set_color(_color_check);
									if ch then draw_triangle(bbox_left+b*2, bbox_top+b*2, mean(bbox_left,bbox_right), bbox_bottom-b*2, bbox_right-b*2, bbox_top+b*2, !_fill);
									break;					
			};


}


Кастомизация боксов происходит прямо в редакторе комнат: