diff --git a/BlankProjectTemplate/src/Exit_image.png b/BlankProjectTemplate/src/Exit_image.png index a1934bb88a34a6261fb7c0aba47a75f4cd0574de..f2e6b63ec78e44ff3ada89af7bd7e6474f6bbe4b 100644 Binary files a/BlankProjectTemplate/src/Exit_image.png and b/BlankProjectTemplate/src/Exit_image.png differ diff --git a/BlankProjectTemplate/src/Interface.py b/BlankProjectTemplate/src/Interface.py index 6e1f146a53917513dcfc0a4b4f92c187ca2cd38e..cb6212b3b01c4d63ff385888bc9c1c89c0f5fe3b 100644 --- a/BlankProjectTemplate/src/Interface.py +++ b/BlankProjectTemplate/src/Interface.py @@ -30,6 +30,11 @@ class GUI(): font = pygame.font.SysFont(fontStyle,fontSize) text = font.render(text,True,color) surface.blit(text,coord) + + def custom_text(text,fontName,fontSize,color,coord,surface): + font = pygame.font.Font(fontName,fontSize) + text = font.render(text,True,color) + surface.blit(text,coord) ## @brief Makes the main interface of this game # @details This will output the main page of this game by using the class above def main(): @@ -58,7 +63,7 @@ def main(): theme.Themes.themes(100) else: GUI.button(game,lightBlue, [400,250,170,50], 0) - GUI.text('Beginner',"maiandragd", 25,[239, 245, 224],(438,260),game) + GUI.custom_text('Beginner',"Roboto-Light.ttf", 25,[239, 245, 224],(438,260),game) if (430 <= mousepos[0] <= 430+220 and 350 <= mousepos[1] <= 350+50 ): #checks if the mouse is hovering over the button @@ -68,7 +73,7 @@ def main(): theme.Themes.themes(70) else: GUI.button(game,lightBlue, [430,350,220,50], 0) - GUI.text('Intermediate',"maiandragd", 25,[239, 245, 224],(470,357),game) + GUI.custom_text('Intermediate',"Roboto-Light.ttf", 25,[239, 245, 224],(470,357),game) if (400 <= mousepos[0] <= 400+180 and 450 <= mousepos[1] <= 450+50 ): #checks if the mouse is hovering over the button @@ -78,7 +83,7 @@ def main(): theme.Themes.themes(50) else: GUI.button(game,lightBlue, [400,450,180,50], 0) - GUI.text('Advanced',"maiandragd", 25,[239, 245, 224],(435,457),game) + GUI.custom_text('Advanced',"Roboto-Light.ttf", 25,[239, 245, 224],(435,457),game) if (15 <= mousepos[0] <= 15+115 and 565 <= mousepos[1] <= 565+35 ): if mouseclick[0] == 1: diff --git a/BlankProjectTemplate/src/Roboto-Light.ttf b/BlankProjectTemplate/src/Roboto-Light.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d43e943312e0f2c653815dd791d93f94f0abd73f Binary files /dev/null and b/BlankProjectTemplate/src/Roboto-Light.ttf differ diff --git a/BlankProjectTemplate/src/ScoreDisplay.py b/BlankProjectTemplate/src/ScoreDisplay.py index ceaf44826534caf86d7565242b74ebeab9b351db..de1a1ec9a8e48036f311271eddb1423960927fdc 100644 --- a/BlankProjectTemplate/src/ScoreDisplay.py +++ b/BlankProjectTemplate/src/ScoreDisplay.py @@ -26,14 +26,14 @@ def display(score,speed, colour,food_colour, backgroundColour): run = True while run: - +## roboto_font = pygame.font.Font("Roboto-Black.ttf", 35) mousepos = pygame.mouse.get_pos() #checking mouse position mouseclick = pygame.mouse.get_pressed()#checking mouse pressed lastPage = pygame.display.set_mode((500, 500)) lastPage.blit(image1,(0,0)) ## lastPage.fill() - highscore.HighScore.text('Your Highscore is ' + str(score),"maiandragd", 35,[0, 0, 0],(70,50),lastPage) + highscore.HighScore.custom_text('Your Highscore is ' + str(score),"Roboto-Light.ttf", 40,[0, 0, 0],(93,50),lastPage) if (150 <= mousepos[0] <= 150+200 and 150 <= mousepos[1] <= 150+60 ): highscore.HighScore.button(lastPage,darkgray, [150,150,200,60], 0) @@ -41,7 +41,7 @@ def display(score,speed, colour,food_colour, backgroundColour): Gameplay.game(speed, colour,food_colour, backgroundColour) else: highscore.HighScore.button(lastPage,lightBlue, [150,150,200,60], 0) - highscore.HighScore.text('Play Again',"maiandragd", 25, white,(193,165),lastPage) + highscore.HighScore.custom_text('Play Again',"Roboto-Light.ttf", 25, white,(193,165),lastPage) if (150 <= mousepos[0] <= 150+200 and 260 <= mousepos[1] <= 260+60 ): highscore.HighScore.button(lastPage,darkgray, [150,260,200,60], 0) @@ -49,7 +49,7 @@ def display(score,speed, colour,food_colour, backgroundColour): Interface.main() else: highscore.HighScore.button(lastPage,lightBlue, [150,260,200,60], 0) - highscore.HighScore.text('Main Menu',"maiandragd", 25,white,(189,275),lastPage) + highscore.HighScore.custom_text('Main Menu',"Roboto-Light.ttf", 25,white,(189,275),lastPage) if (150 <= mousepos[0] <= 150+200 and 370 <= mousepos[1] <= 370+60 ): highscore.HighScore.button(lastPage,darkgray, [150,370,200,60], 0) @@ -58,7 +58,7 @@ def display(score,speed, colour,food_colour, backgroundColour): sys.exit() else: highscore.HighScore.button(lastPage,lightBlue, [150,370,200,60], 0) - highscore.HighScore.text('Quit',"maiandragd", 25,white,(225,385),lastPage) + highscore.HighScore.custom_text('Quit',"Roboto-Light.ttf", 25,white,(225,385),lastPage) pygame.display.update() diff --git a/BlankProjectTemplate/src/highscore.py b/BlankProjectTemplate/src/highscore.py index 3146b88ce425b68074870c6c86f553ead2895ae9..a77a783649def585d30fb0b2510f2633c60d83d7 100644 --- a/BlankProjectTemplate/src/highscore.py +++ b/BlankProjectTemplate/src/highscore.py @@ -20,6 +20,19 @@ class HighScore(): text = font.render(text,True,color) surface.blit(text,coord) + ## @brief A method to display custom text + # @details This function will print the text on the interface + # @param text The text to be printed + # @param fontStyle The font Style of the text to be displayed + # @param fontSize The size of the text written + # @param color The color of the text + # @param coord The coordinate at which the text should start displaying + # @param surface The background (surface) the text should be printed on + def custom_text(text,fontName,fontSize,color,coord,surface): + font = pygame.font.Font(fontName,fontSize) + text = font.render(text,True,color) + surface.blit(text,coord) + ## @brief A method to create a button # @details This method will make a box on the interface # @param surface The background (surface) the box should be made on diff --git a/BlankProjectTemplate/src/highscore.txt b/BlankProjectTemplate/src/highscore.txt index f70d7bba4ae1f07682e0358bd7a2068094fc023b..dc9414b21fc0a9f0da06762d78acf2a2774d9b01 100644 --- a/BlankProjectTemplate/src/highscore.txt +++ b/BlankProjectTemplate/src/highscore.txt @@ -1 +1 @@ -42 \ No newline at end of file +154 \ No newline at end of file