render parity unit I: 40250 PythonGraphic SetGamma, cooldown fan, up/down buttons
SetGamma, RenderCoolTimeBox, RenderUp/DownButton and GetAvailableMemory are transliterated from 40250 in place of stubs. The cooldown fan is emitted as untextured polygon UI commands (native_render + python_ui_surface.gd draw Bar+quad as a polygon); D3D8 shim gains SetGammaRamp/D3DGAMMARAMP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d3fd5f8613
commit
0e8a1574cb
@@ -21,6 +21,7 @@
|
||||
#include "../src/platform/UserInterface/UserInterface.h"
|
||||
#include "../src/platform/EterLib/UIRenderCommands.h"
|
||||
#include "EterLib/GrpScreen.h"
|
||||
#include "EterPythonLib/PythonGraphic.h"
|
||||
#include <dinput.h> // DIK_ESCAPE
|
||||
|
||||
#include <cmath>
|
||||
@@ -126,6 +127,46 @@ static void drawing_primitives()
|
||||
CHECK(commands[4].kind == UIRenderCommand::GradientBar && commands[4].argb == 0xFF102030u &&
|
||||
commands[4].end_argb == 0xFF405060u);
|
||||
}
|
||||
|
||||
// 40250 CPythonGraphic::RenderCoolTimeBox: fTime 0.25 leaves 6 whole fan triangles from the top
|
||||
// centre anticlockwise round to (+1, 0); fTime 0.3 has 5 whole ones and a sixth 60% of the way
|
||||
// from (+1, +1) to (+1, 0).
|
||||
UIRenderBeginFrame();
|
||||
{
|
||||
CPythonGraphic graphic;
|
||||
graphic.RenderCoolTimeBox(100, 100, 10, 0.25f);
|
||||
CHECK(commands.size() == 6);
|
||||
if (commands.size() == 6)
|
||||
{
|
||||
CHECK(commands[0].kind == UIRenderCommand::Bar && commands[0].quad && commands[0].argb == 0x80000000u);
|
||||
CHECK(near(commands[0].qx[0], 100) && near(commands[0].qy[0], 100));
|
||||
CHECK(near(commands[0].qx[1], 100) && near(commands[0].qy[1], 90));
|
||||
CHECK(near(commands[0].qx[2], 90) && near(commands[0].qy[2], 90));
|
||||
CHECK(near(commands[5].qx[2], 110) && near(commands[5].qy[2], 100));
|
||||
}
|
||||
UIRenderBeginFrame();
|
||||
graphic.RenderCoolTimeBox(100, 100, 10, 0.3f);
|
||||
CHECK(commands.size() == 6);
|
||||
if (commands.size() == 6)
|
||||
CHECK(near(commands[5].qx[1], 110) && near(commands[5].qy[1], 110) &&
|
||||
near(commands[5].qx[2], 110) && near(commands[5].qy[2], 104));
|
||||
UIRenderBeginFrame();
|
||||
graphic.RenderCoolTimeBox(100, 100, 10, 1.0f);
|
||||
CHECK(commands.empty());
|
||||
|
||||
// CPythonGraphic::SetViewport also clips the UI commands to the viewport until RestoreViewport.
|
||||
graphic.SetViewport(10, 20, 30, 40);
|
||||
screen.RenderBar2d(0, 0, 5, 5);
|
||||
graphic.RestoreViewport();
|
||||
screen.RenderBar2d(0, 0, 5, 5);
|
||||
CHECK(commands.size() == 2);
|
||||
if (commands.size() == 2)
|
||||
{
|
||||
CHECK(near(commands[0].clip_x1, 10) && near(commands[0].clip_y1, 20) &&
|
||||
near(commands[0].clip_x2, 40) && near(commands[0].clip_y2, 60));
|
||||
CHECK(near(commands[1].clip_x1, 0) && near(commands[1].clip_x2, 800) && near(commands[1].clip_y2, 600));
|
||||
}
|
||||
}
|
||||
UIRenderSetSize(0, 0);
|
||||
UIRenderBeginFrame();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user