def build(self, width, height): self.width, self.height = width, height self.x, self.y = (director.window.width - width) // 2, (director.window.height - height) // 2 title_label = Label(self.popup_ctrl.title, font_name='Calibri', color=rgba_colors["black"], font_size=23, anchor_x='center', anchor_y='center') title_label.x = width // 2 title_label.y = height - 50 self.add(title_label) message_label = Label(self.popup_ctrl.message, font_name='Calibri', color=rgba_colors["black"], font_size=16, anchor_x='center', anchor_y='center') message_label.x = width // 2 message_label.y = height - 100 self.add(message_label) for i, button in enumerate(self.popup_ctrl.buttons): padding = 20 button_container = ColorLayer(*rgba_colors["popup_button_background"], width=(width - padding) // len(self.popup_ctrl.buttons) - padding, height=40) button_container.position = padding * (i + 1) + button_container.width * i, 30 self.add(button_container) self.buttons_container.append(button_container) button_text = Label(button.text, font_name='Calibri', color=rgba_colors["white"], font_size=18, anchor_x='center', anchor_y='center') button_text.position = button_container.x + button_container.width / 2, button_container.y + button_container.height / 2 + 3 self.add(button_text) director.window.push_handlers(self.popup_ctrl)
def __init__(self): super().__init__(100, 100, 100, 100) events.settingsevents.push_handlers(self) global x, y self.width = int(x * 0.75) self.height = int(y * 0.6) self.x = int((x / 2) - (self.width / 2)) self.y = int((y * 0.37) - (self.height / 2)) self.active = self._active = True self.posleft = int(-self.width) self.poscenter = int((x / 2) - (self.width / 2)) self.posright = int(x) fullscreenLabel = Label("Fullscreen", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) fullscreenLabel.x = self.width * 0.05 fullscreenLabel.y = self.height * 0.9 fullscreenButton = SettingsToggleButton(cfg.configuration, section = "Core", option = "fullscreen", command = director.window.set_fullscreen) fullscreenButton.x = self.width * 0.9 fullscreenButton.y = self.height * 0.9 vsyncLabel = Label("VSync", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) vsyncLabel.x = self.width * 0.05 vsyncLabel.y = self.height * 0.7 vsyncButton = SettingsToggleButton(cfg.configuration, section = "Core", option = "vsync", command = director.window.set_vsync) vsyncButton.x = self.width * 0.9 vsyncButton.y = self.height * 0.7 showfpsLabel = Label("Show FPS", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) showfpsLabel.x = self.width * 0.05 showfpsLabel.y = self.height * 0.5 showfpsButton = SettingsToggleButton(cfg.configuration, section = "Core", option = "showfps", command = director.set_show_FPS) showfpsButton.x = self.width * 0.9 showfpsButton.y = self.height * 0.5 resInputLabel = Label("Resolution", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) resInputLabel.x = self.width * 0.05 resInputLabel.y = self.height * 0.3 resInput = self.ResolutionInput(self) self.add(fullscreenButton) self.add(fullscreenLabel) self.add(vsyncButton) self.add(vsyncLabel) self.add(showfpsButton) self.add(showfpsLabel) self.add(resInput) self.add(resInputLabel)
def __init__(self): super().__init__(0, 0, 255, 255) events.settingsevents.push_handlers(self) global x, y self.width = int(x * 0.75) self.height = int(y * 0.6) self.posleft = int(-self.width) self.poscenter = int((x / 2) - (self.width / 2)) self.posright = int(x) self.x = self.posright self.y = int((y * 0.37) - (self.height / 2)) self.active = self._active = False miscInfo = Label("Coming Soon", anchor_x="center", anchor_y="center", font_size=35, multiline=True, width=(self.width * 0.8), align="center") miscInfo.x = self.width / 2 miscInfo.y = self.height / 2 self.add(miscInfo)
def __init__(self, parent): super().__init__() reswidth, resheight = [int(res) for res in cfg.configuration["Core"]["defaultres"].split("x")] self.txtBoxWidth = elements.TextBox(self, 0, 0, default_text=str(reswidth), charLimit=4) seperator = Label("X", anchor_x = "center", anchor_y = "center", font_size = 15, color = (255, 255, 255, 255)) seperator.x = self.txtBoxWidth.width seperator.y = 0 self.width = (self.txtBoxWidth.width * 2) self.height = self.txtBoxWidth.height self.txtBxHeight = elements.TextBox(self, self.width, 0, default_text=str(resheight), charLimit=4) self.x = parent.width - (self.width + (parent.width * 0.1)) self.y = parent.height * 0.3 self.txtBoxWidth.parentx = parent.x + self.x self.txtBoxWidth.parenty = parent.y + self.y self.txtBxHeight.parentx = parent.x + self.x self.txtBxHeight.parenty = parent.y + self.y self.add(self.txtBoxWidth) self.add(seperator) self.add(self.txtBxHeight) self.showing = self._showing = True self.schedule_interval(self.changed, 0.5) self.resume_scheduler()
def __init__(self): super().__init__(100, 100, 100, 100) events.settingsevents.push_handlers(self) global x, y self.width = int(x * 0.75) self.height = int(y * 0.6) self.posleft = int(-self.width) self.poscenter = int((x / 2) - (self.width / 2)) self.posright = int(x) self.x = self.posright self.y = int((y * 0.37) - (self.height / 2)) self.active = self._active = False controlsLabel = Label("Controls", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) controlsLabel.x = self.width * 0.05 controlsLabel.y = self.height * 0.9 controlsButton = elements.LargeButton("Controls", events.settingsevents.onControlsButtonClick, showing = False) controlsButton.lbl.element.font_size = 13 controlsButton.x = self.width * 0.9 controlsButton.y = self.height * 0.9 logLabel = Label("Log", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) logLabel.x = self.width * 0.05 logLabel.y = self.height * 0.7 logButton = SettingsToggleButton(cfg.configuration, section = "Core", option = "log", restartGame = True) logButton.x = self.width * 0.9 logButton.y = self.height * 0.7 if cfg.configuration["Debug"]["developer"] == "True": debugLabel = Label("Debug", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) debugLabel.x = self.width * 0.05 debugLabel.y = self.height * 0.5 debugButton = SettingsToggleButton(cfg.configuration, section = "Debug", option = "logging", restartGame = True) debugButton.x = self.width * 0.9 debugButton.y = self.height * 0.5 self.add(debugLabel) self.add(debugButton) errorLabel = Label("Error", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) errorLabel.x = self.width * 0.05 errorLabel.y = self.height * 0.3 errorButton = SettingsToggleButton(cfg.configuration, section = "Debug", option = "error", restartGame = True) errorButton.x = self.width * 0.9 errorButton.y = self.height * 0.3 self.add(errorLabel) self.add(errorButton) timesLabel = Label("Execution Times", font_size=25, anchor_x="left", anchor_y="center", color=(255, 255, 255, 255)) timesLabel.x = self.width * 0.05 timesLabel.y = self.height * 0.1 timesButton = SettingsToggleButton(cfg.configuration, section = "Debug", option = "times", restartGame = True) timesButton.x = self.width * 0.9 timesButton.y = self.height * 0.1 self.add(timesLabel) self.add(timesButton) self.add(controlsButton) self.add(controlsLabel) self.add(logLabel) self.add(logButton)