Code: Show/Hide #include <sdl.h>
#include <string.h> const int screen_w = 500; const int screen_h = 500; const int screen_bpp = 32; SDL_Surface *message = NULL; SDL_Surface *background = NULL; SDL_Surface *screen = NULL; SDL_Surface *load_image(std::string fileName) { SDL_Surface* loadedImage = NULL; SDL_Surface* optimizedImage = NULL; loadedImage = SDL_LoadBMP(fileName.c_str()); if (loadedImage!=NULL) { optimizedImage = SDL_DisplayFormat(loadedImage); SDL_FreeSurface(loadedImage); } return optimizedImage; } void apply_surface(int x,int y, SDL_Surface* source, SDL_Surface destination) { SDL_Rect offset; offset.x = x; offset.y = y; SDL_BlitSurface(source,NULL,destination,&offset); } int main(int argc, char* args[]) { if (SDL_Init(SDL_INIT_EVERYTHING)== -1)) { return 1; } screen = SDL_SetVideoMode(screen_w,screen_h,screen_bpp,SDL_SWSURFACE); if (screen == NULL) { return 1; } SDL_WM_SetCaption("A3 Pokemon 2",NULL); message = load_image("logo.bmp"); background = load_image("bg.bmp"); apply_surface(0,0,background,screen); apply_surface(102,175,message,screen); if (SDL_Flip == -1) { return 1; } SDL_Delay(3000); SDL_FreeSurface(backround); SDL_FreeSurface(message); SDL_Quit(); return 0; } |
Code: Show/Hide 1>------ Build started: Project: A3 Pokemon 2, Configuration: Debug Win32 ------
1>Compiling... 1>main.cpp 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(12) : error C2653: 'std' : is not a class or namespace name 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(12) : error C2065: 'string' : undeclared identifier 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(12) : error C2146: syntax error : missing ')' before identifier 'fileName' 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(12) : error C2059: syntax error : ')' 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(13) : error C2143: syntax error : missing ';' before '{' 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(13) : error C2447: '{' : missing function header (old-style formal list?) 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(36) : error C2664: 'SDL_UpperBlit' : cannot convert parameter 3 from 'SDL_Surface' to 'SDL_Surface *' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(42) : error C2059: syntax error : ')' 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(56) : error C2064: term does not evaluate to a function taking 1 arguments 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(57) : error C2064: term does not evaluate to a function taking 1 arguments 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(59) : error C2664: 'apply_surface' : cannot convert parameter 4 from 'SDL_Surface *' to 'SDL_Surface' 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(60) : error C2664: 'apply_surface' : cannot convert parameter 4 from 'SDL_Surface *' to 'SDL_Surface' 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(62) : error C2446: '==' : no conversion from 'int' to 'int (__cdecl *)(SDL_Surface *)' 1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(62) : error C2040: '==' : 'int (__cdecl *)(SDL_Surface *)' differs in levels of indirection from 'int' 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(69) : error C2065: 'backround' : undeclared identifier 1>Build log was saved at "file://c:\Documents and Settings\Owner\Desktop\Programing\c++\A3 Pokemon 2 VC version\A3 Pokemon 2\A3 Pokemon 2\Debug\BuildLog.htm" 1>A3 Pokemon 2 - 15 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
Code: Show/Hide 1>------ Build started: Project: A3 Pokemon 2, Configuration: Debug Win32 ------
1>Compiling... 1>main.cpp 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(62) : error C2446: '==' : no conversion from 'int' to 'int (__cdecl *)(SDL_Surface *)' 1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\owner\desktop\programing\c++\a3 pokemon 2 vc version\a3 pokemon 2\a3 pokemon 2\main.cpp(62) : error C2040: '==' : 'int (__cdecl *)(SDL_Surface *)' differs in levels of indirection from 'int' 1>Build log was saved at "file://c:\Documents and Settings\Owner\Desktop\Programing\c++\A3 Pokemon 2 VC version\A3 Pokemon 2\A3 Pokemon 2\Debug\BuildLog.htm" 1>A3 Pokemon 2 - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
Code: Show/Hide extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); |