cursor.cpp

来自「hl2 source code. Do not use it illegal.」· C++ 代码 · 共 64 行

CPP
64
字号
/*----------------------------------------------------------------------
Copyright (c) 1998 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.

File:	cursor.cpp
Owner:	russf@gipsysoft.com
Purpose:	Cursor abstraction.
----------------------------------------------------------------------*/
#include "stdafx.h"
#include "Cursor.h"
#include "QHTM_Includes.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCursor::CCursor()
	: m_cursor( knArrow )
{

}

CCursor::~CCursor()
{

}


void CCursor::Load( CursorShape c )
{
	m_cursor = c;
}


void CCursor::Set()
{
	//	REVIEW - russf - OS specific code
	HCURSOR cur = NULL;
	switch( m_cursor )
	{
	case knArrow:
		cur = ::LoadCursor( NULL, IDC_ARROW );
		break;

	case knHand:
		cur = ::LoadCursor( NULL, MAKEINTRESOURCE(/*IDC_HAND*/32649) );
		if (!cur)
		{
			cur = ::LoadCursor( g_hResourceInstance, MAKEINTRESOURCE( g_uHandCursorID ) );
		}
		break;

	default:
		TRACE(_T("Invalid cursor shape used\n"));
		ASSERT( FALSE );
		break;
	}

	//	If this fires then you have not yet added the resources from QHTM (cursor, bitmap)		
	ASSERT( cur );
	SetCursor( cur );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?