Spinning Roulette Wheel
-
Not entirely on-topic, but... I can't stand games that waste time doing crap like that. Just randomize the number already! I'll always remember that the Amstrad that my father bought (mid-80s) had a Wheel Of Fortune game installed, but the clock was much slower than the developers had intended -- waiting for the wheel to stop spinning was horrible. What I recommend is randomizing a number and displaying just that number. Do it a few (10?) times so the user sees the numbers flashing. That's what I do for a dice game I wrote; it's much quicker and easier.
PIEBALDconsult wrote:
I can't stand games that waste time doing crap like that.
Maybee. I do see where your comming from, but the idea is to design a realistic and working mini roulette game, so the spinning wheel is a real big part of it. Also, this is just a fun app, and a doubt many other people will use it. The main idea for this is a learning curve for a beginner, and not so much the spinning wheel, but the fact that I can learn how to spin the wheel realisticaly, which may be usefull for other stuff. but thank you for your point of view! Steve
-
Yes, WPF makes things like that considerably easier. No concern though. First thing to do is rotate the image, which is presumably represented as a bitmap in code. Get to the graphics object, and that's got two methods TranslateTransform and RotateTransform (as I recall) which should do the rotation. If everything's perfectly circular you may not need the translate transform. Then, create a method which rotates the image as needed. I'd probably create a custom control for just this purpose. You'll have to use the System.Windows.Forms timer to update the angle in such a way to make it look like real movement.
Regards, Rob Philpott.
Rob Philpott wrote:
Yes, WPF makes things like that considerably easier.
I am excited to get started with WPF, however, I think I should get through my "Head First C#" Book first, and learn C# properly. I will look into what you have sugested, and see if I can get something going. Thank you for the sugestion, Regards, Stephen
-
38 in the U.S. -- 00 .
-
Hi, I was just woundering if anyone knows how I would do this... I have an image of a roulette wheel, and I would like to animate it as it was spinning, faster to slower and then stop. How would I achive this using c# and winforms, as I am not ready to delve into WPF just yet? Thank you, Kind Regards, Steve
You should just bite the bullet and learn WPF. Doing this in, well, GDI/GDI+ is the correct term here since Winforms has nothing to do with your question, will require you to worry about such silly things as multi-threading, timers, double buffering, geometry, etc and you'll have to write a lot of code. In WPF, you just attach an animation that animates the rotation angle from 0 to 360 degrees and you're done. 5 minute job max. ZERO code as it can all be done with one line of XAML.
-
You should just bite the bullet and learn WPF. Doing this in, well, GDI/GDI+ is the correct term here since Winforms has nothing to do with your question, will require you to worry about such silly things as multi-threading, timers, double buffering, geometry, etc and you'll have to write a lot of code. In WPF, you just attach an animation that animates the rotation angle from 0 to 360 degrees and you're done. 5 minute job max. ZERO code as it can all be done with one line of XAML.
SledgeHammer01 wrote:
You should just bite the bullet and learn WPF.
What? While learning C#?
SledgeHammer01 wrote:
one line of XAML.
Could you show one line that does this? Either way, I am starting to lean toward the idea of WPF. Thank you, Steve
-
SledgeHammer01 wrote:
You should just bite the bullet and learn WPF.
What? While learning C#?
SledgeHammer01 wrote:
one line of XAML.
Could you show one line that does this? Either way, I am starting to lean toward the idea of WPF. Thank you, Steve
See DoubleAnimation http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation.aspx[^]. Ok, its a little more then one line :), but here is an easy example of animating the rotation transform http://www.galasoft.ch/mydotnet/articles/article-2006102701.aspx[^]
-
PIEBALDconsult wrote:
38 in the U.S. -- 00 .
0 for the casino. 00 for the government? :confused: ;)
Heck no, the guv'mint takes more than that.
-
See DoubleAnimation http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation.aspx[^]. Ok, its a little more then one line :), but here is an easy example of animating the rotation transform http://www.galasoft.ch/mydotnet/articles/article-2006102701.aspx[^]
Thank you, That has gave me something to look over the weekend. Regards, Stephen
-
Hi, I was just woundering if anyone knows how I would do this... I have an image of a roulette wheel, and I would like to animate it as it was spinning, faster to slower and then stop. How would I achive this using c# and winforms, as I am not ready to delve into WPF just yet? Thank you, Kind Regards, Steve
For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
-
For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
Alan Balkany wrote:
For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
This sounds like a very interesting idea, however, I would not have a clue where to start by doing this. Would you possibly be able to provide a little more information please? Thank you, Regards, Stephen
-
Alan Balkany wrote:
For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
This sounds like a very interesting idea, however, I would not have a clue where to start by doing this. Would you possibly be able to provide a little more information please? Thank you, Regards, Stephen
This http://www.blackpawn.com/texts/blur/default.html[^] gives basic blurring algorithms, but they're rectangle-oriented, and you need to adapt them for rotation. So, instead of averaging in a rectangular region for each pixel, you'd use an arc representing a fraction of the roulette wheel's rotation, at the pixel's distance from the center +/- a delta constant.
-
This http://www.blackpawn.com/texts/blur/default.html[^] gives basic blurring algorithms, but they're rectangle-oriented, and you need to adapt them for rotation. So, instead of averaging in a rectangular region for each pixel, you'd use an arc representing a fraction of the roulette wheel's rotation, at the pixel's distance from the center +/- a delta constant.
Thank you, I will look into this. Regards, Stephen