-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
917bb13
commit a654c4b
Showing
14 changed files
with
510 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//----------------------------------------------- | ||
// | ||
// This file is part of the Siv3D Engine. | ||
// | ||
// Copyright (c) 2008-2023 Ryo Suzuki | ||
// Copyright (c) 2016-2023 OpenSiv3D Project | ||
// | ||
// Licensed under the MIT License. | ||
// | ||
//----------------------------------------------- | ||
|
||
# pragma once | ||
# include "../Common.hpp" | ||
# include "../PointVector.hpp" | ||
# include "../ColorHSV.hpp" | ||
# include "UIElement.hpp" | ||
|
||
namespace s3d | ||
{ | ||
inline namespace UI1 | ||
{ | ||
class ColorRect final : public UIElement | ||
{ | ||
public: | ||
|
||
SIV3D_NODISCARD_CXX20 | ||
ColorRect() = default; | ||
|
||
SIV3D_NODISCARD_CXX20 | ||
explicit ColorRect(const SizeF& size, const ColorF& color = ColorF{ 1.0 }); | ||
|
||
[[nodiscard]] | ||
static std::shared_ptr<ColorRect> Create(const SizeF& size, const ColorF& color = ColorF{ 1.0 }); | ||
|
||
private: | ||
|
||
[[nodiscard]] | ||
SizeF getSize() const noexcept override; | ||
|
||
void onDraw() const override; | ||
|
||
SizeF m_size = { 0, 0 }; | ||
|
||
ColorF m_color = ColorF{ 1.0 }; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//----------------------------------------------- | ||
// | ||
// This file is part of the Siv3D Engine. | ||
// | ||
// Copyright (c) 2008-2023 Ryo Suzuki | ||
// Copyright (c) 2016-2023 OpenSiv3D Project | ||
// | ||
// Licensed under the MIT License. | ||
// | ||
//----------------------------------------------- | ||
|
||
# include <Siv3D/UI1/ColorRect.hpp> | ||
# include <Siv3D/2DShapes.hpp> | ||
|
||
namespace s3d | ||
{ | ||
namespace UI1 | ||
{ | ||
ColorRect::ColorRect(const SizeF& size, const ColorF& color) | ||
: m_size{ size } | ||
, m_color{ color } {} | ||
|
||
std::shared_ptr<ColorRect> ColorRect::Create(const SizeF& size, const ColorF& color) | ||
{ | ||
return std::make_shared<ColorRect>(size, color); | ||
} | ||
|
||
SizeF ColorRect::getSize() const noexcept | ||
{ | ||
return m_size; | ||
} | ||
|
||
void ColorRect::onDraw() const | ||
{ | ||
RectF{ m_size }.draw(m_color); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.