1.1 --- a/examples/vga/main.c Sat Nov 10 18:53:06 2018 +0100
1.2 +++ b/examples/vga/main.c Sat Nov 10 19:06:08 2018 +0100
1.3 @@ -114,47 +114,6 @@
1.4
1.5
1.6
1.7 -/* Copy to the store from the display, then blit the image. */
1.8 -
1.9 -static void plot_sprite(sprite_t *s, int x, int y, int key)
1.10 -{
1.11 - int frame = display_config.frame;
1.12 - position_t *p = image_get_stored_position(s->regions, frame);
1.13 -
1.14 - /* Copy to the stored region. */
1.15 -
1.16 - display_copy(&display_config, image_get_stored_region(s->regions, frame),
1.17 - s->image->width, s->image->height / s->yscale, 1,
1.18 - x, y, -1, 0);
1.19 -
1.20 - /* Plot to the screen. */
1.21 -
1.22 - display_copy(&display_config, s->image->image,
1.23 - s->image->width, s->image->height, s->yscale,
1.24 - x, y, key, 1);
1.25 -
1.26 - /* Record the stored background details. */
1.27 -
1.28 - p->x = x;
1.29 - p->y = y;
1.30 -
1.31 - if (frame >= s->regions->stored)
1.32 - s->regions->stored = frame + 1;
1.33 -}
1.34 -
1.35 -/* Copy to the display from the store, restoring the original background. */
1.36 -
1.37 -static void unplot_sprite(sprite_t *s)
1.38 -{
1.39 - int frame = display_config.frame;
1.40 - position_t *p = image_get_stored_position(s->regions, frame);
1.41 -
1.42 - if (s->regions->stored > frame)
1.43 - display_copy(&display_config, image_get_stored_region(s->regions, frame),
1.44 - s->image->width, s->image->height / s->yscale, 1,
1.45 - p->x, p->y, -1, 1);
1.46 -}
1.47 -
1.48 /* Plot the revealed region at the edge of the screen after scrolling. */
1.49
1.50 static void plot_screen_edge(viewport_t *v, int xorigin, int yorigin,
1.51 @@ -232,7 +191,7 @@
1.52 {
1.53 /* Stores of background details, replotted when moving the sprite. */
1.54
1.55 - Sprite(s, &sprite, FRAME_COUNT, SOURCE_YSTEP);
1.56 + Sprite(s, &sprite, &display_config, SOURCE_YSTEP);
1.57
1.58 /* Sprite position. */
1.59
1.60 @@ -264,7 +223,7 @@
1.61 {
1.62 for (x = 0; x < display_config.line_length - s.image->width; x++)
1.63 {
1.64 - plot_sprite(&s, x, y, 0x8c);
1.65 + image_plot_sprite(&s, x, y, 0x8c);
1.66
1.67 /* Update the display with the frame details. */
1.68
1.69 @@ -277,7 +236,7 @@
1.70
1.71 /* Prepare the frame for updates. */
1.72
1.73 - unplot_sprite(&s);
1.74 + image_unplot_sprite(&s);
1.75
1.76 /* Scroll in the indicated direction. */
1.77