From cea09bdfaeede8dbd2be3439e643ae4a85de7e14 Mon Sep 17 00:00:00 2001 From: sos Date: Thu, 16 Oct 1997 07:29:26 +0000 Subject: Add a little example on libvgl usage. --- share/examples/libvgl/demo.c | 120 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 share/examples/libvgl/demo.c (limited to 'share/examples/libvgl/demo.c') diff --git a/share/examples/libvgl/demo.c b/share/examples/libvgl/demo.c new file mode 100644 index 0000000..1a8e207 --- /dev/null +++ b/share/examples/libvgl/demo.c @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 1991-1997 Søren Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id: demo.c,v 1.16 1997/08/17 20:46:55 sos Exp sos $ + */ + +#include +#include +#include "vgl.h" + +int +main(int argc, char **argv) +{ + int x, y, xsize, ysize, i,j; + VGLBitmap tmp; + + // set graphics mode, here 320x240 256 colors + // supported modes are (from ): + // SW_VGA_CG320: std VGA 320x200 256 colors + // SW_VGA_MODEX: Modex VGA 320x240 256 colors + // SW_VGA_VG640: std VGA 640x480 16 colors + VGLInit(SW_VGA_MODEX); + + // initialize mouse and show pointer + VGLMouseInit(VGL_MOUSESHOW); + + // VGLDisplay is a ptr to a struct Bitmap defined and initialized by + // libvgl. The Bitmap points directly to screen memory etc. + xsize=VGLDisplay->Xsize; + ysize=VGLDisplay->Ysize; + + // alloc a new bitmap (there should be a function for this) + tmp.Type = MEMBUF; tmp.Bitmap = (char*)malloc(256*256); + tmp.Xsize = 256; tmp.Ysize = 256; + + // fill the screen with colored lines + for (y=0; y 1000) break; + } + + // restore screen to its original mode + VGLEnd(); + return 0; +} + -- cgit v1.1