{"id":166357,"date":"2013-01-20T17:58:03","date_gmt":"2013-01-20T13:58:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=166357"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=166357","title":{"rendered":"<span class=\"post_title\">\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043e\u0442\u0432\u0430\u0436\u043d\u044b\u0439 \u0430\u0440\u043a\u0430\u043d\u043e\u0438\u0434 (\u0447\u0430\u0441\u0442\u044c 2 \u2014 YAML)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u043f\u0440\u043e \u043d\u0430\u0448 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 (\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043e\u0442\u0432\u0430\u0436\u043d\u044b\u0439) <a href=\"http:\/\/habrahabr.ru\/post\/165667\/\">arcanoid<\/a>, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043e \u0442\u0430\u043a\u043e\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043a\u0430\u043a <a href=\"http:\/\/ru.wikipedia.org\/wiki\/YAML\">YAML<\/a>. \u041b\u044e\u0431\u0430\u044f, \u0434\u0430\u0436\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0438\u0433\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0439 \u0438 \u0442.\u043f. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0438 \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u0432\u0438\u0434\u0435. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e, \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/ru.wikipedia.org\/wiki\/XML\">XML<\/a>, \u043d\u043e \u043e\u043d \u0432\u0435\u0441\u044c\u043c\u0430 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u0435\u043d \u0438 \u0435\u0433\u043e \u0432\u0440\u044f\u0434-\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  YAML \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f, \u0437\u0430\u0447\u0435\u043c \u043d\u0430\u043c YAML. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e, \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">level.json<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>{   board: { width: 320 },   types: { odd:  { inner_color: 0xffffff00,                    outer_color: 0xff50ff00,                    width: 40,                    height: 20                  },            even: { inner_color: 0xff1010ff,                    outer_color: 0xffffffff,                    width: 40,                    height: 20                  }          },   level: [            { type: odd,              x: 50,              y: 30            },            { type: even,              x: 94,              y: 30            },            { type: odd,              x: 138,              y: 30            },            { type: even,              x: 182,              y: 30            },            { type: odd,              x: 226,              y: 30            },            { type: even,              x: 270,              y: 30            },            { type: even,              x: 50,              y: 54            },            { type: odd,              x: 94,              y: 54            },            { type: even,              x: 138,              y: 54            },            { type: odd,              x: 182,              y: 54            },            { type: even,              x: 226,              y: 54            },            { type: odd,              x: 270,              y: 54            },            { type: odd,              x: 50,              y: 78            },            { type: even,              x: 94,              y: 78            },            { type: odd,              x: 138,              y: 78            },            { type: even,              x: 182,              y: 78            },            { type: odd,              x: 226,              y: 78            },            { type: even,              x: 270,              y: 78            },            { type: even,              x: 50,              y: 102            },            { type: odd,              x: 94,              y: 102            },            { type: even,              x: 138,              y: 102            },            { type: odd,              x: 182,              y: 102            },            { type: even,              x: 226,              y: 102            },            { type: odd,              x: 270,              y: 102            }          ] } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043d\u0430\u0434\u043e \u0433\u043d\u0435\u0432\u043d\u043e \u043a\u0440\u0438\u0447\u0430\u0442\u044c \u00ab\u043d\u0430\u0441 \u043e\u0431\u043c\u0430\u043d\u0443\u043b\u0438!\u00bb. \u0414\u0430, \u044d\u0442\u043e <a href=\"http:\/\/ru.wikipedia.org\/wiki\/JSON\">JSON<\/a>. \u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 YAML \u0442\u043e\u0436\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0440\u043e\u0441\u0442\u043e JSON \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c YAML \u0438 \u043b\u044e\u0431\u043e\u0435 JSON \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043e YAML-\u043f\u0430\u0440\u0441\u0435\u0440\u043e\u043c. JSON \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0440\u043e\u0433 \u0438 \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u0435\u043d (\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435 \u0447\u0435\u043c XML).<\/p>\n<p>  \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0435\u043e\u0440\u0438\u0438, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0434\u0435\u043b\u0443. \u041d\u0430\u0439\u0434\u0435\u043c \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 <a href=\"http:\/\/pyyaml.org\/wiki\/LibYAML\">\u043b\u044e\u0431\u0443\u044e<\/a> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 YAML \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435 \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. \u041a \u0441\u043b\u043e\u0432\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043d\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u0430 \u041a\u0438\u0440\u0438\u043b\u043b\u043e\u043c \u0421\u0438\u043c\u043e\u043d\u043e\u0432\u044b\u043c \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e <a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%9B%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F_MIT\">MIT license<\/a> (\u043e \u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"http:\/\/pyyaml.org\/wiki\/LibYAML#Copyright\">Copyright<\/a> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438).<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 mkb-\u0444\u0430\u0439\u043b <a href=\"http:\/\/www.madewithmarmalade.com\/\">Marmalade<\/a>-\u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0434\u043f\u0440\u043e\u0435\u043a\u0442\u0430 Marmalade, \u0431\u043b\u0430\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0435 Maramalade \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u00abyaml\u00bb \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 mkf-\u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">yaml.mkf<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">includepath h includepath source  files {     (h)     yaml.h     config.h      (source)     yaml_private.h     api.c     dumper.c     emitter.c     loader.c     parser.c     reader.c     scanner.c     writer.c } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043d\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 mkf-\u0444\u0430\u0439\u043b\u0435. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 Marmalade-\u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. <\/p>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">arcanoid.mkb<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#!\/usr\/bin\/env mkb options { \tmodule_path=&quot;..\/yaml&quot; } subprojects { \tiwgl \tyaml } includepath { \t.\/source\/Main \t.\/source\/Model } files { \t[Main] \t(source\/Main) \tMain.cpp \tMain.h \tQuads.cpp \tQuads.h        \tDesktop.cpp \tDesktop.h \tIO.cpp \tIO.h  \t[Model] \t(source\/Model) \tBoard.cpp \tBoard.h \tBricks.cpp \tBricks.h \tBall.cpp \tBall.h  \t[Data] \t(data) } assets { \t(data) \tlevel.json  \t(data-ram\/data-gles1, data\/data-gles1) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043c\u043e\u0434\u0443\u043b\u044c YAML \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0438 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0435 \u043e\u0442 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 Board:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Board.h<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#ifndef _BOARD_H_ #define _BOARD_H_  #include &lt;yaml.h&gt; #include &lt;vector&gt; #include &lt;String&gt;  #include &quot;Bricks.h&quot; #include &quot;Ball.h&quot;  #define MAX_NAME_SZ   100  using namespace std;  enum EBrickMask {     ebmX            = 0x01,     ebmY            = 0x02,     ebmComplete     = 0x03,     ebmWidth        = 0x04,     ebmHeight       = 0x08,     ebmIColor       = 0x10,     ebmOColor       = 0x20 };  class Board {     private:         struct Type {             Type(const char* s, const char* n, const char* v): s(s), n(n), v(v) {}             Type(const Type& p): s(p.s), n(p.n), v(p.v) {}             string s, n, v;         };         Bricks bricks;         Ball ball;         yaml_parser_t parser;         yaml_event_t event;         vector&lt;string&gt; scopes;         vector&lt;Type&gt; types;         char currName[MAX_NAME_SZ];         int  brickMask;         int  brickX, brickY, brickW, brickH, brickIC, brickOC;         bool isTypeScope;         void load();         void clear();         void notify();         const char* getScopeName();         void setProperty(const char* scope, const char* name, const char* value);         void closeTag(const char* scope);         int  fromNum(const char* s);     public:         Board(): scopes(), types() {}         void init();         void refresh(); \t\tvoid update() {}      typedef vector&lt;string&gt;::iterator SIter;     typedef vector&lt;Type&gt;::iterator TIter; };  #endif\t\/\/ _BOARD_H_ <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Board.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &quot;Board.h&quot; #include &quot;Desktop.h&quot;  const char* BOARD_SCOPE      = &quot;board&quot;; const char* LEVEL_SCOPE      = &quot;level&quot;; const char* TYPE_SCOPE       = &quot;types&quot;;  const char* TYPE_PROPERTY    = &quot;type&quot;; const char* WIDTH_PROPERTY   = &quot;width&quot;; const char* HEIGHT_PROPERTY  = &quot;height&quot;; const char* IC_PROPERTY      = &quot;inner_color&quot;; const char* OC_PROPERTY      = &quot;outer_color&quot;; const char* X_PROPERTY       = &quot;x&quot;; const char* Y_PROPERTY       = &quot;y&quot;;  void Board::init() {     load();     ball.init(); }  void Board::clear() {     bricks.clear();     scopes.clear();     memset(currName, 0, sizeof(currName));     types.clear(); }  void Board::load() {     clear();     yaml_parser_initialize(&parser);     FILE *input = fopen(&quot;level.json&quot;, &quot;rb&quot;);     yaml_parser_set_input_file(&parser, input);     int done = 0;     while (!done) {         if (!yaml_parser_parse(&parser, &event)) {             break;         }         notify();         done = (event.type == YAML_STREAM_END_EVENT);         yaml_event_delete(&event);     }     yaml_parser_delete(&parser);     fclose(input); }  void Board::notify() {     switch (event.type) {         case YAML_MAPPING_START_EVENT:         case YAML_SEQUENCE_START_EVENT:             scopes.push_back(currName);             memset(currName, 0, sizeof(currName));             break;                    case YAML_MAPPING_END_EVENT:             closeTag(getScopeName());         case YAML_SEQUENCE_END_EVENT:             scopes.pop_back();             break;         case YAML_SCALAR_EVENT:             if (currName[0] == 0) {                 strncpy(currName,                              (const char*)event.data.scalar.value,                              sizeof(currName)-1);                 break;             }             setProperty(getScopeName(),                                 currName,                                 (const char*)event.data.scalar.value);             memset(currName, 0, sizeof(currName));             break;          default:             break;     } }  const char* Board::getScopeName() {     const char* r = NULL;     isTypeScope = false;     for (SIter p = scopes.begin(); p !=scopes.end(); ++p) {          if (!(*p).empty()) {              if (strcmp((*p).c_str(), TYPE_SCOPE) == 0) {                 isTypeScope = true;                 continue;              }              r = (*p).c_str();          }     }     return r; }  int Board::fromNum(const char* s) {     int r = 0;     int x = 10;     for (size_t i = 0; i &lt; strlen(s); i++) {         switch (s[i]) {             case 'x':             case 'X':                 x = 16;                 break;             case 'a':             case 'b':             case 'c':             case 'd':             case 'e':             case 'f':                 x = 16;                 r *= x;                 r += s[i] - 'a' + 10;                 break;             case 'A':             case 'B':             case 'C':             case 'D':             case 'E':             case 'F':                 x = 16;                 r *= x;                 r += s[i] - 'A' + 10;                 break;             default:                 r *= x;                 r += s[i] - '0';                 break;         }     }     return r; }  void Board::setProperty(const char* scope, const char* name, const char* value) {     if (scope == NULL) return;     if (isTypeScope) {         types.push_back(Type(scope, name, value));         return;     }     if (strcmp(scope, BOARD_SCOPE) == 0) {         if (strcmp(name, WIDTH_PROPERTY) == 0) {             desktop.setVSize(fromNum(value));         }     }     if (strcmp(scope, LEVEL_SCOPE) == 0) {         if (strcmp(name, TYPE_PROPERTY) == 0) {             for (TIter p = types.begin(); p != types.end(); ++p) {                  if (strcmp(value, p-&gt;s.c_str()) == 0) {                     setProperty(scope, p-&gt;n.c_str(), p-&gt;v.c_str());                  }             }         }         if (strcmp(name, X_PROPERTY) == 0) {             brickMask |= ebmX;             brickX = fromNum(value);         }         if (strcmp(name, Y_PROPERTY) == 0) {             brickMask |= ebmY;             brickY = fromNum(value);         }         if (strcmp(name, WIDTH_PROPERTY) == 0) {             brickMask |= ebmWidth;             brickW = fromNum(value);         }         if (strcmp(name, HEIGHT_PROPERTY) == 0) {             brickMask |= ebmHeight;             brickH = fromNum(value);         }         if (strcmp(name, IC_PROPERTY) == 0) {             brickMask |= ebmIColor;             brickIC = fromNum(value);         }         if (strcmp(name, OC_PROPERTY) == 0) {             brickMask |= ebmOColor;             brickOC = fromNum(value);         }     } }  void Board::closeTag(const char* scope) {     if (scope == NULL) return;     if (strcmp(scope, LEVEL_SCOPE) == 0) {         if ((brickMask & ebmComplete) == ebmComplete) {             Bricks::SBrick b(desktop.toRSize(brickX), desktop.toRSize(brickY));             if ((brickMask & ebmWidth) != 0) {                 b.hw = desktop.toRSize(brickW) \/ 2;             }             if ((brickMask & ebmHeight) != 0) {                 b.hh = desktop.toRSize(brickH) \/ 2;             }             if ((brickMask & ebmIColor) != 0) {                 b.ic = brickIC;             }             if ((brickMask & ebmOColor) != 0) {                 b.oc = brickOC;             }             bricks.add(b);         }         brickMask = 0;     } }  void Board::refresh() {     bricks.refresh();     ball.refresh(); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0424\u0430\u0439\u043b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u044f \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 load. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 yaml_parser_parse \u0432 \u0446\u0438\u043a\u043b\u0435, \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430. \u0410\u043d\u0430\u043b\u0438\u0437 \u044d\u0442\u043e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0435\u043d. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0436\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043d\u043e\u0441\u0438\u0442 \u043b\u0438\u0448\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0435\u043a\u0446\u0438\u0438 \u00abtypes\u00bb. \u0412 \u043d\u0435\u0439 \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u00ab\u0448\u0430\u0431\u043b\u043e\u043d\u044b\u00bb \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0432\u0438\u0438 \u0441\u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u00ab\u043a\u0438\u0440\u043f\u0438\u0447\u0435\u0439\u00bb, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0438\u043c\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u00abtype\u00bb.<\/p>\n<p>  \u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00abboard\u00bb \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u0443 \u0434\u043e\u0441\u043a\u0438. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b, \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0435. \u041e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0434\u043e\u0441\u043a\u0438 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f. \u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0436\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0434\u043e\u0431\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u044b \u0438 \u0432\u044b\u0441\u043e\u0442\u044b \u044d\u043a\u0440\u0430\u043d\u0430 (\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u00ab\u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f\u00bb \u0432 \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435).<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0438\u0441\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/4.bp.blogspot.com\/-O9NCR0HXRR0\/UPwBe6PWW6I\/AAAAAAAAAP8\/cwXsuhQ5o-s\/s1600\/0001.PNG\" alt=\"image\"\/><\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 LibYAML \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c YAML-\u0444\u0430\u0439\u043b\u043e\u0432. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c YAML-\u0444\u0430\u0439\u043b\u044b \u0441\u0430\u043c\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0432 \u043d\u0438\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"http:\/\/pyyaml.org\/wiki\/LibYAML#EmitterAPISynopsis\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435<\/a> \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 DataDirIsRAM:<\/p>\n<pre><code class=\"cpp\">[S3E] SysGlesVersion=1 DispFixRot=FixedPortrait DataDirIsRAM=1 <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 YAML \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/GlukKazan\/mf\/tree\/master\/modules\/yaml\">GitHub<\/a>.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Box2D.      \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\/166357\/\"> http:\/\/habrahabr.ru\/post\/166357\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u043f\u0440\u043e \u043d\u0430\u0448 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 (\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043e\u0442\u0432\u0430\u0436\u043d\u044b\u0439) <a href=\"http:\/\/habrahabr.ru\/post\/165667\/\">arcanoid<\/a>, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043e \u0442\u0430\u043a\u043e\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043a\u0430\u043a <a href=\"http:\/\/ru.wikipedia.org\/wiki\/YAML\">YAML<\/a>. \u041b\u044e\u0431\u0430\u044f, \u0434\u0430\u0436\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0438\u0433\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0439 \u0438 \u0442.\u043f. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0438 \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u0432\u0438\u0434\u0435. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e, \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/ru.wikipedia.org\/wiki\/XML\">XML<\/a>, \u043d\u043e \u043e\u043d \u0432\u0435\u0441\u044c\u043c\u0430 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u0435\u043d \u0438 \u0435\u0433\u043e \u0432\u0440\u044f\u0434-\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  YAML \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.  <\/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-166357","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166357","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=166357"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166357\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}