{"id":19,"date":"2008-06-18T00:36:04","date_gmt":"2008-06-18T00:36:04","guid":{"rendered":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/?p=19"},"modified":"2022-05-21T11:08:52","modified_gmt":"2022-05-21T11:08:52","slug":"finally-started-coding","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/2008\/06\/18\/finally-started-coding\/","title":{"rendered":"Finally started coding"},"content":{"rendered":"<p>Been a while since I&#8217;ve updated my blog, but rest assured my project work has been progressing well. I&#8217;ve made tremendous progress in terms of my understanding and ideas for the project, and have even made a substantial start on coding&#8230;.finally!<\/p>\n<h4>Progression of ideas<\/h4>\n<p>Since my last post I have gone from understanding the general techniques that my virtual keyboard will utilise, to the details of the project. I have also discussed my progress with Eugene, and he helped me by further explaining his original ideas for the keyboard. Some of the key areas I have looked are discussed below.<\/p>\n<h5>Handling of images<\/h5>\n<p>Had to look into what code existed to load images. Found that the ImageManager class would do all the hard work, including the loading of images from within a zip archive. The ThemeModern class of the GUI helped me understand how I would use this.<\/p>\n<h5>Format of the keyboard&#8217;s ini file<\/h5>\n<p>I adopted Eugene&#8217;s original idea of extended the HTML imagemap format, to give a simple XML file that would encapsulate all the information needed to describe the different resolutions. For example:<\/p>\n<blockquote>\n<pre>&lt;keyboard&gt; &lt;resolution=320xy&gt; &lt;mode=normal&gt;\r\n&lt;image=\"key_normal.bmp\"&gt; &lt;map&gt; ... &lt;\/map&gt; &lt;\/mode&gt; ...\r\n&lt;\/resolution&gt; ... &lt;\/keyboard&gt;<\/pre>\n<\/blockquote>\n<p>I will write a very simple, specialised XML parser for parsing this file, and the specific format of it will be tied down at a later date.<\/p>\n<h5>Polygon intersection methods<\/h5>\n<p>As I needed to allow for polygonal areas in the image map for the keyboard I had to research algorithms for determining whether a point is inside a polygon. This was known as the Point In Polygon problem. There were a number of different algorithms, but the one that seemed to be simple and quick was the ray casting method. This method works by testing how many times a ray starting from the point intersects the edges of the polygon. If this number is odd then the point is inside the polygon.<\/p>\n<h5>Idea of having hierarchy of image map areas<\/h5>\n<p>After looking into polygonal intersection routines, I thought that my virtual keyboard could run into efficiency issues when it tries to find out which area of a map was clicked, because there would be alot of different areas it could be. This lead me to think that I could arrange all the imagemap areas into a hierarchy based on areas of the keyboard. It would be similar to the Bounding Volume Hierarchy technique that I used when implementing a ray tracer for my Computer Graphics assignment. Whether this will be needed or not will remain to be seen, but the idea is there.<\/p>\n<h4>Started coding<\/h4>\n<p>I felt that now was a good time to start writing code. I started by:<\/p>\n<ul>\n<li>Writing the header file for the VirtualKeyboard class &#8211; defining its interface and key methods<\/li>\n<li>Writing support classes for the image map areas &#8211; including intersection method (that would detect whether a point was inside the area or not)<\/li>\n<li>Made a start on writing of simple XML parser for the ini file<\/li>\n<\/ul>\n<p>I&#8217;m off on holiday tomorrow, so I won&#8217;t be around for a week. But once i&#8217;m back i&#8217;ll be able to really crack on with the coding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Been a while since I&#8217;ve updated my blog, but rest assured my project work has been progressing well. I&#8217;ve made tremendous progress in terms of my understanding and ideas for the project, and have even made a substantial start on coding&#8230;.finally! Progression of ideas Since my last post I have gone from understanding the general [&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-19","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":3,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/posts\/19\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/kenny-gsoc\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}