Spoiler
Load Screen / Bar API
v2.0
After searching through the forums I was disappointed at the lack of a load screen API that was realtime and not just a fake sleep based screen. So I decided to make some... Here it is:
The load screen API provides an easy way to show your users in real time where your program is up to while loading... This API features the ability to render your logo in the middle of the screen AND event use it as the progress bar!
Now you can make multiple progress bars!
Whats new:
Functions:
Loading Screen / Bar Object Modes:
Example of Usage:
Change Log
Latest Version Download here
Or get it in-game with
Version 1.1 Download here
Or get it in-game with
Load Screen / Bar API
v2.0
After searching through the forums I was disappointed at the lack of a load screen API that was realtime and not just a fake sleep based screen. So I decided to make some... Here it is:
The load screen API provides an easy way to show your users in real time where your program is up to while loading... This API features the ability to render your logo in the middle of the screen AND event use it as the progress bar!
Now you can make multiple progress bars!
Whats new:
Spoiler
This API has had a full rewrite from ground up. Your load screen / bar are now objects. This means that each bar is in charge of its own progress.
What does this mean?
Well you can have multiple progress bars on the one screen*! Thats right, you can have for example an 'overall' progress and 'current operation' progress AND more*!
There are several new class functions as well as a few new functions for the objects themselves ( listed below in the 'Functions' section ).
Notable feature: Each object will only update WHEN REQUIRED and when required to update will send a custom event that ONLY they will respond to**.
* Up to 999
** Other event loops may pull this event, however no other progress bar object will, they only listen for their own
This API has had a full rewrite from ground up. Your load screen / bar are now objects. This means that each bar is in charge of its own progress.
What does this mean?
Well you can have multiple progress bars on the one screen*! Thats right, you can have for example an 'overall' progress and 'current operation' progress AND more*!
There are several new class functions as well as a few new functions for the objects themselves ( listed below in the 'Functions' section ).
Notable feature: Each object will only update WHEN REQUIRED and when required to update will send a custom event that ONLY they will respond to**.
* Up to 999
** Other event loops may pull this event, however no other progress bar object will, they only listen for their own
Functions:
Spoiler
If a message is supplied it will change the message text. NOTE: If you do not want the message to change just call triggerUpdate()
cleanup is an optional boolean parameter. if set to true the load object will dealloc once completed.
tostring( loadObj )Calling tostring on the load screen / bar object will return the apiIdentifier so that you can easily check if a passed variable is an object from this API
function getVersion()Returns the version of the API
function getApiIdentifier()Returns a string formatted as follows "Loading Bar API v<version> Object" ( recommended usage, to check against an object's tostring )
function getId()Returns the id of the current loading bar object ( this is unique and is used internally when queueing and pulling events )
function getCurrentProgress()Returns the current progress of the loading bar, minimum 0 maximum is the total events
function getFormattedProgress()Returns the current progress as a string formatted as follows "<current>/<total>"
function init( mode, tLogo, count, width, y, loadColor, openingMsg, headMsg, footMsg )Initialises the loading screen / bar with the values supplied, each mode is different with what values required ( see examples to see whats needed )
function setMessage( msg )Changes the progress message that is displayed to the user without triggering progress
function removeMessage()Removes the progress message that is displayed to the user without triggering progress, equivalent to
function dealloc()Removes the current object and frees up memory allocation
function reset()Resets the current progress count to zero ( and obviously the actual progress bar )
function forceStop()Exits the render loop and allows your program to continue running ( suggested usage, when something goes wrong, such as a file doesn't exist that is needed and you want the load screen to stop )
function triggerUpdate( msg )Triggers progress, incrementing the progress bar and displaying with the formula ( current_progress / total_required ) * bar_width
If a message is supplied it will change the message text. NOTE: If you do not want the message to change just call triggerUpdate()
function forceDraw()This will force the load screen / bar to draw to the screen for 1 loop
function run( cleanup )Runs the render loop ( note: this API uses a pullEvent loop, recommended method of calling is with parallels api so you can load your stuff, to exit loop see forceStop )
cleanup is an optional boolean parameter. if set to true the load object will dealloc once completed.
Loading Screen / Bar Object Modes:
Spoiler
For visual examples of all these look at the 'Screenshots' section
load.STANDARDThis includes a load screen with the logo, all text and a progress bar ( NOTE: This will clear the screen )
load.BAR_ONLYThis draws only a progress bar to the screen ( NOTE: This will not clear the screen )
load.ASCII_BAR_ONLYThis draws only a progress bar to the screen on ASCII ( Suggested usage, non-advanced computers including CC 1.3 computers ) ( NOTE: This will not clear the screen )
load.LOGO_IS_LOADThis draws a load screen with the logo and all the text. The logo is the progress bar and the supplied color ( see init ) will be drawn over the top of it.
load.LOGO_IS_OVERLAYThis draws a load screen with the logo and all the text. The logo is the progress bar and is initially greyed out, with the color representing progress.
load.ASCIIThis includes a load screen with the logo, all text and a progress bar, all in ASCII ( NOTE: This will clear the screen )
For visual examples of all these look at the 'Screenshots' section
Example of Usage:
Spoiler
Generic Object/Class Functions
http://pastebin.com/XhVXdpHX
STANDARD mode example code:
http://pastebin.com/9WqxtPZP
BAR_ONLY mode example code:
http://pastebin.com/LcZJKxv4
ASCII_BAR_ONLY mode example code:
http://pastebin.com/6rBQDrqy
LOGO_IS_LOAD mode example code:
http://pastebin.com/msRYcMju
LOGO_IS_OVERLAY mode example code:
http://pastebin.com/0LiT8utH
ASCII mode example code:
http://pastebin.com/FgZK2t38
Multiple progress bar example code:
http://pastebin.com/80LZaVj0
and
http://pastebin.com/RF2rRazY
Generic Object/Class Functions
http://pastebin.com/XhVXdpHX
STANDARD mode example code:
http://pastebin.com/9WqxtPZP
BAR_ONLY mode example code:
http://pastebin.com/LcZJKxv4
ASCII_BAR_ONLY mode example code:
http://pastebin.com/6rBQDrqy
LOGO_IS_LOAD mode example code:
http://pastebin.com/msRYcMju
LOGO_IS_OVERLAY mode example code:
http://pastebin.com/0LiT8utH
ASCII mode example code:
http://pastebin.com/FgZK2t38
Multiple progress bar example code:
http://pastebin.com/80LZaVj0
and
http://pastebin.com/RF2rRazY
Change Log
Spoiler
v2.0
v2.0
- New mode, bar only
- New mode, ascii bar only
- Your load screen / bar are now objects meaning you can now have more than one!
- New mode, ASCII
- Bugfixes
- Initial release
Latest Version Download here
Or get it in-game with
pastebin zeG34tu6 load
Version 1.1 Download here
Or get it in-game with
pastebin 4iLhhffG load
[/spoiler]
Edited by TheOriginalBIT, 23 January 2013 - 07:25 PM.