1

I am attempting to animate a Roulette Wheel (European version) using the GDImage graphics library. The idea being instead of the whole wheel spinning, a chord (integer seg, segPositionAngle etc) runs around the wheel and stops on a random number.

However since changing

  FILE *jpgImageFile = NULL;

to

  FILE *animatedGIF;    
    animatedGIF = fopen( "animation.gif", "wb" );
    Roulette = gdImageCreate( IMAGE_WIDTH, IMAGE_HEIGHT );    
     gdImageGifAnimBegin( Roulette, animatedGIF, USE_GLOBAL_COLORMAP, DO_NOT_LOOP_ANIMATION); 
      for ( frameCounter = 0; frameCounter <= MAX_FRAMES_COUNT; frameCounter++ )
      {
        gdImageDestroy( Roulette );

and

    jpgImageFile = fopen( "RouletteImage.jpg", "wb" );
    gdImageJpeg( Roulette, jpgImageFile, -1 );
    fclose( jpgImageFile );
    gdImageDestroy( Roulette );

to

  gdImageGifAnimEnd( animatedGIF );
      fclose( animatedGIF );
      gdImageDestroy( Roulette ); 
        }

The program compiles and runs fine, but displays nothing. I have tried changing these parts around and have had no luck so far. Not sure about what the compiler is, as a browser based form is used to input the code that my lecturer uses. If anyone has any ideas on how to get the Roulette Wheel to display, that would be great.

  • 1
    What *exactly* is the problem? What have you tried? What do you expect to happen, and what happens instead? "Doesn't work" isn't really enough for us to help you, you know. – Frxstrem Apr 20 '14 at 01:06
  • Apologies, have edited the question. Hopefully its clearer :) – user3112393 Apr 20 '14 at 01:42
  • The typical thing one would ask about long code samples for a problem is: *"have you really pared down the example to the point that it demonstrates the minimal point where you became lost?"* Is your problem related to `++sliceCounter < 37`? If you can demonstrate something you expect to happen not happening *without* that, then why are you showing it to us? It would be worthwhile for you to read [Short, Self Contained, Correct Example](http://www.sscce.org/) and edit your question so that it is more in line with what that advises a "good" Internet question to look like...! – HostileFork says dont trust SE Apr 20 '14 at 01:56
  • +1 for editing down! But note the "compilable" aspect, and you are saying "displays nothing". Where is the line that would display anything? Is the real problem that you're not generating valid *files* that can be displayed with a preview program or a browser? Can you make a program others could test that show you producing a 10x10 all-red square but not an animated gif that has 10x10 all-red and then 10x10 all-blue? How short a program could you make to demonstrate a problem that others could compile without needing to modify, and precisely describe the failed condition? – HostileFork says dont trust SE Apr 20 '14 at 02:31

0 Answers0