[SDL] Getting Devc++ compile errors on SDL_BlitSurface (n00bie question)
Brian Kropf
bkropf at emich.edu
Wed Dec 15 11:10:34 PST 2004
tile = SDL_LoadBMP("D:\Pyro\img\brick.bmp");
You have to make sure to escape the backslashes like this:
tile = SDL_LoadBMP("D:\\Pyro\\img\\brick.bmp");
or this will usually work as well:
tile = SDL_LoadBMP("D:/Pyro/img/brick.bmp");
otherwise it'll think you are trying to use the string escape sequence \P, \i, \b.
- brian
Ihateusernames wrote:
>Here is my code. The errors are all on SDL_Blitsurface, and they are:
>45 D:\Pyro\main.cpp:31 [Warning] unknown escape sequence '\P'
>45 D:\Pyro\main.cpp:31 [Warning] unknown escape sequence '\i'
> D:\Pyro\main.cpp In function `int SDL_main(int, char**)':
>40 D:\Pyro\main.cpp cannot convert `SDL_Rect' to `SDL_Rect*' for argument `4'
>to `int SDL_UpperBlit(SDL_Surface*, SDL_Rect*, SDL_Surface*, SDL_Rect*)'
> D:\Pyro\Makefile.win [Build Error] [main.o] Error 1
>
>Can anyone please tell me what is wrong?
>
>#include <iostream>
>#include <stdlib.h>
>
>#include <SDL/SDL.h>
>
>#define width 320;
>#define height 200;
>#define BPP 16;
>
>void Slock(SDL_Surface *screen);
>void Sulock(SDL_Surface *screen);
>
>using namespace std;
>
>SDL_Surface *screen;
>SDL_Surface *tile;
>
>int main(int argc, char *argv[])
>{
>
>SDL_Rect dest;
>
>if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) <0 )
>{
> printf("Unable to init SDL: %s\n", SDL_GetError());
> return 1;
>}
> atexit(SDL_Quit);
>
> screen = SDL_SetVideoMode(320, 200, 32,
>SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN);
> tile = SDL_LoadBMP("D:\Pyro\img\brick.bmp");
> if ( screen == NULL )
> {
> cout << "Unable to set "<< "320" << "x" << "200" << "x" << "16" << "
>video: " << SDL_GetError() << endl;
> return 1;
> }
> Slock(screen);
>
> dest.x = 0; dest.y=0;
> SDL_BlitSurface(screen, NULL, tile, dest);
>
> Sulock(screen);
> SDL_Flip(screen);
> for (int uhu=0; uhu<1000000000; uhu++);
>
> return 0;
>}
>
>
>void Slock(SDL_Surface *screen)
>{
> if ( SDL_MUSTLOCK(screen) )
> {
> if ( SDL_LockSurface(screen) < 0 )
> {
> return;
> }
> }
>}
>
>void Sulock(SDL_Surface *screen)
>{
> if ( SDL_MUSTLOCK(screen) )
> {
> SDL_UnlockSurface(screen);
> }
>}
>
>
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl
>
>
More information about the SDL
mailing list