forked from ayte/PinmikPanik
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
import gamedata.objects.menu.menu as menu
|
|
|
|
class MainMenu(menu.Menu):
|
|
def __init__(self,x,y,game,w=100,h=100):
|
|
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
|
|
# Buttons dictionnaries
|
|
def fnPlay(self,game):
|
|
game.scene = game.scenes.ingame
|
|
btnPlay = {"name":"Play","function":fnPlay}
|
|
def fnOptions(self,game):
|
|
game.scene = game.scenes.options
|
|
btnOptions= {"name":"Options","function": fnOptions}
|
|
def fnQuit(self,game):
|
|
game.running = False
|
|
btnQuit= {"name":"Quit","function": fnQuit}
|
|
|
|
# Spacing between buttons
|
|
self.vpadding = 20
|
|
self.hpadding = 20
|
|
|
|
# Initialising grid
|
|
self.grid = [
|
|
[btnPlay],
|
|
[btnOptions],
|
|
[btnQuit]
|
|
]
|
|
|
|
self.create(self.grid,self.rect)
|
|
|
|
self.depth = -1
|
|
|
|
# Shadow sprite
|
|
shadow = game.sprite_lib["shadow.png"]
|
|
self.shadow = game.pygame.transform.scale(shadow,(1000,1000)) # J'augmente la taille de l'ombre
|
|
|
|
def draw(self):
|
|
# Shadow
|
|
self.game.lib.drawcenter(self.game,self.shadow,self.game.DISPLAY_WIDTH/2,self.game.DISPLAY_HEIGHT*3/5)
|
|
# Display game title
|
|
self.game.lib.drawcenter(self.game,self.game.sprite_lib["gui/title.png"],self.game.DISPLAY_WIDTH/2,self.baserect[1]-self.game.DISPLAY_HEIGHT/8)
|