#!/usr/bin/python3

import pygame.font

class Display_Text:
    def __init__(self, window):
        self.screen = window.screen
        self.screen_rect = self.screen.get_rect()

        self.font_white = (250, 250, 250)
        self.font_purple = (120, 82, 158)
        self.font_amber = (107, 20, 38)
        self.font = pygame.font.SysFont(None, 20)
        self.gpu_temp = 0
        self.cpu_temp = 0

    def prep_message(self, window, gputemp, gpu_utilization, cputemp):
        self.gpu_temp_image = self.font.render(f'GPU Temp: {str(gputemp)}', True, self.font_purple)
        self.gpu_temp_rect = self.gpu_temp_image.get_rect()
        self.cpu_temp_image = self.font.render(f'CPU Temp: {str(cputemp)}', True, self.font_white)
        self.cpu_temp_rect = self.cpu_temp_image.get_rect()
        self.gpu_utilization_image = self.font.render(f'GPU Utilization: {str(gpu_utilization)}', True, self.font_amber)
        self.gpu_utilization_rect = self.gpu_utilization_image.get_rect()

        self.gpu_temp_rect.midbottom = window.sailor_saturn.rect.midtop
        self.gpu_utilization_rect.midbottom = window.sailor_pluto.rect.midtop

    def show_text(self):
        try:
            self.screen.blit(self.gpu_temp_image, self.gpu_temp_rect)
            self.screen.blit(self.gpu_utilization_image, self.gpu_utilization_rect)
        except:
            pass

