Re: full description and mouse programming

Search this archive.

From: Johannes Zellner (johannes@zellner.org)
Date: Sun 28 May 2000 - 11:20:09 IDT


On Sat, 27 May 2000, Arnaud Diederen wrote:

> 
> Hello,
> 
> I'm mailing to ask you where i could find a full description of the svgalib.
> The official site being a little light, i haven't been able to find what i needed.
if you're on UNIX `man -k vga' does help a lot. The examples which
are shipped with vgalib are helpful too.

> What i'd also like to get is a tutorial on how to program the mouse under the svgalib.
#include <vgamouse.h>

/* turn mouse support on */
vga_setmousesupport(1);

int x = mouse_getx();
int y = mouse_gety();
int b = mouse_getbutton();

you typically will use the vgalib select version `vga_waitevent' to listen
for events:

/* here's how an event loop could look like */
while (1) {
    int ret = vga_waitevent(VGA_MOUSEEVENT | VGA_KEYEVENT,
        (fd_set*) 0, (fd_set*) 0, (fd_set*) 0, (struct timeval*) 0);
    mouse_getposition_6d(...);
}

The actual mouse behaviour (speed / acceleration) is controlled in
/etc/vga/libvga.conf (or whereever your installation puts it).

Note that vgalib does not supply something like a cursor to show
where the mouse is. If you want to have this, you've to draw and
`undraw' a cursor yourself, while the mouse moves.

-- 
   Johannes


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST