require( "scripts/style.lua" );
dofile( "board/board_export.lua" );

dofile( "scripts/integration/position_data.lua" );

-- The "Twodemos" game handles its messages in Lua, unlike the "TGame" game
-- which handles them in C++.
function SendGameMessage( msg )
	if msg=="quit" then
		QuitToMainMenu();
	end
end

MakeDialog
{
	Bitmap
	{
		-- background grid
		name="backgroundimage",
		image="board/bg_boardbg",

--[[		
		-- board "lower part"
		Bitmap
		{
			image='board/board_copy';
			name='board_copy';
			x=0;
			y=123;
		},
		
		-- board
		Bitmap
		{
			image='board/board_02';
			name='board_02';
			x=0;
			y=119;
		},
		
		-- real estate
		Bitmap
		{
			image='board/layer_14';
			name='layer_14';
			x=45;
			y=161;
		},
--]]
		Text
		{
			x=410,y=20,
			w=400-20,h=180,
			flags=kHAlignCenter+kVAlignCenter,
			label="sandbox_info",
		},

		SandBoxWindow
		{
			name='sandbox',
			w=800, h=600,

			-- For this simple example, we can define some parameters right here

			-- For a game with levels, you might want to use globals or an XML
			-- file to define specifics, depending on the nature of the data.
			edgebounce=0.5,		-- How bouncy is the edge
			damping=0.95,		-- How much damping they experience
			butterflypull=4,	-- How much they're pulled to your mouse
			butterflyrepel=80,	-- How much they push each other apart
			
			sprites = psd2window_board_export()
			
		},
		Button
		{
			x=20,
			y=-50,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="quit",
			label="common.quit.label",
			type = kPush,
			command=
				function()
--					DoModal("scripts/pause.lua");
					PostMessage( CreateNamedMessage( kQuitNow, "Quit" ) );
				end
		},
		Button
		{
			x=20,
			y=-100,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="restart",
			label="debug.restart",
			type = kPush,
			command=
				function()
				        SendGameMessage( "quit" );
				end
		},
	},
}

-- The sandbox window wants to get any key presses, so let's give it the focus
SetFocus("sandbox");