#include "ui/menudef.h"

// Defines //
#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	608
#define WINDOW_HEIGHT	448
#define GROUP_NAME		"grpOptionsSystemGamma"

// Macros //
#include "ui/menumacros.h"

// System Menu //
menuDef {
	name		"options_system_gamma"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onESC {
		close options_system_gamma ;
		fadeoutmenu background_black ;
#ifdef FUI
		open background_1 ;
#endif // FUI
		open options_system
	}

// Window //
	WINDOW( _("CALIBRATE BRIGHTNESS"), 214 )

// General
#define SUBWINDOW_WIDTH		WINDOW_WIDTH-12

	LABELWHITE( 6+2, 32, (WINDOW_WIDTH)-64, 10, _("General Brightness Calibration (All Color Depths)"), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 44, (WINDOW_WIDTH)-64, 10, _("1. Move the slider below and/or the brightness on your monitor until you can see 16"), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 56, (WINDOW_WIDTH)-64, 10, _("     separate bars below of equal differing brightness."), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 68, (WINDOW_WIDTH)-64, 10, _("2. Click the BACK button."), .2, ITEM_ALIGN_LEFT, 0, 8 )

	itemDef {
		name		"gammaBar"
		rect		$evalfloat(2+.5*(WINDOW_WIDTH-576)) 92 576 64
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/gammabar"
		forecolor	1 1 1 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	LABELWHITE( 6+2, 178, (WINDOW_WIDTH)-64, 10, _("Brightness Fine-Tuning (32 bit Textures and Color Depth)"), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 190, (WINDOW_WIDTH)-64, 10, _("1. Move the slider below until you can see 3 separate bars below."), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 202, (WINDOW_WIDTH)-64, 10, _("2. Adjust the slider until there is no difference between the left and middle boxes."), .2, ITEM_ALIGN_LEFT, 0, 8 )
	LABEL( 6+2, 214, (WINDOW_WIDTH)-64, 10, _("3. Click the BACK button."), .2, ITEM_ALIGN_LEFT, 0, 8 )

	itemDef {
		name		"threesquares"
		rect		$evalfloat(2+.5*(WINDOW_WIDTH-288)) 238 288 144
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/3squares"
		forecolor	1 1 1 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	SLIDER( 2+.5*(WINDOW_WIDTH-192), 404, 192, 10, _("Brightness:"), .2, 8, "r_gamma" 1 0.5 2, _("Set the brightness of the game") )
	CVARFLOATLABEL( 2+.5*(WINDOW_WIDTH-288), 404, 192, 10, "r_gamma", .2, ITEM_ALIGN_RIGHT, 288, 8 )

// Buttons //
#ifdef FUI
	BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, _("BACK"), .3, 14, close options_system_gamma ; fadeoutmenu background_black ; open background_1 ; open options_system )
#else
	BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, _("BACK"), .3, 14, close options_system_gamma ; fadeoutmenu background_black ; open options_system )
#endif // FUI
}
