SDL screen resolution April 07, 2009 08:45PM | Registered: 15 years ago Posts: 74 |
Re: SDL screen resolution April 07, 2009 09:03PM | Registered: 15 years ago Posts: 703 |
SDL_Rect dr = {0,0,640,480}; SDL_Rect sr = {0,0,480,480}; dr.x = (int)(sr.w - dr.w) / 2; dr.y = (int)(sr.h - dr.h) / 2; SDL_SoftStretch(backbuffer,&sr,screen,&dr);
Re: SDL screen resolution April 08, 2009 07:22AM | Registered: 16 years ago Posts: 265 |
Re: SDL screen resolution April 08, 2009 09:25AM | Registered: 15 years ago Posts: 74 |
Re: SDL screen resolution April 08, 2009 07:16PM | Registered: 15 years ago Posts: 703 |
Re: SDL screen resolution April 12, 2009 11:28PM | Registered: 15 years ago Posts: 74 |
void draw (SDL_Surface *screen) { SDL_Rect dr; SDL_Rect sr; sr.x=0; sr.y=0; sr.h=480; sr.w=480; dr.h=480; dr.w=640; dr.x = (int)(sr.w - dr.w) / 2; dr.y = (int)(sr.h - dr.h) / 2; SDL_Surface *backbuffer = SDL_SetVideoMode( 640, 480, 8, SDL_FULLSCREEN); while (!done) { //Logic & blit on screen surface ... SDL_SoftStretch(screen,&sr,backbuffer,&dr); SDL_Flip(backbuffer); }
Re: SDL screen resolution April 13, 2009 02:02AM | Registered: 15 years ago Posts: 73 |
Re: SDL screen resolution April 13, 2009 11:10AM | Registered: 15 years ago Posts: 74 |
Re: SDL screen resolution April 13, 2009 04:00PM | Registered: 15 years ago Posts: 74 |
screen = SDL_SetVideoMode( 640, 480, 8, SDL_HWSURFACE);
SDL_Surface* backbuffer = SDL_DisplayFormat(screen); SDL_Rect srcrect = {0,0,480,480}; //the part of the screen to be stretched, must be sup 0 and inf screen surface Height and Width SDL_Rect dstrect = {0,0,640,480}; //equals screen resolution
SDL_SoftStretch(backbuffer,&srcrect,screen,&dstrect); SDL_Flip(screen);
#ifndef GLOBALS_H #define GLOBALS_H #include <SDL/SDL.h> SDL_Surface* backbuffer; #define SDL_GetBufferSurface() backbuffer #endif