{"id":8994,"date":"2017-12-12T15:42:55","date_gmt":"2017-12-12T06:42:55","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=8994"},"modified":"2017-12-30T17:29:30","modified_gmt":"2017-12-30T08:29:30","slug":"lattepanda-%e3%81%a8-siv3d%ef%bc%88%e4%bb%ae%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/8994","title":{"rendered":"LattePanda \u3068 Siv3D\uff08\u4eee\uff09"},"content":{"rendered":"<p>\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u306f <a href=\"https:\/\/qiita.com\/advent-calendar\/2017\/siv3d\">Siv3D Advent Calendar 2017 &#8211; Qiita<\/a> \u306e 12 \u65e5\u76ee\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3067\u3059\u3002\u524d\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u306f\u3001para7 \u3055\u3093\u306e <a href=\"https:\/\/qiita.com\/para7\/items\/fe16e75fca7ae4e974e6\">OpenSiv3D\u306e\u30c8\u30e9\u30f3\u30d7\u63cf\u753b\u6a5f\u80fd(PlayingCard) <\/a>\u3067\u3059\u3002<\/p>\n<h2>LattePanda \u3068\u306f<\/h2>\n<p>\u5510\u7a81\u3067\u3059\u304c\u3001LattePanda \u3068\u3044\u3046\u7d44\u307f\u8fbc\u307f\u30dc\u30fc\u30c9\u304c\u3042\u308a\u307e\u3059\u3002\u7d44\u307f\u8fbc\u307f\u30dc\u30fc\u30c9\u3068\u3044\u3046\u3068Raspberry Pi \u304c\u6709\u540d\u3060\u3063\u305f\u308a\u3001\u3082\u3063\u3068\u5c0f\u3055\u304f\u3084\u308d\u3046\u3068\u601d\u3046\u3068 Arduino \u304c\u826f\u304b\u3063\u305f\u308a\u3068\u3044\u3046\u306e\u3082\u3042\u308b\u306e\u3067\u3059\u304c\u3001Raspberry Pi \u306f OS \u304c Rasbian \u3068\u3044\u3046 Linux \u3067\u3042\u3063\u305f\u308a\u3001Arduino \u306e\u5834\u5408\u306f\u305d\u3082\u305d\u3082 OS \u304c\u7121\u304b\u3063\u305f\u308a\u3068\u3044\u3046\u7279\u5fb4\u304c\u3042\u308a\u307e\u3059\u3002\u3058\u3083\u3042\u3001LattePanda \u306f\u306a\u3093\u3058\u3083\uff1f\u3068\u3044\u3046\u3068\u3001<\/p>\n<ul>\n<li>Arduino \u306e\u3088\u3046\u306a GPIO \u30d4\u30f3\u3092\u6301\u3063\u3066\u3044\u3066<\/li>\n<li>Windows 10 \u304c\u52d5\u304f<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u7279\u5fb4\u3092\u6301\u3064\u30dc\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/image_thumb-9.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"640\" height=\"480\" style=\"margin: 0px; border: 0px currentcolor; display: inline; background-image: none;\" \/><\/a><\/p>\n<p>\u307e\u3042\u3001\u3055\u3063\u305d\u304f\u7a2e\u660e\u304b\u3057\u3092\u3057\u3066\u3057\u307e\u3048\u3070\u3001Windows 10 \u304c\u52d5\u304f\u30dc\u30fc\u30c9\u3068 Arduino \u304c I2C \u3067\u304f\u3063\u3064\u3044\u3066\u3044\u308b\u3060\u3051\u306e\u30dc\u30fc\u30c9\u306a\u306e\u3067\u3001\u666e\u901a\u306e\u30ce\u30fc\u30c8 PC \u3068 Arduino \u3092 USB \u30b1\u30fc\u30d6\u30eb\u3067\u63a5\u7d9a\u3057\u3066\u3057\u307e\u3048\u3070\u540c\u3058\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4e2d\u53e4\u306a\u30ce\u30fc\u30c8PC\u3092\u8cb7\u3063\u3066\u3001\u683c\u5b89\u306a Arduino \u3092\u8cb7\u3048\u3070\u30e2\u30cb\u30bf\u4ed8\u304d\u3067\uff08\u5f53\u7136 LattePanda \u306b\u306f\u30e2\u30cb\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\uff09\u7d44\u307f\u8fbc\u307f\u306a\u74b0\u5883\u304c\u6574\u3048\u3089\u308c\u308b\u306e\u3067\u3001\u3058\u3083\u3042 LattePanda \u3092\u4f7f\u3046\u610f\u5473\u304c\u3042\u308b\u306e\u304b\uff1f\u3068\u3044\u3046\u554f\u984c\u306f\u591a\u3005\u3042\u308b\u306e\u3067\u3059\u304c\u3001<\/p>\n<ul>\n<li>\u5927\u304d\u3055\u304c\u30e9\u30ba\u30d1\u30a4\u4e26\u307f\u306b\u5c0f\u3055\u3044\uff08\u30e9\u30ba\u30d1\u30a4\u3088\u308a\u3082\u4e00\u56de\u308a\u5927\u304d\u3044\u7a0b\u5ea6\uff09<\/li>\n<li>\u96fb\u6e90\u304c USB micro \u3067 5V2A \u7a0b\u5ea6\u3067\u52d5\u304f<\/li>\n<li>\u30e2\u30cb\u30bf\u304c HDMI \u3067\u7e4b\u3052\u308b<\/li>\n<li>\u30d5\u30eb\u306a Windows 10 \u304c\u52d5\u304f<\/li>\n<\/ul>\n<p>\u5927\u304d\u3055\u304c\u30e9\u30ba\u30d1\u30a4\u4e26\u307f\u3068\u3044\u3046\u3053\u3068\u306f\u30e2\u30cb\u30bf\u3092\u5fc5\u8981\u3068\u3057\u306a\u3044\u5834\u5408\u306b\u306f\u3001\u5c55\u793a\u54c1\u306e\u8107\u306b\u304a\u3044\u3066\u5236\u5fa1\u3059\u308b\u3068\u304d\u306a\u3069\u5834\u6240\u304c\u5c0f\u3055\u304f\u3066\u6e08\u307f\u307e\u3059\u3002\u96fb\u6e90\u3082\u30ce\u30fc\u30c8PC\u306e\u3088\u3046\u306a\u7279\u6b8a\u306a\u30a2\u30c0\u30d7\u30bf\u3092\u5fc5\u8981\u3068\u305b\u305a\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u5145\u96fb\u5668\u3067\u5341\u5206\u3067\u3059\u3002\u3061\u306a\u307f\u306b\u3001\u30b9\u30de\u30db\u306e\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u3067\u52d5\u304b\u3059\u3053\u3068\u3082\u3067\u304d\u307e\u3059\uff08\u3082\u3061\u308d\u3093\u3001\u30d0\u30c3\u30c6\u30ea\u30fc\u5207\u308c\u306b\u306a\u308b\u3068 OS \u3054\u3068\u843d\u3061\u308b\u306e\u3067\u3001\u304b\u306a\u308a\u96e3\u70b9\u3067\u3059\u304c\uff09\u3002<\/p>\n<p>\u307e\u305f\u3001HDMI \u30b3\u30cd\u30af\u30bf\u304c\u3064\u3044\u3066\u3044\u308b\u306e\u3067\u3001\u5927\u62b5\u306e\u30e2\u30cb\u30bf\u306a\u3089\u3070\u884c\u3051\u307e\u3059\u3002\u79cb\u3054\u308d\u306b\u5b66\u7814\u30ef\u30fc\u30eb\u30c9\u30a2\u30a4\u3068\u3044\u3046\u7403\u578b\u30e2\u30cb\u30bf\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u5341\u5206\u3044\u3051\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u306a\u3093\u3068\u3044\u3063\u3066\u3082\u30d5\u30eb\u3067 Windows 10 \u304c\u52d5\u304f\u3068\u3044\u3046\u3053\u3068\u3067\u3057\u3087\u3046\u3002\u30e9\u30ba\u30d1\u30a4\uff0bWindows IoT Core \u3068\u3044\u3046\u7d44\u307f\u5408\u308f\u305b\u3082\u3042\u308b\u306e\u3067\u3059\u304c\uff08\u79c1\u3068\u3057\u3066\u306f\u3001\u305d\u308c\u306f\u305d\u308c\u3067\u4f7f\u3044\u3088\u3046\u304c\u3042\u308b\u306e\u3060\u3051\u308c\u3069\uff09\u3001\u3053\u306e\u5c0f\u3055\u3055\u3067\u30d5\u30eb\u306e Windows 10 \u304c\u52d5\u304f\u306e\u3067\u3042\u308c\u3070\u52d5\u4f5c\u3059\u308b\u30a2\u30d7\u30ea\u3092 UWP \u30a2\u30d7\u30ea\u306b\u3057\u306a\u304f\u3066\u3082\u3001Windows \u30a2\u30d7\u30ea\u306e\u307e\u307e\u3044\u3051\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u4fa1\u683c\u3068\u3057\u3066\u306f\u79cb\u6708 <a title=\"http:\/\/akizukidenshi.com\/catalog\/g\/gM-12549\/\" href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gM-12549\/\">http:\/\/akizukidenshi.com\/catalog\/g\/gM-12549\/<\/a> \u3067 14k \u4f4d\u3001\u76f4\u3067 DFROBOT <a title=\"https:\/\/www.dfrobot.com\/product-1405.html\" href=\"https:\/\/www.dfrobot.com\/product-1405.html\">https:\/\/www.dfrobot.com\/product-1405.html<\/a> \u304b\u3089\u8cb7\u3046\u3068 $120 \u4f4d\u306a\u306e\u3067\u3042\u307e\u308a\u5909\u308f\u308a\u307e\u305b\u3093\u3002\u79c1\u304c\u8cb7\u3063\u305f\u3068\u304d\u306f\u3001\u76f4\u3067\u8cb7\u3046\u3057\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u90f5\u9001\u6599\u304c\u639b\u304b\u308a\u307e\u3057\u305f\u304c\u3042\u307e\u308a\u5024\u6bb5\u306f\u5909\u308f\u3063\u3066\u3044\u306a\u3044\u30cf\u30ba\u3067\u3059\u3002<\/p>\n<h2>\u3068\u3044\u3046\u3053\u3068\u306f Siv3D \u304c\u52d5\u304f\u3068\u3044\u3046\u3053\u3068\u3060\u306a<\/h2>\n<p>\u30d5\u30eb\u3067 Windows 10 \u304c\u52d5\u304f\u3068\u3044\u3046\u3053\u3068\u306f DirectX \u3068\u304b\u306a\u3093\u304b\u9069\u5f53\u306a GPU \u7d61\u307f\u306e\u306a\u3093\u3068\u304b\u3082\u52d5\u304f\u306f\u305a\u3067\u3059\u3002\u305f\u3081\u3057\u306b\u3001OpenSiv3D \u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u52d5\u304b\u3057\u3066\u307f\u305f\u306e\u304c\u3001<a href=\"https:\/\/www.youtube.com\/watch?v=aub1rfZvN3g\">\u3053\u308c<\/a>\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/image_thumb-10.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"640\" height=\"371\" style=\"margin: 0px; border: 0px currentcolor; display: inline; background-image: none;\" \/><\/a><\/p>\n<p>\u7403\u578b\u30e2\u30cb\u30bf\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u8d70\u99ac\u71c8\u306e\u3088\u3046\u306a\u4e0d\u601d\u8b70\u306a\u3082\u306e\u304c\u3067\u304d\u307e\u3059\u306d\u3002\u307e\u3042\u3001\u8d70\u99ac\u71c8\u306e\u307b\u3046\u304c\u76f8\u5f53\u5b89\u3044\u3093\u3067\u3059\u304c\u3002\u305d\u308c\u306f\u8a00\u308f\u306a\u3044\u7d04\u675f\u3067\u3002<\/p>\n<p>\u3068\u3044\u3046\u8a33\u3067\u3001\u3053\u3046\u3044\u3046\u5c0f\u578b\u306e\u30dc\u30fc\u30c9\u3068 OpenSiv3D \u3042\u308b\u3044\u306f Siv3D \u306e\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u8a18\u8ff0\u304c\u624b\u8efd\u306a Siv3D \u3068\u30dc\u30fc\u30c9\u306e\u5c0f\u3055\u3055\uff08\u88cf\u306b\u96a0\u308c\u308b\u3068\u3044\u3046\u610f\u5473\u3067\uff09\u306e\u76f8\u4e57\u52b9\u679c\u3067\u4f55\u304b\u65b0\u3057\u3044\u9053\u304c\u958b\u3051\u308b\u306e\u3067\u306f\u306a\u3044\u304b\uff1f\uff08\u65b0\u3057\u304f\u306a\u304f\u3066\u3082\u3044\u3044\u3051\u3069\uff09\u3068\u601d\u3063\u305f\u6b21\u7b2c\u306a\u306e\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3058\u3083\u3042\u3001\u5177\u4f53\u7684\u306b\u4f55\u304b\uff1f\u3063\u3066\u306e\u3092\u30d7\u30ed\u30b0\u30e9\u30de\u306a\u3089\u3070\u30b3\u30fc\u30c9\u3092\u66f8\u304b\u306d\u3070\u3001\u3068\u601d\u3063\u3066\u305f\u3068\u3053\u308d\u306a\u306e\u3067\u3059\u304c\u306d\u3001\u3061\u3087\u3063\u3068\u5148\u9031\u306e\u571f\u66dc\u65e5\u306b\u5b50\u4f9b\u304b\u3089\u30a4\u30f3\u30d5\u30eb\u30a8\u30f3\u30b6\u3092\u79fb\u3055\u308c\u305f\u3089\u3057\u304f\u6c88\u6ca1\u3057\u3066\u304a\u308a\u307e\u3057\u3066\u3001\u73fe\u5728\u3082\u6c88\u6ca1\u4e2d\u3002\u3067\u3082\u3063\u3066\u3001\u5bdd\u306a\u304c\u3089\u8003\u3048\u3066\u3044\u305f\u30cd\u30bf\u304c\u3001hota1024 \u3055\u3093\u306e <a href=\"https:\/\/qiita.com\/hota1024\/items\/ac4e7c9afe47d1f2a596\">Siv3D\u306715\u30d1\u30ba\u30eb\u3092\u6975\u9650\u307e\u3067\u30cf\u30a4\u30af\u30aa\u30ea\u30c6\u30a3\u30fc\u306b\u3057\u3066\u307f\u308b<\/a> \u306b\u30cd\u30bf\u88ab\u308a\u3057\u3066\u3057\u307e\u3063\u305f\u3068\u3044\u3046\u3002\u8981\u306f\u30a2\u30ba\u30ec\u30f3\u306e16\u30d1\u30ba\u30eb\u309216\u30d1\u30ba\u30eb\u306b\u3059\u308b\u3068\u3044\u3046\u30cd\u30bf\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u2026\u3069\u3046\u3057\u305f\u3082\u306e\u304b\u3002<\/p>\n<p>\u305d\u3093\u306a\u8a33\u3067\u3001\u5f62\u3060\u3051\u3067\u3082\u30d0\u30c8\u30f3\u7684\u306b AkiraKoizumi \u3055\u3093\u306e\u300cSiv3D\u3067\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u6587\u5b57\u3092\u4f5c\u308b\u300d\u307e\u3067\u7e4b\u3052\u3066\u304a\u304d\u307e\u3059\u3002\u5b8c\u6cbb\u3057\u305f\u3089\u3001\u3053\u3053\u306e\u8a18\u4e8b\u3092\u5897\u3084\u3057\u3066\u304a\u304d\u307e\u3059\u306e\u3067\u3001\u3057\u3070\u3057\u304a\u5f85\u3061\u3092\u3001\u3067\u306f\u3002<\/p>\n<p>\u8ffd\u8a18\u00a02017\/12\/30<\/p>\n<p>\u5e30\u7701\u4e2d\u306b\u3001\u3048\u3044\u3063\u306825\u99d2\u306e\u30b9\u30e9\u30a4\u30c9\u30d1\u30ba\u30eb\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002LattePanda \u3092\u6301\u3063\u3066\u304f\u308b\u306e\u3092\u5fd8\u308c\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001LattePanda \u3067\u52d5\u304b\u3059\u5834\u5408\u306b\u306f\u3001\u3063\u3066\u306e\u306f\u5f8c\u304b\u3089\u66f8\u304d\u307e\u3059\u304c\u3002\u3072\u3068\u307e\u305a\u52d5\u4f5c\u3059\u308b\u30b3\u30fc\u30c9\u3060\u3051\u3092\u3056\u3063\u3068\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n# include &lt;Siv3D.hpp&gt; \/\/ OpenSiv3D v0.1.7\r\n\r\n\/\/ \u753b\u50cf\u3092\u6307\u5b9a\u4f4d\u7f6e\u3067\u30af\u30ea\u30c3\u30d7\u3059\u308b\r\ns3d::Image &amp;clip(const s3d::Image &amp;src, s3d::Image &amp;dest, int l, int t, int w, int h)\r\n{\r\n\tfor (int y = 0; y &lt; h; y++ ) {\r\n\t\tfor (int x = 0; x &lt; w; x++) {\r\n\t\t\tdest&#x5B;y]&#x5B;x] = src&#x5B;t + y]&#x5B;l + x];\r\n\t\t}\r\n\t}\r\n\treturn dest;\r\n}\r\n\r\n\/\/\/ \u30b9\u30e9\u30a4\u30c9\u30d1\u30ba\u30eb\u306e\u30dc\u30fc\u30c9\u30af\u30e9\u30b9\r\nclass Board {\r\n\r\n\tint xmax;\r\n\tint ymax;\r\n\tint cellWidth, cellHeight;\r\n\tstd::vector&lt;Texture*&gt; *_cells;\r\n\tstd::vector&lt;Texture*&gt; *_goal;\r\n\tImage *_image;\r\n\tTexture *_textrueOriginal;\r\n\tTexture *_blank;\r\n\r\npublic:\r\n\t\/\/\/ \u30dc\u30fc\u30c9\u306e\u521d\u671f\u5316\r\n\tBoard(int width, int height) {\r\n\t\txmax = width;\r\n\t\tymax = height;\r\n\t\t_cells = new std::vector&lt;Texture*&gt;(xmax * ymax);\r\n\t}\r\npublic:\r\n\t\/\/\/ \u753b\u50cf\u3092\u8a2d\u5b9a\u3059\u308b\r\n\tvoid setImage(const wchar_t *path) {\r\n\t\t_image = new Image(FilePath(String(path)));\r\n\t\t_textrueOriginal = new Texture(*_image);\r\n\r\n\t\tcellWidth = _image-&gt;width() \/ xmax;\r\n\t\tcellHeight = _image-&gt;height() \/ ymax;\r\n\t\tImage imageTemp(cellWidth, cellHeight);\r\n\t\tfor (int y = 0; y &lt; ymax; y++) {\r\n\t\t\tfor (int x = 0; x &lt; xmax; x++) {\r\n\t\t\t\tclip(*_image, imageTemp, x * cellWidth, y * cellHeight, cellWidth, cellHeight);\r\n\t\t\t\t_cells-&gt;at(x + y * xmax) = new Texture(imageTemp);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\/\/ 25\u679a\u76ee\u3060\u3051\u9ed2\u3067\u5857\u308a\u3064\u3076\u3057\r\n\t\tconst Image imageBlank(cellWidth, cellHeight, Color(100, 100, 100));\r\n\t\t_blank = _cells-&gt;at(xmax*ymax -1) = new Texture(imageBlank);\r\n\r\n\t\t\/\/ \u6700\u521d\u306e\u914d\u7f6e\u3092\u899a\u3048\u3066\u304a\u304f\r\n\t\t_goal = new std::vector&lt;Texture*&gt;();\r\n\t\tfor (auto it : *_cells) {\r\n\t\t\t_goal-&gt;push_back(it);\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/\/ \u30b7\u30e3\u30c3\u30d5\u30eb\r\n\tvoid shuffle()\r\n\t{\r\n\t\tstd::random_device seed_gen;\r\n\t\tstd::mt19937 engine(seed_gen());\r\n\t\tstd::shuffle(_cells-&gt;begin(), _cells-&gt;end(), engine);\r\n\t}\r\n\r\n\t\/\/\/ \u5b8c\u6210\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\r\n\tbool IsGoal() {\r\n\t\tbool same = true;\r\n\t\tfor (int i = 0; _cells-&gt;size(); i++) {\r\n\t\t\tif (_cells-&gt;at(i) != _goal-&gt;at(i)) {\r\n\t\t\t\tsame = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn same;\r\n\t}\r\n\r\n\t\/\/ \u30d6\u30e9\u30f3\u30af\u30bb\u30eb\u306e\u4f4d\u7f6e\u3092\u53d6\u5f97\r\n\ts3d::Point GetBlank() {\r\n\t\tfor (int y = 0; y &lt; ymax; y++) {\r\n\t\t\tfor (int x = 0; x &lt; xmax; x++) {\r\n\t\t\t\tif (_cells-&gt;at(x + y * xmax) == _blank) {\r\n\t\t\t\t\treturn s3d::Point(x, y);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\/\/ \u672c\u6765\u306f\u3053\u3053\u306b\u306f\u6765\u306a\u3044\r\n\t\treturn s3d::Point(0, 0);\r\n\t}\r\n\r\n\t\/\/ \u30d6\u30e9\u30f3\u30af\u306e\u30bb\u30eb\u3092\u52d5\u304b\u3059\r\n\tvoid MoveTo(int mx, int my)\r\n\t{\r\n\t\ts3d::Point pt = GetBlank();\r\n\t\ts3d::Point pt2 = s3d::Point(pt.x + mx, pt.y + my);\r\n\t\t\/\/ \u79fb\u52d5\u5148\u304c\u306f\u307f\u51fa\u3066\u3044\u306a\u3044\u3053\u3068\r\n\t\tif (pt2.x &lt; 0 || pt2.x &gt;= xmax) return;\r\n\t\tif (pt2.y &lt; 0 || pt2.y &gt;= ymax) return;\r\n\r\n\t\t\/\/ \u30bb\u30eb\u3092\u79fb\u52d5\u3055\u305b\u308b\r\n\t\t_cells-&gt;at(pt.x + pt.y * xmax) = _cells-&gt;at(pt2.x + pt2.y * xmax);\r\n\t\t_cells-&gt;at(pt2.x + pt2.y * xmax ) = _blank;\r\n\t}\r\n\r\n\t\/\/\/ \u30ad\u30fc\u64cd\u4f5c\u3092\u51e6\u7406\u3059\u308b\r\n\tvoid InputKey() {\r\n\t\tif (s3d::KeyUp.down()) this-&gt;MoveTo(    0,-1);\r\n\t\tif (s3d::KeyDown.down()) this-&gt;MoveTo(  0,+1);\r\n\t\tif (s3d::KeyLeft.down()) this-&gt;MoveTo( -1, 0);\r\n\t\tif (s3d::KeyRight.down()) this-&gt;MoveTo(+1, 0);\r\n\t}\r\n\t\/\/\/ \u30de\u30a6\u30b9\u64cd\u4f5c\u3092\u51e6\u7406\u3059\u308b\r\n\tvoid InputMouse() {\r\n\t\tif (s3d::MouseL.down()) {\r\n\t\t\tauto m = Cursor::Pos();\r\n\t\t\tauto b = s3d::Point( GetBlank().x * cellWidth, GetBlank().y * cellHeight );\r\n\t\t\tif (b.y &gt; m.y  &amp;&amp; ( b.x &lt;= m.x &amp;&amp; m.x &lt;= b.x + cellWidth ))\t\t\t \r\n\t\t\t\tthis-&gt;MoveTo(0, -1);\r\n\t\t\tif (b.y + cellHeight &lt; m.y &amp;&amp; (b.x &lt;= m.x &amp;&amp; m.x &lt;= b.x + cellWidth))\r\n\t\t\t\tthis-&gt;MoveTo(0, +1);\r\n\t\t\tif (b.x &gt; m.x &amp;&amp; (b.y &lt;= m.y &amp;&amp; m.y &lt;= b.y + cellHeight)) \r\n\t\t\t\tthis-&gt;MoveTo(-1, 0);\r\n\t\t\tif (b.x + cellWidth &lt; m.x &amp;&amp; (b.y &lt;= m.y &amp;&amp; m.y &lt;= b.y + cellHeight)) \r\n\t\t\t\tthis-&gt;MoveTo(1, 0);\r\n\t\t}\r\n\t}\r\n\t\/\/\/ \u73fe\u5728\u306e\u30dc\u30fc\u30c9\u3092\u63cf\u753b\u3059\u308b\r\n\tvoid Draw() {\r\n\t\tfor (int y = 0; y &lt; ymax; y++) {\r\n\t\t\tfor (int x = 0; x &lt; xmax; x++) {\r\n\t\t\t\t_cells-&gt;at(x + y * xmax)-&gt;draw(x * cellWidth, y * cellHeight);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\/\/\/ \u73fe\u5728\u306e\u30dc\u30fc\u30c9\u3092\u63cf\u753b\u3059\u308b\r\n\tvoid GoalDraw() {\r\n\t\t_textrueOriginal-&gt;draw();\r\n\t}\r\n};\r\n\r\nvoid Main()\r\n{\r\n\tGraphics::SetBackground(ColorF(0.8, 0.9, 1.0));\r\n\tconst Font font(50);\r\n\r\n\t\/\/ \u30dc\u30fc\u30c9\u306e\u4f5c\u6210\r\n\tBoard board(5, 5);\r\n\t\/\/ \u30dc\u30fc\u30c9\u306b\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u3080\r\n#define IMAGE L&amp;quot;C:\\\\Users\\\\masuda\\\\Pictures\\\\IMG_0139.jpg&amp;quot;\r\n#define IMAGE L&amp;quot;C:\\\\Users\\\\masuda\\\\Pictures\\\\azurlane001.jpg&amp;quot;\r\n\tboard.setImage(IMAGE);\r\n\t\/\/ \u914d\u5217\u3092\u30b7\u30e3\u30c3\u30d5\u30eb\r\n\tboard.shuffle();\r\n\r\n\twhile (System::Update())\r\n\t{\r\n\t\t\/\/ \u3059\u3079\u3066\u63c3\u3063\u3066\u3044\u308b\u304b\uff1f\r\n\t\tif ( board.IsGoal() ) {\r\n\t\t\t\/\/  \u63c3\u3063\u3066\u3044\u308c\u3070\u3001\u30b2\u30fc\u30e0\u7d42\u4e86\r\n\t\t\tboard.GoalDraw();\r\n\t\t\tfont(L&amp;quot;GOAL, Siv3D!&amp;quot;).drawAt(Window::Center(), Palette::Black);\r\n\t\t\tcontinue;\r\n\t\t} \r\n\r\n\t\t\/\/ \u30ad\u30fc\u5165\u529b\r\n\t\tboard.InputKey();\r\n\t\t\/\/ \u30de\u30a6\u30b9\u5165\u529b\r\n\t\tboard.InputMouse();\r\n\t\t\/\/ \u914d\u5217\u306b\u5f93\u3063\u3066\u3001\u753b\u50cf\u3092\u8868\u793a\r\n\t\tboard.Draw();\r\n\r\n\t\tfont(Cursor::Pos()).draw(20, 400, ColorF(0.6));\r\n\t\tCircle(Cursor::Pos(), 30).draw(ColorF(1, 0, 0, 0.5));\r\n\t}\r\n}\r\n\r\n<\/pre>\n<p>\u30b3\u30fc\u30c9\u81ea\u4f53\u306f\u3001200\u884c\u7a0b\u5ea6\u3067\u3059\u3002\u3042\u307e\u308a\u306b\u3082\u96d1\u306b\u66f8\u304d\u3059\u304e\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u30af\u30e9\u30b9\u306f\u30dc\u30fc\u30c9\u30af\u30e9\u30b9\uff08Board\uff09\u3057\u304b\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u307e\u3042\u3001\u307b\u3069\u3088\u304f\u52d5\u4f5c\u3057\u307e\u3059\u3002\u4e2d\u3067\u3001std::shuffle \u3057\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u306e\u3067\u672c\u5f53\u306b\u30b9\u30e9\u30a4\u30c9\u30b2\u30fc\u30e0\u304c\u5b8c\u6210\u3059\u308b\u306e\u304b\u306f\u4e0d\u660e&#8230;\u3068\u3044\u3046\u3072\u3069\u3044\u30b2\u30fc\u30e0\u3067\u3059\u304c\u3002<\/p>\n<p>\u5b9f\u306f\u3001OpenSiv3D \u3092\u304d\u3061\u3093\u3068\u66f8\u304f\u306e\u306f\uff08\u305f\u3063\u305f200\u884c\u3067\u3059\u304c\uff09\u3001\u3053\u308c\u304c\u521d\u3081\u3066\u3067\u300112\/30\u306e\u5348\u524d\u4e2d\u306b\u521d\u3081\u3066\u3001\u9014\u4e2d\u3067\u8cb7\u3044\u7269\u306b\u884c\u3063\u3066\u5915\u65b9\u306b\u30af\u30e9\u30b9\u5316\u3059\u308b\u3068\u3044\u3046\u30d1\u30bf\u30fc\u30f3\u3067\u3001\u8abf\u3079\u8abf\u3079\u3057\u306a\u304c\u30894\u6642\u9593\u307b\u3069\u3067\u4f5c\u3063\u3066\u3044\u307e\u3059\u3002\u601d\u3046\u306b\u3001\u3053\u306e\u624b\u306e\u30b2\u30fc\u30e0\u306e\u3088\u3046\u306a\u3082\u306e\u306f\u81ea\u5206\u306e\u601d\u3063\u305f\u3088\u3046\u306b\u4f5c\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3001\u3042\u308c\u3053\u308c\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306a\u30c6\u30af\u30cb\u30c3\u30af\u306f\u5f8c\u304b\u3089\u8ffd\u52a0\u3057\u3066\u3044\u3063\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u3067\u306f\uff1f\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002\u4ed5\u4e8b\u81ea\u4f53\u306f\u30b7\u30b9\u30c6\u30e0\u5c4b\u3055\u3093\u306a\u3068\u3053\u308d\u304c\u591a\u3044\u306e\u3067\u3001\u8a2d\u8a08\u3057\u3066\u304b\u3089\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\uff08\u3068\u306f\u3044\u3048\u3001\u7d19\u306b\u8a2d\u8a08\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u7591\u4f3c\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u3067\u3059\u304c\uff09\u3068\u3044\u3046\u30d1\u30bf\u30fc\u30f3\u304c\u591a\u304f\u3001\u6570\u6642\u9593\u3067\u601d\u3063\u305f\u3088\u3046\u306a\u3082\u306e\u3092\u4f5c\u308b\u3068\u3044\u3046\u6a5f\u4f1a\u306f\u4ed5\u4e8b\u3067\u306f\u306a\u304b\u306a\u304b\u3042\u308a\u307e\u305b\u3093\u3002OpenSiv3D \u306f\u305d\u3046\u3044\u3046\u3068\u3053\u308d\u3067\u3001\u624b\u8efd\u306b\u4f7f\u3048\u308b\u300c\u9053\u5177\u7acb\u3066\u300d\u3067\u306f\u306a\u3044\u304b\u306a\u3001\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u5b9f\u884c\u3059\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_01.jpg\" alt=\"\" width=\"642\" height=\"512\" class=\"alignnone size-full wp-image-8999\" srcset=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_01.jpg 642w, http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_01-300x239.jpg 300w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/p>\n<p>\u5b8c\u6210\u3059\u308c\u3070\u3001\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308b\u306f\u305a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_02.jpg\" alt=\"\" width=\"640\" height=\"480\" class=\"alignnone size-full wp-image-9000\" srcset=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_02.jpg 640w, http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2017\/12\/20171230_02-300x225.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>C++ \u306a\u306e\u306b\u30e1\u30e2\u30ea\u3092\u89e3\u653e\u3057\u3066\u3044\u306a\u3044\u3068\u3044\u3046\u60aa\u3055\uff08\u82e6\u7b11\uff09\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u306e\u3042\u305f\u308a\u304d\u3061\u3093\u3068\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u4f5c\u3063\u3066\u51e6\u7406\u3059\u308b\u304b\u3001const \u4f7f\u3044\u3064\u3064\u30b9\u30b3\u30fc\u30d7\u5185\u3067\u306e\u81ea\u52d5\u89e3\u653e\u306a\u6a5f\u80fd\u3092\u4f7f\u3048\u3070\u3082\u3046\u5c11\u3057\u5b89\u5168\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308b\u306f\u305a\u3067\u3059\u3002\u3067\u304d\u308b\u3060\u3051\u8868\u306b\u30dd\u30a4\u30f3\u30bf\u304c\u51fa\u306a\u3044\u306e\u304c Siv3D \u306e\u826f\u3044\u3068\u3053\u308d\u3067\u306f\u306a\u3044\u304b\u3001\u3068\u3044\u3046\u306e\u306b\u30dd\u30a4\u30f3\u30bf\u3092\u4f7f\u3044\u307e\u304f\u3063\u3066\u3044\u308b\u306e\u304c\u30a2\u30ec\u306a\u306e\u3067\u3059\u304c\u3001main \u95a2\u6570\u3060\u3051\u898b\u308c\u3070\u3001\u306a\u3093\u304b\u3059\u3063\u304d\u308a\u3057\u3066\u3044\u308b\u3068\u3044\u3046\u5177\u5408\u3067\u3057\u3087\u3046\u304b\u3002\u305d\u306e\u3042\u305f\u308a\u306f\u3001C++ \u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u306e\u3088\u3044\u3068\u3053\u308d\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u306f Siv3D Advent Calendar 2017 &#8211; Qiita \u306e 12 \u65e5\u76ee\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3067\u3059\u3002\u524d\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u306f\u3001para7 \u3055\u3093\u306e OpenSiv3D\u306e\u30c8\u30e9\u30f3\u30d7\u63cf\u753b\u6a5f\u80fd(Playin &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/8994\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,22],"tags":[],"class_list":["post-8994","post","type-post","status-publish","format-standard","hentry","category-dev","category-c"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=8994"}],"version-history":[{"count":3,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8994\/revisions"}],"predecessor-version":[{"id":9001,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8994\/revisions\/9001"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=8994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=8994"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=8994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}