Hello,
How would I go about resizing the main SDL_Surface?
I’ve tried the following, but with no success:================
int ResizeSurface(SDL_Surface * surface, Uint32 flags, Uint32 width, Uint32 height, Uint16 depth) {
SDL_FreeSurface(surface);
surface = SDL_SetVideoMode(width, height, depth, flags);
if(!surface) {
fprintf(stderr, “Unable to set video: %s\n”, SDL_GetError());
return -1;
}
return 0;
}
Neil Hodges wrote:
Hello,
How would I go about resizing the main SDL_Surface?
I’ve tried the following, but with no success:
int ResizeSurface(SDL_Surface * surface, Uint32 flags, Uint32 width,
Uint32 height, Uint16 depth) { SDL_FreeSurface(surface);
surface = SDL_SetVideoMode(width, height, depth, flags);
if(!surface) {
fprintf(stderr, “Unable to set video: %s\n”, SDL_GetError());
return -1;
}
return 0;
}
As was said not long ago, you MUST NOT FREE the main surface. The one
returned by SDL_SetVideoMode.
Try to quit SDL instead ( completly, use SDL_Quit ).
Hello !
How would I go about resizing the main SDL_Surface?
I’ve tried the following, but with no success:
int ResizeSurface(SDL_Surface * surface, Uint32 flags, Uint32 width,
Uint32 height, Uint16 depth) {
SDL_FreeSurface(surface);
surface = SDL_SetVideoMode(width, height, depth, flags); if(!surface) {
fprintf(stderr, “Unable to set video: %s\n”, SDL_GetError()); return -1; }
return 0; }
Look here :
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fSetVideoMode
This is important :
The framebuffer surface, or NULL if it fails. The surface returned is
freed by SDL_Quit and should not be freed by the caller. Note: This rule
includes consecutive calls to SDL_SetVideoMode (i.e. resize or rez change)
- the pre-existing surface will be released automatically.
CU
Thank you for responding;
I believe I’ve found my solution is SDL_gfx, it being zoomSurface().
Thank you for the help.
- NeilOn 23:46 Wed 16 Aug , Torsten Giebl wrote:
Hello !
How would I go about resizing the main SDL_Surface?
I’ve tried the following, but with no success:
int ResizeSurface(SDL_Surface * surface, Uint32 flags, Uint32 width,
Uint32 height, Uint16 depth) {
SDL_FreeSurface(surface);
surface = SDL_SetVideoMode(width, height, depth, flags); if(!surface) {
fprintf(stderr, “Unable to set video: %s\n”, SDL_GetError()); return -1; }
return 0; }
Look here :
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fSetVideoMode
This is important :
The framebuffer surface, or NULL if it fails. The surface returned is
freed by SDL_Quit and should not be freed by the caller. Note: This rule
includes consecutive calls to SDL_SetVideoMode (i.e. resize or rez change)
- the pre-existing surface will be released automatically.
CU
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Neil Hodges <kenji.malist at gmail.com> wrote:
I believe I’ve found my solution is SDL_gfx, it being zoomSurface().
hmpf, surly not. zoomSurface is meant to resize a SDL surface but NOT
the screen surface. maybe you completely mixed up the purpose of
SDL_SetViedoMode() and SDL_CreateRGBSurface() ?
clemens