|  |  | @ -221,6 +221,7 @@ function Painter:init(args) | 
			
		
	
		
		
			
				
					
					|  |  |  |     self.y = self.y1 |  |  |  |     self.y = self.y1 | 
			
		
	
		
		
			
				
					
					|  |  |  |     self.cur_pen = to_pen(args.pen or COLOR_GREY) |  |  |  |     self.cur_pen = to_pen(args.pen or COLOR_GREY) | 
			
		
	
		
		
			
				
					
					|  |  |  |     self.cur_key_pen = to_pen(args.key_pen or COLOR_LIGHTGREEN) |  |  |  |     self.cur_key_pen = to_pen(args.key_pen or COLOR_LIGHTGREEN) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     self.to_map = false | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Painter.new(rect, pen) |  |  |  | function Painter.new(rect, pen) | 
			
		
	
	
		
		
			
				
					|  |  | @ -295,6 +296,11 @@ function Painter:key_pen(pen,...) | 
			
		
	
		
		
			
				
					
					|  |  |  |     return self |  |  |  |     return self | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | function Painter:map(to_map) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     self.to_map = to_map | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return self | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Painter:clear() |  |  |  | function Painter:clear() | 
			
		
	
		
		
			
				
					
					|  |  |  |     dscreen.fillRect(CLEAR_PEN, self.clip_x1, self.clip_y1, self.clip_x2, self.clip_y2) |  |  |  |     dscreen.fillRect(CLEAR_PEN, self.clip_x1, self.clip_y1, self.clip_x2, self.clip_y2) | 
			
		
	
		
		
			
				
					
					|  |  |  |     return self |  |  |  |     return self | 
			
		
	
	
		
		
			
				
					|  |  | @ -308,20 +314,20 @@ function Painter:fill(x1,y1,x2,y2,pen,bg,bold) | 
			
		
	
		
		
			
				
					
					|  |  |  |     y1 = math.max(y1+self.y1,self.clip_y1) |  |  |  |     y1 = math.max(y1+self.y1,self.clip_y1) | 
			
		
	
		
		
			
				
					
					|  |  |  |     x2 = math.min(x2+self.x1,self.clip_x2) |  |  |  |     x2 = math.min(x2+self.x1,self.clip_x2) | 
			
		
	
		
		
			
				
					
					|  |  |  |     y2 = math.min(y2+self.y1,self.clip_y2) |  |  |  |     y2 = math.min(y2+self.y1,self.clip_y2) | 
			
		
	
		
		
			
				
					
					|  |  |  |     dscreen.fillRect(to_pen(self.cur_pen,pen,bg,bold),x1,y1,x2,y2) |  |  |  |     dscreen.fillRect(to_pen(self.cur_pen,pen,bg,bold),x1,y1,x2,y2,self.to_map) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     return self |  |  |  |     return self | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Painter:char(char,pen,...) |  |  |  | function Painter:char(char,pen,...) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if self:isValidPos() then |  |  |  |     if self:isValidPos() then | 
			
		
	
		
		
			
				
					
					|  |  |  |         dscreen.paintTile(to_pen(self.cur_pen, pen, ...), self.x, self.y, char) |  |  |  |         dscreen.paintTile(to_pen(self.cur_pen, pen, ...), self.x, self.y, char, nil, self.to_map) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |     return self:advance(1, nil) |  |  |  |     return self:advance(1, nil) | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function Painter:tile(char,tile,pen,...) |  |  |  | function Painter:tile(char,tile,pen,...) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if self:isValidPos() then |  |  |  |     if self:isValidPos() then | 
			
		
	
		
		
			
				
					
					|  |  |  |         dscreen.paintTile(to_pen(self.cur_pen, pen, ...), self.x, self.y, char, tile) |  |  |  |         dscreen.paintTile(to_pen(self.cur_pen, pen, ...), self.x, self.y, char, tile, self.to_map) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
		
		
			
				
					
					|  |  |  |     return self:advance(1, nil) |  |  |  |     return self:advance(1, nil) | 
			
		
	
		
		
			
				
					
					|  |  |  | end |  |  |  | end | 
			
		
	
	
		
		
			
				
					|  |  | @ -340,7 +346,8 @@ function Painter:string(text,pen,...) | 
			
		
	
		
		
			
				
					
					|  |  |  |             dscreen.paintString( |  |  |  |             dscreen.paintString( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 to_pen(self.cur_pen, pen, ...), |  |  |  |                 to_pen(self.cur_pen, pen, ...), | 
			
		
	
		
		
			
				
					
					|  |  |  |                 self.x+dx, self.y, |  |  |  |                 self.x+dx, self.y, | 
			
		
	
		
		
			
				
					
					|  |  |  |                 string.sub(text,dx+1,len) |  |  |  |                 string.sub(text,dx+1,len), | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 self.to_map | 
			
		
	
		
		
			
				
					
					|  |  |  |             ) |  |  |  |             ) | 
			
		
	
		
		
			
				
					
					|  |  |  |         end |  |  |  |         end | 
			
		
	
		
		
			
				
					
					|  |  |  |     end |  |  |  |     end | 
			
		
	
	
		
		
			
				
					|  |  | 
 |