• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A couple questions relevant to games
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A couple questions relevant to games


  • Subject: Re: A couple questions relevant to games
  • From: Aaron MacDonald <email@hidden>
  • Date: Sun, 17 Feb 2008 23:20:26 -0400

On 17-Feb-08, at 1:21 PM, j o a r wrote:
In Cocoa you would typically use a NSTabView (with the actual tabs hidden) for this purpose. Or, alternatively, you would just insert / remove subviews manually from your root view.

Thanks. The tabless option for NSTabView is exactly what I needed.

In IB you set the default size & position for your views, but you can always change them at runtime.

With regards to your concerns about keeping square proportions, take a look at "-[NSWindow setResizeIncrements:]", or alternatively "- [NSWindow(Delegate) windowWillResize:toSize:]".

Are you sure? I only want to control the resizing of the tile view (that's what I'll call it) itself.


This is what I've tried so far. I have a function bestRect() that takes an NSRect and the desired grid dimensions and returns a trimmed NSRect. I use this in initWithFrame, and have also tried this in setFrame to handle resizing.

----------

- (id) initWithFrame: (NSRect) frame
{
    self = [super initWithFrame: bestRect(frame, 15, 10) ];

    if (self)
    {
        gridWidth = 15;
        gridHeight = 10;
    }

    return self;
}

- (void) setFrame: (NSRect) frameRect
{
    [super setFrame: bestRect(frameRect, gridWidth, gridHeight) ];
}

----------

This works when the window is first shown, but it doesn't handle resizing well. When I have it set to not expand and I shrink the window to smaller than the tile view's initial size, its tiles get squished out of proportion (so far I'm trying to get square tiles).

There's also the issue of the grid dimensions been magic numbers. I want an initialization method where I provide the grid width, grid height, and tile size. It's just that I can't see where I'd be able to call that since it appears I can only access my tile view through Interface Builder. This is especially troublesome if I want to have more than one tile view, such where I have a main view screen and a mini-map.

Thank you,

Aaron J. M.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: A couple questions relevant to games
      • From: Jens Alfke <email@hidden>
    • Re: A couple questions relevant to games
      • From: j o a r <email@hidden>
References: 
 >A couple questions relevant to games (From: Aaron MacDonald <email@hidden>)
 >Re: A couple questions relevant to games (From: j o a r <email@hidden>)

  • Prev by Date: Re: Where to enforce paragraph-cohesion policy in text system?
  • Next by Date: Re: A couple questions relevant to games
  • Previous by thread: Re: A couple questions relevant to games
  • Next by thread: Re: A couple questions relevant to games
  • Index(es):
    • Date
    • Thread