11#include " UnrealEnginePythonPrivatePCH.h"
22#include " Runtime/Engine/Classes/GameFramework/HUD.h"
33
4- PyObject *py_ue_hud_draw_2d_line (ue_PyUObject *self, PyObject * args) {
4+ PyObject *py_ue_hud_draw_2d_line (ue_PyUObject *self, PyObject * args)
5+ {
56
67 ue_py_check (self);
78
89 int x1, y1, x2, y2;
910 PyObject *py_fcolor;
1011
11- if (!PyArg_ParseTuple (args, " iiiiO:hud_draw_2d_line" , &x1, &y1, &x2, &y2, &py_fcolor)) {
12+ if (!PyArg_ParseTuple (args, " iiiiO:hud_draw_2d_line" , &x1, &y1, &x2, &y2, &py_fcolor))
13+ {
1214 return nullptr ;
1315 }
1416
1517 AHUD *hud = ue_py_check_type<AHUD >(self);
1618 if (!hud)
1719 return PyErr_Format (PyExc_Exception, " UObject is not a AHUD." );
1820
19- ue_PyFColor *fcolor = py_ue_is_fcolor (py_fcolor);
20- if (!fcolor)
21- return PyErr_Format (PyExc_Exception, " argument is not a FColor." );
21+ FColor color;
22+ if (!py_ue_get_fcolor (py_fcolor, color))
23+ {
24+ return PyErr_Format (PyExc_Exception, " argument is not a FColor or FLinearColor." );
25+ }
2226
23- hud->Draw2DLine (x1, y1, x2, y2, fcolor-> color );
27+ hud->Draw2DLine (x1, y1, x2, y2, color);
2428
2529 Py_RETURN_NONE;
2630}
2731
28- PyObject *py_ue_hud_draw_line (ue_PyUObject *self, PyObject * args) {
32+ PyObject *py_ue_hud_draw_line (ue_PyUObject *self, PyObject * args)
33+ {
2934
3035 ue_py_check (self);
3136
3237 float x1, y1, x2, y2;
3338 PyObject *py_fcolor;
3439 float thickness;
3540
36- if (!PyArg_ParseTuple (args, " ffffOf:hud_draw_line" , &x1, &y1, &x2, &y2, &py_fcolor, &thickness)) {
41+ if (!PyArg_ParseTuple (args, " ffffOf:hud_draw_line" , &x1, &y1, &x2, &y2, &py_fcolor, &thickness))
42+ {
3743 return nullptr ;
3844 }
3945
4046 AHUD *hud = ue_py_check_type<AHUD >(self);
4147 if (!hud)
4248 return PyErr_Format (PyExc_Exception, " UObject is not a AHUD." );
4349
44- ue_PyFColor *fcolor = py_ue_is_fcolor (py_fcolor);
45- if (!fcolor)
46- return PyErr_Format (PyExc_Exception, " argument is not a FColor." );
50+ FLinearColor color;
51+ if (!py_ue_get_flinearcolor (py_fcolor, color))
52+ {
53+ return PyErr_Format (PyExc_Exception, " argument is not a FLinearColor or FColor." );
54+ }
4755
48- hud->DrawLine (x1, y1, x2, y2, fcolor-> color , thickness);
56+ hud->DrawLine (x1, y1, x2, y2, color, thickness);
4957
5058 Py_RETURN_NONE;
5159}
5260
53- PyObject *py_ue_hud_draw_rect (ue_PyUObject *self, PyObject * args) {
61+ PyObject *py_ue_hud_draw_rect (ue_PyUObject *self, PyObject * args)
62+ {
5463
5564 ue_py_check (self);
5665
5766 float x, y, w, h;
5867 PyObject *py_fcolor;
5968
60- if (!PyArg_ParseTuple (args, " ffffO:hud_draw_line" , &x, &y, &w, &h, &py_fcolor)) {
69+ if (!PyArg_ParseTuple (args, " ffffO:hud_draw_line" , &x, &y, &w, &h, &py_fcolor))
70+ {
6171 return nullptr ;
6272 }
6373
6474 AHUD *hud = ue_py_check_type<AHUD >(self);
6575 if (!hud)
6676 return PyErr_Format (PyExc_Exception, " UObject is not a AHUD." );
6777
68- ue_PyFLinearColor *fcolor = py_ue_is_flinearcolor (py_fcolor);
69- if (!fcolor)
70- return PyErr_Format (PyExc_Exception, " argument is not a FColor." );
78+ FLinearColor color;
79+ if (!py_ue_get_flinearcolor (py_fcolor, color))
80+ {
81+ return PyErr_Format (PyExc_Exception, " argument is not a FLinearColor or FColor." );
82+ }
7183
72- hud->DrawRect (fcolor-> color , x, y, w, h);
84+ hud->DrawRect (color, x, y, w, h);
7385
7486 Py_RETURN_NONE;
7587}
7688
7789
78- PyObject *py_ue_hud_draw_text (ue_PyUObject *self, PyObject * args) {
90+ PyObject *py_ue_hud_draw_text (ue_PyUObject *self, PyObject * args)
91+ {
7992
8093 ue_py_check (self);
8194
@@ -84,24 +97,28 @@ PyObject *py_ue_hud_draw_text(ue_PyUObject *self, PyObject * args) {
8497 PyObject *py_fcolor;
8598 float scale = 1 ;
8699
87- if (!PyArg_ParseTuple (args, " sffO|f:hud_draw_text" , &text, &x, &y, &py_fcolor, &scale)) {
100+ if (!PyArg_ParseTuple (args, " sffO|f:hud_draw_text" , &text, &x, &y, &py_fcolor, &scale))
101+ {
88102 return nullptr ;
89103 }
90104
91105 AHUD *hud = ue_py_check_type<AHUD >(self);
92106 if (!hud)
93107 return PyErr_Format (PyExc_Exception, " UObject is not a AHUD." );
94108
95- ue_PyFLinearColor *fcolor = py_ue_is_flinearcolor (py_fcolor);
96- if (!fcolor)
97- return PyErr_Format (PyExc_Exception, " argument is not a FColor." );
109+ FLinearColor color;
110+ if (!py_ue_get_flinearcolor (py_fcolor, color))
111+ {
112+ return PyErr_Format (PyExc_Exception, " argument is not a FLinearColor or FColor." );
113+ }
98114
99- hud->DrawText (FString (UTF8_TO_TCHAR (text)), fcolor-> color , x, y, nullptr , scale);
115+ hud->DrawText (FString (UTF8_TO_TCHAR (text)), color, x, y, nullptr , scale);
100116
101117 Py_RETURN_NONE;
102118}
103119
104- PyObject *py_ue_hud_draw_texture (ue_PyUObject *self, PyObject * args) {
120+ PyObject *py_ue_hud_draw_texture (ue_PyUObject *self, PyObject * args)
121+ {
105122
106123 ue_py_check (self);
107124
@@ -116,7 +133,8 @@ PyObject *py_ue_hud_draw_texture(ue_PyUObject *self, PyObject * args) {
116133 float pivot_rot_x = 0 , pivot_rot_y = 0 ;
117134
118135
119- if (!PyArg_ParseTuple (args, " Offff|ffffOifOf(ff):hud_draw_texture" , &py_texture, &x, &y, &w, &h, &u, &v, &uw, &vh, &py_flinear_color, &blend_mode, &scale, &py_scale_position, &rotation, &pivot_rot_x, &pivot_rot_y)) {
136+ if (!PyArg_ParseTuple (args, " Offff|ffffOifOf(ff):hud_draw_texture" , &py_texture, &x, &y, &w, &h, &u, &v, &uw, &vh, &py_flinear_color, &blend_mode, &scale, &py_scale_position, &rotation, &pivot_rot_x, &pivot_rot_y))
137+ {
120138 return nullptr ;
121139 }
122140
@@ -130,11 +148,12 @@ PyObject *py_ue_hud_draw_texture(ue_PyUObject *self, PyObject * args) {
130148
131149 FLinearColor tint = FLinearColor::White;
132150
133- if (py_flinear_color) {
134- ue_PyFLinearColor *flinear_color = py_ue_is_flinearcolor (py_flinear_color);
135- if (!flinear_color)
136- return PyErr_Format (PyExc_Exception, " argument is not a FLinearColor." );
137- tint = flinear_color->color ;
151+ if (py_flinear_color)
152+ {
153+ if (!py_ue_get_flinearcolor (py_flinear_color, tint))
154+ {
155+ return PyErr_Format (PyExc_Exception, " argument is not a FLinearColor or FColor." );
156+ }
138157 }
139158
140159 bool scale_position = false ;
0 commit comments