summaryrefslogtreecommitdiff
path: root/vguimatsurface/Cursor.cpp
blob: 545154141a65aa52a4109410ac5a24f7ad29c981 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Methods associated with the cursor
//
// $Revision: $
// $NoKeywords: $
//===========================================================================//

#if !defined( _X360 )
	#define OEMRESOURCE //for OCR_* cursor junk
	#include "winlite.h"
#endif
#include <appframework/ilaunchermgr.h>

#if defined( USE_SDL )
#undef M_PI
#include "SDL.h"
#endif

#include "tier0/dbg.h"
#include "tier0/vcrmode.h"
#include "tier0/icommandline.h"
#include "tier1/utldict.h"
#include "Cursor.h"
#include "vguimatsurface.h"
#include "MatSystemSurface.h"
#include "filesystem.h"
#if defined( _X360 )
#include "xbox/xbox_win32stubs.h"
#endif

#if defined( USE_SDL ) 
#include "materialsystem/imaterialsystem.h"
#endif

#include "inputsystem/iinputsystem.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

using namespace vgui;
#if defined( USE_SDL )
static SDL_Cursor *s_pDefaultCursor[ dc_last ];
static SDL_Cursor *s_hCurrentCursor = NULL;
static SDL_Cursor *s_hCurrentlySetCursor = NULL;
#elif defined( WIN32 )
static HICON s_pDefaultCursor[ dc_last ];
static HICON s_hCurrentCursor = NULL;
#endif
static bool s_bCursorLocked = false; 
static bool s_bCursorVisible = true;
static int s_nForceCursorVisibleCount = 0;
static bool s_bSoftwareCursorActive = false;
static int  s_nSoftwareCursorTexture = -1;
static float  s_fSoftwareCursorOffsetX = 0;
static float  s_fSoftwareCursorOffsetY = 0;
static int	s_rnSoftwareCursorID[20];
static float s_rfSoftwareCursorOffset[20][2];
static bool s_bSoftwareCursorsInitialized = false;

extern CMatSystemSurface g_MatSystemSurface;

//-----------------------------------------------------------------------------
// Initializes cursors
//-----------------------------------------------------------------------------
void InitCursors()
{
	// load up all default cursors
#if defined( USE_SDL )

	s_pDefaultCursor[ dc_none ]     = NULL;
	s_pDefaultCursor[ dc_arrow ]    = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_ARROW );
	s_pDefaultCursor[ dc_ibeam ]    = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_IBEAM );
	s_pDefaultCursor[ dc_hourglass ]= SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_WAIT );
	s_pDefaultCursor[ dc_crosshair ]= SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_CROSSHAIR );
	s_pDefaultCursor[ dc_waitarrow ]= SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_WAITARROW );
	s_pDefaultCursor[ dc_sizenwse ] = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_SIZENWSE );
	s_pDefaultCursor[ dc_sizenesw ] = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_SIZENESW );
	s_pDefaultCursor[ dc_sizewe ]   = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_SIZEWE );
	s_pDefaultCursor[ dc_sizens ]   = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_SIZENS );
	s_pDefaultCursor[ dc_sizeall ]  = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_SIZEALL );
	s_pDefaultCursor[ dc_no ]       = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_NO );
	s_pDefaultCursor[ dc_hand ]     = SDL_CreateSystemCursor( SDL_SYSTEM_CURSOR_HAND );

	s_hCurrentCursor = s_pDefaultCursor[ dc_arrow ];

