Skip to content

Commit 315578c

Browse files
committed
increase button size
1 parent ec7f172 commit 315578c

3 files changed

Lines changed: 31 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif()
2020
# ═══════════════════════════════════════════════════════════════════════════════
2121

2222
project(HydroChrono
23-
VERSION 0.3.1
23+
VERSION 0.3.2
2424
DESCRIPTION "Hydrodynamics for Project Chrono."
2525
LANGUAGES CXX
2626
)

src/gui/guihelper.cpp

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class hydroc::gui::GUIImpl::MyActionReceiver : public irr::IEventReceiver {
7777
private:
7878
chrono::irrlicht::ChVisualSystemIrrlicht* vis;
7979
irr::gui::IGUIButton* pauseButton;
80-
irr::gui::IGUIStaticText* buttonText;
8180

8281
bool& pressed;
8382
};
@@ -131,11 +130,24 @@ void GUIImpl::Init(UI& ui, chrono::ChSystem* system, const char* title) {
131130
}
132131

133132
try {
134-
hydroc::debug::LogDebug("🔍 GUIImpl::Init - Setting up event receiver...");
133+
hydroc::debug::LogDebug("🔍 GUIImpl::Init - Setting up GUI skin and event receiver...");
134+
// Improve GUI readability: use built-in font for crisper text
135+
try {
136+
auto* env = pVis->GetGUIEnvironment();
137+
auto* skin = env ? env->getSkin() : nullptr;
138+
if (env && skin) {
139+
auto* builtin = env->getBuiltInFont();
140+
if (builtin) {
141+
skin->setFont(builtin);
142+
}
143+
}
144+
} catch (...) {
145+
// non-fatal if font override fails
146+
}
135147
InitReceiver(ui.simulationStarted);
136148
receiver->Init(pVis.get());
137149
pVis->AddUserEventReceiver(receiver.get());
138-
hydroc::debug::LogDebug("Event receiver set up successfully");
150+
hydroc::debug::LogDebug("GUI skin and event receiver set up successfully");
139151
} catch (const std::exception& e) {
140152
hydroc::cli::LogError(std::string("🔥 Exception during receiver setup: ") + e.what());
141153
// Don't re-throw here, receiver is optional
@@ -288,8 +300,18 @@ void hydroc::gui::GUIImpl::MyActionReceiver::Init(chrono::irrlicht::ChVisualSyst
288300
vis = vsys;
289301

290302
// ..add a GUI button to control pause/play
291-
pauseButton = vis->GetGUIEnvironment()->addButton(rect<s32>(510, 20, 650, 35));
292-
buttonText = vis->GetGUIEnvironment()->addStaticText(L"Paused", rect<s32>(560, 20, 600, 35), false);
303+
pauseButton = vis->GetGUIEnvironment()->addButton(rect<s32>(500, 18, 700, 50));
304+
pauseButton->setIsPushButton(true);
305+
pauseButton->setScaleImage(true);
306+
// Increase text visibility by adjusting the skin font was done in Init; ensure border size is sane
307+
if (auto* skin = vis->GetGUIEnvironment()->getSkin()) {
308+
skin->setSize(irr::gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X, 2);
309+
skin->setSize(irr::gui::EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y, 2);
310+
// Optional: increase button text distance to border for clarity
311+
skin->setSize(irr::gui::EGDS_TEXT_DISTANCE_X, 6);
312+
skin->setSize(irr::gui::EGDS_TEXT_DISTANCE_Y, 3);
313+
}
314+
pauseButton->setText(L"Paused");
293315
}
294316

295317
bool hydroc::gui::GUIImpl::MyActionReceiver::OnEvent(const irr::SEvent& event) {
@@ -299,9 +321,9 @@ bool hydroc::gui::GUIImpl::MyActionReceiver::OnEvent(const irr::SEvent& event) {
299321
case EGUI_EVENT_TYPE::EGET_BUTTON_CLICKED:
300322
pressed = !pressed;
301323
if (pressed) {
302-
buttonText->setText(L"Playing");
324+
pauseButton->setText(L"Playing");
303325
} else {
304-
buttonText->setText(L"Paused");
326+
pauseButton->setText(L"Paused");
305327
}
306328
return pressed;
307329
break;

src/utils/logging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void CLILogger::ShowBanner() {
301301
Log(LogLevel::Success, "│ │", LogColor::BrightCyan);
302302
Log(LogLevel::Success, "│ Hydrodynamics for Project Chrono │", LogColor::White);
303303
Log(LogLevel::Success, "│ │", LogColor::BrightCyan);
304-
Log(LogLevel::Success, "│ Version : 0.3.1", LogColor::Gray);
304+
Log(LogLevel::Success, "│ Version : 0.3.2", LogColor::Gray);
305305
Log(LogLevel::Success, "│ Status : Prototype │", LogColor::Gray);
306306
Log(LogLevel::Success, "│ Author : SEA-Stack Development Team │", LogColor::Gray);
307307
Log(LogLevel::Success, "│ Lead Developer : David Ogden │", LogColor::Gray);

0 commit comments

Comments
 (0)