diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/FlippedIcon.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/FlippedIcon.cpp')
| -rw-r--r-- | Minecraft.World/FlippedIcon.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
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); +} |
