home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / MIDNIGHT.LZH / MIDNIGHT / SOURCE / SET_PIX.C < prev    next >
C/C++ Source or Header  |  1992-12-19  |  2KB  |  82 lines

  1.  
  2. #include <aes.h>
  3. #include <vdi.h>
  4. #include <tos.h>
  5. #include <ext.h>
  6. #include <stdio.h>
  7. #include <time.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include <portab.h>
  11.  
  12. #include "midnight.h"    /* ACC_str + MOD_str + defines für Module + ACC */
  13.  
  14.         /* Funktionen aus MOSTART.S, die über Pointer aufgerufen werden    */
  15. extern int        EVNT_ask( long wait_ms );
  16. extern long        rnd24( long wert );
  17. extern int        Sound( SND_str *SND_struct );
  18. extern int        ScreenSave( int flag, char *Name );
  19.  
  20. extern MOD_str MOD_struct;
  21.  
  22. Value    *Value_s = NULL;        /* zeigt auf eine Liste von Pointern    */
  23.  
  24.  
  25. /*
  26.     GRUNDLEGENDES !
  27.     Da die Module ab und zu einmal aufgerufen werden und eben nicht
  28.     kontinuierlich die Kontrolle über die Register haben, kann es bei
  29.     Benutzung einer Variablen über mehrere Programmteile (M_INIT,M_SWITCH...)
  30.     zu Problemen kommen, da ja inzwischen wieder 'Sonstwer' in den Registern
  31.     'rumgespielt hat. Deshalb sind solche Variablen als 'static' zu deklarieren,
  32.     im Notfall (wenn's nicht klappt) auch als Volatile.
  33.     Sicher ist sicher...
  34. */
  35.  
  36.  
  37.  
  38. int        pxy[4];
  39. volatile static int handle;        /* darf nicht im Register stehn            */
  40.  
  41.  
  42.  
  43. ULONG MOD_main( int Mode, ACC_str *As )
  44. {
  45.     int x;
  46.  
  47.     switch( Mode )
  48.     {    case M_INIT:
  49.             MOD_struct.U.b = 0x003f;
  50.             v_opnvwk( As->work_in,&handle,As->work_out );
  51.             if( !handle ) return( 0 );
  52.             pxy[0]=As->x;
  53.             pxy[1]=As->y;
  54.             pxy[2]=As->x+As->w;
  55.             pxy[3]=As->y+As->h;
  56.             vs_clip( handle,1,pxy );
  57.             break;
  58.         case M_SWITCH:
  59.             v_bar( handle,pxy );
  60.             break;
  61.         case M_DO_IT:
  62.             do
  63.             {
  64.                 for( x=0; x<100; x++ )
  65.                 {    pxy[2]= (pxy[0]= Random() % As->w)+1;
  66.                     pxy[3]= (pxy[1]= Random() % As->h)+1;
  67.                     vsf_color( handle, Random() % (1<<As->planes) );
  68.                     v_bar( handle,pxy );
  69.                 }
  70.  
  71.             } while( !EVNT_ask( 1 ) );
  72.             break;
  73.         case M_EXIT:
  74.             if( handle ) v_clsvwk( handle );
  75.             break;
  76.     }
  77.  
  78.     return( 1 );
  79. }
  80.  
  81.  
  82.