User Tools

Site Tools


proton:variants

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
proton:variants [2010/10/26 07:33]
seth created
proton:variants [2012/07/24 09:43] (current)
aki 6 members in a VariantList nowadays
Line 35: Line 35:
  
 Some code to see how they work: Some code to see how they work:
-<​code>​+<​code ​cpp>
  
 //​instantiate a VariantList with four things in it //​instantiate a VariantList with four things in it
Line 59: Line 59:
 </​code>​ </​code>​
  
-Caveat: Currently it will assert if you try to use more than variables in a single VariantList. For speed, I don't dynamically allocate them as needed. ​ It's a simple define to raise that limit though.+Caveat: Currently it will assert if you try to use more than variables in a single VariantList. For speed, I don't dynamically allocate them as needed. ​ It's a simple define to raise that limit though.
 ====VariantDB==== ====VariantDB====
 A VariantDB is exactly what it sounds like.  A key/data database of variants! A VariantDB is exactly what it sounds like.  A key/data database of variants!
Line 67: Line 67:
 Example: Example:
  
-<​code>​+<​code ​cpp>
 VariantDB db; VariantDB db;
  
Line 81: Line 81:
 You can also save and load them, making them perfect for keeping track of game settings. You can also save and load them, making them perfect for keeping track of game settings.
  
-<​code>​+<​code ​cpp>
 db.Save(GetSavePath()+"​game.dat"​);​ db.Save(GetSavePath()+"​game.dat"​);​
  
Line 101: Line 101:
 In addition to setting and retrieving variant data by name, you can create and retrieve "​function objects"​. In addition to setting and retrieving variant data by name, you can create and retrieve "​function objects"​.
  
-A function object (why do I call it this? confusing) ​ is basically a named signal. (You read [[proton:​organization|earlier part about slots and signals]], right?)+A function object (why do I call it this? confusing) ​ is basically a named signal. (You read the [[proton:​organization|earlier part about slots and signals]], right?)
  
 In this way, you can sort of create labels that can be triggered easily, and these triggers can activate real functions that have been attached to them. In this way, you can sort of create labels that can be triggered easily, and these triggers can activate real functions that have been attached to them.
proton/variants.1288078435.txt.gz ยท Last modified: 2010/10/26 07:33 by seth