diff --git a/arcade/experimental/basic_renderer.py b/arcade/experimental/examples/basic_renderer.py similarity index 77% rename from arcade/experimental/basic_renderer.py rename to arcade/experimental/examples/basic_renderer.py index 0148931b1..6aa1adf8a 100644 --- a/arcade/experimental/basic_renderer.py +++ b/arcade/experimental/examples/basic_renderer.py @@ -57,21 +57,17 @@ def __init__(self, width, height, title): self.quad_2 = geometry.quad_2d(pos=(0.5, 0.5)) def on_draw(self): - try: - self.clear() - self.color_program['color'] = ( - (math.sin(self.time) + 1.0) / 2, - (math.sin(self.time + 2) + 1.0) / 2, - (math.sin(self.time + 3) + 1.0) / 2, - 1.0 - ) - self.quad_1.render(self.color_program) - self.quad_2.render(self.uv_program) - - arcade.draw_circle_filled(100, 100, 100, arcade.color.APPLE_GREEN) + self.clear() + self.color_program['color'] = ( + (math.sin(self.time) + 1.0) / 2, + (math.sin(self.time + 2) + 1.0) / 2, + (math.sin(self.time + 3) + 1.0) / 2, + 1.0 + ) + self.quad_1.render(self.color_program) + self.quad_2.render(self.uv_program) - except Exception: - exit(1) + arcade.draw_circle_filled(100, 100, 100, arcade.color.APPLE_GREEN) def on_update(self, dt): self.time += dt diff --git a/arcade/experimental/examples/geometry_shader.py b/arcade/experimental/examples/geometry_shader.py index 9c6a4b158..9c0fe2242 100644 --- a/arcade/experimental/examples/geometry_shader.py +++ b/arcade/experimental/examples/geometry_shader.py @@ -47,29 +47,33 @@ def __init__(self, width, height, title): // Get the position emitted from the vertex shader // We get the 0th element because point primitives only have 1 position. vec4 pos = gl_in[0].gl_Position; - float offset = 0.02 + sin(time * 5.0) / 200.0; + float offset = 0.02 + sin(time * 5.0 + gl_PrimitiveIDIn) / 200.0; float rot = time + length(pos) * 10.0; mat2 rotate = mat2( cos(rot), -sin(rot), sin(rot), cos(rot) ); - + vec3 color = vec3( + (sin(time + gl_PrimitiveIDIn) + 1.0) / 2.0, + (sin(time + 2 + gl_PrimitiveIDIn) + 1.0) / 2.0, + (sin(time + 3 + gl_PrimitiveIDIn) + 1.0) / 2.0 + ); // Emit 4 vertices around the original vertex position making a quad gl_Position = pos + vec4(rotate * vec2(-offset, offset), 0.0, 0.0); - gs_color = vec3(pos.x, pos.y, 0.5); + gs_color = color; EmitVertex(); gl_Position = pos + vec4(rotate * vec2(-offset, -offset), 0.0, 0.0); - gs_color = vec3(pos.x, pos.y, 0.5); + gs_color = color; EmitVertex(); gl_Position = pos + vec4(rotate * vec2(offset, offset), 0.0, 0.0); - gs_color = vec3(pos.x, pos.y, 0.5); + gs_color = color; EmitVertex(); gl_Position = pos + vec4(rotate * vec2(offset, -offset), 0.0, 0.0); - gs_color = vec3(pos.x, pos.y, 0.5); + gs_color = color; EmitVertex(); // Done with the primitive diff --git a/arcade/gui.py b/arcade/gui.py index ca060fad5..5d964b331 100644 --- a/arcade/gui.py +++ b/arcade/gui.py @@ -400,7 +400,7 @@ class Theme: DEFAULT_FONT_NAME = ('Calibri', 'Arial') def __init__(self): - self.button_textures: Dict[str, Optional['', arcade.Texture]] =\ + self.button_textures: Dict[str, Optional[str, arcade.Texture]] =\ {'normal': '', 'hover': '', 'clicked': '', 'locked': '', } self.menu_texture = "" self.window_texture = "" diff --git a/arcade/tilemap.py b/arcade/tilemap.py index 19292cab0..a7061753f 100644 --- a/arcade/tilemap.py +++ b/arcade/tilemap.py @@ -468,7 +468,7 @@ def process_layer(map_object: pytiled_parser.objects.TileMap, layer_name: str, scaling: float = 1, base_directory: str = "", - use_spatial_hash: Optional[bool] = None) -> SpriteList: + use_spatial_hash: bool = False) -> SpriteList: """ This takes a map layer returned by the read_tmx function, and creates Sprites for it.