mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 21:48:15 +08:00 
			
		
		
		
	Start the gauge widget.
This commit is contained in:
		
							
								
								
									
										4
									
								
								examples/gauge/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								examples/gauge/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
add_executable(gauge_example
 | 
			
		||||
  main.cpp
 | 
			
		||||
)
 | 
			
		||||
target_link_libraries(gauge_example PRIVATE ftxui)
 | 
			
		||||
							
								
								
									
										30
									
								
								examples/gauge/main.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								examples/gauge/main.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
#include "ftxui/core/screen.hpp"
 | 
			
		||||
#include "ftxui/core/dom/elements.hpp"
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
int main(int argc, const char *argv[])
 | 
			
		||||
{
 | 
			
		||||
  using namespace ftxui::dom;
 | 
			
		||||
  auto document =
 | 
			
		||||
    hbox(
 | 
			
		||||
      flex(vbox(
 | 
			
		||||
        gauge(0.1),
 | 
			
		||||
        gauge(0.2),
 | 
			
		||||
        gauge(0.3)
 | 
			
		||||
      )),
 | 
			
		||||
      flex(vbox(
 | 
			
		||||
        gauge(0.1),
 | 
			
		||||
        gauge(0.8),
 | 
			
		||||
        gauge(0.3)
 | 
			
		||||
      ))
 | 
			
		||||
    );
 | 
			
		||||
  //auto screen = ftxui::Screen::WholeTerminal();
 | 
			
		||||
  auto screen = ftxui::Screen::TerminalOutput(document);
 | 
			
		||||
  Render(screen, document.get());
 | 
			
		||||
 | 
			
		||||
  std::cout << screen.ToString();
 | 
			
		||||
 | 
			
		||||
  getchar();
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user