"Fossies" - the Fresh Open Source Software Archive

Member "pcemu/video.c" (22 Jan 2001, 1391 Bytes) of package /linux/privat/old/pcemu-1.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "video.c" see the Fossies "Dox" file reference documentation.

    1 #include "global.h"
    2 #include "video.h"
    3 #include <string.h>
    4 
    5 VIDEO_DRIVER *video_driver;
    6 
    7 void put_cursor(unsigned x, unsigned y)
    8 {
    9     video_driver->put_cursor(x, y);
   10 }
   11 
   12 void unput_cursor(void)
   13 {
   14     video_driver->unput_cursor();
   15 }
   16 
   17 extern VIDEO_DRIVER curses_video;
   18 extern VIDEO_DRIVER x_video;
   19 
   20 static VIDEO_DRIVER *modes[] = {
   21     &x_video,
   22     &curses_video
   23 };
   24 
   25 #define NUM_MODES   (sizeof(modes)/sizeof(*modes))
   26 
   27 const char *set_video_mode(const char *mode)
   28 {
   29     int i;
   30     for (i=0; i<NUM_MODES; i++) {
   31     if (!strcasecmp(modes[i]->name, mode)) {
   32         video_driver = modes[i];
   33         return NULL;
   34     }
   35     }
   36     return "Invalid video mode.";
   37 }
   38 
   39 void init_video(void)
   40 {
   41     if (video_driver == NULL)
   42     video_driver = modes[0];
   43     video_driver->init();
   44 }
   45 
   46 void copy(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned newx, unsigned newy)
   47 {
   48     video_driver->copy(x1, y1, x2, y2, newx, newy);
   49 }
   50 
   51 void new_cursor(int st, int end)
   52 {
   53     video_driver->new_cursor(st, end);
   54 }
   55 
   56 void window_size(unsigned width, unsigned height)
   57 {
   58     video_driver->window_size(width, height);
   59 }
   60 
   61 void draw_line(unsigned x, unsigned y, const char *text, unsigned len, BYTE attr)
   62 {
   63     video_driver->draw_line(x, y, text, len, attr);
   64 }
   65 
   66 void end_video(void)
   67 {
   68     video_driver->end();
   69 }
   70 
   71 void process_events(void)
   72 {
   73     video_driver->process_events();
   74 }
   75 
   76 void flush_video(void)
   77 {
   78     video_driver->flush();
   79 }