gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: freecell.app


From: Josh Freeman
Subject: Re: freecell.app
Date: Thu, 5 Oct 2017 19:46:48 -0400

Hi Gürkan,

On Oct 5, 2017, at 2:59 PM, Germán A. Arias wrote:

Hi,

El jue, 05-10-2017 a las 17:53 +0200, Gürkan Myczko escribió:
Hello

I was able to write a GNUmakefile to build Freecell.app for macOS,
however I'm missing
a link. Something with first responder maybe, or something in the
GNUmakefile?

Any help or tip is welcome.

https://github.com/alexmyczko/Freecell.app

Thanks,

Change your Makefile to look like this:

Freecell_LOCALIZED_RESOURCE_FILES=\
        MainMenu.nib\
        Credits.html\


Thanks for porting Freecell, and thanks Germán for the fix. After changing the Makefile & rebuilding, Freecell seems to run fine, though there's a cosmetic issue while playing the game:

On a Mac build, the selected (last-clicked) card is drawn darker than the other cards. On GNUstep, however, the selected card vanishes, and stays hidden until you click elsewhere (deselecting the card), then the card reappears.

Turns out this is due to a bug in GNUstep GUI: If you have an NSImage that contains only non-cached image representations (such as an image that's just been created or loaded, but hasn't been used in a drawing operation yet), calling -[NSImage copy] on that image will return an empty image rather than a copy.

This is because GNUstep's -[NSImage copyWithZone:] ignores non- cached image representations - only cached reps are moved to the copy. This is intentional, as there's a comment in the code saying to do this, however, it doesn't mention why. Does someone know the reason? (As a further note on -[NSImage copyWithZone:], the rep objects it attaches to the copied image should probably be copies themselves rather than the original's rep objects, otherwise you could lock focus on the copied image, draw onto it, and the original image would also be overwritten due to both images sharing the cached rep that was the draw target).

Freecell draws selected cards using a set of darkened images that are initialized by copying the corresponding normal (non-selected) card's image, so the selected-card images all end up empty & invisible.

Attached is a patch for Freecell.app that fixes the card-hiding issue by setting up the selected-card images without -[NSImage copy]. The patch modifies only CardView.m - it assumes your GNUmakefile already has Germán's change.

Cheers,

Josh


Attachment: Freecell_selection_fix.patch
Description: Binary data





reply via email to

[Prev in Thread] Current Thread [Next in Thread]