From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/FlippedIcon.cpp | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Minecraft.World/FlippedIcon.cpp (limited to 'Minecraft.World/FlippedIcon.cpp') diff --git a/Minecraft.World/FlippedIcon.cpp b/Minecraft.World/FlippedIcon.cpp new file mode 100644 index 00000000..559423d7 --- /dev/null +++ b/Minecraft.World/FlippedIcon.cpp @@ -0,0 +1,88 @@ +#include "stdafx.h" +#include "FlippedIcon.h" +#include "SharedConstants.h" + +FlippedIcon::FlippedIcon(Icon *base, bool horizontal, bool vertical) : base(base), horizontal(horizontal), vertical(vertical) +{ +} + +int FlippedIcon::getX() const +{ + return base->getX(); +} + +int FlippedIcon::getY() const +{ + return base->getY(); +} + +int FlippedIcon::getWidth() const +{ + return base->getWidth(); +} + +int FlippedIcon::getHeight() const +{ + return base->getHeight(); +} + +float FlippedIcon::getU0(bool adjust/*=false*/) const +{ + if (horizontal) return base->getU1(adjust); + return base->getU0(adjust); +} + +float FlippedIcon::getU1(bool adjust/*=false*/) const +{ + if (horizontal) return base->getU0(adjust); + return base->getU1(adjust); +} + +float FlippedIcon::getU(double offset, bool adjust/*=false*/) const +{ + float diff = getU1(adjust) - getU0(adjust); + return getU0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); +} + +float FlippedIcon::getV0(bool adjust/*=false*/) const +{ + if (vertical) return base->getV0(adjust); + return base->getV0(adjust); +} + +float FlippedIcon::getV1(bool adjust/*=false*/) const +{ + if (vertical) return base->getV0(adjust); + return base->getV1(adjust); +} + +float FlippedIcon::getV(double offset, bool adjust/*=false*/) const +{ + float diff = getV1(adjust) - getV0(adjust); + return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION)); +} + +wstring FlippedIcon::getName() const +{ + return base->getName(); +} + +int FlippedIcon::getSourceWidth() const +{ + return base->getSourceWidth(); +} + +int FlippedIcon::getSourceHeight() const +{ + return base->getSourceHeight(); +} + +int FlippedIcon::getFlags() const +{ + return base->getFlags(); +} + +void FlippedIcon::setFlags(int flags) +{ + base->setFlags(flags); +} -- cgit v1.2.3