Example #1
0
		void Base::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString & text )
		{
			
		//	std::cout << "tryinta render sum txt '" << Gwen::Utility::UnicodeToString(text) <<"'\n";
			float fSize = pFont->size * Scale();

			SetDrawColor(Gwen::Color(0,0,0,255));
			for ( float i = 0; i < text.length(); i++ )
			{
				wchar_t chr = text[i];

				if ( chr == ' ' ) { continue; }

				Gwen::Rect r( pos.x + i * fSize * 0.4, pos.y, fSize * 0.4 - 1, fSize );

				/*
					This isn't important, it's just me messing around changing the
					shape of the rect based on the letter.. just for fun.
				*/
				if ( chr == 'l' || chr == 'i' || chr == '!' || chr == 't' )
				{
					r.w = 1;
				}
				else if ( chr >= 'a' && chr <= 'z' )
				{
					r.y += fSize * 0.5f;
					r.h -= fSize * 0.4f;
				}
				else if ( chr == '.' || chr == ',' )
				{
					r.x += 2;
					r.y += r.h - 2;
					r.w = 2;
					r.h = 2;
				}
				else if ( chr == '\'' || chr == '`'  || chr == '"' )
				{
					r.x += 3;
					r.w = 2;
					r.h = 2;
				}

				if ( chr == 'o' || chr == 'O' || chr == '0' )
				{ DrawLinedRect( r ); }
				else
				{
				//	std::cout << "drawing ur flld rct: " <<r.x<<','<<r.y<<','<<r.w<<','<<r.h<<"\n";
					DrawFilledRect( r );
				}
			}
		}
Example #2
0
		void Base::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text )
		{
			float fSize = pFont->size * Scale();

			for ( float i=0; i<text.length(); i++ )
			{
				wchar_t chr = text[i];

				if ( chr == ' ' ) continue;

				Gwen::Rect r( pos.x + i * fSize * 0.4, pos.y, fSize * 0.4 -1, fSize );

				/*
					This isn't important, it's just me messing around changing the
					shape of the rect based on the letter.. just for fun.
				*/
				if ( chr == 'l' || chr == 'i' || chr == '!' || chr == 't' )
				{
					r.w = 1;
				}
				else if ( chr >= 'a' && chr <= 'z' )
				{
					r.y += fSize * 0.5f;
					r.h -= fSize * 0.4f;
				}
				else if ( chr == '.' || chr == ',' )
				{
					r.x += 2;
					r.y += r.h - 2;
					r.w = 2;
					r.h = 2;
				}
				else if ( chr == '\'' || chr == '`'  || chr == '"' )
				{
					r.x += 3;
					r.w = 2;
					r.h = 2;
				}


				if ( chr == 'o' || chr == 'O' || chr == '0' )
					DrawLinedRect( r );	
				else
					DrawFilledRect( r );
			}
		}