In SDL programming in c++ (I write codes in Ubuntu Linux), for drawing a text on the screen, I made a function and the second argument of it, gets the text. The type of it, is char*. In the main function, what should I send to the above function for the second argument. For example in this code, I get error in compiling: (I want to draw the text (Player1 must play...) on the screen by using the function)
#include<iostream>
#include"SDL/SDL.h"
#include<SDL/SDL_gfxPrimitives.h>
#include "SDL/SDL_ttf.h"
using namespace std;
void drawText(SDL_Surface* screen,char* strin1 ,int size,int x, int y,int fR, int fG, int fB,int bR, int bG, int bB)
{
TTF_Font*font = TTF_OpenFont("ARIAL.TTF", size);
SDL_Color foregroundColor = { fR, fG, fB };
SDL_Color backgroundColor = { bR, bG, bB };
SDL_Surface* textSurface = TTF_RenderText_Shaded(font, strin1,foregroundColor, backgroundColor);
SDL_Rect textLocation = { x, y, 0, 0 };
SDL_BlitSurface(textSurface, NULL, screen, &textLocation);
SDL_FreeSurface(textSurface);
TTF_CloseFont(font);
}
int main(){
SDL_Init( SDL_INIT_VIDEO);
TTF_Init();
SDL_Surface* screen = SDL_SetVideoMode(1200,800,32,0);
SDL_WM_SetCaption("Ping Pong", 0 );
SDL_Delay(500);
drawText(screen,"Player1 must play with ESCAPE & SPACE Keys and player2 must play with UP & DOWN Keys. . . Have Fun!!!",20,15,550,50,50,100,180,180,180);
return 0;
}