Mercurial > sdl-ios-xcode
diff src/video/ataricommon/SDL_xbiosevents.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | d910939febfa |
children | 4da1ee79c9af |
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_xbiosevents.c Sun May 21 17:27:13 2006 +0000 +++ b/src/video/ataricommon/SDL_xbiosevents.c Sun May 28 13:04:16 2006 +0000 @@ -35,114 +35,121 @@ /* Variables */ -int SDL_AtariXbios_enabled=0; +int SDL_AtariXbios_enabled = 0; /* Local variables */ -static _KBDVECS *kbdvecs; /* Pointer to access system vectors */ -static Uint16 atari_prevmouseb; /* buttons */ +static _KBDVECS *kbdvecs; /* Pointer to access system vectors */ +static Uint16 atari_prevmouseb; /* buttons */ /* Functions */ -void SDL_AtariXbios_InstallVectors(int vectors_mask) +void +SDL_AtariXbios_InstallVectors (int vectors_mask) { - void *oldpile; + void *oldpile; - /* Clear variables */ - SDL_AtariXbios_mouseb = - SDL_AtariXbios_mousex = - SDL_AtariXbios_mousey = - SDL_AtariXbios_joystick = - atari_prevmouseb = 0; + /* Clear variables */ + SDL_AtariXbios_mouseb = + SDL_AtariXbios_mousex = + SDL_AtariXbios_mousey = + SDL_AtariXbios_joystick = atari_prevmouseb = 0; - if (vectors_mask==0) { - SDL_AtariXbios_enabled=0; - return; - } + if (vectors_mask == 0) { + SDL_AtariXbios_enabled = 0; + return; + } - /* Read IKBD vectors base */ - kbdvecs=Kbdvbase(); + /* Read IKBD vectors base */ + kbdvecs = Kbdvbase (); - /* Go to supervisor mode */ - oldpile=(void *)Super(0); + /* Go to supervisor mode */ + oldpile = (void *) Super (0); - /* Install our vectors */ - SDL_AtariXbios_Install( - kbdvecs, - (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL, - (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? SDL_AtariXbios_JoystickVector : NULL - ); + /* Install our vectors */ + SDL_AtariXbios_Install (kbdvecs, + (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? + SDL_AtariXbios_MouseVector : NULL, + (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? + SDL_AtariXbios_JoystickVector : NULL); - /* Back to user mode */ - Super(oldpile); + /* Back to user mode */ + Super (oldpile); - SDL_AtariXbios_enabled=1; + SDL_AtariXbios_enabled = 1; } -void SDL_AtariXbios_RestoreVectors(void) +void +SDL_AtariXbios_RestoreVectors (void) { - void *oldpile; + void *oldpile; - if (SDL_AtariXbios_enabled==0) { - return; - } + if (SDL_AtariXbios_enabled == 0) { + return; + } + + /* Read IKBD vectors base */ + kbdvecs = Kbdvbase (); + + /* Go to supervisor mode */ + oldpile = (void *) Super (NULL); - /* Read IKBD vectors base */ - kbdvecs=Kbdvbase(); + /* Reinstall system vector */ + SDL_AtariXbios_Restore (kbdvecs); - /* Go to supervisor mode */ - oldpile=(void *)Super(NULL); + /* Back to user mode */ + Super (oldpile); +} - /* Reinstall system vector */ - SDL_AtariXbios_Restore(kbdvecs); - - /* Back to user mode */ - Super(oldpile); +static int +atari_GetButton (int button) +{ + switch (button) { + case 0: + return SDL_BUTTON_RIGHT; + break; + case 1: + default: + return SDL_BUTTON_LEFT; + break; + } } -static int atari_GetButton(int button) +void +SDL_AtariXbios_PostMouseEvents (_THIS, SDL_bool buttonEvents) { - switch(button) - { - case 0: - return SDL_BUTTON_RIGHT; - break; - case 1: - default: - return SDL_BUTTON_LEFT; - break; - } + if (SDL_AtariXbios_enabled == 0) { + return; + } + + /* Mouse motion ? */ + if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) { + SDL_PrivateMouseMotion (0, 1, SDL_AtariXbios_mousex, + SDL_AtariXbios_mousey); + SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0; + } + + /* Mouse button ? */ + if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) { + int i; + + for (i = 0; i < 2; i++) { + int curbutton, prevbutton; + + curbutton = SDL_AtariXbios_mouseb & (1 << i); + prevbutton = atari_prevmouseb & (1 << i); + + if (curbutton && !prevbutton) { + SDL_PrivateMouseButton (SDL_PRESSED, + atari_GetButton (i), 0, 0); + } + if (!curbutton && prevbutton) { + SDL_PrivateMouseButton (SDL_RELEASED, + atari_GetButton (i), 0, 0); + } + } + atari_prevmouseb = SDL_AtariXbios_mouseb; + } } -void SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents) -{ - if (SDL_AtariXbios_enabled==0) { - return; - } - - /* Mouse motion ? */ - if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) { - SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey); - SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0; - } - - /* Mouse button ? */ - if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) { - int i; - - for (i=0;i<2;i++) { - int curbutton, prevbutton; - - curbutton = SDL_AtariXbios_mouseb & (1<<i); - prevbutton = atari_prevmouseb & (1<<i); - - if (curbutton && !prevbutton) { - SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0); - } - if (!curbutton && prevbutton) { - SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0); - } - } - atari_prevmouseb = SDL_AtariXbios_mouseb; - } -} +/* vi: set ts=4 sw=4 expandtab: */