ISRTO Protocol Reference

Conforms to NSObject
Declared in ISRTO.h

Overview

Protocol used to represent the beahviour of an RTO (rendering and touch).

Warning: In order to create an RTO with bitmaps, Cocos2d needs to be initialized, otherwise the application will crash.

Warning: In order to use Cocos2d and your own RTO (add to the current CCLayer), you will need to give it a unique identifier which you can get by calling [ISMapView generateCocos2dUniqueId].

General

  rtoId required method

A RTO unique identifier for the current class.

@property (nonatomic, readonly) int rtoId

Declared In

ISRTO.h

  zonePoi required method

Related zone association (could be nil).

@property (nonatomic, retain) ISZonePoi *zonePoi

Declared In

ISRTO.h

  mapId required method

RTO related map identifier (@see ISERTOMapId for general).

@property (nonatomic, readonly) int mapId

Declared In

ISRTO.h

– cloneRTO required method

Method called to clone an RTO (used when adding an RTO in several zones).

- (id<ISRTO>)cloneRTO

Return Value

The result cloned RTO.

Declared In

ISRTO.h

– setDisplayEnabled: required method

Method called show or hide an RTO.

- (void)setDisplayEnabled:(Boolean)displayEnabled

Parameters

displayEnabled

YES for a visible RTO, otherwise NO.

Declared In

ISRTO.h

Render 2D

– render2DWithLayer:andRatio:andOffset:andAngle:andPriority: required method

Method called to draw an RTO with a ratio and an offset. To obtain object position on screen, do (object_position_in_meter.x * aRatio + aOffset.x AND aOffset.y - object_position_in_meter.x * aRatio). If this object has no position (ie: ISRTO is put in a zone), simply draw it at aOffset.

- (void)render2DWithLayer:(CCLayer *)layer andRatio:(double)ratio andOffset:(CGPoint)offset andAngle:(float)angle andPriority:(int)priority

Parameters

layer

The destination Cocos2d layer where this object should be added to.

ratio

The real/screen coord ratio, this is used to transform the object’s real coords into screen coords.

offset

In pixels, the offset from the (0, 0) of the drawing Cocos2d layer that should be added to this object coords.

angle

The offset angle in case a rotation should be done. The rotation is relative to the screen center (clockwise).

priority

The renderer priority, used as Z by Cocos2d.

Discussion

Warning: Cocos2d coordinates system is reversed.

Declared In

ISRTO.h

– remove2DFromLayer: required method

Method called to remove an RTO from the Cocos2d layer.

- (void)remove2DFromLayer:(CCLayer *)layer

Parameters

layer

The current Cocos2d layer used.

Declared In

ISRTO.h

– setResources required method

Method called to initialize RTO resources such as images, labels etc…

- (void)setResources

Discussion

Warning: This method will be called on the main thread (UI Thread).

Declared In

ISRTO.h

Touch

– onTouchDown: required method

Method called when an RTO was touched down.

- (ISETouchObjectResult)onTouchDown:(ISTouch *)touch

Parameters

touch

Object that contains iOS touch information.

Return Value

Touch event handling result.

Discussion

Warning: Cocos2d coordinates system is reversed.

Declared In

ISRTO.h

– onTouchMove: required method

Method called when an RTO was touch-moved.

- (ISETouchObjectResult)onTouchMove:(ISTouch *)touch

Parameters

touch

Object that contains iOS touch information.

Return Value

Touch event handling result.

Discussion

Warning: Cocos2d coordinates system is reversed.

Declared In

ISRTO.h

– onTouchUp: required method

Method called when an RTO was touched up.

- (ISETouchObjectResult)onTouchUp:(ISTouch *)touch

Parameters

touch

Object that contains iOS touch information.

Return Value

Touch event handling result.

Discussion

Warning: Cocos2d coordinates system is reversed.

Declared In

ISRTO.h

Render 3D

  renderMode

Current map render mode (2D or 3D).

@property (nonatomic, readwrite) ISERenderMode renderMode

Declared In

ISRTO.h

  zoneOffset

Zone offset in meters

@property (nonatomic, readwrite) CC3Vector zoneOffset

Declared In

ISRTO.h

  object3d

3D Object to handle in case of 3D rendering.

@property (nonatomic, readonly) CC3Node *object3d

Declared In

ISRTO.h

– render3DWithScene:andLayer:andCurrentMap:andRatio:andAngle:andPriority:

Method called to handle 3D rendering stuff.

- (void)render3DWithScene:(CC3Scene *)scene andLayer:(CC3Node *)layer andCurrentMap:(ISMap *)map andRatio:(float)ratio andAngle:(float)angle andPriority:(int)priority

Parameters

scene

Current 3D scene.

layer

Layer where the RTO is.

map

Current displayed map.

ratio

Current ratio (depending on the current zoom level).

angle

Current angle.

priority

The renderer priority, used as Z by Cocos2d.

Declared In

ISRTO.h

– remove3DFromLayer:

Method called to remove an RTO from the Cocos3d layer.

- (void)remove3DFromLayer:(CC3Node *)layer

Parameters

layer

The current Cocos3d layer used.

Declared In

ISRTO.h