{"id":135,"date":"2023-08-13T17:23:57","date_gmt":"2023-08-13T17:23:57","guid":{"rendered":"https:\/\/blogs.scummvm.org\/hsk\/?p=135"},"modified":"2023-08-16T18:58:08","modified_gmt":"2023-08-16T18:58:08","slug":"reading-books-in-total-distortion","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/hsk\/2023\/08\/13\/reading-books-in-total-distortion\/","title":{"rendered":"Reading Books in Total Distortion"},"content":{"rendered":"<p>Greetings everybody! Just before we start, I have something to tell you all, It&#8217;s about time and we are in the final phases of GSoC ending, the final mentor evaluation is about to happen (2 weeks~) and unfortunately, that means my tenure will be coming to an end! With that being said let&#8217;s start with my work this week! (plus what has been merged)<\/p>\n<p>This week I have worked on fixing more bugs and improve more support, let&#8217;s start with the title!<\/p>\n<h3>Reading Books in Total Distortion!<\/h3>\n<p>Linked to <a href=\"https:\/\/trello.com\/c\/ZMRuRYA0\/632-index-books-overflow\">https:\/\/trello.com\/c\/ZMRuRYA0\/632-index-books-overflow<\/a> where in books library the index in book was overflowing (see image)<\/p>\n<figure style=\"width: 511px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/trello.com\/1\/cards\/647ee5908b97303c7c21b81d\/attachments\/647ee5d0f404bb444f1a32d6\/previews\/647ee5d1f404bb444f1a335d\/download\/image.png\" alt=\"image.png\" width=\"511\" height=\"420\" \/><figcaption class=\"wp-caption-text\">bad (or bugged) render of books<\/figcaption><\/figure>\n<p>Now, like any good sensible developer I took it upon myself to fix this issue! To do that I have to investigate, that how this thing is different from other &#8220;texts&#8221; in Director.. and I found that:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-136\" src=\"https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/Screenshot-from-2023-08-13-21-54-01-300x155.png\" alt=\"\" width=\"379\" height=\"196\" srcset=\"https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/Screenshot-from-2023-08-13-21-54-01-300x155.png 300w, https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/Screenshot-from-2023-08-13-21-54-01.png 453w\" sizes=\"auto, (max-width: 379px) 100vw, 379px\" \/><\/p>\n<p><em>Style: Scrolling <\/em>and that&#8217;s it! The difference was that this &#8220;text cast&#8221; has this style &#8220;Scrolling&#8221;, which was giving issues as in ScummVM we didn&#8217;t implement &#8220;Scrolling&#8221; textcast! You might have been confused about one thing: What is &#8220;Cast?&#8221; or &#8220;Text Cast&#8221; here??<\/p>\n<p>Well a cast is like an element of movie, it is like the building blocks of any game\/multimedia in director engine, and among these elements, we have many different kinds, for example Image cast, text cast, filmloop (series of frames), digital-video etc etc. Now each of these building blocks can have properties, like here TextCast member has this property of Style, where we can choose what kind of cast that is!<\/p>\n<div class=\"message-2CShn3 cozyMessage-1DWF9U wrapper-30-Nkg cozy-VmLDNB zalgo-26OfGz\" role=\"article\" data-list-item-id=\"chat-messages___chat-messages-636495083935629325-1141370313154764831\" aria-labelledby=\"message-username-1141370249162276918 uid_1 message-content-1141370313154764831 uid_2 message-timestamp-1141370313154764831\">\n<div class=\"contents-2MsGLg\">\n<blockquote>\n<div id=\"message-content-1141370313154764831\" class=\"markup-eYLPri messageContent-2t3eCI\">The Cast terms originally coined right after movies<\/p>\n<p>e.g. it is one of the actors in a movie, you put it on a Frame, and Frames compose a Score<br \/>\n~ sev, (#engine-director, discord server)<\/p><\/div>\n<\/blockquote>\n<\/div>\n<div class=\"buttonContainer-1502pf\">\n<div class=\"buttons-3dF5Kd container-2gUZhU\" role=\"group\" aria-label=\"Message Actions\"><\/div>\n<\/div>\n<\/div>\n<p>So as I have previously mentioned, there is only simple text cast implemented in ScummVM, therefore, what I had to do is to simply implement a scrolling cast member! One\u00a0 that takes into account a scrollbar in side and the logic to click items in it!<\/p>\n<p>Well to do that, I just reused the TextScrollingWindow (ie a special kind of window specially created for displaying text in mac styled windows), well I had to do this because of scrollbar, that I needed in order to implement this scroll behaviour! Now as a part of doing this, what I was basically doing is to reuse the code that was written for text display, google says about code reuse:<\/p>\n<blockquote>\n<div class=\"wDYxhc\" lang=\"en-IN\" data-md=\"61\">\n<div class=\"LGOjhe\" role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\"><span class=\"ILfuVd\" lang=\"en\"><span class=\"hgKElc\">Code reuse aims\u00a0<b>to save time and resources and reduce redundancy<\/b> by taking advantage of assets that have already been created in some form within the software product development process.<\/span><\/span><\/div>\n<\/div>\n<\/blockquote>\n<div role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\">and that serves about right! I could have simply written everything into default text class (which was used to mactexts) however the thing is, to do that I have to add scrollbar, its render, then event functions.. basically all of these were there in textwindow itself, so why do that all again when all you can do is to reuse it!<\/div>\n<div role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\"><\/div>\n<div role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\">and that is how, after fixing it up, and making more changes to make it work properly, here&#8217;s the final result:<\/div>\n<div role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\"><\/div>\n<div role=\"heading\" data-attrid=\"wa:\/description\" data-hveid=\"CBsQAA\">\n<div style=\"width: 580px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-135-1\" width=\"580\" height=\"363\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/088f2545-3874-4813-899d-d8aeda7232df.mp4?_=1\" \/><a href=\"https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/088f2545-3874-4813-899d-d8aeda7232df.mp4\">https:\/\/blogs.scummvm.org\/hsk\/wp-content\/uploads\/sites\/71\/2023\/08\/088f2545-3874-4813-899d-d8aeda7232df.mp4<\/a><\/video><\/div>\n<p>and that&#8217;s how the working books look like, Happy Reading!<\/p>\n<p>Link to PR &#8211; <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/5182\">#5182<\/a><\/p>\n<h4>More work done<\/h4>\n<p><strong>Fixing visibility issues when setting window properties<\/strong><\/p>\n<p>There was this bug where assigning windows property automatically used to bring them to foreground, but this was not good as it means that sometimes hidden window that are supposed to be hidden are now shown, to fix it all I had to do is to remove the statement that does this and voila, fixed!<\/p>\n<p>Link to PR &#8211; <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/5245\">#5245<\/a><\/p>\n<p><strong>Refactor frames loading, fixing chan command<\/strong><\/p>\n<p>If you have been reading my blogs for a while, you must be knowing about one of the biggest changes to frames loading, well there are still some things that pop out occasionally, one of them being this debugger command &#8220;chan &lt;number&gt;&#8221; which was used to list channel information on any specific frame! The fix was simple, to refactor some things and fix the logic!<\/p>\n<p>Link to PR &#8211; <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/5255\">#5255<\/a><\/p>\n<h3>The End<\/h3>\n<p>Thank you for reading so far, its been great writing and working for scummvm and I really enjoyed this whole journey! Before ending I&#8217;d like to say that I have been offered to become member of this organization (Director engine), and I am very happy for that! (the process is still underway but expect the results next week), what that means is I can officially start directly committing codes to scummvm, and get some perks (cool discord roles, etc!). With that being said see you in next article!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Greetings everybody! Just before we start, I have something to tell you all, It&#8217;s about time and we are in the final phases of GSoC ending, the final mentor evaluation is about to happen (2 weeks~) and unfortunately, that means my tenure will be coming to an end! With that being said let&#8217;s start with [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4,7,6,9],"tags":[],"class_list":["post-135","post","type-post","status-publish","format-standard","hentry","category-coding","category-experience","category-fun","category-opinion","category-technical"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":3,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":140,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/posts\/135\/revisions\/140"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/hsk\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}