# include <Siv3D.hpp> // OpenSiv3D v0.6.10
Vec2 ConvertMath2Screen(Vec2 _point)
{
Vec2 resultPoint;
Vec2 halfScrSize = { Scene::Width() / 2.0, Scene::Height() / 2.0 };
resultPoint.x = _point.x+halfScrSize.x;
resultPoint.y = Scene::Height() - (_point.y + halfScrSize.y);
return resultPoint;
}
void DrawAxis()
{
Vec2 halfScrSize = { Scene::Width() / 2.0, Scene::Height() / 2.0 };
Vec2 xAxisStart = { 0, halfScrSize.y };
Vec2 xAxisEnd = { Scene::Width() , halfScrSize.y };
Vec2 yAxisStart = { halfScrSize.x, Scene::Height() };
Vec2 yAxisEnd = { halfScrSize.x, 0 };
Line{ xAxisStart, xAxisEnd }.drawArrow( 2, Vec2{5,5}, Palette::Black );
Line{ yAxisStart, yAxisEnd }.drawArrow(2, Vec2{ 5,5 }, Palette::Black);
}
//車の基本方向を表すベクトル Vec2 sVec{0, 1};
//車の位置 位置ベクトル Vec2
//車の向き 回転角度 double
void Main()
{
// 背景の色を設定する | Set the background color
Scene::SetBackground(ColorF{ 0.6, 0.8, 0.7 });
// 絵文字からテクスチャを作成する | Create a texture from an emoji
const Texture emoji{ U"🦖"_emoji };
// 太文字のフォントを作成する | Create a bold font with MSDF method
const Font font{ FontMethod::MSDF, 48, Typeface::Bold };
// テキストに含まれる絵文字のためのフォントを作成し、font に追加する | Create a font for emojis in text and add it to font as a fallback
const Font emojiFont{ 48, Typeface::ColorEmoji };
font.addFallback(emojiFont);
TextureAsset::Register(U"CAR", U"car.png");
Vec2 origin{ 0,0 };
Vec2 sOrigin = ConvertMath2Screen(origin);
Print << sOrigin;
Texture carImg = TextureAsset(U"CAR");
while (System::Update())
{
DrawAxis();
carImg.resized({64,64}).drawAt(sOrigin);
}
}