Skip to content

Commit 603df58

Browse files
committed
Did stage, socket, storage
1 parent c7a9d49 commit 603df58

File tree

5 files changed

+196
-192
lines changed

5 files changed

+196
-192
lines changed

shared-bindings/_stage/Layer.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@
3030
#include "Layer.h"
3131
#include "supervisor/shared/translate.h"
3232

33-
//| .. currentmodule:: _stage
33+
//| class Layer:
34+
//| """.. currentmodule:: _stage
3435
//|
35-
//| :class:`Layer` -- Keep information about a single layer of graphics
36-
//| ===================================================================
36+
//| :class:`Layer` -- Keep information about a single layer of graphics
37+
//| ==================================================================="""
3738
//|
38-
//| .. class:: Layer(width, height, graphic, palette, [grid])
39+
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray):
40+
//| """Keep internal information about a layer of graphics (either a
41+
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
42+
//| with the ``render()`` function.
3943
//|
40-
//| Keep internal information about a layer of graphics (either a
41-
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
42-
//| with the ``render()`` function.
44+
//| :param int width: The width of the grid in tiles, or 1 for sprites.
45+
//| :param int height: The height of the grid in tiles, or 1 for sprites.
46+
//| :param bytearray graphic: The graphic data of the tiles.
47+
//| :param bytearray palette: The color palette to be used.
48+
//| :param bytearray grid: The contents of the grid map.
4349
//|
44-
//| :param int width: The width of the grid in tiles, or 1 for sprites.
45-
//| :param int height: The height of the grid in tiles, or 1 for sprites.
46-
//| :param bytearray graphic: The graphic data of the tiles.
47-
//| :param bytearray palette: The color palette to be used.
48-
//| :param bytearray grid: The contents of the grid map.
49-
//|
50-
//| This class is intended for internal use in the ``stage`` library and
51-
//| it shouldn't be used on its own.
50+
//| This class is intended for internal use in the ``stage`` library and
51+
//| it shouldn't be used on its own."""
52+
//| ...
5253
//|
5354
STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
5455
const mp_obj_t *args, mp_map_t *kw_args) {
@@ -90,9 +91,9 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
9091
return MP_OBJ_FROM_PTR(self);
9192
}
9293

93-
//| .. method:: move(x, y)
94-
//|
95-
//| Set the offset of the layer to the specified values.
94+
//| def move(self, x: Any, y: Any) -> Any:
95+
//| """Set the offset of the layer to the specified values."""
96+
//| ...
9697
//|
9798
STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
9899
layer_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -102,10 +103,10 @@ STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
102103
}
103104
STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_move_obj, layer_move);
104105

105-
//| .. method:: frame(frame, rotation)
106-
//|
107-
//| Set the animation frame of the sprite, and optionally rotation its
108-
//| graphic.
106+
//| def frame(self, frame: Any, rotation: Any) -> Any:
107+
//| """Set the animation frame of the sprite, and optionally rotation its
108+
//| graphic."""
109+
//| ...
109110
//|
110111
STATIC mp_obj_t layer_frame(mp_obj_t self_in, mp_obj_t frame_in,
111112
mp_obj_t rotation_in) {

shared-bindings/_stage/Text.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@
3030
#include "Text.h"
3131
#include "supervisor/shared/translate.h"
3232

33-
//| .. currentmodule:: _stage
33+
//| class Text:
34+
//| """.. currentmodule:: _stage
3435
//|
35-
//| :class:`Text` -- Keep information about a single text of text
36-
//| ==============================================================
36+
//| :class:`Text` -- Keep information about a single text of text
37+
//| =============================================================="""
3738
//|
38-
//| .. class:: Text(width, height, font, palette, chars)
39+
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray):
40+
//| """Keep internal information about a text of text
41+
//| in a format suitable for fast rendering
42+
//| with the ``render()`` function.
3943
//|
40-
//| Keep internal information about a text of text
41-
//| in a format suitable for fast rendering
42-
//| with the ``render()`` function.
44+
//| :param int width: The width of the grid in tiles, or 1 for sprites.
45+
//| :param int height: The height of the grid in tiles, or 1 for sprites.
46+
//| :param bytearray font: The font data of the characters.
47+
//| :param bytearray palette: The color palette to be used.
48+
//| :param bytearray chars: The contents of the character grid.
4349
//|
44-
//| :param int width: The width of the grid in tiles, or 1 for sprites.
45-
//| :param int height: The height of the grid in tiles, or 1 for sprites.
46-
//| :param bytearray font: The font data of the characters.
47-
//| :param bytearray palette: The color palette to be used.
48-
//| :param bytearray chars: The contents of the character grid.
49-
//|
50-
//| This class is intended for internal use in the ``stage`` library and
51-
//| it shouldn't be used on its own.
50+
//| This class is intended for internal use in the ``stage`` library and
51+
//| it shouldn't be used on its own."""
52+
//| ...
5253
//|
5354
STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
5455
const mp_obj_t *args, mp_map_t *kw_args) {
@@ -84,9 +85,9 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args,
8485
return MP_OBJ_FROM_PTR(self);
8586
}
8687

87-
//| .. method:: move(x, y)
88-
//|
89-
//| Set the offset of the text to the specified values.
88+
//| def move(self, x: Any, y: Any) -> Any:
89+
//| """Set the offset of the text to the specified values."""
90+
//| ...
9091
//|
9192
STATIC mp_obj_t text_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
9293
text_obj_t *self = MP_OBJ_TO_PTR(self_in);

shared-bindings/_stage/__init__.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "Layer.h"
3535
#include "Text.h"
3636

37-
//| :mod:`_stage` --- C-level helpers for animation of sprites on a stage
37+
//| """:mod:`_stage` --- C-level helpers for animation of sprites on a stage
3838
//| =====================================================================
3939
//|
4040
//| .. module:: _stage
@@ -49,11 +49,10 @@
4949
//| :maxdepth: 3
5050
//|
5151
//| Layer
52-
//| Text
52+
//| Text"""
5353
//|
54-
//| .. function:: render(x0, y0, x1, y1, layers, buffer, display[, scale[, background]])
55-
//|
56-
//| Render and send to the display a fragment of the screen.
54+
//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> Any:
55+
//| """Render and send to the display a fragment of the screen.
5756
//|
5857
//| :param int x0: Left edge of the fragment.
5958
//| :param int y0: Top edge of the fragment.
@@ -70,7 +69,8 @@
7069
//| valid.
7170
//|
7271
//| This function is intended for internal use in the ``stage`` library
73-
//| and all the necessary checks are performed there.
72+
//| and all the necessary checks are performed there."""
73+
//|
7474
STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
7575
uint16_t x0 = mp_obj_get_int(args[0]);
7676
uint16_t y0 = mp_obj_get_int(args[1]);

0 commit comments

Comments
 (0)