Re: [cc65] Mouse API Proposals

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-08-26 14:27:35
Hi!

On Wed, Aug 26, 2009 at 01:31:45PM +0200, Oliver Schmidt wrote:
> I'm somewhat puzzled why everybody talks about the mouse drivers. What
> does the mouse driver have to do with text or graphics mode display
> and the user program preferences regarding pixel vs. char resolution?

The driver does return those coordinates. And the initial bounding box is the
resolution of the graphics screen. So the current driver *does* depend on
pixel resolution. As a consequence, it seems somewhat logical that using other
coordinates may be implemented in the driver. This has nothing to do with your
other proposals, these may be implemented in other places.

So assume we take the mouse driver, and at each point, coordinates are passed
to or from the driver, these coordinates are translated to or from text mode
coordinates using two small functions (or macros where applicable). This
wouldn't make the driver "fat", just a bit larger. Since there are only a few
places where this translation is necessary, we can have one source for both
drivers - the one that uses text mode coords and the other one that uses
graphics mode coords. The nice thing is that no API changes are necessary.
Text mode applications would use one driver and graphics mode applications
another.

> Beside that - going down the road Uz pointed out would mean that for
> consistency reasons setting the bounding box and setting the cursor
> pos would have to happen char based as well.

Actually, I was thinking about exactly that. If you're using one sort of
coordinates, you'll have to use them throughout.

> THIS would mean a fat
> driver (without the option to get rid of actually unused functionality
> at link time). One cannot just have the whole mouse driver work with
> chars because the mouse would become way to sensitive/fast...

Translating coordinates is not that expensive - both speed and codewise. The
text mode mouse driver would grow by about 50-100 bytes, which is acceptable
in my eyes. And it would not work with chars internally, just translate
coordinates into chars if the user requests them.

> So maybe it's just two ordinary functions (probably in the conio library) ?

We can place them there, but please reconsider a driver change as described
above. I'm actually willing to make a sample if necessary.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Aug 26 14:29:16 2009

This archive was generated by hypermail 2.1.8 : 2009-08-26 14:29:18 CEST