From 93bf97a15ec1a5808193d066b1e14332fe5de281 Mon Sep 17 00:00:00 2001 From: Kolyah35 Date: Mon, 20 Jul 2026 20:05:29 +0300 Subject: [PATCH] Style changes --- .../gui/components/GuiElementContainer.cpp | 2 +- src/client/gui/components/OptionsGroup.cpp | 15 +---- src/client/gui/components/OptionsGroup.h | 62 +++++++++---------- 3 files changed, 34 insertions(+), 45 deletions(-) diff --git a/src/client/gui/components/GuiElementContainer.cpp b/src/client/gui/components/GuiElementContainer.cpp index 4fdaf22..377538a 100755 --- a/src/client/gui/components/GuiElementContainer.cpp +++ b/src/client/gui/components/GuiElementContainer.cpp @@ -36,7 +36,7 @@ void GuiElementContainer::removeChild( GuiElement* element ) { } bool GuiElementContainer::containsPointInChildren(int x, int y) const { - for (std::vector::const_iterator it = children.begin(); it != children.end(); ++it) { + for (auto it = children.begin(); it != children.end(); ++it) { GuiElement* child = *it; if (child == NULL || !child->visible) continue; if (child->pointInside(x, y)) return true; diff --git a/src/client/gui/components/OptionsGroup.cpp b/src/client/gui/components/OptionsGroup.cpp index 61695bb..d4dd161 100755 --- a/src/client/gui/components/OptionsGroup.cpp +++ b/src/client/gui/components/OptionsGroup.cpp @@ -12,18 +12,7 @@ #include "../../../platform/input/Mouse.h" #include "../../../util/Mth.h" -OptionsGroup::OptionsGroup( std::string labelID ) -: contentHeight(0), - scrollOffsetY(0.0f), - maxScrollOffsetY(0.0f), - trackingScrollGesture(false), - scrollingGesture(false), - touchDispatched(false), - dragStartX(0), - dragStartY(0), - lastDragY(0), - touchStartX(0), - touchStartY(0) { +OptionsGroup::OptionsGroup( std::string labelID ) { label = I18n::get(labelID); } @@ -36,7 +25,7 @@ void OptionsGroup::setupPositions() { const int contentStartY = y + labelHeight; // First we write the header and then we add the items - for(std::vector::iterator it = children.begin(); it != children.end(); ++it) { + for(auto it = children.begin(); it != children.end(); ++it) { (*it)->width = width - 5; (*it)->y = curY; diff --git a/src/client/gui/components/OptionsGroup.h b/src/client/gui/components/OptionsGroup.h index ac90e3d..bb284fa 100755 --- a/src/client/gui/components/OptionsGroup.h +++ b/src/client/gui/components/OptionsGroup.h @@ -1,16 +1,16 @@ -#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ -#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ - -//package net.minecraft.client.gui; - -#include -#include "GuiElementContainer.h" -#include "ScrollingPane.h" -#include "../../Options.h" - -class Font; -class Minecraft; - +#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ +#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__ + +//package net.minecraft.client.gui; + +#include +#include "GuiElementContainer.h" +#include "ScrollingPane.h" +#include "../../Options.h" + +class Font; +class Minecraft; + class OptionsGroup: public GuiElementContainer { typedef GuiElementContainer super; public: @@ -24,26 +24,26 @@ public: void scrollByPixels(float deltaY); bool isScrollingGestureActive() const; protected: - - void createToggle(OptionId optId, Minecraft* minecraft); - void createProgressSlider(OptionId optId, Minecraft* minecraft); - void createStepSlider(OptionId optId, Minecraft* minecraft); - void createTextbox(OptionId optId, Minecraft* minecraft); + + void createToggle(OptionId optId, Minecraft* minecraft); + void createProgressSlider(OptionId optId, Minecraft* minecraft); + void createStepSlider(OptionId optId, Minecraft* minecraft); + void createTextbox(OptionId optId, Minecraft* minecraft); void createKey(OptionId optId, Minecraft* minecraft); std::string label; - int contentHeight; - float scrollOffsetY; - float maxScrollOffsetY; - bool trackingScrollGesture; - bool scrollingGesture; - bool touchDispatched; - int dragStartX; - int dragStartY; - int lastDragY; - int touchStartX; - int touchStartY; + int contentHeight = 0; + float scrollOffsetY = 0.f; + float maxScrollOffsetY = 0.f; + bool trackingScrollGesture = false; + bool scrollingGesture = false; + bool touchDispatched = false; + int dragStartX = 0; + int dragStartY = 0; + int lastDragY = 0; + int touchStartX = 0; + int touchStartY = 0; static const int ScrollStartThreshold = 5; }; - -#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__*/ + +#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__OptionsGroup_H__*/ -- 2.47.3