• Advertisement
Sign in to follow this  

c++ return * ->format problem

This topic is 2127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.

/* 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 */



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
Advertisement
Sign in to follow this  

  • Advertisement