require( "scripts/style.lua" );


function OkEnterName(a_name)
	name = a_name;
	if(IsNameValid(name)) then 
		CreateNewUser(name);
		SetWelcomeName();
		CloseWindow();
	end
	SetFocus( "nameedit" );
end


MakeDialog
{
	Bitmap
	{
		image="backgrounds/entername",
		x=kCenter,
		y=kCenter,

--			Text
--			{
--				name = "entername",
--				font = {standardFont,  30,  BlackColor},
--				x=3,y=40,w=510,h=40,
--				flags = kHAlignCenter + kVAlignTop,
--				label = "enternameprompt"
--			},


		FirstEnterName
		{
			name="FirstEnterName",
			x=0,
			y=0,
			w=kMax,h=kMax,
			okbutt ="b_ok;190,270,127,47;fonts/arial.mvec;128,128,128,255;255,255,255,255;23;buttons/b_ok;buttons/b_ok_pressed;buttons/b_ok_mouseover",
			shadow ="backgrounds/sh1;0,0,1024,768;0.3;0.8",

			TextEdit
			{
				font = { standardFont,  30,  BlackColor},
				flags = kHAlignCenter,
				name = "nameedit",
				label = playername,
				clearinitial = deleteselected,
				x=kCenter,y= kCenter + 84, w=290,h=kMax,
				length=10,
				utf8=true,
				ignore = kIllegalNameChars
			},
		}
	},

}

SetFocus( "nameedit" );
