api:

--Developed by Makerimages
--the internal dialogue box instance
local dialogueBox=nil;
local passedShell
os.loadAPI("/apis/gameutils")
local w,h=term.getSize();
local backGround=gameutils.loadSprite("/graphics/dialogueBack.nfp",math.ceil(w/2-13),math.ceil(h/2-5));
--[[Allows for shell functions
]]--
function setShell(sl)
    passedShell = sl
end
--[[ Creates a new, blank dialogue box with the set title and text.

]]--
function createDialogueBox(title,text)

dialogueBox=
{
  title=title;
  text=text;
}
return dialogueBox
end
--[[
Creates a new, blank dialogue box that has a loading bar;
]]--
function createDialogueBoxWithLoadBar(title, text)

  dialogueBox=
  {
   title=title;
   text=text;
   loadingBar=gameutils.loadAnimation("/graphics/LoadingBar.nfa",math.ceil(w/2-3),math.ceil(h/2));
	 }
	 dialogueBox.loadingBar.currentFrame=1;
	 return dialogueBox
end
function drawDialogueBox(dialogueBoxToDraw)

  gameutils.initializeBuffer()
  gameutils.writeToBuffer(backGround)
  --gameutils.drawBuffer()
  term.setTextColor(colors.gray)
  term.setCursorPos(math.ceil(w/2-2),math.ceil(h/2-5));
  print(dialogueBoxToDraw.title);
  term.setBackgroundColor(colors.white);
  term.setCursorPos(math.ceil(w/2-11),math.ceil(h/2-3));
  print(dialogueBoxToDraw.text)
  if not dialogueBoxToDraw.loadingBar==nil then
   gameutils.writeToBuffer(dialogueBox.loadingBar)
   end
  while dialogueBoxToDraw.loadingBar.currentFrame<=10 do
   dialogueBoxToDraw.loadingBar:next()
   sleep(0.15)
   gameutils.writeToBuffer(dialogueBoxToDraw.loadingBar)
   gameutils.writeToBuffer(backGround)
   gameutils.drawBuffer();
   term.setTextColor(colors.gray)
   term.setCursorPos(math.ceil(w/2-2),math.ceil(h/2-5));
   print(dialogueBoxToDraw.title);
	 term.setBackgroundColor(colors.white);
   term.setCursorPos(math.ceil(w/2-11),math.ceil(h/2-3));
   print(dialogueBoxToDraw.text)
  end
passedShell.run(dialogueBoxToDraw.endFunction)

end

function addLoadingBarEndFunctionGoTo(dialogueBoxToAddTo,functionTo)
dialogueBoxToAddTo.endFunction=functionTo;
return dialogueBoxToAddTo
end

program:

--Developed by Makerimages
os.loadAPI("/apis/gameutils");--Load the animation api by NitrogenFingers
os.loadAPI("/apis/dialoguehandler")
term.setTextColor(colors.lightGray)
local topBar=gameutils.loadSprite("/graphics/TopBar.nfp",1,1);--top bar
local w, h=term.getSize();
local backGround=gameutils.loadSprite("/graphics/b.nfp",1,1)--background
local dBox=dialoguehandler.createDialogueBoxWithLoadBar("Booting","OS One is booting...")
local addAccountButton=
{
text="+ Add an account";
x=math.ceil(w/2-5);
y=math.ceil(h/2);
w=16;
h=1;
}

gameutils.initializeBuffer();
gameutils.writeToBuffer(backGround)
gameutils.writeToBuffer(topBar);

gameutils.drawBuffer();
dialoguehandler.setShell(shell);
--dialoguehandler.addLoadingBarEndFunctionGoTo(dBox,"id");
dialoguehandler.drawDialogueBox(dBox);
if fs.exists("userDdata/user1.uData") then
shell.run("/OSCore/loginScreen.lua")
else
gameutils.clearBuffer()
gameutils.writeToBuffer(backGround)
gameutils.writeToBuffer(topBar);
while true do
gameutils.drawBuffer();
term.setCursorPos(1,math.ceil(h/2-5))
print("OS One has identified that you do not have an admininstrative user Account set up yet. Please do so now.")
term.setCursorPos(addAccountButton.x, addAccountButton.y)
write("|")write(addAccountButton.text)write("|")
  event, button, x, y = os.pullEvent("mouse_click")
   if x >= addAccountButton.x and x <= addAccountButton.x + addAccountButton.w - 1 and
    y >= addAccountButton.y and y < addAccountButton.y + addAccountButton.h then
   os.reboot()
  end
sleep(0.15)
end
end


the loading bar wont draw itself