Quick Pixel-double hack?

I’m making a small desktop game, and I’ve been told by testers that on
high res monitors it is so small that is a strain on the eyes, and they
want a pixel doubled mode.

I’ve already coded most of the game around the 300x500 window size, so
it would be a bit tricky to change now.

Is there a quick hack I could use to turn the window into a 600x1000
pixel doubled one? Or a semi-quick one where I’d only have to change a
few things? I wouldn’t mind find and replacing a load of numbers in my
code and replacing them with constants if necessary.

Thanks!
–Joseph

El S?bado, 13 de Septiembre de 2003 13:18, Joseph Humfrey escribi?:

Is there a quick hack I could use to turn the window into a 600x1000
pixel doubled one? Or a semi-quick one where I’d only have to change a
few things? I wouldn’t mind find and replacing a load of numbers in my
code and replacing them with constants if necessary.

I guess you haven't encapsulated SDL behind any type of "video module" or so.
The right way to do it is not using directly in your code calls to SDL 

routines, but encapsulating them in functions like startVideo(), putPixel()
and such. This way, you would only need to change this functions behaviour in
order to achieve changes like the one you are willing to do.–
Pablo Brasero
http://www.pablobm.com
mailto:pablo.brasero at hispalinux.es
jabber:otnirebal at jabber.sk
Usuario registrado de Linux n?mero 286.361

Joseph Humfrey wrote:

I’m making a small desktop game, and I’ve been told by testers that on
high res monitors it is so small that is a strain on the eyes, and
they want a pixel doubled mode.

I’ve already coded most of the game around the 300x500 window size, so
it would be a bit tricky to change now.

Is there a quick hack I could use to turn the window into a 600x1000
pixel doubled one? Or a semi-quick one where I’d only have to change a
few things? I wouldn’t mind find and replacing a load of numbers in my
code and replacing them with constants if necessary.

You could use glSDL for this. It has a “scaling” option that stretches
the video buffer using OpenGL (using nice texture filtering) :
http://olofson.net/mixed.html

If you don’t want OpenGL, the second quickest solution I can think of is
to modify SDL to :

  • always create a shadow surface
  • create a video surface twice the width/height of the shadow surface
  • write a special copy routine that doubles every pixel while copying
    the shadow surface to the video surface

Or do one of those two as a complete SDL video backend.

Stephane