mirror of https://github.com/OpenTTD/OpenTTD
(svn r6292) -Cleanup: Indentation, bracing, etc.
parent
d7e1d08d53
commit
463ae887ea
|
@ -184,6 +184,7 @@ static bool CreateMainSurface(int w, int h)
|
|||
if (icon != NULL) {
|
||||
/* Get the colourkey, which will be magenta */
|
||||
uint32 rgbmap = SDL_CALL SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
|
||||
SDL_CALL SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
|
||||
SDL_CALL SDL_WM_SetIcon(icon, NULL);
|
||||
SDL_CALL SDL_FreeSurface(icon);
|
||||
|
@ -263,6 +264,7 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
|
|||
{
|
||||
const VkMapping *map;
|
||||
uint key = 0;
|
||||
|
||||
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
|
||||
if ((uint)(sym->sym - map->vk_from) <= map->vk_count) {
|
||||
key = sym->sym - map->vk_from + map->map_to;
|
||||
|
@ -295,8 +297,10 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
|
|||
if (sym->mod & KMOD_CTRL) key |= WKC_CTRL;
|
||||
if (sym->mod & KMOD_ALT) key |= WKC_ALT;
|
||||
// these two lines really help porting hotkey combos. Uncomment to use -- Bjarni
|
||||
//printf("scancode character pressed %d\n", sym->scancode);
|
||||
//printf("unicode character pressed %d\n", sym->unicode);
|
||||
#if 0
|
||||
printf("scancode character pressed %d\n", sym->scancode);
|
||||
printf("unicode character pressed %d\n", sym->unicode);
|
||||
#endif
|
||||
return (key << 16) + sym->unicode;
|
||||
}
|
||||
|
||||
|
@ -306,8 +310,7 @@ static int PollEvent(void)
|
|||
{
|
||||
SDL_Event ev;
|
||||
|
||||
if (!SDL_CALL SDL_PollEvent(&ev))
|
||||
return -2;
|
||||
if (!SDL_CALL SDL_PollEvent(&ev)) return -2;
|
||||
|
||||
switch (ev.type) {
|
||||
case SDL_MOUSEMOTION:
|
||||
|
@ -329,25 +332,24 @@ static int PollEvent(void)
|
|||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (_rightclick_emulate && (SDL_CALL SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)))
|
||||
if (_rightclick_emulate && (SDL_CALL SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL))) {
|
||||
ev.button.button = SDL_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
switch (ev.button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
_left_button_down = true;
|
||||
break;
|
||||
|
||||
case SDL_BUTTON_RIGHT:
|
||||
_right_button_down = true;
|
||||
_right_button_clicked = true;
|
||||
break;
|
||||
case SDL_BUTTON_WHEELUP:
|
||||
_cursor.wheel--;
|
||||
break;
|
||||
case SDL_BUTTON_WHEELDOWN:
|
||||
_cursor.wheel++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
case SDL_BUTTON_WHEELUP: _cursor.wheel--; break;
|
||||
case SDL_BUTTON_WHEELDOWN: _cursor.wheel++; break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -511,8 +513,10 @@ static void SdlVideoFullScreen(bool full_screen)
|
|||
{
|
||||
_fullscreen = full_screen;
|
||||
GetVideoModes(); // get the list of available video modes
|
||||
if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1]))
|
||||
_fullscreen ^= true; // switching resolution failed, put back full_screen to original status
|
||||
if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1])) {
|
||||
// switching resolution failed, put back full_screen to original status
|
||||
_fullscreen ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
const HalVideoDriver _sdl_video_driver = {
|
||||
|
|
Loading…
Reference in New Issue