import pygame
def abs_to_screen(rect,screen_loc):
    """
    Converts a rectangle using absolute coordinates to screen coordinates
    """
    #do everything with a temp rect to prevent object editing stuffs
    tmp_rect = pygame.Rect(rect)
    tmp_rect.left -= screen_loc.left
    tmp_rect.top -= screen_loc.top
    return tmp_rect
def is_on_screen(absrect,screen_rect):
    """
    returns if a rect(in abs coords) is on the screen at all
    """
    rect = abs_to_screen(absrect,screen_rect)
    return ((rect.right > 0 and rect.right < screen_rect.width) or (rect.left > 0 and rect.left < screen_rect.width)) and \
           ((rect.top > 0 and rect.top < screen_rect.height) or (rect.bottom > 0 and rect.bottom < screen_rect.height))
    