#elif defined( WIN32 )

	s_pDefaultCursor[ dc_none ]      = NULL;
	s_pDefaultCursor[ dc_arrow ]     =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_NORMAL);
	s_pDefaultCursor[ dc_ibeam ]     =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_IBEAM);
	s_pDefaultCursor[ dc_hourglass ] =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_WAIT);
	s_pDefaultCursor[ dc_crosshair ] =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_CROSS);
	s_pDefaultCursor[ dc_waitarrow ] =(HICON)LoadCursor(NULL, (LPCTSTR)32650);
	s_pDefaultCursor[ dc_up ]        =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_UP);
	s_pDefaultCursor[ dc_sizenwse ]  =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_SIZENWSE);
	s_pDefaultCursor[ dc_sizenesw ]  =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_SIZENESW);
	s_pDefaultCursor[ dc_sizewe ]    =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_SIZEWE);
	s_pDefaultCursor[ dc_sizens ]    =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_SIZENS);
	s_pDefaultCursor[ dc_sizeall ]   =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_SIZEALL);
	s_pDefaultCursor[ dc_no ]        =(HICON)LoadCursor(NULL, (LPCTSTR)OCR_NO);
	s_pDefaultCursor[ dc_hand ]      =(HICON)LoadCursor(NULL, (LPCTSTR)32649);

	s_hCurrentCursor = s_pDefaultCursor[ dc_arrow ];

#endif

	s_bCursorLocked = false;
	s_bCursorVisible = true;
	s_nForceCursorVisibleCount = 0;
}


#define USER_CURSOR_MASK 0x80000000

#ifdef WIN32
//-----------------------------------------------------------------------------
// Purpose: Simple manager for user loaded windows cursors in vgui
//-----------------------------------------------------------------------------
class CUserCursorManager
{
public:
	void Shutdown();
	vgui::HCursor CreateCursorFromFile( char const *curOrAniFile, char const *pPathID );
	bool LookupCursor( vgui::HCursor cursor, HCURSOR& handle );
private:
	CUtlDict< HCURSOR, int >	m_UserCursors;
};

void CUserCursorManager::Shutdown()
{
	for ( int i = m_UserCursors.First() ; i != m_UserCursors.InvalidIndex(); i = m_UserCursors.Next( i ) )
	{
		::DestroyCursor( m_UserCursors[ i ] );
	}
	m_UserCursors.RemoveAll();
}

vgui::HCursor CUserCursorManager::CreateCursorFromFile( char const *curOrAniFile, char const *pPathID )
{
	char fn[ 512 ];
	Q_strncpy( fn, curOrAniFile, sizeof( fn ) );
	Q_strlower( fn );
	Q_FixSlashes( fn );
	
	int cursorIndex = m_UserCursors.Find( fn );
	if ( cursorIndex != m_UserCursors.InvalidIndex() )
	{
		return cursorIndex | USER_CURSOR_MASK;
	}

	g_pFullFileSystem->GetLocalCopy( fn );

	char fullpath[ 512 ];
	g_pFullFileSystem->RelativePathToFullPath( fn, pPathID, fullpath, sizeof( fullpath ) );
	
	HCURSOR newCursor = (HCURSOR)LoadCursorFromFile( fullpath );
	cursorIndex = m_UserCursors.Insert( fn, newCursor );
	return cursorIndex | USER_CURSOR_MASK;
}

bool CUserCursorManager::LookupCursor( vgui::HCursor cursor, HCURSOR& handle )
{
	if ( !( (int)cursor & USER_CURSOR_MASK ) )
	{
		handle = 0;
		return false;
	}

	int cursorIndex = (int)cursor & ~USER_CURSOR_MASK;
	if ( !m_UserCursors.IsValidIndex( cursorIndex ) )
	{
		handle = 0;
		return false;
	}

	handle = m_UserCursors[ cursorIndex ];
	return true;
}

static CUserCursorManager g_UserCursors;
#endif

vgui::HCursor Cursor_CreateCursorFromFile( char const *curOrAniFile, char const *pPathID )
{
#ifdef WIN32 
	return g_UserCursors.CreateCursorFromFile( curOrAniFile, pPathID );
#else
	return dc_user;
#endif
}


void Cursor_ClearUserCursors()
{
#ifdef WIN32 
	g_UserCursors.Shutdown();
#endif
}


