Changeset 911


Ignore:
Timestamp:
Sep 25, 2006, 1:11:32 AM (15 years ago)
Author:
livings124
Message:

better box sizing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/nat-traversal/PiecesWindowController.m

    r910 r911  
    99#import "PiecesWindowController.h"
    1010
    11 #define MIN_WIDTH 4.0
    1211#define MAX_ACROSS 18
     12#define BETWEEN 1.0
    1313
    1414#define BLANK -99
     
    114114    //determine how many boxes
    115115    int across = MAX_ACROSS;
    116     float width = MIN_WIDTH, between;
    117     while (numPieces <= (across / 2) * (across / 2))
    118     {
    119         across /= 2;
    120         width *= 2.0;
    121     }
    122     between = ([fExistingImage size].width - (float)across * width) / (float)(across + 1);
     116    while (numPieces <= (across - 1) * (across - 1))
     117        across -= 1;
     118   
     119    float width = ([fExistingImage size].width - (float)((across + 1) * BETWEEN)) / (float)across;
    123120   
    124121    int8_t * pieces = malloc(numPieces);
     
    190187                }
    191188               
    192                 point = NSMakePoint((float)j * (width + between) + between, (float)(across - i) * (width + between) - width);
     189                point = NSMakePoint((float)j * (width + BETWEEN) + BETWEEN, (float)(across - i) * (width + BETWEEN) - width);
    193190                [pieceImage compositeToPoint: point fromRect: rect operation: NSCompositeSourceOver];
    194191            }
Note: See TracChangeset for help on using the changeset viewer.