

function makeBlackBox()

   local box = Widget:new();

   --box:setBackgroundImage("editordata/np_ff1.ninepatch");
   box:setBackgroundImage("editordata/black.tga");

   return box;

end

function buildMainUI()

   local letterBoxContainer = WidgetContainer:new();

   letterBoxContainer:setMinWidth(gameScreenWidth);
   letterBoxContainer:setMinHeight(gameScreenHeight);

   letterBox_top = makeBlackBox();
   letterBox_bottom = makeBlackBox();
   
   letterBoxContainer:setNumRows(3);
   letterBoxContainer:setStretchableRow(1);

   letterBoxContainer:addChild(letterBox_top);
   letterBoxContainer:addChild(nil);
   letterBoxContainer:addChild(letterBox_bottom);

   return letterBoxContainer;

end

function updateLetterBox()

   local w, h = getScreenSize();

   local spacerSize = (h - gameScreenHeight) / 2;

   if spacerSize > 0 then
      letterBox_top:setMinHeight(spacerSize);
      letterBox_bottom:setMinHeight(spacerSize);
   else
      letterBox_top:setMinHeight(0);
      letterBox_bottom:setMinHeight(0);
   end

end

widgetSetRoot(buildMainUI());
