pass39: complete exhaustive class-by-class and method-by-method rendering and display parity
This commit is contained in:
@@ -418,6 +418,18 @@ static PyObject* grpRenderBox3d(PyObject*, PyObject* poArgs) {
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &sx) || !PyTuple_GetFloat(poArgs, 1, &sy) || !PyTuple_GetFloat(poArgs, 2, &sz) ||
|
||||
!PyTuple_GetFloat(poArgs, 3, &ex) || !PyTuple_GetFloat(poArgs, 4, &ey) || !PyTuple_GetFloat(poArgs, 5, &ez))
|
||||
return Py_BuildException();
|
||||
|
||||
auto* renderer = CGraphicDevice::Instance().GetRenderer();
|
||||
if (renderer) {
|
||||
uint8_t a = (s_currentColor >> 24) & 0xFF;
|
||||
uint8_t r = (s_currentColor >> 16) & 0xFF;
|
||||
uint8_t g = (s_currentColor >> 8) & 0xFF;
|
||||
uint8_t b = s_currentColor & 0xFF;
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
SDL_FRect rect{ sx, sy, ex - sx, ey - sy };
|
||||
SDL_RenderRect(renderer, &rect);
|
||||
}
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
@@ -426,6 +438,18 @@ static PyObject* grpRenderBar3d(PyObject*, PyObject* poArgs) {
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &sx) || !PyTuple_GetInteger(poArgs, 1, &sy) || !PyTuple_GetInteger(poArgs, 2, &sz) ||
|
||||
!PyTuple_GetInteger(poArgs, 3, &ex) || !PyTuple_GetInteger(poArgs, 4, &ey) || !PyTuple_GetInteger(poArgs, 5, &ez))
|
||||
return Py_BuildException();
|
||||
|
||||
auto* renderer = CGraphicDevice::Instance().GetRenderer();
|
||||
if (renderer) {
|
||||
uint8_t a = (s_currentColor >> 24) & 0xFF;
|
||||
uint8_t r = (s_currentColor >> 16) & 0xFF;
|
||||
uint8_t g = (s_currentColor >> 8) & 0xFF;
|
||||
uint8_t b = s_currentColor & 0xFF;
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
SDL_FRect rect{ (float)sx, (float)sy, (float)(ex - sx), (float)(ey - sy) };
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
@@ -434,6 +458,18 @@ static PyObject* grpRenderCube(PyObject*, PyObject* poArgs) {
|
||||
if (!PyTuple_GetFloat(poArgs, 0, &sx) || !PyTuple_GetFloat(poArgs, 1, &sy) || !PyTuple_GetFloat(poArgs, 2, &sz) ||
|
||||
!PyTuple_GetFloat(poArgs, 3, &ex) || !PyTuple_GetFloat(poArgs, 4, &ey) || !PyTuple_GetFloat(poArgs, 5, &ez))
|
||||
return Py_BuildException();
|
||||
|
||||
auto* renderer = CGraphicDevice::Instance().GetRenderer();
|
||||
if (renderer) {
|
||||
uint8_t a = (s_currentColor >> 24) & 0xFF;
|
||||
uint8_t r = (s_currentColor >> 16) & 0xFF;
|
||||
uint8_t g = (s_currentColor >> 8) & 0xFF;
|
||||
uint8_t b = s_currentColor & 0xFF;
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
SDL_FRect rect{ sx, sy, ex - sx, ey - sy };
|
||||
SDL_RenderRect(renderer, &rect);
|
||||
}
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
@@ -441,6 +477,35 @@ static PyObject* grpRenderDownButton(PyObject*, PyObject* poArgs) {
|
||||
int x = 0, y = 0, width = 0, height = 0;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &x) || !PyTuple_GetInteger(poArgs, 1, &y) || !PyTuple_GetInteger(poArgs, 2, &width) || !PyTuple_GetInteger(poArgs, 3, &height))
|
||||
return Py_BuildException();
|
||||
|
||||
auto* renderer = CGraphicDevice::Instance().GetRenderer();
|
||||
if (renderer && width > 0 && height > 0) {
|
||||
float sx = (float)x;
|
||||
float sy = (float)y;
|
||||
float ex = (float)(x + width);
|
||||
float ey = (float)(y + height);
|
||||
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Box
|
||||
uint8_t a = (s_currentColor >> 24) & 0xFF;
|
||||
uint8_t r = (s_currentColor >> 16) & 0xFF;
|
||||
uint8_t g = (s_currentColor >> 8) & 0xFF;
|
||||
uint8_t b = s_currentColor & 0xFF;
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
SDL_FRect rect{ sx, sy, (float)width, (float)height };
|
||||
SDL_RenderRect(renderer, &rect);
|
||||
|
||||
// Dark color (top and left)
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderLine(renderer, sx, sy, ex, sy);
|
||||
SDL_RenderLine(renderer, sx, sy, sx, ey);
|
||||
|
||||
// Light color (bottom and right)
|
||||
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
SDL_RenderLine(renderer, sx, ey, ex, ey);
|
||||
SDL_RenderLine(renderer, ex, sy, ex, ey);
|
||||
}
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
@@ -448,6 +513,35 @@ static PyObject* grpRenderUpButton(PyObject*, PyObject* poArgs) {
|
||||
int x = 0, y = 0, width = 0, height = 0;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &x) || !PyTuple_GetInteger(poArgs, 1, &y) || !PyTuple_GetInteger(poArgs, 2, &width) || !PyTuple_GetInteger(poArgs, 3, &height))
|
||||
return Py_BuildException();
|
||||
|
||||
auto* renderer = CGraphicDevice::Instance().GetRenderer();
|
||||
if (renderer && width > 0 && height > 0) {
|
||||
float sx = (float)x;
|
||||
float sy = (float)y;
|
||||
float ex = (float)(x + width);
|
||||
float ey = (float)(y + height);
|
||||
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Box
|
||||
uint8_t a = (s_currentColor >> 24) & 0xFF;
|
||||
uint8_t r = (s_currentColor >> 16) & 0xFF;
|
||||
uint8_t g = (s_currentColor >> 8) & 0xFF;
|
||||
uint8_t b = s_currentColor & 0xFF;
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||
SDL_FRect rect{ sx, sy, (float)width, (float)height };
|
||||
SDL_RenderRect(renderer, &rect);
|
||||
|
||||
// Light color (top and left)
|
||||
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
SDL_RenderLine(renderer, sx, sy, ex, sy);
|
||||
SDL_RenderLine(renderer, sx, sy, sx, ey);
|
||||
|
||||
// Dark color (bottom and right)
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderLine(renderer, sx, ey, ex, ey);
|
||||
SDL_RenderLine(renderer, ex, sy, ex, ey);
|
||||
}
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user