Fio:Iterators

From Fio

Revision as of 15:18, 30 August 2006 by 219.232.33.6 (Talk)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)

"To iterate is humane, to recurse - divine!"

Iterator

Contents

One Design Principle of Fio is:

  • Rendering is an inorder iterating process; Picking is a postorder one.

while rendering is to draw the game world and picking is to dispatch mouse event so that the player can interact with the game.

In Fio we use a typical GoF Iterator:

template<typename T>
class Iterator{
public:
	virtual ~Iterator(){}
	virtual void first() = 0;
	virtual void next() = 0;
	virtual bool isDone() = 0;
	virtual T current() = 0;
};

we can call first() to position an iterator to its beginning; next() to step to the next element in current iterating order. And when isDone() returns true, there's no element left to iterate. current() returns the element the iterator points to.

Root of The World

Iterators: Policy & Mechanism

Isometric Iterator for Layer

Personal tools