@ -88,26 +88,38 @@ static UiContainer * UiContainerInitGameUiContainer(){
} ;
Vector2 position = ( Vector2 ) { 20 , 300 } ;
int showDescription = 1 ;
Selectable * selectable1 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building " , showDescription , 9 , 16 , SELECTABLE_ID_TEST ) ;
int hasBackground = 1 ;
int groupOne = 0 ;
int groupTwo = 1 ;
int fontSize = 16 ;
Selectable * selectable1 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building " ,
showDescription , 9 , fontSize , SELECTABLE_ID_TEST , groupOne ) ;
position . y + = 100 ;
Selectable * selectable2 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building2 " , showDescription , 10 , 16 , SELECTABLE_ID_TEST ) ;
Selectable * selectable2 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building2 " ,
showDescription , 10 , fontSize , SELECTABLE_ID_TEST , groupOne ) ;
position . y + = 100 ;
Selectable * selectable3 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building3 " , showDescription , 10 , 16 , SELECTABLE_ID_TEST ) ;
Selectable * selectable3 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building3 " ,
showDescription , 10 , fontSize , SELECTABLE_ID_TEST , groupOne ) ;
position . y + = 100 ;
Selectable * selectable4 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building4 " , showDescription , 10 , 16 , SELECTABLE_ID_TEST ) ;
Selectable * selectable4 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building4 " ,
showDescription , 10 , fontSize , SELECTABLE_ID_TEST , groupTwo ) ;
position . x + = 100 ;
Selectable * selectable5 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building5 " , showDescription , 10 , 16 , SELECTABLE_ID_TEST ) ;
Selectable * selectable5 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building5 " ,
showDescription , 10 , fontSize , SELECTABLE_ID_TEST , groupTwo ) ;
position . x + = 100 ;
Selectable * selectable6 = SelectableInit ( textures , backgroundTextures , 1 , & position , " Building6 " , showDescription , 10 , 16 , SELECTABLE_ID_TEST ) ;
Selectable * selectable6 = SelectableInit ( textures , backgroundTextures , hasBackground , & position , " Building6 " ,
showDescription , 10 , fontSize , SELECTABLE_ID_TEST , groupTwo ) ;
uiContainer - > selectables [ 0 ] = selectable1 ;
uiContainer - > selectables [ 1 ] = selectable2 ;
uiContainer - > selectables [ 2 ] = selectable3 ;
uiContainer - > selectables [ 3 ] = selectable4 ;
uiContainer - > selectables [ 4 ] = selectable5 ;
uiContainer - > selectables [ 5 ] = selectable6 ;
int selectableCounter = 0 ;
uiContainer - > selectableCounter = 6 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable1 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable2 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable3 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable4 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable5 ;
uiContainer - > selectables [ selectableCounter + + ] = selectable6 ;
uiContainer - > selectableCounter = selectableCounter ;
return uiContainer ;
}
@ -145,8 +157,8 @@ static void UpdateSelectables(Game *game, Selectable **selectables, int selectab
// Unselecting every selectable if one is selected
if ( setState = = SELECTABLE_STATE_SELECTED ) {
int j ;
for ( j = 0 ; j < selectableCounter ; j + + ) {
if ( i ! = j ) {
for ( j = 0 ; j < selectableCounter ; j + + ) {
if ( i ! = j & & selectables [ j ] - > groupID = = selectables [ i ] - > groupID ) {
SelectableUnselectSelectable ( selectables [ j ] ) ;
}
}