Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement