Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>fg.msm</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fg.msm

   Type

   unsigned fg.msm;

   Description

   Reports on whether the mouse functions can be used. 
   <<<<<<<<<<<<<< error in text file >>>>>>>>>>>>>>>>>>>>>>>

   Microsoft mouse driver is present, or the code has not been linked in. It is
   non-zero if the code and driver are present.

Optional User-supplied Functions

   The user of the FG module can supply alternatives to the following
   functions although default versions are supplied in the libraries. The
   functions themselves are described later.

   fg_assert
   fg_lineclip

Supported Modes

   A function, fg_get_type(), has been provided to determine the type of
   display present. See the individual entry for this function for details.
   Currently the following modes are supported under OS/2:

       CGAHIRES        EGACOLOR
       EGAMONO         EGAECD

       VGA11           VGA12

   Other modes will be added from time to time. Please refer to the file
   readme.fg for up to date information on supported display modes.

   Here is a complete list of boards and modes currently supported by Flash
   Graphics. Again, refer to the readme.fg file for up to date information
   on OS/2 support.

Hercules mono
   1 or 2 display pages 720x348x2 colors.

CGA
   320x200x4 colors (mode 0x03).
   640x200x2 colors (mode 0x06).

IBM EGA color display
   320x200x16 colors (mode 0x0D).
   640x200x16 colors (mode 0x0E).


IBM EGA TTL mono monitor
   640x350x4 colors (mode 0x0F).

IBM EGA enhanced color display
   640x350x16 colors (mode 0x10).

IBM VGA
   640x480x1 color (mode 0x11).
   640x200x2 colors (mode 0x06).
   640x200x2 colors (mode 0x06).
   320x200x256 colors (mode 0x13).

Orchid ProDesigner multi-freq monitor
   800x600x16 colors (mode 0x29).

Paradise VGA Plus multi-freq monitor
   800x600x16 colors (mode 0x58).

Video 7 VEGA VGA multi-freq monitor
   800x600x16 colors (mode 0x62).


VESA (multi vendor) multi-freq monitor
   800x600x16 colors (mode 0x6A).
   800x600x16 colors (mode 0x102).

Everex EVGA multi-freq monitor
   800x600x16 colors (mode 0x70).

Toshiba T/J-3100
   640x400x2 colors, note T and J.
   No autodetect

Trident VGA
   800x600x16 colors.

IBM 8514A
   Resolution and colors 8514 dependent.

   Due to the way the data is arranged in the new library, some of the old
   tricks to limit code size do not work. For example, previously if you did

   not call fg_init_all() but instead called fg_init_herc() you would cut
   your code size by about 15 kb. This no longer works. Get round it by
   creating your own function fg_init_all(), which achieves the same
   results. For example:

   #include <fg.h>
   main ()
       {
           if (fg_init() != FG_NULL)
           {
               . . .
               fg_term();
               return 0;
           }
       else
           return 1;
       }

   int fg_init_all(void)
       {

           return fg_init_herc();
       }

   The above "trick" cuts the code size by about 17 kb, at the loss of
   EGA/VGA etc. Of course you must make sure that a Hercules board is really
   present or you will probably crash the computer. This can be achieved by
   brute force like requiring users to inform the system that they have a
   Hercules (or EGA, VGA, whatever) available. Alternatively call
   fg_get_type() which returns the type of graphics board available. For
   example, replace the fg_init_all() with the following:

   int fg_init_all(void)
   {
       switch (fg_get_type())
       {
           case HERCHALF   :
           case HERCFULL   :       return fg_init_herc();
                                       break;
           default         :       return FG_NULL;
       }

   }

Fonts and Flash Graphics

   The extended character set (0x80 through 0xff) is available with
   fg_putc() and fg_puts() for all graphics boards except the CGA. On the
   CGA, characters in this range are silently ignored.

   It is also now possible to define your own fonts. This is achieved by
   using the following typedef.

   typedef struct fg_font
   {
       const char _far *fontptr;
                           /*First 128 characters*/
       const char _far *fontptr2;
                           /*Second 128 characters*/
       fg_box_t charbox;
   } fg_font_t;


   To save DGROUP data segment space declare the tables _far (optional):

   char _far  my_4x4_font_table[]=
   {
       0x80,0x40,0x20,0x10,    /* char 0 == '\'     */
       0x10,0x20,0x40,0x80,    /* char 1 == '/'     */
       .   .   .
       .   .   .
       0x00,0x00,0x00,0xf0 /* char 127 == '_' */
   };

   The font table is used by fg_drawmatrix() to output the characters. Each
   character entry must be in form compatible for fg_drawmatrix(). The first
   font table is assumed to be 128 characters long, the characters 129
   through 256 are assumed to be in the second font table. The second table
   is optional. If it is set to (char _far *) 0 then any attempted output of
   characters in the range 128 through 255 is ignored. The font tables need
   not be 128 characters long, but outputting characters beyond the range of
   the table will most likely result in segment faults under UNIX, DOS 386
   and OS/2, and garbage output under DOS. You can make your own font tables

   or request pointers to them from your graphics board (if available), see
   your graphics board programmer s manual for details.

   There are two functions supplied to enable the selection of fonts,
   fg_get_font() and fg_set_font().

   fg_font_t my_4x4_font =
   {
       my_4x4_font_table,
       (char _far *)0,
       0, 0, 3, 3
   };
   void foo(void)
   {
       fg_font_t default_font;
   /* Save current font if we want to restore it later */
       fg_get_font(&default_font);

       fg_set_font(&my_4x4_font);      /* Install new font*/
       .  .  .

       fg_set_font(&default_font); /* Restore original*/

       return;
   }

   A sample character and icon designer, ICONDRAW, is supplied on the
   distribution disks.

Mouse Support

   When using Flash Graphics with a mouse it is not often appreciated that
   the mouse cursor is drawn by the mouse driver. Most drivers have support
   for the standard graphics adapters supplied by IBM, such as CGA, EGA,
   VGA. Some may even have support for Hercules. Most, however, do not
   support the high resolution 800x600 modes supported by Flash Graphics.
   Your mouse will most likely disappear (but still report its position when
   queried) when you put the graphics board into one of these modes.

   Previously it has been necessary for the programmer to build his own
   mouse support using either fg_drawmatrix or fg_drawline. However, mouse

   support has now been added to the Flash Graphics libraries. It should
   work with any mouse that has a suitable mouse driver. The mouse will work
   with all graphics modes supported by Flash Graphics, even Hercules and
   Super VGA modes.

   The mouse support is implemented in such a way that the code is not
   linked in if you do not call any of the following functions:

       fg_msm_getpress()       fg_msm_getrelease()
       fg_msm_getstatus()      fg_msm_setarea()
       fg_msm_setcurpos()      fg_msm_setcursor()
       fg_msm_setratio()

   If you do not want the mouse support you can save about 1100 bytes total
   in code and data space.

   A global variable, fg.msm, has been supplied to report on whether the
   mouse functions can be run. It will be zero if no mouse driver is
   present, or the code has not been linked in. It is non-zero if the code
   and driver are present.


   The following defines can be tested to check on the status of the mouse
   buttons. They represent the bits that will be set on pressing that
   button.

       FG_MSM_LEFT FG_MSM_RIGHT    FG_MSM_MIDDLE

   These are also used by fg_msm_getpress() and fg_msm_getrelease().

Example Code

   See the file fgdemo.c on the distribution disks for examples of how to use
   the Flash Graphics mouse interface.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson