4141//|
4242//| Manage a group of sprites and groups and how they are inter-related.
4343//|
44- //| .. class:: Group(*, max_size=4, scale=1)
44+ //| .. class:: Group(*, max_size=4, scale=1, x=0, y=0 )
4545//|
4646//| Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
4747//| leads to a layer's pixel being 2x2 pixels when in the group.
4848//|
4949//| :param int max_size: The maximum group size.
5050//| :param int scale: Scale of layer pixels in one dimension.
51+ //| :param int x: Initial x position within the parent.
52+ //| :param int y: Initial y position within the parent.
5153//|
5254STATIC mp_obj_t displayio_group_make_new (const mp_obj_type_t * type , size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
53- enum { ARG_max_size , ARG_scale };
55+ enum { ARG_max_size , ARG_scale , ARG_x , ARG_y };
5456 static const mp_arg_t allowed_args [] = {
5557 { MP_QSTR_max_size , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 4 } },
5658 { MP_QSTR_scale , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 1 } },
59+ { MP_QSTR_x , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 0 } },
60+ { MP_QSTR_y , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 0 } },
5761 };
5862 mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
5963 mp_arg_parse_all (n_args , pos_args , kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
@@ -70,7 +74,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg
7074
7175 displayio_group_t * self = m_new_obj (displayio_group_t );
7276 self -> base .type = & displayio_group_type ;
73- common_hal_displayio_group_construct (self , max_size , scale );
77+ common_hal_displayio_group_construct (self , max_size , scale , args [ ARG_x ]. u_int , args [ ARG_y ]. u_int );
7478
7579 return MP_OBJ_FROM_PTR (self );
7680}
0 commit comments