solanaceae_ecosystem/plugins/dice_tool.hpp
Green Sky b51414f049
Some checks failed
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
ContinuousDelivery / linux-ubuntu (push) Failing after 3m21s
ContinuousIntegration / linux (push) Successful in 2m41s
ContinuousIntegration / android (push) Failing after 5m26s
fix imgui, add dice tool and p2prng (non functional yet)
2024-08-07 11:08:19 +02:00

37 lines
838 B
C++

#pragma once
#include <solanaceae/tox_p2prng/p2prng.hpp>
#include <solanaceae/contact/contact_model3.hpp>
#include <vector>
class DiceTool : public P2PRNGEventI {
P2PRNGI& _p2prng;
Contact3Registry& _cr;
struct Rolls {
std::vector<uint8_t> id;
P2PRNG::State state {P2PRNG::State::UNKNOWN};
uint16_t state_number_1{};
uint16_t state_number_2{};
uint16_t final_result{};
};
std::vector<Rolls> _rolls;
public:
DiceTool(P2PRNGI& p2prng, Contact3Registry& cr);
~DiceTool(void);
float render(float time_delta);
protected: // p2prng
bool onEvent(const P2PRNG::Events::Init&) override;
bool onEvent(const P2PRNG::Events::HMAC&) override;
bool onEvent(const P2PRNG::Events::Secret&) override;
bool onEvent(const P2PRNG::Events::Done&) override;
bool onEvent(const P2PRNG::Events::ValError&) override;
};