Ensure tile pos is always visible in map editor
The tile position label was not entirely visible when hovering the tiles near the top/right of the screen. This modification ensures that the label is always visible by moving it to the opposite side of the tile if there is not enough space to display it on the default position.
This commit is contained in:
		
							
								
								
									
										14
									
								
								src/map.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/map.c
									
									
									
									
									
								
							@@ -411,12 +411,16 @@ static void drawCursorPos(Map* map, s32 x, s32 y)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	sprintf(pos, "%03i:%03i", tx, ty);
 | 
						sprintf(pos, "%03i:%03i", tx, ty);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	x += (TIC_SPRITESIZE + 3);
 | 
						s32 width = map->tic->api.text(map->tic, pos, TIC80_WIDTH, 0, systemColor(tic_color_gray));
 | 
				
			||||||
	y -= (TIC_FONT_HEIGHT + 2);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s32 width = map->tic->api.text(map->tic, pos, x, y, systemColor(tic_color_gray));
 | 
						s32 px = x + (TIC_SPRITESIZE + 3);
 | 
				
			||||||
	map->tic->api.rect(map->tic, x - 1, y - 1, width + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white));
 | 
						if(px + width >= TIC80_WIDTH) px = x - (width + 2);
 | 
				
			||||||
	map->tic->api.text(map->tic, pos, x, y, systemColor(tic_color_light_blue));
 | 
					
 | 
				
			||||||
 | 
						s32 py = y - (TIC_FONT_HEIGHT + 2);
 | 
				
			||||||
 | 
						if(py <= TOOLBAR_SIZE) py = y + (TIC_SPRITESIZE + 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						map->tic->api.rect(map->tic, px - 1, py - 1, width + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white));
 | 
				
			||||||
 | 
						map->tic->api.text(map->tic, pos, px, py, systemColor(tic_color_light_blue));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void setMapSprite(Map* map, s32 x, s32 y)
 | 
					static void setMapSprite(Map* map, s32 x, s32 y)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user