Thread: ** HELP ** Color driver and mouse

  1. #1
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    Unhappy BGI driver + mouse

    Please. If anyone is willing to help. I'm using a BGI driver that sets to 256 colors and high resolution. Only problem is that when i try to set to any video mode that is higher than 0 ( 320x240 ) the cursor doesn't get to be displayed. I'm working under DOS.


    Thnx
    Last edited by Sunny; 11-20-2001 at 05:49 AM.
    Yes...YES!!! I did it! Ha ha ha...I'm king of the world...No..No..please-wait-no...!!!!-- This program has performed an illegal operation AND WILL be shut down....Ack-Choking..help...ack..

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I'm assuming based on your subject line that you mean the mouse cursor is not being displayed.

    Hardware cursors usually only support certain resolutions and modes. The BGI driver may be using a screen mode/resolution that it does not support, or it is using it in a way that the mouse driver does not support. Either way it is not displaying the cursor because it would not look correct in the screen mode you are using. In fact, you probably don't what it to display the cursor because it would not be useful nor would it be displayed correctly.


    Simple solution is to get the coordinates of the mouse cursor using subfunction 03h and then place your own mouse cursor at those coords. In order for your cursor to erase and redraw correctly (preserving the background) you will need to write some simple sprite blt functions. To prevent the cursor from blinking as it is constantly refreshed, only refresh and redraw when the mouse moves or is being moved. Check out the thread about mouse in 800x600x24 bit. There is a more thorough explanation there. Don't get confused about the 24 bit stuff, just ignore it and concentrate on the cursor drawing/redrawing/updating part of the post.

  3. #3
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    yes i know

    Well, thanks. Yes, i was well aware of the fact that the cursor works just that it was not being displayed. So i tried to display it myself, of course. Yes, i could retrieve the coordonates of the mouse ( X and Y location ) . So. ok i succeeded to draw the cursor. But when i decide to redraw the background i hav not yet devised some algoritm to prevent redraw over unless any movement has been made.

    The way it goes till here:


    void DrawMouse() // In a continuus loop
    {
    ...
    ...
    Get_Background_behind_mouse
    DrawMouseCursorar_at_x_and_y
    Redraw_Background_over

    }

    I havn't yet figured out how to detect if any movement has occured - and this would indeed help a lot, thus preventing the Blinkig. But otherwise, the blinking problem has not yet been solved.

    Yes, i did look at the other thread, the one about 24 bit and mouse, but i did not find a solution to the blinking problem.


    Anyways,
    thank you very much.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The solution is in the other thread.


    Here is some source for you in DOS Turbo C.

  5. #5
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    Cool

    Gee... Don't know what to say. Thanks a lot.
    Didn't expect the solution to be that simple, allthough i think i tried evey assembler thing i could think of. The source is REALLY good. I'm gonna see how it works in higher resolutions.

    Thanks a lot.
    Yes...YES!!! I did it! Ha ha ha...I'm king of the world...No..No..please-wait-no...!!!!-- This program has performed an illegal operation AND WILL be shut down....Ack-Choking..help...ack..

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    No problem.

    For higher resolution in real mode you willl need to learn about bank switching. If you are in protected mode, just get the address of the Linear Frame Buffer and plot to it just like in mode 13h.

    The code I gave you will only work in mode 13h, but could easily be expanded to work in higher resolutions.

  7. #7
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101
    Thanks a lot again. Yes, i figured, 'cause when i switched
    it to :
    asm mov AX, 0x4f01
    asm mov BX, 0x101

    ( 640x400x256colors )

    while running under windows i got like ten consecutive blue screens, after
    which ( i'm not kidding here ) i had to phisically turn off the pc. When i tried
    to launch the compiler again ( Borland C++ 3.1 for DOS ) i only got
    an error message saying something about memory fault. I had a backup though,
    and i'm ok now. But yes, it doesn't work in higher res. And since you brought up the
    subject about DPMI, would it be too much if i asked what it really is and how can
    i use it? So far i understood it's a memory extender, i have to get some
    address ( in assembly, of course ) and use that address somehow.

    Thanks a lot again.


    Sunny

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need Help in Mouse Pointer
    By obaid in forum C++ Programming
    Replies: 3
    Last Post: 12-07-2006, 03:33 AM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  3. Problem with Mouse Over Menu!!! HELP!!!
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2006, 02:10 AM
  4. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM