parent
fcf49f83e5
commit
2dc4c04482
|
|
@ -28,7 +28,7 @@ namespace kiwano
|
|||
class ActionManager;
|
||||
|
||||
class KGE_API Action
|
||||
: public virtual Object
|
||||
: public Object
|
||||
, protected IntrusiveListItem<ActionPtr>
|
||||
{
|
||||
friend class ActionManager;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace kiwano
|
|||
{
|
||||
// ÐòÁÐÖ¡
|
||||
class KGE_API Frames
|
||||
: public virtual Object
|
||||
: public Object
|
||||
{
|
||||
public:
|
||||
Frames();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace kiwano
|
|||
{
|
||||
// 섯부녜蹶
|
||||
class KGE_API Geometry
|
||||
: public virtual Object
|
||||
: public Object
|
||||
{
|
||||
friend class Canvas;
|
||||
friend class GeometryNode;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace kiwano
|
|||
{
|
||||
// ͼƬ
|
||||
class KGE_API Image
|
||||
: public virtual Object
|
||||
: public Object
|
||||
{
|
||||
public:
|
||||
Image();
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace kiwano
|
|||
|
||||
// 节点
|
||||
class KGE_API Node
|
||||
: public virtual Object
|
||||
: public Object
|
||||
, public TimerManager
|
||||
, public ActionManager
|
||||
, public EventDispatcher
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace kiwano
|
|||
|
||||
// 场景过渡
|
||||
class KGE_API Transition
|
||||
: public virtual Object
|
||||
: public Object
|
||||
{
|
||||
friend class Application;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace kiwano
|
|||
|
||||
// 音乐对象
|
||||
class KGE_API Sound
|
||||
: public virtual Object
|
||||
: public Object
|
||||
{
|
||||
public:
|
||||
Sound();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace kiwano
|
|||
|
||||
// 事件监听器
|
||||
class KGE_API EventListener
|
||||
: public virtual Object
|
||||
: public Object
|
||||
, protected IntrusiveListItem<EventListenerPtr>
|
||||
{
|
||||
friend class EventDispatcher;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace kiwano
|
|||
|
||||
// 定时任务
|
||||
class KGE_API Timer
|
||||
: public virtual Object
|
||||
: public Object
|
||||
, protected IntrusiveListItem<TimerPtr>
|
||||
{
|
||||
friend class TimerManager;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ namespace kiwano
|
|||
{}
|
||||
|
||||
RectT(
|
||||
const Vec2& pos,
|
||||
const Vec2& size
|
||||
const Vec2T<value_type>& pos,
|
||||
const Vec2T<value_type>& size
|
||||
)
|
||||
: origin(pos.x, pos.y)
|
||||
, size(size.x, size.y)
|
||||
|
|
@ -75,36 +75,38 @@ namespace kiwano
|
|||
return (origin == rect.origin) && (size == rect.size);
|
||||
}
|
||||
|
||||
inline void Set(value_type x, value_type y, value_type width, value_type height) { origin = Vec2{ x, y }; size = Vec2{ width, height }; }
|
||||
inline void Set(value_type x, value_type y, value_type width, value_type height)
|
||||
{
|
||||
origin = Vec2T<value_type>{ x, y };
|
||||
size = Vec2T<value_type>{ width, height };
|
||||
}
|
||||
|
||||
inline Vec2 GetCenter() const { return Vec2{ origin.x + size.x / 2, origin.y + size.y / 2 }; }
|
||||
inline Vec2T<value_type> GetCenter() const { return Vec2T<value_type>{ origin.x + size.x / 2, origin.y + size.y / 2 }; }
|
||||
|
||||
inline Vec2 GetLeftTop() const { return origin; }
|
||||
inline Vec2T<value_type> GetLeftTop() const { return origin; }
|
||||
|
||||
inline Vec2 GetRightBottom() const { return Vec2{ GetRight(), GetBottom() }; }
|
||||
inline Vec2T<value_type> GetRightBottom() const { return Vec2T<value_type>{ GetRight(), GetBottom() }; }
|
||||
|
||||
inline Vec2 GetRightTop() const { return Vec2{ GetRight(), GetTop() }; }
|
||||
inline Vec2T<value_type> GetRightTop() const { return Vec2T<value_type>{ GetRight(), GetTop() }; }
|
||||
|
||||
inline Vec2 GetLeftBottom() const { return Vec2{ GetLeft(), GetBottom() }; }
|
||||
inline Vec2T<value_type> GetLeftBottom() const { return Vec2T<value_type>{ GetLeft(), GetBottom() }; }
|
||||
|
||||
inline value_type GetLeft() const { return origin.x; }
|
||||
inline value_type GetLeft() const { return origin.x; }
|
||||
|
||||
inline value_type GetTop() const { return origin.y; }
|
||||
inline value_type GetTop() const { return origin.y; }
|
||||
|
||||
inline value_type GetRight() const { return origin.x + size.x; }
|
||||
inline value_type GetRight() const { return origin.x + size.x; }
|
||||
|
||||
inline value_type GetBottom() const { return origin.y + size.y; }
|
||||
inline value_type GetBottom() const { return origin.y + size.y; }
|
||||
|
||||
inline bool IsEmpty() const { return origin.IsOrigin() && size.IsOrigin(); }
|
||||
inline bool IsEmpty() const { return origin.IsOrigin() && size.IsOrigin(); }
|
||||
|
||||
// 判断点是否在矩形内
|
||||
inline bool ContainsPoint(const Vec2& point) const
|
||||
inline bool ContainsPoint(const Vec2T<value_type>& point) const
|
||||
{
|
||||
return point.x >= origin.x && point.x <= (origin.x + size.x) &&
|
||||
point.y >= origin.y && point.y <= (origin.y + size.y);
|
||||
}
|
||||
|
||||
// 判断两矩形是否相交
|
||||
inline bool Intersects(const RectT& rect) const
|
||||
{
|
||||
return !((origin.x + size.x) < rect.origin.x ||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,34 @@ namespace kiwano
|
|||
return Vec2T(-x, -y);
|
||||
}
|
||||
|
||||
inline Vec2T& operator += (const Vec2T& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline Vec2T& operator -= (const Vec2T& other)
|
||||
{
|
||||
x -= other.x;
|
||||
y -= other.y;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline Vec2T& operator *= (value_type val)
|
||||
{
|
||||
x *= val;
|
||||
y *= val;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline Vec2T& operator /= (value_type val)
|
||||
{
|
||||
x /= val;
|
||||
y /= val;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline bool operator== (const Vec2T& other) const
|
||||
{
|
||||
return (x == other.x) && (y == other.y);
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ namespace kiwano
|
|||
_In_ ComPtr<ID2D1Bitmap1> const& target
|
||||
);
|
||||
|
||||
inline ID2D1Factory1* GetD2DFactory() const { return d2d_factory_.Get(); }
|
||||
inline IWICImagingFactory* GetWICImagingFactory() const { return imaging_factory_.Get(); }
|
||||
inline IDWriteFactory* GetDWriteFactory() const { return dwrite_factory_.Get(); }
|
||||
inline ID2D1Device* GetD2DDevice() const { return d2d_device_.Get(); }
|
||||
inline ID2D1DeviceContext* GetD2DDeviceContext() const { return d2d_device_context_.Get(); }
|
||||
inline ID2D1Bitmap1* GetD2DTargetBitmap() const { return d2d_target_bitmap_.Get(); }
|
||||
inline ID2D1Factory1* GetD2DFactory() const { KGE_ASSERT(d2d_factory_); return d2d_factory_.Get(); }
|
||||
inline IWICImagingFactory* GetWICImagingFactory() const { KGE_ASSERT(imaging_factory_); return imaging_factory_.Get(); }
|
||||
inline IDWriteFactory* GetDWriteFactory() const { KGE_ASSERT(dwrite_factory_); return dwrite_factory_.Get(); }
|
||||
inline ID2D1Device* GetD2DDevice() const { KGE_ASSERT(d2d_device_); return d2d_device_.Get(); }
|
||||
inline ID2D1DeviceContext* GetD2DDeviceContext() const { KGE_ASSERT(d2d_device_context_); return d2d_device_context_.Get(); }
|
||||
inline ID2D1Bitmap1* GetD2DTargetBitmap() const { KGE_ASSERT(d2d_target_bitmap_); return d2d_target_bitmap_.Get(); }
|
||||
|
||||
ID2D1StrokeStyle* GetStrokeStyle(StrokeStyle stroke) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ namespace kiwano
|
|||
|
||||
void DiscardResources();
|
||||
|
||||
inline ID3D10Device* GetD3DDevice() const { return d3d_device_.Get(); }
|
||||
inline ID3D10Device* GetD3DDeviceContext() const { return d3d_device_.Get(); }
|
||||
inline ID3D10RenderTargetView* GetD3DRenderTargetView() const { return d3d_rt_view_.Get(); }
|
||||
inline ID3D10DepthStencilView* GetD3DDepthStencilView() const { return d3d_ds_view_.Get(); }
|
||||
inline IDXGIFactory* GetDXGIFactory() const { return dxgi_factory_.Get(); }
|
||||
inline IDXGISwapChain* GetDXGISwapChain() const { return dxgi_swap_chain_.Get(); }
|
||||
inline ID3D10Device* GetD3DDevice() const { KGE_ASSERT(d3d_device_); return d3d_device_.Get(); }
|
||||
inline ID3D10Device* GetD3DDeviceContext() const { KGE_ASSERT(d3d_device_); return d3d_device_.Get(); }
|
||||
inline ID3D10RenderTargetView* GetD3DRenderTargetView() const { KGE_ASSERT(d3d_rt_view_); return d3d_rt_view_.Get(); }
|
||||
inline ID3D10DepthStencilView* GetD3DDepthStencilView() const { KGE_ASSERT(d3d_ds_view_); return d3d_ds_view_.Get(); }
|
||||
inline IDXGIFactory* GetDXGIFactory() const { KGE_ASSERT(dxgi_factory_); return dxgi_factory_.Get(); }
|
||||
inline IDXGISwapChain* GetDXGISwapChain() const { KGE_ASSERT(dxgi_swap_chain_); return dxgi_swap_chain_.Get(); }
|
||||
|
||||
inline Size const& GetLogicalSize() const { return logical_size_; }
|
||||
inline Size const& GetOutputSize() const { return output_size_; }
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ namespace kiwano
|
|||
|
||||
void DiscardResources();
|
||||
|
||||
inline ID3D11Device* GetD3DDevice() const { return d3d_device_.Get(); }
|
||||
inline ID3D11DeviceContext* GetD3DDeviceContext() const { return d3d_device_context_.Get(); }
|
||||
inline ID3D11RenderTargetView* GetD3DRenderTargetView() const { return d3d_rt_view_.Get(); }
|
||||
inline ID3D11DepthStencilView* GetD3DDepthStencilView() const { return d3d_ds_view_.Get(); }
|
||||
inline IDXGIFactory* GetDXGIFactory() const { return dxgi_factory_.Get(); }
|
||||
inline IDXGISwapChain* GetDXGISwapChain() const { return dxgi_swap_chain_.Get(); }
|
||||
inline ID3D11Device* GetD3DDevice() const { KGE_ASSERT(d3d_device_); return d3d_device_.Get(); }
|
||||
inline ID3D11DeviceContext* GetD3DDeviceContext() const { KGE_ASSERT(d3d_device_context_); return d3d_device_context_.Get(); }
|
||||
inline ID3D11RenderTargetView* GetD3DRenderTargetView() const { KGE_ASSERT(d3d_rt_view_); return d3d_rt_view_.Get(); }
|
||||
inline ID3D11DepthStencilView* GetD3DDepthStencilView() const { KGE_ASSERT(d3d_ds_view_); return d3d_ds_view_.Get(); }
|
||||
inline IDXGIFactory* GetDXGIFactory() const { KGE_ASSERT(dxgi_factory_); return dxgi_factory_.Get(); }
|
||||
inline IDXGISwapChain* GetDXGISwapChain() const { KGE_ASSERT(dxgi_swap_chain_); return dxgi_swap_chain_.Get(); }
|
||||
|
||||
inline D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return d3d_feature_level_; }
|
||||
inline Size const& GetLogicalSize() const { return logical_size_; }
|
||||
|
|
|
|||
|
|
@ -151,11 +151,11 @@ namespace kiwano
|
|||
|
||||
inline Size const& GetOutputSize() const { return output_size_; }
|
||||
|
||||
inline DeviceResources* GetDeviceResources() const { return device_resources_.Get(); }
|
||||
inline DeviceResources* GetDeviceResources() const { KGE_ASSERT(device_resources_); return device_resources_.Get(); }
|
||||
|
||||
inline ITextRenderer* GetTextRenderer() const { return text_renderer_.Get(); }
|
||||
inline ITextRenderer* GetTextRenderer() const { KGE_ASSERT(text_renderer_); return text_renderer_.Get(); }
|
||||
|
||||
inline ID2D1SolidColorBrush* GetSolidColorBrush() const { return solid_color_brush_.Get(); }
|
||||
inline ID2D1SolidColorBrush* GetSolidColorBrush() const { KGE_ASSERT(solid_color_brush_); return solid_color_brush_.Get(); }
|
||||
|
||||
private:
|
||||
Renderer();
|
||||
|
|
|
|||
Loading…
Reference in New Issue