mirror of https://github.com/OpenTTD/OpenTTD
(svn r23241) -Codechange: make the decision when to go to the custom drawn cursor more prominently during the initialisation of OpenTTD
parent
cc85ef493a
commit
6e31c2f068
|
@ -782,6 +782,7 @@ int ttd_main(int argc, char *argv[])
|
||||||
|
|
||||||
/* restore saved music volume */
|
/* restore saved music volume */
|
||||||
_music_driver->SetVolume(_settings_client.music.music_vol);
|
_music_driver->SetVolume(_settings_client.music.music_vol);
|
||||||
|
_video_driver->ClaimMousePointer();
|
||||||
|
|
||||||
NetworkStartUp(); // initialize network-core
|
NetworkStartUp(); // initialize network-core
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,16 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
static bool _has_console;
|
static bool _has_console;
|
||||||
|
static bool _cursor_disable = true;
|
||||||
|
static bool _cursor_visible = true;
|
||||||
|
|
||||||
static bool cursor_visible = true;
|
bool MyShowCursor(bool show, bool toggle)
|
||||||
|
|
||||||
bool MyShowCursor(bool show)
|
|
||||||
{
|
{
|
||||||
if (cursor_visible == show) return show;
|
if (toggle) _cursor_disable = !_cursor_disable;
|
||||||
|
if (_cursor_disable) return show;
|
||||||
|
if (_cursor_visible == show) return show;
|
||||||
|
|
||||||
cursor_visible = show;
|
_cursor_visible = show;
|
||||||
ShowCursor(show);
|
ShowCursor(show);
|
||||||
|
|
||||||
return !show;
|
return !show;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define WIN32_H
|
#define WIN32_H
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
bool MyShowCursor(bool show);
|
bool MyShowCursor(bool show, bool toggle = false);
|
||||||
|
|
||||||
typedef void (*Function)(int);
|
typedef void (*Function)(int);
|
||||||
bool LoadLibraryList(Function proc[], const char *dll);
|
bool LoadLibraryList(Function proc[], const char *dll);
|
||||||
|
|
|
@ -225,11 +225,23 @@ static bool CreateMainSurface(uint w, uint h)
|
||||||
snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
|
snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
|
||||||
set_window_title(caption);
|
set_window_title(caption);
|
||||||
|
|
||||||
|
enable_hardware_cursor();
|
||||||
|
select_mouse_cursor(MOUSE_CURSOR_ARROW);
|
||||||
|
show_mouse(_allegro_screen);
|
||||||
|
|
||||||
GameSizeChanged();
|
GameSizeChanged();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VideoDriver_Allegro::ClaimMousePointer()
|
||||||
|
{
|
||||||
|
select_mouse_cursor(MOUSE_CURSOR_NONE);
|
||||||
|
show_mouse(_allegro_screen);
|
||||||
|
disable_hardware_cursor();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
struct VkMapping {
|
struct VkMapping {
|
||||||
uint16 vk_from;
|
uint16 vk_from;
|
||||||
byte vk_count;
|
byte vk_count;
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
|
|
||||||
/* virtual */ bool AfterBlitterChange();
|
/* virtual */ bool AfterBlitterChange();
|
||||||
|
|
||||||
|
/* virtual */ bool ClaimMousePointer();
|
||||||
|
|
||||||
/* virtual */ const char *GetName() const { return "allegro"; }
|
/* virtual */ const char *GetName() const { return "allegro"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -259,13 +259,18 @@ static bool CreateMainSurface(uint w, uint h)
|
||||||
|
|
||||||
snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
|
snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
|
||||||
SDL_CALL SDL_WM_SetCaption(caption, caption);
|
SDL_CALL SDL_WM_SetCaption(caption, caption);
|
||||||
SDL_CALL SDL_ShowCursor(0);
|
|
||||||
|
|
||||||
GameSizeChanged();
|
GameSizeChanged();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VideoDriver_SDL::ClaimMousePointer()
|
||||||
|
{
|
||||||
|
SDL_CALL SDL_ShowCursor(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
struct VkMapping {
|
struct VkMapping {
|
||||||
uint16 vk_from;
|
uint16 vk_from;
|
||||||
byte vk_count;
|
byte vk_count;
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
|
|
||||||
/* virtual */ bool AfterBlitterChange();
|
/* virtual */ bool AfterBlitterChange();
|
||||||
|
|
||||||
|
/* virtual */ bool ClaimMousePointer();
|
||||||
|
|
||||||
/* virtual */ const char *GetName() const { return "sdl"; }
|
/* virtual */ const char *GetName() const { return "sdl"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,11 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool ClaimMousePointer()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the driver has a graphical user interface with the end user.
|
* Whether the driver has a graphical user interface with the end user.
|
||||||
* Or in other words, whether we should spawn a thread for world generation
|
* Or in other words, whether we should spawn a thread for world generation
|
||||||
|
|
|
@ -81,6 +81,12 @@ static void UpdatePalette(HDC dc, uint start, uint count)
|
||||||
SetDIBColorTable(dc, start, count, rgb);
|
SetDIBColorTable(dc, start, count, rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VideoDriver_Win32::ClaimMousePointer()
|
||||||
|
{
|
||||||
|
MyShowCursor(false, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
struct VkMapping {
|
struct VkMapping {
|
||||||
byte vk_from;
|
byte vk_from;
|
||||||
byte vk_count;
|
byte vk_count;
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
|
|
||||||
/* virtual */ bool AfterBlitterChange();
|
/* virtual */ bool AfterBlitterChange();
|
||||||
|
|
||||||
|
/* virtual */ bool ClaimMousePointer();
|
||||||
|
|
||||||
/* virtual */ const char *GetName() const { return "win32"; }
|
/* virtual */ const char *GetName() const { return "win32"; }
|
||||||
|
|
||||||
bool MakeWindow(bool full_screen);
|
bool MakeWindow(bool full_screen);
|
||||||
|
|
Loading…
Reference in New Issue