{"id":227667,"date":"2014-06-30T09:03:03","date_gmt":"2014-06-30T05:03:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=227667"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=227667","title":{"rendered":"<span class=\"post_title\">\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 (\u0444\u0443\u0442\u0431\u043e\u043b\u044c\u043d\u044b\u0445) \u0438\u0433\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e MonoGame<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t<img decoding=\"async\" align=\"left\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f1a\/820\/d43\/f1a820d4350d4d647cd295fde1b253f2.png\"\/>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0445\u043e\u0442\u044f\u0442 \u0432\u0441\u0435, \u0438 \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u043e\u043d\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0434\u0430\u044e\u0442\u0441\u044f. \u041a\u0442\u043e \u043d\u0435 \u043c\u0435\u0447\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u043b\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0438 \u0440\u0430\u0437\u0431\u043e\u0433\u0430\u0442\u0435\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0435 Angry Birds \u0438\u043b\u0438 Halo? \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043e\u0434\u043d\u0430\u043a\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0433\u0440 \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0432\u0435\u0434\u044c \u0432 \u0438\u0433\u0440\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0437\u0432\u0443\u043a\u0430 \u0438 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0438\u0433\u0440, \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u043e\u0432\u043e\u0440\u043a\u0438, \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0421 \u0438 \u0421++, \u043d\u043e \u0438 \u0434\u043b\u044f \u0421# \u0438 \u0434\u0430\u0436\u0435 JavaScript. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Microsoft XNA, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e Microsoft DirectX \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0434\u043b\u044f Xbox 360, Windows, and Windows Phone. Microsoft XNA \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e Open Source \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 MonoGame. \u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u044c\u043d\u043e\u0439 (\u043a \u0447\u0435\u043c\u0443 \u0431\u044b \u044d\u0442\u043e?) \u0438\u0433\u0440\u044b.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 MonoGame?<\/h4>\n<p>MonoGame \u2013 \u044d\u0442\u043e open source \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f XNA API \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f Windows, \u043d\u043e \u0438 \u0434\u043b\u044f Mac OS X, Apple iOS, Google Android, Linux \u0438 Windows Phone. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0434 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0441\u0442\u0440\u043e\u0438\u0442 \u043f\u043b\u0430\u043d\u044b \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u043c\u0438\u0440\u0430!<br \/>  \u0412\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f Windows \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441 MonoGame. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MonoDevelop (open source \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 IDE \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u043e\u0432 Microsoft .NET) \u0438\u043b\u0438 \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 IDE Xamarin Studio \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 Linux \u0438 Mac.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0435\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c Microsoft .NET \u0438 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Microsoft Visual Studio, MonoGame \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0442\u0443\u0434\u0430. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 MonoGame \u0431\u044b\u043b\u0430 3.2, \u043e\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 Visual Studio 2012 \u0438 2013.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0438\u0433\u0440\u0443<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0438\u0433\u0440\u0443, \u0432 \u043c\u0435\u043d\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0432\u044b\u0431\u0435\u0440\u0435\u043c MonoGame Windows Project. Visual Studio \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435:<br \/>  \u0421\u043a\u0443\u0447\u043d\u043e\u0432\u0430\u0442\u043e, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438? \u041d\u0438\u0447\u0435\u0433\u043e, \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u0432\u043e\u0435\u0439 \u0438\u0433\u0440\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441. \u0412\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u0440\u0438\u0441\u0443\u043d\u043a\u0438, \u0441\u043f\u0440\u0430\u0439\u0442\u044b, \u0448\u0440\u0438\u0444\u0442\u044b \u0438 \u0442.\u0434.) \u0431\u0435\u0437 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u0432 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0441 MonoGame \u0444\u043e\u0440\u043c\u0430\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e:  <\/p>\n<ul>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c XNA Game Studio 4.0<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Windows Phone 8 SDK<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432\u0440\u043e\u0434\u0435 XNA content compiler<\/li>\n<\/ul>\n<p>  \u0418\u0442\u0430\u043a, \u0432 Program.cs \u0443 \u0432\u0430\u0441 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f Main. \u041e\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0433\u0440\u0443.  <\/p>\n<pre><code class=\"cpp\">static void Main() {     using (var game = new Game1())         game.Run(); } <\/code><\/pre>\n<p>  Game1.cs \u2013 \u044f\u0434\u0440\u043e \u0438\u0433\u0440\u044b. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443: Update \u0438 Draw. \u041f\u0440\u0438 Update \u0432\u044b \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0433\u0440\u044b; Draw, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u044d\u0442\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0446\u0438\u043a\u043b\u0430 \u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u2013 \u0432\u0441\u0435\u0433\u043e 16.7 \u043c\u0441. \u0415\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Draw, \u0447\u0442\u043e, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435.<br \/>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u0442\u0431\u043e\u043b\u044c\u043d\u0443\u044e \u0438\u0433\u0440\u0443 \u00ab\u0437\u0430\u0431\u0435\u0439 \u043f\u0435\u043d\u0430\u043b\u044c\u0442\u0438\u00bb. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0443\u0434\u0430\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435\u043c, \u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u0439 \u00ab\u0432\u0440\u0430\u0442\u0430\u0440\u044c\u00bb \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043c\u044f\u0447. \u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u00ab\u0432\u0440\u0430\u0442\u0430\u0440\u044f\u00bb. \u041e\u0447\u043a\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u043d\u0430\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432 \u0438\u0433\u0440\u0443<\/h4>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u0433\u0440\u044b \u2013 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0444\u043e\u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u043f\u043e\u043b\u044f \u0438 \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u043c\u044f\u0447\u0430. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0430 PNG \u0440\u0438\u0441\u0443\u043d\u043a\u0430: \u043f\u043e\u043b\u044f (\u0432\u043d\u0438\u0437\u0443) \u0438 \u043c\u044f\u0447\u0430 (\u043d\u0430 \u041a\u0414\u041f\u0412).<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b08\/0cd\/0e3\/b080cd0e3532c676d64893ea1f8ae766.png\"\/><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0440\u0438\u0441\u0443\u043d\u043a\u0438 \u0432 \u0438\u0433\u0440\u0435, \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 XNA Game Studio \u0438\u043b\u0438 Windows Phone 8 SDK, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c XNA \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0438 \u0432 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043e. \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0435\u0441\u044f .xnb \u0444\u0430\u0439\u043b\u044b \u0432 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. XNA Content Compiler \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<br \/>  \u041a\u043e\u0433\u0434\u0430 .xnb \u0444\u0430\u0439\u043b\u044b \u0433\u043e\u0442\u043e\u0432\u044b, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0438\u0445 \u0432 \u043f\u0430\u043f\u043a\u0443 Content \u0432\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u043c\u044f\u0447\u0430 \u0438 \u043f\u043e\u043b\u044f:  <\/p>\n<pre><code class=\"cpp\">private Texture2D _backgroundTexture; private Texture2D _ballTexture; <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u043f\u043e\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 LoadContent:  <\/p>\n<pre><code class=\"cpp\">protected override void LoadContent() {     \/\/ Create a new SpriteBatch, which can be used to draw textures.     _spriteBatch = new SpriteBatch(GraphicsDevice);      \/\/ TODO: use this.Content to load your game content here     _backgroundTexture = Content.Load&lt;Texture2D&gt;(&quot;SoccerField&quot;);     _ballTexture = Content.Load&lt;Texture2D&gt;(&quot;SoccerBall&quot;); }  <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Draw:  <\/p>\n<pre><code class=\"cpp\">protected override void Draw(GameTime gameTime) {     GraphicsDevice.Clear(Color.Green);      \/\/ Set the position for the background         var screenWidth = Window.ClientBounds.Width;     var screenHeight = Window.ClientBounds.Height;     var rectangle = new Rectangle(0, 0, screenWidth, screenHeight);     \/\/ Begin a sprite batch         _spriteBatch.Begin();     \/\/ Draw the background         _spriteBatch.Draw(_backgroundTexture, rectangle, Color.White);     \/\/ Draw the ball     var initialBallPositionX = screenWidth \/ 2;     var \u00ednitialBallPositionY = (int)(screenHeight * 0.8);     var ballDimension = (screenWidth &gt; screenHeight) ?          (int)(screenWidth * 0.02) :         (int)(screenHeight * 0.035);     var ballRectangle = new Rectangle(initialBallPositionX, \u00ednitialBallPositionY,         ballDimension, ballDimension);     _spriteBatch.Draw(_ballTexture, ballRectangle, Color.White);     \/\/ End the sprite batch         _spriteBatch.End();     base.Draw(gameTime); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u0437\u0435\u043b\u0435\u043d\u044b\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0440\u0438\u0441\u0443\u0435\u0442 \u0444\u043e\u043d \u0438 \u043c\u044f\u0447 \u043d\u0430 \u0442\u043e\u0447\u043a\u0435 \u043f\u0435\u043d\u0430\u043b\u044c\u0442\u0438. \u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 spriteBatch Draw \u0440\u0438\u0441\u0443\u0435\u0442 \u0444\u043e\u043d, \u043f\u043e\u0434\u043e\u0433\u043d\u0430\u043d\u043d\u044b\u0439 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043e\u043a\u043d\u0430, \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0438\u0441\u0443\u0435\u0442 \u043c\u044f\u0447 \u043d\u0430 \u0442\u043e\u0447\u043a\u0435 \u043f\u0435\u043d\u0430\u043b\u044c\u0442\u0438. \u0414\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u2013 \u043d\u0430\u0434\u043e \u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c.<br \/>  \u0414\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043c\u044f\u0447\u0430<br \/>  \u0427\u0442\u043e\u0431\u044b \u043c\u044f\u0447 \u0434\u0432\u0438\u0433\u0430\u043b\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0412\u044b\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update:  <\/p>\n<pre><code class=\"cpp\">protected override void Update(GameTime gameTime) {     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||         Keyboard.GetState().IsKeyDown(Keys.Escape))         Exit();      \/\/ TODO: Add your update logic here     _ballPosition -= 3;     _ballRectangle.Y = _ballPosition;     base.Update(gameTime);  } <\/code><\/pre>\n<p>  \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u044f\u0447\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f 3 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 _screenWidth, _screenHeight, _backgroundRectangle, _ballRectangle \u0438 _ballPosition \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 ResetWindowSize:  <\/p>\n<pre><code class=\"cpp\">private void ResetWindowSize() {     _screenWidth = Window.ClientBounds.Width;     _screenHeight = Window.ClientBounds.Height;     _backgroundRectangle = new Rectangle(0, 0, _screenWidth, _screenHeight);     _initialBallPosition = new Vector2(_screenWidth \/ 2.0f, _screenHeight * 0.8f);     var ballDimension = (_screenWidth &gt; _screenHeight) ?         (int)(_screenWidth * 0.02) :         (int)(_screenHeight * 0.035);     _ballPosition = (int)_initialBallPosition.Y;     _ballRectangle = new Rectangle((int)_initialBallPosition.X, (int)_initialBallPosition.Y,         ballDimension, ballDimension); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u043a\u043d\u0430. \u041e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize.  <\/p>\n<pre><code class=\"cpp\">protected override void Initialize() {     \/\/ TODO: Add your initialization logic here     ResetWindowSize();     Window.ClientSizeChanged += (s, e) =&gt; ResetWindowSize();     base.Initialize(); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043c\u0435\u0441\u0442\u0430\u0445: \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u043a\u043d\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u044f\u0447 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e, \u043d\u043e \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u044f. \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u044f\u0447, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0437\u0430\u043b\u0435\u0442\u0430\u0435\u0442 \u0432 \u0432\u043e\u0440\u043e\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"cpp\">protected override void Update(GameTime gameTime) {     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||         Keyboard.GetState().IsKeyDown(Keys.Escape))         Exit();      \/\/ TODO: Add your update logic here     _ballPosition -= 3;     if (_ballPosition &lt; _goalLinePosition)         _ballPosition = (int)_initialBallPosition.Y;      _ballRectangle.Y = _ballPosition;     base.Update(gameTime);  } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f _goalLinePosition \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 ResetWindowSize.  <\/p>\n<pre><code class=\"cpp\">_goalLinePosition = _screenHeight * 0.05; <\/code><\/pre>\n<p>  \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 Draw \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0435 \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cpp\">protected override void Draw(GameTime gameTime) {     GraphicsDevice.Clear(Color.Green);     var rectangle = new Rectangle(0, 0, _screenWidth, _screenHeight);     \/\/ Begin a sprite batch         _spriteBatch.Begin();     \/\/ Draw the background         _spriteBatch.Draw(_backgroundTexture, rectangle, Color.White);     \/\/ Draw the ball          _spriteBatch.Draw(_ballTexture, _ballRectangle, Color.White);     \/\/ End the sprite batch         _spriteBatch.End();     base.Draw(gameTime); } <\/code><\/pre>\n<p>  \u0414\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043c\u044f\u0447\u0430 \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u043d\u043e \u043b\u0438\u043d\u0438\u0438 \u0432\u043e\u0440\u043e\u0442. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043c\u044f\u0447 \u043f\u043e\u0434 \u0443\u0433\u043b\u043e\u043c, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e _ballPositionX \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0439\u0442\u0435 \u0435\u0435 (\u0434\u043b\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u043f\u0440\u0430\u0432\u043e) \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0439\u0442\u0435 (\u0434\u043b\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u043b\u0435\u0432\u043e). \u0415\u0449\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Vector2 \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044f\u0447\u0430:  <\/p>\n<pre><code class=\"cpp\">protected override void Update(GameTime gameTime) {     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||         Keyboard.GetState().IsKeyDown(Keys.Escape))         Exit();      \/\/ TODO: Add your update logic here     _ballPosition.X -= 0.5f;     _ballPosition.Y -= 3;     if (_ballPosition.Y &lt; _goalLinePosition)         _ballPosition = new Vector2(_initialBallPosition.X,_initialBallPosition.Y);     _ballRectangle.X = (int)_ballPosition.X;     _ballRectangle.Y = (int)_ballPosition.Y;     base.Update(gameTime);  } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u044f\u0447 \u043b\u0435\u0442\u0438\u0442 \u043f\u043e\u0434 \u0443\u0433\u043b\u043e\u043c. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2013 \u043f\u0440\u0438\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0435\u043c.<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/632\/1d0\/456\/6321d045613e464b978f50a11779745e.png\"\/><\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0412 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043b\u044c\u0446\u0435\u043c. \u0414\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u043b\u044c\u0446\u0430 \u0437\u0430\u0434\u0430\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u0438\u043b\u0443 \u0443\u0434\u0430\u0440\u0430.<br \/>  \u0412 MonoGame \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 TouchScreen. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 Gestures API. \u0421\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, Gestures API \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0436\u0435\u0441\u0442\u044b, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0449\u0435\u043b\u0447\u043e\u043a \u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Gestures API \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0435\u0439. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c, \u043e\u0431\u0437\u043d\u0430\u0447\u0438\u043c, \u043a\u0430\u043a\u0438\u043c \u0436\u0435\u0441\u0442\u043e\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:  <\/p>\n<pre><code class=\"cpp\">TouchPanel.EnabledGestures = GestureType.Flick | GestureType.FreeDrag; <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0449\u0435\u043b\u0447\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u044f. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0436\u0435\u0441\u0442\u044b:  <\/p>\n<pre><code class=\"cpp\">if (TouchPanel.IsGestureAvailable) {     \/\/ Read the next gesture         GestureSample gesture = TouchPanel.ReadGesture();     if (gesture.GestureType == GestureType.Flick)     {         \u2026     } } <\/code><\/pre>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0438\u043c \u0449\u0435\u043b\u0447\u043e\u043a \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize:  <\/p>\n<pre><code class=\"cpp\">protected override void Initialize() {     \/\/ TODO: Add your initialization logic here     ResetWindowSize();     Window.ClientSizeChanged += (s, e) =&gt; ResetWindowSize();     TouchPanel.EnabledGestures = GestureType.Flick;     base.Initialize(); } <\/code><\/pre>\n<p>  \u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043c\u044f\u0447 \u043a\u0430\u0442\u0438\u043b\u0441\u044f \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u043a\u0430 \u0438\u0433\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e _isBallMoving, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0438\u0433\u0440\u0435, \u043a\u043e\u0433\u0434\u0430 \u043c\u044f\u0447 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 Update, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0449\u0435\u043b\u0447\u043e\u043a, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 _isBallMoving \u0440\u0430\u0432\u043d\u044b\u043c True, \u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f. \u041a\u043e\u0433\u0434\u0430 \u043c\u044f\u0447 \u043f\u0435\u0440\u0435\u0447\u0435\u0442 \u043b\u0438\u043d\u0438\u044e \u0432\u043e\u0440\u043e\u0442, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 _isBallMoving \u0432 False \u0438 \u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u043c\u044f\u0447 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\">protected override void Update(GameTime gameTime) {     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||         Keyboard.GetState().IsKeyDown(Keys.Escape))         Exit();      \/\/ TODO: Add your update logic here     if (!_isBallMoving && TouchPanel.IsGestureAvailable)     {         \/\/ Read the next gesture             GestureSample gesture = TouchPanel.ReadGesture();         if (gesture.GestureType == GestureType.Flick)         {             _isBallMoving = true;             _ballVelocity = gesture.Delta * (float)TargetElapsedTime.TotalSeconds \/ 5.0f;         }     }     if (_isBallMoving)     {         _ballPosition += _ballVelocity;         \/\/ reached goal line         if (_ballPosition.Y &lt; _goalLinePosition)         {             _ballPosition = new Vector2(_initialBallPosition.X, _initialBallPosition.Y);             _isBallMoving = false;             while (TouchPanel.IsGestureAvailable)                 TouchPanel.ReadGesture();         }         _ballRectangle.X = (int) _ballPosition.X;         _ballRectangle.Y = (int) _ballPosition.Y;     }     base.Update(gameTime);  } <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043c\u044f\u0447\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0436\u0435 \u043d\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e _ballVelocity \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u043e \u043e\u0441\u044f\u043c x \u0438 y. Gesture.Delta \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0449\u0435\u043b\u0447\u043a\u0430, \u0443\u043c\u043d\u043e\u0436\u044c\u0442\u0435 \u044d\u0442\u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430 TargetElapsedTime.<br \/>  \u0415\u0441\u043b\u0438 \u043c\u044f\u0447 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f, \u0432\u0435\u043a\u0442\u043e\u0440 _ballPosition \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 (\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445 \u0437\u0430 \u0444\u0440\u0435\u0439\u043c) \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043c\u044f\u0447 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0435\u0442 \u043b\u0438\u043d\u0438\u0438 \u0432\u043e\u0440\u043e\u0442. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043c\u044f\u0447 \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0436\u0435\u0441\u0442\u044b \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:  <\/p>\n<pre><code class=\"cpp\">_isBallMoving = false; while (TouchPanel.IsGestureAvailable)     TouchPanel.ReadGesture();  <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043c\u044f\u0447, \u043e\u043d \u043f\u043e\u043b\u0435\u0442\u0438\u0442 \u043f\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0449\u0435\u043b\u0447\u043a\u0430 \u0438 \u0441 \u0435\u0433\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0438\u0442, \u0433\u0434\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0449\u0435\u043b\u0447\u043e\u043a. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0449\u0435\u043b\u043a\u043d\u0443\u0442\u044c \u0433\u0434\u0435 \u0443\u0433\u043e\u0434\u043d\u043e, \u0438 \u043c\u044f\u0447 \u043d\u0430\u0447\u043d\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0430 \u043e\u043a\u043e\u043b\u043e \u043c\u044f\u0447\u0430. \u0415\u0441\u043b\u0438 \u0434\u0430, \u0436\u0435\u0441\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e _isBallHit:  <\/p>\n<pre><code class=\"cpp\">TouchCollection touches = TouchPanel.GetState();  if (touches.Count &gt; 0 && touches[0].State == TouchLocationState.Pressed) {     var touchPoint = new Point((int)touches[0].Position.X, (int)touches[0].Position.Y);     var hitRectangle = new Rectangle((int)_ballPositionX, (int)_ballPositionY, _ballTexture.Width,         _ballTexture.Height);     hitRectangle.Inflate(20,20);     _isBallHit = hitRectangle.Contains(touchPoint); } <\/code><\/pre>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 _isBallHit \u0440\u0430\u0432\u043d\u0430 True:  <\/p>\n<pre><code class=\"cpp\">if (TouchPanel.IsGestureAvailable && _isBallHit) <\/code><\/pre>\n<p>  \u0418\u043c\u0435\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0434\u0430\u0440\u0438\u0442\u0435 \u043c\u044f\u0447 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438\u043b\u0438 \u043d\u0435 \u0432 \u0442\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0438\u0433\u0440\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044f\u0447 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u0442 \u043b\u0438\u043d\u0438\u044e \u0432\u043e\u0440\u043e\u0442 \u0438 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u044f\u0447\u0430. \u041a\u043e\u0433\u0434\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442, \u0438\u0433\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430:  <\/p>\n<pre><code class=\"cpp\">if (gesture.GestureType == GestureType.Flick) {     _isBallMoving = true;     _isBallHit = false;     _startMovement = gameTime.TotalGameTime;     _ballVelocity = gesture.Delta*(float) TargetElapsedTime.TotalSeconds\/5.0f; }  ...  var timeInMovement = (gameTime.TotalGameTime - _startMovement).TotalSeconds; \/\/ reached goal line or timeout if (_ballPosition.Y &lt;' _goalLinePosition || timeInMovement &gt; 5.0) {     _ballPosition = new Vector2(_initialBallPosition.X, _initialBallPosition.Y);     _isBallMoving = false;     _isBallHit = false;     while (TouchPanel.IsGestureAvailable)         TouchPanel.ReadGesture(); } <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0442\u0430\u0440\u044f<\/h4>\n<p>\u041d\u0430\u0448\u0430 \u0438\u0433\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2013 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0435 \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u0440\u0430\u0442\u0430\u0440\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0443\u0434\u0430\u0440\u0438\u043c \u043c\u044f\u0447. \u0412\u0440\u0430\u0442\u0430\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PNG, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c.<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/8eb\/ea5\/238\/8ebea52383ab4be0a7bd9ef66c806735.png\"\/><br \/>  \u0412\u0440\u0430\u0442\u0430\u0440\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 LoadContent:  <\/p>\n<pre><code class=\"cpp\">protected override void LoadContent() {     \/\/ Create a new SpriteBatch, which can be used to draw textures.     _spriteBatch = new SpriteBatch(GraphicsDevice);      \/\/ TODO: use this.Content to load your game content here     _backgroundTexture = Content.Load&lt;Texture2D&gt;(&quot;SoccerField&quot;);     _ballTexture = Content.Load&lt;Texture2D&gt;(&quot;SoccerBall&quot;);     _goalkeeperTexture = Content.Load&lt;Texture2D&gt;(&quot;Goalkeeper&quot;); }  <\/code><\/pre>\n<p>  \u041e\u0442\u0440\u0438\u0441\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Draw  <\/p>\n<pre><code class=\"cpp\">protected override void Draw(GameTime gameTime) {      GraphicsDevice.Clear(Color.Green);         \/\/ Begin a sprite batch         _spriteBatch.Begin();     \/\/ Draw the background         _spriteBatch.Draw(_backgroundTexture, _backgroundRectangle, Color.White);     \/\/ Draw the ball     _spriteBatch.Draw(_ballTexture, _ballRectangle, Color.White);     \/\/ Draw the goalkeeper     _spriteBatch.Draw(_goalkeeperTexture, _goalkeeperRectangle, Color.White);     \/\/ End the sprite batch         _spriteBatch.End();     base.Draw(gameTime); } <\/code><\/pre>\n<p>  _goalkeeperRectangle \u2013 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u0440\u0430\u0442\u0430\u0440\u044f \u0432 \u043e\u043a\u043d\u0435. \u041e\u043d \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update:  <\/p>\n<pre><code class=\"cpp\">protected override void Update(GameTime gameTime) {     \u2026     _ballRectangle.X = (int) _ballPosition.X;    _ballRectangle.Y = (int) _ballPosition.Y;    _goalkeeperRectangle = new Rectangle(_goalkeeperPositionX, _goalkeeperPositionY,                     _goalKeeperWidth, _goalKeeperHeight);    base.Update(gameTime); } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 _goalkeeperPositionY, _goalKeeperWidth \u0438 _goalKeeperHeight fields \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 ResetWindowSize:  <\/p>\n<pre><code class=\"cpp\">private void ResetWindowSize() {     \u2026     _goalkeeperPositionY = (int) (_screenHeight*0.12);     _goalKeeperWidth = (int)(_screenWidth * 0.05);     _goalKeeperHeight = (int)(_screenWidth * 0.005); } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0442\u0430\u0440\u044f \u2013 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u043e\u043a\u043d\u0430 \u043f\u0435\u0440\u0435\u0434 \u043b\u0438\u043d\u0438\u0435\u0439 \u0432\u043e\u0440\u043e\u0442:  <\/p>\n<pre><code class=\"cpp\">_goalkeeperPositionX = (_screenWidth - _goalKeeperWidth)\/2; <\/code><\/pre>\n<p>  \u0412\u0440\u0430\u0442\u0430\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u044f\u0447\u043e\u043c. \u041e\u043d \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443:<br \/>  <i>X = A * sin(at + \u03b4),<\/i><br \/>  \u0413\u0434\u0435 \u0410 \u2013 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439 (\u0448\u0438\u0440\u0438\u043d\u0430 \u0432\u043e\u0440\u043e\u0442), t \u2013 \u043f\u0435\u0440\u0438\u043e\u0434 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u0439, \u0430 \u03b4 \u2013 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a \u043d\u0435 \u043c\u043e\u0433 \u043f\u0440\u0435\u0434\u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0442\u0430\u0440\u044f.<br \/>  \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0434\u0430\u0440\u0430 \u043f\u043e \u043c\u044f\u0447\u0443:  <\/p>\n<pre><code class=\"cpp\">if (gesture.GestureType == GestureType.Flick) {     _isBallMoving = true;     _isBallHit = false;     _startMovement = gameTime.TotalGameTime;     _ballVelocity = gesture.Delta * (float)TargetElapsedTime.TotalSeconds \/ 5.0f;     var rnd = new Random();     _aCoef = rnd.NextDouble() * 0.005;     _deltaCoef = rnd.NextDouble() * Math.PI \/ 2; } <\/code><\/pre>\n<p>  \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0430 \u2013 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u0440\u0430\u0442\u0430\u0440\u044f, \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u0436\u0434\u0443 0 \u0438 0.005, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 0 \u0438 0.3 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u043b\u044c\u0442\u0430 \u2013 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u0436\u0434\u0443 0 \u0438 \u03c0\/2. \u041a\u043e\u0433\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043c\u044f\u0447, \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432\u0440\u0430\u0442\u0430\u0440\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"cpp\">if (_isBallMoving) {     _ballPositionX += _ballVelocity.X;     _ballPositionY += _ballVelocity.Y;     _goalkeeperPositionX = (int)((_screenWidth * 0.11) *                       Math.Sin(_aCoef * gameTime.TotalGameTime.TotalMilliseconds +                        _deltaCoef) + (_screenWidth * 0.75) \/ 2.0 + _screenWidth * 0.11);     \u2026 } <\/code><\/pre>\n<p>  \u0410\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u2013 _screenWidth * 0.11 (\u0448\u0438\u0440\u0438\u043d\u0430 \u0432\u043e\u0440\u043e\u0442). \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 (_screenWidth * 0.75) \/ 2.0 + _screenWidth * 0.11 \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u0440\u0430\u0442\u0430\u0440\u044c \u0434\u0432\u0438\u0433\u0430\u043b\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0432\u043e\u0440\u043e\u0442\u0430\u043c\u0438.<\/p>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043f\u043e\u0439\u043c\u0430\u043d \u043b\u0438 \u043c\u044f\u0447 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0430<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u043e\u0439\u043c\u0430\u043d \u043c\u044f\u0447 \u0438\u043b\u0438 \u043d\u0435\u0442, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0432\u0440\u0430\u0442\u0430\u0440\u044f \u0438 \u043c\u044f\u0447\u0430. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439:  <\/p>\n<pre><code class=\"cpp\">_ballRectangle.X = (int)_ballPosition.X; _ballRectangle.Y = (int)_ballPosition.Y; _goalkeeperRectangle = new Rectangle(_goalkeeperPositionX, _goalkeeperPositionY,     _goalKeeperWidth, _goalKeeperHeight); if (_goalkeeperRectangle.Intersects(_ballRectangle)) {     ResetGame(); } <\/code><\/pre>\n<p>  ResetGame \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0433\u0440\u0443 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\">private void ResetGame() {     _ballPosition = new Vector2(_initialBallPosition.X, _initialBallPosition.Y);     _goalkeeperPositionX = (_screenWidth - _goalKeeperWidth) \/ 2;     _isBallMoving = false;     _isBallHit = false;     while (TouchPanel.IsGestureAvailable)         TouchPanel.ReadGesture(); } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u043e\u043f\u0430\u043b \u043b\u0438 \u043c\u044f\u0447 \u0432 \u0432\u043e\u0440\u043e\u0442\u0430. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u044f\u0447 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043b\u0438\u043d\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">var isTimeout = timeInMovement &gt; 5.0; if (_ballPosition.Y &lt; _goalLinePosition || isTimeout) {     bool isGoal = !isTimeout &&         (_ballPosition.X &gt; _screenWidth * 0.375) &&         (_ballPosition.X &lt; _screenWidth * 0.623);     ResetGame(); } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0430, \u0432 \u0438\u0433\u0440\u0443 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u2013 \u0448\u0440\u0438\u0444\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0446\u0438\u0444\u0440\u044b. \u0428\u0440\u0438\u0444\u0442 \u2013 \u044d\u0442\u043e XML \u0444\u0430\u0439\u043b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0448\u0440\u0438\u0444\u0442: \u0432\u0438\u0434, \u0440\u0430\u0437\u043c\u0435\u0440, \u043d\u0430\u0447\u0435\u0440\u0442\u0430\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0412 \u0438\u0433\u0440\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0448\u0440\u0438\u0444\u0442:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;XnaContent xmlns:Graphics=&quot;Microsoft.Xna.Framework.Content.Pipeline.Graphics&quot;&gt;   &lt;Asset Type=&quot;Graphics:FontDescription&quot;&gt;     &lt;FontName&gt;Segoe UI&lt;\/FontName&gt;     &lt;Size&gt;24&lt;\/Size&gt;     &lt;Spacing&gt;0&lt;\/Spacing&gt;     &lt;UseKerning&gt;false&lt;\/UseKerning&gt;     &lt;Style&gt;Regular&lt;\/Style&gt;     &lt;CharacterRegions&gt;       &lt;CharacterRegion&gt;         &lt;Start&gt; &lt;\/Star&gt;         &lt;End&gt;&lt;\/End&gt;       &lt;\/CharacterRegion&gt;     &lt;\/CharacterRegions&gt;   &lt;\/Asset&gt; &lt;\/XnaContent&gt; <\/code><\/pre>\n<p>  \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0448\u0440\u0438\u0444\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f XNB \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043f\u043a\u0443 Content \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:  <\/p>\n<pre><code class=\"cpp\">_soccerFont = Content.Load&lt;SpriteFont&gt;(&quot;SoccerFont&quot;); <\/code><\/pre>\n<p>  \u0412 ResetWindowSize \u0441\u0431\u0440\u043e\u0441\u0438\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u0447\u0435\u0442\u0430:  <\/p>\n<pre><code class=\"cpp\">var scoreSize = _soccerFont.MeasureString(_scoreText); _scorePosition = (int)((_screenWidth - scoreSize.X) \/ 2.0); <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435: _userScore \u0438 _computerScore. _userScore \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0438\u0433\u0440\u043e\u043a \u0437\u0430\u0431\u044c\u0435\u0442 \u0433\u043e\u043b, _computerScore \u2013 \u043a\u043e\u0433\u0434\u0430 \u0438\u0433\u0440\u043e\u043a \u043f\u0440\u043e\u043c\u0430\u0445\u043d\u0435\u0442\u0441\u044f, \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u043b\u0438\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043b\u0438 \u0432\u0440\u0430\u0442\u0430\u0440\u044c \u043f\u043e\u0439\u043c\u0430\u0435\u0442 \u043c\u044f\u0447.  <\/p>\n<pre><code class=\"cpp\">if (_ballPosition.Y &lt; _goalLinePosition || isTimeout) {     bool isGoal = !isTimeout &&                   (_ballPosition.X &gt; _screenWidth * 0.375) &&                   (_ballPosition.X &lt; _screenWidth * 0.623);     if (isGoal)         _userScore++;     else         _computerScore++;     ResetGame(); } \u2026 if (_goalkeeperRectangle.Intersects(_ballRectangle)) {     _computerScore++;     ResetGame(); } <\/code><\/pre>\n<p>  ResetGame \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0441\u0447\u0435\u0442\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">private void ResetGame() {     _ballPosition = new Vector2(_initialBallPosition.X, _initialBallPosition.Y);     _goalkeeperPositionX = (_screenWidth - _goalKeeperWidth) \/ 2;     _isBallMoving = false;     _isBallHit = false;     _scoreText = string.Format(&quot;{0} x {1}&quot;, _userScore, _computerScore);     var scoreSize = _soccerFont.MeasureString(_scoreText);     _scorePosition = (int)((_screenWidth - scoreSize.X) \/ 2.0);     while (TouchPanel.IsGestureAvailable)         TouchPanel.ReadGesture(); } <\/code><\/pre>\n<p>  _soccerFont.MeasureString \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0447\u0435\u0442\u0430, \u044d\u0442\u0430 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0421\u0447\u0435\u0442 \u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Draw:  <\/p>\n<pre><code class=\"cpp\">protected override void Draw(GameTime gameTime) { \u2026     \/\/ Draw the score     _spriteBatch.DrawString(_soccerFont, _scoreText,           new Vector2(_scorePosition, _screenHeight * 0.9f), Color.White);     \/\/ End the sprite batch         _spriteBatch.End();     base.Draw(gameTime); } <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0433\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u043e\u043d\u0430<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0448\u0442\u0440\u0438\u0445\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0438\u0433\u0440\u0443 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0433\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u043e\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u0442\u0435\u043c\u043d\u043e. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0443\u043b\u044c\u0442\u0440\u0430\u0431\u0443\u043a\u0430\u0445 \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u0430\u0445. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Windows API Code Pack \u0434\u043b\u044f Microsoft .NET Framework, \u043d\u043e \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c WinRT Sensor API. \u0425\u043e\u0442\u044f \u044d\u0442\u043e\u0442 API \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f Windows 8, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0432 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<br \/>  \u0412\u044b\u0434\u0435\u043b\u0438\u0442\u0435 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Solution Explorer, \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 Unload Project. \u0417\u0430\u0442\u0435\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043f\u0440\u0430\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u2013 Edit project. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 PropertyGroup \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0435\u0433 TargetPlatFormVersion:  <\/p>\n<pre><code class=\"xml\">&lt;PropertyGroup&gt;   &lt;Configuration Condition=&quot; '$(Configuration)' == '' &quot;&gt;Debug&lt;\/Configuration&gt; \u2026   &lt;FileAlignment&gt;512&lt;\/FileAlignmen&gt;   &lt;TargetPlatformVersion&gt;8.0&lt;\/TargetPlatformVersion&gt; &lt;\/PropertyGroup&gt; <\/code><\/pre>\n<p>  \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u0430\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 Reload Project. Visual Studio \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0442. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Windows \u0432 Reference Manager, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/d78\/aac\/244\/d78aac2444854165a7e0e5136542b66e.png\"\/><br \/>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Windows \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 System.Runtime.WindowsRuntime.dll. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"cpp\">LightSensor light = LightSensor.GetDefault(); if (light != null) { <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"cpp\">LightSensor light = LightSensor.GetDefault(); if (light != null) {     light.ReportInterval = 0;     light.ReadingChanged += (s,e) =&gt; _lightsOn = e.Reading.IlluminanceInLux &lt; 10; } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043c\u0435\u043d\u0435\u0435 10, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f _lightsOn \u0440\u0430\u0432\u043d\u0430 True \u0438 \u0444\u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 spriteBatch \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Draw, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0435\u0435 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2013 \u0446\u0432\u0435\u0442. \u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0431\u0435\u043b\u044b\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0446\u0432\u0435\u0442, \u0442\u043e \u0446\u0432\u0435\u0442 \u0444\u043e\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f. \u0412\u044b\u0431\u0435\u0440\u0435\u043c \u0437\u0435\u043b\u0435\u043d\u044b\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0433\u043d\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0438 \u0431\u0435\u043b\u044b\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b. \u0412\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0442\u043e\u0434 Draw:  <\/p>\n<pre><code class=\"cpp\">_spriteBatch.Draw(_backgroundTexture, rectangle, _lightsOn ? Color.White : Color.Green); <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0435\u043c\u043d\u043e-\u0437\u0435\u043b\u0435\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u043e\u0433\u043d\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0438 \u0441\u0432\u0435\u0442\u043b\u043e-\u0437\u0435\u043b\u0435\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b.<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/1e3\/f68\/8c4\/1e3f688c4df14ce4a88177794c561aa4.png\"\/><br \/>  \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u043d\u0435\u0439 \u043d\u0430\u0434\u043e \u043a\u043e\u0435-\u0447\u0442\u043e \u0434\u043e\u0434\u0435\u043b\u0430\u0442\u044c: \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u0437\u0430\u0431\u0438\u0442\u043e\u043c \u043c\u044f\u0447\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0441\u043a\u043e\u043a \u043c\u044f\u0447\u0430 \u043e\u0442 \u0448\u0442\u0430\u043d\u0433\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0448\u0438\u043c \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c.<br \/>  <a href=\"https:\/\/software.intel.com\/en-us\/articles\/developing-games-with-monogame\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Intel Developer Zone<\/a>      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/227667\/\"> http:\/\/habrahabr.ru\/company\/intel\/blog\/227667\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t<img decoding=\"async\" align=\"left\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f1a\/820\/d43\/f1a820d4350d4d647cd295fde1b253f2.png\"\/>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0445\u043e\u0442\u044f\u0442 \u0432\u0441\u0435, \u0438 \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u043e\u043d\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0434\u0430\u044e\u0442\u0441\u044f. \u041a\u0442\u043e \u043d\u0435 \u043c\u0435\u0447\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u043b\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0438 \u0440\u0430\u0437\u0431\u043e\u0433\u0430\u0442\u0435\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0435 Angry Birds \u0438\u043b\u0438 Halo? \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043e\u0434\u043d\u0430\u043a\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0433\u0440 \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0432\u0435\u0434\u044c \u0432 \u0438\u0433\u0440\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0437\u0432\u0443\u043a\u0430 \u0438 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0438\u0433\u0440, \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u043e\u0432\u043e\u0440\u043a\u0438, \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0421 \u0438 \u0421++, \u043d\u043e \u0438 \u0434\u043b\u044f \u0421# \u0438 \u0434\u0430\u0436\u0435 JavaScript. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Microsoft XNA, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e Microsoft DirectX \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0434\u043b\u044f Xbox 360, Windows, and Windows Phone. Microsoft XNA \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e Open Source \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 MonoGame. \u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0443\u0442\u0431\u043e\u043b\u044c\u043d\u043e\u0439 (\u043a \u0447\u0435\u043c\u0443 \u0431\u044b \u044d\u0442\u043e?) \u0438\u0433\u0440\u044b.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-227667","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227667"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/227667\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}