mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Miscellaneous refactoring (#160)
* Reorganize ContainerBase - Reduce Container overloads using default arguments - Extract member function pointers to virtual functions - Separate classes for Vertical, Horizontal and Tab containers * Collect unpack from NodeDecorator subclasses * Reduce redundant expansion for aliases
This commit is contained in:
		 Tushar Maheshwari
					Tushar Maheshwari
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							210e8c5863
						
					
				
				
					commit
					09805e5e86
				
			| @@ -24,26 +24,19 @@ int main(int argc, const char* argv[]) { | ||||
|  | ||||
|   int shift = 0; | ||||
|  | ||||
|   class Graph { | ||||
|    public: | ||||
|     Graph(int* shift) : shift_(shift) {} | ||||
|     std::vector<int> operator()(int width, int height) { | ||||
|       std::vector<int> output(width); | ||||
|       for (int i = 0; i < width; ++i) { | ||||
|         float v = 0; | ||||
|         v += 0.1f * sin((i + *shift_) * 0.1f); | ||||
|         v += 0.2f * sin((i + *shift_ + 10) * 0.15f); | ||||
|         v += 0.1f * sin((i + *shift_) * 0.03f); | ||||
|         v *= height; | ||||
|         v += 0.5f * height; | ||||
|         output[i] = (int)v; | ||||
|       } | ||||
|       return output; | ||||
|   auto my_graph = [&shift](int width, int height) { | ||||
|     std::vector<int> output(width); | ||||
|     for (int i = 0; i < width; ++i) { | ||||
|       float v = 0.5f; | ||||
|       v += 0.1f * sin((i + shift) * 0.1f); | ||||
|       v += 0.2f * sin((i + shift + 10) * 0.15f); | ||||
|       v += 0.1f * sin((i + shift) * 0.03f); | ||||
|       v *= height; | ||||
|       output[i] = (int)v; | ||||
|     } | ||||
|     int* shift_; | ||||
|     return output; | ||||
|   }; | ||||
|  | ||||
|   Graph my_graph(&shift); | ||||
|   auto htop = Renderer([&] { | ||||
|     auto frequency = vbox({ | ||||
|         text(L"Frequency [Mhz]") | hcenter, | ||||
| @@ -53,7 +46,7 @@ int main(int argc, const char* argv[]) { | ||||
|                 filler(), | ||||
|                 text(L"1200 "), | ||||
|                 filler(), | ||||
|                 text(L"0% "), | ||||
|                 text(L"0 "), | ||||
|             }), | ||||
|             graph(std::ref(my_graph)) | flex, | ||||
|         }) | flex, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user