Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: frontend should provide pointer for pixel data #87

Open
deltabeard opened this issue May 26, 2023 · 0 comments
Open

core: frontend should provide pointer for pixel data #87

deltabeard opened this issue May 26, 2023 · 0 comments
Labels
diff: intermediate Medium difficulty enhancement New feature or request
Milestone

Comments

@deltabeard
Copy link
Owner

A function should be added to allow the frontend to provide a pointer to Peanut-GB for it to fill with pixel data. This function could be called at any time.

This could be used by the frontend to enable double buffering.
This could also be used to make Peanut-GB draw each line of pixel data in a surface representing the LCD screen size.

void lcd_draw_line(struct gb_s *gb, const uint8_t *pixels, const uint_fast8_t line)
{
        struct priv *p = gb->priv;
        SDL_Surface *s = p->surf;
        /* "pixels" is already set to a pointer in the SDL surface from a previous
         * call to gb_set_pixels_ptr, so peanut-gb has already copied pixel data
         * for the line directly to the surface. */
        /* Set pointer to pixels for the next line. */
        gb_set_pixels_ptr(s->pixels + (LCD_WIDTH * line));
}
@deltabeard deltabeard added enhancement New feature or request diff: intermediate Medium difficulty labels May 26, 2023
@deltabeard deltabeard added this to the v2 milestone May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diff: intermediate Medium difficulty enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant