Mouse type now configurable
This commit is contained in:
parent
d9fe1a30d7
commit
09dbd1dd65
21 changed files with 494 additions and 238 deletions
47
src/mouse.c
47
src/mouse.c
|
|
@ -1,4 +1,49 @@
|
|||
#include "ibm.h"
|
||||
#include "mouse.h"
|
||||
#include "amstrad.h"
|
||||
#include "mouse_ps2.h"
|
||||
#include "mouse_serial.h"
|
||||
#include "keyboard_olim24.h"
|
||||
|
||||
void (*mouse_poll)(int x, int y, int b);
|
||||
static mouse_t *mouse_list[] =
|
||||
{
|
||||
&mouse_serial_microsoft,
|
||||
&mouse_ps2_2_button,
|
||||
&mouse_amstrad,
|
||||
&mouse_olim24,
|
||||
NULL
|
||||
};
|
||||
|
||||
static mouse_t *cur_mouse;
|
||||
static void *mouse_p;
|
||||
int mouse_type = 0;
|
||||
|
||||
void mouse_emu_init()
|
||||
{
|
||||
cur_mouse = mouse_list[mouse_type];
|
||||
mouse_p = cur_mouse->init();
|
||||
}
|
||||
|
||||
void mouse_emu_close()
|
||||
{
|
||||
if (cur_mouse)
|
||||
cur_mouse->close(mouse_p);
|
||||
cur_mouse = NULL;
|
||||
}
|
||||
|
||||
void mouse_poll(int x, int y, int b)
|
||||
{
|
||||
if (cur_mouse)
|
||||
cur_mouse->poll(x, y, b, mouse_p);
|
||||
}
|
||||
|
||||
char *mouse_get_name(int mouse)
|
||||
{
|
||||
if (!mouse_list[mouse])
|
||||
return NULL;
|
||||
return mouse_list[mouse]->name;
|
||||
}
|
||||
int mouse_get_type(int mouse)
|
||||
{
|
||||
return mouse_list[mouse]->type;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue