载入中...
搜索中...
未找到
Quad.cpp
浏览该文件的文档.
1#include "graphics/Quad.h"
2
3namespace eve::graphics {
4
5Quad::Quad() = default;
6
7Quad::Quad(int x_, int y_, int w_, int h_) { setViewport(x_, y_, w_, h_); }
8
9Quad::~Quad() = default;
10
11void Quad::setViewport(int x_, int y_, int w_, int h_) {
12 x = x_;
13 y = y_;
14 w = w_ > 0 ? w_ : 0;
15 h = h_ > 0 ? h_ : 0;
16}
17
18void Quad::getUV(int texW, int texH, float &u0, float &v0, float &u1, float &v1) const {
19 if (texW <= 0 || texH <= 0 || w <= 0 || h <= 0) {
20 u0 = 0.f;
21 v0 = 0.f;
22 u1 = 1.f;
23 v1 = 1.f;
24 return;
25 }
26 const float tw = float(texW);
27 const float th = float(texH);
28 u0 = float(x) / tw;
29 v0 = float(y) / th;
30 u1 = float(x + w) / tw;
31 v1 = float(y + h) / th;
32}
33
34} // namespace eve::graphics
void getUV(int texW, int texH, float &u0, float &v0, float &u1, float &v1) const
Convert pixel rect to normalized UVs for a texture of size texW×texH.
Definition Quad.cpp:18
void setViewport(int x, int y, int w, int h)
Definition Quad.cpp:11
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition AnimTrail.h:6