Skip to content
Maarten Billemont edited this page Jun 23, 2011 · 10 revisions

Pearl

This is a companion library for iOS development.

It provides utilities for a range of tasks, including Cryptography, JSON REST Web Services, UIKit, and Cocos2D.

Status

Pearl is being actively developed as it provides the basis for the applications I write.

It was born from extracting generic components out of the Gorillas codebase and is currently being used by a range of applications including DeBlock, Task Assist and a few proprietary applications.

The Pearl API that exists is maturing and considered Beta-quality. New API is added every now and then.

Features

  • Abstract Application Delegate:
    Provides a good basis for your application delegate and works well with the Configuration framework. Also registers for notifications should you choose to enable support for that.
  • Configuration:
    A configuration singleton provides dead-easy NSUserDefaults-backed strongly typed property-based configuration. Extend a class, add properties to your header and @dynamic to your implementation, done.
  • Logging:
    Log events and messages at different levels, automatically recording the source code line that logged it. Obtain logs in code or output all above a certain level to the console.
  • Cryptography:
    Simple hashing, encrypting and decrypting of arbitrary data.
  • UIKit:
    Many UIKit utilities for things such as automatic UIScrollView content management and keyboard handling, validating text fields, laying out UIViews, scaling images, etc.
  • Web Services:
    JSON-based REST Web Service class to make web services trivial for you. Works best with JLibs’ JSONResult.
  • Objects:
    Lots of utilities for dealing with all sorts of objects such as strings, dates, datas, etc. Also includes macros for things like making vararg methods trivial to use, etc.
  • Audio:
    Configuration-based music manager and easy sound effects management.
  • Cocos2D Layers:
    Animating loading/aiming bar, Node scrolling (like UIScrollLayer), flicking and swiping, Automatic Menu/Configuration menu generation.
  • Cocos2D Actions:
    Modify arbitrary properties in combination with other cocos2d-iphone Actions such as Ease actions.

Cocos2D-iPhone

There are a few game development frameworks for iOS, and developers can also just use OpenGL/ES and the other low-level APIs directly.

Cocos2D-iPhone is the library I have chosen because it is very much alive, has a strong and growing community and provides in most all needs of basic and more advanced game development with a healthy and usable API.

Screenshots

These shots demonstrate Pearl features in the Deblock game.

Menu

Menus are built through a simple API. You mention the title strings, the callback to invoke when the user taps the menu item, and the item layout on screen. You can even specify a logo.

   self.pausedMenu = [MenuLayer menuWithDelegate:self logo:[MenuItemImage itemFromNormalImage:@"title.game.paused.png"
                                                                                 selectedImage:@"title.game.paused.png"]
                                            items:
                       [MenuItemFont itemFromString:l(@"menu.level.restart")
                                             target:self selector:@selector(levelRedo:)],
                       [MenuItemSpacer spacerSmall],
                       [MenuItemFont itemFromString:l(@"menu.main")
                                             target:self selector:@selector(stopGame:)],
                       [MenuItemFont itemFromString:l(@"menu.game.end")
                                             target:self selector:@selector(endGame:)],
                       nil];

Configuration Menu

This menu is built from a given set of properties defined in the Configuration backend.

   self.configMenu = [ConfigMenuLayer menuWithDelegate:self logo:nil
                                               settings:
                       @selector(music),
                       @selector(soundFx),
                       @selector(compete),
                       nil];

Scroll Layer

The following score list is built using a ScrollLayer. This allows the user to scroll through the list as though it’s a normal UIScrollView in a very intuitive way with the same fluent feel.

Flick Layer

This allows users to flick through a set of layers much the same way as the Scroll Layer works (it extends the Scroll Layer).