dice-gui-old/src/dice.h
2025-09-18 14:57:05 +02:00

48 lines
924 B
C

#ifndef DICE_H
#define DICE_H
#include "renderer/clay_renderer_SDL3.h"
#include <stdlib.h>
#ifndef MAX_ACTIVE_DICE
#define MAX_ACTIVE_DICE 20
#endif
#ifndef MAX_ROLL_STR_LEN
#define MAX_ROLL_STR_LEN 10
#endif
enum Dice_Die {
COIN = 1,
D4 = 4,
D6 = 6,
D8 = 8,
D10 = 10,
D12 = 12,
D20 = 20,
D100 = 100
};
struct Dice_ResultType {
int roll;
size_t string_len;
char string[MAX_ROLL_STR_LEN];
Clay_String clay_string;
};
extern int Dice_Roll(enum Dice_Die die);
extern enum Dice_Die const *Dice_GetActiveSet(size_t *out_length);
extern size_t Dice_AddToActiveSet(enum Dice_Die die);
extern void Dice_RemoveFromActiveSet(size_t index);
extern void Dice_ClearActiveSet();
extern struct Dice_ResultType *Dice_GetLastResult(size_t *out_length);
extern struct Dice_ResultType *Dice_GetLastResultTotal();
extern void Dice_RollActiveSet();
extern Clay_String Dice_ToString(enum Dice_Die die);
#endif // !DICE_H