Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EXAMPLE FOR https://github.com/Sharkbyteprojects/consoleLoadingbar DESCRIBED IN USAGE SECTION OF README
cmake_minimum_required (VERSION 3.8)
project ("myCool-Loadingbar-Project")
add_subdirectory("consoleLoadingbar")
add_executable (myCoolExample "exampleLoadingbar.cpp")
target_link_libraries(myCoolExample sharks::consoleLoadingBar)
add_executable (myCoolExampleWithRecalculation "exampleLoadingbar2.cpp")
target_link_libraries(myCoolExampleWithRecalculation sharks::consoleLoadingBar)
// <c> Sharkbyteprojects (https://github.com/Sharkbyteprojects/)
// THIS WORKS ON LINUX && WINDOWS
// INCLUDE MAIN HEADER
#include <consoleLoadingBar.h>
int main(){
// Create a object of class `CloadingBarConsole`
CloadingBarConsole myBarClass;
//YELLOW SEEMS COOL:
myBarClass.setColorCode(colorcode::SUSPEND);
//MY PROGRESS IS 50%
myBarClass.setPercent(50);
//RENDER IT
myBarClass.render();
//YOU COULD RENDER AGAIN, TO RECALCULATE THE BAR, if you didn't used stdout
//OTHER EXAMPLE: https://github.com/Sharkbyteprojects/consoleLoadingBar-win/blob/master/consoleLoadingBar/consoleLoadingBar.cpp (FOR NEWER VERSION, INCLUDE <consoleLoadingBar.h> instead of "../loadingBarConsole/loadingBarConsole.h")
}
// <c> Sharkbyteprojects (https://github.com/Sharkbyteprojects/)
// THIS WORKS ON LINUX && WINDOWS
// INCLUDE MAIN HEADER
#include <consoleLoadingBar.h>
int main(){
// Create a object of class `CloadingBarConsole`
CloadingBarConsole myBarClass;
//YELLOW SEEMS COOL:
myBarClass.setColorCode(colorcode::SUSPEND);
//MY PROGRESS IS 50%
myBarClass.setPercent(50);
//RENDER IT
while(1)
myBarClass.render();
//OTHER EXAMPLE: https://github.com/Sharkbyteprojects/consoleLoadingBar-win/blob/master/consoleLoadingBar/consoleLoadingBar.cpp (FOR NEWER VERSION, INCLUDE <consoleLoadingBar.h> instead of "../loadingBarConsole/loadingBarConsole.h")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment