Update to spice2x-26-02-17 (pre-apply)
> broken commit
This commit is contained in:
@@ -10,12 +10,14 @@ namespace overlay::windows {
|
||||
uint32_t IIDX_SEGMENT_FONT_SIZE = 64;
|
||||
std::optional<uint32_t> IIDX_SEGMENT_FONT_COLOR = std::nullopt;
|
||||
std::string IIDX_SEGMENT_LOCATION = "bottom";
|
||||
bool IIDX_SEGMENT_BORDERLESS = false;
|
||||
|
||||
static const size_t TICKER_SIZE = 9;
|
||||
static const ImVec4 DARK_GRAY(0.1f, 0.1f, 0.1f, 1.f);
|
||||
static const ImVec4 YELLOW(1.f, 1.f, 0.f, 1.f);
|
||||
static const ImVec4 RED(1.f, 0.f, 0.f, 1.f);
|
||||
static const int PADDING_Y = 8;
|
||||
static const int PADDING_X = 4;
|
||||
static const float PADDING_Y = 8.f;
|
||||
static const float PADDING_X = 4.f;
|
||||
|
||||
static const std::map<char, std::pair<char, char>> CHARMAP = {\
|
||||
// period - add a space afterwards (game sends 'm' for period)
|
||||
@@ -31,16 +33,18 @@ namespace overlay::windows {
|
||||
log_fatal("iidx_seg", "DSEG_FONT is null");
|
||||
}
|
||||
|
||||
this->title = "IIDX LED Segment Display";
|
||||
this->title = "IIDX LDJ LED Ticker";
|
||||
this->toggle_button = games::OverlayButtons::ToggleSubScreen;
|
||||
this->remove_window_padding = true;
|
||||
this->size_max = ImVec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y);
|
||||
this->flags = ImGuiWindowFlags_NoTitleBar
|
||||
| ImGuiWindowFlags_NoScrollbar
|
||||
this->flags = ImGuiWindowFlags_NoScrollbar
|
||||
| ImGuiWindowFlags_NoResize
|
||||
| ImGuiWindowFlags_NoNavFocus
|
||||
| ImGuiWindowFlags_NoNavInputs
|
||||
| ImGuiWindowFlags_NoDocking;
|
||||
if (IIDX_SEGMENT_BORDERLESS) {
|
||||
this->flags |= ImGuiWindowFlags_NoTitleBar;
|
||||
}
|
||||
|
||||
if (IIDX_SEGMENT_FONT_COLOR.has_value()) {
|
||||
const auto rgb = IIDX_SEGMENT_FONT_COLOR.value();
|
||||
@@ -51,13 +55,22 @@ namespace overlay::windows {
|
||||
}
|
||||
}
|
||||
|
||||
float IIDXSegmentDisplay::get_title_bar_height() {
|
||||
// make sure you don't call this within PushFont/PopFont block
|
||||
// since text line height calculation is dependent on current font size
|
||||
return ImGui::GetTextLineHeight() + ImGui::GetStyle().FramePadding.y * 2.0f;
|
||||
}
|
||||
|
||||
void IIDXSegmentDisplay::calculate_initial_window() {
|
||||
// ImGui::CalcTextSize doesn't seem to work here, so manually calculate
|
||||
ImGui::PushFont(DSEG_FONT);
|
||||
this->init_size = ImGui::CalcTextSize("~.~.~.~.~.~.~.~.~.");
|
||||
ImGui::PopFont();
|
||||
this->init_size.x += PADDING_X * 2;
|
||||
this->init_size.y += PADDING_Y * 2;
|
||||
ImGui::PopFont();
|
||||
if (!IIDX_SEGMENT_BORDERLESS) {
|
||||
this->init_size.y += get_title_bar_height();
|
||||
}
|
||||
|
||||
// initial horizontal position
|
||||
if (IIDX_SEGMENT_LOCATION.find("left") != std::string::npos) {
|
||||
@@ -79,6 +92,23 @@ namespace overlay::windows {
|
||||
}
|
||||
|
||||
void IIDXSegmentDisplay::build_content() {
|
||||
|
||||
// explicitly check if TDJ I/O is enabled to account for the fact that I/O emulation may be
|
||||
// disabled
|
||||
if (games::iidx::CURRENT_IO_EMULATION_STATE == games::iidx::iidx_aio_emulation_state::bi2x_hook) {
|
||||
ImGui::TextUnformatted("");
|
||||
ImGui::TextColored(
|
||||
YELLOW,
|
||||
"%s",
|
||||
"Invalid I/O mode; DLL is configured for TDJ I/O!\n"
|
||||
"Enable -iidxtdj if you want TDJ subscreen overlay.");
|
||||
ImGui::TextUnformatted("");
|
||||
if (ImGui::Button("Close")) {
|
||||
this->set_active(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
char input_ticker[TICKER_SIZE];
|
||||
|
||||
// get ticker content from game
|
||||
@@ -127,9 +157,13 @@ namespace overlay::windows {
|
||||
}
|
||||
|
||||
void IIDXSegmentDisplay::draw_ticker(char *ticker_string) {
|
||||
ImGui::PushFont(DSEG_FONT);
|
||||
float pad_y = PADDING_Y;
|
||||
if (!IIDX_SEGMENT_BORDERLESS) {
|
||||
pad_y += get_title_bar_height();
|
||||
}
|
||||
const auto pos = ImVec2(PADDING_X, pad_y);
|
||||
|
||||
const auto pos = ImVec2(PADDING_X, PADDING_Y);
|
||||
ImGui::PushFont(DSEG_FONT);
|
||||
|
||||
// to imitate LED "off"
|
||||
ImGui::SetCursorPos(pos);
|
||||
|
||||
Reference in New Issue
Block a user