iw4x-client/src/Components/Modules/UIFeeder.hpp

57 lines
1.2 KiB
C++
Raw Normal View History

2015-12-27 18:06:15 -05:00
namespace Components
{
2015-12-28 08:08:46 -05:00
class UIFeeder : public Component
2015-12-27 18:06:15 -05:00
{
public:
2016-01-10 06:25:31 -05:00
typedef unsigned int(__cdecl * GetItemCount_t)();
typedef const char* (__cdecl * GetItemText_t)(unsigned int index, int column);
typedef void(__cdecl * Select_t)(unsigned int index);
2015-12-27 18:06:15 -05:00
struct Callbacks
{
GetItemCount_t GetItemCount;
GetItemText_t GetItemText;
Select_t Select;
};
2015-12-28 08:08:46 -05:00
UIFeeder();
2016-08-15 10:40:30 -04:00
~UIFeeder();
2016-09-16 05:04:28 -04:00
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
2015-12-28 08:08:46 -05:00
const char* GetName() { return "UIFeeder"; };
2016-08-15 10:40:30 -04:00
#endif
2015-12-27 18:06:15 -05:00
static void Add(float feeder, GetItemCount_t itemCountCb, GetItemText_t itemTextCb, Select_t selectCb);
private:
struct Container
{
2015-12-28 08:08:46 -05:00
float Feeder;
2015-12-27 18:06:15 -05:00
int Index;
int Column;
};
static Container Current;
static void GetItemCountStub();
2016-01-10 06:25:31 -05:00
static unsigned int GetItemCount();
2015-12-27 18:06:15 -05:00
static void GetItemTextStub();
static const char* GetItemText();
static void SetItemSelectionStub();
static bool SetItemSelection();
static bool CheckFeeder();
static void MouseEnterStub();
static void MouseSelectStub();
static void HandleKeyStub();
static void PlaySoundStub();
static std::map<float, Callbacks> Feeders;
2016-11-01 16:09:50 -04:00
static void ApplyMapFeeder(Game::dvar_t* dvar, int num);
2015-12-27 18:06:15 -05:00
};
}