00001 /*========================================================================= 00002 00003 GFX EXAMPLE CODE - #3 00004 "colorful bars" 00005 00006 Copyright (C) 2004 Rafael de Oliveira Jannone 00007 00008 This example's source code is Public Domain. 00009 00010 WARNING: The author makes no guarantees and holds no responsibility for 00011 any damage, injury or loss that may result from the use of this source 00012 code. USE IT AT YOUR OWN RISK. 00013 00014 Contact the author: 00015 by e-mail : rafael AT jannone DOT org 00016 homepage : http://jannone.org/gfxlib 00017 ICQ UIN : 10115284 00018 00019 =========================================================================*/ 00020 00021 #include <stdlib.h> 00022 #include "gfx.h" 00023 00024 main() { 00025 u_int addr; 00026 int c, l; 00027 00028 set_color(15, 1, 1); 00029 00030 // set video mode to screen 2 00031 set_mode(mode_2); 00032 00033 // draw horizontal lines 00034 for (c = 0; c < MODE2_MAX; c += 8) 00035 vpoke(MODE2_ATTR + c, 0xFF); 00036 00037 // for each column... 00038 for (c = 0; c < 32; c++) { 00039 // randomly draw one colored vertical bar 00040 l = rand() & 63; 00041 addr = map_pixel(c << 3, 96 - l); 00042 fill_v(8192 + addr, (c % 14) + 2, l << 1); 00043 } 00044 while (!get_trigger(0)) {} 00045 00046 set_mode(mode_0); 00047 }
1.4.1