def on_draw(): global toolbar, frames, current_frame, linked_scenes # Render entire toolbar, all user-drawn shapes arcadeplus.start_render() if (current_frame - 1) in linked_scenes.keys(): background_texture = arcadeplus.load_texture( "data/scenes/" + linked_scenes[current_frame - 1] + ".png") arcadeplus.draw_texture_rectangle(center_x=500, center_y=400, width=800, height=800, texture=background_texture) try: frames[current_frame - 1].draw() except Exception as e: pass try: toolbar.draw() except Exception as e: pass render_toolbar_icons() render_toolbar_text()
def on_draw(self): """ Render the screen. """ arcadeplus.start_render() # Get viewport dimensions left, screen_width, bottom, screen_height = self.get_viewport() text_size = 18 # Draw text on the screen so the user has an idea of what is happening arcadeplus.draw_text( "Press F to toggle between full screen and windowed mode, unstretched.", screen_width // 2, screen_height // 2 - 20, arcadeplus.color.WHITE, text_size, anchor_x="center") arcadeplus.draw_text( "Press S to toggle between full screen and windowed mode, stretched.", screen_width // 2, screen_height // 2 + 20, arcadeplus.color.WHITE, text_size, anchor_x="center") # Draw some boxes on the bottom so we can see how they change for x in range(64, 800, 128): y = 64 width = 128 height = 128 arcadeplus.draw_texture_rectangle(x, y, width, height, self.example_image)
def render_toolbar_icons(): img_names = ["PREV FRM", "UNDO", "DEL FRM", "LOAD SCN"] index = 0 for img_name in img_names: try: background_texture = arcadeplus.load_texture("res/icons/" + img_name + ".png") arcadeplus.draw_texture_rectangle(center_x=925, center_y=625 - (index * 50), width=40, height=40, texture=background_texture) except: pass index += 1 img_names = ["NEXT FRM", "CLR FRM", "NEW FRM", "NEW SCN"] index = 0 for img_name in img_names: try: background_texture = arcadeplus.load_texture("res/icons/" + img_name + ".png") arcadeplus.draw_texture_rectangle(center_x=975, center_y=625 - (index * 50), width=40, height=40, texture=background_texture) except: pass index += 1
def draw_texture_theme(self): if self.pressed: arcadeplus.draw_texture_rectangle(self.center_x, self.center_y, self.width, self.height, self.clicked_texture) else: arcadeplus.draw_texture_rectangle(self.center_x, self.center_y, self.width, self.height, self.normal_texture)
def on_draw(self): if self.active: if self.theme: arcadeplus.draw_texture_rectangle(self.x, self.y, self.width, self.height, self.texture) else: arcadeplus.draw_rectangle_filled(self.x, self.y, self.width, self.height, self.color) for button in self.button_list: button.draw() for text in self.text_list: text.draw()
def main(): arcadeplus.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE) arcadeplus.set_background_color(BACKGROUND_COLOR) arcadeplus.start_render() arcadeplus.draw_circle_filled(400, 250, 100, arcadeplus.color.BLACK) # load image image = arcadeplus.load_texture(resource_path('character.png')) arcadeplus.draw_texture_rectangle(200, 250, image.width, image.height, image) # load sound sound = arcadeplus.sound.load_sound(resource_path('cat-meow.wav')) arcadeplus.sound.play_sound(sound) arcadeplus.finish_render() arcadeplus.run() return
def on_draw(self): arcadeplus.start_render() scale = .6 arcadeplus.draw_texture_rectangle(540, 120, self.texture.image.width * scale, self.texture.image.height * scale, self.texture, angle=45) arcadeplus.draw_lrwh_rectangle_textured(10, 400, 64, 64, self.texture) for i in range(15): arcadeplus.draw_scaled_texture_rectangle(i * 50 + 20, 220, self.texture, scale, angle=45, alpha=i * 15)
def texture_theme_draw(self): arcadeplus.draw_texture_rectangle(self.x, self.y, self.width, self.height, self.texture) self.draw_text()