Ejemplo n.º 1
0
def draw_info(operation_mode, current_stage, clk):
    x = 15
    y = 600

    # Ciclos de reloj
    clk_text = font_bold.render("CLK: " + str(clk), True, black)
    screen.blit(clk_text, (x, y))

    # Modo de operacion
    y += 30
    operation_mode_text = font_bold.render(
        "Modo de operación: " + operation_mode, True, black)
    screen.blit(operation_mode_text, (x, y))
Ejemplo n.º 2
0
def draw_alert_rect(x, y, alert):
    width = 170
    background_rect = pygame.Rect(x, y, width, 33)
    pygame.draw.rect(screen, cpu_alert_background, background_rect, 0, 10)

    title = font_bold.render(alert, True, cpu_text_color)

    title_width = title.get_width()
    screen.blit(title, (x + abs(width - title_width) / 2, y + 5))
Ejemplo n.º 3
0
def draw_mem_operations(x, y, operations):
    width = 170
    background_rect = pygame.Rect(x, y, width, 132)
    pygame.draw.rect(screen, cpu_alert_background, background_rect, 0, 10)
    for i in range(0, len(operations)):
        font = font_bold.render(operations[i], True, white)
        text_width = font.get_width()
        screen.blit(font, (x + abs(width - text_width) / 2,
                           (y + 10) + space_y * (i)))
Ejemplo n.º 4
0
def draw_node_element_rect(x, y, width, height, title_text):
    background_rect = pygame.Rect(x, y, width, height)
    pygame.draw.rect(screen, cpu_rect_background, background_rect)
    pygame.draw.rect(screen, cpu_rect_background, background_rect)
    pygame.draw.rect(screen, cpu_rect_border, background_rect, 4)

    title_rect = pygame.Rect(x, y, width, 30)
    pygame.draw.rect(screen, cpu_rect_border, title_rect)

    title = font_bold.render(title_text, True, cpu_text_color)

    title_width = title.get_width()
    screen.blit(title, (x + abs(width - title_width) / 2, y + 5))
Ejemplo n.º 5
0
def draw_cpu(x, y, num, cpu_instr):
    max_width = 170
    draw_node_element_rect(x, y, max_width, 125, "Procesador " + str(num))

    x += 10
    y += 5

    for i in range(0, len(cpu_instr)):
        if i == len(cpu_instr) - 1:
            instr_rect = pygame.Rect(x - 3, y + space_y * (i + 1),
                                     max_width - 13, 24)
            pygame.draw.rect(screen, cpu_rect_aux, instr_rect, 0, 10)
            instr = font_bold.render(cpu_instr[i], True, cpu_text_color)
            screen.blit(instr, (x, y + space_y * (i + 1)))
        else:
            instr = font.render(cpu_instr[i], True, cpu_text_color)
            screen.blit(instr, (x, y + space_y * (i + 1)))
def write_text(x, y, text):
    text = font_bold.render(text, True, white)
    screen.blit(text, (x, y))