Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of code/doc/Tickable


Ignore:
Timestamp:
Oct 8, 2008, 1:19:56 AM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/Tickable

    v2 v3  
    33== Description ==
    44
    5 [wiki:Tickable] is an interface that adds only one, but very important, function to the inheriting classes:
     5Tickable is an interface that adds only one, but very important, function to the inheriting classes:
    66{{{
    77#!cpp
     
    1717== How to use tick(dt) ==
    1818
    19 Every class that wants to do something every tick has to inherit from [wiki:Tickable] or from a class that already inherited from [wiki:Tickable]. Note that tick() is a virtual function. This means: If you want to call the tick(dt) function of your parent, you have to do this manually by writing Parent::tick(dt) into the code of your tick(dt) function. This is a bit unhandy, but it allows you to freely decide whether the tick of your class comes before or after (or between) the tick of the parent class. But this might also cause problems when adding tick(dt) to an old class - several childs might already have implemented their own tick(dt). You have to change them all so they call the tick(dt) of your class too.
     19Every class that wants to do something every tick has to inherit from Tickable or from a class that already inherited from Tickable. Note that tick() is a virtual function. This means: If you want to call the tick(dt) function of your parent, you have to do this manually by writing Parent::tick(dt) into the code of your tick(dt) function. This is a bit unhandy, but it allows you to freely decide whether the tick of your class comes before or after (or between) the tick of the parent class. But this might also cause problems when adding tick(dt) to an old class - several childs might already have implemented their own tick(dt). You have to change them all so they call the tick(dt) of your class too.
    2020
    2121== Example ==