Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edits to CardView.m Card.m and GameView.m for Mavericks #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Card.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ @implementation Card
// Overridden methods
//


- (NSUInteger) hash
//- (unsigned) hash
{
// Suit ranges from 0 to 3; rank ranges from 1 (ACE) to 13 (KING).
// This therefore returns a unique number between 0 and 51.
Expand Down
15 changes: 9 additions & 6 deletions CardView.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ - (void) drawBlanks
cardSize.width, cardSize.height);

[blank lockFocus];
[bonded compositeToPoint: NSMakePoint(0, 0)
[bonded drawAtPoint: NSMakePoint(0, 0)
fromRect: source
operation: NSCompositeCopy];
operation: NSCompositeCopy
fraction: 1.0 ];
[blank unlockFocus];

// Selected blank (for placeholders and compositing selected cards)
Expand All @@ -73,9 +74,10 @@ - (void) drawBlanks
cardSize.width, cardSize.height);

[selectedBlank lockFocus];
[bonded compositeToPoint: NSMakePoint(0, 0)
[bonded drawAtPoint: NSMakePoint(0, 0)
fromRect: source
operation: NSCompositeCopy];
operation: NSCompositeCopy
fraction: 1.0];
[selectedBlank unlockFocus];
}

Expand All @@ -100,9 +102,10 @@ - (void) drawCards
cardSize.width, cardSize.height);

[card lockFocus];
[bonded compositeToPoint: NSMakePoint(0, 0)
[bonded drawAtPoint: NSMakePoint(0, 0)
fromRect: source
operation: NSCompositeCopy];
operation: NSCompositeCopy
fraction: 1.0];
[card unlockFocus];

[dict setObject: card forKey: [Card cardWithSuit: i rank: j]];
Expand Down
11 changes: 10 additions & 1 deletion Freecell.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastUpgradeCheck = 0620;
};
buildConfigurationList = F29D0D27158CDFEE0050A6FA /* Build configuration list for PBXProject "Freecell" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -456,9 +456,12 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "Info-Freecell.plist";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = Freecell;
SDKROOT = macosx10.10;
SECTORDER_FLAGS = "";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
Expand All @@ -485,9 +488,12 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "Info-Freecell.plist";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = Freecell;
SDKROOT = macosx10.10;
SECTORDER_FLAGS = "";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
Expand All @@ -513,9 +519,12 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "Info-Freecell__Upgraded_.plist";
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = Freecell;
SDKROOT = macosx10.10;
SECTORDER_FLAGS = "";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
Expand Down
4 changes: 2 additions & 2 deletions Freecell_Prefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// 1. Redistribution of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// 2. Redistribution in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
Expand Down
28 changes: 18 additions & 10 deletions GameView.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ - (void) drawRect: (NSRect) rect
else
operation = NSCompositeSourceOver;

[image compositeToPoint: origin
operation: operation
fraction: card == nil? 0.5 : 1.0 ];
//[image compositeToPoint: origin
// operation: operation
// fraction: card == nil? 0.5 : 1.0 ];
[ image drawAtPoint: origin fromRect: frame operation: operation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s probably better to send fromRect: an NSZeroRect. From the documentation:

If you pass in NSZeroRect, the entire image is drawn.

fraction: card == nil ? 0.5 : 1.0 ];
}

for (i = 0; i < NUMBER_OF_STACKS; i++)
Expand All @@ -119,10 +121,12 @@ - (void) drawRect: (NSRect) rect
else
operation = NSCompositeSourceOver;

[image compositeToPoint: origin
operation: operation
fraction: card == nil? 0.25 : 1.0 ];
}
//[image compositeToPoint: origin
// operation: operation
// fraction: card == nil? 0.25 : 1.0 ];
[ image drawAtPoint: origin fromRect: frame operation: operation
fraction: card == nil ? 0.25 : 1.0 ];
}

for (i = 0; i < NUMBER_OF_COLUMNS; i++)
{
Expand All @@ -143,8 +147,10 @@ - (void) drawRect: (NSRect) rect
frame.size.height - edgeMargin
- (cardHeight + margin) * 2 - o * row);
NSImage *image = [cardView imageForCard: card selected: [game isCardSelected: card]];
[image compositeToPoint: origin operation: NSCompositeSourceOver];
}
//[image compositeToPoint: origin operation: NSCompositeSourceOver];
[ image drawAtPoint: origin fromRect: frame operation: NSCompositeSourceOver
fraction: 1.0 ];
}

// If the column is empty and selected, draw the selected image
if (row == 0 && [game isTableLocationSelected: [TableLocation locationWithType: COLUMN number: i]])
Expand All @@ -153,7 +159,9 @@ - (void) drawRect: (NSRect) rect
frame.size.height - edgeMargin
- (cardHeight + margin) * 2);
NSImage *image = [cardView imageForCard: nil selected: YES];
[image compositeToPoint: origin operation: NSCompositePlusDarker fraction: 0.5];
//[image compositeToPoint: origin operation: NSCompositePlusDarker fraction: 0.5];
[ image drawAtPoint: origin fromRect: frame operation: NSCompositePlusDarker
fraction: 0.5 ];
}
}
}
Expand Down