aiaf Posted July 13, 2021 Share Posted July 13, 2021 Same code has different results on windows and linux. Can be seen , the last buttons (-ROT and 2-ROT) are not shown completely on windows. On linux we can see the proper result with no issues. Here windows is running in a VM , but i tested on native windows it looks the same. Below just on windows with 150% scale, the issue can be seen clearer: I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted July 13, 2021 Share Posted July 13, 2021 Need code to run please! My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted July 14, 2021 Author Share Posted July 14, 2021 Here is simplified code to reproduce the problem: #include "UltraEngine.h" #include <time.h> using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Test", 0, 0, 470, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); auto ui = CreateInterface(window); vector<std::shared_ptr<UltraEngine::Widget>> left_stack_items; vector<std::shared_ptr<UltraEngine::Widget>> right_stack_items; auto sz = ui->root->GetSize(); auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root); tabber->AddItem("Main", true); array<shared_ptr<Widget>, 4> panels; sz = tabber->ClientSize(); panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber); //Main panel //panels //left auto panel0 = CreatePanel(10, 40, sz.x / 2 - 15, sz.y - 150 - 10, panels[0]); panel0->SetColor(0.3, 0.3, 0.3, 1); panel0->SetLayout(1, 1, 1, 1); auto panel0sz = panel0->GetSize(); for (int i = 0; i < 10; i++) { left_stack_items.push_back(CreateLabel("0", 5, panel0sz.y - i * 30, 197, 25, panel0, LABEL_BORDER | LABEL_CENTER | LABEL_MIDDLE)); left_stack_items[i]->Hide(); } for (int i = 0; i < 10; i++) { left_stack_items[i]->SetText(i); left_stack_items[i]->Show(); } CreateLabel("Working", 0, 0, panel0sz.x, 25, panel0, LABEL_CENTER | LABEL_MIDDLE); //right auto panel1 = CreatePanel(sz.x / 2 + 5, 40, sz.x / 2 - 15, sz.y - 150 - 10, panels[0]); panel1->SetColor(0.3, 0.3, 0.3, 1); panel1->SetLayout(1, 1, 1, 1); auto panel1sz = panel1->GetSize(); CreateLabel("Target", 0, 0, panel1sz.x, 25, panel1, LABEL_CENTER | LABEL_MIDDLE); //1 op auto plus_btn = CreateButton("DUP", 5, sz.y - 110, 50, 50, panels[0]); plus_btn->SetLayout(1, 1, 1, 1); auto minus_btn = CreateButton("DROP", 60, sz.y - 110, 50, 50, panels[0]); minus_btn->SetLayout(1, 1, 1, 1); auto over_btn = CreateButton("OVER", 115, sz.y - 110, 50, 50, panels[0]); over_btn->SetLayout(1, 1, 1, 1); auto swap_btn = CreateButton("SWAP", 170, sz.y - 110, 50, 50, panels[0]); swap_btn->SetLayout(1, 1, 1, 1); auto nip_btn = CreateButton("NIP", 225, sz.y - 110, 50, 50, panels[0]); nip_btn->SetLayout(1, 1, 1, 1); auto tuck_btn = CreateButton("TUCK", 280, sz.y - 110, 50, 50, panels[0]); tuck_btn->SetLayout(1, 1, 1, 1); auto rot_btn = CreateButton("ROT", 335, sz.y - 110, 50, 50, panels[0]); rot_btn->SetLayout(1, 1, 1, 1); auto minusrot_btn = CreateButton("-ROT", 390, sz.y - 110, 50, 50, panels[0]); minusrot_btn->SetLayout(1, 1, 1, 1); //2 ops auto plus2_btn = CreateButton("2DUP", 5, sz.y - 55, 50, 50, panels[0]); plus2_btn->SetLayout(1, 0, 0, 1); auto minus2_btn = CreateButton("2DROP", 60, sz.y - 55, 50, 50, panels[0]); minus2_btn->SetLayout(1, 0, 0, 1); auto over2_btn = CreateButton("2OVER", 115, sz.y - 55, 50, 50, panels[0]); over2_btn->SetLayout(1, 0, 0, 1); auto swap2_btn = CreateButton("2SWAP", 170, sz.y - 55, 50, 50, panels[0]); swap2_btn->SetLayout(1, 0, 0, 1); auto nip2_btn = CreateButton("2NIP", 225, sz.y - 55, 50, 50, panels[0]); nip2_btn->SetLayout(1, 0, 0, 1); auto tuck2_btn = CreateButton("2TUCK", 280, sz.y - 55, 50, 50, panels[0]); tuck2_btn->SetLayout(1, 0, 0, 1); auto rot2_btn = CreateButton("2ROT", 335, sz.y - 55, 50, 50, panels[0]); rot2_btn->SetLayout(1, 0, 0, 1); auto minusrot2_btn = CreateButton("2-ROT", 390, sz.y - 55, 50, 50, panels[0]); minusrot2_btn->SetLayout(1, 0, 0, 1); float scale = displays[0]->scale; window->SetShape(0, 0, 470 * scale, 600 * scale); ui->SetScale(scale); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: break; case EVENT_WIDGETSELECT: break; case EVENT_QUIT: case EVENT_WINDOWCLOSE: return 0; break; default: break; } } return 0; } 1 I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted July 14, 2021 Share Posted July 14, 2021 We can elimnate DPI scaling as a cause. Here is the program without the scaling factor applied on Windows at all: My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted July 14, 2021 Share Posted July 14, 2021 On Windows, the window border size includes the shadow around the window, so the client size of your window is smaller than the one created on Linux. You can fix this by adding this code below your call to CreateWindow(): auto cs = window->ClientSize(); int diff = 470 - cs.x; window->SetShape(window->position.x, window->position.y, window->size.x + diff, window->size.y); This improves the issue on Windows but still does not completely solve it. I am investigating why... My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted July 14, 2021 Share Posted July 14, 2021 I have discovered that WIndow::SetShape() does not set the shape you indicate it should...stay tuned... #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Test", 0, 0, 400, 300, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); Print(WString(window->size)); window->SetShape(window->position.x, window->position.y, 800, 600); Print(WString(window->size)); return 0; } My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted July 14, 2021 Share Posted July 14, 2021 My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted July 14, 2021 Solution Share Posted July 14, 2021 Update is on Steam now. Give it a try with this code: #include "UltraEngine.h" #include <time.h> using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Test", 0, 0, 470, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); auto cs = window->ClientSize(); int diff = 470 - cs.x; window->SetShape(window->position.x, window->position.y, window->size.x + diff, window->size.y); auto ui = CreateInterface(window); vector<std::shared_ptr<UltraEngine::Widget>> left_stack_items; vector<std::shared_ptr<UltraEngine::Widget>> right_stack_items; auto sz = ui->root->GetSize(); auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root); tabber->AddItem("Main", true); array<shared_ptr<Widget>, 4> panels; sz = tabber->ClientSize(); panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber); //Main panel //panels //left auto panel0 = CreatePanel(10, 40, sz.x / 2 - 15, sz.y - 150 - 10, panels[0]); panel0->SetColor(0.3, 0.3, 0.3, 1); panel0->SetLayout(1, 1, 1, 1); auto panel0sz = panel0->GetSize(); for (int i = 0; i < 10; i++) { left_stack_items.push_back(CreateLabel("0", 5, panel0sz.y - i * 30, 197, 25, panel0, LABEL_BORDER | LABEL_CENTER | LABEL_MIDDLE)); left_stack_items[i]->Hide(); } for (int i = 0; i < 10; i++) { left_stack_items[i]->SetText(i); left_stack_items[i]->Show(); } CreateLabel("Working", 0, 0, panel0sz.x, 25, panel0, LABEL_CENTER | LABEL_MIDDLE); //right auto panel1 = CreatePanel(sz.x / 2 + 5, 40, sz.x / 2 - 15, sz.y - 150 - 10, panels[0]); panel1->SetColor(0.3, 0.3, 0.3, 1); panel1->SetLayout(1, 1, 1, 1); auto panel1sz = panel1->GetSize(); CreateLabel("Target", 0, 0, panel1sz.x, 25, panel1, LABEL_CENTER | LABEL_MIDDLE); //1 op auto plus_btn = CreateButton("DUP", 5, sz.y - 110, 50, 50, panels[0]); plus_btn->SetLayout(1, 1, 1, 1); auto minus_btn = CreateButton("DROP", 60, sz.y - 110, 50, 50, panels[0]); minus_btn->SetLayout(1, 1, 1, 1); auto over_btn = CreateButton("OVER", 115, sz.y - 110, 50, 50, panels[0]); over_btn->SetLayout(1, 1, 1, 1); auto swap_btn = CreateButton("SWAP", 170, sz.y - 110, 50, 50, panels[0]); swap_btn->SetLayout(1, 1, 1, 1); auto nip_btn = CreateButton("NIP", 225, sz.y - 110, 50, 50, panels[0]); nip_btn->SetLayout(1, 1, 1, 1); auto tuck_btn = CreateButton("TUCK", 280, sz.y - 110, 50, 50, panels[0]); tuck_btn->SetLayout(1, 1, 1, 1); auto rot_btn = CreateButton("ROT", 335, sz.y - 110, 50, 50, panels[0]); rot_btn->SetLayout(1, 1, 1, 1); auto minusrot_btn = CreateButton("-ROT", 390, sz.y - 110, 50, 50, panels[0]); minusrot_btn->SetLayout(1, 1, 1, 1); //2 ops auto plus2_btn = CreateButton("2DUP", 5, sz.y - 55, 50, 50, panels[0]); plus2_btn->SetLayout(1, 0, 0, 1); auto minus2_btn = CreateButton("2DROP", 60, sz.y - 55, 50, 50, panels[0]); minus2_btn->SetLayout(1, 0, 0, 1); auto over2_btn = CreateButton("2OVER", 115, sz.y - 55, 50, 50, panels[0]); over2_btn->SetLayout(1, 0, 0, 1); auto swap2_btn = CreateButton("2SWAP", 170, sz.y - 55, 50, 50, panels[0]); swap2_btn->SetLayout(1, 0, 0, 1); auto nip2_btn = CreateButton("2NIP", 225, sz.y - 55, 50, 50, panels[0]); nip2_btn->SetLayout(1, 0, 0, 1); auto tuck2_btn = CreateButton("2TUCK", 280, sz.y - 55, 50, 50, panels[0]); tuck2_btn->SetLayout(1, 0, 0, 1); auto rot2_btn = CreateButton("2ROT", 335, sz.y - 55, 50, 50, panels[0]); rot2_btn->SetLayout(1, 0, 0, 1); auto minusrot2_btn = CreateButton("2-ROT", 390, sz.y - 55, 50, 50, panels[0]); minusrot2_btn->SetLayout(1, 0, 0, 1); float scale = displays[0]->scale; window->SetShape(window->position.x, window->position.y, window->size.x * scale, window->size.y * scale); ui->SetScale(scale); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: break; case EVENT_WIDGETSELECT: break; case EVENT_QUIT: case EVENT_WINDOWCLOSE: return 0; break; default: break; } } return 0; } 1 1 My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted July 14, 2021 Share Posted July 14, 2021 You could also use the WINDOW_CLIENTCOORDS style flag to ensure the window is created with the desired client area. 1 1 My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted July 14, 2021 Author Share Posted July 14, 2021 I tried with my original code. Looking good, i think can be closed I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Recommended Posts