Пример #1
0
void CGameText::Display( CBaseEntity *pActivator )
{
	if ( !CanFireForActivator( pActivator ) )
		return;

	char fontbuf[48];
	FontGet(fontbuf);

	if ( MessageToAll() )
	{
		UTIL_HudMessageAll( m_textParms, MessageGet(), fontbuf );
	}
	else
	{
		// If we're in singleplayer, show the message to the player.
		if ( gpGlobals->maxClients == 1 )
		{
			CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
			UTIL_HudMessage( pPlayer, m_textParms, MessageGet(), fontbuf );
		}
		// Otherwise show the message to the player that triggered us.
		else if ( pActivator && pActivator->IsNetClient() )
		{
			UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet(), fontbuf );
		}
	}
}
Пример #2
0
/*
// - FontWidth(char c)
// -  	Returns the widthe of character 'c'
// -	
// - 	
// - 	
// -  Returns - uint8_t font character width
*/
uint8_t FontWidth(char c)
{
		char buf[7];
		buf[1] = 0;
		
		FontGet(c, buf);
		return buf[1];
}
Пример #3
0
/*
// - FontDisplayUpDown(char c, uint8_t offset, uint8_t up)
// -  	Places 'c' character on the display at 'offset'
// -	column either from the bottom up (up = 1)
// - 	or the top down (up = 0).
// - 	
// -  Returns - nothing
*/
void FontDisplayUpDown(char c, uint8_t offset, uint8_t up)
{
		char buf[7];
		
		// get font data for the current character and place it into the buffer
		FontGet(c, buf);
		uint8_t width = buf[1];
		uint8_t y, x, s,n;
		
		if(up){
				for(y=0; y<ROWS; y++) {
						n=0;
						s=5-y;
						while(s<ROWS){
								for(x=0; x<width; x++) {
										if((offset + x) < COLS) {
												if( (buf[2+x] & (1<<((ROWS-1)-n))) != 0) {
														ht1632c_set(offset + x,s,1);
												}else{
														ht1632c_set(offset + x,s,0);
												}
										}
								}
								delay_ms(4);
								n++;
								s++;
						}
				}
		}else{
				for(y=0; y<ROWS; y++) {
						n=(ROWS-1)-y;
						s=0;
						while(s<=y){
								for(x=0; x<width; x++) {
										if((offset + x) < COLS) {
												if( (buf[2+x] & (1<<((ROWS-1)-n))) != 0) {
														ht1632c_set(offset + x,s,1);
												}else{
														ht1632c_set(offset + x,s,0);
												}
										}
								}
								delay_ms(4);
								n++;
								s++;
						}
				}
		}
		// blank the next column to the right
		for(y=0; y<ROWS; y++) {
				ht1632c_set(offset+width,y, 0);
		}
}
Пример #4
0
/*
// - FontGet(char match, char *buf) 
// -  	Copies the character 'match' into 
// -	the buffer.
// -  Returns - nothing
*/
void FontGet(char match, char *buf)
{
		// copies the character "match" into the buffer
		uint8_t y;
		PGM_P p;
		
		for(y=0; y<FONT_SIZE; y++) {
				memcpy_P(&p, &font[y], sizeof(PGM_P));
				if(memcmp_P(&match, p,1)==0) {
						memcpy_P(buf, p, 7);
						return;
				}
		}
		
		// NO MATCH?
		FontGet('?', buf);
}
Пример #5
0
/*
// - FontDisplay(char c, uint8_t offset)
// -  	Places 'c' character on the display at 'offset'
// -	column. 
// - 	
// - 	
// -  Returns - nothing
*/
void FontDisplay(char c, uint8_t offset)
{
		char buf[7];
		
		FontGet(c, buf);
		uint8_t width = buf[1];
		uint8_t y, x;
		for(y=0; y<ROWS; y++) {
				for(x=0; x<width; x++) {
						if((offset + x) < COLS) {
								if( (buf[2+x] & (1<<((ROWS-1)-y))) != 0){
										ht1632c_set(offset + x,y,1);
								}else{
										ht1632c_set(offset + x,y,0);
								}
						}
				}
		}
		// blank the next column to the right
		for(y=0; y<ROWS; y++){
				ht1632c_set(offset+width,y, 0);
		}
}