   -  ?
  ok Im aware this is some kind of assignment operator, like in basic itsvalue->variablebut what exactly does it do in c++/sdl?Its formatting right?I just dont understand how....here: if( optimizedImage != NULL )   {  //Map the color keyif(imageName=="bowser.png")    colorkey = SDL_MapRGB( optimizedImage->format, 0xFF, 0xFF, 0xFF );else if(imageName=="foo.png"||imageName=="dots.png")colorkey = SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF );  //Set all pixels of color R 0, G 0xFF, B 0xFF to be transparent  SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, colorkey );   }
  It's the . operator for pointers.The left hand side is a variable, and the right hand side is a 'sub variable' (formally called a "member") of that variable.   ;Quote:Original post by BlueBan007ok Im aware this is some kind of assignment operator, like in basic itsvalue->variableFor what it's worth, assignment in BASIC usually takes the form variable=value or LET variable=value. The language built into TI's calculators uses → as an assignment operator, but that language is not BASIC (it doesn't have an official name at all).   ;Quote:Original post by BlueBan007ok Im aware this is some kind of assignment operator, like in basic itsvalue->variablebut what exactly does it do in c++/sdl?SDL does nothing to the language syntax.Quote:Its formatting right?I have no idea what you mean by that.Quote:I just dont understand how....here:The expression 'optimizedImage->format' (rather, the fact that it doesn't cause a compilation error :) ) tells us that 'optimizedImage' is a pointer to some kind of structure, which has a member called 'format'. The -> notation is a shortcut for dereferencing the pointer and then selecting the member of the structure (i.e. '(*optimizedImage).format'). That data member is then passed to the SDL_MapRGB function as the first parameter.In this case, 'optimizedImage' is presumably an SDL_Surface*; i.e., it points to an SDL_Surface. (SDL creates SDL_Surface instances internally and gives you pointers to them; you don't get to touch them directly, but only via the pointers.) The SDL_Surface structure represents an image (or else a blank "canvas" onto which things may be drawn), and its 'format' member encodes some information about how the image's pixels are represented. (The structure also logically contains a grid of pixel-representations, each of which represents a pixel of the image.) The purpose of the SDL_MapRGB call is to convert the specified colour (specified with the last 3 arguments to the call) into a pixel-representation compatible with the image in question.On the last line, we use the pixel-representation (stored in 'colorkey') to set the image's color key. That is, the image struct remembers (with other data members) that any pixel with a matching pixel-representation should not be drawn. When you blit the image, SDL loops over the pixel-representations in the image: each one that matches the color key is skipped, and the others modify the pixel colour at a corresponding location on the destination surface.   ;  Just to be clear, C++ is a programming language, while SDL is just a library.  The library does not alter the language in any way.  The "->" will do the same thing in any library when you're working in C++.   