This is legit weird. I just tried it too. Cast to double first should work, but you tried that (and I tried it too).
Very oddly, if I change “unsigned long” to just “long”, it works.
Are you including #stdio.h and not just getting an automatically generated prototype for printf? I assume...
True, but if you just want the deepest pixel-depth device you can simply skip all that and call GetMaxDevice(). That’s exactly what it’s for.
To elaborate a bit:
1. If you want to know the main device’s current color depth, check (**(**MainDevice).gdPMap).pixelSize as I said above.
2. If you...
Yep, though you are answering a different question @eric, namely “does this system support Color QuickDraw.”
The answer to that question will be “yes” in many cases (e.g., an SE/30 with no external display) where there is currently no capacity to actually display color. For that, you need...
How is what you are looking for different from this?
https://github.com/elliotnunn/mac-rom/blob/72f4af952310df94362d70d1e0259aef65ab814f/OS/StartMgr/StartInit.a
You mean in code right? 😀
If you want to know if it’s possible to get colors, use HasDepth(MainDevice, …) (or you could loop thru all the devices with GetNextDevice and check them all).
If you want to know if it’s currently showing colors, check (**(**MainDevice).gdPMap).pixelSize > 1.
Are you using 16-bit ints? If you are using 16-bit ints, this will easily overflow:
colPix.red = (int)((float)colModel.red * dpLight);
since colModel.red is an unsigned int (if more than 50% pure red, > 32767) which, when casting to a float, is still > 32767. If you are then (say) multiply...
Right.
@pfuentes69 : the clock() function in time.h is just calling TickCount(), FYI (THINK C includes all sources for the standard library so you can check this yourself in time.c: the definition is literally “clock_t clock(void) {return TickCount();}”). So you would get the same result...
clock_t is defined as unsigned long in time.h, but (pretty sure this is the issue) you are telling printf to display it as a signed short (‘%d’).
Try changing the printf format specifier to ‘%lu’
Are people actually claiming AirTalk results in slow printing? Cheesestraws indeed stated that AirTalk is slower than wired LocalTalk, but if you’re printing to an ImageWriter II the print speed ends up being like 1000x slower than the speed for network traffic so I would be surprised if print...
Right. If you want to get fancy, you can do a MacPaint-style “marching ants” marquee rectangle (instead of a Finder-style static-pattern rectangle) by xor’ing a sequence of striped patterns sequentially shifted by one pixel on a timer. One of the Scott Knaster books includes example code for...
That’s what text looked like on a real Apple II. Green and purple tinges on the edges. I never knew why, would love an explanation of that, but I always assumed the IIe Card was just trying to replicate the full experience!
Huh, I probably stand corrected, I thought SystemTask checked for an FKEY press (for a screenshot) but looks like you need GetNextEvent or WaitNextEvent for that. Thanks for making me check myself.
Your snip is totally fine except I think you should really pass a pointer to an EventRecord in...
BlockMoveData() was added in the ‘90s … it guarantees that the bytes being moved don’t contain any code so obviates the need for instruction cache flushing etc. and improves performance on 030/040 and perhaps PPC processors. It’s documented in (I think) the mid-90s version of “Inside Macintosh...
Yes - or just call SystemTask(), which yields time to the system if you don’t care about getting an event (or, in an older app/pre-MultiFinder system, where you call _GetNextEvent instead _WaitNextEvent).
You can of course include math.h (or is it stdlib.h?) and call abs() as long as you have included the ANSI library in your project. Not including/calling abs() is not because it’s difficult, it’s just an optimization to save memory and skip function call overhead.
I would typically just do...
Continuing the sidebar, the history of StuffIt as a format that kept changing silently under the hood with no visibility, no changes in file extension, and no backward compatibility was frustrating in the ‘90s and remains very frustrating for vintage hobbyists.
In the ‘90s, the answer was to...