Thread: sdl screen resize and redraw problem

  1. #1
    Registered User
    Join Date
    Aug 2006

    sdl screen resize and redraw problem

    I have written a program to draw the mandelbrot set .. again ..

    the first time I used a zoom that left the size of the sdl screen the same and it works fine ..

    this time I wanted to be able to use two mousebutton clicks high left to low right and have the screen redrawn to those dimensions. I use a multiplier so the screen stays a relative size.

    the program works fine when it first draws the set but when I use two mousebutton events to zoom into the set it redraws the screen ok but no set.

    I put in lots of printf statements to try and find out where the code was faiiling but as far as I can tell it should be working ..

    I have the code and a trial run results at so if someone can spot what I have done wrong I would appreciate it.

    again all comments welcome .. Im in a learning phase so its all good ..

    thanks al.

  2. #2
    Registered User
    Join Date
    Aug 2006

    yay!!! it works

    found out where I was going wrong ..

    three seperate areas .. fixed them and its fine now ..

    the first was using SDL_UpdateRect( screen,0,0,p->xs,p->ys ); instead of
    SDL_UpdateRect( screen,0,0,p->xsx,p->ysy ); which meant I was always using the orignal screen size when updating the screen.

    the second was the offsets used when drawing the mandelbrot set .. the set itself was offscreen due to the offsets being in the wrong place so I was getting a completly red screen.

    and the third was trying to use ints a b c d in the structure to find out the image size which is a double .. after I added some doubles in the sruct .. fixing the offsets and changing the SDL_UpdateRect screen it works a charm.

    all I want to do now is add more colors ..

    the working code is at for anyone who wants a play with it

    thanks for anyone who has had a look at the code ..


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. mousebutton event sdl
    By mad_muppet in forum Game Programming
    Replies: 7
    Last Post: 08-09-2008, 02:11 AM
  2. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM