diff --git a/gamedata/assets/gui/optionsbg.png b/gamedata/assets/gui/optionsbg.png new file mode 100644 index 0000000..06fe926 Binary files /dev/null and b/gamedata/assets/gui/optionsbg.png differ diff --git a/gamedata/objects/bg/menubackground.py b/gamedata/objects/bg/menubackground.py index c7322d2..01b2533 100644 --- a/gamedata/objects/bg/menubackground.py +++ b/gamedata/objects/bg/menubackground.py @@ -7,11 +7,8 @@ class MenuBackground(BaseObject): # Islands self.sprite = game.sprite_lib["ingame.png"] - # Shadow sprite - shadow = game.sprite_lib["shadow.png"] - self.shadow = game.pygame.transform.scale(shadow,(1500,1500)) # J'augmente la taille de l'ombre - self.depth = 0 + self.depth = -2 self.cameraratio = 0.1 @@ -26,4 +23,3 @@ class MenuBackground(BaseObject): def draw(self): game = self.game game.window.blit(self.sprite,[-game.globals["camerax"]*self.cameraratio,-game.globals["cameray"]*self.cameraratio]) - game.lib.drawcenter(game,self.shadow,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT*3/5) diff --git a/gamedata/objects/menu/mainmenu.py b/gamedata/objects/menu/mainmenu.py index 1565385..414d09e 100644 --- a/gamedata/objects/menu/mainmenu.py +++ b/gamedata/objects/menu/mainmenu.py @@ -27,6 +27,14 @@ class MainMenu(menu.Menu): 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) diff --git a/gamedata/objects/menu/optionmenu.py b/gamedata/objects/menu/optionmenu.py index 73a075a..f6921e8 100644 --- a/gamedata/objects/menu/optionmenu.py +++ b/gamedata/objects/menu/optionmenu.py @@ -14,3 +14,8 @@ class OptionMenu(menu.Menu): ] self.create(self.grid,self.rect) + + self.depth = -1 + + def draw(self): + self.game.window.blit(self.game.sprite_lib["gui/optionsbg.png"],[0,0]) diff --git a/gamedata/objects/sliders/slider.py b/gamedata/objects/sliders/slider.py index e9f3887..3adfcf6 100644 --- a/gamedata/objects/sliders/slider.py +++ b/gamedata/objects/sliders/slider.py @@ -69,11 +69,11 @@ class Slider(base.BaseObject): game = self.game - game.window.blit(self.bgsprite,(self.baserect[0]-game.globals["camerax"],self.baserect[1]-game.globals["cameray"])) - game.window.blit(self.sprite,(self.rect[0]-game.globals["camerax"],self.rect[1]-game.globals["cameray"])) + game.window.blit(self.bgsprite,self.baserect[:2]) + game.window.blit(self.sprite,self.rect[:2]) txt = game.fontfile.render(str(round(self.currentvalue))+self.posttext,False,[255]*3) - px = self.baserect[0]+self.baserect[2]+50-game.globals["camerax"] - py = self.rect[1]+self.rect[3]/2-txt.get_height()/2-game.globals["camerax"] + px = self.baserect[0]+self.baserect[2]+50 + py = self.rect[1]+self.rect[3]/2-txt.get_height()/2 game.window.blit(txt,[px,py]) diff --git a/gamedata/scenes.py b/gamedata/scenes.py index c00242b..3f47d85 100644 --- a/gamedata/scenes.py +++ b/gamedata/scenes.py @@ -32,7 +32,8 @@ def ingame(game): game.gameloop.summon(Manager(game)) def options(game): - game.gameloop.reinit() + game.gameloop.delname("Button") + game.gameloop.delname("MainMenu") game.globals["camerax"] = 0 game.globals["cameray"] = 0 s = BGMSlider(40,40,game,400,40) @@ -40,6 +41,7 @@ def options(game): menu = OptionMenu(round(game.DISPLAY_WIDTH/8),round(game.DISPLAY_HEIGHT*9/10),game,round(game.DISPLAY_WIDTH*6/8),round(game.DISPLAY_HEIGHT/10-game.DISPLAY_HEIGHT/30)) game.gameloop.summon(s) game.gameloop.summon(s2) + game.gameloop.summon(menu) def gameover(game): game.gameloop.reinit()