Пример #1
0
	void onSelect( Gwen::Controls::Base* pControl )
	{
		Gwen::Controls::ComboBox* but = (Gwen::Controls::ComboBox*) pControl;

		Gwen::String str = Gwen::Utility::UnicodeToString(	but->GetSelectedItem()->GetText());

		if (m_callback)
			(*m_callback)(m_buttonId,str.c_str(),m_userPointer);
	}
Пример #2
0
	virtual void LoadTexture(Gwen::Texture* pTexture)
	{
		Gwen::String namestr = pTexture->name.Get();
		const char* n = namestr.c_str();
		GLint* texIdPtr = m_hashMap[n];
		if (texIdPtr)
		{
			pTexture->m_intData = *texIdPtr;
		}
	}
Пример #3
0
	void onButtonC(Gwen::Controls::Base* pControl)
	{
		Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
		Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
		Gwen::String laa = Gwen::Utility::UnicodeToString(la);
		const char* ha = laa.c_str();


//		printf("onButtonC ! %s\n", ha);
	}
Пример #4
0
	void onButtonB(Gwen::Controls::Base* pControl)
	{
		Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
		Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
		Gwen::String laa = Gwen::Utility::UnicodeToString(la);
		const char* ha = laa.c_str();


		selectDemo(sCurrentHightlighted);
		saveCurrentDemoEntry(sCurrentDemoIndex, startFileName);
	}
Пример #5
0
	void onButtonA(Gwen::Controls::Base* pControl)
	{
		const Gwen::String& name = pControl->GetName();
		Gwen::Controls::TreeNode* node = (Gwen::Controls::TreeNode*)pControl;
		Gwen::Controls::Label* l = node->GetButton();

		Gwen::UnicodeString la = node->GetButton()->GetText();// node->GetButton()->GetName();// GetText();
		Gwen::String laa = Gwen::Utility::UnicodeToString(la);
		const char* ha = laa.c_str();

		//printf("selected %s\n", ha);
		//int dep = but->IsDepressed();
		//int tog = but->GetToggleState();
//		if (m_data->m_toggleButtonCallback)
	//		(*m_data->m_toggleButtonCallback)(m_buttonId, tog);
	}
Пример #6
0
 void SDL2Renderer::RenderText(Gwen::Font* pFont, Gwen::Point pos, const Gwen::String& text)
 {
     TTF_Font *tfont = static_cast<TTF_Font*>(pFont->data);
     Translate(pos.x, pos.y);
     
     SDL_Surface *surf = TTF_RenderUTF8_Blended(tfont, text.c_str(), m_color);
     SDL_Texture *texture = SDL_CreateTextureFromSurface(m_renderer, surf);
     SDL_FreeSurface(surf);
     
     int w, h;
     SDL_QueryTexture(texture, NULL, NULL, &w, &h);
     const SDL_Rect dest = { pos.x,pos.y, w,h };
     
     SDL_RenderCopy(m_renderer, texture, NULL, &dest);
     
     SDL_DestroyTexture(texture);
 }
Пример #7
0
        Gwen::Point SDL2Renderer::MeasureText(Gwen::Font* pFont, const Gwen::String& text)
        {
            TTF_Font *tfont = static_cast<TTF_Font*>(pFont->data);

            // If the font doesn't exist, or the font size should be changed.
            if (!tfont || pFont->realsize != pFont->size*Scale())
            {
                FreeFont(pFont);
                LoadFont(pFont);
                tfont = static_cast<TTF_Font*>(pFont->data);
            }

            if (!tfont)
                return Gwen::Point(0, 0);

            int w,h;
            TTF_SizeUTF8(tfont, text.c_str(), &w,&h);
            
            return Point(w,h);
        }
Пример #8
0
float Gwen::Utility::Strings::To::Float( const Gwen::String& str )
{
	if ( str == "" ) return 0.0f;
	return (float)atof( str.c_str() );
}
Пример #9
0
int Gwen::Utility::Strings::To::Int( const Gwen::String& str )
{
	if ( str == "" ) return 0;
	return atoi( str.c_str() );
}