Пример #1
0
void CMenu::AddOkCancel( int a_iOkCode )
{
	SDL_Rect oRect;
	oRect.x = 0; oRect.w = 150;
	oRect.y = gamescreen->h - 50; oRect.h = sge_TTF_FontHeight( inkFont );

	CMenuItem* poItem = AddMenuItem( "~OK", SDLK_o, a_iOkCode );
	poItem->SetPosition( oRect );
	
//	poItem = AddMenuItem( "Cancel", SDLK_UNKNOWN, 0 );
	oRect.x = gamescreen->w - 150;
	poItem->SetPosition( oRect );
}
Пример #2
0
CMenuItem* CMenu::AddMenuItem( CMenuItem* a_poItem )
{
	m_oItems.push_back( a_poItem );
	
	SDL_Rect oRect;
	oRect.x = 0; oRect.w = gamescreen->w;
	oRect.y = m_oItems.size() * 40 + 100;
	oRect.h = sge_TTF_FontHeight( inkFont );

	a_poItem->SetPosition( oRect );
	
	return a_poItem;
}
Пример #3
0
void API_SDLAGG::Gfx_DrawString(s32 x, s32 y, c_string_p format, u32 bgcolor, u32 fgcolor)
{
	int strpos = 0;
	int strpos_s = 0;
	float cury = y;
	char _tstr[256];
	int strAscent = sge_TTF_FontAscent(font)/2;
	int strheight = sge_TTF_FontHeight(font)-strAscent;
	while(strpos_s<256)
	{
		_tstr[strpos] = format[strpos_s++];
		if(_tstr[strpos] == '\n')
		{
			_tstr[strpos] = '\0';
			sge_tt_textout((SDL_Surface*)_gfxSurface, font, _tstr, (int)x, (int)cury+strheight, fgcolor, bgcolor, 255);
			cury+=(strheight);
			strpos = 0;
		}else if(_tstr[strpos] == '\0')
		{
			sge_tt_textout((SDL_Surface*)_gfxSurface, font, _tstr, (int)x, (int)cury+strheight, fgcolor, bgcolor, 255);
			break;
		}else strpos++;
	}
};