![]()  | 
  
    Gamedev Framework (gf)
    0.11.0
    
   A C++14 framework for 2D games 
   | 
 
A set of dice that can be rolled. More...
#include <gf/Dice.h>
Public Member Functions | |
| constexpr | Dice (int faces, int count=1, int modifier=0) | 
| Constructor.  More... | |
| constexpr | Dice (StringRef str) | 
| Constructor.  More... | |
| constexpr int | getFaces () const | 
| Get the number of faces.  More... | |
| constexpr int | getCount () const | 
| Get the count of dice.  More... | |
| constexpr int | getModifier () const | 
| Get the modifier.  More... | |
| int | roll (gf::Random &random) const | 
| Roll the dice.  More... | |
Related Functions | |
(Note that these are not member functions.)  | |
| constexpr gf::Dice | operator"" _dice (const char *str, std::size_t sz) | 
| User defined operator for creating dice with common dice notation.  More... | |
| constexpr gf::Dice | operator"" _d4 (unsigned long long int count) | 
| User defined operator for creating some d4.  More... | |
| constexpr gf::Dice | operator"" _d6 (unsigned long long int count) | 
| User defined operator for creating some d6.  More... | |
| constexpr gf::Dice | operator"" _d8 (unsigned long long int count) | 
| User defined operator for creating some d6.  More... | |
| constexpr gf::Dice | operator"" _d10 (unsigned long long int count) | 
| User defined operator for creating some d10.  More... | |
| constexpr gf::Dice | operator"" _d12 (unsigned long long int count) | 
| User defined operator for creating some d12.  More... | |
| constexpr gf::Dice | operator"" _d20 (unsigned long long int count) | 
| User defined operator for creating some d20.  More... | |
| constexpr gf::Dice | operator"" _d100 (unsigned long long int count) | 
| User defined operator for creating some d100.  More... | |
A set of dice that can be rolled.
The set of dice is composed of several dice with the same number of faces. After a roll a modifier can be added to the sum.
      
  | 
  inlineexplicit | 
Constructor.
With this constructor, you can set the number of faces, the count of dice and the modifier directly.
| faces | The number of faces of each dice | 
| count | The count of dice | 
| modifier | The modifier to apply after a roll | 
      
  | 
  inline | 
Constructor.
| str | The string representing a dice notation | 
      
  | 
  inline | 
Get the count of dice.
      
  | 
  inline | 
Get the number of faces.
      
  | 
  inline | 
Get the modifier.
| int gf::Dice::roll | ( | gf::Random & | random | ) | const | 
Roll the dice.
      
  | 
  related | 
User defined operator for creating some d10.
      
  | 
  related | 
User defined operator for creating some d100.
      
  | 
  related | 
User defined operator for creating some d12.
      
  | 
  related | 
User defined operator for creating some d20.
      
  | 
  related | 
User defined operator for creating some d4.
      
  | 
  related | 
User defined operator for creating some d6.
      
  | 
  related | 
User defined operator for creating some d6.
      
  | 
  related | 
User defined operator for creating dice with common dice notation.
The notation is the classical \( XdY+Z \) where \( X \) is the count of dice (1 if omitted), \( Y \) is the number of faces (mandatory), \( Z \) is the modifier (0 if omitted).
 1.8.13