delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/28/19:17:28

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mouse Cursors, GUI's.
Date: Sun, 28 Sep 1997 13:28:37 +0100
Organization: None
Distribution: world
Message-ID: <thLYchA11kL0EwXg@talula.demon.co.uk>
References: <3 DOT 0 DOT 16 DOT 19970928113810 DOT 1c0f11e8 AT hem1 DOT passagen DOT se>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Peter Palotas writes:
>First problem is the mouse-pointer. How do you greate an absolutely
>flicker-free mouse-pointer? I mean, just look at windows. It doesn't
>flicker. How did they do their mouse-pointer really?

Windows uses the hardware cursor, which is supported by most recent
graphics cards and is simply overlayed on top of the regular framebuffer
image, so there is no need to bother saving the image beneath it.

Doing that in a DOS program isn't very practical because there are way
too many different SVGA chipsets to support hardware cursors on them
all. The new VBE/AF interface does provide a standard way of doing this,
but SciTech have yet to release /AF drivers for any chips other than the
ATI Mach64 (I can't wait to get my hands on one for my Matrox :-)

>Next problem, which isn't really a *big* problem, would be the event
>handler. How do you write a good event-handler? Using interrupts such as
>the keyboard-interrupt and mouseinterrupt to trap events doesn't work very
>nice since you can't do I/O from a hooked interrupt.

I would use interrupts, but simply have them store the event in some
buffers and then return instantly. Then in your main loop you can sit
there checking these buffers, and whenever an event occurs you send the
appropriate message off to whatever window or object needs to deal with
it. You have to be quite careful about timing (if a keyboard interrupt
occurs at the very same instant that you are removing the previous
keypress from the buffer, what will happen?) but using a message queue
like this allows you to keep the interrupt handlers really simple and do
all the work in your mainline code.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019