mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	hotkeys for geometry filters; geometry list is now a list; unfiltered list
This commit is contained in:
		
							
								
								
									
										31
									
								
								geom-exp.cpp
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								geom-exp.cpp
									
									
									
									
									
								
							| @@ -249,6 +249,7 @@ EX void activate_ge_land_selection() { | |||||||
| #if HDR | #if HDR | ||||||
| struct geometry_filter { | struct geometry_filter { | ||||||
|   string name; |   string name; | ||||||
|  |   int hotkey; | ||||||
|   /** test if the current geometry matches the filter */ |   /** test if the current geometry matches the filter */ | ||||||
|   function<bool()> test;  |   function<bool()> test;  | ||||||
|   }; |   }; | ||||||
| @@ -258,23 +259,24 @@ EX geometry_filter *current_filter; | |||||||
|  |  | ||||||
| bool forced_quotient() { return quotient && !(cgflags & qOPTQ); } | bool forced_quotient() { return quotient && !(cgflags & qOPTQ); } | ||||||
|  |  | ||||||
| EX geometry_filter gf_hyperbolic = {"hyperbolic", [] { return (arcm::in() || arb::in() || hyperbolic) && !forced_quotient(); }}; | EX geometry_filter gf_hyperbolic = {"hyperbolic", 'h', [] { return (arcm::in() || arb::in() || hyperbolic) && !forced_quotient(); }}; | ||||||
| EX geometry_filter gf_spherical = {"spherical", [] { return (arcm::in() || arb::in() || sphere) && !forced_quotient(); }}; | EX geometry_filter gf_spherical = {"spherical", 's', [] { return (arcm::in() || arb::in() || sphere) && !forced_quotient(); }}; | ||||||
| EX geometry_filter gf_euclidean = {"Euclidean", [] { return (arcm::in() || arb::in() || euclid) && !forced_quotient(); }}; | EX geometry_filter gf_euclidean = {"Euclidean", 'e', [] { return (arcm::in() || arb::in() || euclid) && !forced_quotient(); }}; | ||||||
| EX geometry_filter gf_other = {"non-isotropic", [] { return prod || nonisotropic; }}; | EX geometry_filter gf_other = {"non-isotropic", 'n', [] { return prod || nonisotropic; }}; | ||||||
| EX geometry_filter gf_regular_2d = {"regular 2D tesselations", [] {  | EX geometry_filter gf_regular_2d = {"regular 2D tesselations", 'r', [] {  | ||||||
|   return standard_tiling() && WDIM == 2 && !forced_quotient(); |   return standard_tiling() && WDIM == 2 && !forced_quotient(); | ||||||
|   }}; |   }}; | ||||||
| EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", [] {  | EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", '3', [] {  | ||||||
|   if(euclid) return geometry == gCubeTiling; |   if(euclid) return geometry == gCubeTiling; | ||||||
|   return !bt::in() && !kite::in() && WDIM == 3 && !forced_quotient() && !nonisotropic && !prod; |   return !bt::in() && !kite::in() && WDIM == 3 && !forced_quotient() && !nonisotropic && !prod; | ||||||
|   }}; |   }}; | ||||||
| EX geometry_filter gf_quotient = {"interesting quotient spaces", [] {  | EX geometry_filter gf_quotient = {"interesting quotient spaces", 'q', [] {  | ||||||
|   return forced_quotient() && !elliptic; |   return forced_quotient() && !elliptic; | ||||||
|   }}; |   }}; | ||||||
| EX geometry_filter gf_tes_file = {"load from file", [] { return arb::in(); }}; | EX geometry_filter gf_tes_file = {"load from file", 'f', [] { return arb::in(); }}; | ||||||
|  | EX geometry_filter gf_no_filters = {"no filters", '-', [] { return true; }}; | ||||||
|    |    | ||||||
| EX vector<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient, &gf_tes_file }; | EX vector<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient, &gf_tes_file, &gf_no_filters }; | ||||||
|  |  | ||||||
| void ge_select_filter() { | void ge_select_filter() { | ||||||
|   cmode = sm::SIDE | sm::MAYDARK; |   cmode = sm::SIDE | sm::MAYDARK; | ||||||
| @@ -282,12 +284,11 @@ void ge_select_filter() { | |||||||
|  |  | ||||||
|   dialog::init(XLAT("geometries")); |   dialog::init(XLAT("geometries")); | ||||||
|    |    | ||||||
|   char x = 'a'; |  | ||||||
|   for(auto f: available_filters) { |   for(auto f: available_filters) { | ||||||
|     if(current_filter) |     if(current_filter) | ||||||
|       dialog::addBoolItem(XLAT(f->name), f == current_filter, x++); |       dialog::addBoolItem(XLAT(f->name), f == current_filter, f->hotkey); | ||||||
|     else |     else | ||||||
|       dialog::addItem(XLAT(f->name), x++); |       dialog::addItem(XLAT(f->name), f->hotkey); | ||||||
|     dialog::add_action([f] { current_filter = f; popScreen(); }); |     dialog::add_action([f] { current_filter = f; popScreen(); }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -380,7 +381,8 @@ void ge_select_tiling() { | |||||||
|  |  | ||||||
|   dialog::addBreak(100); |   dialog::addBreak(100); | ||||||
|    |    | ||||||
|   char letter = 'a'; |   dialog::start_list(500, 1500, 'a'); | ||||||
|  |    | ||||||
|   for(int i=0; i<isize(ginf); i++) { |   for(int i=0; i<isize(ginf); i++) { | ||||||
|     eGeometry g = eGeometry(i); |     eGeometry g = eGeometry(i); | ||||||
|     if(among(g, gProduct, gRotSpace)) hybrid::configure(g); |     if(among(g, gProduct, gRotSpace)) hybrid::configure(g); | ||||||
| @@ -408,11 +410,12 @@ void ge_select_tiling() { | |||||||
|     dialog::addBoolItem( |     dialog::addBoolItem( | ||||||
|       is_product ? XLAT("current geometry x E") :  |       is_product ? XLAT("current geometry x E") :  | ||||||
|       is_rotspace ? XLAT("space of rotations in current geometry") :  |       is_rotspace ? XLAT("space of rotations in current geometry") :  | ||||||
|       XLAT(ginf[g].menu_displayed_name), on, letter++); |       XLAT(ginf[g].menu_displayed_name), on, dialog::list_fake_key++); | ||||||
|     dialog::lastItem().value += validclasses[land_validity(specialland).quality_level]; |     dialog::lastItem().value += validclasses[land_validity(specialland).quality_level]; | ||||||
|     dialog::add_action([g] { set_or_configure_geometry(g); }); |     dialog::add_action([g] { set_or_configure_geometry(g); }); | ||||||
|     } |     } | ||||||
|    |    | ||||||
|  |   dialog::end_list(); | ||||||
|   dialog::addBreak(100); |   dialog::addBreak(100); | ||||||
|   dual::add_choice();   |   dual::add_choice();   | ||||||
|   dialog::addBack(); |   dialog::addBack(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue