Created
July 23, 2017 10:52
-
-
Save dev001hajipro/ced0fb022ca47111803e90e592efcf3b to your computer and use it in GitHub Desktop.
OpenSiv3Dで簡単なポリゴンを表示。
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> // OpenSiv3D v0.1.5 | |
// Polygonクラスを使った描画例と、 | |
// 頂点配列とPolygonクラスを組み合わせた例。 | |
void Main() | |
{ | |
Window::Resize(1280, 720); | |
const Font font(30); | |
// OpenSiv3Dにはポリゴンクラスが用意されているので多角形を作れます。 | |
const Polygon polygon | |
{ | |
{ 0, 0 }, { 110, 0 }, | |
{ 100, 100 }, { 10, 100 }, | |
}; | |
Array<Vec2> vertices = { | |
{ 0, 0 },{ 110, 0 }, | |
{ 100, 100 },{ 10, 100 }, | |
}; | |
while (System::Update()) { | |
font(L"ポリゴンを表示").drawAt(Window::Center().x, Window::Height() - 50); | |
// あらかじめ用意したPolygonを描画。 | |
polygon.draw(Palette::White); | |
// 頂点配列(vertices)を使った例。 | |
// drawFrameメソッドを使うと、フレーム(線)のみを表示できます。 | |
Polygon(vertices).moveBy(Window::Center()).drawFrame(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment