I would recommend Programming Windows, but if your not into books there are a few windows tutorials online. Just search "Windows api tutorials" in google and you will get some hits. It will be very difficult at first but it gets easier later.
Printable View
I would recommend Programming Windows, but if your not into books there are a few windows tutorials online. Just search "Windows api tutorials" in google and you will get some hits. It will be very difficult at first but it gets easier later.
Charles Petzold's "Programming Windows" is by far the best book - even if it's a few years old now, it's still applies to 99.9% of the stuff it describes.
As to how to draw a circle, you can use sin/cos to find the coordinates for X,Y at a certain angle. x = cos(angle) * radius, y = sin(angle) * radius. Obviously, you'll also have to add the offset of the center-point. [You can half or quarter the number of points you have to calculate by using reflections and only draw the 90/180 degrees + the opposites].
For a much faster (but slightly more complex) circle drawing mechanism, look up Brezenhem's circle algorithm - it only uses simple add, subtract and I think there is one division at the beginning. Again, you can use reflections to draw more points at once.
--
Mats
Thank you both I'll try [=
I succssed creating this function but it's very slow I can see every single pixel drawing \:
any ideas? (the accurate is 3 digits after the point)
So, what are you doing?
And yes, SetPixel in itself isn't very fast. Sin and Cos are probably the slowest instructions in the x86 FPU instruction set - and the C library version of sin/cos may be slower yet if the compiler uses discrete instructions (like gcc does if you don't use -ffast-math), and even slower yet if you use debug version of the code.
--
Mats
What do you think? the circle function.. XD
The algorithem you mentioned above might be faster?