|
|
@ -438,6 +438,9 @@ void CTouchControls::CreateAtlasTexture() |
|
|
|
stbrp_rect *rects = (stbrp_rect*)malloc(textureList.Count()*sizeof(stbrp_rect)); |
|
|
|
stbrp_rect *rects = (stbrp_rect*)malloc(textureList.Count()*sizeof(stbrp_rect)); |
|
|
|
memset(rects, 0, sizeof(stbrp_node)*textureList.Count()); |
|
|
|
memset(rects, 0, sizeof(stbrp_node)*textureList.Count()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( touchTextureID ) |
|
|
|
|
|
|
|
vgui::surface()->DeleteTextureByID( touchTextureID ); |
|
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < textureList.Count(); i++ ) |
|
|
|
for( int i = 0; i < textureList.Count(); i++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CTouchTexture *t = textureList[i]; |
|
|
|
CTouchTexture *t = textureList[i]; |
|
|
@ -516,6 +519,7 @@ void CTouchControls::CreateAtlasTexture() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DestroyVTFTexture(t->vtf); |
|
|
|
DestroyVTFTexture(t->vtf); |
|
|
|
|
|
|
|
t->isInAtlas = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
touchTextureID = vgui::surface()->CreateNewTextureID( true ); |
|
|
|
touchTextureID = vgui::surface()->CreateNewTextureID( true ); |
|
|
@ -643,8 +647,13 @@ void CTouchControls::Paint( ) |
|
|
|
CTouchButton *btn = *it; |
|
|
|
CTouchButton *btn = *it; |
|
|
|
|
|
|
|
|
|
|
|
if( btn->texture != NULL && !(btn->flags & TOUCH_FL_HIDE) ) |
|
|
|
if( btn->texture != NULL && !(btn->flags & TOUCH_FL_HIDE) ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !btn->texture->isInAtlas ) |
|
|
|
|
|
|
|
CreateAtlasTexture(); |
|
|
|
|
|
|
|
|
|
|
|
meshCount++; |
|
|
|
meshCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
meshBuilder.Begin( m_pMesh, MATERIAL_QUADS, meshCount ); |
|
|
|
meshBuilder.Begin( m_pMesh, MATERIAL_QUADS, meshCount ); |
|
|
|
|
|
|
|
|
|
|
@ -734,6 +743,8 @@ void CTouchControls::AddButton( const char *name, const char *texturefile, const |
|
|
|
|
|
|
|
|
|
|
|
CTouchTexture *texture = new CTouchTexture; |
|
|
|
CTouchTexture *texture = new CTouchTexture; |
|
|
|
btn->texture = texture; |
|
|
|
btn->texture = texture; |
|
|
|
|
|
|
|
texture->isInAtlas = false; |
|
|
|
|
|
|
|
texture->X0 = 0; texture->X1 = 0; texture->Y0 = 0; texture->Y1 = 0; |
|
|
|
Q_strncpy( texture->szName, btn->texturefile, sizeof(btn->texturefile) ); |
|
|
|
Q_strncpy( texture->szName, btn->texturefile, sizeof(btn->texturefile) ); |
|
|
|
textureList.AddToTail(texture); |
|
|
|
textureList.AddToTail(texture); |
|
|
|
|
|
|
|
|
|
|
|