diff --git a/inc/hgl/type/Size2.h b/inc/hgl/type/Size2.h new file mode 100644 index 0000000..b89d7b3 --- /dev/null +++ b/inc/hgl/type/Size2.h @@ -0,0 +1,46 @@ +#pragma once + +#include + +namespace hgl +{ + /** + * 尺寸模板 + */ + template struct Size2 + { + T width,height; + + public: + + Size2() + { + width=height=0; + } + + Size2(const T &w,const T &h) + { + width=w; + height=h; + } + + const bool isLandscape()const{return width>height;} ///<是否横的 + const bool isPortrait()const{return width Swapped(){return Size2(height,width);} ///<获取一个横竖交换的尺寸 + };//template struct Size2 + + using Size2i =Size2; + using Size2ui =Size2; + using Size2s =Size2; + using Size2us =Size2; + using Size2f =Size2; + using Size2d =Size2; +}//namespace hgl