doc/classes/C64.src/M000534.html in ripxplore-0.11.0 vs doc/classes/C64.src/M000534.html in ripxplore-0.12.0

- old
+ new

@@ -3,111 +3,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>to_screendump (C64)</title> + <title>border_width (C64)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre><span class="ruby-comment cmt"># File lib/host_systems/C64.rb, line 229</span> -<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_screendump</span>(<span class="ruby-identifier">text</span>,<span class="ruby-identifier">screen_width</span>=<span class="ruby-identifier">default_screen_width</span>) - - <span class="ruby-identifier">main_width</span>=<span class="ruby-identifier">font_width</span><span class="ruby-operator">*</span><span class="ruby-identifier">screen_width</span> - <span class="ruby-identifier">main_height</span>=(<span class="ruby-identifier">pixels_between_characters</span><span class="ruby-operator">+</span><span class="ruby-identifier">font_height</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">line_count</span>(<span class="ruby-identifier">text</span>,<span class="ruby-identifier">screen_width</span>) - - <span class="ruby-identifier">total_width</span>=<span class="ruby-identifier">main_width</span><span class="ruby-operator">+</span><span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">border_width</span> - <span class="ruby-identifier">total_height</span>=<span class="ruby-identifier">main_height</span><span class="ruby-operator">+</span><span class="ruby-value">2</span><span class="ruby-operator">*</span><span class="ruby-identifier">border_height</span> - - - <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-identifier">default_foreground_colour</span> - <span class="ruby-identifier">background_colour</span>=<span class="ruby-identifier">default_background_colour</span> - <span class="ruby-identifier">background_colour</span>=<span class="ruby-constant">COLOR_BLACK</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span><span class="ruby-operator">=~</span><span class="ruby-regexp re">/\x5|\x1c|\x1e|\x1f|\x81|\x90|\x95|\x96|\x97|\x8e|\x99|\x9a|\x9b|\x9c|\x9e|\x9f/</span> - -<span class="ruby-identifier">canvas</span> = <span class="ruby-constant">PNG</span><span class="ruby-operator">::</span><span class="ruby-constant">Canvas</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">total_width</span>,<span class="ruby-identifier">total_height</span> , <span class="ruby-identifier">background_colour</span> - <span class="ruby-comment cmt">#draw the borders </span> - <span class="ruby-identifier">total_width</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">total_height</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">y</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">canvas</span>[<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>]=<span class="ruby-identifier">foreground_colour</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">x</span><span class="ruby-operator">&lt;</span><span class="ruby-identifier">border_width</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">x</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">main_width</span><span class="ruby-operator">+</span><span class="ruby-identifier">border_width</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">y</span><span class="ruby-operator">&lt;</span><span class="ruby-identifier">border_height</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">y</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">border_height</span><span class="ruby-operator">+</span><span class="ruby-identifier">main_height</span>) - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">line_number</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">reverse</span>=<span class="ruby-keyword kw">false</span> - <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:lowercase</span> - <span class="ruby-identifier">enable_shift_cbm</span>=<span class="ruby-keyword kw">true</span> - <span class="ruby-identifier">text</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span> - <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">char</span> - <span class="ruby-comment cmt">#colours first </span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">5</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_WHITE</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">28</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_RED</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">30</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_GREEN</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">31</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_BLUE</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">129</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_ORANGE</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">144</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_BLACK</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">149</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_BROWN</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">150</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_LTRED</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">151</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_DKGRAY</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">152</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_GRAY</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">153</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_LTGREEN</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">154</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_LTBLUE</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">155</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_LTGRAY</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">156</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_PURPLE</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">158</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_YELLOW</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">159</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COLOR_CYAN</span> - <span class="ruby-comment cmt">#now movement </span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">10</span> <span class="ruby-comment cmt">#do nothing </span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">13</span> , <span class="ruby-value">141</span> <span class="ruby-comment cmt">#return </span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">reverse</span>=<span class="ruby-keyword kw">false</span> - <span class="ruby-identifier">line_number</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">17</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">line_number</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">147</span> <span class="ruby-comment cmt">#clr/home </span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">line_number</span>=<span class="ruby-value">0</span> - <span class="ruby-comment cmt">#cls </span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">19</span> <span class="ruby-comment cmt">#home </span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">line_number</span>=<span class="ruby-value">0</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">20</span> <span class="ruby-comment cmt">#delete </span> - <span class="ruby-identifier">col</span><span class="ruby-operator">-=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">col</span><span class="ruby-operator">&lt;</span><span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">col</span>=<span class="ruby-identifier">screen_width</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> - <span class="ruby-identifier">line_number</span><span class="ruby-operator">-=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">draw_char_at</span>(<span class="ruby-identifier">canvas</span>,<span class="ruby-ivar">@screencode</span>[<span class="ruby-value">32</span>],<span class="ruby-identifier">line_number</span>,<span class="ruby-identifier">col</span>,<span class="ruby-identifier">foreground_colour</span>,<span class="ruby-identifier">background_colour</span>,<span class="ruby-identifier">mode</span>,<span class="ruby-keyword kw">false</span>) - - <span class="ruby-keyword kw">when</span> <span class="ruby-value">157</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">col</span><span class="ruby-operator">-=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">29</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">col</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">145</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">line_number</span><span class="ruby-operator">-=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">148</span> <span class="ruby-comment cmt"># insert ? </span> - - - - <span class="ruby-comment cmt">#now fonts </span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">8</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">enable_shift_cbm</span>=<span class="ruby-keyword kw">false</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">9</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">enable_shift_cbm</span>=<span class="ruby-keyword kw">true</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">14</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:lowercase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enable_shift_cbm</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">142</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:graphics</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enable_shift_cbm</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">18</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">reverse</span>=<span class="ruby-keyword kw">true</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">146</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">reverse</span>=<span class="ruby-keyword kw">false</span> - - <span class="ruby-keyword kw">else</span> -<span class="ruby-comment cmt"># puts &quot;#{line_number},#{col}&quot; </span> - <span class="ruby-identifier">draw_char_at</span>(<span class="ruby-identifier">canvas</span>,<span class="ruby-ivar">@screencode</span>[<span class="ruby-identifier">char</span>],<span class="ruby-identifier">line_number</span>,<span class="ruby-identifier">col</span>,<span class="ruby-identifier">foreground_colour</span>,<span class="ruby-identifier">background_colour</span>,<span class="ruby-identifier">mode</span>,<span class="ruby-identifier">reverse</span>) - <span class="ruby-identifier">col</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">col</span><span class="ruby-operator">&gt;=</span><span class="ruby-identifier">screen_width</span>) <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">line_number</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">col</span><span class="ruby-operator">&lt;</span><span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">line_number</span><span class="ruby-operator">-=</span><span class="ruby-value">1</span> - <span class="ruby-identifier">col</span>=<span class="ruby-identifier">screen_width</span><span class="ruby-operator">-</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">line_number</span>=<span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line_number</span><span class="ruby-operator">&lt;</span><span class="ruby-value">0</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-constant">PNG</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">canvas</span>).<span class="ruby-identifier">raw_bytes</span> + <pre><span class="ruby-comment cmt"># File lib/host_systems/C64.rb, line 114</span> +<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">border_width</span> + <span class="ruby-value">40</span> <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file