I'm writing a fractal generator that rasterizes the fractal through a certain amount of iterations, these iterations get more and more exact and take longer and longer to calculate... So this is what I want to do:
I want whenever an interrupt happens, like a keypress or mouse click anything that involves interaction from the user, for the program to STOP doing whatever function it is currently in, like calculating mathematics or printing to the screen, and idle as if the function was never called
E.g. When the program is in a loop calculating the mandelbrot set and you press a key I want that loop to stop and go to the user input function. I want this from any function within my program.
I looked into setting something up so whenever WndProc hears any messages that deal with keyboard input or mouse clicks then it will stop whatever loop it is in, but I just cant figure out how to do that! I would really like to stop the loops from within WndProc because it deals with all messages to the window that the fractal is being drawn upon.
If someone could please help me with this I'll be very very grateful!
Thank-you