• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Help getting started with retro software development

nightingale

Well-known member
So update, I got colour offscreens working using... GWorlds! I messed about with my code a bit more and just couldn't get it to work properly. Even setting the high bit of rowBytes didn't seem to get the desired results. So I gave up and implemented it using GWorlds, and wow, they really are simple. That was a fantastic improvement by Apple.

At this point, I'll do some testing and see if it's even worth implementing a non-GWorld solution.

Right now, my program is just checking whether the system is using original QuickDraw or Colour QuickDraw, and if it's the latter, then it assumes a colour offscreen and uses GWorld for the offscreen. This is problematic because the performance is way worse than just using a B&W GrafPort, which surprised me. My SE/30, for example, which only has 1-bit graphics uses a GWorld because it's running System 7.5.5, and the game is unplayable. I thought the under-the-hood mechanics of how it draws offscreen with GWorlds was essentially the same as creating and drawing to your own GrafPort, it was just doing all the work of setting it up for you. But perhaps it's an entirely different concept. I am limiting my GWorld to 4-bit colour depth (my colour tiles only use 16 colours) but it still seems to really bog down.

Anyway, I wanted to add a check to see whether the screen actually supports 4-bit depth, and if it doesn't, then it would just use my B&W GrafPort offscreen even if GWorlds were available. But when I try to call HasDepth(), Think C tells me it needs a prototype. Is there some library I need to add to make use of HasDepth? I can't seem to find it in any of the header files that come with Think C. I've come across a few calls that don't seem to work. I'm using Think C 5.0 -- maybe these routines were not implemented when this was released? I struggle sometimes trying to match up my development environment with documentation that was written in the same era...

Although I'm not really sure if HasDepth() is the solution I need anyway. I think I'm less interested in whether the screen supports 4-bit than I am in whether the screen is set to 4-bit colour or greater. If there are going to be performance issues on slower machines, I'd like people to be able to set the monitors control panel to B&W and get my more efficient drawing routines, but HasDepth() would still report the screen as being capable of 4-bit depth, I think.

On an interesting side note, I have been using my B&W tiles for so long, that when I started adding colour, I don't like it as much! I'll try to make the colour tiles as beautiful as I can, but I think I prefer playing in B&W...
 

Crutch

Well-known member
HasDepth is in <Palettes.h> and should definitely be available in THINK C 5. (THINK Reference can tell you this right up at the top of each Toolbox call’s entry. Definitely use THINK Reference if you aren’t already!)

GWorlds are just a way to do the setup and tear down — in between you are using CopyBits to actually do the time consuming grunt work. CopyBits is CopyBits and doesn’t care if you are copying from a GWorld or not, so using GWorlds shouldn’t slow it down at all. However copying a 4-bit image is definitely (about) 400% as slow as copying a 1-bit image. So yes, checking for current use of color is the way to go.

You can do this most easily by looking at (**(**GetMainDevice()).gdPMap).pixelSize, which gives you the current main screen depth in bits per pixel. If you want to worry about people using multiple screens with different depths, well …. My advice is, don’t. 😊 That’s not fun, and a we’re all just in it to have fun at this point …
 

nightingale

Well-known member
I don't know what I'd do without you. Pallets.h! Of course!

I really don't know how I made it this far without realizing the value of THINK Reference. The THINK disk I have had a demo of THINK Reference, but it was obviously quite limited and not useful. I was so focused on reading books that I never thought to go look for the full version of it. And now that I look at it, I see it contains the answers to so many questions I've had...

It had occurred to me that I could look at the pixelSize field of the pixmap, but in other instances Inside Mac told me not to examine such fields, and use certain toolbox calls instead... So I never really bothered trying. I'll give it a whirl and see if it solves my problem...

That makes sense that my SE/30 is slow simply because it's copying 4x the data. I had assumed that the drawing was what was slowing it down, but the copying makes more sense.

Thanks again!
 

LelandLong

Active member
It's been 28 months since the last update to this thread.
I've just enjoyed reading through it's entirety and have enjoyed it.
Is there any continuation of this topic and author on another thread?
Or did it die on the vine right here? Hope not.....
 

Phipli

Well-known member
It's been 28 months since the last update to this thread.
I've just enjoyed reading through it's entirety and have enjoyed it.
Is there any continuation of this topic and author on another thread?
Or did it die on the vine right here? Hope not.....
There is this :

 

nightingale

Well-known member
Definitely did not die on the vine! This thread was more about the learning process, getting started coding, learning the tricks for programming for the Macintosh. The users of this forum were invaluable, but I got to the point where I had the tools and resources I needed to solve my own problems, so that's why I haven't been back to this thread in 22 months! I can't believe it's been that long...

The other thread that Phipli linked to is the topic which announced the game, and the Kickstarter that I ran to fund a physical production of the game. I am still on track to release the final version of the game next month, and will be sure to update the other thread when that happens, along with a download to the shareware version of the game.

I'm glad you enjoyed reading through my learning journey!
 
Top