Angel 3.2
A 2D Game Prototyping Engine
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
TagCollection Class Reference

A helper class that manages the tags you can set on Actors. More...

#include <TagCollection.h>

Public Member Functions

ActorSet GetObjectsTagged (String findTag)
StringSet GetTagList ()
void AddObjToTagList (Actor *obj, const String &tag)
void RemoveObjFromTagList (Actor *obj, const String &tag)

Static Public Member Functions

static TagCollectionGetInstance ()

Static Protected Attributes

static TagCollections_TagCollection = NULL

Detailed Description

Whenever you call Actor::Tag or Actor::Untag, the Actor manipulates the tag collection appropriately for you. The only functions here you should be thinking about are TagCollection::GetObjectsTagged and TagCollection::GetTagList.

Like the Camera and the World, it uses the singleton pattern; you can't actually declare a new instance of a TagCollection. To access tags in your world, use "theTagList" to retrieve the singleton object. "theTagList" is defined in both C++ and Lua.

If you're not familiar with the singleton pattern, this paper is a good starting point. (Don't be afraid that it's written by Microsoft.)

Definition at line 53 of file TagCollection.h.

Member Function Documentation

TagCollection & TagCollection::GetInstance ( )

Used to access the singleton instance of this class. As a shortcut, you can just use "theTagList".

The singleton

Definition at line 39 of file TagCollection.cpp.

ActorSet TagCollection::GetObjectsTagged ( String  findTag)

Returns the set of all Actors who have the given tag.

findTagThe tag of interest
An ActorSet of everyone who is tagged thusly

Definition at line 53 of file TagCollection.cpp.

StringSet TagCollection::GetTagList ( )

Get a list of all the tags currently in use.

All current tags as a StringSet

Definition at line 111 of file TagCollection.cpp.

void TagCollection::AddObjToTagList ( Actor obj,
const String &  tag 

Adds a tag to a given Actor. Shouldn't be called directly; use the Actor::Tag function.

objThe Actor to tag
tagThe tag to apply

Definition at line 125 of file TagCollection.cpp.

void TagCollection::RemoveObjFromTagList ( Actor obj,
const String &  tag 

Removes a tag from an Actor. Shouldn't be called directly; use the Actor::Untag function.

objThe Actor to untag
tagThe tag to remove

Definition at line 130 of file TagCollection.cpp.

The documentation for this class was generated from the following files: