Arama butonu
Bu konudaki kullanıcılar: 1 misafir
1
Cevap
511
Tıklama
0
Öne Çıkarma
Yanlış Return Value
B
13 yıl (125 mesaj)
Teğmen
Konu Sahibi

arkadaşlar fonksiyon class dışındayken gayet güzel çalışıyor fakat class içine aldığımda return valuesini yanlış diye error veriyor hemen erroru yapıştırıyım

Error 1 error C2440: 'return' : cannot convert from 'SDL_Surface *' to 'SDL_Surface GraphicHandler::* '
2 IntelliSense: return value type does not match the function type c:\Users\efee\Documents\Visual Studio 2012\Projects\Project4\Project4\GraphicHandler.cpp


class GraphicHandler
{
public:
static const int SCREEN_WIDTH = 640;
static const int SCREEN_HEIGHT = 480;
static const int SCREEN_BPP = 32;
SDL_Surface *load_image( std::string filename );
void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination );
void DrawBackground();
void UpdateScreen();
void start();
GraphicHandler(void);
~GraphicHandler(void);

private:

SDL_Rect s1;
SDL_Rect s2;
SDL_Surface *message;
SDL_Surface *background;
SDL_Surface *screen;
};



SDL_Surface GraphicHandler::*load_image( std::string filename )
{
//Temporary storage for the image that's loaded
SDL_Surface* loadedImage = NULL;

//The optimized image that will be used
SDL_Surface* optimizedImage = NULL;

//Load the image
loadedImage = SDL_LoadBMP( filename.c_str() );

//If nothing went wrong in loading the image
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat( loadedImage );

//Free the old image
SDL_FreeSurface( loadedImage );
}

//Return the optimized image
return optimizedImage;
}


optimizedimagenin altı kırmızı :(





< Bu mesaj bu kişi tarafından değiştirildi BeMasterinCpp -- 14 Kasım 2013; 0:55:53 >


Bu mesajda bahsedilenler: @elektro_gadget
B
13 yıl (125 mesaj)
Teğmen
Konu Sahibi

SDL_Surface GraphicHandler::*load_image( std::string filename )

bunu SDL_Surface *GraphicHandler::load_image( std::string filename )

olarak değiştirdim oldu :)



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.