{"id":165279,"date":"2013-01-10T15:18:05","date_gmt":"2013-01-10T11:18:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=165279"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=165279","title":{"rendered":"<span class=\"post_title\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0435\u043c\u043e\u043a, \u0447\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435!<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0435\u0445, \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0435\u043c\u043e\u0441\u0446\u0435\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u044e \u0446\u0438\u043a\u043b \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0435\u043c\u043e\u043a. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439, \u043d\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<br \/>  \u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c Demo \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e OpenGL, DirectX, \u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432, \u043e\u0431 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043e \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041d\u0430 \u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c?<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0438 \u043d\u0430 \u0447\u0451\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0435\u043c\u043a\u0443.<br \/>  \u041f\u0438\u0441\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430 C, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Visual Studio 2008.<\/p>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 Images.h \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 TImage, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438:  <\/p>\n<pre><code class=\"cpp\">struct TImage {   int width;   int height;   unsigned char *pBitMap; }; <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Images.h, Images.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#pragma once  struct TImage {   int width;   int height;   unsigned char *pBitMap; };  void imgClearRGBA(struct TImage Image, unsigned char R, unsigned char G, unsigned char B, unsigned char A ); void imgClear(struct TImage Image, unsigned long color ); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/*   Images *\/ #include &quot;Images.h&quot;  void imgClearRGBA(struct TImage Image, unsigned char R, unsigned char G, unsigned char B, unsigned char A ) {   int i;   for(i=0;i!=Image.width*Image.height*4;i=i+4)   {     Image.pBitMap[  i  ] = B;     Image.pBitMap[ i+1 ] = G;     Image.pBitMap[ i+2 ] = R;     Image.pBitMap[ i+3 ] = A;   } }  void imgClear(struct TImage Image, unsigned long color ) {   unsigned long *pBitMap;   int i;   pBitMap = (unsigned long*)Image.pBitMap;   for(i=0;i!=Image.width*Image.height;i++)   {     pBitMap[  i  ] = color;   } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0410 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0438\u0442\u043e\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c pBitMap.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OpenGL \u0438 DirectX, \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<br \/>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 SetPixel() \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<br \/>  \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f WinApi StretchDIBits(), \u043e\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 Handle \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<br \/>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4-\u0445 \u0431\u0430\u0439\u0442, \u043d\u0430 \u044d\u043a\u0440\u0430\u043d:<\/p>\n<pre><code class=\"cpp\">void DrawBuffer(struct TImage Image) {    BITMAPINFO BitMapInfo;    DC=GetDC(Wnd);    BitMapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);   BitMapInfo.bmiHeader.biWidth=Image.width;   BitMapInfo.bmiHeader.biHeight=Image.height;   BitMapInfo.bmiHeader.biPlanes=1;   BitMapInfo.bmiHeader.biBitCount=32;   BitMapInfo.bmiHeader.biCompression=BI_RGB;    StretchDIBits( DC,     0, 0, Image.width*PIXEL_SIZE, Image.height*PIXEL_SIZE,     0, 0, Image.width, Image.height,     Image.pBitMap,     &BitMapInfo,     DIB_RGB_COLORS,     SRCCOPY );    ReleaseDC(Wnd, DC); } <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">SystemUtils.h, SystemUtils.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#pragma once #define PIXEL_SIZE 1 #define DISP_WIDTH 640 #define DISP_HEIGHT 480  void DrawBuffer(struct TImage Image); #include &quot;windows.h&quot; void SetHWND( HWND _Wnd );  <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/* SystemUtils *\/ #include &quot;windows.h&quot; #include &quot;Images.h&quot; #include &quot;SystemUtils.h&quot;  static HWND Wnd;  void SetHWND( HWND _Wnd ) {   Wnd = _Wnd; }  void DrawBuffer(struct TImage Image) {    BITMAPINFO BitMapInfo;   HDC DC;    DC = GetDC(Wnd);    BitMapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);\/\/ \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b   BitMapInfo.bmiHeader.biWidth = Image.width;\/\/ \u0448\u0438\u0440\u0438\u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438   BitMapInfo.bmiHeader.biHeight = -Image.height;\/\/ \u0432\u044b\u0441\u043e\u0442\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u043c\u0438\u043d\u0443\u0441 \u043d\u0443\u0436\u0435\u043d \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u043c   BitMapInfo.bmiHeader.biPlanes = 1;\/\/ \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0435\u0432 - \u0432\u0441\u0435\u0433\u0434\u0430 1   BitMapInfo.bmiHeader.biBitCount = 32;\/\/ \u043a\u043e\u043b-\u0432\u043e \u0431\u0438\u0442 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c   BitMapInfo.bmiHeader.biCompression = BI_RGB;\/\/ \u0444\u043e\u0440\u043c\u0430\u0442   BitMapInfo.bmiHeader.biSizeImage = Image.width*Image.height*32\/8;\/\/ \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438    StretchDIBits( DC,     0, 0, Image.width*PIXEL_SIZE, Image.height*PIXEL_SIZE, \/\/ \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043a\u0443\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c     0, 0, Image.width, Image.height, \/\/ \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c     Image.pBitMap, \/\/ \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439     &BitMapInfo, \/\/ \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b     DIB_RGB_COLORS, \/\/ \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430     SRCCOPY ); \/\/ \u0440\u0435\u0436\u0438\u043c \u0432\u044b\u0432\u043e\u0434\u0430    ReleaseDC(Wnd, DC); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0446\u0438\u043a\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">while(1) {   \u0420\u0438\u0441\u0443\u0435\u043c;   \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c  \u043d\u0430 \u044d\u043a\u0440\u0430\u043d;   Pause(); } <\/code><\/pre>\n<p>  \u041d\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 Windows, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043a\u043d\u0430 \u0438\u043d\u0430\u0447\u0435 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0432\u0438\u0441\u043b\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Pause() \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u043a\u043d\u0430 \u0432 \u043d\u0435\u043c?<br \/>  \u041d\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c State Machine, \u043d\u043e \u0432 \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u0430 \u0433\u0438\u0433\u0430\u043d\u0442\u0441\u043a\u0430\u044f \u0438 \u043d\u0435\u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043b\u0438\u0432\u0430\u044f State Machine \u0432 \u0434\u0435\u043c\u043a\u0435 (\u044f \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044e \u043e\u0431 \u0438\u0433\u0440\u0430\u0445).<br \/>  \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c pause.c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Pause.h, Pause.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#pragma once #include &quot;windows.h&quot;  void SetMsg( MSG _Msg ); void SetPause( DWORD value ); void Pause(void); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/*   \u0422\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 *\/  \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f timeGetTime \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0442\u043e\u0447\u043d\u0435\u0435 GetTickCount #define _USE_TIMEGETTIME  #include &quot;windows.h&quot;  #ifdef _USE_TIMEGETTIME #include &quot;mmsystem.h&quot; #pragma comment (lib,&quot;winmm&quot;) #endif  static MSG Msg;  DWORD Time; DWORD OldTime;  void SetMsg( MSG _Msg ) {   Msg = _Msg; }  void SetPause( DWORD value ) {   if(value == 0)value = 1;   Time = value; #ifdef _USE_TIMEGETTIME   timeBeginPeriod(1);\/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c timeGetTime   OldTime = timeGetTime()+Time; #else   OldTime = GetTickCount()+Time; #endif }  void Pause(void) {    \/\/ \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b    while (PeekMessage(&Msg, 0, 0, 0, PM_NOREMOVE) != 0 )   {     if (GetMessage(&Msg, 0, 0, 0) )     {       TranslateMessage(&Msg);       DispatchMessage(&Msg);     }   }  #ifdef _USE_TIMEGETTIME \twhile( timeGetTime()&lt;OldTime)Sleep(1);\/\/\u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \tOldTime = timeGetTime()+Time; #else \twhile( GetTickCount()&lt;OldTime)Sleep(1);\/\/\u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \tOldTime = GetTickCount()+Time; #endif } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u042d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e.<br \/>  \u041b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043a\u043d\u043e:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Main.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/* \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u043a\u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0430\u043c\u0443 \u0434\u0435\u043c\u043a\u0443 *\/ #include &quot;windows.h&quot; #include &quot;windowsx.h&quot;  #include &quot;Demo.h&quot; #include &quot;SystemUtils.h&quot; #include &quot;Pause.h&quot;  static HWND Wnd; static MSG Msg; static WNDCLASS wndclass;  \/*   \u041c\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u043e\u043a\u043d\u043e, \u0442.\u043a. \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c Windows   \u0442\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0431\u0435 \u0438 \u0434\u0435\u043c\u043a\u0430 &quot;\u0437\u0430\u0432\u0438\u0441\u0430\u0435\u0442&quot;.   \u0412\u044b\u0445\u043e\u0434 - \u043f\u043e \u043f\u0440\u0430\u0432\u043e\u043c\u0443 \u043a\u043b\u0438\u043a\u0443 *\/ static POINT MouseInWin; static RECT WinRect; static int MoveWin = 0;  \/\/ window procedure LONG WINAPI WndProc (   HWND    hWnd,   UINT    uMsg,   WPARAM  wParam,   LPARAM  lParam) {   LONG lRet = 1;   POINT point;   switch (uMsg)    {     case WM_LBUTTONDOWN:       MoveWin = 1;\/\/move window=true       GetWindowRect( Wnd, &WinRect ); \t         point.x = GET_X_LPARAM(lParam);       point.y = GET_Y_LPARAM(lParam);       ClientToScreen( Wnd, (LPPOINT)&point );              MouseInWin.x = point.x-WinRect.left;       MouseInWin.y = point.y-WinRect.top;              SetCapture(Wnd);       break;     case WM_MOUSEMOVE:       GetCursorPos( (LPPOINT)&point );       if(MoveWin)SetWindowPos( Wnd,0,         point.x-MouseInWin.x, point.y-MouseInWin.y,         WinRect.right-WinRect.left, WinRect.bottom-WinRect.top,         0);       break;     case WM_LBUTTONUP:       MoveWin = 0;\/\/move window=false       ReleaseCapture();       break;     case WM_RBUTTONUP:       PostMessage(Wnd, WM_DESTROY, 0, 0);       break;     case WM_DESTROY:       PostQuitMessage (0);       ExitProcess( 0 );       break;     default:       lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);       break;   }      return lRet; }  void CreateWin( HINSTANCE hInstance, HWND *Wnd) {   const int ClientWidth = DISP_WIDTH*PIXEL_SIZE;\/\/resolution * pixel size   const int ClientHeight = DISP_HEIGHT*PIXEL_SIZE;      RECT Rect = {0,0,ClientWidth,ClientHeight};    wndclass.style         = CS_BYTEALIGNCLIENT;   wndclass.lpfnWndProc   = &WndProc;   wndclass.cbClsExtra    = 0;   wndclass.cbWndExtra    = 0;   wndclass.hInstance     = 0;   wndclass.hIcon         = LoadIcon(0, L&quot;idi_Application&quot;);   wndclass.hCursor       = LoadCursor (0,IDC_ARROW);   wndclass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);   wndclass.lpszMenuName  = L&quot;&quot;;   wndclass.lpszClassName = L&quot;MainWindow&quot;;      RegisterClass(&wndclass);    *Wnd=CreateWindow(      L&quot;MainWindow&quot;,     L&quot;Demo&quot;,     WS_POPUPWINDOW, \/\/\u0441\u0442\u0438\u043b\u044c     CW_USEDEFAULT,\/\/x     CW_USEDEFAULT,\/\/y     ClientWidth,\/\/width     ClientHeight,\/\/height     0,\/\/ parent win     0,\/\/menu     hInstance,     0\/\/other     );        GetWindowRect(*Wnd,&Rect);   Rect.bottom = Rect.left+ClientHeight;\/\/ClientHeight   Rect.right = Rect.top+ClientWidth;\/\/ClientWidth   AdjustWindowRect(&Rect, GetWindowLong(*Wnd,GWL_STYLE) ,0);        SetWindowPos(*Wnd,0,Rect.left,Rect.top,     Rect.right-Rect.left,     Rect.bottom-Rect.top,0);        ShowWindow(*Wnd, SW_SHOW );   UpdateWindow (*Wnd);  }  int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {   CreateWin(hInstance, &Wnd);\/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u043a\u043d\u043e      SetHWND(Wnd);   SetMsg(Msg);      StartDemo();    return 0; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c Demo.c, \u0433\u0434\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c\u0430 \u0434\u0435\u043c\u043a\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Demo.h, Demo.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void StartDemo(void); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &quot;Pause.h&quot; #include &quot;SystemUtils.h&quot; #include &quot;Images.h&quot; #include &quot;math.h&quot;  static unsigned char BitMap[640*480*4];\/\/\u0431\u0438\u0442\u043e\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f static struct TImage Disp = {640,480,BitMap};\/\/\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435  void StartDemo(void) {   SetPause(16);\/\/fps ~= 60   while(1)   {     \/\/              AARRGGBB     imgClear(Disp,0xFF000000);\/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d      DrawBuffer(Disp);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043e\u043a\u043d\u043e     Pause();   } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c!<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d8c\/321\/5ea\/d8c3215ea423d5b4734b15436f0502ad.png\"\/><br \/>  \u041d\u043e \u043f\u043e\u043a\u0430 \u043a\u0440\u043e\u043c\u0435 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u043c\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c, \u0432\u0441\u0435 \u0432\u0435\u0440\u043d\u043e \u0432\u0435\u0434\u044c \u043c\u044b \u0432 \u0446\u0438\u043a\u043b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d:  <\/p>\n<pre><code class=\"cpp\">void StartDemo(void) {   SetPause(16);\/\/fps ~= 60   while(1)   {     \/\/              AARRGGBB     imgClear(Disp,0xFF000000);\/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d      DrawBuffer(Disp);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043e\u043a\u043d\u043e     Pause();   } } <\/code><\/pre>\n<h4>\u0420\u0438\u0441\u0443\u0435\u043c \u0442\u043e\u0447\u043a\u0443<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/7a7\/c41\/b9f\/7a7c41b9f0fbbe1a4804911b11906b5e.png\"\/><br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 x=1, y=1.<br \/>  \u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/bdf\/342\/384\/bdf342384c84132d61cba03a66355702.png\"\/><br \/>  \u0413\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 4-\u0445 unsigned char \u043b\u0438\u0431\u043e \u043e\u0434\u043d\u0438\u043c unsigned long:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/25b\/888\/af8\/25b888af8444db06e0387b7fdfa5d0ce.png\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/1b4\/a5f\/8d4\/1b4a5f8d430acf039b9c81887488df9b.png\"\/><br \/>  \u0422\u043e, \u0447\u0442\u043e \u0441\u0435\u0440\u043e\u0435 \u2014 \u044d\u0442\u043e \u0430\u043b\u044c\u0444\u0430, \u043c\u044b \u0435\u0435 \u043f\u043e\u043a\u0430 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 (x + y*disp.width)&lt;&lt;2 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430, \u0443 \u043d\u0430\u0441 \u043e\u043d\u043e \u0440\u0430\u0432\u043d\u043e 2-\u043c. (&lt;&lt;2 \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 4 \u0441\u0434\u0432\u0438\u0433\u043e\u043c)   <\/p>\n<pre><code class=\"cpp\">void StartDemo(void) {   const int x=1, y=1;   SetPause(16);\/\/fps ~= 60   while(1)   {     \/\/              AARRGGBB     imgClear(Disp,0xFF000000);\/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d      Disp.pBitMap[( (x + y*Disp.width)&lt;&lt;2 )+2] = 255;\/\/\u0440\u0438\u0441\u0443\u0435\u043c \u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443      DrawBuffer(Disp);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043e\u043a\u043d\u043e     Pause();   } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443.<\/p>\n<h4>\u0420\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/235\/7b5\/e6c\/2357b5e6c3e7b3c34bea24c74b17c57d.png\"\/><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0432\u0443\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0446\u0438\u043a\u043b\u043e\u0432,<br \/>  \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c\u0443\u043b\u044b Value = X \/ ( Max_X \/ Max_Value ), \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438 \u0441\u0438\u043d\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u043e\u0439, \u0447\u0442\u043e \u0434\u0430\u0441\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443.  <\/p>\n<pre><code class=\"cpp\">void StartDemo(void) {   int x,y,line;     SetPause(16);\/\/fps ~= 60    imgClear(Disp,0xFF000000);\/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d      while(1)   {     for(y=0;y!=Disp.height;y++)     {       line = y*Disp.width;       for(x=0;x!=Disp.width;x++)       {         Disp.pBitMap[( (x + line)&lt;&lt;2 )+0] = (unsigned char)( y\/(Disp.height\/256.0) );\/\/B         Disp.pBitMap[( (x + line)&lt;&lt;2 )+2] = (unsigned char)( x\/(Disp.width\/256.0) );\/\/R       }     }     DrawBuffer(Disp);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043e\u043a\u043d\u043e     Pause();   } } <\/code><\/pre>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435.<\/p>\n<h4>\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u043f\u043b\u0430\u0437\u043c\u0430<\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/624\/856\/347\/62485634702480fbfacc17f07e82e8bd.png\"\/><br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u043f\u043b\u0430\u0437\u043c\u0443, \u043f\u0440\u0430\u0432\u0434\u0430, \u043f\u043e\u043a\u0430 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u044b, \u044d\u0442\u043e \u0442\u0435\u043c\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u041e\u0442\u043c\u0435\u0447\u0443 \u043b\u0438\u0448\u044c \u0442\u043e, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sin() \u0442\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0438\u043d\u0443\u0441\u043e\u0432, \u0447\u0442\u043e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Demo.c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &quot;Pause.h&quot; #include &quot;SystemUtils.h&quot; #include &quot;Images.h&quot; #include &quot;math.h&quot;  static unsigned char BitMap[640*480*4];\/\/\u0431\u0438\u0442\u043e\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f static struct TImage Disp = {640,480,BitMap};\/\/\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435  static unsigned char SinT[256];\/\/\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0438\u043d\u0443\u0441\u043e\u0432  static void CreatetSinT(void) {   int i;   for(i=0;i!=256;i++)   {     SinT[i] = (int)( sin( (i*3.14*2.0)\/256.0) *128+128 );   } }  void StartDemo(void) {   int x,y,line;   int tx1=0,ty1=0,tx2=0,ty2=0,tx3=0,ty3=0;   int px1,py1,px2,py2,px3,py3;     SetPause(16);\/\/fps ~= 60    CreatetSinT();    imgClear(Disp,0xFF000000);\/\/\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d      while(1)   {     py1=ty1;     py2=ty2;     py3=ty3;     for(y=0;y!=Disp.height;y++)     {       line = y*Disp.width;       px1=tx1;       px2=tx2;       px3=tx3;       for(x=0;x!=Disp.width;x++)       {         px1=px1+1;         px2=px2+1;         px3=px3+1;         Disp.pBitMap[( (x + line)&lt;&lt;2 )+2] = (SinT[ px1&255 ]+SinT[ py1&255 ])&gt;&gt;1;\/\/R         Disp.pBitMap[( (x + line)&lt;&lt;2 )+1] = (SinT[ px2&255 ]+SinT[ py2&255 ])&gt;&gt;1;\/\/G         Disp.pBitMap[( (x + line)&lt;&lt;2 )+0] = (SinT[ px3&255 ]+SinT[ (py3+63)&255 ])&gt;&gt;1;\/\/B       }       py1=py1+1;       py2=py2+1;       py3=py3+1;     }     tx1=tx1+1;     ty1=ty1+1;     tx2=tx2+2;     ty2=ty2+2;     tx3=ty3+3;     ty3=ty3+3;     DrawBuffer(Disp);\/\/\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043e\u043a\u043d\u043e     Pause();   } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438:<br \/>  <a href=\"http:\/\/errorsoft-demoscene.narod.ru\/DemoTutorial\/part1\/Demo_Window.zip\">\u041f\u0443\u0441\u0442\u043e\u0435 \u043e\u043a\u043d\u043e<\/a><br \/>  <a href=\"http:\/\/errorsoft-demoscene.narod.ru\/DemoTutorial\/part1\/Demo_Pixel.zip\">\u0422\u043e\u0447\u043a\u0430<\/a><br \/>  <a href=\"http:\/\/errorsoft-demoscene.narod.ru\/DemoTutorial\/part1\/Demo_Gradient.zip\">\u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442<\/a><br \/>  <a href=\"http:\/\/errorsoft-demoscene.narod.ru\/DemoTutorial\/part1\/Demo_Plasma.zip\">\u041f\u043b\u0430\u0437\u043c\u0430<\/a><br \/>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043b\u0430\u0437\u043c\u044b.<br \/>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!    \t \t\t   \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\/post\/165279\/\"> http:\/\/habrahabr.ru\/post\/165279\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435!<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0435\u0445, \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0435\u043c\u043e\u0441\u0446\u0435\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u044e \u0446\u0438\u043a\u043b \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0435\u043c\u043e\u043a. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439, \u043d\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<br \/>  \u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c Demo \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e OpenGL, DirectX, \u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432, \u043e\u0431 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043e \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.  <\/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-165279","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165279","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=165279"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165279\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}