Search
lxdream.org :: lxdream/src/video.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/video.c
changeset 65:9f124c245fc6
prev31:495e480360d7
author nkeynes
date Mon Jan 16 11:18:29 2006 +0000 (18 years ago)
permissions -rw-r--r--
last change Add 's3m' mode (for testing) and also headless mode
view annotate diff log raw
     1 /**
     2  * $Id: video.c,v 1.3 2006-01-03 12:21:45 nkeynes Exp $
     3  *
     4  * The PC side of the video support (responsible for actually displaying / 
     5  * rendering frames)
     6  *
     7  * Copyright (c) 2005 Nathan Keynes.
     8  *
     9  * This program is free software; you can redistribute it and/or modify
    10  * it under the terms of the GNU General Public License as published by
    11  * the Free Software Foundation; either version 2 of the License, or
    12  * (at your option) any later version.
    13  *
    14  * This program is distributed in the hope that it will be useful,
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  * GNU General Public License for more details.
    18  */
    20 #include <gnome.h>
    21 #include <stdint.h>
    23 GdkImage *img;
    24 GtkWindow *video_win;
    25 GtkWidget *video_area;
    26 char *video_data;
    27 uint32_t video_width = 640;
    28 uint32_t video_height = 480;
    29 uint32_t video_frame_count = 0;
    31 void video_open( void )
    32 {
    33     img = gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(),
    34                          640, 480 );
    35     video_win = GTK_WINDOW(gtk_window_new( GTK_WINDOW_TOPLEVEL ));
    36     video_area = gtk_image_new_from_image(img, NULL);
    37     gtk_widget_show( video_area );
    38     gtk_container_add( GTK_CONTAINER(video_win), video_area );
    39     video_data = img->mem;
    41     gtk_window_set_title( video_win, "DreamOn! - Emulation Window" );
    42     gtk_window_set_policy( video_win, FALSE, FALSE, FALSE );
    43     gtk_window_set_default_size( video_win, 640, 480 );
    45     gtk_widget_show( GTK_WIDGET(video_win) );
    46 }
    48 /**
    49  * Fill the entire frame with the specified colour (00RRGGBB)
    50  */
    51 void video_fill( uint32_t colour ) 
    52 {
    53     char *p = video_data;
    54     int i;
    55     for( i=0; i<video_width*video_height; i++ ) {
    56 	*p++ = (colour>>16) & 0xFF;
    57 	*p++ = (colour>>8) & 0xFF;
    58 	*p++ = (colour) & 0xFF;
    59     }
    60 }
    62 void video_update_frame( void )
    63 {
    64     video_frame_count++;
    65     gtk_widget_queue_draw( video_area );
    66 }
    68 void video_update_size( int hres, int vres, int colmode )
    69 {
    70     /* do something intelligent */
    71 }
.