⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keydemo.c

📁 在DOS13号中断下开发图形显示程序的例程
💻 C
字号:
/*****************************************************************************
 KEYDEMO.C

 Demo program that shows how to use the VGL keyboard trapping routines.  This
 one simply displays a textual description of which of the 4 arrow keys are
 currently being held down.  Sorry it hasn't got a pretty display, but at
 least you get the idea... I hope.

 You can add additional keys to be trapped by editing the file VGLKEY.C and
 inserting or deleting them from the list.

 Mark
 morley@camosun.bc.ca
*****************************************************************************/

#include "vgl.h"

main()
{
   int i;

   clrscr();
   gotoxy( 1, 1 );
   cprintf( "Key Trapping Demo - Play with the arrow keys." );

   vglTrapKeys();                       /* Turn on key trapping             */

   while( !kbhit() )                    /* Loop until ESCAPE is hit         */
   {
      gotoxy( 1, 3 );                   /* Display the status bytes         */
      for( i = 0; i < VGL_NUMKEYS; i++ )
         if( vglKeyStatus[i] )
            putch( '*' );
         else
            putch( '-' );

      gotoxy( 1, 5 );                   /* Display a message                */
      if( vglKeyStatus[0] )
         cprintf( "UP-ARROW " );
      if( vglKeyStatus[1] )
         cprintf( "DOWN-ARROW " );
      if( vglKeyStatus[2] )
         cprintf( "LEFT-ARROW " );
      if( vglKeyStatus[3] )
         cprintf( "RIGHT-ARROW " );
      clreol();

      delay( 100 );                     /* Keeps cursor from flickering all */
                                        /* over the place.                  */
   }

   vglReleaseKeys();                    /* Disable keytrapping              */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -