Skip to content
Snippets Groups Projects
Commit 72145072 authored by Hameed Andy's avatar Hameed Andy
Browse files

font changed | placement changed

parent d301e3ae
No related branches found
No related tags found
No related merge requests found
BlankProjectTemplate/src/Exit_image.png

5.31 KiB | W: | H:

BlankProjectTemplate/src/Exit_image.png

10 KiB | W: | H:

BlankProjectTemplate/src/Exit_image.png
BlankProjectTemplate/src/Exit_image.png
BlankProjectTemplate/src/Exit_image.png
BlankProjectTemplate/src/Exit_image.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -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:
......
File added
......@@ -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()
......
......@@ -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
......
42
\ No newline at end of file
154
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment