Hi. I try to created two dimensional array and I want to show this numbers on screen. I have something like that
TTF_Init();
TTF_Font * font = TTF_OpenFont(“arialn.ttf”,25);
SDL_Color color = { 255, 255, 255 };
int texW = 65;
int texH = 65;
SDL_Surface * surface = NULL;
SDL_Texture * texture = NULL;
SDL_Rect dstrect = {texW,texH,25,25};
for(int i=0; i<9; i++)
{
small_rect.x = 50;
rect.x = 50;
for(int j=0; j<9; j++)
{
SDL_SetRenderDrawColor(renderer, 0, 128,128, 128);
SDL_RenderFillRect(renderer,&rect);
SDL_SetRenderDrawColor(renderer, 0, 0,255, 255);
SDL_RenderDrawRect(renderer, &small_rect);
surface = TTF_RenderText_Solid(font,"text", color);
texture = SDL_CreateTextureFromSurface(renderer,surface);
SDL_QueryTexture(texture, NULL, NULL, &texW, &texH);
SDL_RenderCopy(renderer, texture, NULL, &dstrect);
texW+=50;
small_rect.x+=50;
rect.x+=50;
}
texH+=50;
small_rect.y+=50;
rect.y+=50;
}
Loop to show numbers from array on screen but this print text only one time