{"id":7,"date":"2016-05-26T10:17:00","date_gmt":"2016-05-26T08:17:00","guid":{"rendered":"https:\/\/blogs.scummvm.org\/blorente\/?p=7"},"modified":"2022-04-15T14:23:38","modified_gmt":"2022-04-15T12:23:38","slug":"refactoring","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/blorente\/2016\/05\/26\/refactoring\/","title":{"rendered":"Refactoring"},"content":{"rendered":"\n<p>This week, I\u2019m working on extracting the components of the WAGE engine that are reusable to other engines (such as\u2026 you guessed it, MacVenture), specifically that old and lovely black and white Macintosh GUI.<\/p>\n\n\n\n<p>This, in addition to easing the burden of having to create these components myself, has served to give me insight about how an engine is structured. After this, I have a much clearer idea of how I should implement MacVenture. It mught be worth to revisit the order in which I planned to write the components.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>However, as with every time that you touch other people\u2019s code, there is a constant fear that you might have broken something, even more so if we take into account the lack of tests for engines. However, little by little, I think that I arrived to a working solution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Constant Struggle for Style (that\u2019s a pun)<\/h2>\n\n\n\n<p>As it turns out, not all Macintosh GUIs were created equal, and thus they need different style constants (hence the pun) to adjust fun things like border width, border color, border pattern, window border, window frame border\u2026 well, you get the idea.<\/p>\n\n\n\n<p>For comparison\u2019s sake, here are two screensoths. One is from a WAGE game (Another Fine Mess), and the other is from a MacVenture game (Uninvited):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s492hHRV1u70uzl_540.png\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"342\" src=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s492hHRV1u70uzl_540.png\" alt=\"\" class=\"wp-image-9\" srcset=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s492hHRV1u70uzl_540.png 512w, https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s492hHRV1u70uzl_540-300x200.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s49iitqw1u70uzl_540.png\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"342\" src=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s49iitqw1u70uzl_540.png\" alt=\"\" class=\"wp-image-10\" srcset=\"https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s49iitqw1u70uzl_540.png 512w, https:\/\/blogs.scummvm.org\/blorente\/wp-content\/uploads\/sites\/15\/2022\/04\/tumblr_inline_o7s49iitqw1u70uzl_540-300x200.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Since the styles are so different, for now at least every engine will hold to it\u2019s own constants, and they will be isolated from the rest. If any of the common files (macwindow.cpp, I\u2019m looking at you) would need any constants, these will be defined in the implementation, and not in the interface, so as to keep things nice and tidy. For me in particular, this has several ramifications:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Obviously, I\u2019ll have to tinker my fair share with the constants when I\u2019m implementing MacVenture.<\/li><li>If and when I implement the Apple II graphics, I will have to do it inside MacVenture also, or spend a very sizeable portion of the schedule making the system abstract enough to handle it.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">The rest of the week<\/h2>\n\n\n\n<p>\u201cBut it\u2019s still just Thursday\u201d, you say. \u201cWhat are you going to do with the rest of the week?\u201d<\/p>\n\n\n\n<p>Well, my goal is to submit the code I already have in my fork to review by my mentor and anybody else that wants to see it, and then get it ready to issue a PR. There are still a couple of things I\u2019m unclear on, I think I can make a general style work. We\u2019ll see.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week, I\u2019m working on extracting the components of the WAGE engine that are reusable to other engines (such as\u2026 you guessed it, MacVenture), specifically that old and lovely black and white Macintosh GUI. This, in addition to easing the burden of having to create these components myself, has served to give me insight about [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":6,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":88,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/posts\/7\/revisions\/88"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/blorente\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}