hey everyone,
At the moment, I am developing my editor for my game, and I have hit a
cropper. I am trying to use multiple SDL_Surface’s on the screen, so that I
can have different parts to the editor. When I try to do this, it causes
the program to crash. Here is the part of the code:
extern SDL_Surface *sScreen; /* main SDL surface */
SDL_Surface *sEditor; /* The editor screen */
SDL_Surface *sTileset; /* The tileset used for the level */
/* The current color to fill */
Uint32 color;
/* We define the editing area */
SDL_Rect editarea;
editarea.w = 400;
editarea.h = 480;
editarea.x = 0;
editarea.y = 0;
/* Next we need the editing area */
color = SDL_MapRGB (sScreen->format, 0, 255, 0);
SDL_FillRect(sEditor,&editarea,color);
Basicly, when I try to draw the sEditor surface onto the screen by doing the
FillRect, it causes the program to crash. Where am I going wrong with
this? Basicly, what I am TRYING to do is use the sScreen surface to blit
the editor cursor, which is the current tile selected, then when the user
clicks the mouse, I want to blit that to the sEditor surface at the current
mouse x,y coords, and this surface and be exported to BMP later. I can’t
find any examples of this anywhere, only samples that use 1 surface, which
is no use to me.
Thanks in advance for any help.