//-----------------------------------------------------------------------------
// Initializes all the textures for software cursors
//-----------------------------------------------------------------------------
int InitSoftwareCursorTexture( const char *pchFilename )
{
	if( !pchFilename || !*pchFilename )
		return -1;

	int nTextureID = g_MatSystemSurface.DrawGetTextureId( pchFilename );
	if( nTextureID == -1 )
	{
		nTextureID = g_MatSystemSurface.CreateNewTextureID();
		g_MatSystemSurface.DrawSetTextureFile( nTextureID, pchFilename, true, false );
	}
	return nTextureID;
}

void InitSoftwareCursors()
{
	if( s_bSoftwareCursorsInitialized )
		return;

	memset( s_rfSoftwareCursorOffset, 0, sizeof( s_rfSoftwareCursorOffset ) );

	s_rnSoftwareCursorID[dc_none]     = -1;
	s_rnSoftwareCursorID[dc_arrow]    =InitSoftwareCursorTexture( "vgui/cursors/arrow" );
	s_rnSoftwareCursorID[dc_ibeam]    =InitSoftwareCursorTexture( "vgui/cursors/ibeam" );
	s_rnSoftwareCursorID[dc_hourglass]=InitSoftwareCursorTexture( "vgui/cursors/hourglass" );
	s_rnSoftwareCursorID[dc_crosshair]=InitSoftwareCursorTexture( "vgui/cursors/crosshair" );
	s_rnSoftwareCursorID[dc_waitarrow]=InitSoftwareCursorTexture( "vgui/cursors/waitarrow" );
	s_rnSoftwareCursorID[dc_up]       =InitSoftwareCursorTexture( "vgui/cursors/up" );
	s_rnSoftwareCursorID[dc_sizenwse] =InitSoftwareCursorTexture( "vgui/cursors/sizenwse" );
	s_rnSoftwareCursorID[dc_sizenesw] =InitSoftwareCursorTexture( "vgui/cursors/sizenesw" );
	s_rnSoftwareCursorID[dc_sizewe]   =InitSoftwareCursorTexture( "vgui/cursors/sizewe" );
	s_rnSoftwareCursorID[dc_sizens]   =InitSoftwareCursorTexture( "vgui/cursors/sizens" );
	s_rnSoftwareCursorID[dc_sizeall]  =InitSoftwareCursorTexture( "vgui/cursors/sizeall" );
	s_rnSoftwareCursorID[dc_no]       =InitSoftwareCursorTexture( "vgui/cursors/no" );
	s_rnSoftwareCursorID[dc_hand]     =InitSoftwareCursorTexture( "vgui/cursors/hand" );

	// handle the cursor hotspots not being at their origin
	s_rfSoftwareCursorOffset[dc_arrow][0] = -0.1;
	s_rfSoftwareCursorOffset[dc_arrow][1] = -0.1;
	s_rfSoftwareCursorOffset[dc_ibeam][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_ibeam][1] = -0.8;
	s_rfSoftwareCursorOffset[dc_hourglass][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_hourglass][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_crosshair][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_crosshair][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_waitarrow][0] = -0.1;
	s_rfSoftwareCursorOffset[dc_waitarrow][1] = -0.1;
	s_rfSoftwareCursorOffset[dc_up][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_up][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizenwse][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizenwse][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizenesw][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizenesw][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizewe][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizewe][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizens][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizens][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizeall][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_sizeall][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_no][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_no][1] = -0.5;
	s_rfSoftwareCursorOffset[dc_hand][0] = -0.5;
	s_rfSoftwareCursorOffset[dc_hand][1] = -0.5;

	s_bSoftwareCursorsInitialized = true;
}


