Sign in to follow this  
Tw3tye

c++ return * ->format problem

Recommended Posts

Hello.
short demonstration

i got functions that return me "SDL_Surface* surf_Screen"
i want to aces it ".format" member but i got a problem check it out.
[CODE]
/* roughtly */
in App class, is private, SDL_Surface *surf_Screen;
in Menu class, is private, SDL_Surface *surf_MouseIcon;
surf_Screen = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE | SDL_DOUBLEBUF);
surf_MouseIcon = IMG_Load("why are you reading this useless part");

SDL_Surface* App::GET_surf_Screen()
{
return surf_Screen;
}
bool App::Init()
{
SDL_SetColorKey(*objMenu.GETP_surf_MouseIcon(), SDL_SRCCOLORKEY, SDL_MapRGB( (GET_surf_Screen()->format), 255, 0,255));
}
/*surf_MouseIcon() returns me memory adres of the memory adres of that.*/
/* my problem starts at GET_surf_Screen()->format */
/* i cant aces ".format / ->format" from SDL_Surface */
/* so my question is : Do i need to make a function that returns : "return surf_Screen->format" */
/* or is there a fix to this */
[/CODE]


EDIT: i fixed it
SDL_SetColorKey(*objMenu.GETP_surf_MouseIcon(), SDL_SRCCOLORKEY, SDL_MapRGB( ((GET_surf_Screen())->format), 255, 0,255));
i put parentheses around the function"GET_surf_Screen()" and then do " ->format " Edited by Tw3tye

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this