Doing timing benchmarks on graphical operations (DrawPicture, CopyBits, MoveBlock, etc) is stumping me right now.
I don't particularly like converting long values to Str255 and moving about the pen to DrawString all my result information across zillions of tiny Str255 fragments, alternating between regular text and converted-to-text values.
I like using the much simpler printf just to get a quick value on screen. Not to mention, I can query values with scanf far more simply than devoting a whole new dialog or textedit box. This is not for a full-fledged app, just a simple benchmarking tool.
However, the thing I'm not sure about is how an ANSI THINK C project deals with windows. I can't add both libraries to the same default Segment 2 (ANSI and MacTraps) because they're too big together. No problem, I put MacTraps in segment 3. The problem lies in that an ANSI project deals with its own GrafPtr in order to display stuff in the default window it creates under curtains for me. I can use FillRect to get some graphics going inside that window, without having to call my own MacTrap-like usual functions like InitGraf and stuff. That's all fine and dandy and expected.
Things start to turn sour when I try to simply DrawPicture on the given window I get. It doesn't work. I tried several things to circumvent this problem:
-define my own secondary window with or without InitWindows() at the start
-try GetPort SetPort to make both things stay in their lanes (text for the ANSI text output and graphics for my own defined windowptr port)
I get either of these:
-Mac bomb system 3
-freeze at start
-just the ANSI text output and freeze while attempting to return to shell
Is there an elegant way to get the cake and eat it as well?
I don't particularly like converting long values to Str255 and moving about the pen to DrawString all my result information across zillions of tiny Str255 fragments, alternating between regular text and converted-to-text values.
I like using the much simpler printf just to get a quick value on screen. Not to mention, I can query values with scanf far more simply than devoting a whole new dialog or textedit box. This is not for a full-fledged app, just a simple benchmarking tool.
However, the thing I'm not sure about is how an ANSI THINK C project deals with windows. I can't add both libraries to the same default Segment 2 (ANSI and MacTraps) because they're too big together. No problem, I put MacTraps in segment 3. The problem lies in that an ANSI project deals with its own GrafPtr in order to display stuff in the default window it creates under curtains for me. I can use FillRect to get some graphics going inside that window, without having to call my own MacTrap-like usual functions like InitGraf and stuff. That's all fine and dandy and expected.
Things start to turn sour when I try to simply DrawPicture on the given window I get. It doesn't work. I tried several things to circumvent this problem:
-define my own secondary window with or without InitWindows() at the start
-try GetPort SetPort to make both things stay in their lanes (text for the ANSI text output and graphics for my own defined windowptr port)
I get either of these:
-Mac bomb system 3
-freeze at start
-just the ANSI text output and freeze while attempting to return to shell
Is there an elegant way to get the cake and eat it as well?