forked from hoffstadt/DearPyGui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmvTextureItems.h
116 lines (83 loc) · 2.96 KB
/
mvTextureItems.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#pragma once
#include "mvItemRegistry.h"
#include "dearpygui.h"
#include "cpp.hint"
class mvTextureRegistry : public mvAppItem
{
public:
explicit mvTextureRegistry(mvUUID uuid);
void draw(ImDrawList* drawlist, float x, float y) override;
void show_debugger();
private:
int _selection = -1;
};
class mvStaticTexture : public mvAppItem
{
public:
explicit mvStaticTexture(mvUUID uuid) : mvAppItem(uuid) {}
~mvStaticTexture();
void draw(ImDrawList* drawlist, float x, float y) override;
void handleSpecificRequiredArgs(PyObject* dict) override;
void applySpecificTemplate(mvAppItem* item) override;
// values
void setDataSource(mvUUID dataSource) override;
void* getValue() override { return &_value; }
PyObject* getPyValue() override;
void setPyValue(PyObject* value) override;
void markDirty() { _dirty = true; }
public:
mvRef<std::vector<float>> _value = CreateRef<std::vector<float>>(std::vector<float>{0.0f});
void* _texture = nullptr;
bool _dirty = true;
int _permWidth = 0;
int _permHeight = 0;
};
class mvRawTexture : public mvAppItem
{
enum class ComponentType {
MV_FLOAT_COMPONENT,
MV_INT_COMPONENT,
};
public:
explicit mvRawTexture(mvUUID uuid) : mvAppItem(uuid) {}
~mvRawTexture();
void draw(ImDrawList* drawlist, float x, float y) override;
void handleSpecificRequiredArgs(PyObject* dict) override;
void handleSpecificKeywordArgs(PyObject* dict) override;
void getSpecificConfiguration(PyObject* dict) override;
void applySpecificTemplate(mvAppItem* item) override;
// values
PyObject* getPyValue() override;
void setPyValue(PyObject* value) override;
public:
PyObject* _buffer = nullptr;
void* _value = nullptr;
void* _texture = nullptr;
bool _dirty = true;
ComponentType _componentType = ComponentType::MV_FLOAT_COMPONENT;
int _components = 4;
int _permWidth = 0;
int _permHeight = 0;
};
class mvDynamicTexture : public mvAppItem
{
public:
explicit mvDynamicTexture(mvUUID uuid) : mvAppItem(uuid) {}
~mvDynamicTexture();
void draw(ImDrawList* drawlist, float x, float y) override;
void handleSpecificRequiredArgs(PyObject* dict) override;
void handleSpecificKeywordArgs(PyObject* dict) override;
void getSpecificConfiguration(PyObject* dict) override;
void applySpecificTemplate(mvAppItem* item) override;
// values
void setDataSource(mvUUID dataSource) override;
void* getValue() override { return &_value; }
PyObject* getPyValue() override;
void setPyValue(PyObject* value) override;
public:
mvRef<std::vector<float>> _value = CreateRef<std::vector<float>>(std::vector<float>{0.0f});
void* _texture = nullptr;
bool _dirty = true;
int _permWidth = 0;
int _permHeight = 0;
};