//-----------------------------------------------------------------------------
// Selects a cursor
//-----------------------------------------------------------------------------
void CursorSelect(HCursor hCursor)
{
	if ( ( hCursor == dc_alwaysvisible_push ) || ( hCursor == dc_alwaysvisible_pop ) )
	{
		// CConPanel in engine/console.cpp does a SetCursor(null). So when the TF2 chat window pops up
		//	and there are console commands showing and fading out in the top left, our chat window
		//	will have a cursor show/hide fight with them. So the cursor flickers or doesn't show up
		//	at all. Unfortunately on Linux, it's even worse since we recenter the mouse when it's
		//	not shown - so we added this API call which causes cursor.cpp to always show the cursor.
		s_nForceCursorVisibleCount += ( hCursor == dc_alwaysvisible_push ? 1 : -1 );
		Assert( s_nForceCursorVisibleCount >= 0 );

		if( ( s_nForceCursorVisibleCount && !s_bCursorVisible ) ||
			( !s_nForceCursorVisibleCount && s_bCursorVisible ) )
		{
			ActivateCurrentCursor();
		}
		return;
	}

	if (s_bCursorLocked)
		return;

#if defined( WIN32 ) && !defined( USE_SDL )
	s_bCursorVisible = true;
	switch (hCursor)
	{
	case dc_user:
	case dc_none:
	case dc_blank:
		s_bCursorVisible = false;
		break;

	case dc_arrow:
	case dc_waitarrow:
	case dc_ibeam:
	case dc_hourglass:
	case dc_crosshair:
	case dc_up:
	case dc_sizenwse:
	case dc_sizenesw:
	case dc_sizewe:
	case dc_sizens:
	case dc_sizeall:
	case dc_no:
	case dc_hand:
		if( !s_bSoftwareCursorActive )
		{
			s_hCurrentCursor = s_pDefaultCursor[hCursor];
		}
		else
		{
			s_nSoftwareCursorTexture = s_rnSoftwareCursorID[ hCursor ];
			s_fSoftwareCursorOffsetX = s_rfSoftwareCursorOffset[ hCursor ][0];
			s_fSoftwareCursorOffsetY = s_rfSoftwareCursorOffset[ hCursor ][1];
		}
		break;

	default:
		{
			HCURSOR custom = 0;
			if ( g_UserCursors.LookupCursor( hCursor, custom ) && custom != 0 )
			{
				s_hCurrentCursor = custom;
			}
			else
			{
				s_bCursorVisible = false;
				Assert(0);
			}
		}
		break;
	}

	ActivateCurrentCursor();

#elif defined( USE_SDL )

	switch (hCursor)
	{
	case dc_user:
	case dc_none:
	case dc_blank:
		s_bCursorVisible = false;
		break;

	default:
		// We don't support custom cursors at the moment (but could, if necessary).
		// Fall through and use the arrow for now...
		Assert(0);
		hCursor = dc_arrow;

	case dc_arrow:
	case dc_waitarrow:
	case dc_ibeam:
	case dc_hourglass:
	case dc_crosshair:
	case dc_up:
	case dc_sizenwse:
	case dc_sizenesw:
	case dc_sizewe:
	case dc_sizens:
	case dc_sizeall:
	case dc_no:
	case dc_hand:
		s_bCursorVisible = true;
		if( !s_bSoftwareCursorActive )
		{
			s_hCurrentCursor = s_pDefaultCursor[hCursor];
		}
		else
		{
			s_nSoftwareCursorTexture = s_rnSoftwareCursorID[ hCursor ];
			s_fSoftwareCursorOffsetX = s_rfSoftwareCursorOffset[ hCursor ][0];
			s_fSoftwareCursorOffsetY = s_rfSoftwareCursorOffset[ hCursor ][1];
		}
		break;
	}

	ActivateCurrentCursor();

#else
#error
#endif

}


//-----------------------------------------------------------------------------
// Hides the hardware cursor
//-----------------------------------------------------------------------------
void HideHardwareCursor()
{
#if defined( WIN32 ) && !defined( USE_SDL )
	::SetCursor(NULL);
#elif defined( USE_SDL )
	//if ( s_hCurrentlySetCursor != s_pDefaultCursor[ dc_none ] )
	{
		s_hCurrentlySetCursor = s_pDefaultCursor[ dc_none ];
		g_pLauncherMgr->SetMouseCursor( s_hCurrentlySetCursor );
		g_pLauncherMgr->SetMouseVisible( false );
	}
#else
#error
#endif
}


