diff --git a/libraries/ZWidget/CMakeLists.txt b/libraries/ZWidget/CMakeLists.txt index 8c96e60586..823b6ee884 100644 --- a/libraries/ZWidget/CMakeLists.txt +++ b/libraries/ZWidget/CMakeLists.txt @@ -9,6 +9,7 @@ set(ZWIDGET_SOURCES src/core/timer.cpp src/core/widget.cpp src/core/utf8reader.cpp + src/core/pathfill.cpp src/core/schrift/schrift.cpp src/core/schrift/schrift.h src/core/picopng/picopng.cpp @@ -38,6 +39,7 @@ set(ZWIDGET_INCLUDES include/zwidget/core/font.h include/zwidget/core/image.h include/zwidget/core/rect.h + include/zwidget/core/pathfill.h include/zwidget/core/span_layout.h include/zwidget/core/timer.h include/zwidget/core/widget.h diff --git a/libraries/ZWidget/include/zwidget/widgets/listview/listview.h b/libraries/ZWidget/include/zwidget/widgets/listview/listview.h index ad30cd17c2..c7caca8d44 100644 --- a/libraries/ZWidget/include/zwidget/widgets/listview/listview.h +++ b/libraries/ZWidget/include/zwidget/widgets/listview/listview.h @@ -14,6 +14,7 @@ class ListView : public Widget void AddItem(const std::string& text); int GetSelectedItem() const { return selectedItem; } + void SetSelectedItem(int index); void ScrollToItem(int index); void Activate(); diff --git a/libraries/ZWidget/src/widgets/listview/listview.cpp b/libraries/ZWidget/src/widgets/listview/listview.cpp index 29346ad574..fe73ebdfad 100644 --- a/libraries/ZWidget/src/widgets/listview/listview.cpp +++ b/libraries/ZWidget/src/widgets/listview/listview.cpp @@ -22,6 +22,15 @@ void ListView::Activate() OnActivated(); } +void ListView::SetSelectedItem(int index) +{ + if (selectedItem != index && index >= 0 && index < items.size()) + { + selectedItem = index; + Update(); + } +} + void ListView::ScrollToItem(int index) { double itemHeight = 20.0; @@ -95,8 +104,7 @@ void ListView::OnMouseDown(const Point& pos, int key) int index = (int)((pos.y - 5.0 + scrollbar->GetPosition()) / 20.0); if (index >= 0 && (size_t)index < items.size()) { - selectedItem = index; - Update(); + SetSelectedItem(index); ScrollToItem(selectedItem); } } @@ -128,8 +136,7 @@ void ListView::OnKeyDown(EInputKey key) { if (selectedItem + 1 < (int)items.size()) { - selectedItem++; - Update(); + SetSelectedItem(selectedItem + 1); } ScrollToItem(selectedItem); } @@ -137,8 +144,7 @@ void ListView::OnKeyDown(EInputKey key) { if (selectedItem > 0) { - selectedItem--; - Update(); + SetSelectedItem(selectedItem - 1); } ScrollToItem(selectedItem); } diff --git a/source/common/rendering/gl/gl_shader.cpp b/source/common/rendering/gl/gl_shader.cpp index 7340236abd..bafbf89b8e 100644 --- a/source/common/rendering/gl/gl_shader.cpp +++ b/source/common/rendering/gl/gl_shader.cpp @@ -788,7 +788,6 @@ FShaderCollection::FShaderCollection(EPassType passType) { mEffectShaders[i] = NULL; } - CompileNextShader(); } //========================================================================== diff --git a/source/common/rendering/vulkan/shaders/vk_shader.cpp b/source/common/rendering/vulkan/shaders/vk_shader.cpp index 618fa2ca9b..00734ac7f3 100644 --- a/source/common/rendering/vulkan/shaders/vk_shader.cpp +++ b/source/common/rendering/vulkan/shaders/vk_shader.cpp @@ -115,7 +115,7 @@ bool VkShaderManager::CompileNextShader() VkShaderManager::VkShaderManager(VulkanRenderDevice* fb) : fb(fb) { - CompileNextShader(); + //CompileNextShader(); } VkShaderManager::~VkShaderManager() diff --git a/source/common/utility/tarray.h b/source/common/utility/tarray.h index b0ab192cc5..95f4842edd 100644 --- a/source/common/utility/tarray.h +++ b/source/common/utility/tarray.h @@ -684,7 +684,7 @@ class TArray Resize(i); } - void push_back(T& elem) + void push_back(const T& elem) { Push(elem); } diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index b7ed7c05ac..7357eb9343 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1050,6 +1050,10 @@ int RunGame() GetGames(); auto usedgroups = SetupGame(); + V_InitScreenSize(); + V_InitScreen(); + V_Init2(); + bool colorset = false; for (int i = usedgroups.Size()-1; i >= 0; i--) { @@ -1109,8 +1113,6 @@ int RunGame() auto ci = DumpCPUInfo(&CPU); Printf("%s", ci.GetChars()); - V_InitScreenSize(); - V_InitScreen(); StartWindow = FStartupScreen::CreateInstance(8); StartWindow->Progress(); @@ -1173,7 +1175,6 @@ int RunGame() I_UpdateWindowTitle(); DeleteStartupScreen(); - V_Init2(); while (!screen->CompileNextShader()) { // here we can do some visual updates later diff --git a/source/core/statusbar2.cpp b/source/core/statusbar2.cpp index efb9089721..eb750c007f 100644 --- a/source/core/statusbar2.cpp +++ b/source/core/statusbar2.cpp @@ -97,6 +97,7 @@ void ST_Clear() ReservedSpace GetReservedScreenSpace(int viewsize) { ReservedSpace res{}; + if (StatusBar == nullptr) return res; IFVIRTUALPTRNAME(StatusBar, NAME_RazeStatusBar, GetReservedScreenSpace) { VMReturn ret[2]; diff --git a/source/launcher/launcherwindow.cpp b/source/launcher/launcherwindow.cpp index 6091d9e67f..8e40b20e5f 100644 --- a/source/launcher/launcherwindow.cpp +++ b/source/launcher/launcherwindow.cpp @@ -145,6 +145,12 @@ LauncherWindow::LauncherWindow(WadStuff* wads, int numwads, int defaultiwad, int GamesList->AddItem(work.GetChars()); } + if (defaultiwad >= 0 && defaultiwad < numwads) + { + GamesList->SetSelectedItem(defaultiwad); + GamesList->ScrollToItem(defaultiwad); + } + Logo->SetImage(Image::LoadResource("widgets/banner.png")); GamesList->SetFocus();