Release notes for PyKraken.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning when possible.
tilemap.Map constructor now accepts an optional path to load on creation.transform.angle property.move_world and move_screen.storage_buffer_sizes to Shader constructor.Shader.set_storage_buffer_data method for uploading data to a storage buffer binding.world_pos and local_pos properties,
position has been moved to a transform property.mouse.is_pressed function where left clicks counted as both left and right clicks.shaders.Sampler class.WrapMode enum for shader sampler addressing modes.TextureUsage flag enum for specifying how a texture is intended to be used.Texture read-only .usage property for checking a texture's usage flags and .has_usage(usage) helper method for checking specific usage flags.camera.get_active_angle() function for getting the angle of the active camera.draw APIs now accept optional angle and pivot parameters.angle property to the Camera class.Shader.set_texture_sampler method for sampling multiple textures in a binded shader.log submodule now has explicit enable and disable functions.init for quickstarting a pykraken projectdocs for opening the documentation in the default web browser.Polygon.set_centroid method for setting an exact position of a polygon.Texture constructors now use FilterMode and have an additional usage parameter.PixelArray constructor accepting a Vec2 size parameter changed to accept separate width and height integer parameters for type safety.world_pos, local_pos) with new local/world movement helpers.renderer.draw(texture, dst) now supports optional angle and pivot parameters for screen-space rectangle drawing.renderer.set_default_scale_mode / renderer.get_default_scale_mode renamed to renderer.set_default_filter_mode / renderer.get_default_filter_mode.Shader constructor directly rather than a factory function.TextureScaleMode to FilterMode for ambiguity with the shader API.Polygon rotation and scaling methods use its centroid now instead of a specified pivot point.pykraken.shader_uniform helper module and its ShaderUniform class in favor of native buffer-like data.Camera constructor asking for a default position as they'd be ambiguous.getLastGID() for tileset bounds resolution.renderer.draw_9slice function for drawing 9-slice textures.ui submodule for designing and rendering user interfaces:
Direction enum for specifying layout direction.Align enum for specifying alignment within containers.Style class for defining reusable style properties.root, stack, row, and column container functions for structuring UI elements.button, label, and image functions for common UI elements.World class now has a debug_draw method with extra configurable options for visualizing physics bodies and joints.Polygon constructor for creating regular polygons by specifying the number of sides and radius.restart method to the Timer class for resetting and starting the timer in one call.Tween has a new current_pos read-only property for getting the current interpolated position.fx.Effect class now has a clone method for creating a copy of an effect with the same properties.pykraken package now comes with a cli tool for:
renderer submodule now has a set_render_backend function for manually setting the rendering backend instead of relying on automatic selection.RenderBackend enum for specifying rendering backends.camera.unset() function for unsetting the active camera.fx.scale_by function for scaling an effect by a factor instead of to a specific size.gamepad.get_type function for getting the type of a connected gamepad.Shader constructor to a new shaders.load function that returns a Shader object.Align enum to TextAlign for specificity.World constructor's gravity parameter is now optional and defaults to zero gravity.fx.Effect objects are now stateful, single-use objects to be consumed by an Orchestrator timeline, rather than reusable templates.ShaderState class to Shader for simplicity.Orchestrator constructor only accepts Transform objects now.fx.scale_to function's scale property enforces the Vec2 type for type safety.Body types no longer have a debug_draw method.Tween class no longer has a step method as timing is handled by the engine.Orchestrator objects were copied upon calling parallel and then methods, causing effects to not be added to the original orchestrator timeline. Now returns reference to the original orchestrator.diameter and edge position properties for the Circle class; left, right, top, and bottom.Line methods:
moved for non-mutating version of move.get_midpoint for the line's midpoint.get_perpendicular for a line's perpendicular bisector.get_angle for the line's angle in radians.get_closest_point for finding the closest point on the line to a given point.Polygon methods:
rotated for non-mutating version of rotate.scaled_by for non-mutating version of scale_by.Rect methods and properties:
pos property as a clearer alias for top_left.moved for non-mutating version of move.clamped for a non-mutating version of clamp.scaled_by for non-mutating version of scale_by.scaled_to for non-mutating version of scale_to.get_corners for getting the positions of all four corners as a list of Vec2 objects.get_edges for getting the edges of the rectangle as a list of Line objects.renderer functions for more advanced configuration:
unset_virtual_resolution() for unsetting a previously set virtual resolution and returning to using the actual render target resolution.get_virtual_resolution() for getting the currently set virtual resolution.get_output_resolution() for getting the actual output resolution of the renderer.Polygon's transform method renamed to move and scale methods renamed to scale_by for consistency with other shapes.renderer submodule's set_present_resolution function renamed to set_virtual_resolution for clarity.on_floor, on_ceiling, and on_wall properties of CharacterBody changed from read-only properties to regular methods: is_on_floor(), is_on_ceiling(), and is_on_wall().line and rect submodules removed in favor of non-mutating methods in the Line and Rect classes.renderer.Batcher class for batch draw memory preallocation and management.debug mode is enabled, the engine now attempts to provide more detailed error messages and stack traces for segfaults using the faulthandler module.renderer.draw_batch function now accepts an optional list of Rect objects for per-instance clipping.renderer.draw_batch function:
Batcher parameter for using preallocated memory for batch drawing, significantly improving performance.PathLike objects in addition to strings for improved flexibility and type safety.CharacterBody additions:
MotionMode enum (GROUNDED, FLOATING) and corresponding motion_mode property.max_speed, acceleration, friction, stop_speed, and air_steer.on_floor, on_ceiling, and on_wall.capsule_shape.math.move_toward(current, target, max_delta) function.Vec2: Added in-place rounding methods (floor, ceil, round) and surface sliding methods (slide, slid).Map and PixelArray set_at / get_at methods now require two integers (x, y) instead of a Vec2 for improved type safety.renderer.read_pixels now correctly reads the entire render target instead of crashing.CharacterBody.move_and_slide now uses Box2D's Mover API, utilizing a geometric solver to eliminate snagging on floor seams and provide smoother sliding along complex surfaces.Event.type now returns an EventType enum type instead of an integer (for built-in event types; user events still return integers).CharacterBody removals:
floor_max_angle and floor_snap_distance properties.is_on_floor(), is_on_ceiling(), and is_on_wall() methods (replaced by the new properties mentioned in "Added").Vec2 non-mutating methods: .floored(), .ceiled(), and .rounded() for coordinate manipulation.Rect constructor for accepting only a Vec2 size parameter.draw_batch function for efficiently drawing a texture with many varying transforms.
Texture.get_rect() method for getting the dimensions of a texture as a Rect object.renderer.set_present_resolution function for setting the resolution at which the final rendered image is presented to the screen.math.DEG2RAD and math.RAD2DEG constants for converting between degrees and radians.handle_close parameter to window.create for whether the window should handle the window quit event and close itself, or leave it to the user to handle.pybind11 to nanobind for improved performance and smaller binary sizes.
EasingAnimation class to Tween to follow common terminology.renderer.get_target_resolution function renamed to renderer.get_current_resolution for clarity.math.to_deg() and math.to_rad() functions have been removed in favor of math.DEG2RAD and math.RAD2DEG constants for conversion.renderer.clear function that accepted 4 separate color components.input.get_direction() no longer stacks redundant bindings on the same axis, which caused biased directions after normalization. It also now preserves partial analog stick deflection instead of always normalizing to a unit vector.input.get_axis() no longer double-negates analog values for negative-direction bindings.input.is_pressed(), input.is_just_pressed(), and input.is_just_released() now respect the gamepad slot specified in each InputAction.Color.hex property getter was writing raw int bytes instead of hex-formatted integers, producing invalid UTF-8 strings.log submodule functions were still logging even when disabled.mixer submodule for advanced audio management.AudioPriority enum for managing hardware track acquisition (MUSIC, UI, SFX).Sample class and max_polyphony attribute.mixer.set_master_volume.draw.ellipses and draw.lines functions for drawing multiple ellipses or lines in a single call.is_convex and is_concave methods to the Polygon class for checking polygon convexity.Circle default constructor and another accepting just a radius.physics submodule with a World class, bodies, and joints for basic 2D physics simulation.
Body abstract class for physics bodies:
RigidBody for simulating solid objects with mass, velocity, and forces.CharacterBody for simulating character-like movement with floor detection and snapping.StaticBody for immovable objects that can still collide with other bodies.Joint abstract class for the following joint types:
DistanceJoint for maintaining a fixed distance between two bodies.FilterJoint for filtering collisions between two bodies.MotorJoint for applying a motor force to maintain a relative position between two bodies.PrismaticJoint for allowing relative movement along a specified axis between two bodies.RevoluteJoint for allowing relative rotation between two bodies.MouseJoint for dragging a body with the mouse cursor.WeldJoint for rigidly connecting two bodies together.WheelJoint for allowing relative rotation and translation along a specified axis between two bodies.Collision class for representing collision information between two bodies. Provided via World.get_collisions() method.CastHit class for representing the result of a ray or shape cast in the physics world.Capsule shape class for physics bodies, defined by a line segment and a radius.draw.capsule and draw.capsules functions for drawing capsules.get/set_fixed_delta and get/set_max_substeps functions for managing physics stepping parameters.add_fixed_update and clear_fixed_updates functions and fixed_callback decorator for registering functions to be called at a fixed interval during the automatic physics update loop.Map.tile_layers, Map.object_groups, and Map.image_layers properties for easier access to specific layer types.Map.get_layer(name) method for retrieving a layer by name.World.from_map_layer(world, layer) method for creating physics bodies from a tilemap layer.Vec2 can be divided by another Vec2 element-wise using the / operator.draw.bezier and draw.sector functions for drawing Bezier curves and circular sectors.draw.polyline for drawing connected line segments.world_to_screen and screen_to_world functions/methods for converting between world and screen coordinates.camera.get_active_pos function for getting the position of the currently active camera.Audio class to Sample (for short sound effects).AudioStream class to Stream (for long music files).mixer.load_sample and mixer.load_stream.Stream.looping is now an RW property instead of just a setter method.Stream playback position renamed from current_time to playback_pos.Map.layers to Map.all_layersTexture constructor involving a Vec2 size parameter changed to accept separate width and height integer parameters for type safety.AnimationController.add_sheet method Vec2 frame size parameter changed to separate frame_width and frame_height integer parameters for type safety.draw.rect and draw.rects functions now have parameters for corner radii.rewind method from audio stream class (use seek(0) or restart playback).miniaudio dependency.SGL_gfx dependency.Sprite class as it become redundant.Vec2.ZERO, Vec2.UP, Vec2.DOWN, Vec2.LEFT, and Vec2.RIGHT constants for common vector directions.Vec2 objects element-wise using the * operator.transform submodule with compose and compose_chain functions for parenting transforms.draw.circles function for drawing multiple circles in a single call (~3.5x faster than multiple draw.circle calls in testing).draw.polygons function for drawing multiple polygons in a single call.texture.clip_area property for getting/setting the texture's clipping area.draw.geometry function for drawing arbitrary vertex geometry, optionally with a texture.Vertex class representing a single vertex with position, color, and texture coordinate attributes.Vec2 boolean conversion now checks for both components being exactly zero, rather than using a tolerance.fx.move_to function now requires a Vec2 for the pos parameter instead of accepting an optional argument of any object type.draw.circle and draw.polygon by switching to a GPU-based rendering approach.load_sprite_sheet method renamed to add_sheet and clip property renamed to frame_area.renderer.draw function now accepts optional anchor and pivot parameters for specifying the drawing anchor and pivot points, both of Vec2 type.anchor parameter of Vec2 type for specifying the drawing anchor point.Anchor enum changed to a class with static constants for common anchor points represented as Vec2 objects.render methods to draw for consistency with other drawing functions.Vec2, Rect, Line, Color, and PolarCoordinate have been removed for better type safety. Use explicit constructors instead.src parameter from renderer.draw function.clip attribute from Sprite class.Transform class no longer contains pivot, size, or anchor attributes.