Changeset - r18395:22ade7a0b9e1
[Not reviewed]
master
0 10 0
rubidium - 13 years ago 2011-11-17 21:09:08
rubidium@openttd.org
(svn r23241) -Codechange: make the decision when to go to the custom drawn cursor more prominently during the initialisation of OpenTTD
10 files changed with 44 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -779,12 +779,13 @@ int ttd_main(int argc, char *argv[])
 

	
 
	/* Initialize the zoom level of the screen to normal */
 
	_screen.zoom = ZOOM_LVL_NORMAL;
 

	
 
	/* restore saved music volume */
 
	_music_driver->SetVolume(_settings_client.music.music_vol);
 
	_video_driver->ClaimMousePointer();
 

	
 
	NetworkStartUp(); // initialize network-core
 

	
 
#if defined(ENABLE_NETWORK)
 
	if (debuglog_conn != NULL && _network_available) {
 
		const char *not_used = NULL;
src/os/windows/win32.cpp
Show inline comments
 
@@ -25,20 +25,22 @@
 
#include "../../string_func.h"
 
#include "../../crashlog.h"
 
#include <errno.h>
 
#include <sys/stat.h>
 

	
 
static bool _has_console;
 

	
 
static bool cursor_visible = true;
 
static bool _cursor_disable = true;
 
static bool _cursor_visible = true;
 

	
 
bool MyShowCursor(bool show)
 
bool MyShowCursor(bool show, bool toggle)
 
{
 
	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);
 

	
 
	return !show;
 
}
 

	
 
/**
src/os/windows/win32.h
Show inline comments
 
@@ -10,13 +10,13 @@
 
/** @file win32.h declarations of functions for MS windows systems */
 

	
 
#ifndef WIN32_H
 
#define WIN32_H
 

	
 
#include <windows.h>
 
bool MyShowCursor(bool show);
 
bool MyShowCursor(bool show, bool toggle = false);
 

	
 
typedef void (*Function)(int);
 
bool LoadLibraryList(Function proc[], const char *dll);
 

	
 
char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
 
wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
src/video/allegro_v.cpp
Show inline comments
 
@@ -222,17 +222,29 @@ static bool CreateMainSurface(uint w, ui
 
	InitPalette();
 

	
 
	char caption[32];
 
	snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
 
	set_window_title(caption);
 

	
 
	enable_hardware_cursor();
 
	select_mouse_cursor(MOUSE_CURSOR_ARROW);
 
	show_mouse(_allegro_screen);
 

	
 
	GameSizeChanged();
 

	
 
	return true;
 
}
 

	
 
bool VideoDriver_Allegro::ClaimMousePointer()
 
{
 
	select_mouse_cursor(MOUSE_CURSOR_NONE);
 
	show_mouse(_allegro_screen);
 
	disable_hardware_cursor();
 
	return true;
 
}
 

	
 
struct VkMapping {
 
	uint16 vk_from;
 
	byte vk_count;
 
	byte map_to;
 
};
 

	
src/video/allegro_v.h
Show inline comments
 
@@ -28,12 +28,14 @@ public:
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 

	
 
	/* virtual */ bool AfterBlitterChange();
 

	
 
	/* virtual */ bool ClaimMousePointer();
 

	
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
};
 

	
 
/** Factory for the allegro video driver. */
 
class FVideoDriver_Allegro: public VideoDriverFactory<FVideoDriver_Allegro> {
 
public:
src/video/sdl_v.cpp
Show inline comments
 
@@ -256,19 +256,24 @@ static bool CreateMainSurface(uint w, ui
 
	BlitterFactoryBase::GetCurrentBlitter()->PostResize();
 

	
 
	InitPalette();
 

	
 
	snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
 
	SDL_CALL SDL_WM_SetCaption(caption, caption);
 
	SDL_CALL SDL_ShowCursor(0);
 

	
 
	GameSizeChanged();
 

	
 
	return true;
 
}
 

	
 
bool VideoDriver_SDL::ClaimMousePointer()
 
{
 
	SDL_CALL SDL_ShowCursor(0);
 
	return true;
 
}
 

	
 
struct VkMapping {
 
	uint16 vk_from;
 
	byte vk_count;
 
	byte map_to;
 
};
 

	
src/video/sdl_v.h
Show inline comments
 
@@ -28,12 +28,14 @@ public:
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 

	
 
	/* virtual */ bool AfterBlitterChange();
 

	
 
	/* virtual */ bool ClaimMousePointer();
 

	
 
	/* virtual */ const char *GetName() const { return "sdl"; }
 
};
 

	
 
/** Factory for the SDL video driver. */
 
class FVideoDriver_SDL: public VideoDriverFactory<FVideoDriver_SDL> {
 
public:
src/video/video_driver.hpp
Show inline comments
 
@@ -53,12 +53,17 @@ public:
 
	 */
 
	virtual bool AfterBlitterChange()
 
	{
 
		return true;
 
	}
 

	
 
	virtual bool ClaimMousePointer()
 
	{
 
		return true;
 
	}
 

	
 
	/**
 
	 * 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
 
	 * and NewGRF scanning so the graphical updates can keep coming. Otherwise
 
	 * progress has to be shown on the console, which uses by definition another
 
	 * thread/process for display purposes.
src/video/win32_v.cpp
Show inline comments
 
@@ -78,12 +78,18 @@ static void UpdatePalette(HDC dc, uint s
 
		rgb[i].rgbReserved = 0;
 
	}
 

	
 
	SetDIBColorTable(dc, start, count, rgb);
 
}
 

	
 
bool VideoDriver_Win32::ClaimMousePointer()
 
{
 
	MyShowCursor(false, true);
 
	return true;
 
}
 

	
 
struct VkMapping {
 
	byte vk_from;
 
	byte vk_count;
 
	byte map_to;
 
};
 

	
src/video/win32_v.h
Show inline comments
 
@@ -28,12 +28,14 @@ public:
 
	/* virtual */ bool ChangeResolution(int w, int h);
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 

	
 
	/* virtual */ bool AfterBlitterChange();
 

	
 
	/* virtual */ bool ClaimMousePointer();
 

	
 
	/* virtual */ const char *GetName() const { return "win32"; }
 

	
 
	bool MakeWindow(bool full_screen);
 
};
 

	
 
/** The factory for Windows' video driver. */
0 comments (0 inline, 0 general)