//-----------------------------------------------------------------------------
// Activates the current cursor
//-----------------------------------------------------------------------------
void ActivateCurrentCursor()
{
	if( s_bSoftwareCursorActive )
	{
		HideHardwareCursor();
		return;
	}

	if ( s_bCursorVisible || ( s_nForceCursorVisibleCount > 0 ) )
	{
#if defined( WIN32 ) && !defined( USE_SDL )
		::SetCursor(s_hCurrentCursor);
#elif defined( USE_SDL )
		if (s_hCurrentlySetCursor != s_hCurrentCursor )
		{
			s_hCurrentlySetCursor = s_hCurrentCursor;
			g_pLauncherMgr->SetMouseCursor( s_hCurrentlySetCursor );
			g_pLauncherMgr->SetMouseVisible( true );
		}
#else
#error
#endif
	}
	else
	{
		HideHardwareCursor();
	}
}


//-----------------------------------------------------------------------------
// Purpose: prevents vgui from changing the cursor
//-----------------------------------------------------------------------------
void LockCursor( bool bEnable )
{
	s_bCursorLocked = bEnable;
	ActivateCurrentCursor();
}


//-----------------------------------------------------------------------------
// Purpose: unlocks the cursor state
//-----------------------------------------------------------------------------
bool IsCursorLocked()
{
	return s_bCursorLocked;
}


//-----------------------------------------------------------------------------
// handles mouse movement
//-----------------------------------------------------------------------------
void CursorSetPos( void *hwnd, int x, int y )
{
#if defined( USE_SDL )
	if ( s_bCursorVisible )
#endif
		g_pInputSystem->SetCursorPosition( x, y );
}

void CursorGetPos(void *hwnd, int &x, int &y)
{
#if defined ( USE_SDL ) && !defined( PLATFORM_WINDOWS )
	if ( s_bCursorVisible )
	{
		SDL_GetMouseState( &x, &y );

		int windowHeight = 0;
		int windowWidth = 0;
		//unsigned int ignored;
		SDL_GetWindowSize( ( SDL_Window * )g_pLauncherMgr->GetWindowRef(), &windowWidth, &windowHeight );

		CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
		int rx, ry, width, height;
		pRenderContext->GetViewport( rx, ry, width, height );
	
		if ( !s_bSoftwareCursorActive && (width != windowWidth || height != windowHeight )  )
		{
			// scale the x/y back into the co-ords of the back buffer, not the scaled up window 
			//DevMsg( "Mouse x:%d y:%d %d %d %d %d\n", x, y, width, windowWidth, height, abs( height - windowHeight ) );
			x = x * (float)width/windowWidth;
			y = y * (float)height/windowHeight;
		}
	}
	else 
	{
		// cursor is invisible, just say we have it pinned to the middle of the screen
		CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
		int rx, ry, width, height;
		pRenderContext->GetViewport( rx, ry, width, height );
		x = rx + width/2;
		y = ry + height/2;
		//printf( "Mouse(inv) x:%d y:%d %d %d\n", x, y, width, height );
	}
#else
	POINT pt;

	// Default implementation
	VCRHook_GetCursorPos( &pt );
	VCRHook_ScreenToClient((HWND)hwnd, &pt);
	x = pt.x; y = pt.y;
#endif
}


void EnableSoftwareCursor( bool bEnable )
{
	if( bEnable )
		InitSoftwareCursors();

	bool bWasEnabled = s_bSoftwareCursorActive;
	s_bSoftwareCursorActive = bEnable;

	// set the cursor to the arrow (or none if appropriate) if we're activating the
	// software cursor. VGUI will likely update it again soon, but this will give
	// us some kind of cursor in the meantime
	if( !bWasEnabled && bEnable )
	{
		if( s_bCursorVisible )
			CursorSelect( dc_arrow );
	}
}

bool ShouldDrawSoftwareCursor()
{
	return s_bSoftwareCursorActive && s_bCursorVisible;
}

int  GetSoftwareCursorTexture( float *px, float *py )
{
	if( px && py )
	{
		*px = s_fSoftwareCursorOffsetX;
		*py = s_fSoftwareCursorOffsetY;
	}
	return s_nSoftwareCursorTexture;
}