⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddtext.cpp

📁 赤壁之战(游戏原码)
💻 CPP
字号:
/////////////////////////
// 	CDDString.cpp	:	v0010
//	Written by	 	:	Li	Haijun
//	Compiler		:	Microsoft Visual C++ 4.0
//	v0010			:	Aug.21.1996
/////////////////////////
// to show a sting
/////////////////////////////////////////////////////////////////////////////
// CDDString class

#include	"stdafx.h"
#include	"marco.h"
#include	"ddtext.h"
#include	"puthz.h"


///////////////////////////////////////////////////////////
// to define a class to show a string at the special place
class	CDDString	*	pAllString[MAX_TEXT] ;		// to store the four network game player's name in this

///////////////////////////////////////////

CDDString::CDDString()
{
	m_bIsUse = FALSE ;
	m_bName = FALSE ;
	m_dwX = 0 ;
	m_dwY = 0 ;
	m_TextColor = RGB(255, 255, 255) ;
	memset( m_cString, 0, sizeof(m_cString) );
}

CDDString::~CDDString()
{
}

void		CDDString::SetPos( int x, int y )
{
	m_dwX = x ;
	m_dwY = y ;
}

int			CDDString::GetPosX( void )
{
	return m_dwX ;
}

int			CDDString::GetPosY( void )
{
	return m_dwY ;
}

void		CDDString::SetColor( COLORREF color )
{
	m_TextColor = color ;
}

COLORREF	CDDString::GetColor( void )
{
	return m_TextColor ;
}

void		CDDString::SetString( LPCSTR string )
{
	strcpy( m_cString, string ) ;

	int		length = sizeof( m_cString ) ;
	for( int i=0; i<length; i++ )
	{
		if( m_cString[i] == '&' )
			m_cString[i] = ' ' ;
	}
}

BOOL		CDDString::GetString( LPSTR  string )
{
	if( m_cString[0] != '\0' )
	{
		strcpy( string, m_cString ) ;
		return TRUE ;
	}
	else
		return FALSE ;
}

void		CDDString::ToEmpty( void )
{
	m_bIsUse = FALSE ;
	m_dwX = 0 ;
	m_dwY = 0 ;
	m_TextColor = RGB(255, 255, 255) ;
	memset( m_cString, 0, sizeof(m_cString) );
}

void		CDDString::Blit( void )
{
	class	CDDText MESSAGE_TEXT;		// the string attribute of MESSAGE_STRING

	if( m_bName == TRUE )
		MESSAGE_TEXT.BeginText( MAX_NAME_LETTER );	// ( 640 - 30 ) / 16
	else
		MESSAGE_TEXT.BeginText( NETWORK_MAX_MESSAGE_LETTER+1+2+MAX_NAME_LETTER  );	// ( 640 - 30 ) / 16
	MESSAGE_TEXT.SetTextColor( m_TextColor );
	MESSAGE_TEXT.MyTextOut( DD_GetBackBuffer(), m_dwX, m_dwY, m_cString );
	// to release the character surface
	MESSAGE_TEXT.EndText( );
}

///////////////////////////////////////////////////////////////
// to declear some function to operate the array of this class
void	FACE_DeleteAllText()
{
	for( int i=0; i<MAX_TEXT; i++ )
	{
		if( pAllString[i] != NULL	)
		{
			delete pAllString[i];
			pAllString[i] = NULL;
		}
	}
	return;
}

⌨️ 快捷键说明

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