# include // OpenSiv3D v0.6.10 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 }; Font font{ 40 }; Texture dice[6] = { Texture{U"d1.png"} ,Texture{U"d2.png"} ,Texture{U"d3.png"} ,Texture{U"d4.png"} ,Texture{U"d5.png"} ,Texture{U"d6.png"} }; Console.open(); int i = 0; int j = 0; Vec2 point = { 32,32 }; Vec2 dice_size = { 64,64 }; int diceNum = 0;//賽の目 bool isButtonPushed = false; while (System::Update()) { Print << i; i++; //std::cout << i; if (isButtonPushed == false) { if (i % 30 == 0) j++; diceNum = j % 6 + 1; } Print << U"DiceNum=" << diceNum; if (font(U"START").draw(32, 145, Palette::Palevioletred).leftClicked()) { if (isButtonPushed == true) isButtonPushed = false; } if (font(U"STOP").draw(32, 100, Palette::Darkblue).leftClicked()) { isButtonPushed = true; } dice[j%6].resized(dice_size).draw(point); //サイコロを振ってスタートからゴールまでキャラを動かすループを考える } }