{"id":445546,"date":"2025-01-21T15:02:00","date_gmt":"2025-01-21T15:02:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=445546"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=445546","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043b\u0435\u0433\u0430\u0441\u0438 \u0441 \u043d\u0443\u043b\u044f \u043d\u0430 \u0421++, \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435 \u0443 \u0441\u0430\u043d\u0438\u0442\u0430\u0440\u043e\u0432. 03 \u2014 \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0425\u0430\u0431\u0440\u0430\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 xlib, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 Linux \u0438 \u0437\u0430\u043b\u043e\u0436\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.<\/p>\n<p>\u041d\u0430\u0448 \u043c\u0438\u043d\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f LDL &#8212; Little DirectMedia Layer. \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u044d\u0442\u043e \u043e\u0442\u0441\u044b\u043b\u043a\u0430 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 SDL.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 LDL.<\/p>\n<p><a href=\"https:\/\/github.com\/JordanCpp\/LDL\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/a> \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0435\u043b\u044b\u043c, \u044f \u0432 \u043d\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0430\u0443\u0434\u0438\u043e \u0444\u0430\u0439\u043b\u043e\u0432, \u0432\u044b\u0432\u043e\u0434 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e FreeType, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432\u0435\u0441\u0438\u0442 \u043e\u043a\u043e\u043b\u043e \u0434\u0432\u0443\u0445 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/github.com\/JordanCpp\/LDLHOL\" rel=\"noopener noreferrer nofollow\">\u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/a>, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 namespace \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u0418 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0421 \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e LDL \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439. \u0412 \u043d\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u044f\u0436\u0435\u043b\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043b\u0435\u0433\u0447\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0422\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043e\u0434\u0438\u043d namespace LDL \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0440\u0435\u043f\u0430 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\" rel=\"noopener noreferrer nofollow\">RetroFan<\/a>.<\/p>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/LDL_Win.cpp\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Windows \u0438 Linux. \u0418\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u044b\u0439 API. \u041f\u043e\u0434 Windows \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 GDI, \u043f\u043e\u0434 Linux XLib.<\/p>\n<pre><code class=\"cpp\">#include &lt;LDL\/LDL.hpp&gt; #include &lt;stdlib.h&gt;  int random(unsigned int min, unsigned int max) { return rand() % ((max + min) + min); }  int main() { size_t rnd;  srand(rnd);      LDL::Window window(LDL::Vec2i(0, 0), LDL::Vec2i(800, 600)); LDL::Render render(window);     LDL::Event  report;  while (window.Running()) { while (window.GetEvent(report)) { if (report.Type == LDL::Event::IsQuit) { window.StopEvent(); } }  render.Begin();  for (size_t i = 0; i &lt; 50; i++) { render.SetColor(LDL::Color(random(0, 255), random(0, 255), random(0, 255)));  LDL::Vec2i pos  = LDL::Vec2i(random(0, 800), random(0, 600)); LDL::Vec2i size = LDL::Vec2i(random(25, 50), random(25, 50));  render.Fill(pos, size); }  render.End();  window.Update(); window.PollEvents(); }      return 0; }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 LDL \u0443\u043c\u0435\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0438\u044e \u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u041d\u043e \u0443\u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u0434\u0432\u0435 \u041e\u0421 \u0438 \u0438\u0445 \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Windows<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e23\/a02\/5d9\/e23a025d99c3052eb31de74a26c6dad0.png\" width=\"786\" height=\"593\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e23\/a02\/5d9\/e23a025d99c3052eb31de74a26c6dad0.png\"\/><\/figure>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Linux<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f96\/4f4\/146\/f964f4146439bc458daec0f6d6dd6f16.png\" width=\"804\" height=\"632\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f96\/4f4\/146\/f964f4146439bc458daec0f6d6dd6f16.png\"\/><\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0432 Windows \u043f\u0440\u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e \u043d\u0435 \u0442\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430 \u0434\u043e\u0441\u0443\u0433\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0443\u0441\u044c. \u042f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0430\u0433\u0438 \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. <\/p>\n<p>\u041f\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0443 <a href=\"https:\/\/www.libsdl.org\/\" rel=\"noopener noreferrer nofollow\">SDL2<\/a> \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043e\u043a\u043d\u043e \u0438 \u0440\u0435\u043d\u0434\u0435\u0440, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443.<\/p>\n<p>\u0411\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0441\u0440\u0430\u0437\u0443 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043e\u043a\u043d\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u041e\u0421, \u043e\u0442\u043b\u043e\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">namespace LDL { class MainWindow { public: MainWindow(const Vec2i&amp; pos, const Vec2i&amp; size); ~MainWindow(); void Update(); void StopEvent(); bool Running(); void PollEvents(); bool GetEvent(Event&amp; event); }; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 private \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0435\u0439, \u043d\u043e \u0443\u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u041e\u0421, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u043a\u043d\u0430, \u041e\u0421 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043e\u043a\u043d\u043e, \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u0436\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u043b \u043e\u043a\u043d\u043e, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0418 \u0434\u0430\u043b\u0435\u0435 \u043e\u043a\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">if (report.Type == LDL::Event::IsQuit) { window.StopEvent(); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u043d\u043e \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/LDL\/include\/LDL\/RngBuf.hpp\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043b\u044c\u0446\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430<\/a>.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">namespace LDL { class GdiRender { public: GdiRender(MainWindow&amp; window); const Color&amp; GetColor(); void SetColor(const Color&amp; color); void Begin(); void End(); void Clear(); void Line(const Vec2i&amp; first, const Vec2i&amp; last); void Fill(const Vec2i&amp; pos, const Vec2i&amp; size); }; }<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c. \u0417\u0430\u0434\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0446\u0432\u0435\u0442 \u0438 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432. \u0412\u0430\u0436\u043d\u043e, \u0432\u0441\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 Begin \u0438 End.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u043a\u043e\u0434\u0430, \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0434\u0438\u043e\u043c\u0443 <a href=\"https:\/\/habr.com\/ru\/articles\/118010\/\" rel=\"noopener noreferrer nofollow\">PIMPL<\/a>, \u0447\u0442\u043e \u0431\u044b \u0441\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u041e\u0421, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">#if defined(_WIN32)     #include &lt;LDL\/Windows\/MainWin.hpp&gt; #elif defined (__unix__)     #include &lt;LDL\/UNIX\/MainWin.hpp&gt; #endif  namespace LDL { typedef MainWindow Window; }<\/code><\/pre>\n<pre><code class=\"cpp\">#if defined(_WIN32)     #include &lt;LDL\/Windows\/GdiRndr.hpp&gt; #elif defined (__unix__)     #include &lt;LDL\/UNIX\/XLibRndr.hpp&gt; #endif  namespace LDL {  #if defined(_WIN32) typedef GdiRender Render; #elif defined (__unix__) typedef XLibRender Render; #endif  }<\/code><\/pre>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0438\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u041e\u0421.<\/p>\n<p>Windows GDI<\/p>\n<pre><code class=\"cpp\">void GdiRender::Line(const Vec2i&amp; first, const Vec2i&amp; last) { MoveToEx(_window._handleDeviceContext, first.x, first.y, NULL); LineTo(_window._handleDeviceContext, last.x, last.y); }  void GdiRender::Fill(const Vec2i&amp; pos, const Vec2i&amp; size) { RECT rect;  rect.left   = pos.x; rect.top    = pos.y; rect.right  = size.x; rect.bottom = size.y;  HBRUSH brush = CreateSolidBrush(RGB(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b));  FillRect(_window._handleDeviceContext, &amp;rect, brush);  DeleteObject(brush); }<\/code><\/pre>\n<p>Linux XLib<\/p>\n<pre><code class=\"cpp\">void XLibRender::Line(const Vec2i&amp; first, const Vec2i&amp; last) { uint32_t rgb = MakeRgb(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b);  XSetForeground(_window._display, _graphics, rgb); XDrawLine(_window._display, _window._window, _graphics, first.x, first.y, last.x, last.y); }  void XLibRender::Fill(const Vec2i&amp; pos, const Vec2i&amp; size) { uint32_t rgb = MakeRgb(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b);  XSetForeground(_window._display, _graphics, rgb); XFillRectangle(_window._display, _window._window, _graphics, pos.x, pos.y, size.x, size.y); }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u0443 \u043d\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0446\u0432\u0435\u0442\u0430 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430, \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041b\u0443\u0447\u0448\u0435 \u0435\u0433\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432. \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0436\u0435\u043b\u0435\u0437\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b.<\/p>\n<p>\u0412 Linux \u043e\u0442\u043e\u0440\u0432\u0430\u0442\u044c libc \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0447\u0443\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 <a href=\"https:\/\/gist.github.com\/Scherso\/d11e7de8bd27f234519cfb94348d9c70\" rel=\"noopener noreferrer nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e<\/a>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/libc\/UNIX\/x86_64.s\" rel=\"noopener noreferrer nofollow\">\u0430\u0441\u043c \u0444\u0430\u0439\u043b<\/a> c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 start, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u0447\u043d\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0445 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c. \u0412\u0441\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 write \u0432 linux. \u042f \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0448\u0435\u043b \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 malloc \u0438 free \u0432 Linux. \u041d\u043e \u0443\u0436\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<pre><code class=\"cpp\">intptr LinuxApi::write(int fd, void const* data, uintptr nbytes) {     return (uintptr)syscall3(SYS_write, (void*)(intptr)fd, (void*)data, (void*)nbytes); }  void* LinuxApi::brk(uintptr nbytes) {     return syscall1(SYS_brk, (void*)nbytes); }<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u043e\u0441\u0443\u0433\u0435, \u0445\u043e\u0447\u0443 \u043d\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434 Windows 3.1 \u0438 \u0441\u0442\u0430\u0440\u044b\u0439 Linux. \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043f\u0438\u0448\u0443\u0441\u044c \u043e\u0431 \u0443\u0441\u043f\u0435\u0445\u0430\u0445.<\/p>\n<p>\u0420\u0430\u0434 \u0431\u0443\u0434\u0443, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c, \u043a\u0440\u0438\u0442\u0438\u043a\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/874186\/\"> https:\/\/habr.com\/ru\/articles\/874186\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0425\u0430\u0431\u0440\u0430\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 xlib, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 Linux \u0438 \u0437\u0430\u043b\u043e\u0436\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.<\/p>\n<p>\u041d\u0430\u0448 \u043c\u0438\u043d\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f LDL &#8212; Little DirectMedia Layer. \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u044d\u0442\u043e \u043e\u0442\u0441\u044b\u043b\u043a\u0430 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 SDL.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 LDL.<\/p>\n<p><a href=\"https:\/\/github.com\/JordanCpp\/LDL\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/a> \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0435\u043b\u044b\u043c, \u044f \u0432 \u043d\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0430\u0443\u0434\u0438\u043e \u0444\u0430\u0439\u043b\u043e\u0432, \u0432\u044b\u0432\u043e\u0434 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e FreeType, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0432 \u0438\u0442\u043e\u0433\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432\u0435\u0441\u0438\u0442 \u043e\u043a\u043e\u043b\u043e \u0434\u0432\u0443\u0445 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/github.com\/JordanCpp\/LDLHOL\" rel=\"noopener noreferrer nofollow\">\u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/a>, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 namespace \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u0418 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0421 \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e LDL \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439. \u0412 \u043d\u0435\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u044f\u0436\u0435\u043b\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043b\u0435\u0433\u0447\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0422\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043e\u0434\u0438\u043d namespace LDL \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c. <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0440\u0435\u043f\u0430 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\" rel=\"noopener noreferrer nofollow\">RetroFan<\/a>.<\/p>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/LDL_Win.cpp\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0440\u0430\u0441\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Windows \u0438 Linux. \u0418\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u044b\u0439 API. \u041f\u043e\u0434 Windows \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 GDI, \u043f\u043e\u0434 Linux XLib.<\/p>\n<pre><code class=\"cpp\">#include &lt;LDL\/LDL.hpp&gt; #include &lt;stdlib.h&gt;  int random(unsigned int min, unsigned int max) { return rand() % ((max + min) + min); }  int main() { size_t rnd;  srand(rnd);      LDL::Window window(LDL::Vec2i(0, 0), LDL::Vec2i(800, 600)); LDL::Render render(window);     LDL::Event  report;  while (window.Running()) { while (window.GetEvent(report)) { if (report.Type == LDL::Event::IsQuit) { window.StopEvent(); } }  render.Begin();  for (size_t i = 0; i &lt; 50; i++) { render.SetColor(LDL::Color(random(0, 255), random(0, 255), random(0, 255)));  LDL::Vec2i pos  = LDL::Vec2i(random(0, 800), random(0, 600)); LDL::Vec2i size = LDL::Vec2i(random(25, 50), random(25, 50));  render.Fill(pos, size); }  render.End();  window.Update(); window.PollEvents(); }      return 0; }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 LDL \u0443\u043c\u0435\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0438\u044e \u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u041d\u043e \u0443\u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u0434\u0432\u0435 \u041e\u0421 \u0438 \u0438\u0445 \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Windows<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Linux<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0432 Windows \u043f\u0440\u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e \u043d\u0435 \u0442\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430 \u0434\u043e\u0441\u0443\u0433\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0443\u0441\u044c. \u042f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0430\u0433\u0438 \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. <\/p>\n<p>\u041f\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0443 <a href=\"https:\/\/www.libsdl.org\/\" rel=\"noopener noreferrer nofollow\">SDL2<\/a> \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043e\u043a\u043d\u043e \u0438 \u0440\u0435\u043d\u0434\u0435\u0440, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443.<\/p>\n<p>\u0411\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0441\u0440\u0430\u0437\u0443 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0422\u0430\u043a \u043a\u0430\u043a \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u043e\u043a\u043d\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u041e\u0421, \u043e\u0442\u043b\u043e\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">namespace LDL { class MainWindow { public: MainWindow(const Vec2i&amp; pos, const Vec2i&amp; size); ~MainWindow(); void Update(); void StopEvent(); bool Running(); void PollEvents(); bool GetEvent(Event&amp; event); }; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 private \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0435\u0439, \u043d\u043e \u0443\u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u0432\u0438\u0434\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u041e\u0421, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u043a\u043d\u0430, \u041e\u0421 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043e\u043a\u043d\u043e, \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u0436\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u044d\u0442\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u043b \u043e\u043a\u043d\u043e, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0418 \u0434\u0430\u043b\u0435\u0435 \u043e\u043a\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">if (report.Type == LDL::Event::IsQuit) { window.StopEvent(); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u043d\u043e \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/LDL\/include\/LDL\/RngBuf.hpp\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043b\u044c\u0446\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430<\/a>.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">namespace LDL { class GdiRender { public: GdiRender(MainWindow&amp; window); const Color&amp; GetColor(); void SetColor(const Color&amp; color); void Begin(); void End(); void Clear(); void Line(const Vec2i&amp; first, const Vec2i&amp; last); void Fill(const Vec2i&amp; pos, const Vec2i&amp; size); }; }<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c. \u0417\u0430\u0434\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0446\u0432\u0435\u0442 \u0438 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432. \u0412\u0430\u0436\u043d\u043e, \u0432\u0441\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 Begin \u0438 End.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u043a\u043e\u0434\u0430, \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0434\u0438\u043e\u043c\u0443 <a href=\"https:\/\/habr.com\/ru\/articles\/118010\/\" rel=\"noopener noreferrer nofollow\">PIMPL<\/a>, \u0447\u0442\u043e \u0431\u044b \u0441\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u041e\u0421, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">#if defined(_WIN32)     #include &lt;LDL\/Windows\/MainWin.hpp&gt; #elif defined (__unix__)     #include &lt;LDL\/UNIX\/MainWin.hpp&gt; #endif  namespace LDL { typedef MainWindow Window; }<\/code><\/pre>\n<pre><code class=\"cpp\">#if defined(_WIN32)     #include &lt;LDL\/Windows\/GdiRndr.hpp&gt; #elif defined (__unix__)     #include &lt;LDL\/UNIX\/XLibRndr.hpp&gt; #endif  namespace LDL {  #if defined(_WIN32) typedef GdiRender Render; #elif defined (__unix__) typedef XLibRender Render; #endif  }<\/code><\/pre>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0438\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u041e\u0421.<\/p>\n<p>Windows GDI<\/p>\n<pre><code class=\"cpp\">void GdiRender::Line(const Vec2i&amp; first, const Vec2i&amp; last) { MoveToEx(_window._handleDeviceContext, first.x, first.y, NULL); LineTo(_window._handleDeviceContext, last.x, last.y); }  void GdiRender::Fill(const Vec2i&amp; pos, const Vec2i&amp; size) { RECT rect;  rect.left   = pos.x; rect.top    = pos.y; rect.right  = size.x; rect.bottom = size.y;  HBRUSH brush = CreateSolidBrush(RGB(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b));  FillRect(_window._handleDeviceContext, &amp;rect, brush);  DeleteObject(brush); }<\/code><\/pre>\n<p>Linux XLib<\/p>\n<pre><code class=\"cpp\">void XLibRender::Line(const Vec2i&amp; first, const Vec2i&amp; last) { uint32_t rgb = MakeRgb(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b);  XSetForeground(_window._display, _graphics, rgb); XDrawLine(_window._display, _window._window, _graphics, first.x, first.y, last.x, last.y); }  void XLibRender::Fill(const Vec2i&amp; pos, const Vec2i&amp; size) { uint32_t rgb = MakeRgb(_baseRender.GetColor().r, _baseRender.GetColor().g, _baseRender.GetColor().b);  XSetForeground(_window._display, _graphics, rgb); XFillRectangle(_window._display, _window._window, _graphics, pos.x, pos.y, size.x, size.y); }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u043e\u0434\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432, \u0443 \u043d\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0446\u0432\u0435\u0442\u0430 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430, \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041b\u0443\u0447\u0448\u0435 \u0435\u0433\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432. \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0436\u0435\u043b\u0435\u0437\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b.<\/p>\n<p>\u0412 Linux \u043e\u0442\u043e\u0440\u0432\u0430\u0442\u044c libc \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0447\u0443\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 <a href=\"https:\/\/gist.github.com\/Scherso\/d11e7de8bd27f234519cfb94348d9c70\" rel=\"noopener noreferrer nofollow\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e<\/a>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <a href=\"https:\/\/github.com\/JordanCpp\/RetroFan\/blob\/master\/libc\/UNIX\/x86_64.s\" rel=\"noopener noreferrer nofollow\">\u0430\u0441\u043c \u0444\u0430\u0439\u043b<\/a> c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 start, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u0447\u043d\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0445 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c. \u0412\u0441\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 write \u0432 linux. \u042f \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0448\u0435\u043b \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 malloc \u0438 free \u0432 Linux. \u041d\u043e \u0443\u0436\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<pre><code class=\"cpp\">intptr LinuxApi::write(int fd, void const* data, uintptr nbytes) {     return (uintptr)syscall3(SYS_write, (void*)(intptr)fd, (void*)data, (void*)nbytes); }  void* LinuxApi::brk(uintptr nbytes) {     return syscall1(SYS_brk, (void*)nbytes); }<\/code><\/pre>\n<p>\u041d\u0430 \u0434\u043e\u0441\u0443\u0433\u0435, \u0445\u043e\u0447\u0443 \u043d\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434 Windows 3.1 \u0438 \u0441\u0442\u0430\u0440\u044b\u0439 Linux. \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043f\u0438\u0448\u0443\u0441\u044c \u043e\u0431 \u0443\u0441\u043f\u0435\u0445\u0430\u0445.<\/p>\n<p>\u0420\u0430\u0434 \u0431\u0443\u0434\u0443, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c, \u043a\u0440\u0438\u0442\u0438\u043a\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/874186\/\"> https:\/\/habr.com\/ru\/articles\/874186\/<\/a><br \/><\/br><\/br><\/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-445546","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/445546","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=445546"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/445546\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=445546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=445546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=445546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}