My Pygame Game Engine

More updates to gui.py and fallback screen

Fixed fallback screen to be dynamic with screen size and fixed misstype in gui_text in gui.py that made the percentage_constraint for the y position adjust according to the width instead of the height as its supposed to do.

WillM e20dee44 f3519a86

src/scripts/__pycache__/__init__.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/__pycache__/game_manager.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/colors.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/debug.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/fonts.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/gui.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/image.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/input.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/language.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/math_utils.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/renderer.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/modules/__pycache__/sound.cpython-39.pyc

This is a binary file and will not be displayed.

+3 -2
src/scripts/modules/gui.py
··· 320 320 if class_use == center_constraint: 321 321 self.y = self.parent.y + (self.parent.height / 2) - (self.size * (len(self.draw_text) - 1)) / 2 322 322 elif class_use == percentage_constraint: 323 - self.y = self.parent.y + (self.parent.width * self.y_constraint.value) 323 + self.y = self.parent.y + (self.parent.height * self.y_constraint.value) 324 324 elif class_use == pixel_constraint: 325 325 self.y = self.parent.y + self.y_constraint.value 326 326 ··· 332 332 333 333 def render(self): 334 334 for i, item in enumerate(self.draw_text): 335 - img, rect = self.game.math.rotate_center(self.game.font_handler.render(item, 'default', self.size, self.color), 0, self.x, (self.y + self.size * i)) 335 + #pygame.draw.circle(self.game.renderer.main_surface, (255, 0, 0), (self.x ,self.y) ,4) 336 + img, rect = self.game.math.rotate_center(self.game.font_handler.render(item, 'default', self.size, self.color), 0, self.x, ((self.y + self.size * i))) 336 337 self.game.renderer.main_surface.blit(img, rect) 337 338 338 339 class gui_toggle_button:
+4 -3
src/scripts/modules/renderer.py
··· 138 138 self.text = gui_text(game) 139 139 self.text.parent = self.rect 140 140 self.text.set_x_constraint(center_constraint()) 141 - self.text.set_y_constraint(percentage_constraint(0.25)) 141 + self.text.set_y_constraint(percentage_constraint(0.35)) 142 + self.text.set_size_constraint(percentage_constraint(0.1)) 142 143 self.text.size = 62 143 144 self.text.text = "Fallback Screen" 144 145 145 146 self.text2 = gui_text(game) 146 147 self.text2.parent = self.rect 147 148 self.text2.set_x_constraint(center_constraint()) 148 - self.text2.set_y_constraint(percentage_constraint(0.3)) 149 - self.text2.size = 23 149 + self.text2.set_y_constraint(center_constraint()) 150 + self.text2.set_size_constraint(percentage_constraint(0.1)) 150 151 self.text2.text = "This screen either appeared because you put in a \ninvalid name for a screen switch or you have no screen loaded.\nIf you think this is a bug create a issue on the Github page." 151 152 152 153 ## Redirect button
src/scripts/screens/__pycache__/__init__.cpython-39.pyc

This is a binary file and will not be displayed.

src/scripts/screens/__pycache__/gui_test.cpython-39.pyc

This is a binary file and will not be displayed.