feat: allow conversion of Widget.Box to renderer.Layer.Options
This commit is contained in:
		
							parent
							
								
									ca05f24873
								
							
						
					
					
						commit
						6cc45d76cf
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -1,4 +1,5 @@ | |||
| const Plane = @import("renderer").Plane; | ||||
| const Layer = @import("renderer").Layer; | ||||
| 
 | ||||
| const Self = @This(); | ||||
| 
 | ||||
|  | @ -35,6 +36,15 @@ pub fn from(n: Plane) Self { | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| pub fn to_layer(self: Self) Layer.Options { | ||||
|     return .{ | ||||
|         .y = @intCast(self.y), | ||||
|         .x = @intCast(self.x), | ||||
|         .h = @intCast(self.h), | ||||
|         .w = @intCast(self.w), | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| pub fn is_abs_coord_inside(self: Self, y: usize, x: usize) bool { | ||||
|     return y >= self.y and y < self.y + self.h and x >= self.x and x < self.x + self.w; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue