Skip to content

Instantly share code, notes, and snippets.

@Sharkbyteprojects
Last active March 30, 2022 15:30
Show Gist options
  • Save Sharkbyteprojects/7340bfbff7e063fd0686ebf537e92ed8 to your computer and use it in GitHub Desktop.
Save Sharkbyteprojects/7340bfbff7e063fd0686ebf537e92ed8 to your computer and use it in GitHub Desktop.
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