Reference video buffer from screen

This paves the way to handle EVENT_NEW_FRAME from screen.c, by allowing
to call screen_update_frame() without an explicit video_buffer instance.
This commit is contained in:
Romain Vimont
2021-02-15 18:28:41 +01:00
parent 0538e9645b
commit ea2369f568
3 changed files with 12 additions and 7 deletions

View File

@@ -13,6 +13,7 @@
struct video_buffer;
struct screen {
struct video_buffer *vb;
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
@@ -37,6 +38,7 @@ struct screen {
};
#define SCREEN_INITIALIZER { \
.vb = NULL, \
.window = NULL, \
.renderer = NULL, \
.texture = NULL, \
@@ -70,7 +72,7 @@ struct screen {
// initialize default values
void
screen_init(struct screen *screen);
screen_init(struct screen *screen, struct video_buffer *vb);
// initialize screen, create window, renderer and texture (window is hidden)
// window_x and window_y accept SC_WINDOW_POSITION_UNDEFINED
@@ -91,7 +93,7 @@ screen_destroy(struct screen *screen);
// resize if necessary and write the rendered frame into the texture
bool
screen_update_frame(struct screen *screen, struct video_buffer *vb);
screen_update_frame(struct screen *screen);
// render the texture to the renderer
//