Created
September 11, 2016 02:37
-
-
Save voidproc/f6047e8eb0e1797041fe2f92e36900a2 to your computer and use it in GitHub Desktop.
Circle::drawFrame + RenderTexture
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
#include <Siv3D.hpp> | |
void Main() | |
{ | |
const Size windowSize(640, 480); | |
const Color bg = Palette::Black; | |
RenderTexture renderTexture(windowSize.x / 2, windowSize.y, bg); | |
Window::Resize(windowSize); | |
Graphics::SetBackground(bg); | |
Graphics2D::SetSamplerState(SamplerState::ClampLinear); | |
while (System::Update()) | |
{ | |
PutText(L"RenderTexture").at(windowSize.x * 3 / 4, 50); | |
PutText(L"Default").at(windowSize.x * 1 / 4, 50); | |
// (1) RenderTexture | |
Graphics2D::SetRenderTarget(renderTexture); | |
Rect(renderTexture.size).draw(bg); // 背景をクリア | |
Circle(windowSize.x / 4.0, windowSize.y / 2.0, 100.0).drawFrame(5.0, 0.0); | |
Circle(windowSize.x / 4.0, windowSize.y / 2.0, 70.0).draw(); | |
Graphics2D::SetRenderTarget(Graphics::GetSwapChainTexture()); | |
renderTexture.draw(windowSize.x / 2, 0); | |
// (2) Default | |
Circle(windowSize.x / 4.0 + Random(-100, 100), windowSize.y / 2.0, 100.0).drawFrame(5.0); | |
Circle(windowSize.x / 4.0, windowSize.y / 2.0, 70.0).draw(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment