Fix reached macOS UI primitives and audio fade behavior

This commit is contained in:
shen
2026-09-24 00:31:51 -07:00
parent 330ec9745b
commit 400973da11
14 changed files with 439 additions and 66 deletions
+23
View File
@@ -20,6 +20,7 @@
#include "../src/platform/ScriptLib/PythonHost.h"
#include "../src/platform/UserInterface/UserInterface.h"
#include "../src/platform/EterLib/UIRenderCommands.h"
#include "EterLib/GrpScreen.h"
#include <dinput.h> // DIK_ESCAPE
#include <cmath>
@@ -108,9 +109,31 @@ static void frames(int count)
PythonBoot::UIUpdate();
}
static void drawing_primitives()
{
UIRenderSetSize(800, 600);
UIRenderBeginFrame();
CScreen screen;
screen.SetDiffuseColor(0xFF123456u);
screen.RenderBox2d(10, 20, 30, 40);
screen.RenderGradationBar2d(50, 60, 70, 80, 0xFF102030u, 0xFF405060u);
const auto& commands = UIRenderCommands();
CHECK(commands.size() == 5);
if (commands.size() == 5)
{
CHECK(commands[0].kind == UIRenderCommand::Line && near(commands[0].x1, 10) && near(commands[0].y2, 20));
CHECK(commands[3].kind == UIRenderCommand::Line && near(commands[3].x2, 31));
CHECK(commands[4].kind == UIRenderCommand::GradientBar && commands[4].argb == 0xFF102030u &&
commands[4].end_argb == 0xFF405060u);
}
UIRenderSetSize(0, 0);
UIRenderBeginFrame();
}
int main(int argc, char** argv)
{
drawing_primitives();
const char* strict = std::getenv("MT_ASSETS_STRICT");
const bool is_strict = strict && std::string(strict) == "1";
const std::string client = argc > 1 ? argv[1] : "";
+9
View File
@@ -1161,6 +1161,15 @@ int main(int argc, char** argv)
CHECK(py("snd.SetSoundVolume(3)"));
CHECK(py("snd.SetSoundVolumef(0.6)"));
CHECK(CSoundManager::Instance().GetSoundVolume() > 0.0f);
const float savedMusic = CSoundManager::Instance().GetMusicVolume();
const float savedSound = CSoundManager::Instance().GetSoundVolume();
CSoundManager::Instance().SaveVolume();
CSoundManager::Instance().SaveVolume();
CHECK(CSoundManager::Instance().GetMusicVolume() == 0.0f);
CHECK(CSoundManager::Instance().GetSoundVolume() == 0.0f);
CSoundManager::Instance().RestoreVolume();
CHECK(std::abs(CSoundManager::Instance().GetMusicVolume() - savedMusic) < 0.001f);
CHECK(std::abs(CSoundManager::Instance().GetSoundVolume() - savedSound) < 0.001f);
// Scales
CHECK(py("snd.SetSoundScale(250.0)"));