From 209eb8605101a7e0460b8e6da0eb9faa55cacdf1 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sun, 30 Mar 2014 11:01:05 -0700 Subject: [PATCH] More common video code * Provide new function to get current common framebuffer * Migrates non-X11 video_setpage routine --- src/video/video.h | 9 +++++++-- src/video/xvideo.c | 8 -------- src/vidsup.c | 12 ++++++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/video/video.h b/src/video/video.h index be70da28..a53ded05 100644 --- a/src/video/video.h +++ b/src/video/video.h @@ -97,8 +97,8 @@ void video_loadfont_int(int first, int qty, const unsigned char *data); */ void video_plotchar(int row, int col, int color, unsigned char code); -/* Called at about 30Hz (this may change in future), and when waiting in - * the interface screens. +/* + * Draws video and possibly handles keyboard input. * * Should flush any video data to the real screen (if any kind of caching * is in use), check for keyboard input (presently reported via @@ -108,6 +108,11 @@ void video_sync(int block); void video_set_mode(a2_video_mode_t mode); +/* + * Get a reference to current internal framebuffer + */ +const uint8_t * const video_current_framebuffer(); + #endif /* !__ASSEMBLER__ */ /**** Private stuff follows *****/ diff --git a/src/video/xvideo.c b/src/video/xvideo.c index b7f3fe3b..87e3d48a 100644 --- a/src/video/xvideo.c +++ b/src/video/xvideo.c @@ -67,14 +67,6 @@ typedef struct { unsigned long status; } FullScreenHints; -/* ------------------------------------------------------------------------- - video_setpage(p): Switch to screen page p - ------------------------------------------------------------------------- */ -void video_setpage(int p) -{ - video__current_page = p; -} - #ifdef HAVE_X11_SHM /* * XShm code influenced from the DOOM source code. diff --git a/src/vidsup.c b/src/vidsup.c index 85afecde..71aa07b9 100644 --- a/src/vidsup.c +++ b/src/vidsup.c @@ -724,3 +724,15 @@ void video_shutdown(void) #endif } +/* ------------------------------------------------------------------------- + video_setpage(p): Switch to screen page p + ------------------------------------------------------------------------- */ +void video_setpage(int p) +{ + video__current_page = p; +} + +const uint8_t * const video_current_framebuffer() { + return !video__current_page ? video__fb1 : video__fb2; +} +