diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/docs.css | 12 | ||||
| -rw-r--r-- | docs/docs.html | 7865 | ||||
| -rw-r--r-- | docs/docs.txt | 8590 | ||||
| -rw-r--r-- | docs/parse_log.txt | 38150 |
4 files changed, 42659 insertions, 11958 deletions
diff --git a/docs/docs.css b/docs/docs.css index 115fd34..84cd977 100644 --- a/docs/docs.css +++ b/docs/docs.css @@ -127,30 +127,30 @@ blockquote { font-style: italic; } -#toc { +#table-of-contents { font-size: 14px; } -#toc ul { +#table-of-contents ul { margin-left: 3px; padding-left: 15px; } -#toc .header-1 { +#table-of-contents .header-1 { display: inline-block; margin-top: 10px; font-weight: 900; } -#toc .header-2 { +#table-of-contents .header-2 { display: inline-block; padding-left: 5px; padding-right: 5px; margin-top: 10px; } -#toc .header-3 { +#table-of-contents .header-3 { } @media only screen and (min-width: 1280px) { @@ -160,7 +160,7 @@ blockquote { padding-left: 310px; } - #toc { + #table-of-contents { border: solid 1px #f0f0f0; padding: 10px; padding-bottom: 30px; diff --git a/docs/docs.html b/docs/docs.html index 39d0086..67cd054 100644 --- a/docs/docs.html +++ b/docs/docs.html @@ -1,27 +1,29 @@ -<html> +<html lang="en"> <head> + <meta charset="utf-8"> <title>DragonRuby Game Toolkit Documentation</title> - <link href="docs.css?ver=1617643886" rel="stylesheet" type="text/css" media="all"> + <link href="docs.css?ver=1637820563" rel="stylesheet" type="text/css" media="all"> </head> <body> - <div id='toc'> + <div id='table-of-contents'> <h1>Table Of Contents</h1> <ul> <li><a class='header-1' href='#--dragonruby-game-toolkit-live-docs'>DragonRuby Game Toolkit Live Docs</a></li> <li><a class='header-1' href='#--hello-world'>Hello World</a></li> <li><a class='header-1' href='#--join-the-discord-and-subscribe-to-the-news-letter'>Join the Discord and Subscribe to the News Letter</a></li> -<li><a class='header-1' href='#--watch-some-intro-videos'>Watch Some Intro Videos</a></li> -<li><a class='header-1' href='#--getting-started-tutorial'>Getting Started Tutorial</a></li> -<ul><li><a class='header-2' href='#---introduction'>Introduction</a></li></ul><ul><li><a class='header-2' href='#---prerequisites'>Prerequisites</a></li></ul><ul><li><a class='header-2' href='#---the-game-loop'>The Game Loop</a></li></ul><ul><li><a class='header-2' href='#---breakdown-of-the--tick--method'>Breakdown Of The <code>tick</code> Method</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-sprite'>Rendering A Sprite</a></li></ul><ul><li><a class='header-2' href='#---coordinate-system-and-virtual-canvas'>Coordinate System and Virtual Canvas</a></li></ul><ul><li><a class='header-2' href='#---game-state'>Game State</a></li></ul><ul><li><a class='header-2' href='#---there-is-no-delta-time'>There Is No Delta Time</a></li></ul><ul><li><a class='header-2' href='#---handling-user-input'>Handling User Input</a></li></ul><ul><li><a class='header-2' href='#---coding-on-a-raspberry-pi'>Coding On A Raspberry Pi</a></li></ul><ul><li><a class='header-2' href='#---conclusion'>Conclusion</a></li></ul><li><a class='header-1' href='#--deploying-to-itch.io'>Deploying To Itch.io</a></li> +<li><a class='header-1' href='#--intro-videos'>Intro Videos</a></li> +<ul><li><a class='header-2' href='#---quick-api-tour'>Quick Api Tour</a></li></ul><ul><li><a class='header-2' href='#---if-you-are-completely-new-to-ruby-and-programming'>If You Are Completely New to Ruby and Programming</a></li></ul><ul><li><a class='header-2' href='#---if-you-have-game-dev-experience'>If You Have Game Dev Experience</a></li></ul><li><a class='header-1' href='#--getting-started-tutorial'>Getting Started Tutorial</a></li> +<ul><li><a class='header-2' href='#---introduction'>Introduction</a></li></ul><ul><li><a class='header-2' href='#---prerequisites'>Prerequisites</a></li></ul><ul><li><a class='header-2' href='#---the-game-loop'>The Game Loop</a></li></ul><ul><li><a class='header-2' href='#---breakdown-of-the--tick--method'>Breakdown Of The <code>tick</code> Method</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-sprite'>Rendering A Sprite</a></li></ul><ul><li><a class='header-2' href='#---coordinate-system-and-virtual-canvas'>Coordinate System and Virtual Canvas</a></li></ul><ul><li><a class='header-2' href='#---game-state'>Game State</a></li></ul><ul><li><a class='header-2' href='#---there-is-no-delta-time'>There Is No Delta Time</a></li></ul><ul><li><a class='header-2' href='#---handling-user-input'>Handling User Input</a></li></ul><ul><li><a class='header-2' href='#---coding-on-a-raspberry-pi'>Coding On A Raspberry Pi</a></li></ul><ul><li><a class='header-2' href='#---conclusion'>Conclusion</a></li></ul><li><a class='header-1' href='#--deploying-to-itch-io'>Deploying To Itch.io</a></li> <ul><li><a class='header-2' href='#---creating-your-game-landing-page'>Creating Your Game Landing Page</a></li></ul><ul><li><a class='header-2' href='#---update-your-game's-metadata'>Update Your Game's Metadata</a></li></ul><ul><li><a class='header-2' href='#---building-your-game-for-distribution'>Building Your Game For Distribution</a></li></ul><li><a class='header-1' href='#--deploying-to-mobile-devices'>Deploying To Mobile Devices</a></li> <li><a class='header-1' href='#--dragonruby's-philosophy'>DragonRuby's Philosophy</a></li> -<ul><li><a class='header-2' href='#---challenge-the-status-quo'>Challenge The Status Quo</a></li></ul><ul><li><a class='header-2' href='#---continuity-of-design'>Continuity of Design</a></li></ul><ul><li><a class='header-2' href='#---release-early-and-often'>Release Early and Often</a></li></ul><ul><li><a class='header-2' href='#---sustainable-and-ethical-monetization'>Sustainable And Ethical Monetization</a></li></ul><ul><li><a class='header-2' href='#---sustainable-and-ethical-open-source'>Sustainable And Ethical Open Source</a></li></ul><ul><li><a class='header-2' href='#---people-over-entities'>People Over Entities</a></li></ul><ul><li><a class='header-2' href='#---building-a-game-should-be-fun-and-bring-happiness'>Building A Game Should Be Fun And Bring Happiness</a></li></ul><ul><li><a class='header-2' href='#---real-world-application-drives-features'>Real World Application Drives Features</a></li></ul><li><a class='header-1' href='#--frequently-asked-questions,-comments,-and-concerns'>Frequently Asked Questions, Comments, and Concerns</a></li> -<ul><li><a class='header-2' href='#---frequently-asked-questions'>Frequently Asked Questions</a></li></ul><ul><ul><li><a class='header-3' href='#----what-is-dragonruby-llp?'>What is DragonRuby LLP?</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----what-is-dragonruby?'>What is DragonRuby?</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----how-is-dragonruby-different-than-mri?'>How is DragonRuby different than MRI?</a></li></ul></ul><ul><li><a class='header-2' href='#---frequent-comments-about-ruby-as-a-language-choice'>Frequent Comments About Ruby as a Language Choice</a></li></ul><ul><ul><li><a class='header-3' href='#----but-ruby-is-dead.'>But Ruby is dead.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----but-ruby-is-slow.'>But Ruby is slow.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dynamic-languages-are-slow.'>Dynamic languages are slow.</a></li></ul></ul><ul><li><a class='header-2' href='#---frequent-concerns'>Frequent Concerns</a></li></ul><ul><ul><li><a class='header-3' href='#----dragonruby-is-not-open-source.-that's-not-right.'>DragonRuby is not open source. That's not right.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dragonruby-is-for-pay.-you-should-offer-a-free-version.'>DragonRuby is for pay. You should offer a free version.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----but-still,-you-should-offer-a-free-version.-so-i-can-try-it-out-and-see-if-i-like-it.'>But still, you should offer a free version. So I can try it out and see if I like it.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----i-still-think-you-should-do-a-free-version.-think-of-all-people-who-would-give-it-a-shot.'>I still think you should do a free version. Think of all people who would give it a shot.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----what-if-i-build-something-with-dragonruby,-but-dragonruby-llp-becomes-insolvent.'>What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.</a></li></ul></ul><li><a class='header-1' href='#--recipies-'>RECIPIES:</a></li> -<ul><li><a class='header-2' href='#---how-to-determine-what-frame-you-are-on'>How To Determine What Frame You Are On</a></li></ul><ul><li><a class='header-2' href='#---how-to-get-current-framerate'>How To Get Current Framerate</a></li></ul><ul><li><a class='header-2' href='#---how-to-render-a-sprite-using-an-array'>How To Render A Sprite Using An Array</a></li></ul><ul><li><a class='header-2' href='#---more-sprite-properties-as-an-array'>More Sprite Properties As An Array</a></li></ul><ul><li><a class='header-2' href='#---different-sprite-representations'>Different Sprite Representations</a></li></ul><ul><li><a class='header-2' href='#---how-to-render-a-label'>How To Render A Label</a></li></ul><ul><li><a class='header-2' href='#---a-colored-label'>A Colored Label</a></li></ul><ul><li><a class='header-2' href='#---extended-label-properties'>Extended Label Properties</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-label-as-a--hash-'>Rendering A Label As A <code>Hash</code></a></li></ul><ul><li><a class='header-2' href='#---getting-the-size-of-a-piece-of-text'>Getting The Size Of A Piece Of Text</a></li></ul><ul><li><a class='header-2' href='#---how-to-play-a-sound'>How To Play A Sound</a></li></ul><ul><li><a class='header-2' href='#---using--args.state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</a></li></ul><ul><li><a class='header-2' href='#---troubleshoot-performance'>Troubleshoot Performance</a></li></ul><li><a class='header-1' href='#--docs---gtk--runtime-'>DOCS: <code>GTK::Runtime</code></a></li> +<ul><li><a class='header-2' href='#---challenge-the-status-quo'>Challenge The Status Quo</a></li></ul><ul><li><a class='header-2' href='#---continuity-of-design'>Continuity of Design</a></li></ul><ul><li><a class='header-2' href='#---release-early-and-often'>Release Early and Often</a></li></ul><ul><li><a class='header-2' href='#---sustainable-and-ethical-monetization'>Sustainable And Ethical Monetization</a></li></ul><ul><li><a class='header-2' href='#---sustainable-and-ethical-open-source'>Sustainable And Ethical Open Source</a></li></ul><ul><li><a class='header-2' href='#---people-over-entities'>People Over Entities</a></li></ul><ul><li><a class='header-2' href='#---building-a-game-should-be-fun-and-bring-happiness'>Building A Game Should Be Fun And Bring Happiness</a></li></ul><ul><li><a class='header-2' href='#---real-world-application-drives-features'>Real World Application Drives Features</a></li></ul><li><a class='header-1' href='#--frequently-asked-questions--comments--and-concerns'>Frequently Asked Questions, Comments, and Concerns</a></li> +<ul><li><a class='header-2' href='#---frequently-asked-questions'>Frequently Asked Questions</a></li></ul><ul><ul><li><a class='header-3' href='#----what-is-dragonruby-llp-'>What is DragonRuby LLP?</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----what-is-dragonruby-'>What is DragonRuby?</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----how-is-dragonruby-different-than-mri-'>How is DragonRuby different than MRI?</a></li></ul></ul><ul><li><a class='header-2' href='#---frequent-comments-about-ruby-as-a-language-choice'>Frequent Comments About Ruby as a Language Choice</a></li></ul><ul><ul><li><a class='header-3' href='#----but-ruby-is-dead-'>But Ruby is dead.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----but-ruby-is-slow-'>But Ruby is slow.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dynamic-languages-are-slow-'>Dynamic languages are slow.</a></li></ul></ul><ul><li><a class='header-2' href='#---frequent-concerns'>Frequent Concerns</a></li></ul><ul><ul><li><a class='header-3' href='#----dragonruby-is-not-open-source--that's-not-right-'>DragonRuby is not open source. That's not right.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dragonruby-is-for-pay--you-should-offer-a-free-version-'>DragonRuby is for pay. You should offer a free version.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----but-still--you-should-offer-a-free-version--so-i-can-try-it-out-and-see-if-i-like-it-'>But still, you should offer a free version. So I can try it out and see if I like it.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----i-still-think-you-should-do-a-free-version--think-of-all-people-who-would-give-it-a-shot-'>I still think you should do a free version. Think of all people who would give it a shot.</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----what-if-i-build-something-with-dragonruby--but-dragonruby-llp-becomes-insolvent-'>What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.</a></li></ul></ul><li><a class='header-1' href='#--recipies-'>RECIPIES:</a></li> +<ul><li><a class='header-2' href='#---how-to-determine-what-frame-you-are-on'>How To Determine What Frame You Are On</a></li></ul><ul><li><a class='header-2' href='#---how-to-get-current-framerate'>How To Get Current Framerate</a></li></ul><ul><li><a class='header-2' href='#---how-to-render-a-sprite-using-an-array'>How To Render A Sprite Using An Array</a></li></ul><ul><li><a class='header-2' href='#---more-sprite-properties-as-an-array'>More Sprite Properties As An Array</a></li></ul><ul><li><a class='header-2' href='#---different-sprite-representations'>Different Sprite Representations</a></li></ul><ul><li><a class='header-2' href='#---how-to-render-a-label'>How To Render A Label</a></li></ul><ul><li><a class='header-2' href='#---a-colored-label'>A Colored Label</a></li></ul><ul><li><a class='header-2' href='#---extended-label-properties'>Extended Label Properties</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-label-as-a--hash-'>Rendering A Label As A <code>Hash</code></a></li></ul><ul><li><a class='header-2' href='#---getting-the-size-of-a-piece-of-text'>Getting The Size Of A Piece Of Text</a></li></ul><ul><li><a class='header-2' href='#---rendering-labels-with-new-line-characters-and-wrapping'>Rendering Labels With New Line Characters And Wrapping</a></li></ul><ul><li><a class='header-2' href='#---how-to-play-a-sound'>How To Play A Sound</a></li></ul><ul><li><a class='header-2' href='#---using--args-state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</a></li></ul><ul><li><a class='header-2' href='#---troubleshoot-performance'>Troubleshoot Performance</a></li></ul><li><a class='header-1' href='#--docs---gtk--runtime-'>DOCS: <code>GTK::Runtime</code></a></li> <li><a class='header-1' href='#--summary---def-tick-args;-end;-'>SUMMARY: <code>def tick args; end;</code></a></li> -<ul><li><a class='header-2' href='#----args.state-'><code>args.state</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.-.entity_id-'><code>.*.entity_id</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.entity_type-'><code>.*.entity_type</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.created_at-'><code>.*.created_at</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.created_at_elapsed-'><code>.*.created_at_elapsed</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.global_created_at-'><code>.*.global_created_at</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.global_created_at_elapsed-'><code>.*.global_created_at_elapsed</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.-.as_hash-'><code>.*.as_hash</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.new_entity-'><code>.new_entity</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.new_entity_strict-'><code>.new_entity_strict</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.tick_count-'><code>.tick_count</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.inputs-'><code>args.inputs</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.up-'><code>.up</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.down-'><code>.down</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.left-'><code>.left</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.right-'><code>.right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.left_right-'><code>.left_right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.up_down-'><code>.up_down</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.text--or--.history-'><code>.text</code> OR <code>.history</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.mouse-'><code>.mouse</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.controller_one-,--.controller_two-'><code>.controller_one</code>, <code>.controller_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.keyboard-'><code>.keyboard</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.outputs-'><code>args.outputs</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.background_color-'><code>.background_color</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.sounds-'><code>.sounds</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.solids-'><code>.solids</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.static_solids-'><code>.static_solids</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.sprites-,--.static_sprites-'><code>.sprites</code>, <code>.static_sprites</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.primitives-,--.static_primitives-'><code>.primitives</code>, <code>.static_primitives</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.labels-,--.static_labels-'><code>.labels</code>, <code>.static_labels</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.lines-,--.static_lines-'><code>.lines</code>, <code>.static_lines</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.borders-,--.static_borders-'><code>.borders</code>, <code>.static_borders</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.debug-,--.static_debug-'><code>.debug</code>, <code>.static_debug</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.geometry-'><code>args.geometry</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.inside_rect?-rect_1,-rect_2-'><code>.inside_rect? rect_1, rect_2</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.intersect_rect?-rect_2,-rect_2-'><code>.intersect_rect? rect_2, rect_2</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.scale_rect-rect,-x_percentage,-y_percentage-'><code>.scale_rect rect, x_percentage, y_percentage</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.angle_to-start_point,-end_point-'><code>.angle_to start_point, end_point</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.angle_from-start_point,-end_point-'><code>.angle_from start_point, end_point</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.point_inside_circle?-point,-circle_center_point,-radius-'><code>.point_inside_circle? point, circle_center_point, radius</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.center_inside_rect-rect,-other_rect-'><code>.center_inside_rect rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.center_inside_rect_x-rect,-other_rect-'><code>.center_inside_rect_x rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.center_inside_rect_y-rect,-other_rect-'><code>.center_inside_rect_y rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.anchor_rect-rect,-anchor_x,-anchor_y-'><code>.anchor_rect rect, anchor_x, anchor_y</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.shift_line-line,-x,-y-'><code>.shift_line line, x, y</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.line_y_intercept-line-'><code>.line_y_intercept line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.angle_between_lines-line_one,-line_two,-replace_infinity--'><code>.angle_between_lines line_one, line_two, replace_infinity:</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.line_slope-line,-replace_infinity--'><code>.line_slope line, replace_infinity:</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.line_rise_run-'><code>.line_rise_run</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.ray_test-point,-line-'><code>.ray_test point, line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.line_rect-line-'><code>.line_rect line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.line_intersect-line_one,-line_two-'><code>.line_intersect line_one, line_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.distance-point_one,-point_two-'><code>.distance point_one, point_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.cubic_bezier-t,-a,-b,-c,-d-'><code>.cubic_bezier t, a, b, c, d</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.easing-'><code>args.easing</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.ease-start_tick,-current_tick,-duration,-easing_functions-'><code>.ease start_tick, current_tick, duration, easing_functions</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.ease_spline-start_tick,-current_tick,-duration,-spline-'><code>.ease_spline start_tick, current_tick, duration, spline</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.string-'><code>args.string</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.wrapped_lines-string,-max_character_length-'><code>.wrapped_lines string, max_character_length</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.grid-'><code>args.grid</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.name-'><code>.name</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.bottom-'><code>.bottom</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.top-'><code>.top</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.left-'><code>.left</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.right-'><code>.right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.rect-'><code>.rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.origin_bottom_left!-'><code>.origin_bottom_left!</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.origin_center!-'><code>.origin_center!</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.w-'><code>.w</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.h-'><code>.h</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args.gtk-'><code>args.gtk</code></a></li></ul><ul><ul><li><a class='header-3' href='#-----.argv-'><code>.argv</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.platform-'><code>.platform</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.request_quit-'><code>.request_quit</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.write_file-path,-contents-'><code>.write_file path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.write_file_root-'><code>.write_file_root</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.append_file-path,-contents-'><code>.append_file path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.append_file_root-path,-contents-'><code>.append_file_root path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.read_file-path-'><code>.read_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.parse_xml-string,-parse_xml_file-path-'><code>.parse_xml string, parse_xml_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.parse_json-string,-parse_json_file-path-'><code>.parse_json string, parse_json_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.http_get-url,-extra_headers-=-{}-'><code>.http_get url, extra_headers = {}</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.http_post-url,-form_fields-=-{},-extra_headers-=-{}-'><code>.http_post url, form_fields = {}, extra_headers = {}</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.reset-'><code>.reset</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.stop_music-'><code>.stop_music</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.calcstringbox-str,-size_enum,-font-'><code>.calcstringbox str, size_enum, font</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.slowmo!-factor-'><code>.slowmo! factor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.notify!-string-'><code>.notify! string</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.system-'><code>.system</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.exec-'><code>.exec</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.save_state-'><code>.save_state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.load_state-'><code>.load_state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.serialize_state-file,-state-'><code>.serialize_state file, state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.deserialize_state-file-'><code>.deserialize_state file</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.reset_sprite-path-'><code>.reset_sprite path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.show_cursor-'><code>.show_cursor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.hide_cursor-'><code>.hide_cursor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.cursor_shown?-'><code>.cursor_shown?</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.set_window_fullscreen-enabled-'><code>.set_window_fullscreen enabled</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.openurl-url-'><code>.openurl url</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.get_base_dir-'><code>.get_base_dir</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#-----.get_game_dir-'><code>.get_game_dir</code></a></li></ul></ul><li><a class='header-1' href='#--docs---gtk--runtime#reset-'>DOCS: <code>GTK::Runtime#reset</code></a></li> +<ul><li><a class='header-2' href='#----args-state-'><code>args.state</code></a></li></ul><ul><ul><li><a class='header-3' href='#--------entity_id-'><code>.*.entity_id</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------entity_type-'><code>.*.entity_type</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------created_at-'><code>.*.created_at</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------created_at_elapsed-'><code>.*.created_at_elapsed</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------global_created_at-'><code>.*.global_created_at</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------global_created_at_elapsed-'><code>.*.global_created_at_elapsed</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#--------as_hash-'><code>.*.as_hash</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------new_entity-'><code>.new_entity</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------new_entity_strict-'><code>.new_entity_strict</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------tick_count-'><code>.tick_count</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-inputs-'><code>args.inputs</code></a></li></ul><ul><ul><li><a class='header-3' href='#------up-'><code>.up</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------down-'><code>.down</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------left-'><code>.left</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------right-'><code>.right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------left_right-'><code>.left_right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------up_down-'><code>.up_down</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------text--or---history-'><code>.text</code> OR <code>.history</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------mouse-'><code>.mouse</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------controller_one-----controller_two-'><code>.controller_one</code>, <code>.controller_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------keyboard-'><code>.keyboard</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-outputs-'><code>args.outputs</code></a></li></ul><ul><ul><li><a class='header-3' href='#------background_color-'><code>.background_color</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------sounds-'><code>.sounds</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------solids-'><code>.solids</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------static_solids-'><code>.static_solids</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------sprites-----static_sprites-'><code>.sprites</code>, <code>.static_sprites</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------primitives-----static_primitives-'><code>.primitives</code>, <code>.static_primitives</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------labels-----static_labels-'><code>.labels</code>, <code>.static_labels</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------lines-----static_lines-'><code>.lines</code>, <code>.static_lines</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------borders-----static_borders-'><code>.borders</code>, <code>.static_borders</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------debug-----static_debug-'><code>.debug</code>, <code>.static_debug</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-geometry-'><code>args.geometry</code></a></li></ul><ul><ul><li><a class='header-3' href='#------inside_rect--rect_1--rect_2-'><code>.inside_rect? rect_1, rect_2</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------intersect_rect--rect_2--rect_2-'><code>.intersect_rect? rect_2, rect_2</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------scale_rect-rect--x_percentage--y_percentage-'><code>.scale_rect rect, x_percentage, y_percentage</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------angle_to-start_point--end_point-'><code>.angle_to start_point, end_point</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------angle_from-start_point--end_point-'><code>.angle_from start_point, end_point</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------point_inside_circle--point--circle_center_point--radius-'><code>.point_inside_circle? point, circle_center_point, radius</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------center_inside_rect-rect--other_rect-'><code>.center_inside_rect rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------center_inside_rect_x-rect--other_rect-'><code>.center_inside_rect_x rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------center_inside_rect_y-rect--other_rect-'><code>.center_inside_rect_y rect, other_rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------anchor_rect-rect--anchor_x--anchor_y-'><code>.anchor_rect rect, anchor_x, anchor_y</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------shift_line-line--x--y-'><code>.shift_line line, x, y</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------line_y_intercept-line-'><code>.line_y_intercept line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------angle_between_lines-line_one--line_two--replace_infinity--'><code>.angle_between_lines line_one, line_two, replace_infinity:</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------line_slope-line--replace_infinity--'><code>.line_slope line, replace_infinity:</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------line_rise_run-'><code>.line_rise_run</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------ray_test-point--line-'><code>.ray_test point, line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------line_rect-line-'><code>.line_rect line</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------line_intersect-line_one--line_two-'><code>.line_intersect line_one, line_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------distance-point_one--point_two-'><code>.distance point_one, point_two</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------cubic_bezier-t--a--b--c--d-'><code>.cubic_bezier t, a, b, c, d</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-easing-'><code>args.easing</code></a></li></ul><ul><ul><li><a class='header-3' href='#------ease-start_tick--current_tick--duration--easing_functions-'><code>.ease start_tick, current_tick, duration, easing_functions</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------ease_spline-start_tick--current_tick--duration--spline-'><code>.ease_spline start_tick, current_tick, duration, spline</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-string-'><code>args.string</code></a></li></ul><ul><ul><li><a class='header-3' href='#------wrapped_lines-string--max_character_length-'><code>.wrapped_lines string, max_character_length</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-grid-'><code>args.grid</code></a></li></ul><ul><ul><li><a class='header-3' href='#------name-'><code>.name</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------bottom-'><code>.bottom</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------top-'><code>.top</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------left-'><code>.left</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------right-'><code>.right</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------rect-'><code>.rect</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------origin_bottom_left!-'><code>.origin_bottom_left!</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------origin_center!-'><code>.origin_center!</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------w-'><code>.w</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------h-'><code>.h</code></a></li></ul></ul><ul><li><a class='header-2' href='#----args-gtk-'><code>args.gtk</code></a></li></ul><ul><ul><li><a class='header-3' href='#------argv-'><code>.argv</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------platform-'><code>.platform</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------request_quit-'><code>.request_quit</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------write_file-path--contents-'><code>.write_file path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------write_file_root-'><code>.write_file_root</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------append_file-path--contents-'><code>.append_file path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------append_file_root-path--contents-'><code>.append_file_root path, contents</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------read_file-path-'><code>.read_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------parse_xml-string--parse_xml_file-path-'><code>.parse_xml string, parse_xml_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------parse_json-string--parse_json_file-path-'><code>.parse_json string, parse_json_file path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------http_get-url--extra_headers-=-{}-'><code>.http_get url, extra_headers = {}</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------http_post-url--form_fields-=-{}--extra_headers-=-{}-'><code>.http_post url, form_fields = {}, extra_headers = {}</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------reset-'><code>.reset</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------stop_music-'><code>.stop_music</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------calcstringbox-str--size_enum--font-'><code>.calcstringbox str, size_enum, font</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------slowmo!-factor-'><code>.slowmo! factor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------notify!-string-'><code>.notify! string</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------system-'><code>.system</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------exec-'><code>.exec</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------save_state-'><code>.save_state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------load_state-'><code>.load_state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------serialize_state-file--state-'><code>.serialize_state file, state</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------deserialize_state-file-'><code>.deserialize_state file</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------reset_sprite-path-'><code>.reset_sprite path</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------show_cursor-'><code>.show_cursor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------hide_cursor-'><code>.hide_cursor</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------cursor_shown--'><code>.cursor_shown?</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------set_window_fullscreen-enabled-'><code>.set_window_fullscreen enabled</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------openurl-url-'><code>.openurl url</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------get_base_dir-'><code>.get_base_dir</code></a></li></ul></ul><ul><ul><li><a class='header-3' href='#------get_game_dir-'><code>.get_game_dir</code></a></li></ul></ul><li><a class='header-1' href='#--docs---gtk--runtime#reset-'>DOCS: <code>GTK::Runtime#reset</code></a></li> <li><a class='header-1' href='#--docs---gtk--runtime#calcstringbox-'>DOCS: <code>GTK::Runtime#calcstringbox</code></a></li> <li><a class='header-1' href='#--docs---gtk--runtime#write_file-'>DOCS: <code>GTK::Runtime#write_file</code></a></li> +<li><a class='header-1' href='#--docs---gtk--runtime#benchmark-'>DOCS: <code>GTK::Runtime#benchmark</code></a></li> <li><a class='header-1' href='#--docs---array-'>DOCS: <code>Array</code></a></li> <li><a class='header-1' href='#--docs---array#map-'>DOCS: <code>Array#map</code></a></li> <li><a class='header-1' href='#--docs---array#each-'>DOCS: <code>Array#each</code></a></li> @@ -29,28 +31,29 @@ <li><a class='header-1' href='#--docs---array#reject_false-'>DOCS: <code>Array#reject_false</code></a></li> <li><a class='header-1' href='#--docs---array#product-'>DOCS: <code>Array#product</code></a></li> <li><a class='header-1' href='#--docs---array#map_2d-'>DOCS: <code>Array#map_2d</code></a></li> -<li><a class='header-1' href='#--docs---array#include_any?-'>DOCS: <code>Array#include_any?</code></a></li> -<li><a class='header-1' href='#--docs---array#any_intersect_rect?-'>DOCS: <code>Array#any_intersect_rect?</code></a></li> +<li><a class='header-1' href='#--docs---array#include_any--'>DOCS: <code>Array#include_any?</code></a></li> +<li><a class='header-1' href='#--docs---array#any_intersect_rect--'>DOCS: <code>Array#any_intersect_rect?</code></a></li> <li><a class='header-1' href='#--docs---gtk--args#audio-'>DOCS: <code>GTK::Args#audio</code></a></li> <ul><li><a class='header-2' href='#---audio-synthesis-(pro-only)'>Audio synthesis (Pro only)</a></li></ul><ul><ul><li><a class='header-3' href='#----sound-source'>Sound source</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----example-'>Example:</a></li></ul></ul><li><a class='header-1' href='#--docs---gtk--outputs-'>DOCS: <code>GTK::Outputs</code></a></li> <li><a class='header-1' href='#--docs---gtk--outputs#solids-'>DOCS: <code>GTK::Outputs#solids</code></a></li> <ul><li><a class='header-2' href='#---rendering-a-solid-using-an-array'>Rendering a solid using an Array</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-solid-using-an-array-with-colors-and-alpha'>Rendering a solid using an Array with colors and alpha</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-solid-using-a-hash'>Rendering a solid using a Hash</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-solid-using-a-class'>Rendering a solid using a Class</a></li></ul><li><a class='header-1' href='#--docs---gtk--outputs#borders-'>DOCS: <code>GTK::Outputs#borders</code></a></li> -<li><a class='header-1' href='#--docs---gtk--outputs#screenshots-'>DOCS: <code>GTK::Outputs#screenshots</code></a></li> +<li><a class='header-1' href='#--docs---gtk--outputs#sprites-'>DOCS: <code>GTK::Outputs#sprites</code></a></li> +<ul><li><a class='header-2' href='#---rendering-a-sprite-using-an-array'>Rendering a sprite using an Array</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-sprite-using-an-array-with-colors-and-alpha'>Rendering a sprite using an Array with colors and alpha</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-sprite-using-a-hash'>Rendering a sprite using a Hash</a></li></ul><ul><li><a class='header-2' href='#---rendering-a-solid-using-a-class'>Rendering a solid using a Class</a></li></ul><li><a class='header-1' href='#--docs---gtk--outputs#screenshots-'>DOCS: <code>GTK::Outputs#screenshots</code></a></li> <ul><li><a class='header-2' href='#---chroma-key-(making-a-color-transparent)'>Chroma key (Making a color transparent)</a></li></ul><li><a class='header-1' href='#--docs---gtk--mouse-'>DOCS: <code>GTK::Mouse</code></a></li> <li><a class='header-1' href='#--docs---gtk--mousepoint-'>DOCS: <code>GTK::MousePoint</code></a></li> <li><a class='header-1' href='#--docs---gtk--openentity-'>DOCS: <code>GTK::OpenEntity</code></a></li> <li><a class='header-1' href='#--docs---gtk--openentity#as_hash-'>DOCS: <code>GTK::OpenEntity#as_hash</code></a></li> <li><a class='header-1' href='#--docs---numeric#frame_index-'>DOCS: <code>Numeric#frame_index</code></a></li> <li><a class='header-1' href='#--docs---numeric#elapsed_time-'>DOCS: <code>Numeric#elapsed_time</code></a></li> -<li><a class='header-1' href='#--docs---numeric#elapsed?-'>DOCS: <code>Numeric#elapsed?</code></a></li> -<li><a class='header-1' href='#--docs---numeric#created?-'>DOCS: <code>Numeric#created?</code></a></li> +<li><a class='header-1' href='#--docs---numeric#elapsed--'>DOCS: <code>Numeric#elapsed?</code></a></li> +<li><a class='header-1' href='#--docs---numeric#created--'>DOCS: <code>Numeric#created?</code></a></li> <li><a class='header-1' href='#--docs---kernel-'>DOCS: <code>Kernel</code></a></li> <li><a class='header-1' href='#--docs---kernel--tick_count-'>DOCS: <code>Kernel::tick_count</code></a></li> <li><a class='header-1' href='#--docs---kernel--global_tick_count-'>DOCS: <code>Kernel::global_tick_count</code></a></li> <li><a class='header-1' href='#--docs---geometry-'>DOCS: <code>Geometry</code></a></li> <li><a class='header-1' href='#--docs---gtk--geometry#scale_rect-'>DOCS: <code>GTK::Geometry#scale_rect</code></a></li> <li><a class='header-1' href='#--source-code'>Source Code</a></li> -<ul><li><a class='header-2' href='#---samples'>Samples</a></li></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---beginner-ruby-primer---automation.rb'>Learn Ruby Optional - Beginner Ruby Primer - automation.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---beginner-ruby-primer---main.rb'>Learn Ruby Optional - Beginner Ruby Primer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---printing.txt'>Learn Ruby Optional - Intermediate Ruby Primer - printing.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---strings.txt'>Learn Ruby Optional - Intermediate Ruby Primer - strings.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---numbers.txt'>Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---booleans.txt'>Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---conditionals.txt'>Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---looping.txt'>Learn Ruby Optional - Intermediate Ruby Primer - looping.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---functions.txt'>Learn Ruby Optional - Intermediate Ruby Primer - functions.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---arrays.txt'>Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---main.rb'>Learn Ruby Optional - Intermediate Ruby Primer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---labels---main.rb'>Rendering Basics - Labels - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---lines---main.rb'>Rendering Basics - Lines - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---solids-borders---main.rb'>Rendering Basics - Solids Borders - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---sprites---main.rb'>Rendering Basics - Sprites - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---sounds---main.rb'>Rendering Basics - Sounds - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---audio-mixer---main.rb'>Rendering Basics - Audio Mixer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---sound-synthesis---main.rb'>Rendering Basics - Sound Synthesis - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---keyboard---main.rb'>Input Basics - Keyboard - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse---main.rb'>Input Basics - Mouse - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse-point-to-rect---main.rb'>Input Basics - Mouse Point To Rect - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse-rect-to-rect---main.rb'>Input Basics - Mouse Rect To Rect - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---controller---main.rb'>Input Basics - Controller - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---touch---main.rb'>Input Basics - Touch - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-using-separate-pngs---main.rb'>Rendering Sprites - Animation Using Separate Pngs - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-using-sprite-sheet---main.rb'>Rendering Sprites - Animation Using Sprite Sheet - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-states---main.rb'>Rendering Sprites - Animation States - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---color-and-rotation---main.rb'>Rendering Sprites - Color And Rotation - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---simple---main.rb'>Physics And Collisions - Simple - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---moving-objects---main.rb'>Physics And Collisions - Moving Objects - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---entities---main.rb'>Physics And Collisions - Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision---main.rb'>Physics And Collisions - Box Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision-2---main.rb'>Physics And Collisions - Box Collision 2 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision-3---main.rb'>Physics And Collisions - Box Collision 3 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---jump-physics---main.rb'>Physics And Collisions - Jump Physics - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---ball.rb'>Physics And Collisions - Bouncing On Collision - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---block.rb'>Physics And Collisions - Bouncing On Collision - block.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---cannon.rb'>Physics And Collisions - Bouncing On Collision - cannon.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---main.rb'>Physics And Collisions - Bouncing On Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---peg.rb'>Physics And Collisions - Bouncing On Collision - peg.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---vector2d.rb'>Physics And Collisions - Bouncing On Collision - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---ball.rb'>Physics And Collisions - Arbitrary Collision - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---blocks.rb'>Physics And Collisions - Arbitrary Collision - blocks.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---linear_collider.rb'>Physics And Collisions - Arbitrary Collision - linear_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---main.rb'>Physics And Collisions - Arbitrary Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---paddle.rb'>Physics And Collisions - Arbitrary Collision - paddle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---rectangle.rb'>Physics And Collisions - Arbitrary Collision - rectangle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---square_collider.rb'>Physics And Collisions - Arbitrary Collision - square_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---vector2d.rb'>Physics And Collisions - Arbitrary Collision - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---ball.rb'>Physics And Collisions - Collision With Object Removal - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---linear_collider.rb'>Physics And Collisions - Collision With Object Removal - linear_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---main.rb'>Physics And Collisions - Collision With Object Removal - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---paddle.rb'>Physics And Collisions - Collision With Object Removal - paddle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---tests.rb'>Physics And Collisions - Collision With Object Removal - tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---vector2d.rb'>Physics And Collisions - Collision With Object Removal - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-click---main.rb'>Mouse - Mouse Click - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-move---main.rb'>Mouse - Mouse Move - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-move-paint-app---main.rb'>Mouse - Mouse Move Paint App - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---coordinate-systems---main.rb'>Mouse - Coordinate Systems - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----save-load---save-load-game---main.rb'>Save Load - Save Load Game - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---simple-render-targets---main.rb'>Advanced Rendering - Simple Render Targets - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-targets-with-tile-manipulation---main.rb'>Advanced Rendering - Render Targets With Tile Manipulation - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-target-viewports---main.rb'>Advanced Rendering - Render Target Viewports - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-primitive-hierarchies---main.rb'>Advanced Rendering - Render Primitive Hierarchies - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-primitives-as-hash---main.rb'>Advanced Rendering - Render Primitives As Hash - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---pixel-arrays---main.rb'>Advanced Rendering - Pixel Arrays - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---splitscreen-camera---main.rb'>Advanced Rendering - Splitscreen Camera - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---z-targeting-camera---main.rb'>Advanced Rendering - Z Targeting Camera - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---easing-functions---main.rb'>Tweening Lerping Easing Functions - Easing Functions - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---cubic-bezier---main.rb'>Tweening Lerping Easing Functions - Cubic Bezier - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---easing-using-spline---main.rb'>Tweening Lerping Easing Functions - Easing Using Spline - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---parametric-enemy-movement---main.rb'>Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-hash---main.rb'>Performance - Sprites As Hash - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-entities---main.rb'>Performance - Sprites As Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-strict-entities---main.rb'>Performance - Sprites As Strict Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-classes---main.rb'>Performance - Sprites As Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---static-sprites-as-classes---main.rb'>Performance - Static Sprites As Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---static-sprites-as-classes-with-custom-drawing---main.rb'>Performance - Static Sprites As Classes With Custom Drawing - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---collision-limits---main.rb'>Performance - Collision Limits - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---trace-debugging---main.rb'>Advanced Debugging - Trace Debugging - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---trace-debugging-classes---main.rb'>Advanced Debugging - Trace Debugging Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---exception_raising_tests.rb'>Advanced Debugging - Unit Tests - exception_raising_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---fn_tests.rb'>Advanced Debugging - Unit Tests - fn_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---gen_docs.rb'>Advanced Debugging - Unit Tests - gen_docs.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---geometry_tests.rb'>Advanced Debugging - Unit Tests - geometry_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---http_tests.rb'>Advanced Debugging - Unit Tests - http_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---nil_coercion_tests.rb'>Advanced Debugging - Unit Tests - nil_coercion_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---object_to_primitive_tests.rb'>Advanced Debugging - Unit Tests - object_to_primitive_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---parsing_tests.rb'>Advanced Debugging - Unit Tests - parsing_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---require_tests.rb'>Advanced Debugging - Unit Tests - require_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---serialize_deserialize_tests.rb'>Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---state_serialization_experimental_tests.rb'>Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---suggest_autocompletion_tests.rb'>Advanced Debugging - Unit Tests - suggest_autocompletion_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----http---retrieve-images---main.rb'>Http - Retrieve Images - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----http---web-server---main.rb'>Http - Web Server - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---basics---main.rb'>C Extensions - Basics - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---intermediate---main.rb'>C Extensions - Intermediate - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---native-pixel-arrays---main.rb'>C Extensions - Native Pixel Arrays - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---breadth-first-search---main.rb'>Path Finding Algorithms - Breadth First Search - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---detailed-breadth-first-search---main.rb'>Path Finding Algorithms - Detailed Breadth First Search - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---breadcrumbs---main.rb'>Path Finding Algorithms - Breadcrumbs - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---early-exit---main.rb'>Path Finding Algorithms - Early Exit - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---dijkstra---main.rb'>Path Finding Algorithms - Dijkstra - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---heuristic---main.rb'>Path Finding Algorithms - Heuristic - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---heuristic-with-walls---main.rb'>Path Finding Algorithms - Heuristic With Walls - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---a-star---main.rb'>Path Finding Algorithms - A Star - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---tower-defense---main.rb'>Path Finding Algorithms - Tower Defense - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---3d-cube---main.rb'>3d - 3d Cube - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---wireframe---main.rb'>3d - Wireframe - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---wireframe---data---what-is-this.txt'>3d - Wireframe - Data - what-is-this.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---bullet-hell---main.rb'>Arcade - Bullet Hell - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---dueling-starships---main.rb'>Arcade - Dueling Starships - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade/flappy-dragon/credits.txt'>arcade/flappy dragon/credits.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade/flappy-dragon/main.rb'>arcade/flappy dragon/main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---pong---main.rb'>Arcade - Pong - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---snakemoji---main.rb'>Arcade - Snakemoji - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---solar-system---main.rb'>Arcade - Solar System - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---sound-golf---main.rb'>Arcade - Sound Golf - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---twinstick---main.rb'>Arcade - Twinstick - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----crafting---craft-game-starting-point---main.rb'>Crafting - Craft Game Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---add-buttons-to-console---main.rb'>Dev Tools - Add Buttons To Console - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---animation-creator-starting-point---main.rb'>Dev Tools - Animation Creator Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---tile-editor-starting-point---main.rb'>Dev Tools - Tile Editor Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---nokia-3310---main.rb'>Lowrez - Nokia 3310 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---nokia-3310---nokia.rb'>Lowrez - Nokia 3310 - nokia.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---resolution-64x64---lowrez.rb'>Lowrez - Resolution 64x64 - lowrez.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---resolution-64x64---main.rb'>Lowrez - Resolution 64x64 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---clepto-frog---main.rb'>Platformer - Clepto Frog - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---clepto-frog---map.rb'>Platformer - Clepto Frog - map.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---credits.txt'>Platformer - Gorillas Basic - credits.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---main.rb'>Platformer - Gorillas Basic - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---tests.rb'>Platformer - Gorillas Basic - tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---tests---building_generation_tests.rb'>Platformer - Gorillas Basic - Tests - building_generation_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---main.rb'>Platformer - The Little Probe - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---data---level.txt'>Platformer - The Little Probe - Data - level.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---data---level_lava.txt'>Platformer - The Little Probe - Data - level_lava.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---choose-your-own-adventure---decision.rb'>Rpg Narrative - Choose Your Own Adventure - decision.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---choose-your-own-adventure---main.rb'>Rpg Narrative - Choose Your Own Adventure - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---lowrez_simulator.rb'>Rpg Narrative - Return Of Serenity - lowrez_simulator.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---main.rb'>Rpg Narrative - Return Of Serenity - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---require.rb'>Rpg Narrative - Return Of Serenity - require.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline.rb'>Rpg Narrative - Return Of Serenity - storyline.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_anka.rb'>Rpg Narrative - Return Of Serenity - storyline_anka.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_blinking_light.rb'>Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_day_one.rb'>Rpg Narrative - Return Of Serenity - storyline_day_one.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_final_decision.rb'>Rpg Narrative - Return Of Serenity - storyline_final_decision.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_final_message.rb'>Rpg Narrative - Return Of Serenity - storyline_final_message.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_alive.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_bio.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_introduction.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_speed_of_light.rb'>Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---constants.rb'>Rpg Roguelike - Roguelike Starting Point - constants.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---legend.rb'>Rpg Roguelike - Roguelike Starting Point - legend.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---main.rb'>Rpg Roguelike - Roguelike Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---sprite_lookup.rb'>Rpg Roguelike - Roguelike Starting Point - sprite_lookup.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-line-of-sight---main.rb'>Rpg Roguelike - Roguelike Line Of Sight - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-tactical---hexagonal-grid---main.rb'>Rpg Tactical - Hexagonal Grid - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-tactical---isometric-grid---main.rb'>Rpg Tactical - Isometric Grid - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-topdown---topdown-starting-point---main.rb'>Rpg Topdown - Topdown Starting Point - main.rb</a></li></ul></ul><ul><li><a class='header-2' href='#---oss'>OSS</a></li></ul><ul><ul><li><a class='header-3' href='#----args.rb'>args.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----assert.rb'>assert.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----attr_gtk.rb'>attr_gtk.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----attr_sprite.rb'>attr_sprite.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console.rb'>console.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_color.rb'>console_color.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_font_style.rb'>console_font_style.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_menu.rb'>console_menu.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_prompt.rb'>console_prompt.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller.rb'>controller.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller/config.rb'>controller/config.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller/keys.rb'>controller/keys.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----directional_input_helper_methods.rb'>directional_input_helper_methods.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----easing.rb'>easing.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----entity.rb'>entity.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----geometry.rb'>geometry.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----grid.rb'>grid.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----inputs.rb'>inputs.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----ios_wizard.rb'>ios_wizard.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----itch_wizard.rb'>itch_wizard.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----layout.rb'>layout.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----log.rb'>log.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----numeric.rb'>numeric.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----remote_hotload_client.rb'>remote_hotload_client.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/autocomplete.rb'>runtime/autocomplete.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/draw.rb'>runtime/draw.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/framerate.rb'>runtime/framerate.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/framerate_diagnostics.rb'>runtime/framerate_diagnostics.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/hotload.rb'>runtime/hotload.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----string.rb'>string.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tests.rb'>tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----trace.rb'>trace.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----wizards.rb'>wizards.rb</a></li></ul></ul></ul> </div> +<ul><li><a class='header-2' href='#---samples'>Samples</a></li></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---beginner-ruby-primer---automation-rb'>Learn Ruby Optional - Beginner Ruby Primer - automation.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---beginner-ruby-primer---main-rb'>Learn Ruby Optional - Beginner Ruby Primer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---printing-txt'>Learn Ruby Optional - Intermediate Ruby Primer - printing.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---strings-txt'>Learn Ruby Optional - Intermediate Ruby Primer - strings.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---numbers-txt'>Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---booleans-txt'>Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---conditionals-txt'>Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---looping-txt'>Learn Ruby Optional - Intermediate Ruby Primer - looping.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---functions-txt'>Learn Ruby Optional - Intermediate Ruby Primer - functions.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---arrays-txt'>Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----learn-ruby-optional---intermediate-ruby-primer---main-rb'>Learn Ruby Optional - Intermediate Ruby Primer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---labels---main-rb'>Rendering Basics - Labels - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---lines---main-rb'>Rendering Basics - Lines - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---solids-borders---main-rb'>Rendering Basics - Solids Borders - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---sprites---main-rb'>Rendering Basics - Sprites - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-basics---sounds---main-rb'>Rendering Basics - Sounds - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---keyboard---main-rb'>Input Basics - Keyboard - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---moving-a-sprite---main-rb'>Input Basics - Moving A Sprite - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse---main-rb'>Input Basics - Mouse - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse-point-to-rect---main-rb'>Input Basics - Mouse Point To Rect - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---mouse-rect-to-rect---main-rb'>Input Basics - Mouse Rect To Rect - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---controller---main-rb'>Input Basics - Controller - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----input-basics---touch---main-rb'>Input Basics - Touch - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-using-separate-pngs---main-rb'>Rendering Sprites - Animation Using Separate Pngs - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-using-sprite-sheet---main-rb'>Rendering Sprites - Animation Using Sprite Sheet - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---animation-states---main-rb'>Rendering Sprites - Animation States - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rendering-sprites---color-and-rotation---main-rb'>Rendering Sprites - Color And Rotation - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---simple---main-rb'>Physics And Collisions - Simple - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---moving-objects---main-rb'>Physics And Collisions - Moving Objects - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---entities---main-rb'>Physics And Collisions - Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision---main-rb'>Physics And Collisions - Box Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision-2---main-rb'>Physics And Collisions - Box Collision 2 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---box-collision-3---main-rb'>Physics And Collisions - Box Collision 3 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---jump-physics---main-rb'>Physics And Collisions - Jump Physics - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---ball-rb'>Physics And Collisions - Bouncing On Collision - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---block-rb'>Physics And Collisions - Bouncing On Collision - block.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---cannon-rb'>Physics And Collisions - Bouncing On Collision - cannon.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---main-rb'>Physics And Collisions - Bouncing On Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---peg-rb'>Physics And Collisions - Bouncing On Collision - peg.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---bouncing-on-collision---vector2d-rb'>Physics And Collisions - Bouncing On Collision - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---ball-rb'>Physics And Collisions - Arbitrary Collision - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---blocks-rb'>Physics And Collisions - Arbitrary Collision - blocks.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---linear_collider-rb'>Physics And Collisions - Arbitrary Collision - linear_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---main-rb'>Physics And Collisions - Arbitrary Collision - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---paddle-rb'>Physics And Collisions - Arbitrary Collision - paddle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---rectangle-rb'>Physics And Collisions - Arbitrary Collision - rectangle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---square_collider-rb'>Physics And Collisions - Arbitrary Collision - square_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---arbitrary-collision---vector2d-rb'>Physics And Collisions - Arbitrary Collision - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---ball-rb'>Physics And Collisions - Collision With Object Removal - ball.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---linear_collider-rb'>Physics And Collisions - Collision With Object Removal - linear_collider.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---main-rb'>Physics And Collisions - Collision With Object Removal - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---paddle-rb'>Physics And Collisions - Collision With Object Removal - paddle.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---tests-rb'>Physics And Collisions - Collision With Object Removal - tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----physics-and-collisions---collision-with-object-removal---vector2d-rb'>Physics And Collisions - Collision With Object Removal - vector2d.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-click---main-rb'>Mouse - Mouse Click - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-move---main-rb'>Mouse - Mouse Move - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---mouse-move-paint-app---main-rb'>Mouse - Mouse Move Paint App - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mouse---coordinate-systems---main-rb'>Mouse - Coordinate Systems - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----save-load---save-load-game---main-rb'>Save Load - Save Load Game - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-audio---audio-mixer---main-rb'>Advanced Audio - Audio Mixer - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-audio---audio-mixer---server_ip_address-txt'>Advanced Audio - Audio Mixer - server_ip_address.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-audio---sound-synthesis---main-rb'>Advanced Audio - Sound Synthesis - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---labels-with-wrapped-text---main-rb'>Advanced Rendering - Labels With Wrapped Text - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---rotating-label---main-rb'>Advanced Rendering - Rotating Label - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---simple-render-targets---main-rb'>Advanced Rendering - Simple Render Targets - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-targets-with-tile-manipulation---main-rb'>Advanced Rendering - Render Targets With Tile Manipulation - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-target-viewports---main-rb'>Advanced Rendering - Render Target Viewports - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-primitive-hierarchies---main-rb'>Advanced Rendering - Render Primitive Hierarchies - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-primitives-as-hash---main-rb'>Advanced Rendering - Render Primitives As Hash - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---pixel-arrays---main-rb'>Advanced Rendering - Pixel Arrays - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---simple-camera---main-rb'>Advanced Rendering - Simple Camera - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---splitscreen-camera---main-rb'>Advanced Rendering - Splitscreen Camera - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---z-targeting-camera---main-rb'>Advanced Rendering - Z Targeting Camera - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---blend-modes---main-rb'>Advanced Rendering - Blend Modes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-rendering---render-target-noclear---main-rb'>Advanced Rendering - Render Target Noclear - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---easing-functions---main-rb'>Tweening Lerping Easing Functions - Easing Functions - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---cubic-bezier---main-rb'>Tweening Lerping Easing Functions - Cubic Bezier - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---easing-using-spline---main-rb'>Tweening Lerping Easing Functions - Easing Using Spline - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweening-lerping-easing-functions---parametric-enemy-movement---main-rb'>Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-hash---main-rb'>Performance - Sprites As Hash - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-entities---main-rb'>Performance - Sprites As Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-struct---main-rb'>Performance - Sprites As Struct - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-strict-entities---main-rb'>Performance - Sprites As Strict Entities - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---sprites-as-classes---main-rb'>Performance - Sprites As Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---static-sprites-as-classes---main-rb'>Performance - Static Sprites As Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---static-sprites-as-classes-with-custom-drawing---main-rb'>Performance - Static Sprites As Classes With Custom Drawing - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----performance---collision-limits---main-rb'>Performance - Collision Limits - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---logging---main-rb'>Advanced Debugging - Logging - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---trace-debugging---main-rb'>Advanced Debugging - Trace Debugging - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---trace-debugging-classes---main-rb'>Advanced Debugging - Trace Debugging Classes - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---benchmark_api_tests-rb'>Advanced Debugging - Unit Tests - benchmark_api_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---exception_raising_tests-rb'>Advanced Debugging - Unit Tests - exception_raising_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---fn_tests-rb'>Advanced Debugging - Unit Tests - fn_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---gen_docs-rb'>Advanced Debugging - Unit Tests - gen_docs.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---geometry_tests-rb'>Advanced Debugging - Unit Tests - geometry_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---http_tests-rb'>Advanced Debugging - Unit Tests - http_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---nil_coercion_tests-rb'>Advanced Debugging - Unit Tests - nil_coercion_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---object_to_primitive_tests-rb'>Advanced Debugging - Unit Tests - object_to_primitive_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---parsing_tests-rb'>Advanced Debugging - Unit Tests - parsing_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---pretty_format_tests-rb'>Advanced Debugging - Unit Tests - pretty_format_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---require_tests-rb'>Advanced Debugging - Unit Tests - require_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---serialize_deserialize_tests-rb'>Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---state_serialization_experimental_tests-rb'>Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----advanced-debugging---unit-tests---suggest_autocompletion_tests-rb'>Advanced Debugging - Unit Tests - suggest_autocompletion_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----http---retrieve-images---main-rb'>Http - Retrieve Images - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----http---in-game-web-server-http-get---main-rb'>Http - In Game Web Server Http Get - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----http---in-game-web-server-http-post---main-rb'>Http - In Game Web Server Http Post - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---basics---main-rb'>C Extensions - Basics - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---intermediate---main-rb'>C Extensions - Intermediate - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----c-extensions---native-pixel-arrays---main-rb'>C Extensions - Native Pixel Arrays - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---breadth-first-search---main-rb'>Path Finding Algorithms - Breadth First Search - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---detailed-breadth-first-search---main-rb'>Path Finding Algorithms - Detailed Breadth First Search - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---breadcrumbs---main-rb'>Path Finding Algorithms - Breadcrumbs - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---early-exit---main-rb'>Path Finding Algorithms - Early Exit - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---dijkstra---main-rb'>Path Finding Algorithms - Dijkstra - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---heuristic---main-rb'>Path Finding Algorithms - Heuristic - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---heuristic-with-walls---main-rb'>Path Finding Algorithms - Heuristic With Walls - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---a-star---main-rb'>Path Finding Algorithms - A Star - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----path-finding-algorithms---tower-defense---main-rb'>Path Finding Algorithms - Tower Defense - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---3d-cube---main-rb'>3d - 3d Cube - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---wireframe---main-rb'>3d - Wireframe - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---wireframe---data---what-is-this-txt'>3d - Wireframe - Data - what-is-this.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----3d---yaw-pitch-roll---main-rb'>3d - Yaw Pitch Roll - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---bullet-hell---main-rb'>Arcade - Bullet Hell - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---dueling-starships---main-rb'>Arcade - Dueling Starships - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade/flappy-dragon/credits-txt'>arcade/flappy dragon/credits.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade/flappy-dragon/main-rb'>arcade/flappy dragon/main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---pong---main-rb'>Arcade - Pong - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---snakemoji---main-rb'>Arcade - Snakemoji - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---solar-system---main-rb'>Arcade - Solar System - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---sound-golf---main-rb'>Arcade - Sound Golf - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----arcade---twinstick---main-rb'>Arcade - Twinstick - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----crafting---craft-game-starting-point---main-rb'>Crafting - Craft Game Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----crafting---farming-game-starting-point---main-rb'>Crafting - Farming Game Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----crafting---farming-game-starting-point---tests-rb'>Crafting - Farming Game Starting Point - tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---add-buttons-to-console---main-rb'>Dev Tools - Add Buttons To Console - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---animation-creator-starting-point---main-rb'>Dev Tools - Animation Creator Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dev-tools---tile-editor-starting-point---main-rb'>Dev Tools - Tile Editor Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----dungeon-crawl---classics-jam---main-rb'>Dungeon Crawl - Classics Jam - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----fighting---special-move-inputs---main-rb'>Fighting - Special Move Inputs - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---nokia-3310---main-rb'>Lowrez - Nokia 3310 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---nokia-3310---nokia-rb'>Lowrez - Nokia 3310 - nokia.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---resolution-64x64---lowrez-rb'>Lowrez - Resolution 64x64 - lowrez.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----lowrez---resolution-64x64---main-rb'>Lowrez - Resolution 64x64 - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mario---jumping---main-rb'>Mario - Jumping - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----mario---jumping-and-collisions---main-rb'>Mario - Jumping And Collisions - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---clepto-frog---main-rb'>Platformer - Clepto Frog - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---clepto-frog---map-rb'>Platformer - Clepto Frog - map.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---credits-txt'>Platformer - Gorillas Basic - credits.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---main-rb'>Platformer - Gorillas Basic - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---tests-rb'>Platformer - Gorillas Basic - tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---gorillas-basic---tests---building_generation_tests-rb'>Platformer - Gorillas Basic - Tests - building_generation_tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---main-rb'>Platformer - The Little Probe - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---data---level-txt'>Platformer - The Little Probe - Data - level.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----platformer---the-little-probe---data---level_lava-txt'>Platformer - The Little Probe - Data - level_lava.txt</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---choose-your-own-adventure---decision-rb'>Rpg Narrative - Choose Your Own Adventure - decision.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---choose-your-own-adventure---main-rb'>Rpg Narrative - Choose Your Own Adventure - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---lowrez_simulator-rb'>Rpg Narrative - Return Of Serenity - lowrez_simulator.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---main-rb'>Rpg Narrative - Return Of Serenity - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---require-rb'>Rpg Narrative - Return Of Serenity - require.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline-rb'>Rpg Narrative - Return Of Serenity - storyline.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_anka-rb'>Rpg Narrative - Return Of Serenity - storyline_anka.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_blinking_light-rb'>Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_day_one-rb'>Rpg Narrative - Return Of Serenity - storyline_day_one.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_final_decision-rb'>Rpg Narrative - Return Of Serenity - storyline_final_decision.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_final_message-rb'>Rpg Narrative - Return Of Serenity - storyline_final_message.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_alive-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_bio-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_serenity_introduction-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-narrative---return-of-serenity---storyline_speed_of_light-rb'>Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---constants-rb'>Rpg Roguelike - Roguelike Starting Point - constants.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---legend-rb'>Rpg Roguelike - Roguelike Starting Point - legend.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---main-rb'>Rpg Roguelike - Roguelike Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-starting-point---sprite_lookup-rb'>Rpg Roguelike - Roguelike Starting Point - sprite_lookup.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-roguelike---roguelike-line-of-sight---main-rb'>Rpg Roguelike - Roguelike Line Of Sight - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-tactical---hexagonal-grid---main-rb'>Rpg Tactical - Hexagonal Grid - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-tactical---isometric-grid---main-rb'>Rpg Tactical - Isometric Grid - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-topdown---topdown-casino---main-rb'>Rpg Topdown - Topdown Casino - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----rpg-topdown---topdown-starting-point---main-rb'>Rpg Topdown - Topdown Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----teenytiny---teenytiny-starting-point---main-rb'>Teenytiny - Teenytiny Starting Point - main.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----teenytiny---teenytiny-starting-point---license-txt'>Teenytiny - Teenytiny Starting Point - license.txt</a></li></ul></ul><ul><li><a class='header-2' href='#---oss'>OSS</a></li></ul><ul><ul><li><a class='header-3' href='#----args-rb'>args.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----assert-rb'>assert.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----attr_gtk-rb'>attr_gtk.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----attr_sprite-rb'>attr_sprite.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console-rb'>console.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_color-rb'>console_color.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_font_style-rb'>console_font_style.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_menu-rb'>console_menu.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----console_prompt-rb'>console_prompt.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller-rb'>controller.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller/config-rb'>controller/config.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----controller/keys-rb'>controller/keys.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----directional_input_helper_methods-rb'>directional_input_helper_methods.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----easing-rb'>easing.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----entity-rb'>entity.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----geometry-rb'>geometry.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----grid-rb'>grid.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----inputs-rb'>inputs.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----ios_wizard-rb'>ios_wizard.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----itch_wizard-rb'>itch_wizard.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----layout-rb'>layout.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----log-rb'>log.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----metadata-rb'>metadata.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----numeric-rb'>numeric.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----recording-rb'>recording.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----remote_hotload_client-rb'>remote_hotload_client.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/autocomplete-rb'>runtime/autocomplete.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/benchmark-rb'>runtime/benchmark.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/draw-rb'>runtime/draw.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/framerate-rb'>runtime/framerate.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/framerate_diagnostics-rb'>runtime/framerate_diagnostics.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----runtime/hotload-rb'>runtime/hotload.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----string-rb'>string.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tests-rb'>tests.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----trace-rb'>trace.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----tweetcart-rb'>tweetcart.rb</a></li></ul></ul><ul><ul><li><a class='header-3' href='#----wizards-rb'>wizards.rb</a></li></ul></ul></ul> </div> <div id='content'> <h1 id='--dragonruby-game-toolkit-live-docs'>DragonRuby Game Toolkit Live Docs</h1> <p> @@ -61,9 +64,6 @@ To search docs you can type <code>docs_search "SEARCH TERM"</code> or if you wan </p> <pre><code class="language-ruby">docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } </code></pre> -<p> -<img src='docs_search.gif'></img> -</p> <h1 id='--hello-world'>Hello World</h1> <p> Welcome to DragonRuby Game Toolkit. Take the steps below to get started. @@ -91,21 +91,26 @@ Reply with: I am a Dragon Rider. </p> </blockquote> -<h1 id='--watch-some-intro-videos'>Watch Some Intro Videos</h1> +<h1 id='--intro-videos'>Intro Videos</h1> <p> -Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them: +Here are some videos to help you get the lay of the land. </p> +<h2 id='---quick-api-tour'>Quick Api Tour</h2> <ol> <li> Beginner Introduction to DragonRuby Game Toolkit: <a href='https://youtu.be/ixw7TJhU08E'>https://youtu.be/ixw7TJhU08E</a></li> +</ol> +<h2 id='---if-you-are-completely-new-to-ruby-and-programming'>If You Are Completely New to Ruby and Programming</h2> +<ol> <li> Intermediate Introduction to Ruby Syntax: <a href='https://youtu.be/HG-XRZ5Ppgc'>https://youtu.be/HG-XRZ5Ppgc</a></li> <li> Intermediate Introduction to Arrays in Ruby: <a href='https://youtu.be/N72sEYFRqfo'>https://youtu.be/N72sEYFRqfo</a></li> +<li> You may also want to try this free course provided at <a href='http://dragonruby.school'>http://dragonruby.school</a>.</li> +</ol> +<h2 id='---if-you-have-game-dev-experience'>If You Have Game Dev Experience</h2> +<ol> +<li> Building Tetris - Part 1: <a href='https://youtu.be/xZMwRSbC4rY'>https://youtu.be/xZMwRSbC4rY</a></li> +<li> Building Tetris - Part 2: <a href='https://youtu.be/C3LLzDUDgz4'>https://youtu.be/C3LLzDUDgz4</a></li> +<li> Low Res Game Jam Tutorial: <a href='https://youtu.be/pCI90ukKCME'>https://youtu.be/pCI90ukKCME</a></li> </ol> -<p> -The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one. -</p> -<p> -You may also want to try this free course provided at <a href='http://dragonruby.school'>http://dragonruby.school</a>. -</p> <h1 id='--getting-started-tutorial'>Getting Started Tutorial</h1> <p> This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: <a href='https://en.wikipedia.org/wiki/Ryan_C._Gordon'>https://en.wikipedia.org/wiki/Ryan_C._Gordon</a>). @@ -291,7 +296,7 @@ Note that you can also run DragonRuby without X11 at all: if you run it from a v <p> There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to <code>args.output</code> anymore. </p> -<h1 id='--deploying-to-itch.io'>Deploying To Itch.io</h1> +<h1 id='--deploying-to-itch-io'>Deploying To Itch.io</h1> <p> Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel! </p> @@ -360,7 +365,7 @@ If you have a Pro subscription, you also have the capability to deploy to mobile To deploy to iOS, you need to have a Mac running MacOS Catalina, an iOS device, and an active/paid Developer Account with Apple. From the Console type: <code>$wizards.ios.start</code> and you will be guided through the deployment process. </p> <p> -To deploy to Android, you need to have an Android emulator/device, and a environment that is able to run Android SDK. <code>dragonruby-publish</code> will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like: +To deploy to Android, you need to have an Android emulator/device, and an environment that is able to run Android SDK. <code>dragonruby-publish</code> will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like: </p> <pre><code class="language-ruby">> adb logcat -e mygame # you'll want to run this in a separate terminal > keytool -genkey -v -keystore mygame.keystore -alias mygame -keyalg RSA -keysize 2048 -validity 10000 @@ -369,7 +374,7 @@ To deploy to Android, you need to have an Android emulator/device, and a environ </code></pre> <h1 id='--dragonruby's-philosophy'>DragonRuby's Philosophy</h1> <p> -The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. +The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principles. </p> <h2 id='---challenge-the-status-quo'>Challenge The Status Quo</h2> <p> @@ -388,7 +393,7 @@ It's a hard pill to swallow, but forget blindly accepted best practices and try There is a programming idiom in software called "The Pit of Success". The term normalizes upfront pain as a necessity/requirement in the hopes that the investment will yield dividends "when you become successful" or "when the code becomes more complicated". This approach to development is strongly discouraged by us. It leads to over-architected and unnecessary code; creates barriers to rapid prototyping and shipping a game; and overwhelms beginners who are new to the engine or programming in general. </p> <p> -DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and string entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create). +DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs that take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and strict entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create). </p> <h2 id='---release-early-and-often'>Release Early and Often</h2> <p> @@ -432,12 +437,12 @@ We are bombarded by marketing speak day in and day out. We don't do that here. T <p> We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work). </p> -<h1 id='--frequently-asked-questions,-comments,-and-concerns'>Frequently Asked Questions, Comments, and Concerns</h1> +<h1 id='--frequently-asked-questions--comments--and-concerns'>Frequently Asked Questions, Comments, and Concerns</h1> <p> Here are questions, comments, and concerns that frequently come up. </p> <h2 id='---frequently-asked-questions'>Frequently Asked Questions</h2> -<h3 id='----what-is-dragonruby-llp?'>What is DragonRuby LLP?</h3> +<h3 id='----what-is-dragonruby-llp-'>What is DragonRuby LLP?</h3> <p> DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible. </p> @@ -462,7 +467,7 @@ NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just <p> NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh? </p> -<h3 id='----what-is-dragonruby?'>What is DragonRuby?</h3> +<h3 id='----what-is-dragonruby-'>What is DragonRuby?</h3> <p> The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. </p> @@ -482,7 +487,7 @@ DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's The elevator pitch is: </p> <p> -DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Stadia. </p> <h4>What does Multilevel Cross-platform mean?</h4> <p> @@ -513,7 +518,7 @@ These levels allow us to stay up to date with open source implementations of Rub <p> DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. </p> -<h3 id='----how-is-dragonruby-different-than-mri?'>How is DragonRuby different than MRI?</h3> +<h3 id='----how-is-dragonruby-different-than-mri-'>How is DragonRuby different than MRI?</h3> <p> DragonRuby supports a subset of MRI apis. Our target is to support all of mRuby's standard lib. There are challenges to this given the number of platforms we are trying to support (specifically console). </p> @@ -535,7 +540,7 @@ end </code></pre> <ul> <li>If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal).</li> -<li>All <code>puts</code> statements will also be saved to <code>logs/log.txt</code>. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can <code>tail</code> this file.</li> +<li>All <code>puts</code> statements will also be saved to <code>logs/puts.txt</code>. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can <code>tail</code> this file.</li> </ul> <p> 4. To ignore code in <code>repl.rb</code>, instead of commenting it out, prefix <code>repl</code> with the letter <code>x</code> and it'll be ignored. @@ -568,18 +573,18 @@ You can use DragonRuby's replay capabilities to troubleshoot: </p> <ol> <li> DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).</li> -<li> Use <code>./dragonruby mygame --record</code> to create a game play recording that you can use to find the exception (you can replay a recoding by executing <code>./dragonruby mygame --replay last_replay.txt</code> or through the DragonRuby Console using <code>$gtk.recording.start_replay "last_replay.txt"</code>.</li> +<li> Use <code>./dragonruby mygame --record</code> to create a game play recording that you can use to find the exception (you can replay a recording by executing <code>./dragonruby mygame --replay last_replay.txt</code> or through the DragonRuby Console using <code>$gtk.recording.start_replay "last_replay.txt"</code>.</li> <li> DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: <code>./dragonruby . --eval some_ruby_file.rb --no-tick</code>.</li> <li> Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to <code>args.outputs.debug</code> that will render on top of your game but will be ignored in a production release.</li> <li> Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago.</li> </ol> <h2 id='---frequent-comments-about-ruby-as-a-language-choice'>Frequent Comments About Ruby as a Language Choice</h2> -<h3 id='----but-ruby-is-dead.'>But Ruby is dead.</h3> +<h3 id='----but-ruby-is-dead-'>But Ruby is dead.</h3> <p> Let's check the official source for the answer to this question: isrubydead.com: <a href='https://isrubydead.com/'>https://isrubydead.com/</a>. </p> <p> -On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny. +On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Everyone chases the new and shiny. </p> <p> What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. @@ -587,11 +592,11 @@ What really matters is _quality/maturity_. Here is the latest (StackOverflow Sur <p> Let's stop making this comment shall we? </p> -<h3 id='----but-ruby-is-slow.'>But Ruby is slow.</h3> +<h3 id='----but-ruby-is-slow-'>But Ruby is slow.</h3> <p> That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime. </p> -<h3 id='----dynamic-languages-are-slow.'>Dynamic languages are slow.</h3> +<h3 id='----dynamic-languages-are-slow-'>Dynamic languages are slow.</h3> <p> They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_. </p> @@ -602,7 +607,7 @@ Unless you are writing in some form of intermediate representation by hand, your NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^. </p> <h2 id='---frequent-concerns'>Frequent Concerns</h2> -<h3 id='----dragonruby-is-not-open-source.-that's-not-right.'>DragonRuby is not open source. That's not right.</h3> +<h3 id='----dragonruby-is-not-open-source--that's-not-right-'>DragonRuby is not open source. That's not right.</h3> <p> The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant. </p> @@ -618,7 +623,7 @@ If the reason above isn't sufficient, then definitely use something else. <p> All this being said, we do have parts of the engine open sourced on GitHub: <a href='https://github.com/dragonruby/dragonruby-game-toolkit-contrib/'>https://github.com/dragonruby/dragonruby-game-toolkit-contrib/</a> </p> -<h3 id='----dragonruby-is-for-pay.-you-should-offer-a-free-version.'>DragonRuby is for pay. You should offer a free version.</h3> +<h3 id='----dragonruby-is-for-pay--you-should-offer-a-free-version-'>DragonRuby is for pay. You should offer a free version.</h3> <p> If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products. </p> @@ -640,21 +645,21 @@ You qualify for a free, unrestricted license to DragonRuby products if any of th <p> Just contact Amir at [email protected] with a short explanation of your current situation and he'll set you up. No questions asked. </p> -<h3 id='----but-still,-you-should-offer-a-free-version.-so-i-can-try-it-out-and-see-if-i-like-it.'>But still, you should offer a free version. So I can try it out and see if I like it.</h3> +<h3 id='----but-still--you-should-offer-a-free-version--so-i-can-try-it-out-and-see-if-i-like-it-'>But still, you should offer a free version. So I can try it out and see if I like it.</h3> <p> -You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. +You can try our web-based sandbox environment at <a href='http://fiddle.dragonruby.org'>http://fiddle.dragonruby.org</a>. But it won't do the runtime justice. Or just come to our Discord Channel at <a href='http://discord.dragonruby.org'>http://discord.dragonruby.org</a> and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. </p> <p> Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so. </p> -<h3 id='----i-still-think-you-should-do-a-free-version.-think-of-all-people-who-would-give-it-a-shot.'>I still think you should do a free version. Think of all people who would give it a shot.</h3> +<h3 id='----i-still-think-you-should-do-a-free-version--think-of-all-people-who-would-give-it-a-shot-'>I still think you should do a free version. Think of all people who would give it a shot.</h3> <p> Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers). </p> <p> The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do. </p> -<h3 id='----what-if-i-build-something-with-dragonruby,-but-dragonruby-llp-becomes-insolvent.'>What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.</h3> +<h3 id='----what-if-i-build-something-with-dragonruby--but-dragonruby-llp-becomes-insolvent-'>What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.</h3> <p> That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen. </p> @@ -743,11 +748,15 @@ You can represent a sprite as a <code>Hash</code>: flip_vertically: false, flip_horizontally: false, angle_anchor_x: 0.5, - angle_anchor_y: 1.0 + angle_anchor_y: 1.0, + blendmode_enum: 1 } end </code></pre> <p> +The <code>blendmode_enum</code> value can be set to <code>0</code> (no blending), <code>1</code> (alpha blending), <code>2</code> (additive blending), <code>3</code> (modulo blending), <code>4</code> (multiply blending). +</p> +<p> You can represent a sprite as an <code>object</code>: </p> <pre><code class="language-ruby"># Create type with ALL sprite properties AND primitive_marker @@ -756,7 +765,7 @@ class Sprite :source_x, :source_y, :source_w, :source_h, :tile_x, :tile_y, :tile_w, :tile_h, :flip_horizontally, :flip_vertically, - :angle_anchor_x, :angle_anchor_y + :angle_anchor_x, :angle_anchor_y, :blendmode_enum def primitive_marker :sprite @@ -832,16 +841,17 @@ You can add additional metadata about your game within a label, which requires y </p> <pre><code class="language-ruby">def tick args args.outputs.labels << { - x: 200, - y: 550, - text: "dragonruby", - size_enum: 2, - alignment_enum: 1, - r: 155, - g: 50, - b: 50, - a: 255, - font: "fonts/manaspc.ttf", + x: 200, + y: 550, + text: "dragonruby", + size_enum: 2, + alignment_enum: 1, + r: 155, + g: 50, + b: 50, + a: 255, + font: "fonts/manaspc.ttf", + vertical_alignment_enum: 0, # 0 is bottom, 1 is middle, 2 is top # You can add any properties you like (this will be ignored/won't cause errors) game_data_one: "Something", game_data_two: { @@ -871,6 +881,19 @@ You can get the render size of any string using <code>args.gtk.calcstringbox</co ] end </code></pre> +<h2 id='---rendering-labels-with-new-line-characters-and-wrapping'>Rendering Labels With New Line Characters And Wrapping</h2> +<p> +You can use a strategy like the following to create multiple labels from a String. +</p> +<pre><code class="language-ruby">def tick args + long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elitteger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim." + max_character_length = 30 + long_strings_split = args.string.wrapped_lines long_string, max_character_length + args.outputs.labels << long_strings_split.map_with_index do |s, i| + { x: 10, y: 600 - (i * 20), text: s } + end +end +</code></pre> <h2 id='---how-to-play-a-sound'>How To Play A Sound</h2> <p> Sounds that end <code>.wav</code> will play once: @@ -902,7 +925,7 @@ If you want to play a <code>.ogg</code> once as if it were a sound effect, you c end end </code></pre> -<h2 id='---using--args.state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</h2> +<h2 id='---using--args-state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</h2> <p> <code>args.state</code> is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of <code>class</code>. </p> @@ -975,7 +998,7 @@ All the properties below hang off of <code>args</code> and can be accessed in th args.PROPERTY end </code></pre> -<h2 id='----args.state-'><code>args.state</code></h2> +<h2 id='----args-state-'><code>args.state</code></h2> <p> Store your game state inside of this <code>state</code>. Properties with arbitrary nesting is allowed and a backing Entity will be created on your behalf. </p> @@ -984,35 +1007,35 @@ Store your game state inside of this <code>state</code>. Properties with arbitra args.state.player.y ||= 0 end </code></pre> -<h3 id='-----.-.entity_id-'><code>.*.entity_id</code></h3> +<h3 id='--------entity_id-'><code>.*.entity_id</code></h3> <p> Entities automatically receive an <code>entity_id</code> of type <code>Fixnum</code>. </p> -<h3 id='-----.-.entity_type-'><code>.*.entity_type</code></h3> +<h3 id='--------entity_type-'><code>.*.entity_type</code></h3> <p> Entities can have an <code>entity_type</code> which is represented as a <code>Symbol</code>. </p> -<h3 id='-----.-.created_at-'><code>.*.created_at</code></h3> +<h3 id='--------created_at-'><code>.*.created_at</code></h3> <p> Entities have <code>created_at</code> set to <code>args.state.tick_count</code> when they are created. </p> -<h3 id='-----.-.created_at_elapsed-'><code>.*.created_at_elapsed</code></h3> +<h3 id='--------created_at_elapsed-'><code>.*.created_at_elapsed</code></h3> <p> Returns the elapsed number of ticks since creation. </p> -<h3 id='-----.-.global_created_at-'><code>.*.global_created_at</code></h3> +<h3 id='--------global_created_at-'><code>.*.global_created_at</code></h3> <p> Entities have <code>global_created_at</code> set to <code>Kernel.global_tick_count</code> when they are created. </p> -<h3 id='-----.-.global_created_at_elapsed-'><code>.*.global_created_at_elapsed</code></h3> +<h3 id='--------global_created_at_elapsed-'><code>.*.global_created_at_elapsed</code></h3> <p> Returns the elapsed number of global ticks since creation. </p> -<h3 id='-----.-.as_hash-'><code>.*.as_hash</code></h3> +<h3 id='--------as_hash-'><code>.*.as_hash</code></h3> <p> Entity cast to a <code>Hash</code> so you can update values as if you were updating a <code>Hash</code>. </p> -<h3 id='-----.new_entity-'><code>.new_entity</code></h3> +<h3 id='------new_entity-'><code>.new_entity</code></h3> <p> Creates a new Entity with a <code>type</code>, and initial properties. An option block can be passed to change the newly created entity: </p> @@ -1023,47 +1046,47 @@ Creates a new Entity with a <code>type</code>, and initial properties. An option end end </code></pre> -<h3 id='-----.new_entity_strict-'><code>.new_entity_strict</code></h3> +<h3 id='------new_entity_strict-'><code>.new_entity_strict</code></h3> <p> Creates a new Strict Entity. While Entities created via <code>args.state.new_entity</code> can have new properties added later on, Entities created using <code>args.state.new_entity</code> must define all properties that are allowed during its initialization. Attempting to add new properties after initialization will result in an exception. </p> -<h3 id='-----.tick_count-'><code>.tick_count</code></h3> +<h3 id='------tick_count-'><code>.tick_count</code></h3> <p> Returns the current tick of the game. <code>args.state.tick_count</code> is <code>0</code> when the game is first started or if the game is reset via <code>$gtk.reset</code>. </p> -<h2 id='----args.inputs-'><code>args.inputs</code></h2> +<h2 id='----args-inputs-'><code>args.inputs</code></h2> <p> Access using input using <code>args.inputs</code>. </p> -<h3 id='-----.up-'><code>.up</code></h3> +<h3 id='------up-'><code>.up</code></h3> <p> Returns <code>true</code> if: the <code>up</code> arrow or <code>w</code> key is pressed or held on the <code>keyboard</code>; or if <code>up</code> is pressed or held on <code>controller_one</code>; or if the <code>left_analog</code> on <code>controller_one</code> is tilted upwards. </p> -<h3 id='-----.down-'><code>.down</code></h3> +<h3 id='------down-'><code>.down</code></h3> <p> Returns <code>true</code> if: the <code>down</code> arrow or <code>s</code> key is pressed or held on the <code>keyboard</code>; or if <code>down</code> is pressed or held on <code>controller_one</code>; or if the <code>left_analog</code> on <code>controller_one</code> is tilted downwards. </p> -<h3 id='-----.left-'><code>.left</code></h3> +<h3 id='------left-'><code>.left</code></h3> <p> Returns <code>true</code> if: the <code>left</code> arrow or <code>a</code> key is pressed or held on the <code>keyboard</code>; or if <code>left</code> is pressed or held on <code>controller_one</code>; or if the <code>left_analog</code> on <code>controller_one</code> is tilted to the left. </p> -<h3 id='-----.right-'><code>.right</code></h3> +<h3 id='------right-'><code>.right</code></h3> <p> Returns <code>true</code> if: the <code>right</code> arrow or <code>d</code> key is pressed or held on the <code>keyboard</code>; or if <code>right</code> is pressed or held on <code>controller_one</code>; or if the <code>left_analog</code> on <code>controller_one</code> is tilted to the right. </p> -<h3 id='-----.left_right-'><code>.left_right</code></h3> +<h3 id='------left_right-'><code>.left_right</code></h3> <p> Returns <code>-1</code> (left), <code>0</code> (neutral), or <code>+1</code> (right) depending on results of <code>args.inputs.left</code> and <code>args.inputs.right</code>. </p> -<h3 id='-----.up_down-'><code>.up_down</code></h3> +<h3 id='------up_down-'><code>.up_down</code></h3> <p> -Returns <code>-1</code> (down), <code>0</code> (neutral), or <code>+1</code> (right) depending on results of <code>args.inputs.up</code> and <code>args.inputs.down</code>. +Returns <code>-1</code> (down), <code>0</code> (neutral), or <code>+1</code> (up) depending on results of <code>args.inputs.down</code> and <code>args.inputs.up</code>. </p> -<h3 id='-----.text--or--.history-'><code>.text</code> OR <code>.history</code></h3> +<h3 id='------text--or---history-'><code>.text</code> OR <code>.history</code></h3> <p> Returns a string that represents the last key that was pressed on the keyboard. </p> -<h3 id='-----.mouse-'><code>.mouse</code></h3> +<h3 id='------mouse-'><code>.mouse</code></h3> <p> Represents the user's </p> @@ -1105,37 +1128,49 @@ Returns a bitmask for all buttons on the mouse: <code>1</code> for a button in t </p> <h4><code>mouse.wheel</code></h4> <p> -Represents the mouse wheel. Returns <code>nil</code> if no mouse wheel actions occurred. ***** <code>.x</code> Returns the negative or positive number if the mouse wheel has changed in the <code>x</code> axis. ***** <code>.y</code> Returns the negative or positive number if the mouse wheel has changed in the <code>y</code> axis. +Represents the mouse wheel. Returns <code>nil</code> if no mouse wheel actions occurred. +</p> +<p> +***** <code>.x</code> +</p> +<p> +Returns the negative or positive number if the mouse wheel has changed in the <code>x</code> axis. +</p> +<p> +***** <code>.y</code> +</p> +<p> +Returns the negative or positive number if the mouse wheel has changed in the <code>y</code> axis. </p> <h4><code>.click</code> OR <code>.down</code>, <code>.previous_click</code>, <code>.up</code></h4> <p> The properties <code>args.inputs.mouse.(click|down|previous_click|up)</code> each return <code>nil</code> if the mouse button event didn't occur. And return an Entity that has an <code>x</code>, <code>y</code> properties along with helper functions to determine collision: <code>inside_rect?</code>, <code>inside_circle</code>. </p> -<h3 id='-----.controller_one-,--.controller_two-'><code>.controller_one</code>, <code>.controller_two</code></h3> +<h3 id='------controller_one-----controller_two-'><code>.controller_one</code>, <code>.controller_two</code></h3> <p> Represents controllers connected to the usb ports. </p> -<h4>~.up</h4> +<h4><code>.up</code></h4> <p> Returns <code>true</code> if <code>up</code> is pressed or held on the directional or left analog. </p> -<h4>~.down</h4> +<h4><code>.down</code></h4> <p> Returns <code>true</code> if <code>down</code> is pressed or held on the directional or left analog. </p> -<h4>~.left</h4> +<h4><code>.left</code></h4> <p> Returns <code>true</code> if <code>left</code> is pressed or held on the directional or left analog. </p> -<h4>~.right</h4> +<h4><code>.right</code></h4> <p> Returns <code>true</code> if <code>right</code> is pressed or held on the directional or left analog. </p> -<h4>~.left_right</h4> +<h4><code>.left_right</code></h4> <p> Returns <code>-1</code> (left), <code>0</code> (neutral), or <code>+1</code> (right) depending on results of <code>args.inputs.controller_(one|two).left</code> and <code>args.inputs.controller_(one|two).right</code>. </p> -<h4>~.up_down</h4> +<h4><code>.up_down</code></h4> <p> Returns <code>-1</code> (down), <code>0</code> (neutral), or <code>+1</code> (up) depending on results of <code>args.inputs.controller_(one|two).up</code> and <code>args.inputs.controller_(one|two).down</code>. </p> @@ -1155,19 +1190,19 @@ Returns a number between <code>-1</code> and <code>1</code> which represents the <p> Returns a number between <code>-1</code> and <code>1</code> which represents the percentage the analog is moved vertically as a ratio of the maximum vertical movement. </p> -<h4><code>.directional_up)</code></h4> +<h4><code>.directional_up</code></h4> <p> Returns <code>true</code> if <code>up</code> is pressed or held on the directional. </p> -<h4><code>.directional_down)</code></h4> +<h4><code>.directional_down</code></h4> <p> Returns <code>true</code> if <code>down</code> is pressed or held on the directional. </p> -<h4><code>.directional_left)</code></h4> +<h4><code>.directional_left</code></h4> <p> Returns <code>true</code> if <code>left</code> is pressed or held on the directional. </p> -<h4><code>.directional_right)</code></h4> +<h4><code>.directional_right</code></h4> <p> Returns <code>true</code> if <code>right</code> is pressed or held on the directional. </p> @@ -1191,7 +1226,7 @@ Returns <code>true</code> if the specific button is being held. <code>args.input <p> Returns <code>true</code> if the specific button was released. <code>args.inputs.controller_(one|two).key_up.BUTTON</code> will be true only on the frame the button was released. </p> -<h3 id='-----.keyboard-'><code>.keyboard</code></h3> +<h3 id='------keyboard-'><code>.keyboard</code></h3> <p> Represents the user's keyboard </p> @@ -1333,139 +1368,148 @@ Returns a <code>Hash</code> with all keys on the keyboard in their respective st <li><code>:down_or_held</code></li> <li><code>:up</code></li> </ul> -<h2 id='----args.outputs-'><code>args.outputs</code></h2> +<h2 id='----args-outputs-'><code>args.outputs</code></h2> <p> <code>args.outputs.PROPERTY</code> is how you render to the screen. </p> -<h3 id='-----.background_color-'><code>.background_color</code></h3> +<h3 id='------background_color-'><code>.background_color</code></h3> <p> Set <code>args.outputs.background_color</code> to an <code>Array</code> with <code>RGB</code> values (eg. <code>[255, 255, 255]</code> for the color white). </p> -<h3 id='-----.sounds-'><code>.sounds</code></h3> +<h3 id='------sounds-'><code>.sounds</code></h3> <p> Send a file path to this collection to play a sound. The sound file must be under the <code>mygame</code> directory. Example: <code>args.outputs.sounds << "sounds/jump.wav"</code>. </p> -<h3 id='-----.solids-'><code>.solids</code></h3> +<h3 id='------solids-'><code>.solids</code></h3> <p> Send a Primitive to this collection to render a filled in rectangle to the screen. This collection is cleared at the end of every frame. </p> -<h3 id='-----.static_solids-'><code>.static_solids</code></h3> +<h3 id='------static_solids-'><code>.static_solids</code></h3> <p> Send a Primitive to this collection to render a filled in rectangle to the screen. This collection is not cleared at the end of every frame. And objects can be mutated by reference. </p> -<h3 id='-----.sprites-,--.static_sprites-'><code>.sprites</code>, <code>.static_sprites</code></h3> +<h3 id='------sprites-----static_sprites-'><code>.sprites</code>, <code>.static_sprites</code></h3> <p> Send a Primitive to this collection to render a sprite to the screen. </p> -<h3 id='-----.primitives-,--.static_primitives-'><code>.primitives</code>, <code>.static_primitives</code></h3> +<h3 id='------primitives-----static_primitives-'><code>.primitives</code>, <code>.static_primitives</code></h3> <p> Send a Primitive of any type and it'll be rendered. The Primitive must have a <code>primitive_marker</code> that returns <code>:solid</code>, <code>:sprite</code>, <code>:label</code>, <code>:line</code>, <code>:border</code>. </p> -<h3 id='-----.labels-,--.static_labels-'><code>.labels</code>, <code>.static_labels</code></h3> +<h3 id='------labels-----static_labels-'><code>.labels</code>, <code>.static_labels</code></h3> <p> Send a Primitive to this collection to render text to the screen. </p> -<h3 id='-----.lines-,--.static_lines-'><code>.lines</code>, <code>.static_lines</code></h3> +<h3 id='------lines-----static_lines-'><code>.lines</code>, <code>.static_lines</code></h3> <p> Send a Primitive to this collection to render a line to the screen. </p> -<h3 id='-----.borders-,--.static_borders-'><code>.borders</code>, <code>.static_borders</code></h3> +<h3 id='------borders-----static_borders-'><code>.borders</code>, <code>.static_borders</code></h3> <p> Send a Primitive to this collection to render an unfilled rectangle to the screen. </p> -<h3 id='-----.debug-,--.static_debug-'><code>.debug</code>, <code>.static_debug</code></h3> +<h3 id='------debug-----static_debug-'><code>.debug</code>, <code>.static_debug</code></h3> <p> Send any Primitive to this collection which represents things you render to the screen for debugging purposes. Primitives in this collection will not be rendered in a production release of your game. </p> -<h2 id='----args.geometry-'><code>args.geometry</code></h2> +<h2 id='----args-geometry-'><code>args.geometry</code></h2> <p> This property contains geometric functions. Functions can be invoked via <code>args.geometry.FUNCTION</code>. </p> -<h3 id='-----.inside_rect?-rect_1,-rect_2-'><code>.inside_rect? rect_1, rect_2</code></h3> +<p> +Here are some general notes with regards to the arguments these geometric functions accept. +</p> +<ol> +<li> <code>Rectangles</code> can be represented as an <code>Array</code> with four (or more) values <code>[x, y, w, h]</code>, as a <code>Hash</code> <code>{ x:, y:, w:, h: }</code> or an object that responds to <code>x</code>, <code>y</code>, <code>w</code>, and <code>h</code>.</li> +<li> <code>Points</code> can be represent as an <code>Array</code> with two (or more) values <code>[x, y]</code>, as a <code>Hash</code> <code>{ x:, y:}</code> or an object that responds to <code>x</code>, and <code>y</code>.</li> +<li> <code>Lines</code> can be represented as an <code>Array</code> with four (or more) values <code>[x, y, x2, y2]</code>, as a <code>Hash</code> <code>{ x:, y:, x2:, y2: }</code> or an object that responds to <code>x</code>, <code>y</code>, <code>x2</code>, and <code>y2</code>.</li> +<li> <code>Angles</code> are represented as degrees (not radians).</li> +</ol> +<h3 id='------inside_rect--rect_1--rect_2-'><code>.inside_rect? rect_1, rect_2</code></h3> <p> Returns <code>true</code> if <code>rect_1</code> is inside <code>rect_2</code>. </p> -<h3 id='-----.intersect_rect?-rect_2,-rect_2-'><code>.intersect_rect? rect_2, rect_2</code></h3> +<h3 id='------intersect_rect--rect_2--rect_2-'><code>.intersect_rect? rect_2, rect_2</code></h3> <p> Returns <code>true</code> if <code>rect_1</code> intersects <code>rect_2</code>. </p> -<h3 id='-----.scale_rect-rect,-x_percentage,-y_percentage-'><code>.scale_rect rect, x_percentage, y_percentage</code></h3> +<h3 id='------scale_rect-rect--x_percentage--y_percentage-'><code>.scale_rect rect, x_percentage, y_percentage</code></h3> <p> Returns a new rectangle that is scaled by the percentages provided. </p> -<h3 id='-----.angle_to-start_point,-end_point-'><code>.angle_to start_point, end_point</code></h3> +<h3 id='------angle_to-start_point--end_point-'><code>.angle_to start_point, end_point</code></h3> <p> Returns the angle in degrees between two points <code>start_point</code> to <code>end_point</code>. </p> -<h3 id='-----.angle_from-start_point,-end_point-'><code>.angle_from start_point, end_point</code></h3> +<h3 id='------angle_from-start_point--end_point-'><code>.angle_from start_point, end_point</code></h3> <p> Returns the angle in degrees between two points <code>start_point</code> from <code>end_point</code>. </p> -<h3 id='-----.point_inside_circle?-point,-circle_center_point,-radius-'><code>.point_inside_circle? point, circle_center_point, radius</code></h3> +<h3 id='------point_inside_circle--point--circle_center_point--radius-'><code>.point_inside_circle? point, circle_center_point, radius</code></h3> <p> Returns <code>true</code> if a point is inside a circle defined by its center and radius. </p> -<h3 id='-----.center_inside_rect-rect,-other_rect-'><code>.center_inside_rect rect, other_rect</code></h3> +<h3 id='------center_inside_rect-rect--other_rect-'><code>.center_inside_rect rect, other_rect</code></h3> <p> Returns a new rectangle based of off <code>rect</code> that is centered inside of <code>other_rect</code>. </p> -<h3 id='-----.center_inside_rect_x-rect,-other_rect-'><code>.center_inside_rect_x rect, other_rect</code></h3> +<h3 id='------center_inside_rect_x-rect--other_rect-'><code>.center_inside_rect_x rect, other_rect</code></h3> <p> Returns a new rectangle based of off <code>rect</code> that is centered horizontally inside of <code>other_rect</code>. </p> -<h3 id='-----.center_inside_rect_y-rect,-other_rect-'><code>.center_inside_rect_y rect, other_rect</code></h3> +<h3 id='------center_inside_rect_y-rect--other_rect-'><code>.center_inside_rect_y rect, other_rect</code></h3> <p> Returns a new rectangle based of off <code>rect</code> that is centered vertically inside of <code>other_rect</code>. </p> -<h3 id='-----.anchor_rect-rect,-anchor_x,-anchor_y-'><code>.anchor_rect rect, anchor_x, anchor_y</code></h3> +<h3 id='------anchor_rect-rect--anchor_x--anchor_y-'><code>.anchor_rect rect, anchor_x, anchor_y</code></h3> <p> Returns a new rectangle based of off <code>rect</code> that has been repositioned based on the percentages passed into anchor_x, and anchor_y. </p> -<h3 id='-----.shift_line-line,-x,-y-'><code>.shift_line line, x, y</code></h3> +<h3 id='------shift_line-line--x--y-'><code>.shift_line line, x, y</code></h3> <p> Returns a line that is offset by <code>x</code>, and <code>y</code>. </p> -<h3 id='-----.line_y_intercept-line-'><code>.line_y_intercept line</code></h3> +<h3 id='------line_y_intercept-line-'><code>.line_y_intercept line</code></h3> <p> Given a line, the <code>b</code> value is determined for the point slope form equation: <code>y = mx + b</code>. </p> -<h3 id='-----.angle_between_lines-line_one,-line_two,-replace_infinity--'><code>.angle_between_lines line_one, line_two, replace_infinity:</code></h3> +<h3 id='------angle_between_lines-line_one--line_two--replace_infinity--'><code>.angle_between_lines line_one, line_two, replace_infinity:</code></h3> <p> Returns the angle between two lines as if they were infinitely long. A numeric value can be passed in for the last parameter which would represent lines that do not intersect. </p> -<h3 id='-----.line_slope-line,-replace_infinity--'><code>.line_slope line, replace_infinity:</code></h3> +<h3 id='------line_slope-line--replace_infinity--'><code>.line_slope line, replace_infinity:</code></h3> <p> Given a line, the <code>m</code> value is determined for the point slope form equation: <code>y = mx + b</code>. </p> -<h3 id='-----.line_rise_run-'><code>.line_rise_run</code></h3> +<h3 id='------line_rise_run-'><code>.line_rise_run</code></h3> <p> Given a line, a <code>Hash</code> is returned that returns the slope as <code>x</code> and <code>y</code> properties with normalized values (the number is between -1 and 1). </p> -<h3 id='-----.ray_test-point,-line-'><code>.ray_test point, line</code></h3> +<h3 id='------ray_test-point--line-'><code>.ray_test point, line</code></h3> <p> Given a point and a line, <code>:on</code>, <code>:left</code>, or <code>:right</code> which represents the location of the point relative to the line. </p> -<h3 id='-----.line_rect-line-'><code>.line_rect line</code></h3> +<h3 id='------line_rect-line-'><code>.line_rect line</code></h3> <p> Returns the bounding rectangle for a line. </p> -<h3 id='-----.line_intersect-line_one,-line_two-'><code>.line_intersect line_one, line_two</code></h3> +<h3 id='------line_intersect-line_one--line_two-'><code>.line_intersect line_one, line_two</code></h3> <p> Returns a point that represents the intersection of the lines. </p> -<h3 id='-----.distance-point_one,-point_two-'><code>.distance point_one, point_two</code></h3> +<h3 id='------distance-point_one--point_two-'><code>.distance point_one, point_two</code></h3> <p> Returns the distance between two points. </p> -<h3 id='-----.cubic_bezier-t,-a,-b,-c,-d-'><code>.cubic_bezier t, a, b, c, d</code></h3> +<h3 id='------cubic_bezier-t--a--b--c--d-'><code>.cubic_bezier t, a, b, c, d</code></h3> <p> Returns the cubic bezier function for tick_count <code>t</code> with anchors <code>a</code>, <code>b</code>, <code>c</code>, and <code>d</code>. </p> -<h2 id='----args.easing-'><code>args.easing</code></h2> +<h2 id='----args-easing-'><code>args.easing</code></h2> <p> A set of functions that allow you to determine the current progression of an easing function. </p> -<h3 id='-----.ease-start_tick,-current_tick,-duration,-easing_functions-'><code>.ease start_tick, current_tick, duration, easing_functions</code></h3> +<h3 id='------ease-start_tick--current_tick--duration--easing_functions-'><code>.ease start_tick, current_tick, duration, easing_functions</code></h3> <p> Given a start, current, duration, and easing function names, <code>ease</code> returns a number between 0 and 1 that represents the progress of an easing function. </p> @@ -1485,7 +1529,7 @@ This example will move a box at a linear speed from 0 to 1280. args.outputs.solids << { x: 1280 * current_progress, y: 360, w: 10, h: 10 } end </code></pre> -<h3 id='-----.ease_spline-start_tick,-current_tick,-duration,-spline-'><code>.ease_spline start_tick, current_tick, duration, spline</code></h3> +<h3 id='------ease_spline-start_tick--current_tick--duration--spline-'><code>.ease_spline start_tick, current_tick, duration, spline</code></h3> <p> Given a start, current, duration, and a multiple bezier values, this function returns a number between 0 and 1 that represents the progress of an easing function. </p> @@ -1506,11 +1550,11 @@ This example will move a box at a linear speed from 0 to 1280 and then back to 0 args.outputs.solids << { x: 1280 * current_progress, y: 360, w: 10, h: 10 } end </code></pre> -<h2 id='----args.string-'><code>args.string</code></h2> +<h2 id='----args-string-'><code>args.string</code></h2> <p> Useful string functions not included in Ruby core libraries. </p> -<h3 id='-----.wrapped_lines-string,-max_character_length-'><code>.wrapped_lines string, max_character_length</code></h3> +<h3 id='------wrapped_lines-string--max_character_length-'><code>.wrapped_lines string, max_character_length</code></h3> <p> This function will return a collection of strings given an input <code>string</code> and <code>max_character_length</code>. The collection of strings returned will split the input string into strings of <code>length <= max_character_length</code>. </p> @@ -1527,175 +1571,175 @@ teger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim." end end </code></pre> -<h2 id='----args.grid-'><code>args.grid</code></h2> +<h2 id='----args-grid-'><code>args.grid</code></h2> <p> Returns the virtual grid for the game. </p> -<h3 id='-----.name-'><code>.name</code></h3> +<h3 id='------name-'><code>.name</code></h3> <p> Returns either <code>:origin_bottom_left</code> or <code>:origin_center</code>. </p> -<h3 id='-----.bottom-'><code>.bottom</code></h3> +<h3 id='------bottom-'><code>.bottom</code></h3> <p> Returns the <code>y</code> value that represents the bottom of the grid. </p> -<h3 id='-----.top-'><code>.top</code></h3> +<h3 id='------top-'><code>.top</code></h3> <p> Returns the <code>y</code> value that represents the top of the grid. </p> -<h3 id='-----.left-'><code>.left</code></h3> +<h3 id='------left-'><code>.left</code></h3> <p> Returns the <code>x</code> value that represents the left of the grid. </p> -<h3 id='-----.right-'><code>.right</code></h3> +<h3 id='------right-'><code>.right</code></h3> <p> Returns the <code>x</code> value that represents the right of the grid. </p> -<h3 id='-----.rect-'><code>.rect</code></h3> +<h3 id='------rect-'><code>.rect</code></h3> <p> Returns a rectangle Primitive that represents the grid. </p> -<h3 id='-----.origin_bottom_left!-'><code>.origin_bottom_left!</code></h3> +<h3 id='------origin_bottom_left!-'><code>.origin_bottom_left!</code></h3> <p> Change the grids coordinate system to 0, 0 at the bottom left corner. </p> -<h3 id='-----.origin_center!-'><code>.origin_center!</code></h3> +<h3 id='------origin_center!-'><code>.origin_center!</code></h3> <p> Change the grids coordinate system to 0, 0 at the center of the screen. </p> -<h3 id='-----.w-'><code>.w</code></h3> +<h3 id='------w-'><code>.w</code></h3> <p> Returns the grid's width (always 1280). </p> -<h3 id='-----.h-'><code>.h</code></h3> +<h3 id='------h-'><code>.h</code></h3> <p> Returns the grid's height (always 720). </p> -<h2 id='----args.gtk-'><code>args.gtk</code></h2> +<h2 id='----args-gtk-'><code>args.gtk</code></h2> <p> This represents the DragonRuby Game Toolkit's Runtime Environment and can be accessed via <code>args.gtk.METHOD</code>. </p> -<h3 id='-----.argv-'><code>.argv</code></h3> +<h3 id='------argv-'><code>.argv</code></h3> <p> Returns a <code>String</code> that represents the parameters passed into the <code>./dragonruby</code> binary. </p> -<h3 id='-----.platform-'><code>.platform</code></h3> +<h3 id='------platform-'><code>.platform</code></h3> <p> Returns a <code>String</code> representing the operating system the game is running on. </p> -<h3 id='-----.request_quit-'><code>.request_quit</code></h3> +<h3 id='------request_quit-'><code>.request_quit</code></h3> <p> Request that the runtime quit the game. </p> -<h3 id='-----.write_file-path,-contents-'><code>.write_file path, contents</code></h3> +<h3 id='------write_file-path--contents-'><code>.write_file path, contents</code></h3> <p> Writes/overwrites a file within the game directory + path. </p> -<h3 id='-----.write_file_root-'><code>.write_file_root</code></h3> +<h3 id='------write_file_root-'><code>.write_file_root</code></h3> <p> Writes/overwrites a file within the root dragonruby binary directory + path. </p> -<h3 id='-----.append_file-path,-contents-'><code>.append_file path, contents</code></h3> +<h3 id='------append_file-path--contents-'><code>.append_file path, contents</code></h3> <p> Append content to a file located at the game directory + path. </p> -<h3 id='-----.append_file_root-path,-contents-'><code>.append_file_root path, contents</code></h3> +<h3 id='------append_file_root-path--contents-'><code>.append_file_root path, contents</code></h3> <p> Append content to a file located at the root dragonruby binary directory + path. </p> -<h3 id='-----.read_file-path-'><code>.read_file path</code></h3> +<h3 id='------read_file-path-'><code>.read_file path</code></h3> <p> Reads a file from the sandboxed file system. </p> -<h3 id='-----.parse_xml-string,-parse_xml_file-path-'><code>.parse_xml string, parse_xml_file path</code></h3> +<h3 id='------parse_xml-string--parse_xml_file-path-'><code>.parse_xml string, parse_xml_file path</code></h3> <p> Returns a <code>Hash</code> for a <code>String</code> that represents XML. </p> -<h3 id='-----.parse_json-string,-parse_json_file-path-'><code>.parse_json string, parse_json_file path</code></h3> +<h3 id='------parse_json-string--parse_json_file-path-'><code>.parse_json string, parse_json_file path</code></h3> <p> Returns a <code>Hash</code> for a <code>String</code> that represents JSON. </p> -<h3 id='-----.http_get-url,-extra_headers-=-{}-'><code>.http_get url, extra_headers = {}</code></h3> +<h3 id='------http_get-url--extra_headers-=-{}-'><code>.http_get url, extra_headers = {}</code></h3> <p> Creates an async task to perform an HTTP GET. </p> -<h3 id='-----.http_post-url,-form_fields-=-{},-extra_headers-=-{}-'><code>.http_post url, form_fields = {}, extra_headers = {}</code></h3> +<h3 id='------http_post-url--form_fields-=-{}--extra_headers-=-{}-'><code>.http_post url, form_fields = {}, extra_headers = {}</code></h3> <p> Creates an async task to perform an HTTP POST. </p> -<h3 id='-----.reset-'><code>.reset</code></h3> +<h3 id='------reset-'><code>.reset</code></h3> <p> Resets the game by deleting all data in <code>args.state</code> and setting <code>args.state.tick_count</code> back to <code>0</code>. </p> -<h3 id='-----.stop_music-'><code>.stop_music</code></h3> +<h3 id='------stop_music-'><code>.stop_music</code></h3> <p> Stops all background music. </p> -<h3 id='-----.calcstringbox-str,-size_enum,-font-'><code>.calcstringbox str, size_enum, font</code></h3> +<h3 id='------calcstringbox-str--size_enum--font-'><code>.calcstringbox str, size_enum, font</code></h3> <p> Returns a tuple with width and height of a string being rendered. </p> -<h3 id='-----.slowmo!-factor-'><code>.slowmo! factor</code></h3> +<h3 id='------slowmo!-factor-'><code>.slowmo! factor</code></h3> <p> Slows the game down by the factor provided. </p> -<h3 id='-----.notify!-string-'><code>.notify! string</code></h3> +<h3 id='------notify!-string-'><code>.notify! string</code></h3> <p> Renders a toast message at the bottom of the screen. </p> -<h3 id='-----.system-'><code>.system</code></h3> +<h3 id='------system-'><code>.system</code></h3> <p> Invokes a shell command and prints the result to the console. </p> -<h3 id='-----.exec-'><code>.exec</code></h3> +<h3 id='------exec-'><code>.exec</code></h3> <p> Invokes a shell command and returns a <code>String</code> that represents the result. </p> -<h3 id='-----.save_state-'><code>.save_state</code></h3> +<h3 id='------save_state-'><code>.save_state</code></h3> <p> Saves the game state to <code>game_state.txt</code>. </p> -<h3 id='-----.load_state-'><code>.load_state</code></h3> +<h3 id='------load_state-'><code>.load_state</code></h3> <p> Load <code>args.state</code> from <code>game_state.txt</code>. </p> -<h3 id='-----.serialize_state-file,-state-'><code>.serialize_state file, state</code></h3> +<h3 id='------serialize_state-file--state-'><code>.serialize_state file, state</code></h3> <p> Saves entity state to a file. If only one parameter is provided a string is returned for state instead of writing to a file. </p> -<h3 id='-----.deserialize_state-file-'><code>.deserialize_state file</code></h3> +<h3 id='------deserialize_state-file-'><code>.deserialize_state file</code></h3> <p> Returns entity state from a file or serialization data represented as a <code>String</code>. </p> -<h3 id='-----.reset_sprite-path-'><code>.reset_sprite path</code></h3> +<h3 id='------reset_sprite-path-'><code>.reset_sprite path</code></h3> <p> Invalids the texture cache of a sprite. </p> -<h3 id='-----.show_cursor-'><code>.show_cursor</code></h3> +<h3 id='------show_cursor-'><code>.show_cursor</code></h3> <p> Shows the mouse cursor. </p> -<h3 id='-----.hide_cursor-'><code>.hide_cursor</code></h3> +<h3 id='------hide_cursor-'><code>.hide_cursor</code></h3> <p> Hides the mouse cursor. </p> -<h3 id='-----.cursor_shown?-'><code>.cursor_shown?</code></h3> +<h3 id='------cursor_shown--'><code>.cursor_shown?</code></h3> <p> Returns <code>true</code> if the mouse cursor is shown. </p> -<h3 id='-----.set_window_fullscreen-enabled-'><code>.set_window_fullscreen enabled</code></h3> +<h3 id='------set_window_fullscreen-enabled-'><code>.set_window_fullscreen enabled</code></h3> <p> Sets the game to either fullscreen (<code>enabled=true</code>) or windowed (<code>enabled=false)</code>. </p> -<h3 id='-----.openurl-url-'><code>.openurl url</code></h3> +<h3 id='------openurl-url-'><code>.openurl url</code></h3> <p> Opens a url using the Operating System's default browser. </p> -<h3 id='-----.get_base_dir-'><code>.get_base_dir</code></h3> +<h3 id='------get_base_dir-'><code>.get_base_dir</code></h3> <p> Returns the full path of the DragonRuby binary directory. </p> -<h3 id='-----.get_game_dir-'><code>.get_game_dir</code></h3> +<h3 id='------get_game_dir-'><code>.get_game_dir</code></h3> <p> Returns the full path of the game directory in its sandboxed environment. </p> @@ -1722,6 +1766,33 @@ This function takes in two parameters. The first parameter is the file path and end end </code></pre> +<h1 id='--docs---gtk--runtime#benchmark-'>DOCS: <code>GTK::Runtime#benchmark</code></h1> +<p> +You can use this function to compare the relative performance of methods. +</p> +<pre><code class="language-ruby">def tick args + # press r to run benchmark + if args.inputs.keyboard.key_down.r + args.gtk.console.show + args.gtk.benchmark iterations: 1000, # number of iterations + # label for experiment + using_numeric_map: -> () { + # experiment body + v = 100.map do |i| + i * 100 + end + }, + # label for experiment + using_numeric_times: -> () { + # experiment body + v = [] + 100.times do |i| + v << i * 100 + end + } + end +end +</code></pre> <h1 id='--docs---array-'>DOCS: <code>Array</code></h1> <p> The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit. @@ -1869,11 +1940,11 @@ Assuming the array is an array of arrays, Given a block, each 2D array index inv puts occupied_tiles end </code></pre> -<h1 id='--docs---array#include_any?-'>DOCS: <code>Array#include_any?</code></h1> +<h1 id='--docs---array#include_any--'>DOCS: <code>Array#include_any?</code></h1> <p> Given a collection of items, the function will return <code>true</code> if any of <code>self</code>'s items exists in the collection of items passed in: </p> -<h1 id='--docs---array#any_intersect_rect?-'>DOCS: <code>Array#any_intersect_rect?</code></h1> +<h1 id='--docs---array#any_intersect_rect--'>DOCS: <code>Array#any_intersect_rect?</code></h1> <p> Assuming the array contains objects that respond to <code>left</code>, <code>right</code>, <code>top</code>, <code>bottom</code>, this method returns <code>true</code> if any of the elements within the array intersect the object being passed in. You are given an optional parameter called <code>tolerance</code> which informs how close to the other rectangles the elements need to be for it to be considered intersecting. </p> @@ -2018,7 +2089,7 @@ end </code></pre> <h2 id='---rendering-a-solid-using-an-array-with-colors-and-alpha'>Rendering a solid using an Array with colors and alpha</h2> <p> -The value for the color and alpha is an number between <code>0</code> and <code>255</code>. The alpha property is optional and will be set to <code>255</code> if not specified. +The value for the color and alpha is a number between <code>0</code> and <code>255</code>. The alpha property is optional and will be set to <code>255</code> if not specified. </p> <p> Creates a green solid rectangle with an opacity of 50%. @@ -2047,7 +2118,7 @@ end </code></pre> <h2 id='---rendering-a-solid-using-a-class'>Rendering a solid using a Class</h2> <p> -You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called <code>primitive_marker</code> must be defined on the class. +You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called <code>primitive_marker</code> must be defined on the class. </p> <p> Here is an example: @@ -2100,6 +2171,93 @@ You have to use <code>args.outputs.borders</code>: args.outputs.borders << [100, 100, 160, 90] end </code></pre> +<h1 id='--docs---gtk--outputs#sprites-'>DOCS: <code>GTK::Outputs#sprites</code></h1> +<p> +Add primitives to this collection to render a sprite to the screen. +</p> +<h2 id='---rendering-a-sprite-using-an-array'>Rendering a sprite using an Array</h2> +<p> +Creates a sprite of a white circle located at 100, 100. 160 pixels wide and 90 pixels tall. +</p> +<pre><code class="language-ruby">def tick args + # X Y WIDTH HEIGHT PATH + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png] +end +</code></pre> +<h2 id='---rendering-a-sprite-using-an-array-with-colors-and-alpha'>Rendering a sprite using an Array with colors and alpha</h2> +<p> +The value for the color and alpha is a number between <code>0</code> and <code>255</code>. The alpha property is optional and will be set to <code>255</code> if not specified. +</p> +<p> +Creates a green circle sprite with an opacity of 50%. +</p> +<pre><code class="language-ruby">def tick args + # X Y WIDTH HEIGHT PATH ANGLE ALPHA RED GREEN BLUE + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png", 0, 128, 0, 255, 0] +end +</code></pre> +<h2 id='---rendering-a-sprite-using-a-hash'>Rendering a sprite using a Hash</h2> +<p> +If you want a more readable invocation. You can use the following hash to create a sprite. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order. +</p> +<pre><code class="language-ruby">def tick args + args.outputs.sprites << { + x: 0, + y: 0, + w: 100, + h: 100, + path: "sprites/circle/white.png", + angle: 0, + a: 255, + r: 0, + g: 255, + b: 0 + } +end +</code></pre> +<h2 id='---rendering-a-solid-using-a-class'>Rendering a solid using a Class</h2> +<p> +You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called <code>primitive_marker</code> must be defined on the class. +</p> +<p> +Here is an example: +</p> +<pre><code class="language-ruby"># Create type with ALL sprite properties AND primitive_marker +class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b + + def primitive_marker + :sprite + end +end + +# Inherit from type +class Circle < Sprite +# constructor + def initialize x, y, size, path + self.x = x + self.y = y + self.w = size + self.h = size + self.path = path + end + def serlialize + {x:self.x, y:self.y, w:self.w, h:self.h, path:self.path} + end + + def inspect + serlialize.to_s + end + + def to_s + serlialize.to_s + end +end +def tick args + # render circle sprite + args.outputs.sprites << Circle.new(10, 10, 32,"sprites/circle/white.png") +end +</code></pre> <h1 id='--docs---gtk--outputs#screenshots-'>DOCS: <code>GTK::Outputs#screenshots</code></h1> <p> Add a hash to this collection to take a screenshot and save as png file. The keys of the hash can be provided in any order. @@ -2160,12 +2318,12 @@ The <code>GTK::MousePoint</code> has the following properties. <li><code>x</code>: Integer representing the mouse's x.</li> <li><code>y</code>: Integer representing the mouse's y.</li> <li><code>point</code>: Array with the <code>x</code> and <code>y</code> values.</li> -<li><code>w</code>: Width of the point that always returns <code>0</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> -<li><code>h</code>: Height of the point that always returns <code>0</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> -<li><code>left</code>: This value is the same as <code>x</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> -<li><code>right</code>: This value is the same as <code>x</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> -<li><code>top</code>: This value is the same as <code>y</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> -<li><code>bottom</code>: This value is the same as <code>y</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>w</code>: Width of the point that always returns <code>0</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>h</code>: Height of the point that always returns <code>0</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>left</code>: This value is the same as <code>x</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>right</code>: This value is the same as <code>x</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>top</code>: This value is the same as <code>y</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>bottom</code>: This value is the same as <code>y</code> (included so that it can seamlessly work with <code>GTK::Geometry</code> functions).</li> <li><code>created_at</code>: The tick (<code>args.state.tick_count</code>) that this structure was created.</li> <li><code>global_created_at</code>: The global tick (<code>Kernel.global_tick_count</code>) that this structure was created.</li> </ul> @@ -2322,7 +2480,7 @@ And here is an example where the override parameter is passed in: end end </code></pre> -<h1 id='--docs---numeric#elapsed?-'>DOCS: <code>Numeric#elapsed?</code></h1> +<h1 id='--docs---numeric#elapsed--'>DOCS: <code>Numeric#elapsed?</code></h1> <p> Returns true if <code>Numeric#elapsed_time</code> is greater than the number. An optional parameter can be passed into <code>elapsed?</code> which is added to the number before evaluating whether <code>elapsed?</code> is true. </p> @@ -2386,7 +2544,7 @@ Example usage (with optional parameter): args.state.box_queue -= boxes_to_destroy end </code></pre> -<h1 id='--docs---numeric#created?-'>DOCS: <code>Numeric#created?</code></h1> +<h1 id='--docs---numeric#created--'>DOCS: <code>Numeric#created?</code></h1> <p> Returns true if <code>Numeric#elapsed_time == 0</code>. Essentially communicating that number is equal to the current frame. </p> @@ -2455,7 +2613,7 @@ end Follows is a source code listing for all files that have been open sourced. This code can be found in the <code>./samples</code> directory. </p> <h2 id='---samples'>Samples</h2> -<h3 id='----learn-ruby-optional---beginner-ruby-primer---automation.rb'>Learn Ruby Optional - Beginner Ruby Primer - automation.rb</h3> +<h3 id='----learn-ruby-optional---beginner-ruby-primer---automation-rb'>Learn Ruby Optional - Beginner Ruby Primer - automation.rb</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb # ========================================================================== # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ @@ -2579,7 +2737,7 @@ $gtk.schedule_callback 400 do end </code></pre> -<h3 id='----learn-ruby-optional---beginner-ruby-primer---main.rb'>Learn Ruby Optional - Beginner Ruby Primer - main.rb</h3> +<h3 id='----learn-ruby-optional---beginner-ruby-primer---main-rb'>Learn Ruby Optional - Beginner Ruby Primer - main.rb</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb # ========================================================================== # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ @@ -2900,7 +3058,7 @@ def outputs end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---printing.txt'>Learn Ruby Optional - Intermediate Ruby Primer - printing.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---printing-txt'>Learn Ruby Optional - Intermediate Ruby Primer - printing.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt # ==================================================================================== # Commenting Code @@ -2935,7 +3093,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---strings.txt'>Learn Ruby Optional - Intermediate Ruby Primer - strings.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---strings-txt'>Learn Ruby Optional - Intermediate Ruby Primer - strings.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt # ==================================================================================== # Strings @@ -2954,7 +3112,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---numbers.txt'>Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---numbers-txt'>Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt # ==================================================================================== # Numerics @@ -2979,7 +3137,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---booleans.txt'>Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---booleans-txt'>Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt # ==================================================================================== # Booleans @@ -3015,7 +3173,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---conditionals.txt'>Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---conditionals-txt'>Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt # ==================================================================================== # Conditionals @@ -3133,7 +3291,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---looping.txt'>Learn Ruby Optional - Intermediate Ruby Primer - looping.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---looping-txt'>Learn Ruby Optional - Intermediate Ruby Primer - looping.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt # ==================================================================================== # Looping @@ -3192,7 +3350,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---functions.txt'>Learn Ruby Optional - Intermediate Ruby Primer - functions.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---functions-txt'>Learn Ruby Optional - Intermediate Ruby Primer - functions.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt # ==================================================================================== # Functions @@ -3265,7 +3423,7 @@ repl do end </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---arrays.txt'>Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---arrays-txt'>Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt # ==================================================================================== # Arrays @@ -3479,14 +3637,14 @@ end # ==================================================================================== </code></pre> -<h3 id='----learn-ruby-optional---intermediate-ruby-primer---main.rb'>Learn Ruby Optional - Intermediate Ruby Primer - main.rb</h3> +<h3 id='----learn-ruby-optional---intermediate-ruby-primer---main-rb'>Learn Ruby Optional - Intermediate Ruby Primer - main.rb</h3> <pre><code class="language-ruby"># ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb def tick args args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] end </code></pre> -<h3 id='----rendering-basics---labels---main.rb'>Rendering Basics - Labels - main.rb</h3> +<h3 id='----rendering-basics---labels---main-rb'>Rendering Basics - Labels - main.rb</h3> <pre><code class="language-ruby"># ./samples/01_rendering_basics/01_labels/app/main.rb =begin @@ -3557,7 +3715,7 @@ def tick args g: 0, b: 200, a: 255, - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! # Primitives can hold anything, and can be given a label in the following forms args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label @@ -3571,7 +3729,7 @@ def tick args g: 0, b: 200, a: 255, - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! end def tick_instructions args, text, y = 715 @@ -3589,7 +3747,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----rendering-basics---lines---main.rb'>Rendering Basics - Lines - main.rb</h3> +<h3 id='----rendering-basics---lines---main-rb'>Rendering Basics - Lines - main.rb</h3> <pre><code class="language-ruby"># ./samples/01_rendering_basics/02_lines/app/main.rb =begin @@ -3647,7 +3805,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----rendering-basics---solids-borders---main.rb'>Rendering Basics - Solids Borders - main.rb</h3> +<h3 id='----rendering-basics---solids-borders---main-rb'>Rendering Basics - Solids Borders - main.rb</h3> <pre><code class="language-ruby"># ./samples/01_rendering_basics/03_solids_borders/app/main.rb =begin @@ -3717,7 +3875,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----rendering-basics---sprites---main.rb'>Rendering Basics - Sprites - main.rb</h3> +<h3 id='----rendering-basics---sprites---main-rb'>Rendering Basics - Sprites - main.rb</h3> <pre><code class="language-ruby"># ./samples/01_rendering_basics/04_sprites/app/main.rb =begin @@ -3764,7 +3922,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----rendering-basics---sounds---main.rb'>Rendering Basics - Sounds - main.rb</h3> +<h3 id='----rendering-basics---sounds---main-rb'>Rendering Basics - Sounds - main.rb</h3> <pre><code class="language-ruby"># ./samples/01_rendering_basics/05_sounds/app/main.rb =begin @@ -3799,768 +3957,7 @@ def tick args end </code></pre> -<h3 id='----rendering-basics---audio-mixer---main.rb'>Rendering Basics - Audio Mixer - main.rb</h3> -<pre><code class="language-ruby"># ./samples/01_rendering_basics/06_audio_mixer/app/main.rb -$gtk.reset - -$boxsize = 30 - -def render_sources args - mouse_in_panel = (args.state.selected != 0) && args.inputs.mouse.position.inside_rect?([900, 450, 340, 250]) - mouse_new_down = (args.state.mouse_held == 1) - - if (mouse_new_down && !mouse_in_panel) - args.state.selected = 0 # will reset below if we hit something. - end - - args.audio.keys.each { |k| - s = args.audio[k] - - if (mouse_new_down) && !mouse_in_panel && args.inputs.mouse.position.inside_rect?([s[:screenx], s[:screeny], $boxsize, $boxsize]) - args.state.selected = k - args.state.dragging_source = true - end - - isselected = (k == args.state.selected) - - if isselected && args.state.dragging_source - # you can hang anything on the audio hashes you want, so we store the - # actual screen position so it doesn't scale weirdly vs your mouse. - s[:screenx] = args.inputs.mouse.x - ($boxsize / 2) - s[:screeny] = args.inputs.mouse.y - ($boxsize / 2) - - s[:screeny] = 50 if s[:screeny] < 50 - s[:screeny] = (719 - $boxsize) if s[:screeny] > (719 - $boxsize) - s[:screenx] = 0 if s[:screenx] < 0 - s[:screenx] = (1279 - $boxsize) if s[:screenx] > (1279 - $boxsize) - - s[:x] = ((s[:screenx] / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range - s[:y] = ((s[:screeny] / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range - end - - color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] - args.outputs.primitives << [s[:screenx], s[:screeny], $boxsize, $boxsize, *color].solid - } -end - -def render_panel args - s = args.audio[args.state.selected] - return if s.nil? - mouse_down = (args.state.mouse_held > 0) - - args.outputs.primitives << [900, 450, 340, 250, 127, 127, 200, 255].solid - args.outputs.primitives << [1075, 690, "Source ##{args.state.selected}", 3, 1, 255, 255, 255].label - args.outputs.primitives << [910, 660, 1230, 660, 255, 255, 255].line - args.outputs.primitives << [910, 650, "screen: (#{s[:screenx].to_i}, #{s[:screeny].to_i})", 0, 0, 255, 255, 255].label - args.outputs.primitives << [910, 625, "position: (#{s[:x].round(5).to_s[0..6]}, #{s[:y].round(5).to_s[0..6]})", 0, 0, 255, 255, 255].label - - slider = [1022, 586, 200, 7] - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) - s[:pitch] = ((args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)) * 2.0 - end - slidercolor = (s[:pitch] / 2.0) * 255 - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid - args.outputs.primitives << [910, 600, "pitch: #{s[:pitch].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label - - slider = [1022, 561, 200, 7] - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) - s[:gain] = (args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0) - end - slidercolor = s[:gain] * 255 - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid - args.outputs.primitives << [910, 575, "gain: #{s[:gain].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label - - checkbox = [1022, 533, 10, 12] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) - s[:looping] = !s[:looping] - end - checkboxcolor = s[:looping] ? 255 : 0 - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid - args.outputs.primitives << [910, 550, "looping:", 0, 0, 255, 255, 255].label - - checkbox = [1022, 508, 10, 12] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) - s[:paused] = !s[:paused] - end - checkboxcolor = s[:paused] ? 255 : 0 - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid - args.outputs.primitives << [910, 525, "paused:", 0, 0, 255, 255, 255].label - - button = [910, 460, 320, 20] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(button) - args.audio.delete(args.state.selected) - args.state.selected = 0 - end - args.outputs.primitives << [*button, 255, 0, 0, 255].solid - args.outputs.primitives << [button[0] + (button[2] / 2), button[1]+20, "DELETE SOURCE", 0, 1, 255, 255, 0].label -end - -def spawn_new_sound args, num - input = nil - input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}" - - # Spawn randomly in an area that won't be covered by UI. - screenx = (rand * 600.0) + 200.0 - screeny = (rand * 400.0) + 100.0 - - args.state.next_sound_index += 1 - - # you can hang anything on the audio hashes you want, so we store the - # actual screen position in here for convenience. - args.audio[args.state.next_sound_index] = { - input: input, - screenx: screenx, - screeny: screeny, - x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range - y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range - z: 0.0, - gain: 1.0, - pitch: 1.0, - looping: true, - paused: false - } - - args.state.selected = args.state.next_sound_index -end - -def render_launcher args - total = 6 - x = (1280 - (total * $boxsize * 3)) / 2 - y = 10 - args.outputs.primitives << [0, 0, 1280, ((y*2) + $boxsize), 127, 127, 127, 255].solid - for i in 1..total - args.outputs.primitives << [x, y, $boxsize, $boxsize, 255, 255, 255, 255].solid - args.outputs.primitives << [x+8, y+28, i.to_s, 3, 0, 0, 0, 255, 255].label - if args.inputs.mouse.click && args.inputs.mouse.click.point.inside_rect?([x, y, $boxsize, $boxsize]) - spawn_new_sound args, i - end - x = x + ($boxsize * 3) - end -end - -def render_ui args - render_launcher args - render_panel args -end - -def tick args - args.state.mouse_held ||= 0 - args.state.dragging_source ||= false - args.state.selected ||= 0 - args.state.next_sound_index ||= 0 - - if args.inputs.mouse.up - args.state.mouse_held = 0 - args.state.dragging_source = false - elsif args.inputs.mouse.down || (args.state.mouse_held > 0) - args.state.mouse_held += 1 - else - end - - args.outputs.background_color = [ 0, 0, 0, 255 ] - render_sources args - render_ui args -end - -</code></pre> -<h3 id='----rendering-basics---sound-synthesis---main.rb'>Rendering Basics - Sound Synthesis - main.rb</h3> -<pre><code class="language-ruby"># ./samples/01_rendering_basics/07_sound_synthesis/app/main.rb -begin # region: top level tick methods - def tick args - defaults args - render args - input args - process_audio_queue args - end - - def defaults args - args.state.sine_waves ||= {} - args.state.square_waves ||= {} - args.state.saw_tooth_waves ||= {} - args.state.triangle_waves ||= {} - args.state.audio_queue ||= [] - args.state.buttons ||= [ - (frequency_buttons args), - (sine_wave_note_buttons args), - (bell_buttons args), - (square_wave_note_buttons args), - (saw_tooth_wave_note_buttons args), - (triangle_wave_note_buttons args), - ].flatten - end - - def render args - args.outputs.borders << args.state.buttons.map { |b| b[:border] } - args.outputs.labels << args.state.buttons.map { |b| b[:label] } - args.outputs.labels << args.layout - .rect(row: 0, col: 11.5) - .yield_self { |r| r.merge y: r.y + r.h } - .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", - alignment_enum: 1) - end - - - def input args - args.state.buttons.each do |b| - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) - parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " - args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" - send b[:method_to_call], args, b - end - end - - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) - args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' - end - end - - def process_audio_queue args - to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } - args.state.audio_queue -= to_queue - to_queue.each { |a| args.audio[a[:id]] = a } - - args.audio.find_all { |k, v| v[:decay_rate] } - .each { |k, v| v[:gain] -= v[:decay_rate] } - - sounds_to_stop = args.audio - .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } - .map { |k, v| k } - - sounds_to_stop.each { |k| args.audio.delete k } - end -end - -begin # region: button definitions, ui layout, callback functions - def button args, opts - button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) - - button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 - - label_offset_x = 5 - label_offset_y = 30 - - button_def[:label] = button_def[:rect].merge text: opts[:text], - size_enum: -2.5, - x: button_def[:rect].x + label_offset_x, - y: button_def[:rect].y + label_offset_y - - button_def - end - - def play_sine_wave args, sender - queue_sine_wave args, - frequency: sender[:frequency], - duration: 1.seconds, - fade_out: true - end - - def play_note args, sender - method_to_call = :queue_sine_wave - method_to_call = :queue_square_wave if sender[:type] == :square - method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth - method_to_call = :queue_triangle_wave if sender[:type] == :triangle - method_to_call = :queue_bell if sender[:type] == :bell - - send method_to_call, args, - frequency: (frequency_for note: sender[:note], octave: sender[:octave]), - duration: 1.seconds, - fade_out: true - end - - def frequency_buttons args - [ - (button args, - row: 4.0, col: 0, text: "300hz", - frequency: 300, - method_to_call: :play_sine_wave), - (button args, - row: 5.0, col: 0, text: "400hz", - frequency: 400, - method_to_call: :play_sine_wave), - (button args, - row: 6.0, col: 0, text: "500hz", - frequency: 500, - method_to_call: :play_sine_wave), - ] - end - - def sine_wave_note_buttons args - [ - (button args, - row: 1.5, col: 2, text: "Sine C4", - note: :c, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 2.5, col: 2, text: "Sine D4", - note: :d, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 3.5, col: 2, text: "Sine E4", - note: :e, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 4.5, col: 2, text: "Sine F4", - note: :f, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 5.5, col: 2, text: "Sine G4", - note: :g, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 6.5, col: 2, text: "Sine A5", - note: :a, octave: 5, type: :sine, method_to_call: :play_note), - (button args, - row: 7.5, col: 2, text: "Sine B5", - note: :b, octave: 5, type: :sine, method_to_call: :play_note), - (button args, - row: 8.5, col: 2, text: "Sine C5", - note: :c, octave: 5, type: :sine, method_to_call: :play_note), - ] - end - - def square_wave_note_buttons args - [ - (button args, - row: 1.5, col: 6, text: "Square C4", - note: :c, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 2.5, col: 6, text: "Square D4", - note: :d, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 3.5, col: 6, text: "Square E4", - note: :e, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 4.5, col: 6, text: "Square F4", - note: :f, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 5.5, col: 6, text: "Square G4", - note: :g, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 6.5, col: 6, text: "Square A5", - note: :a, octave: 5, type: :square, method_to_call: :play_note), - (button args, - row: 7.5, col: 6, text: "Square B5", - note: :b, octave: 5, type: :square, method_to_call: :play_note), - (button args, - row: 8.5, col: 6, text: "Square C5", - note: :c, octave: 5, type: :square, method_to_call: :play_note), - ] - end - def saw_tooth_wave_note_buttons args - [ - (button args, - row: 1.5, col: 8, text: "Saw C4", - note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 2.5, col: 8, text: "Saw D4", - note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 3.5, col: 8, text: "Saw E4", - note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 4.5, col: 8, text: "Saw F4", - note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 5.5, col: 8, text: "Saw G4", - note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 6.5, col: 8, text: "Saw A5", - note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 7.5, col: 8, text: "Saw B5", - note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 8.5, col: 8, text: "Saw C5", - note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), - ] - end - - def triangle_wave_note_buttons args - [ - (button args, - row: 1.5, col: 10, text: "Triangle C4", - note: :c, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 2.5, col: 10, text: "Triangle D4", - note: :d, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 3.5, col: 10, text: "Triangle E4", - note: :e, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 4.5, col: 10, text: "Triangle F4", - note: :f, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 5.5, col: 10, text: "Triangle G4", - note: :g, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 6.5, col: 10, text: "Triangle A5", - note: :a, octave: 5, type: :triangle, method_to_call: :play_note), - (button args, - row: 7.5, col: 10, text: "Triangle B5", - note: :b, octave: 5, type: :triangle, method_to_call: :play_note), - (button args, - row: 8.5, col: 10, text: "Triangle C5", - note: :c, octave: 5, type: :triangle, method_to_call: :play_note), - ] - end - - def bell_buttons args - [ - (button args, - row: 1.5, col: 4, text: "Bell C4", - note: :c, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 2.5, col: 4, text: "Bell D4", - note: :d, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 3.5, col: 4, text: "Bell E4", - note: :e, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 4.5, col: 4, text: "Bell F4", - note: :f, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 5.5, col: 4, text: "Bell G4", - note: :g, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 6.5, col: 4, text: "Bell A5", - note: :a, octave: 5, type: :bell, method_to_call: :play_note), - (button args, - row: 7.5, col: 4, text: "Bell B5", - note: :b, octave: 5, type: :bell, method_to_call: :play_note), - (button args, - row: 8.5, col: 4, text: "Bell C5", - note: :c, octave: 5, type: :bell, method_to_call: :play_note), - ] - end -end - -begin # region: wave generation - begin # sine wave - def defaults_sine_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def sine_wave_for opts = {} - opts = defaults_sine_wave_for.merge opts - frequency = opts[:frequency] - sample_rate = opts[:sample_rate] - period_size = (sample_rate.fdiv frequency).ceil - period_size.map_with_index do |i| - Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) - end.to_a - end - - def defaults_queue_sine_wave - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def queue_sine_wave args, opts = {} - opts = defaults_queue_sine_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate - args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.sine_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: sine_wave - end - end - - begin # region: square wave - def defaults_square_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def square_wave_for opts = {} - opts = defaults_square_wave_for.merge opts - sine_wave = sine_wave_for opts - sine_wave.map do |v| - if v >= 0 - 1.0 - else - -1.0 - end - end.to_a - end - - def defaults_queue_square_wave - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } - end - - def queue_square_wave args, opts = {} - opts = defaults_queue_square_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate - args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.square_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: square_wave - end - end - - begin # region: saw tooth wave - def defaults_saw_tooth_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def saw_tooth_wave_for opts = {} - opts = defaults_saw_tooth_wave_for.merge opts - sine_wave = sine_wave_for opts - period_size = sine_wave.length - sine_wave.map_with_index do |v, i| - (((i % period_size).fdiv period_size) * 2) - 1 - end - end - - def defaults_queue_saw_tooth_wave - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } - end - - def queue_saw_tooth_wave args, opts = {} - opts = defaults_queue_saw_tooth_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate - args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: saw_tooth_wave - end - end - - begin # region: triangle wave - def defaults_triangle_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def triangle_wave_for opts = {} - opts = defaults_saw_tooth_wave_for.merge opts - sine_wave = sine_wave_for opts - period_size = sine_wave.length - sine_wave.map_with_index do |v, i| - ratio = (i.fdiv period_size) - if ratio <= 0.5 - (ratio * 4) - 1 - else - ratio -= 0.5 - 1 - (ratio * 4) - end - end - end - - def defaults_queue_triangle_wave - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def queue_triangle_wave args, opts = {} - opts = defaults_queue_triangle_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate - args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.triangle_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: triangle_wave - end - end - - begin # region: bell - def defaults_queue_bell - { frequency: 440, duration: 1.seconds, queue_in: 0 } - end - - def queue_bell args, opts = {} - (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } - end - - def bell_harmonics - [ - { frequency_ratio: 0.5, duration_ratio: 1.00 }, - { frequency_ratio: 1.0, duration_ratio: 0.80 }, - { frequency_ratio: 2.0, duration_ratio: 0.60 }, - { frequency_ratio: 3.0, duration_ratio: 0.40 }, - { frequency_ratio: 4.2, duration_ratio: 0.25 }, - { frequency_ratio: 5.4, duration_ratio: 0.20 }, - { frequency_ratio: 6.8, duration_ratio: 0.15 } - ] - end - - def defaults_bell_to_sine_waves - { frequency: 440, duration: 1.seconds, queue_in: 0 } - end - - def bell_to_sine_waves opts = {} - opts = defaults_bell_to_sine_waves.merge opts - bell_harmonics.map do |b| - { - frequency: opts[:frequency] * b[:frequency_ratio], - duration: opts[:duration] * b[:duration_ratio], - queue_in: opts[:queue_in], - gain: (1.fdiv bell_harmonics.length), - fade_out: true - } - end - end - end - - begin # audio entity construction - def generate_audio_data sine_wave, sample_rate - sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil - copy_count = (sample_size.fdiv sine_wave.length).ceil - sine_wave * copy_count - end - - def defaults_new_audio_state - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def new_audio_state args, opts = {} - opts = defaults_new_audio_state.merge opts - decay_rate = 0 - decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] - frequency = opts[:frequency] - sample_rate = 48000 - - { - id: (new_id! args), - frequency: frequency, - sample_rate: 48000, - stop_at: args.tick_count + opts[:queue_in] + opts[:duration], - gain: opts[:gain].to_f, - queue_at: args.state.tick_count + opts[:queue_in], - decay_rate: decay_rate, - pitch: 1.0, - looping: true, - paused: false - } - end - - def queue_audio args, opts = {} - graph_wave args, opts[:wave], opts[:audio_state][:frequency] - args.state.audio_queue << opts[:audio_state] - end - - def new_id! args - args.state.audio_id ||= 0 - args.state.audio_id += 1 - end - - def graph_wave args, wave, frequency - if args.state.tick_count != args.state.graphed_at - args.outputs.static_lines.clear - args.outputs.static_sprites.clear - end - - wave = wave - - r, g, b = frequency.to_i % 85, - frequency.to_i % 170, - frequency.to_i % 255 - - starting_rect = args.layout.rect(row: 5, col: 13) - x_scale = 10 - y_scale = 100 - max_points = 25 - - points = wave - if wave.length > max_points - resolution = wave.length.idiv max_points - points = wave.find_all.with_index { |y, i| (i % resolution == 0) } - end - - args.outputs.static_lines << points.map_with_index do |y, x| - next_y = points[x + 1] - - if next_y - { - x: starting_rect.x + (x * x_scale), - y: starting_rect.y + starting_rect.h.half + y_scale * y, - x2: starting_rect.x + ((x + 1) * x_scale), - y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, - r: r, - g: g, - b: b - } - end - end - - args.outputs.static_sprites << points.map_with_index do |y, x| - { - x: (starting_rect.x + (x * x_scale)) - 2, - y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, - w: 4, - h: 4, - path: 'sprites/square-white.png', - r: r, - g: g, - b: b - } - end - - args.state.graphed_at = args.state.tick_count - end - end - - begin # region: musical note mapping - def defaults_frequency_for - { note: :a, octave: 5, sharp: false, flat: false } - end - - def frequency_for opts = {} - opts = defaults_frequency_for.merge opts - octave_offset_multiplier = opts[:octave] - 5 - note = note_frequencies_octave_5[opts[:note]] - if octave_offset_multiplier < 0 - note = note * 1 / (octave_offset_multiplier.abs + 1) - elsif octave_offset_multiplier > 0 - note = note * (octave_offset_multiplier.abs + 1) / 1 - end - note - end - - def note_frequencies_octave_5 - { - a: 440.0, - a_sharp: 466.16, b_flat: 466.16, - b: 493.88, - c: 523.25, - c_sharp: 554.37, d_flat: 587.33, - d: 587.33, - d_sharp: 622.25, e_flat: 659.25, - e: 659.25, - f: 698.25, - f_sharp: 739.99, g_flat: 739.99, - g: 783.99, - g_sharp: 830.61, a_flat: 830.61 - } - end - end -end - -$gtk.reset - -</code></pre> -<h3 id='----input-basics---keyboard---main.rb'>Input Basics - Keyboard - main.rb</h3> +<h3 id='----input-basics---keyboard---main-rb'>Input Basics - Keyboard - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/01_keyboard/app/main.rb =begin @@ -4589,9 +3986,9 @@ APIs listing that haven't been encountered in a previous sample apps: def tick args tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 # Notice how small_font accounts for all the remaining parameters - args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] - args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] - args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 0), text: "Current game time: #{args.state.tick_count}", size_enum: -1 } + args.outputs.labels << { x: 460, y: row_to_px(args, 2), text: "Keyboard input: args.inputs.keyboard.key_up.h", size_enum: -1 } + args.outputs.labels << { x: 460, y: row_to_px(args, 3), text: "Press \"h\" on the keyboard.", size_enum: -1 } # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key if args.inputs.keyboard.key_up.h @@ -4602,27 +3999,19 @@ def tick args args.state.h_pressed_at ||= false if args.state.h_pressed_at - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" was pressed at time: #{args.state.h_pressed_at}", size_enum: -1 } else - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" has never been pressed.", size_enum: -1 } end tick_help_text args end -def small_font - # This method provides some values for the construction of labels - # Specifically, Size, Alignment, & RGBA - # This makes it so that custom parameters don't have to be repeatedly typed. - # Additionally "small_font" provides programmers with more information than some numbers - [-2, 0, 0, 0, 0, 255] -end - -def row_to_px args, row_number +def row_to_px args, row_number, y_offset = 20 # This takes a row_number and converts it to pixels DragonRuby understands. # Row 0 starts 5 units below the top of the grid # Each row afterward is 20 units lower - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (y_offset * row_number) end # Don't worry about understanding the code within this method just yet. @@ -4652,17 +4041,17 @@ def tick_help_text args end end - args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] + args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: "This is the api for the keys you've pressed:", size_enum: -1, r: 180 } if !args.state.help_available args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] return end - args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] - args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] - args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] - args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] + args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: "args.inputs.keyboard", size_enum: -2 } + args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_down", size_enum: -2 } + args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_held", size_enum: -2 } + args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_up", size_enum: -2 } fill_history args, :key_value_history, :down_or_held, nil fill_history args, :key_down_value_history, :down, :key_down @@ -4708,12 +4097,8 @@ def render_help_labels args, history_key, state_key, keyboard_method, x end idx += 2 [ - [x, row_to_px(args, idx - 2), - " .#{k} is #{current_value || "nil"}", - small_font], - [x, row_to_px(args, idx - 1), - " was #{v}", - small_font] + { x: x, y: row_to_px(args, idx + 0, 16), text: " .#{k} is #{current_value || "nil"}", size_enum: -2 }, + { x: x, y: row_to_px(args, idx + 1, 16), text: " was #{v}", size_enum: -2 } ] end end @@ -4728,13 +4113,49 @@ def tick_instructions args, text, y = 715 args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, + size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", + size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end </code></pre> -<h3 id='----input-basics---mouse---main.rb'>Input Basics - Mouse - main.rb</h3> +<h3 id='----input-basics---moving-a-sprite---main-rb'>Input Basics - Moving A Sprite - main.rb</h3> +<pre><code class="language-ruby"># ./samples/02_input_basics/01_moving_a_sprite/app/main.rb +def tick args + # create a player and set default values + # for the player's x, y, w (width), and h (height) + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.state.player.w ||= 50 + args.state.player.h ||= 50 + + # render the player to the screen + args.outputs.sprites << { x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/square/green.png' } + + # move the player around using the keyboard + if args.inputs.up + args.state.player.y += 10 + elsif args.inputs.down + args.state.player.y -= 10 + end + + if args.inputs.left + args.state.player.x -= 10 + elsif args.inputs.right + args.state.player.x += 10 + end +end + +$gtk.reset + +</code></pre> +<h3 id='----input-basics---mouse---main-rb'>Input Basics - Mouse - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/02_mouse/app/main.rb =begin @@ -4770,7 +4191,7 @@ Reminder: # Use args.inputs.mouse.click.created_at # To see how many frames its been since the click occurred -# Use args.inputs.mouse.click.creat_at_elapsed +# Use args.inputs.mouse.click.created_at_elapsed # Saving the click in args.state can be quite useful @@ -4799,11 +4220,7 @@ def small_label args, x, row, message # This method effectively combines the row_to_px and small_font methods # It changes the given row value to a DragonRuby pixel value # and adds the customization parameters - [x, row_to_px(args, row), message, small_font] -end - -def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, alignment_enum: -2 } end def row_to_px args, row_number @@ -4819,13 +4236,13 @@ def tick_instructions args, text, y = 715 args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end </code></pre> -<h3 id='----input-basics---mouse-point-to-rect---main.rb'>Input Basics - Mouse Point To Rect - main.rb</h3> +<h3 id='----input-basics---mouse-point-to-rect---main-rb'>Input Basics - Mouse Point To Rect - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb =begin @@ -4871,7 +4288,7 @@ def tick args args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") - box = [785, 370, 50, 50, 0, 0, 170] + box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 } args.outputs.borders << box # Saves the most recent click into args.state @@ -4893,11 +4310,7 @@ def tick args end def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] -end - -def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } end def row_to_px args, row_number @@ -4913,13 +4326,13 @@ def tick_instructions args, text, y = 715 args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end </code></pre> -<h3 id='----input-basics---mouse-rect-to-rect---main.rb'>Input Basics - Mouse Rect To Rect - main.rb</h3> +<h3 id='----input-basics---mouse-rect-to-rect---main-rb'>Input Basics - Mouse Rect To Rect - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb =begin @@ -4965,9 +4378,15 @@ def tick args # They are stored in game so that they do not get reset every tick if args.inputs.mouse.click if !args.state.box_collision_one - args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] + args.state.box_collision_one = { x: args.inputs.mouse.click.point.x - 25, + y: args.inputs.mouse.click.point.y - 25, + w: 125, h: 125, + r: 180, g: 0, b: 0, a: 180 } elsif !args.state.box_collision_two - args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] + args.state.box_collision_two = { x: args.inputs.mouse.click.point.x - 25, + y: args.inputs.mouse.click.point.y - 25, + w: 125, h: 125, + r: 0, g: 0, b: 180, a: 180 } else args.state.box_collision_one = nil args.state.box_collision_two = nil @@ -4994,15 +4413,11 @@ def tick args end def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] -end - -def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } end def row_to_px args, row_number - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (20 * row_number) end def tick_instructions args, text, y = 715 @@ -5020,7 +4435,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----input-basics---controller---main.rb'>Input Basics - Controller - main.rb</h3> +<h3 id='----input-basics---controller---main-rb'>Input Basics - Controller - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/05_controller/app/main.rb =begin @@ -5066,57 +4481,51 @@ class ControllerDemo def process_inputs state.buttons = [] - state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] - state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] - - state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] - state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] - - state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] - state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] - - state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] - state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] - state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] - state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] - - state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] - state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] - state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] - state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] - - state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, - 100 + inputs.controller_one.left_analog_y_perc * 100, - inputs.controller_one.key_held.l3, - "L3"] - - state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, - 100 + inputs.controller_one.right_analog_y_perc * 100, - inputs.controller_one.key_held.r3, - "R3"] + state.buttons << { x: 100, y: 500, active: inputs.controller_one.key_held.l1, text: "L1"} + state.buttons << { x: 100, y: 600, active: inputs.controller_one.key_held.l2, text: "L2"} + state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"} + state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"} + state.buttons << { x: 540, y: 450, active: inputs.controller_one.key_held.select, text: "Select"} + state.buttons << { x: 660, y: 450, active: inputs.controller_one.key_held.start, text: "Start"} + state.buttons << { x: 200, y: 300, active: inputs.controller_one.key_held.left, text: "Left"} + state.buttons << { x: 300, y: 400, active: inputs.controller_one.key_held.up, text: "Up"} + state.buttons << { x: 400, y: 300, active: inputs.controller_one.key_held.right, text: "Right"} + state.buttons << { x: 300, y: 200, active: inputs.controller_one.key_held.down, text: "Down"} + state.buttons << { x: 800, y: 300, active: inputs.controller_one.key_held.x, text: "X"} + state.buttons << { x: 900, y: 400, active: inputs.controller_one.key_held.y, text: "Y"} + state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"} + state.buttons << { x: 900, y: 200, active: inputs.controller_one.key_held.b, text: "B"} + state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100, + y: 100 + inputs.controller_one.left_analog_y_perc * 100, + active: inputs.controller_one.key_held.l3, + text: "L3" } + state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100, + y: 100 + inputs.controller_one.right_analog_y_perc * 100, + active: inputs.controller_one.key_held.r3, + text: "R3" } end # Gives each button a square shape. # If the button is being pressed or held (which means it is considered active), # the square is filled in. Otherwise, the button simply has a border. def render - state.buttons.each do |x, y, active, text| - rect = [x, y, 75, 75] + state.buttons.each do |b| + rect = { x: b.x, y: b.y, w: 75, h: 75 } - if active # if button is pressed + if b.active # if button is pressed outputs.solids << rect # rect is output as solid (filled in) else outputs.borders << rect # otherwise, output as border end # Outputs the text of each button using labels. - outputs.labels << [x, y + 95, text] # add 95 to place label above button + outputs.labels << { x: b.x, y: b.y + 95, text: b.text } # add 95 to place label above button end - outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] - outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] - outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] - outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] + outputs.labels << { x: 10, y: 60, text: "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)" } + outputs.labels << { x: 10, y: 30, text: "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)" } + outputs.labels << { x: 900, y: 60, text: "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)" } + outputs.labels << { x: 900, y: 30, text: "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)" } end end @@ -5150,7 +4559,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----input-basics---touch---main.rb'>Input Basics - Touch - main.rb</h3> +<h3 id='----input-basics---touch---main-rb'>Input Basics - Touch - main.rb</h3> <pre><code class="language-ruby"># ./samples/02_input_basics/06_touch/app/main.rb def tick args args.outputs.background_color = [ 0, 0, 0 ] @@ -5165,10 +4574,12 @@ def tick args # the next new touch will be finger_one again, but until then, new touches # don't fill in earlier slots. if !args.inputs.finger_one.nil? - args.outputs.primitives << [640, 650, "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", 5, 1, 255, 255, 255].label + args.outputs.primitives << { x: 640, y: 650, text: "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end if !args.inputs.finger_two.nil? - args.outputs.primitives << [640, 600, "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", 5, 1, 255, 255, 255].label + args.outputs.primitives << { x: 640, y: 600, text: "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end # Here's the more flexible interface: this will report as many simultaneous @@ -5189,14 +4600,13 @@ def tick args r = (color & 0xFF0000) >> 16 g = (color & 0x00FF00) >> 8 b = (color & 0x0000FF) - args.outputs.primitives << [v.x - (size / 2), v.y + (size / 2), size, size, r, g, b, 255].solid - args.outputs.primitives << [v.x, v.y + size, k.to_s, 0, 1, 0, 0, 0].label + args.outputs.primitives << { x: v.x - (size / 2), y: v.y + (size / 2), w: size, h: size, r: r, g: g, b: b, a: 255 }.solid! + args.outputs.primitives << { x: v.x, y: v.y + size, text: k.to_s, alignment_enum: 1 }.label! } end - </code></pre> -<h3 id='----rendering-sprites---animation-using-separate-pngs---main.rb'>Rendering Sprites - Animation Using Separate Pngs - main.rb</h3> +<h3 id='----rendering-sprites---animation-using-separate-pngs---main-rb'>Rendering Sprites - Animation Using Separate Pngs - main.rb</h3> <pre><code class="language-ruby"># ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb =begin @@ -5231,6 +4641,8 @@ end # in this tick "entry point": `looping_animation`, and the # second method is `one_time_animation`. def tick args + # uncomment the line below to see animation play out in slow motion + # args.gtk.slowmo! 6 looping_animation args one_time_animation args end @@ -5263,22 +4675,22 @@ def looping_animation args does_sprite_loop # Now that we have `sprite_index, we can present the correct file. - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 100, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } # Try changing the numbers below to see how the animation changes: - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] + args.outputs.sprites << { x: 100, y: 200, w: 100, h: 100, path: "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png" } end # This function shows how to animate a sprite that executes # only once when the "f" key is pressed. def one_time_animation args # This is just a label the shows instructions within the game. - args.outputs.labels << [220, 350, "(press f to animate)"] + args.outputs.labels << { x: 220, y: 350, text: "(press f to animate)" } # If "f" is pressed on the keyboard... if args.inputs.keyboard.key_down.f # Print the frame that "f" was pressed on. - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.state.tick_count}" # And MOST IMPORTANTLY set the point it time to start the animation, # equal to "now" which is represented as args.state.tick_count. @@ -5311,7 +4723,7 @@ def one_time_animation args sprite_index ||= 0 # Present the sprite. - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 300, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." end @@ -5331,7 +4743,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----rendering-sprites---animation-using-sprite-sheet---main.rb'>Rendering Sprites - Animation Using Sprite Sheet - main.rb</h3> +<h3 id='----rendering-sprites---animation-using-sprite-sheet---main-rb'>Rendering Sprites - Animation Using Sprite Sheet - main.rb</h3> <pre><code class="language-ruby"># ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb def tick args args.state.player.x ||= 100 @@ -5433,7 +4845,7 @@ def running_sprite args end </code></pre> -<h3 id='----rendering-sprites---animation-states---main.rb'>Rendering Sprites - Animation States - main.rb</h3> +<h3 id='----rendering-sprites---animation-states---main-rb'>Rendering Sprites - Animation States - main.rb</h3> <pre><code class="language-ruby"># ./samples/03_rendering_sprites/03_animation_states/app/main.rb class Game attr_gtk @@ -5620,7 +5032,7 @@ end $gtk.reset </code></pre> -<h3 id='----rendering-sprites---color-and-rotation---main.rb'>Rendering Sprites - Color And Rotation - main.rb</h3> +<h3 id='----rendering-sprites---color-and-rotation---main-rb'>Rendering Sprites - Color And Rotation - main.rb</h3> <pre><code class="language-ruby"># ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: @@ -5850,7 +5262,7 @@ def source_rect state end </code></pre> -<h3 id='----physics-and-collisions---simple---main.rb'>Physics And Collisions - Simple - main.rb</h3> +<h3 id='----physics-and-collisions---simple---main-rb'>Physics And Collisions - Simple - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/01_simple/app/main.rb =begin @@ -5962,7 +5374,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----physics-and-collisions---moving-objects---main.rb'>Physics And Collisions - Moving Objects - main.rb</h3> +<h3 id='----physics-and-collisions---moving-objects---main-rb'>Physics And Collisions - Moving Objects - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb =begin @@ -6266,7 +5678,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----physics-and-collisions---entities---main.rb'>Physics And Collisions - Entities - main.rb</h3> +<h3 id='----physics-and-collisions---entities---main-rb'>Physics And Collisions - Entities - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/03_entities/app/main.rb =begin @@ -6421,7 +5833,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----physics-and-collisions---box-collision---main.rb'>Physics And Collisions - Box Collision - main.rb</h3> +<h3 id='----physics-and-collisions---box-collision---main-rb'>Physics And Collisions - Box Collision - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/04_box_collision/app/main.rb =begin @@ -6762,7 +6174,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----physics-and-collisions---box-collision-2---main.rb'>Physics And Collisions - Box Collision 2 - main.rb</h3> +<h3 id='----physics-and-collisions---box-collision-2---main-rb'>Physics And Collisions - Box Collision 2 - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: @@ -7236,7 +6648,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---box-collision-3---main.rb'>Physics And Collisions - Box Collision 3 - main.rb</h3> +<h3 id='----physics-and-collisions---box-collision-3---main-rb'>Physics And Collisions - Box Collision 3 - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/06_box_collision_3/app/main.rb class Game attr_gtk @@ -7286,9 +6698,9 @@ class Game mouse_overlay = mouse_overlay.merge r: 255 if state.delete_mode if state.mouse_held - outputs.primitives << mouse_overlay.border + outputs.primitives << mouse_overlay.border! else - outputs.primitives << mouse_overlay.solid + outputs.primitives << mouse_overlay.solid! end end @@ -7352,7 +6764,7 @@ class Game def calc_below return unless player.dy <= 0 - tiles_below = find_tiles { |t| t.rect.top <= player.y } + tiles_below = find_tiles { |t| t.rect.top <= player.prev_rect.y } collision = find_colliding_tile tiles_below, (player.rect.merge y: player.next_rect.y) return unless collision if collision.neighbors.b == :none && player.jumped_down_at.elapsed_time < 10 @@ -7383,7 +6795,7 @@ class Game def calc_above return unless player.dy > 0 - tiles_above = find_tiles { |t| t.rect.y >= player.y } + tiles_above = find_tiles { |t| t.rect.y >= player.prev_rect.y } collision = find_colliding_tile tiles_above, (player.rect.merge y: player.next_rect.y) return unless collision return if collision.neighbors.t == :none @@ -7392,17 +6804,17 @@ class Game end def calc_player_dx - player.y += player.dy - player.dy += state.gravity - player.dy += player.dy * state.drag ** 2 * -1 - end - - def calc_player_dy player.dx = player.dx.clamp(-5, 5) player.dx *= 0.9 player.x += player.dx end + def calc_player_dy + player.y += player.dy + player.dy += state.gravity + player.dy += player.dy * state.drag ** 2 * -1 + end + def reset_player player.x = 100 player.y = 720 @@ -7495,7 +6907,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---jump-physics---main.rb'>Physics And Collisions - Jump Physics - main.rb</h3> +<h3 id='----physics-and-collisions---jump-physics---main-rb'>Physics And Collisions - Jump Physics - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/07_jump_physics/app/main.rb =begin @@ -7544,8 +6956,7 @@ class VerticalPlatformer input end - # Sets default values - def defaults + def init_game s.platforms ||= [ # initializes platforms collection with two platforms using hashes new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher @@ -7568,6 +6979,11 @@ class VerticalPlatformer s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) end + # Sets default values + def defaults + init_game + end + # Outputs objects onto the screen def render outputs.solids << s.platforms.map do |p| # outputs platforms onto screen @@ -7655,7 +7071,9 @@ class VerticalPlatformer rect: nil) end else + # game over s.as_hash.clear # otherwise clear the hash (no new platform is necessary) + init_game end end @@ -7695,7 +7113,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---ball.rb'>Physics And Collisions - Bouncing On Collision - ball.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---ball-rb'>Physics And Collisions - Bouncing On Collision - ball.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/ball.rb GRAVITY = -0.08 @@ -7786,7 +7204,7 @@ class Ball end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---block.rb'>Physics And Collisions - Bouncing On Collision - block.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---block-rb'>Physics And Collisions - Bouncing On Collision - block.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/block.rb DEGREES_TO_RADIANS = Math::PI / 180 @@ -7949,7 +7367,7 @@ class Block end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---cannon.rb'>Physics And Collisions - Bouncing On Collision - cannon.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---cannon-rb'>Physics And Collisions - Bouncing On Collision - cannon.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/cannon.rb class Cannon def initialize args @@ -7973,7 +7391,7 @@ class Cannon end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---main.rb'>Physics And Collisions - Bouncing On Collision - main.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---main-rb'>Physics And Collisions - Bouncing On Collision - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/main.rb INFINITY= 10**10 @@ -8094,7 +7512,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---peg.rb'>Physics And Collisions - Bouncing On Collision - peg.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---peg-rb'>Physics And Collisions - Bouncing On Collision - peg.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/peg.rb class Peg def initialize(x, y, block_size) @@ -8280,7 +7698,7 @@ class Peg end </code></pre> -<h3 id='----physics-and-collisions---bouncing-on-collision---vector2d.rb'>Physics And Collisions - Bouncing On Collision - vector2d.rb</h3> +<h3 id='----physics-and-collisions---bouncing-on-collision---vector2d-rb'>Physics And Collisions - Bouncing On Collision - vector2d.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/vector2d.rb class Vector2d attr_accessor :x, :y @@ -8332,7 +7750,7 @@ class Vector2d end end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---ball.rb'>Physics And Collisions - Arbitrary Collision - ball.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---ball-rb'>Physics And Collisions - Arbitrary Collision - ball.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/ball.rb class Ball @@ -8502,7 +7920,7 @@ class Ball end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---blocks.rb'>Physics And Collisions - Arbitrary Collision - blocks.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---blocks-rb'>Physics And Collisions - Arbitrary Collision - blocks.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/blocks.rb MAX_COUNT=100 @@ -9124,7 +8542,7 @@ class Line end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---linear_collider.rb'>Physics And Collisions - Arbitrary Collision - linear_collider.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---linear_collider-rb'>Physics And Collisions - Arbitrary Collision - linear_collider.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/linear_collider.rb COLLISIONWIDTH=8 @@ -9308,7 +8726,7 @@ class LinearCollider end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---main.rb'>Physics And Collisions - Arbitrary Collision - main.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---main-rb'>Physics And Collisions - Arbitrary Collision - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/main.rb INFINITY= 10**10 MAX_VELOCITY = 8.0 @@ -9483,7 +8901,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---paddle.rb'>Physics And Collisions - Arbitrary Collision - paddle.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---paddle-rb'>Physics And Collisions - Arbitrary Collision - paddle.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/paddle.rb class Paddle attr_accessor :enabled @@ -9540,7 +8958,7 @@ class Paddle end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---rectangle.rb'>Physics And Collisions - Arbitrary Collision - rectangle.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---rectangle-rb'>Physics And Collisions - Arbitrary Collision - rectangle.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/rectangle.rb class Rectangle def initialize args @@ -9634,7 +9052,7 @@ class Rectangle end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---square_collider.rb'>Physics And Collisions - Arbitrary Collision - square_collider.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---square_collider-rb'>Physics And Collisions - Arbitrary Collision - square_collider.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/square_collider.rb class SquareCollider @@ -9667,7 +9085,7 @@ class SquareCollider end </code></pre> -<h3 id='----physics-and-collisions---arbitrary-collision---vector2d.rb'>Physics And Collisions - Arbitrary Collision - vector2d.rb</h3> +<h3 id='----physics-and-collisions---arbitrary-collision---vector2d-rb'>Physics And Collisions - Arbitrary Collision - vector2d.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/09_arbitrary_collision/app/vector2d.rb class Vector2d attr_accessor :x, :y @@ -9719,7 +9137,7 @@ class Vector2d end end </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---ball.rb'>Physics And Collisions - Collision With Object Removal - ball.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---ball-rb'>Physics And Collisions - Collision With Object Removal - ball.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/ball.rb class Ball #TODO limit accessors? @@ -9754,7 +9172,7 @@ class Ball end </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---linear_collider.rb'>Physics And Collisions - Collision With Object Removal - linear_collider.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---linear_collider-rb'>Physics And Collisions - Collision With Object Removal - linear_collider.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/linear_collider.rb #The LinearCollider (theoretically) produces collisions upon a line segment defined point.y two x,y cordinates @@ -9924,7 +9342,7 @@ class LinearCollider end </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---main.rb'>Physics And Collisions - Collision With Object Removal - main.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---main-rb'>Physics And Collisions - Collision With Object Removal - main.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/main.rb # coding: utf-8 INFINITY= 10**10 @@ -10117,7 +9535,7 @@ def tick args end </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---paddle.rb'>Physics And Collisions - Collision With Object Removal - paddle.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---paddle-rb'>Physics And Collisions - Collision With Object Removal - paddle.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/paddle.rb class Paddle attr_accessor :enabled @@ -10174,7 +9592,7 @@ class Paddle end </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---tests.rb'>Physics And Collisions - Collision With Object Removal - tests.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---tests-rb'>Physics And Collisions - Collision With Object Removal - tests.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/tests.rb # For advanced users: # You can put some quick verification tests here, any method @@ -10207,7 +9625,7 @@ $gtk.log_level = :off $gtk.tests.start </code></pre> -<h3 id='----physics-and-collisions---collision-with-object-removal---vector2d.rb'>Physics And Collisions - Collision With Object Removal - vector2d.rb</h3> +<h3 id='----physics-and-collisions---collision-with-object-removal---vector2d-rb'>Physics And Collisions - Collision With Object Removal - vector2d.rb</h3> <pre><code class="language-ruby"># ./samples/04_physics_and_collisions/10_collision_with_object_removal/app/vector2d.rb class Vector2d @@ -10261,7 +9679,7 @@ class Vector2d end </code></pre> -<h3 id='----mouse---mouse-click---main.rb'>Mouse - Mouse Click - main.rb</h3> +<h3 id='----mouse---mouse-click---main-rb'>Mouse - Mouse Click - main.rb</h3> <pre><code class="language-ruby"># ./samples/05_mouse/01_mouse_click/app/main.rb =begin @@ -10314,12 +9732,23 @@ class TicTacToe # Starts the game with player x's turn and creates an array (to_a) for space combinations. # Calls methods necessary for the game to run properly. def tick - state.current_turn ||= :x - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + init_new_game render_board input_board end + def init_new_game + state.current_turn ||= :x + state.space_combinations ||= [-1, 0, 1].product([-1, 0, 1]).to_a + + state.spaces ||= {} + + state.space_combinations.each do |x, y| + state.spaces[x] ||= {} + state.spaces[x][y] ||= state.new_entity(:space) + end + end + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. def render_board square_size = 80 @@ -10395,6 +9824,7 @@ class TicTacToe def input_restart_game return unless state.game_over gtk.reset + init_new_game end # Checks if x or o won the game. @@ -10509,7 +9939,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----mouse---mouse-move---main.rb'>Mouse - Mouse Move - main.rb</h3> +<h3 id='----mouse---mouse-move---main-rb'>Mouse - Mouse Move - main.rb</h3> <pre><code class="language-ruby"># ./samples/05_mouse/02_mouse_move/app/main.rb =begin @@ -10709,7 +10139,7 @@ class ProtectThePuppiesFromTheZombies def calc_kill_zombie # Find all zombies that intersect with the player. They are considered killed. - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + killed_this_frame = state.zombies.find_all { |z| z.sprite && (z.sprite.intersect_rect? state.player_sprite) } state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies @@ -10809,7 +10239,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----mouse---mouse-move-paint-app---main.rb'>Mouse - Mouse Move Paint App - main.rb</h3> +<h3 id='----mouse---mouse-move-paint-app---main-rb'>Mouse - Mouse Move Paint App - main.rb</h3> <pre><code class="language-ruby"># ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb =begin @@ -11053,7 +10483,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----mouse---coordinate-systems---main.rb'>Mouse - Coordinate Systems - main.rb</h3> +<h3 id='----mouse---coordinate-systems---main-rb'>Mouse - Coordinate Systems - main.rb</h3> <pre><code class="language-ruby"># ./samples/05_mouse/04_coordinate_systems/app/main.rb =begin @@ -11137,7 +10567,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----save-load---save-load-game---main.rb'>Save Load - Save Load Game - main.rb</h3> +<h3 id='----save-load---save-load-game---main-rb'>Save Load - Save Load Game - main.rb</h3> <pre><code class="language-ruby"># ./samples/06_save_load/01_save_load_game/app/main.rb =begin @@ -11530,7 +10960,1117 @@ def tick args end </code></pre> -<h3 id='----advanced-rendering---simple-render-targets---main.rb'>Advanced Rendering - Simple Render Targets - main.rb</h3> +<h3 id='----advanced-audio---audio-mixer---main-rb'>Advanced Audio - Audio Mixer - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_audio/01_audio_mixer/app/main.rb +# these are the properties that you can sent on args.audio +def spawn_new_sound args, name, path + # Spawn randomly in an area that won't be covered by UI. + screenx = (rand * 600.0) + 200.0 + screeny = (rand * 400.0) + 100.0 + + id = new_sound_id! args + # you can hang anything on the audio hashes you want, so we store the + # actual screen position in here for convenience. + args.audio[id] = { + name: name, + input: path, + screenx: screenx, + screeny: screeny, + x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range + y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range + z: 0.0, + gain: 1.0, + pitch: 1.0, + looping: true, + paused: false + } + + args.state.selected = id +end + +# these are values you can change on the ~args.audio~ data structure +def input_panel args + return unless args.state.panel + return if args.state.dragging + + audio_entry = args.audio[args.state.selected] + results = args.state.panel + + if args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.pitch_slider_rect.rect) + audio_entry.pitch = 2.0 * ((args.inputs.mouse.x - results.pitch_slider_rect.x).to_f / (results.pitch_slider_rect.w - 1.0)) + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.playtime_slider_rect.rect) + audio_entry.playtime = audio_entry.length_ * ((args.inputs.mouse.x - results.playtime_slider_rect.x).to_f / (results.playtime_slider_rect.w - 1.0)) + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.gain_slider_rect.rect) + audio_entry.gain = (args.inputs.mouse.x - results.gain_slider_rect.x).to_f / (results.gain_slider_rect.w - 1.0) + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.looping_checkbox_rect.rect) + audio_entry.looping = !audio_entry.looping + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.paused_checkbox_rect.rect) + audio_entry.paused = !audio_entry.paused + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.delete_button_rect.rect) + args.audio.delete args.state.selected + end +end + +def render_sources args + args.outputs.primitives << args.audio.keys.map do |k| + s = args.audio[k] + + isselected = (k == args.state.selected) + + color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] + [ + [s.screenx, s.screeny, args.state.boxsize, args.state.boxsize, *color].solid, + + { + x: s.screenx + args.state.boxsize.half, + y: s.screeny, + text: s.name, + r: 255, + g: 255, + b: 255, + alignment_enum: 1 + }.label! + ] + end +end + +def playtime_str t + return "" unless t + minutes = (t / 60.0).floor + seconds = t - (minutes * 60.0).to_f + return minutes.to_s + ':' + seconds.floor.to_s + ((seconds - seconds.floor).to_s + "000")[1..3] +end + +def label_with_drop_shadow x, y, text + [ + { x: x + 1, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, + { x: x + 2, y: y + 0, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, + { x: x + 0, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 200, g: 200, b: 200 }.label! + ] +end + +def check_box opts = {} + checkbox_template = opts.args.layout.rect(w: 0.5, h: 0.5, col: 2) + final_rect = checkbox_template.center_inside_rect_y(opts.args.layout.rect(row: opts.row, col: opts.col)) + color = { r: 0, g: 0, b: 0 } + color = { r: 255, g: 255, b: 255 } if opts.checked + + { + rect: final_rect, + primitives: [ + (final_rect.to_solid color) + ] + } +end + +def progress_bar opts = {} + outer_rect = opts.args.layout.rect(row: opts.row, col: opts.col, w: 5, h: 1) + color = opts.percentage * 255 + baseline_progress_bar = opts.args + .layout + .rect(w: 5, h: 0.5) + + final_rect = baseline_progress_bar.center_inside_rect(outer_rect) + center = final_rect.rect_center_point + + { + rect: final_rect, + primitives: [ + final_rect.merge(r: color, g: color, b: color, a: 128).solid!, + label_with_drop_shadow(center.x, center.y, opts.text) + ] + } +end + +def panel_primitives args, audio_entry + results = { primitives: [] } + + return results unless audio_entry + + # this uses DRGTK's layout apis to layout the controls + # imagine the screen is split into equal cells (24 cells across, 12 cells up and down) + # args.layout.rect returns a hash which we merge values with to create primitives + # using args.layout.rect removes the need for pixel pushing + + # args.outputs.debug << args.layout.debug_primitives(r: 255, g: 255, b: 255) + + white_color = { r: 255, g: 255, b: 255 } + label_style = white_color.merge(vertical_alignment_enum: 1) + + # panel background + results.primitives << args.layout.rect(row: 0, col: 0, w: 7, h: 6, include_col_gutter: true, include_row_gutter: true) + .border!(r: 255, g: 255, b: 255) + + # title + results.primitives << args.layout.point(row: 0, col: 3.5, row_anchor: 0.5) + .merge(label_style) + .merge(text: "Source #{args.state.selected} (#{args.audio[args.state.selected].name})", + size_enum: 3, + alignment_enum: 1) + + # seperator line + results.primitives << args.layout.rect(row: 1, col: 0, w: 7, h: 0) + .line!(white_color) + + # screen location + results.primitives << args.layout.point(row: 1.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "screen:") + + results.primitives << args.layout.point(row: 1.0, col: 2, row_anchor: 0.5) + .merge(label_style) + .merge(text: "(#{audio_entry.screenx.to_i}, #{audio_entry.screeny.to_i})") + + # position + results.primitives << args.layout.point(row: 1.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "position:") + + results.primitives << args.layout.point(row: 1.5, col: 2, row_anchor: 0.5) + .merge(label_style) + .merge(text: "(#{audio_entry[:x].round(5).to_s[0..6]}, #{audio_entry[:y].round(5).to_s[0..6]})") + + results.primitives << args.layout.point(row: 2.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "pitch:") + + results.pitch_slider_rect = progress_bar(row: 2.0, col: 2, + percentage: audio_entry.pitch / 2.0, + text: "#{audio_entry.pitch.to_sf}", + args: args) + + results.primitives << results.pitch_slider_rect.primitives + + results.primitives << args.layout.point(row: 2.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "playtime:") + + results.playtime_slider_rect = progress_bar(args: args, + row: 2.5, + col: 2, + percentage: (audio_entry.playtime || 1) / (audio_entry.length_ || 1), + text: "#{playtime_str(audio_entry.playtime)} / #{playtime_str(audio_entry.length_)}") + + results.primitives << results.playtime_slider_rect.primitives + + results.primitives << args.layout.point(row: 3.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "gain:") + + results.gain_slider_rect = progress_bar(args: args, + row: 3.0, + col: 2, + percentage: audio_entry.gain, + text: "#{audio_entry.gain.to_sf}") + + results.primitives << results.gain_slider_rect.primitives + + + results.primitives << args.layout.point(row: 3.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "looping:") + + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) + + results.looping_checkbox_rect = check_box(args: args, row: 3.5, col: 2, checked: audio_entry.looping) + results.primitives << results.looping_checkbox_rect.primitives + + results.primitives << args.layout.point(row: 4.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "paused:") + + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) + + results.paused_checkbox_rect = check_box(args: args, row: 4.0, col: 2, checked: !audio_entry.paused) + results.primitives << results.paused_checkbox_rect.primitives + + results.delete_button_rect = { rect: args.layout.rect(row: 5, col: 0, w: 7, h: 1) } + + results.primitives << results.delete_button_rect.to_solid(r: 180) + + results.primitives << args.layout.point(row: 5, col: 3.5, row_anchor: 0.5) + .merge(label_style) + .merge(text: "DELETE", alignment_enum: 1) + + return results +end + +def render_panel args + args.state.panel = nil + audio_entry = args.audio[args.state.selected] + return unless audio_entry + + mouse_down = (args.state.mouse_held >= 0) + args.state.panel = panel_primitives args, audio_entry + args.outputs.primitives << args.state.panel.primitives +end + +def new_sound_id! args + args.state.sound_id ||= 0 + args.state.sound_id += 1 + args.state.sound_id +end + +def render_launcher args + args.outputs.primitives << args.state.spawn_sound_buttons.map(&:primitives) +end + +def render_ui args + render_launcher args + render_panel args +end + +def tick args + defaults args + render args + input args +end + +def input args + if !args.audio[args.state.selected] + args.state.selected = nil + args.state.dragging = nil + end + + # spawn button and node interaction + if args.inputs.mouse.click + spawn_sound_button = args.state.spawn_sound_buttons.find { |b| args.inputs.mouse.inside_rect? b.rect } + + audio_click_key, audio_click_value = args.audio.find do |k, v| + args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] + end + + if spawn_sound_button + args.state.selected = nil + spawn_new_sound args, spawn_sound_button.name, spawn_sound_button.path + elsif audio_click_key + args.state.selected = audio_click_key + end + end + + if args.state.mouse_state == :held && args.state.selected + v = args.audio[args.state.selected] + if args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] + args.state.dragging = args.state.selected + end + + if args.state.dragging + s = args.audio[args.state.selected] + # you can hang anything on the audio hashes you want, so we store the + # actual screen position so it doesn't scale weirdly vs your mouse. + s.screenx = args.inputs.mouse.x - (args.state.boxsize / 2) + s.screeny = args.inputs.mouse.y - (args.state.boxsize / 2) + + s.screeny = 50 if s.screeny < 50 + s.screeny = (719 - args.state.boxsize) if s.screeny > (719 - args.state.boxsize) + s.screenx = 0 if s.screenx < 0 + s.screenx = (1279 - args.state.boxsize) if s.screenx > (1279 - args.state.boxsize) + + s.x = ((s.screenx / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range + s.y = ((s.screeny / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range + end + elsif args.state.mouse_state == :released + args.state.dragging = nil + end + + input_panel args +end + +def defaults args + args.state.mouse_state ||= :released + args.state.dragging_source ||= false + args.state.selected ||= 0 + args.state.next_sound_index ||= 0 + args.state.boxsize ||= 30 + args.state.sound_files ||= [ + { name: :tada, path: "sounds/tada.wav" }, + { name: :splash, path: "sounds/splash.wav" }, + { name: :drum, path: "sounds/drum.wav" }, + { name: :spring, path: "sounds/spring.wav" }, + { name: :music, path: "sounds/music.ogg" } + ] + + # generate buttons based off the sound collection above + args.state.spawn_sound_buttons ||= begin + # create a group of buttons + # column centered (using col_offset to calculate the column offset) + # where each item is 2 columns apart + rects = args.layout.rect_group row: 11, + col_offset: { + count: args.state.sound_files.length, + w: 2 + }, + dcol: 2, + w: 2, + h: 1, + group: args.state.sound_files + + # now that you have the rects + # construct the metadata for the buttons + rects.map do |rect| + { + rect: rect, + name: rect.name, + path: rect.path, + primitives: [ + rect.to_border(r: 255, g: 255, b: 255), + rect.to_label(x: rect.center_x, + y: rect.center_y, + text: "#{rect.name}", + alignment_enum: 1, + vertical_alignment_enum: 1, + r: 255, g: 255, b: 255) + ] + } + end + end + + if args.inputs.mouse.up + args.state.mouse_state = :released + args.state.dragging_source = false + elsif args.inputs.mouse.down + args.state.mouse_state = :held + end + + args.outputs.background_color = [ 0, 0, 0, 255 ] +end + +def render args + render_ui args + render_sources args +end + +</code></pre> +<h3 id='----advanced-audio---audio-mixer---server_ip_address-txt'>Advanced Audio - Audio Mixer - server_ip_address.txt</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_audio/01_audio_mixer/app/server_ip_address.txt +192.168.1.65 +</code></pre> +<h3 id='----advanced-audio---sound-synthesis---main-rb'>Advanced Audio - Sound Synthesis - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_audio/02_sound_synthesis/app/main.rb +begin # region: top level tick methods + def tick args + defaults args + render args + input args + process_audio_queue args + end + + def defaults args + args.state.sine_waves ||= {} + args.state.square_waves ||= {} + args.state.saw_tooth_waves ||= {} + args.state.triangle_waves ||= {} + args.state.audio_queue ||= [] + args.state.buttons ||= [ + (frequency_buttons args), + (sine_wave_note_buttons args), + (bell_buttons args), + (square_wave_note_buttons args), + (saw_tooth_wave_note_buttons args), + (triangle_wave_note_buttons args), + ].flatten + end + + def render args + args.outputs.borders << args.state.buttons.map { |b| b[:border] } + args.outputs.labels << args.state.buttons.map { |b| b[:label] } + args.outputs.labels << args.layout + .rect(row: 0, col: 11.5) + .yield_self { |r| r.merge y: r.y + r.h } + .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", + alignment_enum: 1) + end + + + def input args + args.state.buttons.each do |b| + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) + parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " + args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" + send b[:method_to_call], args, b + end + end + + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) + args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' + end + end + + def process_audio_queue args + to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } + args.state.audio_queue -= to_queue + to_queue.each { |a| args.audio[a[:id]] = a } + + args.audio.find_all { |k, v| v[:decay_rate] } + .each { |k, v| v[:gain] -= v[:decay_rate] } + + sounds_to_stop = args.audio + .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } + .map { |k, v| k } + + sounds_to_stop.each { |k| args.audio.delete k } + end +end + +begin # region: button definitions, ui layout, callback functions + def button args, opts + button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) + + button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 + + label_offset_x = 5 + label_offset_y = 30 + + button_def[:label] = button_def[:rect].merge text: opts[:text], + size_enum: -2.5, + x: button_def[:rect].x + label_offset_x, + y: button_def[:rect].y + label_offset_y + + button_def + end + + def play_sine_wave args, sender + queue_sine_wave args, + frequency: sender[:frequency], + duration: 1.seconds, + fade_out: true + end + + def play_note args, sender + method_to_call = :queue_sine_wave + method_to_call = :queue_square_wave if sender[:type] == :square + method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth + method_to_call = :queue_triangle_wave if sender[:type] == :triangle + method_to_call = :queue_bell if sender[:type] == :bell + + send method_to_call, args, + frequency: (frequency_for note: sender[:note], octave: sender[:octave]), + duration: 1.seconds, + fade_out: true + end + + def frequency_buttons args + [ + (button args, + row: 4.0, col: 0, text: "300hz", + frequency: 300, + method_to_call: :play_sine_wave), + (button args, + row: 5.0, col: 0, text: "400hz", + frequency: 400, + method_to_call: :play_sine_wave), + (button args, + row: 6.0, col: 0, text: "500hz", + frequency: 500, + method_to_call: :play_sine_wave), + ] + end + + def sine_wave_note_buttons args + [ + (button args, + row: 1.5, col: 2, text: "Sine C4", + note: :c, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 2.5, col: 2, text: "Sine D4", + note: :d, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 3.5, col: 2, text: "Sine E4", + note: :e, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 4.5, col: 2, text: "Sine F4", + note: :f, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 5.5, col: 2, text: "Sine G4", + note: :g, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 6.5, col: 2, text: "Sine A5", + note: :a, octave: 5, type: :sine, method_to_call: :play_note), + (button args, + row: 7.5, col: 2, text: "Sine B5", + note: :b, octave: 5, type: :sine, method_to_call: :play_note), + (button args, + row: 8.5, col: 2, text: "Sine C5", + note: :c, octave: 5, type: :sine, method_to_call: :play_note), + ] + end + + def square_wave_note_buttons args + [ + (button args, + row: 1.5, col: 6, text: "Square C4", + note: :c, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 2.5, col: 6, text: "Square D4", + note: :d, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 3.5, col: 6, text: "Square E4", + note: :e, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 4.5, col: 6, text: "Square F4", + note: :f, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 5.5, col: 6, text: "Square G4", + note: :g, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 6.5, col: 6, text: "Square A5", + note: :a, octave: 5, type: :square, method_to_call: :play_note), + (button args, + row: 7.5, col: 6, text: "Square B5", + note: :b, octave: 5, type: :square, method_to_call: :play_note), + (button args, + row: 8.5, col: 6, text: "Square C5", + note: :c, octave: 5, type: :square, method_to_call: :play_note), + ] + end + def saw_tooth_wave_note_buttons args + [ + (button args, + row: 1.5, col: 8, text: "Saw C4", + note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 2.5, col: 8, text: "Saw D4", + note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 3.5, col: 8, text: "Saw E4", + note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 4.5, col: 8, text: "Saw F4", + note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 5.5, col: 8, text: "Saw G4", + note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 6.5, col: 8, text: "Saw A5", + note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 7.5, col: 8, text: "Saw B5", + note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 8.5, col: 8, text: "Saw C5", + note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), + ] + end + + def triangle_wave_note_buttons args + [ + (button args, + row: 1.5, col: 10, text: "Triangle C4", + note: :c, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 2.5, col: 10, text: "Triangle D4", + note: :d, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 3.5, col: 10, text: "Triangle E4", + note: :e, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 4.5, col: 10, text: "Triangle F4", + note: :f, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 5.5, col: 10, text: "Triangle G4", + note: :g, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 6.5, col: 10, text: "Triangle A5", + note: :a, octave: 5, type: :triangle, method_to_call: :play_note), + (button args, + row: 7.5, col: 10, text: "Triangle B5", + note: :b, octave: 5, type: :triangle, method_to_call: :play_note), + (button args, + row: 8.5, col: 10, text: "Triangle C5", + note: :c, octave: 5, type: :triangle, method_to_call: :play_note), + ] + end + + def bell_buttons args + [ + (button args, + row: 1.5, col: 4, text: "Bell C4", + note: :c, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 2.5, col: 4, text: "Bell D4", + note: :d, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 3.5, col: 4, text: "Bell E4", + note: :e, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 4.5, col: 4, text: "Bell F4", + note: :f, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 5.5, col: 4, text: "Bell G4", + note: :g, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 6.5, col: 4, text: "Bell A5", + note: :a, octave: 5, type: :bell, method_to_call: :play_note), + (button args, + row: 7.5, col: 4, text: "Bell B5", + note: :b, octave: 5, type: :bell, method_to_call: :play_note), + (button args, + row: 8.5, col: 4, text: "Bell C5", + note: :c, octave: 5, type: :bell, method_to_call: :play_note), + ] + end +end + +begin # region: wave generation + begin # sine wave + def defaults_sine_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def sine_wave_for opts = {} + opts = defaults_sine_wave_for.merge opts + frequency = opts[:frequency] + sample_rate = opts[:sample_rate] + period_size = (sample_rate.fdiv frequency).ceil + period_size.map_with_index do |i| + Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) + end.to_a + end + + def defaults_queue_sine_wave + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def queue_sine_wave args, opts = {} + opts = defaults_queue_sine_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate + args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.sine_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: sine_wave + end + end + + begin # region: square wave + def defaults_square_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def square_wave_for opts = {} + opts = defaults_square_wave_for.merge opts + sine_wave = sine_wave_for opts + sine_wave.map do |v| + if v >= 0 + 1.0 + else + -1.0 + end + end.to_a + end + + def defaults_queue_square_wave + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } + end + + def queue_square_wave args, opts = {} + opts = defaults_queue_square_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate + args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.square_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: square_wave + end + end + + begin # region: saw tooth wave + def defaults_saw_tooth_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def saw_tooth_wave_for opts = {} + opts = defaults_saw_tooth_wave_for.merge opts + sine_wave = sine_wave_for opts + period_size = sine_wave.length + sine_wave.map_with_index do |v, i| + (((i % period_size).fdiv period_size) * 2) - 1 + end + end + + def defaults_queue_saw_tooth_wave + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } + end + + def queue_saw_tooth_wave args, opts = {} + opts = defaults_queue_saw_tooth_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate + args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: saw_tooth_wave + end + end + + begin # region: triangle wave + def defaults_triangle_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def triangle_wave_for opts = {} + opts = defaults_saw_tooth_wave_for.merge opts + sine_wave = sine_wave_for opts + period_size = sine_wave.length + sine_wave.map_with_index do |v, i| + ratio = (i.fdiv period_size) + if ratio <= 0.5 + (ratio * 4) - 1 + else + ratio -= 0.5 + 1 - (ratio * 4) + end + end + end + + def defaults_queue_triangle_wave + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def queue_triangle_wave args, opts = {} + opts = defaults_queue_triangle_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate + args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.triangle_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: triangle_wave + end + end + + begin # region: bell + def defaults_queue_bell + { frequency: 440, duration: 1.seconds, queue_in: 0 } + end + + def queue_bell args, opts = {} + (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } + end + + def bell_harmonics + [ + { frequency_ratio: 0.5, duration_ratio: 1.00 }, + { frequency_ratio: 1.0, duration_ratio: 0.80 }, + { frequency_ratio: 2.0, duration_ratio: 0.60 }, + { frequency_ratio: 3.0, duration_ratio: 0.40 }, + { frequency_ratio: 4.2, duration_ratio: 0.25 }, + { frequency_ratio: 5.4, duration_ratio: 0.20 }, + { frequency_ratio: 6.8, duration_ratio: 0.15 } + ] + end + + def defaults_bell_to_sine_waves + { frequency: 440, duration: 1.seconds, queue_in: 0 } + end + + def bell_to_sine_waves opts = {} + opts = defaults_bell_to_sine_waves.merge opts + bell_harmonics.map do |b| + { + frequency: opts[:frequency] * b[:frequency_ratio], + duration: opts[:duration] * b[:duration_ratio], + queue_in: opts[:queue_in], + gain: (1.fdiv bell_harmonics.length), + fade_out: true + } + end + end + end + + begin # audio entity construction + def generate_audio_data sine_wave, sample_rate + sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil + copy_count = (sample_size.fdiv sine_wave.length).ceil + sine_wave * copy_count + end + + def defaults_new_audio_state + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def new_audio_state args, opts = {} + opts = defaults_new_audio_state.merge opts + decay_rate = 0 + decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] + frequency = opts[:frequency] + sample_rate = 48000 + + { + id: (new_id! args), + frequency: frequency, + sample_rate: 48000, + stop_at: args.tick_count + opts[:queue_in] + opts[:duration], + gain: opts[:gain].to_f, + queue_at: args.state.tick_count + opts[:queue_in], + decay_rate: decay_rate, + pitch: 1.0, + looping: true, + paused: false + } + end + + def queue_audio args, opts = {} + graph_wave args, opts[:wave], opts[:audio_state][:frequency] + args.state.audio_queue << opts[:audio_state] + end + + def new_id! args + args.state.audio_id ||= 0 + args.state.audio_id += 1 + end + + def graph_wave args, wave, frequency + if args.state.tick_count != args.state.graphed_at + args.outputs.static_lines.clear + args.outputs.static_sprites.clear + end + + wave = wave + + r, g, b = frequency.to_i % 85, + frequency.to_i % 170, + frequency.to_i % 255 + + starting_rect = args.layout.rect(row: 5, col: 13) + x_scale = 10 + y_scale = 100 + max_points = 25 + + points = wave + if wave.length > max_points + resolution = wave.length.idiv max_points + points = wave.find_all.with_index { |y, i| (i % resolution == 0) } + end + + args.outputs.static_lines << points.map_with_index do |y, x| + next_y = points[x + 1] + + if next_y + { + x: starting_rect.x + (x * x_scale), + y: starting_rect.y + starting_rect.h.half + y_scale * y, + x2: starting_rect.x + ((x + 1) * x_scale), + y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, + r: r, + g: g, + b: b + } + end + end + + args.outputs.static_sprites << points.map_with_index do |y, x| + { + x: (starting_rect.x + (x * x_scale)) - 2, + y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, + w: 4, + h: 4, + path: 'sprites/square-white.png', + r: r, + g: g, + b: b + } + end + + args.state.graphed_at = args.state.tick_count + end + end + + begin # region: musical note mapping + def defaults_frequency_for + { note: :a, octave: 5, sharp: false, flat: false } + end + + def frequency_for opts = {} + opts = defaults_frequency_for.merge opts + octave_offset_multiplier = opts[:octave] - 5 + note = note_frequencies_octave_5[opts[:note]] + if octave_offset_multiplier < 0 + note = note * 1 / (octave_offset_multiplier.abs + 1) + elsif octave_offset_multiplier > 0 + note = note * (octave_offset_multiplier.abs + 1) / 1 + end + note + end + + def note_frequencies_octave_5 + { + a: 440.0, + a_sharp: 466.16, b_flat: 466.16, + b: 493.88, + c: 523.25, + c_sharp: 554.37, d_flat: 587.33, + d: 587.33, + d_sharp: 622.25, e_flat: 659.25, + e: 659.25, + f: 698.25, + f_sharp: 739.99, g_flat: 739.99, + g: 783.99, + g_sharp: 830.61, a_flat: 830.61 + } + end + end +end + +$gtk.reset + +</code></pre> +<h3 id='----advanced-rendering---labels-with-wrapped-text---main-rb'>Advanced Rendering - Labels With Wrapped Text - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/00_labels_with_wrapped_text/app/main.rb +def tick args + # defaults + args.state.scroll_location ||= 0 + args.state.textbox.messages ||= [] + args.state.textbox.scroll ||= 0 + + # render + args.outputs.background_color = [0, 0, 0, 255] + render_messages args + render_instructions args + + # inputs + if args.inputs.keyboard.key_down.one + queue_message args, "Hello there neighbour! my name is mark, how is your day today?" + end + + if args.inputs.keyboard.key_down.two + queue_message args, "I'm doing great sir, actually I'm having a picnic today" + end + + if args.inputs.keyboard.key_down.three + queue_message args, "Well that sounds wonderful!" + end + + if args.inputs.keyboard.key_down.home + args.state.scroll_location = 1 + end + + if args.inputs.keyboard.key_down.delete + clear_message_queue args + end +end + +def queue_message args, msg + args.state.textbox.messages.concat msg.wrapped_lines 50 +end + +def clear_message_queue args + args.state.textbox.messages = nil + args.state.textbox.scroll = 0 +end + +def render_messages args + args.outputs[:textbox].w = 400 + args.outputs[:textbox].h = 720 + + args.outputs.primitives << args.state.textbox.messages.each_with_index.map do |s, idx| + { + x: 0, + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, + text: s, + size_enum: -3, + alignment_enum: 0, + r: 255, g:255, b: 255, a: 255 + } + end + + args.outputs[:textbox].labels << args.state.textbox.messages.each_with_index.map do |s, idx| + { + x: 0, + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, + text: s, + size_enum: -3, + alignment_enum: 0, + r: 255, g:255, b: 255, a: 255 + } + end + + args.outputs[:textbox].borders << [0, 0, args.outputs[:textbox].w, 720] + + args.state.textbox.scroll += args.inputs.mouse.wheel.y unless args.inputs.mouse.wheel.nil? + + if args.state.scroll_location > 0 + args.state.textbox.scroll = 0 + args.state.scroll_location = 0 + end + + args.outputs.sprites << [900, 0, args.outputs[:textbox].w, 720, :textbox] +end + +def render_instructions args + args.outputs.labels << [30, + 30.from_top, + "press 1, 2, 3 to display messages, MOUSE WHEEL to scroll, HOME to go to top, BACKSPACE to delete.", + 0, 255, 255] + + args.outputs.primitives << [0, 55.from_top, 1280, 30, :pixel, 0, 255, 0, 0, 0].sprite +end + +</code></pre> +<h3 id='----advanced-rendering---rotating-label---main-rb'>Advanced Rendering - Rotating Label - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/00_rotating_label/app/main.rb +def tick args + # set the render target width and height to match the label + args.outputs[:scene].w = 220 + args.outputs[:scene].h = 30 + + + # make the background transparent + args.outputs[:scene].background_color = [255, 255, 255, 0] + + # set the blendmode of the label to 0 (no blending) + # center it inside of the scene + # set the vertical_alignment_enum to 1 (center) + args.outputs[:scene].labels << { x: 0, + y: 15, + text: "label in render target", + blendmode_enum: 0, + vertical_alignment_enum: 1 } + + # add a border to the render target + args.outputs[:scene].borders << { x: 0, + y: 0, + w: args.outputs[:scene].w, + h: args.outputs[:scene].h } + + # add the rendertarget to the main output as a sprite + args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half, + y: 360 - args.outputs[:scene].h.half, + w: args.outputs[:scene].w, + h: args.outputs[:scene].h, + angle: args.state.tick_count, + path: :scene } +end + +</code></pre> +<h3 id='----advanced-rendering---simple-render-targets---main-rb'>Advanced Rendering - Simple Render Targets - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb def tick args # args.outputs.render_targets are really really powerful. @@ -11586,7 +12126,7 @@ end $gtk.reset </code></pre> -<h3 id='----advanced-rendering---render-targets-with-tile-manipulation---main.rb'>Advanced Rendering - Render Targets With Tile Manipulation - main.rb</h3> +<h3 id='----advanced-rendering---render-targets-with-tile-manipulation---main-rb'>Advanced Rendering - Render Targets With Tile Manipulation - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/02_render_targets_with_tile_manipulation/app/main.rb # This sample is meant to show you how to do that dripping transition thing # at the start of the original Doom. Most of this file is here to animate @@ -11685,7 +12225,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----advanced-rendering---render-target-viewports---main.rb'>Advanced Rendering - Render Target Viewports - main.rb</h3> +<h3 id='----advanced-rendering---render-target-viewports---main-rb'>Advanced Rendering - Render Target Viewports - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb =begin @@ -12157,7 +12697,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----advanced-rendering---render-primitive-hierarchies---main.rb'>Advanced Rendering - Render Primitive Hierarchies - main.rb</h3> +<h3 id='----advanced-rendering---render-primitive-hierarchies---main-rb'>Advanced Rendering - Render Primitive Hierarchies - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb =begin @@ -12333,7 +12873,7 @@ def collection_of_sprites args end </code></pre> -<h3 id='----advanced-rendering---render-primitives-as-hash---main.rb'>Advanced Rendering - Render Primitives As Hash - main.rb</h3> +<h3 id='----advanced-rendering---render-primitives-as-hash---main-rb'>Advanced Rendering - Render Primitives As Hash - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb =begin @@ -12473,7 +13013,7 @@ def tick args flip_horizontally: false, angle_anchor_x: 0.5, # rotation center set to middle angle_anchor_y: 0.5 - }.sprite + }.sprite! # Outputs label as primitive using a hash args.outputs.primitives << { @@ -12487,7 +13027,7 @@ def tick args b: 50, a: 255, # transparency font: "fonts/manaspc.ttf" # font style - }.label + }.label! # Outputs solid as primitive using a hash args.outputs.primitives << { @@ -12499,7 +13039,7 @@ def tick args g: 50, b: 50, a: 255 # transparency - }.solid + }.solid! # Outputs border as primitive using a hash # Same parameters as solid @@ -12512,7 +13052,7 @@ def tick args g: 50, b: 50, a: 255 # transparency - }.border + }.border! # Outputs line as primitive using a hash args.outputs.primitives << { @@ -12524,11 +13064,11 @@ def tick args g: 50, b: 50, a: 255 # transparency - }.line + }.line! end </code></pre> -<h3 id='----advanced-rendering---pixel-arrays---main.rb'>Advanced Rendering - Pixel Arrays - main.rb</h3> +<h3 id='----advanced-rendering---pixel-arrays---main-rb'>Advanced Rendering - Pixel Arrays - main.rb</h3> <pre><code class="language-ruby"># ./samples/07_advanced_rendering/06_pixel_arrays/app/main.rb $gtk.reset @@ -12573,8 +13113,105 @@ end </code></pre> -<h3 id='----advanced-rendering---splitscreen-camera---main.rb'>Advanced Rendering - Splitscreen Camera - main.rb</h3> -<pre><code class="language-ruby"># ./samples/07_advanced_rendering/07_splitscreen_camera/app/main.rb +<h3 id='----advanced-rendering---simple-camera---main-rb'>Advanced Rendering - Simple Camera - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/07_simple_camera/app/main.rb +def tick args + # variables you can play around with + args.state.world.w ||= 1280 + args.state.world.h ||= 720 + + args.state.player.x ||= 0 + args.state.player.y ||= 0 + args.state.player.size ||= 32 + + args.state.enemy.x ||= 700 + args.state.enemy.y ||= 700 + args.state.enemy.size ||= 16 + + args.state.camera.x ||= 640 + args.state.camera.y ||= 300 + args.state.camera.scale ||= 1.0 + args.state.camera.show_empty_space ||= :yes + + # instructions + args.outputs.primitives << { x: 0, y: 80.from_top, w: 360, h: 80, r: 0, g: 0, b: 0, a: 128 }.solid! + args.outputs.primitives << { x: 10, y: 10.from_top, text: "arrow keys to move around", r: 255, g: 255, b: 255}.label! + args.outputs.primitives << { x: 10, y: 30.from_top, text: "+/- to change zoom of camera", r: 255, g: 255, b: 255}.label! + args.outputs.primitives << { x: 10, y: 50.from_top, text: "tab to change camera edge behavior", r: 255, g: 255, b: 255}.label! + + # render scene + args.outputs[:scene].w = args.state.world.w + args.outputs[:scene].h = args.state.world.h + + args.outputs[:scene].solids << { x: 0, y: 0, w: args.state.world.w, h: args.state.world.h, r: 20, g: 60, b: 80 } + args.outputs[:scene].solids << { x: args.state.player.x, y: args.state.player.y, + w: args.state.player.size, h: args.state.player.size, r: 80, g: 155, b: 80 } + args.outputs[:scene].solids << { x: args.state.enemy.x, y: args.state.enemy.y, + w: args.state.enemy.size, h: args.state.enemy.size, r: 155, g: 80, b: 80 } + + # render camera + scene_position = calc_scene_position args + args.outputs.sprites << { x: scene_position.x, + y: scene_position.y, + w: scene_position.w, + h: scene_position.h, + path: :scene } + + # move player + if args.inputs.directional_angle + args.state.player.x += args.inputs.directional_angle.vector_x * 5 + args.state.player.y += args.inputs.directional_angle.vector_y * 5 + args.state.player.x = args.state.player.x.clamp(0, args.state.world.w - args.state.player.size) + args.state.player.y = args.state.player.y.clamp(0, args.state.world.h - args.state.player.size) + end + + # +/- to zoom in and out + if args.inputs.keyboard.plus && args.state.tick_count.zmod?(3) + args.state.camera.scale += 0.05 + elsif args.inputs.keyboard.hyphen && args.state.tick_count.zmod?(3) + args.state.camera.scale -= 0.05 + elsif args.inputs.keyboard.key_down.tab + if args.state.camera.show_empty_space == :yes + args.state.camera.show_empty_space = :no + else + args.state.camera.show_empty_space = :yes + end + end + + args.state.camera.scale = args.state.camera.scale.greater(0.1) +end + +def calc_scene_position args + result = { x: args.state.camera.x - (args.state.player.x * args.state.camera.scale), + y: args.state.camera.y - (args.state.player.y * args.state.camera.scale), + w: args.state.world.w * args.state.camera.scale, + h: args.state.world.h * args.state.camera.scale, + scale: args.state.camera.scale } + + return result if args.state.camera.show_empty_space == :yes + + if result.w < args.grid.w + result.merge!(x: (args.grid.w - result.w).half) + elsif (args.state.player.x * result.scale) < args.grid.w.half + result.merge!(x: 10) + elsif (result.x + result.w) < args.grid.w + result.merge!(x: - result.w + (args.grid.w - 10)) + end + + if result.h < args.grid.h + result.merge!(y: (args.grid.h - result.h).half) + elsif (result.y) > 10 + result.merge!(y: 10) + elsif (result.y + result.h) < args.grid.h + result.merge!(y: - result.h + (args.grid.h - 10)) + end + + result +end + +</code></pre> +<h3 id='----advanced-rendering---splitscreen-camera---main-rb'>Advanced Rendering - Splitscreen Camera - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/08_splitscreen_camera/app/main.rb class CameraMovement attr_accessor :state, :inputs, :outputs, :grid @@ -12671,6 +13308,7 @@ class CameraMovement default_camera(0,0,1280,720) end + def new_room default_floor_tile(0,0,1024,1024,'sprites/rooms/camera_room.png') end @@ -12972,8 +13610,8 @@ def tick args end </code></pre> -<h3 id='----advanced-rendering---z-targeting-camera---main.rb'>Advanced Rendering - Z Targeting Camera - main.rb</h3> -<pre><code class="language-ruby"># ./samples/07_advanced_rendering/08_z_targeting_camera/app/main.rb +<h3 id='----advanced-rendering---z-targeting-camera---main-rb'>Advanced Rendering - Z Targeting Camera - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/09_z_targeting_camera/app/main.rb class Game attr_gtk @@ -13082,7 +13720,111 @@ end $gtk.reset </code></pre> -<h3 id='----tweening-lerping-easing-functions---easing-functions---main.rb'>Tweening Lerping Easing Functions - Easing Functions - main.rb</h3> +<h3 id='----advanced-rendering---blend-modes---main-rb'>Advanced Rendering - Blend Modes - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/10_blend_modes/app/main.rb +$gtk.reset + +def draw_blendmode args, mode + w = 160 + h = w + args.state.x += (1280-w) / (args.state.blendmodes.length + 1) + x = args.state.x + y = (720 - h) / 2 + s = 'sprites/blue-feathered.png' + args.outputs.sprites << { blendmode_enum: mode.value, x: x, y: y, w: w, h: h, path: s } + args.outputs.labels << [x + (w/2), y, mode.name.to_s, 1, 1, 255, 255, 255] +end + +def tick args + + # Different blend modes do different things, depending on what they + # blend against (in this case, the pixels of the background color). + args.state.bg_element ||= 1 + args.state.bg_color ||= 255 + args.state.bg_color_direction ||= 1 + bg_r = (args.state.bg_element == 1) ? args.state.bg_color : 0 + bg_g = (args.state.bg_element == 2) ? args.state.bg_color : 0 + bg_b = (args.state.bg_element == 3) ? args.state.bg_color : 0 + args.state.bg_color += args.state.bg_color_direction + if (args.state.bg_color_direction > 0) && (args.state.bg_color >= 255) + args.state.bg_color_direction = -1 + args.state.bg_color = 255 + elsif (args.state.bg_color_direction < 0) && (args.state.bg_color <= 0) + args.state.bg_color_direction = 1 + args.state.bg_color = 0 + args.state.bg_element += 1 + if args.state.bg_element >= 4 + args.state.bg_element = 1 + end + end + + args.outputs.background_color = [ bg_r, bg_g, bg_b, 255 ] + + args.state.blendmodes ||= [ + { name: :none, value: 0 }, + { name: :blend, value: 1 }, + { name: :add, value: 2 }, + { name: :mod, value: 3 }, + { name: :mul, value: 4 } + ] + + args.state.x = 0 # reset this, draw_blendmode will increment it. + args.state.blendmodes.each { |blendmode| draw_blendmode args, blendmode } +end + +</code></pre> +<h3 id='----advanced-rendering---render-target-noclear---main-rb'>Advanced Rendering - Render Target Noclear - main.rb</h3> +<pre><code class="language-ruby"># ./samples/07_advanced_rendering/11_render_target_noclear/app/main.rb +def tick args + args.state.x ||= 500 + args.state.y ||= 350 + args.state.xinc ||= 7 + args.state.yinc ||= 7 + args.state.bgcolor ||= 1 + args.state.bginc ||= 1 + + # clear the render target on the first tick, and then never again. Draw + # another box to it every tick, accumulating over time. + clear_target = (args.state.tick_count == 0) || (args.inputs.keyboard.key_down.space) + args.render_target(:accumulation).background_color = [ 0, 0, 0, 0 ]; + args.render_target(:accumulation).clear_before_render = clear_target + args.render_target(:accumulation).solids << [args.state.x, args.state.y, 25, 25, 255, 0, 0, 255]; + args.state.x += args.state.xinc + args.state.y += args.state.yinc + args.state.bgcolor += args.state.bginc + + # animation upkeep...change where we draw the next box and what color the + # window background will be. + if args.state.xinc > 0 && args.state.x >= 1280 + args.state.xinc = -7 + elsif args.state.xinc < 0 && args.state.x < 0 + args.state.xinc = 7 + end + + if args.state.yinc > 0 && args.state.y >= 720 + args.state.yinc = -7 + elsif args.state.yinc < 0 && args.state.y < 0 + args.state.yinc = 7 + end + + if args.state.bginc > 0 && args.state.bgcolor >= 255 + args.state.bginc = -1 + elsif args.state.bginc < 0 && args.state.bgcolor <= 0 + args.state.bginc = 1 + end + + # clear the screen to a shade of blue and draw the render target, which + # is not clearing every frame, on top of it. Note that you can NOT opt to + # skip clearing the screen, only render targets. The screen clears every + # frame; double-buffering would prevent correct updates between frames. + args.outputs.background_color = [ 0, 0, args.state.bgcolor, 255 ] + args.outputs.sprites << [ 0, 0, 1280, 720, :accumulation ] +end + +$gtk.reset + +</code></pre> +<h3 id='----tweening-lerping-easing-functions---easing-functions---main-rb'>Tweening Lerping Easing Functions - Easing Functions - main.rb</h3> <pre><code class="language-ruby"># ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb def tick args # STOP! Watch the following presentation first!!!! @@ -13218,7 +13960,7 @@ module Easing end </code></pre> -<h3 id='----tweening-lerping-easing-functions---cubic-bezier---main.rb'>Tweening Lerping Easing Functions - Cubic Bezier - main.rb</h3> +<h3 id='----tweening-lerping-easing-functions---cubic-bezier---main-rb'>Tweening Lerping Easing Functions - Cubic Bezier - main.rb</h3> <pre><code class="language-ruby"># ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb def tick args args.outputs.background_color = [33, 33, 33] @@ -13283,7 +14025,7 @@ def pow n, to end </code></pre> -<h3 id='----tweening-lerping-easing-functions---easing-using-spline---main.rb'>Tweening Lerping Easing Functions - Easing Using Spline - main.rb</h3> +<h3 id='----tweening-lerping-easing-functions---easing-using-spline---main-rb'>Tweening Lerping Easing Functions - Easing Using Spline - main.rb</h3> <pre><code class="language-ruby"># ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb def tick args args.state.duration = 10.seconds @@ -13305,7 +14047,7 @@ def tick args end </code></pre> -<h3 id='----tweening-lerping-easing-functions---parametric-enemy-movement---main.rb'>Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb</h3> +<h3 id='----tweening-lerping-easing-functions---parametric-enemy-movement---main-rb'>Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb</h3> <pre><code class="language-ruby"># ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb def new_star args { x: 1280.randomize(:ratio), @@ -13522,7 +14264,7 @@ def tick args end </code></pre> -<h3 id='----performance---sprites-as-hash---main.rb'>Performance - Sprites As Hash - main.rb</h3> +<h3 id='----performance---sprites-as-hash---main-rb'>Performance - Sprites As Hash - main.rb</h3> <pre><code class="language-ruby"># ./samples/09_performance/01_sprites_as_hash/app/main.rb # Sprites represented as Hashes using the queue ~args.outputs.sprites~ @@ -13565,7 +14307,11 @@ def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Hashes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13590,7 +14336,7 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---sprites-as-entities---main.rb'>Performance - Sprites As Entities - main.rb</h3> +<h3 id='----performance---sprites-as-entities---main-rb'>Performance - Sprites As Entities - main.rb</h3> <pre><code class="language-ruby"># ./samples/09_performance/02_sprites_as_entities/app/main.rb # Sprites represented as Entities using the queue ~args.outputs.sprites~ # yields nicer access apis over Hashes, but require a bit more code upfront. @@ -13633,7 +14379,97 @@ def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Open Entities" + puts "* INFO: Please specify the number of sprites to render." + args.gtk.console.set_command "reset_with count: 100" + end + + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| new_star args } + end + + # update + args.state.stars.each { |s| move_star args, s } + + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives +end + +# resets game, and assigns star count given by user +def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count +end + +</code></pre> +<h3 id='----performance---sprites-as-struct---main-rb'>Performance - Sprites As Struct - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/03_sprites_as_struct/app/main.rb +# create a Struct variant that allows for named parameters on construction. +class NamedStruct < Struct + def initialize **opts + super(*members.map { |k| opts[k] }) + end +end + +# create a Star NamedStruct +Star = NamedStruct.new(:x, :y, :w, :h, :path, :s, + :angle, :angle_anchor_x, :angle_anchor_y, + :r, :g, :b, :a, + :tile_x, :tile_y, + :tile_w, :tile_h, + :source_x, :source_y, + :source_w, :source_h, + :flip_horizontally, :flip_vertically, + :blendmode_enum) + +# Sprites represented as Structs. They require a little bit more code than Hashes, +# but are the a little faster to render too. +def random_x args + (args.grid.w.randomize :ratio) * -1 +end + +def random_y args + (args.grid.h.randomize :ratio) * -1 +end + +def random_speed + 1 + (4.randomize :ratio) +end + +def new_star args + Star.new x: (random_x args), + y: (random_y args), + w: 4, h: 4, + path: 'sprites/tiny-star.png', + s: random_speed +end + +def move_star args, star + star.x += star[:s] + star.y += star[:s] + if star.x > args.grid.w || star.y > args.grid.h + star.x = (random_x args) + star.y = (random_y args) + star[:s] = random_speed + end +end + +def tick args + args.state.star_count ||= 0 + + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Structs" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13658,8 +14494,8 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---sprites-as-strict-entities---main.rb'>Performance - Sprites As Strict Entities - main.rb</h3> -<pre><code class="language-ruby"># ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb +<h3 id='----performance---sprites-as-strict-entities---main-rb'>Performance - Sprites As Strict Entities - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/04_sprites_as_strict_entities/app/main.rb # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ # yields apis access similar to Entities, but all properties that can be set on the # entity must be predefined with a default value. Strict entities do not support the @@ -13705,7 +14541,11 @@ def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Strict Entities" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13730,8 +14570,8 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---sprites-as-classes---main.rb'>Performance - Sprites As Classes - main.rb</h3> -<pre><code class="language-ruby"># ./samples/09_performance/04_sprites_as_classes/app/main.rb +<h3 id='----performance---sprites-as-classes---main-rb'>Performance - Sprites As Classes - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/05_sprites_as_classes/app/main.rb # Sprites represented as Classes using the queue ~args.outputs.sprites~. # gives you full control of property declaration and method invocation. # They are more performant than OpenEntities and StrictEntities, but more code upfront. @@ -13760,6 +14600,11 @@ end def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Classes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13784,8 +14629,8 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---static-sprites-as-classes---main.rb'>Performance - Static Sprites As Classes - main.rb</h3> -<pre><code class="language-ruby"># ./samples/09_performance/05_static_sprites_as_classes/app/main.rb +<h3 id='----performance---static-sprites-as-classes---main-rb'>Performance - Static Sprites As Classes - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/06_static_sprites_as_classes/app/main.rb # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held # by reference. You get better performance, but you are mutating state of held objects @@ -13815,19 +14660,24 @@ end def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Static Sprites, Classes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end # init if args.state.tick_count == 0 args.state.stars = args.state.star_count.map { |i| Star.new args.grid } + args.outputs.static_sprites << args.state.stars end # update args.state.stars.each(&:move) # render - args.outputs.sprites << args.state.stars args.outputs.background_color = [0, 0, 0] args.outputs.primitives << args.gtk.current_framerate_primitives end @@ -13839,8 +14689,8 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---static-sprites-as-classes-with-custom-drawing---main.rb'>Performance - Static Sprites As Classes With Custom Drawing - main.rb</h3> -<pre><code class="language-ruby"># ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb +<h3 id='----performance---static-sprites-as-classes-with-custom-drawing---main-rb'>Performance - Static Sprites As Classes With Custom Drawing - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/07_static_sprites_as_classes_with_custom_drawing/app/main.rb # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. # is the fastest approach. This is comparable to what other game engines set as the default behavior. # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing @@ -13883,10 +14733,21 @@ class Star # path, # angle, # alpha, red_saturation, green_saturation, blue_saturation + # tile_x, tile_y, tile_w, tile_h, # flip_horizontally, flip_vertically, - # tile_x, tile_y, tile_w, tile_h # angle_anchor_x, angle_anchor_y, # source_x, source_y, source_w, source_h + + # The argument order for ffi_draw.draw_sprite_4 is: + # x, y, w, h, + # path, + # angle, + # alpha, red_saturation, green_saturation, blue_saturation + # tile_x, tile_y, tile_w, tile_h, + # flip_horizontally, flip_vertically, + # angle_anchor_x, angle_anchor_y, + # source_x, source_y, source_w, source_h, + # blendmode_enum end end @@ -13894,6 +14755,11 @@ end def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Static Sprites, Classes, Draw Override" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13915,8 +14781,8 @@ def reset_with count: count end </code></pre> -<h3 id='----performance---collision-limits---main.rb'>Performance - Collision Limits - main.rb</h3> -<pre><code class="language-ruby"># ./samples/09_performance/07_collision_limits/app/main.rb +<h3 id='----performance---collision-limits---main-rb'>Performance - Collision Limits - main.rb</h3> +<pre><code class="language-ruby"># ./samples/09_performance/08_collision_limits/app/main.rb =begin Reminders: @@ -13974,7 +14840,30 @@ end $gtk.reset </code></pre> -<h3 id='----advanced-debugging---trace-debugging---main.rb'>Advanced Debugging - Trace Debugging - main.rb</h3> +<h3 id='----advanced-debugging---logging---main-rb'>Advanced Debugging - Logging - main.rb</h3> +<pre><code class="language-ruby"># ./samples/10_advanced_debugging/00_logging/app/main.rb +def tick args + args.outputs.background_color = [255, 255, 255, 0] + if args.state.tick_count == 0 + args.gtk.log_spam "log level spam" + args.gtk.log_debug "log level debug" + args.gtk.log_info "log level info" + args.gtk.log_warn "log level warn" + args.gtk.log_error "log level error" + args.gtk.log_unfiltered "log level unfiltered" + puts "This is a puts call" + args.gtk.console.show + end + + if args.state.tick_count == 60 + puts "This is a puts call on tick 60" + elsif args.state.tick_count == 120 + puts "This is a puts call on tick 120" + end +end + +</code></pre> +<h3 id='----advanced-debugging---trace-debugging---main-rb'>Advanced Debugging - Trace Debugging - main.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb class Game attr_gtk @@ -14031,7 +14920,7 @@ def tick args end </code></pre> -<h3 id='----advanced-debugging---trace-debugging-classes---main.rb'>Advanced Debugging - Trace Debugging Classes - main.rb</h3> +<h3 id='----advanced-debugging---trace-debugging-classes---main-rb'>Advanced Debugging - Trace Debugging Classes - main.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb class Foobar def initialize @@ -14057,7 +14946,54 @@ def tick args end </code></pre> -<h3 id='----advanced-debugging---unit-tests---exception_raising_tests.rb'>Advanced Debugging - Unit Tests - exception_raising_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---benchmark_api_tests-rb'>Advanced Debugging - Unit Tests - benchmark_api_tests.rb</h3> +<pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/benchmark_api_tests.rb +def test_benchmark_api args, assert + result = args.gtk.benchmark iterations: 100, + only_one: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + } + + assert.equal! result.first_place.name, :only_one + + result = args.gtk.benchmark iterations: 100, + iterations_100: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + }, + iterations_50: -> () { + r = 0 + (1..50).each do |i| + r += 1 + end + } + + assert.equal! result.first_place.name, :iterations_50 + + result = args.gtk.benchmark iterations: 1, + iterations_100: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + }, + iterations_50: -> () { + r = 0 + (1..50).each do |i| + r += 1 + end + } + + assert.equal! result.too_small_to_measure, true +end + +</code></pre> +<h3 id='----advanced-debugging---unit-tests---exception_raising_tests-rb'>Advanced Debugging - Unit Tests - exception_raising_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb begin :shared class ExceptionalClass @@ -14080,7 +15016,7 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---fn_tests.rb'>Advanced Debugging - Unit Tests - fn_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---fn_tests-rb'>Advanced Debugging - Unit Tests - fn_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/fn_tests.rb def infinity 1 / 0 @@ -14264,13 +15200,13 @@ def test_array_hash args, assert end </code></pre> -<h3 id='----advanced-debugging---unit-tests---gen_docs.rb'>Advanced Debugging - Unit Tests - gen_docs.rb</h3> +<h3 id='----advanced-debugging---unit-tests---gen_docs-rb'>Advanced Debugging - Unit Tests - gen_docs.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb # ./dragonruby mygame --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick Kernel.export_docs! </code></pre> -<h3 id='----advanced-debugging---unit-tests---geometry_tests.rb'>Advanced Debugging - Unit Tests - geometry_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---geometry_tests-rb'>Advanced Debugging - Unit Tests - geometry_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb begin :shared def primitive_representations x, y, w, h @@ -14388,7 +15324,7 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---http_tests.rb'>Advanced Debugging - Unit Tests - http_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---http_tests-rb'>Advanced Debugging - Unit Tests - http_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb def try_assert_or_schedule args, assert if $result[:complete] @@ -14414,7 +15350,7 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---nil_coercion_tests.rb'>Advanced Debugging - Unit Tests - nil_coercion_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---nil_coercion_tests-rb'>Advanced Debugging - Unit Tests - nil_coercion_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/nil_coercion_tests.rb # numbers def test_open_entity_add_number args, assert @@ -14510,7 +15446,7 @@ def test_open_entity_nil_bug args, assert end </code></pre> -<h3 id='----advanced-debugging---unit-tests---object_to_primitive_tests.rb'>Advanced Debugging - Unit Tests - object_to_primitive_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---object_to_primitive_tests-rb'>Advanced Debugging - Unit Tests - object_to_primitive_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb class PlayerSpriteForTest end @@ -14530,7 +15466,7 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---parsing_tests.rb'>Advanced Debugging - Unit Tests - parsing_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---parsing_tests-rb'>Advanced Debugging - Unit Tests - parsing_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb def test_parse_json args, assert result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' @@ -14561,7 +15497,141 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---require_tests.rb'>Advanced Debugging - Unit Tests - require_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---pretty_format_tests-rb'>Advanced Debugging - Unit Tests - pretty_format_tests.rb</h3> +<pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/pretty_format_tests.rb +def H opts + opts +end + +def A *opts + opts +end + +def assert_format args, assert, hash, expected + actual = args.fn.pretty_format hash + assert.are_equal! actual, expected +end + +def test_pretty_print args, assert + # ============================= + # hash with single value + # ============================= + input = (H first_name: "John") + expected = <<-S +{:first_name "John"} +S + (assert_format args, assert, input, expected) + + # ============================= + # hash with two values + # ============================= + input = (H first_name: "John", last_name: "Smith") + expected = <<-S +{:first_name "John" + :last_name "Smith"} +S + + (assert_format args, assert, input, expected) + + # ============================= + # hash with inner hash + # ============================= + input = (H first_name: "John", + last_name: "Smith", + middle_initial: "I", + so: (H first_name: "Pocahontas", + last_name: "Tsenacommacah"), + friends: (A (H first_name: "Side", last_name: "Kick"), + (H first_name: "Tim", last_name: "Wizard"))) + expected = <<-S +{:first_name "John" + :last_name "Smith" + :middle_initial "I" + :so {:first_name "Pocahontas" + :last_name "Tsenacommacah"} + :friends [{:first_name "Side" + :last_name "Kick"} + {:first_name "Tim" + :last_name "Wizard"}]} +S + + (assert_format args, assert, input, expected) + + # ============================= + # array with one value + # ============================= + input = (A 1) + expected = <<-S +[1] +S + (assert_format args, assert, input, expected) + + # ============================= + # array with multiple values + # ============================= + input = (A 1, 2, 3) + expected = <<-S +[1 + 2 + 3] +S + (assert_format args, assert, input, expected) + + # ============================= + # array with multiple values hashes + # ============================= + input = (A (H first_name: "Side", last_name: "Kick"), + (H first_name: "Tim", last_name: "Wizard")) + expected = <<-S +[{:first_name "Side" + :last_name "Kick"} + {:first_name "Tim" + :last_name "Wizard"}] +S + + (assert_format args, assert, input, expected) +end + +def test_nested_nested args, assert + # ============================= + # nested array in nested hash + # ============================= + input = (H type: :root, + text: "Root", + children: (A (H level: 1, + text: "Level 1", + children: (A (H level: 2, + text: "Level 2", + children: []))))) + + expected = <<-S +{:type :root + :text "Root" + :children [{:level 1 + :text "Level 1" + :children [{:level 2 + :text "Level 2" + :children []}]}]} + +S + + (assert_format args, assert, input, expected) +end + +def test_scene args, assert + script = <<-S +* Scene 1 +** Narrator +They say happy endings don't exist. +** Narrator +They say true love is a lie. +S + input = parse_org args, script + puts (args.fn.pretty_format input) +end + +</code></pre> +<h3 id='----advanced-debugging---unit-tests---require_tests-rb'>Advanced Debugging - Unit Tests - require_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/require_tests.rb def write_src path, src $gtk.write_file path, src @@ -14603,18 +15673,18 @@ def test_require args, assert end </code></pre> -<h3 id='----advanced-debugging---unit-tests---serialize_deserialize_tests.rb'>Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---serialize_deserialize_tests-rb'>Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb def test_serialize args, assert GTK::Entity.__reset_id__! args.state.player_one = "test" result = args.gtk.serialize_state args.state - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" GTK::Entity.__reset_id__! args.gtk.write_file 'state.txt', '' result = args.gtk.serialize_state 'state.txt', args.state - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" end def test_deserialize args, assert @@ -14663,7 +15733,7 @@ def test_strict_entity_serialization_with_nil args, assert args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) serialized_state = args.gtk.serialize_state args.state - assert.equal! serialized_state, '{:entity_id=>9, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' + assert.equal! serialized_state, '{:entity_id=>7, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' GTK::Entity.__reset_id__! deserialized_state = args.gtk.deserialize_state serialized_state @@ -14721,8 +15791,20 @@ def test_by_reference_state_strict_entities args, assert assert.equal! deserialized_state.strict_entity.one, deserialized_state.strict_entity.two end +def test_serialization_excludes_thrash_count args, assert + GTK::Entity.__reset_id__! + args.state.player.name = "Ryu" + # force a nil pun + if args.state.player.age > 30 + end + assert.equal! args.state.player.as_hash[:__thrash_count__][:>], 1 + result = args.gtk.serialize_state args.state + assert.false! (result.include? "__thrash_count__"), + "The __thrash_count__ key exists in state when it shouldn't have." +end + </code></pre> -<h3 id='----advanced-debugging---unit-tests---state_serialization_experimental_tests.rb'>Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---state_serialization_experimental_tests-rb'>Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb MAX_CODE_GEN_LENGTH = 50 @@ -14832,7 +15914,7 @@ $gtk.reset 100 $gtk.log_level = :off </code></pre> -<h3 id='----advanced-debugging---unit-tests---suggest_autocompletion_tests.rb'>Advanced Debugging - Unit Tests - suggest_autocompletion_tests.rb</h3> +<h3 id='----advanced-debugging---unit-tests---suggest_autocompletion_tests-rb'>Advanced Debugging - Unit Tests - suggest_autocompletion_tests.rb</h3> <pre><code class="language-ruby"># ./samples/10_advanced_debugging/03_unit_tests/suggest_autocompletion_tests.rb def default_suggest_autocompletion args { @@ -14874,13 +15956,15 @@ S end </code></pre> -<h3 id='----http---retrieve-images---main.rb'>Http - Retrieve Images - main.rb</h3> +<h3 id='----http---retrieve-images---main-rb'>Http - Retrieve Images - main.rb</h3> <pre><code class="language-ruby"># ./samples/11_http/01_retrieve_images/app/main.rb +$gtk.register_cvar 'app.warn_seconds', "seconds to wait before starting", :uint, 11 + def tick args args.outputs.background_color = [0, 0, 0] # Show a warning at the start. - args.state.warning_debounce ||= 11 * 60 + args.state.warning_debounce ||= args.cvars['app.warn_seconds'].value * 60 if args.state.warning_debounce > 0 args.state.warning_debounce -= 1 args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] @@ -14931,10 +16015,11 @@ def tick args end </code></pre> -<h3 id='----http---web-server---main.rb'>Http - Web Server - main.rb</h3> -<pre><code class="language-ruby"># ./samples/11_http/02_web_server/app/main.rb +<h3 id='----http---in-game-web-server-http-get---main-rb'>Http - In Game Web Server Http Get - main.rb</h3> +<pre><code class="language-ruby"># ./samples/11_http/02_in_game_web_server_http_get/app/main.rb def tick args args.state.port ||= 3000 + args.state.reqnum ||= 0 # by default the embedded webserver runs on port 9001 (the port number is over 9000) and is disabled in a production build # to enable the http server in a production build, you need to manually start # the server up: @@ -14962,7 +16047,83 @@ def tick args end </code></pre> -<h3 id='----c-extensions---basics---main.rb'>C Extensions - Basics - main.rb</h3> +<h3 id='----http---in-game-web-server-http-post---main-rb'>Http - In Game Web Server Http Post - main.rb</h3> +<pre><code class="language-ruby"># ./samples/11_http/03_in_game_web_server_http_post/app/main.rb +def tick args + # defaults + args.state.post_button = args.layout.rect(row: 0, col: 0, w: 5, h: 1).merge(text: "execute http_post") + args.state.post_body_button = args.layout.rect(row: 1, col: 0, w: 5, h: 1).merge(text: "execute http_post_body") + args.state.request_to_s ||= "" + args.state.request_body ||= "" + + # render + args.state.post_button.yield_self do |b| + args.outputs.borders << b + args.outputs.labels << b.merge(text: b.text, + y: b.y + 30, + x: b.x + 10) + end + + args.state.post_body_button.yield_self do |b| + args.outputs.borders << b + args.outputs.labels << b.merge(text: b.text, + y: b.y + 30, + x: b.x + 10) + end + + draw_label args, 0, 6, "Request:", args.state.request_to_s + draw_label args, 0, 14, "Request Body Unaltered:", args.state.request_body + + # input + if args.inputs.mouse.click + # ============= HTTP_POST ============= + if (args.inputs.mouse.inside_rect? args.state.post_button) + # ========= DATA TO SEND =========== + form_fields = { "userId" => "#{Time.now.to_i}" } + # ================================== + + args.gtk.http_post "http://localhost:9001/testing", + form_fields, + ["Content-Type: application/x-www-form-urlencoded"] + + args.gtk.notify! "http_post" + end + + # ============= HTTP_POST_BODY ============= + if (args.inputs.mouse.inside_rect? args.state.post_body_button) + # =========== DATA TO SEND ============== + json = "{ \"userId\": \"#{Time.now.to_i}\"}" + # ================================== + + args.gtk.http_post_body "http://localhost:9001/testing", + json, + ["Content-Type: application/json", "Content-Length: #{json.length}"] + + args.gtk.notify! "http_post_body" + end + end + + # calc + args.inputs.http_requests.each do |r| + puts "#{r}" + if r.uri == "/testing" + puts r + args.state.request_to_s = "#{r}" + args.state.request_body = r.raw_body + r.respond 200, "ok" + end + end +end + +def draw_label args, row, col, header, text + label_pos = args.layout.rect(row: row, col: col, w: 0, h: 0) + args.outputs.labels << "#{header}\n\n#{text}".wrapped_lines(80).map_with_index do |l, i| + { x: label_pos.x, y: label_pos.y - (i * 15), text: l, size_enum: -2 } + end +end + +</code></pre> +<h3 id='----c-extensions---basics---main-rb'>C Extensions - Basics - main.rb</h3> <pre><code class="language-ruby"># ./samples/12_c_extensions/01_basics/app/main.rb $gtk.ffi_misc.gtk_dlopen("ext") include FFI::CExt @@ -14976,7 +16137,7 @@ end </code></pre> -<h3 id='----c-extensions---intermediate---main.rb'>C Extensions - Intermediate - main.rb</h3> +<h3 id='----c-extensions---intermediate---main-rb'>C Extensions - Intermediate - main.rb</h3> <pre><code class="language-ruby"># ./samples/12_c_extensions/02_intermediate/app/main.rb $gtk.ffi_misc.gtk_dlopen("ext") include FFI::RE @@ -14999,7 +16160,7 @@ def tick args end </code></pre> -<h3 id='----c-extensions---native-pixel-arrays---main.rb'>C Extensions - Native Pixel Arrays - main.rb</h3> +<h3 id='----c-extensions---native-pixel-arrays---main-rb'>C Extensions - Native Pixel Arrays - main.rb</h3> <pre><code class="language-ruby"># ./samples/12_c_extensions/03_native_pixel_arrays/app/main.rb $gtk.ffi_misc.gtk_dlopen("ext") include FFI::CExt @@ -15025,7 +16186,7 @@ end </code></pre> -<h3 id='----path-finding-algorithms---breadth-first-search---main.rb'>Path Finding Algorithms - Breadth First Search - main.rb</h3> +<h3 id='----path-finding-algorithms---breadth-first-search---main-rb'>Path Finding Algorithms - Breadth First Search - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/01_breadth_first_search/app/main.rb # A visual demonstration of a breadth first search # Inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html @@ -15721,7 +16882,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---detailed-breadth-first-search---main.rb'>Path Finding Algorithms - Detailed Breadth First Search - main.rb</h3> +<h3 id='----path-finding-algorithms---detailed-breadth-first-search---main-rb'>Path Finding Algorithms - Detailed Breadth First Search - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/02_detailed_breadth_first_search/app/main.rb # A visual demonstration of a breadth first search # Inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html @@ -16371,7 +17532,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---breadcrumbs---main.rb'>Path Finding Algorithms - Breadcrumbs - main.rb</h3> +<h3 id='----path-finding-algorithms---breadcrumbs---main-rb'>Path Finding Algorithms - Breadcrumbs - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/03_breadcrumbs/app/main.rb class Breadcrumbs attr_gtk @@ -16895,7 +18056,7 @@ def tick args end # Every tick, new args are passed, and the Breadth First Search tick is called - $breadcrumbs ||= Breadcrumbs.new(args) + $breadcrumbs ||= Breadcrumbs.new $breadcrumbs.args = args $breadcrumbs.tick end @@ -16920,7 +18081,7 @@ end # end </code></pre> -<h3 id='----path-finding-algorithms---early-exit---main.rb'>Path Finding Algorithms - Early Exit - main.rb</h3> +<h3 id='----path-finding-algorithms---early-exit---main-rb'>Path Finding Algorithms - Early Exit - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/04_early_exit/app/main.rb # Comparison of a breadth first search with and without early exit # Inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html @@ -17544,7 +18705,7 @@ def tick args end # Every tick, new args are passed, and the Breadth First Search tick is called - $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new(args) + $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new $early_exit_breadth_first_search.args = args $early_exit_breadth_first_search.tick end @@ -17555,7 +18716,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---dijkstra---main.rb'>Path Finding Algorithms - Dijkstra - main.rb</h3> +<h3 id='----path-finding-algorithms---dijkstra---main-rb'>Path Finding Algorithms - Dijkstra - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/05_dijkstra/app/main.rb # Demonstrates how Dijkstra's Algorithm allows movement costs to be considered @@ -18392,7 +19553,7 @@ def tick args end # Every tick, new args are passed, and the Dijkstra tick method is called - $movement_costs ||= Movement_Costs.new(args) + $movement_costs ||= Movement_Costs.new $movement_costs.args = args $movement_costs.tick end @@ -18403,7 +19564,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---heuristic---main.rb'>Path Finding Algorithms - Heuristic - main.rb</h3> +<h3 id='----path-finding-algorithms---heuristic---main-rb'>Path Finding Algorithms - Heuristic - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/06_heuristic/app/main.rb # This program is inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html @@ -19376,7 +20537,7 @@ def tick args end # Every tick, new args are passed, and the Breadth First Search tick is called - $heuristic_with_walls ||= Heuristic_With_Walls.new(args) + $heuristic_with_walls ||= Heuristic_With_Walls.new $heuristic_with_walls.args = args $heuristic_with_walls.tick end @@ -19387,7 +20548,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---heuristic-with-walls---main.rb'>Path Finding Algorithms - Heuristic With Walls - main.rb</h3> +<h3 id='----path-finding-algorithms---heuristic-with-walls---main-rb'>Path Finding Algorithms - Heuristic With Walls - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/07_heuristic_with_walls/app/main.rb # This program is inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html # The effectiveness of the Heuristic search algorithm is shown through this demonstration. @@ -20393,7 +21554,7 @@ def tick args end # Every tick, new args are passed, and the Breadth First Search tick is called - $heuristic ||= Heuristic.new(args) + $heuristic ||= Heuristic.new $heuristic.args = args $heuristic.tick end @@ -20404,7 +21565,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---a-star---main.rb'>Path Finding Algorithms - A Star - main.rb</h3> +<h3 id='----path-finding-algorithms---a-star---main-rb'>Path Finding Algorithms - A Star - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/08_a_star/app/main.rb # This program is inspired by https://www.redblobgames.com/pathfinding/a-star/introduction.html @@ -21426,7 +22587,7 @@ def tick args end # Every tick, new args are passed, and the Breadth First Search tick is called - $a_star_algorithm ||= A_Star_Algorithm.new(args) + $a_star_algorithm ||= A_Star_Algorithm.new $a_star_algorithm.args = args $a_star_algorithm.tick end @@ -21437,7 +22598,7 @@ def reset end </code></pre> -<h3 id='----path-finding-algorithms---tower-defense---main.rb'>Path Finding Algorithms - Tower Defense - main.rb</h3> +<h3 id='----path-finding-algorithms---tower-defense---main-rb'>Path Finding Algorithms - Tower Defense - main.rb</h3> <pre><code class="language-ruby"># ./samples/13_path_finding_algorithms/09_tower_defense/app/main.rb # An example of some major components in a tower defence game # The pathing of the tanks is determined by A* algorithm -- try editing the walls @@ -21742,7 +22903,7 @@ def a_star_color end </code></pre> -<h3 id='----3d---3d-cube---main.rb'>3d - 3d Cube - main.rb</h3> +<h3 id='----3d---3d-cube---main-rb'>3d - 3d Cube - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_3d/01_3d_cube/app/main.rb STARTX = 0.0 STARTY = 0.0 @@ -21796,7 +22957,7 @@ end $gtk.reset </code></pre> -<h3 id='----3d---wireframe---main.rb'>3d - Wireframe - main.rb</h3> +<h3 id='----3d---wireframe---main-rb'>3d - Wireframe - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_3d/02_wireframe/app/main.rb def tick args args.state.model ||= Object3D.new('data/shuttle.off') @@ -21949,11 +23110,366 @@ class Vertex end end </code></pre> -<h3 id='----3d---wireframe---data---what-is-this.txt'>3d - Wireframe - Data - what-is-this.txt</h3> +<h3 id='----3d---wireframe---data---what-is-this-txt'>3d - Wireframe - Data - what-is-this.txt</h3> <pre><code class="language-ruby"># ./samples/99_genre_3d/02_wireframe/data/what-is-this.txt https://en.wikipedia.org/wiki/OFF_(file_format) </code></pre> -<h3 id='----arcade---bullet-hell---main.rb'>Arcade - Bullet Hell - main.rb</h3> +<h3 id='----3d---yaw-pitch-roll---main-rb'>3d - Yaw Pitch Roll - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_3d/03_yaw_pitch_roll/app/main.rb +class Game + attr_gtk + + def tick + defaults + render + input + end + + def matrix_mul m, v + (hmap x: ((m.x.x * v.x) + (m.x.y * v.y) + (m.x.z * v.z) + (m.x.w * v.w)), + y: ((m.y.x * v.x) + (m.y.y * v.y) + (m.y.z * v.z) + (m.y.w * v.w)), + z: ((m.z.x * v.x) + (m.z.y * v.y) + (m.z.z * v.z) + (m.z.w * v.w)), + w: ((m.w.x * v.x) + (m.w.y * v.y) + (m.w.z * v.z) + (m.w.w * v.w))) + end + + def player_ship + [ + # engine back + { x: -1, y: -1, z: 1, w: 0 }, + { x: -1, y: 1, z: 1, w: 0 }, + + { x: -1, y: 1, z: 1, w: 0 }, + { x: 1, y: 1, z: 1, w: 0 }, + + { x: 1, y: 1, z: 1, w: 0 }, + { x: 1, y: -1, z: 1, w: 0 }, + + { x: 1, y: -1, z: 1, w: 0 }, + { x: -1, y: -1, z: 1, w: 0 }, + + # engine front + { x: -1, y: -1, z: -1, w: 0 }, + { x: -1, y: 1, z: -1, w: 0 }, + + { x: -1, y: 1, z: -1, w: 0 }, + { x: 1, y: 1, z: -1, w: 0 }, + + { x: 1, y: 1, z: -1, w: 0 }, + { x: 1, y: -1, z: -1, w: 0 }, + + { x: 1, y: -1, z: -1, w: 0 }, + { x: -1, y: -1, z: -1, w: 0 }, + + # engine left + { x: -1, z: -1, y: -1, w: 0 }, + { x: -1, z: -1, y: 1, w: 0 }, + + { x: -1, z: -1, y: 1, w: 0 }, + { x: -1, z: 1, y: 1, w: 0 }, + + { x: -1, z: 1, y: 1, w: 0 }, + { x: -1, z: 1, y: -1, w: 0 }, + + { x: -1, z: 1, y: -1, w: 0 }, + { x: -1, z: -1, y: -1, w: 0 }, + + # engine right + { x: 1, z: -1, y: -1, w: 0 }, + { x: 1, z: -1, y: 1, w: 0 }, + + { x: 1, z: -1, y: 1, w: 0 }, + { x: 1, z: 1, y: 1, w: 0 }, + + { x: 1, z: 1, y: 1, w: 0 }, + { x: 1, z: 1, y: -1, w: 0 }, + + { x: 1, z: 1, y: -1, w: 0 }, + { x: 1, z: -1, y: -1, w: 0 }, + + # top front of engine to front of ship + { x: 1, y: 1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + { x: 0, y: -1, z: 9, w: 0 }, + { x: -1, y: 1, z: 1, w: 0 }, + + # bottom front of engine + { x: 1, y: -1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + { x: -1, y: -1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + # right wing + # front of wing + { x: 1, y: 0.10, z: 1, w: 0 }, + { x: 9, y: 0.10, z: -1, w: 0 }, + + { x: 9, y: 0.10, z: -1, w: 0 }, + { x: 10, y: 0.10, z: -2, w: 0 }, + + # back of wing + { x: 1, y: 0.10, z: -1, w: 0 }, + { x: 9, y: 0.10, z: -1, w: 0 }, + + { x: 10, y: 0.10, z: -2, w: 0 }, + { x: 8, y: 0.10, z: -1, w: 0 }, + + # front of wing + { x: 1, y: -0.10, z: 1, w: 0 }, + { x: 9, y: -0.10, z: -1, w: 0 }, + + { x: 9, y: -0.10, z: -1, w: 0 }, + { x: 10, y: -0.10, z: -2, w: 0 }, + + # back of wing + { x: 1, y: -0.10, z: -1, w: 0 }, + { x: 9, y: -0.10, z: -1, w: 0 }, + + { x: 10, y: -0.10, z: -2, w: 0 }, + { x: 8, y: -0.10, z: -1, w: 0 }, + + # left wing + # front of wing + { x: -1, y: 0.10, z: 1, w: 0 }, + { x: -9, y: 0.10, z: -1, w: 0 }, + + { x: -9, y: 0.10, z: -1, w: 0 }, + { x: -10, y: 0.10, z: -2, w: 0 }, + + # back of wing + { x: -1, y: 0.10, z: -1, w: 0 }, + { x: -9, y: 0.10, z: -1, w: 0 }, + + { x: -10, y: 0.10, z: -2, w: 0 }, + { x: -8, y: 0.10, z: -1, w: 0 }, + + # front of wing + { x: -1, y: -0.10, z: 1, w: 0 }, + { x: -9, y: -0.10, z: -1, w: 0 }, + + { x: -9, y: -0.10, z: -1, w: 0 }, + { x: -10, y: -0.10, z: -2, w: 0 }, + + # back of wing + { x: -1, y: -0.10, z: -1, w: 0 }, + { x: -9, y: -0.10, z: -1, w: 0 }, + + { x: -10, y: -0.10, z: -2, w: 0 }, + { x: -8, y: -0.10, z: -1, w: 0 }, + + # left fin + # top + { x: -1, y: 0.10, z: 1, w: 0 }, + { x: -1, y: 3, z: -3, w: 0 }, + + { x: -1, y: 0.10, z: -1, w: 0 }, + { x: -1, y: 3, z: -3, w: 0 }, + + { x: -1.1, y: 0.10, z: 1, w: 0 }, + { x: -1.1, y: 3, z: -3, w: 0 }, + + { x: -1.1, y: 0.10, z: -1, w: 0 }, + { x: -1.1, y: 3, z: -3, w: 0 }, + + # bottom + { x: -1, y: -0.10, z: 1, w: 0 }, + { x: -1, y: -2, z: -2, w: 0 }, + + { x: -1, y: -0.10, z: -1, w: 0 }, + { x: -1, y: -2, z: -2, w: 0 }, + + { x: -1.1, y: -0.10, z: 1, w: 0 }, + { x: -1.1, y: -2, z: -2, w: 0 }, + + { x: -1.1, y: -0.10, z: -1, w: 0 }, + { x: -1.1, y: -2, z: -2, w: 0 }, + + # right fin + { x: 1, y: 0.10, z: 1, w: 0 }, + { x: 1, y: 3, z: -3, w: 0 }, + + { x: 1, y: 0.10, z: -1, w: 0 }, + { x: 1, y: 3, z: -3, w: 0 }, + + { x: 1.1, y: 0.10, z: 1, w: 0 }, + { x: 1.1, y: 3, z: -3, w: 0 }, + + { x: 1.1, y: 0.10, z: -1, w: 0 }, + { x: 1.1, y: 3, z: -3, w: 0 }, + + # bottom + { x: 1, y: -0.10, z: 1, w: 0 }, + { x: 1, y: -2, z: -2, w: 0 }, + + { x: 1, y: -0.10, z: -1, w: 0 }, + { x: 1, y: -2, z: -2, w: 0 }, + + { x: 1.1, y: -0.10, z: 1, w: 0 }, + { x: 1.1, y: -2, z: -2, w: 0 }, + + { x: 1.1, y: -0.10, z: -1, w: 0 }, + { x: 1.1, y: -2, z: -2, w: 0 }, + ] + end + + def defaults + state.points ||= player_ship + state.shifted_points ||= state.points.map { |point| point } + + state.scale ||= 1 + state.angle_x ||= 0 + state.angle_y ||= 0 + state.angle_z ||= 0 + end + + def matrix_new x0, y0, z0, w0, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3 + (hmap x: (hmap x: x0, y: y0, z: z0, w: w0), + y: (hmap x: x1, y: y1, z: z1, w: w1), + z: (hmap x: x2, y: y2, z: z2, w: w2), + w: (hmap x: x3, y: y3, z: z3, w: w3)) + end + + def angle_z_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new cos_t, -sin_t, 0, 0, + sin_t, cos_t, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1) + end + + def angle_y_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new cos_t, 0, sin_t, 0, + 0, 1, 0, 0, + -sin_t, 0, cos_t, 0, + 0, 0, 0, 1) + end + + def angle_x_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new 1, 0, 0, 0, + 0, cos_t, -sin_t, 0, + 0, sin_t, cos_t, 0, + 0, 0, 0, 1) + end + + def scale_matrix factor + (matrix_new factor, 0, 0, 0, + 0, factor, 0, 0, + 0, 0, factor, 0, + 0, 0, 0, 1) + end + + def input + if (inputs.keyboard.shift && inputs.keyboard.p) + state.scale -= 0.1 + elsif inputs.keyboard.p + state.scale += 0.1 + end + + if inputs.mouse.wheel + state.scale += inputs.mouse.wheel.y + end + + state.scale = state.scale.clamp(0.1, 1000) + + if (inputs.keyboard.shift && inputs.keyboard.y) || inputs.keyboard.right + state.angle_y += 1 + elsif (inputs.keyboard.y) || inputs.keyboard.left + state.angle_y -= 1 + end + + if (inputs.keyboard.shift && inputs.keyboard.x) || inputs.keyboard.down + state.angle_x -= 1 + elsif (inputs.keyboard.x || inputs.keyboard.up) + state.angle_x += 1 + end + + if inputs.keyboard.shift && inputs.keyboard.z + state.angle_z += 1 + elsif inputs.keyboard.z + state.angle_z -= 1 + end + + if inputs.keyboard.zero + state.angle_x = 0 + state.angle_y = 0 + state.angle_z = 0 + end + + angle_x = state.angle_x + angle_y = state.angle_y + angle_z = state.angle_z + scale = state.scale + + s_matrix = scale_matrix state.scale + x_matrix = angle_z_matrix angle_z + y_matrix = angle_y_matrix angle_y + z_matrix = angle_x_matrix angle_x + + state.shifted_points = state.points.map do |point| + (matrix_mul s_matrix, + (matrix_mul z_matrix, + (matrix_mul x_matrix, + (matrix_mul y_matrix, point)))).merge(original: point) + end + end + + def thick_line line + [ + line.merge(y: line.y - 1, y2: line.y2 - 1, r: 0, g: 0, b: 0), + line.merge(x: line.x - 1, x2: line.x2 - 1, r: 0, g: 0, b: 0), + line.merge(x: line.x - 0, x2: line.x2 - 0, r: 0, g: 0, b: 0), + line.merge(y: line.y + 1, y2: line.y2 + 1, r: 0, g: 0, b: 0), + line.merge(x: line.x + 1, x2: line.x2 + 1, r: 0, g: 0, b: 0) + ] + end + + def render + outputs.lines << state.shifted_points.each_slice(2).map do |(p1, p2)| + perc = 0 + thick_line({ x: p1.x.*(10) + 640, y: p1.y.*(10) + 320, + x2: p2.x.*(10) + 640, y2: p2.y.*(10) + 320, + r: 255 * perc, + g: 255 * perc, + b: 255 * perc }) + end + + outputs.labels << [ 10, 700, "angle_x: #{state.angle_x.to_sf}", 0] + outputs.labels << [ 10, 670, "x, shift+x", 0] + + outputs.labels << [210, 700, "angle_y: #{state.angle_y.to_sf}", 0] + outputs.labels << [210, 670, "y, shift+y", 0] + + outputs.labels << [410, 700, "angle_z: #{state.angle_z.to_sf}", 0] + outputs.labels << [410, 670, "z, shift+z", 0] + + outputs.labels << [610, 700, "scale: #{state.scale.to_sf}", 0] + outputs.labels << [610, 670, "p, shift+p", 0] + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.tick +end + +def set_angles x, y, z + $game.state.angle_x = x + $game.state.angle_y = y + $game.state.angle_z = z +end + +$gtk.reset + +</code></pre> +<h3 id='----arcade---bullet-hell---main-rb'>Arcade - Bullet Hell - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/bullet_hell/app/main.rb def tick args args.state.base_columns ||= 10.times.map { |n| 50 * n + 1280 / 2 - 5 * 50 + 5 } @@ -22146,7 +23662,7 @@ def update_enemy_positions args end </code></pre> -<h3 id='----arcade---dueling-starships---main.rb'>Arcade - Dueling Starships - main.rb</h3> +<h3 id='----arcade---dueling-starships---main-rb'>Arcade - Dueling Starships - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/dueling_starships/app/main.rb class DuelingSpaceships attr_accessor :state, :inputs, :outputs, :grid @@ -22515,14 +24031,14 @@ def tick args end </code></pre> -<h3 id='----arcade/flappy-dragon/credits.txt'>arcade/flappy dragon/credits.txt</h3> +<h3 id='----arcade/flappy-dragon/credits-txt'>arcade/flappy dragon/credits.txt</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt code: Amir Rajan, https://twitter.com/amirrajan graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel </code></pre> -<h3 id='----arcade/flappy-dragon/main.rb'>arcade/flappy dragon/main.rb</h3> +<h3 id='----arcade/flappy-dragon/main-rb'>arcade/flappy dragon/main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/flappy_dragon/app/main.rb class FlappyDragon attr_accessor :grid, :inputs, :state, :outputs @@ -22564,31 +24080,36 @@ class FlappyDragon end def render_score - outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label - outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label - outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + outputs.primitives << { x: 10, y: 710, text: "HI SCORE: #{state.hi_score}", **large_white_typeset } + outputs.primitives << { x: 10, y: 680, text: "SCORE: #{state.score}", **large_white_typeset } + outputs.primitives << { x: 10, y: 650, text: "DIFFICULTY: #{state.difficulty.upcase}", **large_white_typeset } end def render_menu return unless state.scene == :menu render_overlay - outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] - outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] - outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] - outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] - outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] - outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] - outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + outputs.labels << { x: 640, y: 700, text: "Flappy Dragon", size_enum: 50, alignment_enum: 1, **white } + outputs.labels << { x: 640, y: 500, text: "Instructions: Press Spacebar to flap. Don't die.", size_enum: 4, alignment_enum: 1, **white } + outputs.labels << { x: 430, y: 430, text: "[Tab] Change difficulty", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 430, y: 400, text: "[Enter] Start at New Difficulty ", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 430, y: 370, text: "[Escape] Cancel/Resume ", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 640, y: 300, text: "(mouse, touch, and game controllers work, too!) ", size_enum: 4, alignment_enum: 1, **white } + outputs.labels << { x: 640, y: 200, text: "Difficulty: #{state.new_difficulty.capitalize}", size_enum: 4, alignment_enum: 1, **white } - outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] - outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] - outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] - outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + outputs.labels << { x: 10, y: 100, text: "Code: @amirrajan", **white } + outputs.labels << { x: 10, y: 80, text: "Art: @mobypixel", **white } + outputs.labels << { x: 10, y: 60, text: "Music: @mobypixel", **white } + outputs.labels << { x: 10, y: 40, text: "Engine: DragonRuby GTK", **white } end def render_overlay - outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + overlay_rect = grid.rect.scale_rect(1.1, 0, 0) + outputs.primitives << { x: overlay_rect.x, + y: overlay_rect.y, + w: overlay_rect.w, + h: overlay_rect.h, + r: 0, g: 0, b: 0, a: 230 }.solid! end def render_game @@ -22601,14 +24122,14 @@ class FlappyDragon def render_game_over return unless state.scene == :game - outputs.labels << [638, 358, score_text, 20, 1] - outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] - outputs.labels << [638, 428, countdown_text, 20, 1] - outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + outputs.labels << { x: 638, y: 358, text: score_text, size_enum: 20, alignment_enum: 1 } + outputs.labels << { x: 635, y: 360, text: score_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } + outputs.labels << { x: 638, y: 428, text: countdown_text, size_enum: 20, alignment_enum: 1 } + outputs.labels << { x: 635, y: 430, text: countdown_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } end def render_background - outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: 'sprites/background.png' } scroll_point_at = state.tick_count scroll_point_at = state.scene_at if state.scene == :menu @@ -22620,11 +24141,18 @@ class FlappyDragon outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) end + def scrolling_background at, path, rate, y = 0 + [ + { x: 0 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path }, + { x: 1440 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path } + ] + end + def render_walls state.walls.each do |w| w.sprites = [ - [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], - [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] + { x: w.x, y: w.bottom_height - 720, w: 100, h: 720, path: 'sprites/wall.png', angle: 180 }, + { x: w.x, y: w.top_y, w: 100, h: 720, path: 'sprites/wallbottom.png', angle: 0 } ] end outputs.sprites << state.walls.map(&:sprites) @@ -22633,15 +24161,13 @@ class FlappyDragon def render_dragon state.show_death = true if state.countdown == 3.seconds - render_debug_hitbox false - if state.show_death == false || !state.death_at animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } else sprite_name = "sprites/dragon_die.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction @@ -22651,20 +24177,12 @@ class FlappyDragon outputs.sprites << state.dragon_sprite end - def render_debug_hitbox show - return unless show - outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite - outputs.borders << state.walls.flat_map do |w| - w.sprites.map { |s| [s.rect, 255, 0, 0] } - end - end - def render_flash return unless state.flash_at - outputs.primitives << [grid.rect, - white, - 255 * state.flash_at.ease(20, :flip)].solid + outputs.primitives << { **grid.rect.to_hash, + **white, + a: 255 * state.flash_at.ease(20, :flip) }.solid! state.flash_at = 0 if state.flash_at.elapsed_time > 20 end @@ -22784,19 +24302,12 @@ class FlappyDragon end end - def scrolling_background at, path, rate, y = 0 - [ - [ 0 - at.*(rate) % 1440, y, 1440, 720, path], - [1440 - at.*(rate) % 1440, y, 1440, 720, path] - ] - end - def white - [255, 255, 255] + { r: 255, g: 255, b: 255 } end def large_white_typeset - [5, 0, 255, 255, 255] + { size_enum: 5, alignment_enum: 0, r: 255, g: 255, b: 255 } end def at_beginning? @@ -22805,9 +24316,9 @@ class FlappyDragon def dragon_collision_box state.dragon_sprite - .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) - .rect_shift_right(10) - .rect_shift_up(state.dy * 2) + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) + .rect_shift_right(10) + .rect_shift_up(state.dy * 2) end def game_over? @@ -22816,7 +24327,7 @@ class FlappyDragon state.walls .flat_map { |w| w.sprites } .any? do |s| - s.intersect_rect?(dragon_collision_box) + s && s.intersect_rect?(dragon_collision_box) end end @@ -22886,7 +24397,7 @@ def tick args end </code></pre> -<h3 id='----arcade---pong---main.rb'>Arcade - Pong - main.rb</h3> +<h3 id='----arcade---pong---main-rb'>Arcade - Pong - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/pong/app/main.rb def tick args defaults args @@ -23049,7 +24560,7 @@ begin :assets end </code></pre> -<h3 id='----arcade---snakemoji---main.rb'>Arcade - Snakemoji - main.rb</h3> +<h3 id='----arcade---snakemoji---main-rb'>Arcade - Snakemoji - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/snakemoji/app/main.rb # coding: utf-8 ################################ @@ -23218,7 +24729,7 @@ def defaults 🎮 end </code></pre> -<h3 id='----arcade---solar-system---main.rb'>Arcade - Solar System - main.rb</h3> +<h3 id='----arcade---solar-system---main-rb'>Arcade - Solar System - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/solar_system/app/main.rb # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 @@ -23330,7 +24841,7 @@ def r end </code></pre> -<h3 id='----arcade---sound-golf---main.rb'>Arcade - Sound Golf - main.rb</h3> +<h3 id='----arcade---sound-golf---main-rb'>Arcade - Sound Golf - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/sound_golf/app/main.rb =begin @@ -23524,7 +25035,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----arcade---twinstick---main.rb'>Arcade - Twinstick - main.rb</h3> +<h3 id='----arcade---twinstick---main-rb'>Arcade - Twinstick - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_arcade/twinstick/app/main.rb def tick args args.state.player ||= {x: 600, y: 320, w: 80, h: 80, path: 'sprites/circle-white.png', vx: 0, vy: 0, health: 10, cooldown: 0, score: 0} @@ -23678,7 +25189,7 @@ def shoot_directional_vector args [dx, dy] end </code></pre> -<h3 id='----crafting---craft-game-starting-point---main.rb'>Crafting - Craft Game Starting Point - main.rb</h3> +<h3 id='----crafting---craft-game-starting-point---main-rb'>Crafting - Craft Game Starting Point - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb # ================================================== # A NOTE TO JAM CRAFT PARTICIPANTS: @@ -24105,7 +25616,128 @@ end $gtk.reset </code></pre> -<h3 id='----dev-tools---add-buttons-to-console---main.rb'>Dev Tools - Add Buttons To Console - main.rb</h3> +<h3 id='----crafting---farming-game-starting-point---main-rb'>Crafting - Farming Game Starting Point - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_crafting/farming_game_starting_point/app/main.rb +def tick args + args.state.tile_size = 80 + args.state.player_speed = 4 + args.state.player ||= tile(args, 7, 3, 0, 128, 180) + generate_map args + #press j to plant a green onion + if args.inputs.keyboard.j + #change this part you can change what you want to plant + args.state.walls << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y)/args.state.tile_size), 255, 255, 255) + args.state.plants << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y+80)/args.state.tile_size), 0, 160, 0) + end + # Adds walls, background, and player to args.outputs.solids so they appear on screen + args.outputs.solids << [0,0,1280,720, 237,189,101] + args.outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + args.outputs.solids << args.state.walls + args.outputs.solids << args.state.player + args.outputs.solids << args.state.plants + args.outputs.labels << [320, 640, "press J to plant", 3, 1, 255, 0, 0, 200] + + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed +end + +# Sets position, size, and color of the tile +def tile args, x, y, *color + [x * args.state.tile_size, # sets definition for array using method parameters + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values + args.state.tile_size, + args.state.tile_size, + *color] +end + +# Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) +def generate_map args + return if args.state.area + + # Creates the area of the map. There are 9 rows running horizontally across the screen + # and 16 columns running vertically on the screen. Any spot with a "1" is not + # open for the player to move into (and is green), and any spot with a "0" is available + # for the player to move in. + args.state.area = [ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + ].reverse # reverses the order of the area collection + + # By reversing the order, the way that the area appears above is how it appears + # on the screen in the game. If we did not reverse, the map would appear inverted. + + #The wall starts off with no tiles. + args.state.walls = [] + args.state.plants = [] + + # If v is 1, a green tile is added to args.state.walls. + # If v is 2, a black tile is created as the goal. + args.state.area.map_2d do |y, x, v| + if v == 1 + args.state.walls << tile(args, x, y, 255, 160, 156) # green tile + end + end +end + +# Allows the player to move their box around the screen +def move_player args, *vector + box = args.state.player.shift_rect(vector) # box is able to move at an angle + + # If the player's box hits a wall, it is not able to move further in that direction + return if args.state.walls + .any_intersect_rect?(box) + + # Player's box is able to move at angles (not just the four general directions) fast + args.state.player = + args.state.player + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then + vector.y * args.state.player_speed) # the box will move extremely slow +end + +</code></pre> +<h3 id='----crafting---farming-game-starting-point---tests-rb'>Crafting - Farming Game Starting Point - tests.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_crafting/farming_game_starting_point/app/tests.rb +# For advanced users: +# You can put some quick verification tests here, any method +# that starts with the `test_` will be run when you save this file. + +# Here is an example test and game + +# To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick + +class MySuperHappyFunGame + attr_gtk + + def tick + outputs.solids << [100, 100, 300, 300] + end +end + +def test_universe args, assert + game = MySuperHappyFunGame.new + game.args = args + game.tick + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" + puts "test_universe completed successfully" +end + +puts "running tests" +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start + +</code></pre> +<h3 id='----dev-tools---add-buttons-to-console---main-rb'>Dev Tools - Add Buttons To Console - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb # You can customize the buttons that show up in the Console. class GTK::Console::Menu @@ -24167,7 +25799,7 @@ def tick args end </code></pre> -<h3 id='----dev-tools---animation-creator-starting-point---main.rb'>Dev Tools - Animation Creator Starting Point - main.rb</h3> +<h3 id='----dev-tools---animation-creator-starting-point---main-rb'>Dev Tools - Animation Creator Starting Point - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb class OneBitLowrezPaint attr_gtk @@ -24272,12 +25904,12 @@ class OneBitLowrezPaint label = { x: b.x + state.buttons_frame_selection.size.half, y: b.y, text: "#{i + 1}", r: 180, g: 180, b: 180, - size_enum: -4, alignment_enum: 1 }.label + size_enum: -4, alignment_enum: 1 }.label! - selection_border = b.merge(r: 40, g: 40, b: 40).border + selection_border = b.merge(r: 40, g: 40, b: 40).border! if i == state.animation_frames_selected_index - selection_border = b.merge(r: 40, g: 230, b: 200).border + selection_border = b.merge(r: 40, g: 230, b: 200).border! end [selection_border, label] @@ -24616,7 +26248,7 @@ end # $gtk.reset </code></pre> -<h3 id='----dev-tools---tile-editor-starting-point---main.rb'>Dev Tools - Tile Editor Starting Point - main.rb</h3> +<h3 id='----dev-tools---tile-editor-starting-point---main-rb'>Dev Tools - Tile Editor Starting Point - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb =begin @@ -25011,7 +26643,525 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----lowrez---nokia-3310---main.rb'>Lowrez - Nokia 3310 - main.rb</h3> +<h3 id='----dungeon-crawl---classics-jam---main-rb'>Dungeon Crawl - Classics Jam - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_dungeon_crawl/classics_jam/app/main.rb +class Game + attr_gtk + + def tick + defaults + render + input + calc + end + + def defaults + player.x ||= 640 + player.y ||= 360 + player.w ||= 16 + player.h ||= 16 + player.attacked_at ||= -1 + player.angle ||= 0 + player.future_player ||= future_player_position 0, 0 + player.projectiles ||= [] + player.damage ||= 0 + state.level ||= create_level level_one_template + end + + def render + outputs.sprites << level.walls.map do |w| + w.merge(path: 'sprites/square/gray.png') + end + + outputs.sprites << level.spawn_locations.map do |s| + s.merge(path: 'sprites/square/blue.png') + end + + outputs.sprites << player.projectiles.map do |p| + p.merge(path: 'sprites/square/blue.png') + end + + outputs.sprites << level.enemies.map do |e| + e.merge(path: 'sprites/square/red.png') + end + + outputs.sprites << player.merge(path: 'sprites/circle/green.png', angle: player.angle) + + outputs.labels << { x: 30, y: 30.from_top, text: "damage: #{player.damage || 0}" } + end + + def input + player.angle = inputs.directional_angle || player.angle + if inputs.controller_one.key_down.a || inputs.keyboard.key_down.space + player.attacked_at = state.tick_count + end + end + + def calc + calc_player + calc_projectiles + calc_enemies + calc_spawn_locations + end + + def calc_player + if player.attacked_at == state.tick_count + player.projectiles << { at: state.tick_count, + x: player.x, + y: player.y, + angle: player.angle, + w: 4, + h: 4 }.center_inside_rect(player) + end + + if player.attacked_at.elapsed_time > 5 + future_player = future_player_position inputs.left_right * 2, inputs.up_down * 2 + future_player_collision = future_collision player, future_player, level.walls + player.x = future_player_collision.x if !future_player_collision.dx_collision + player.y = future_player_collision.y if !future_player_collision.dy_collision + end + end + + def calc_projectile_collisions entities + entities.each do |e| + e.damage ||= 0 + player.projectiles.each do |p| + if !p.collided && (p.intersect_rect? e) + p.collided = true + e.damage += 1 + end + end + end + end + + def calc_projectiles + player.projectiles.map! do |p| + dx, dy = p.angle.vector 10 + p.merge(x: p.x + dx, y: p.y + dy) + end + + calc_projectile_collisions level.walls + level.enemies + level.spawn_locations + player.projectiles.reject! { |p| p.at.elapsed_time > 10000 } + player.projectiles.reject! { |p| p.collided } + level.enemies.reject! { |e| e.damage > e.hp } + level.spawn_locations.reject! { |s| s.damage > s.hp } + end + + def calc_enemies + level.enemies.map! do |e| + dx = 0 + dx = 1 if e.x < player.x + dx = -1 if e.x > player.x + dy = 0 + dy = 1 if e.y < player.y + dy = -1 if e.y > player.y + future_e = future_entity_position dx, dy, e + future_e_collision = future_collision e, future_e, level.enemies + level.walls + e.next_x = e.x + e.next_y = e.y + e.next_x = future_e_collision.x if !future_e_collision.dx_collision + e.next_y = future_e_collision.y if !future_e_collision.dy_collision + e + end + + level.enemies.map! do |e| + e.x = e.next_x + e.y = e.next_y + e + end + + level.enemies.each do |e| + player.damage += 1 if e.intersect_rect? player + end + end + + def calc_spawn_locations + level.spawn_locations.map! do |s| + s.merge(countdown: s.countdown - 1) + end + level.spawn_locations + .find_all { |s| s.countdown.neg? } + .each do |s| + s.countdown = s.rate + s.merge(countdown: s.rate) + new_enemy = create_enemy s + if !(level.enemies.find { |e| e.intersect_rect? new_enemy }) + level.enemies << new_enemy + end + end + end + + def create_enemy spawn_location + to_cell(spawn_location.ordinal_x, spawn_location.ordinal_y).merge hp: 2 + end + + def create_level level_template + { + walls: level_template.walls.map { |w| to_cell(w.ordinal_x, w.ordinal_y).merge(w) }, + enemies: [], + spawn_locations: level_template.spawn_locations.map { |s| to_cell(s.ordinal_x, s.ordinal_y).merge(s) } + } + end + + def level_one_template + { + walls: [{ ordinal_x: 25, ordinal_y: 20}, + { ordinal_x: 25, ordinal_y: 21}, + { ordinal_x: 25, ordinal_y: 22}, + { ordinal_x: 25, ordinal_y: 23}], + spawn_locations: [{ ordinal_x: 10, ordinal_y: 10, rate: 120, countdown: 0, hp: 5 }] + } + end + + def player + state.player ||= {} + end + + def level + state.level ||= {} + end + + def future_collision entity, future_entity, others + dx_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dx) } + dy_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dy) } + + { + dx_collision: dx_collision, + x: future_entity.dx.x, + dy_collision: dy_collision, + y: future_entity.dy.y + } + end + + def future_entity_position dx, dy, entity + { + dx: entity.merge(x: entity.x + dx), + dy: entity.merge(y: entity.y + dy), + both: entity.merge(x: entity.x + dx, y: entity.y + dy) + } + end + + def future_player_position dx, dy + future_entity_position dx, dy, player + end + + def to_cell ordinal_x, ordinal_y + { x: ordinal_x * 16, y: ordinal_y * 16, w: 16, h: 16 } + end +end + +def tick args + $game ||= Game.new + $game.args = args + $game.tick +end + +$gtk.reset +$game = nil + +</code></pre> +<h3 id='----fighting---special-move-inputs---main-rb'>Fighting - Special Move Inputs - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_fighting/01_special_move_inputs/app/main.rb +def tick args + #tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." + defaults args + render args + input args + calc args +end + +# sets default values and creates empty collections +# initialization only happens in the first frame +def defaults args + fiddle args + + args.state.tick_count = args.state.tick_count + args.state.bridge_top = 128 + args.state.player.x ||= 0 # initializes player's properties + args.state.player.y ||= args.state.bridge_top + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.dy ||= 0 + args.state.player.dx ||= 0 + args.state.player.r ||= 0 + args.state.game_over_at ||= 0 + args.state.animation_time ||=0 + + args.state.timeleft ||=0 + args.state.timeright ||=0 + args.state.lastpush ||=0 + + args.state.inputlist ||= ["j","k","l"] +end + +# sets enemy, player, hammer values +def fiddle args + args.state.gravity = -0.5 + args.state.player_jump_power = 10 # sets player values + args.state.player_jump_power_duration = 5 + args.state.player_max_run_speed = 20 + args.state.player_speed_slowdown_rate = 0.9 + args.state.player_acceleration = 0.9 +end + +# outputs objects onto the screen +def render args + if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01) + args.state.player.dx = 0 + end + + #move list + (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3, + merge: { vertical_alignment_enum: 0, size_enum: -2 }, + group: [ + { text: "move: WASD" }, + { text: "jump: Space" }, + { text: "attack forwards: J (while on ground" }, + { text: "attack upwards: K (while on groud)" }, + { text: "attack backwards: J (while on ground and holding A)" }, + { text: "attack downwards: K (while in air)" }, + { text: "dash attack: J, K in quick succession." }, + { text: "shield: hold J, K at the same time." }, + { text: "dash backwards: A, A in quick succession." }, + ]).into args.outputs.labels + + # registered moves + args.outputs.labels << { x: 0.to_layout_col, + y: 0.to_layout_row, + text: "input history", + size_enum: -2, + vertical_alignment_enum: 0 } + + (args.state.inputlist.take(5)).map do |s| + { text: s, size_enum: -2, vertical_alignment_enum: 0 } + end.yield_self do |group| + (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels + end + + + #sprites + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/white.png", + args.state.player.r] + + playershield = [args.state.player.x - 20, args.state.player.y - 10, + args.state.player.w + 20, args.state.player.h + 20, + "sprites/square/blue.png", + args.state.player.r, + 0] + + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", + args.state.player.r, + 0] + + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", + args.state.player.r+90, + 0] + + if ((args.state.tick_count - args.state.lastpush) <= 15) + if (args.state.inputlist[0] == "<<") + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/yellow.png", args.state.player.r] + end + + if (args.state.inputlist[0] == "shield") + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/indigo.png", args.state.player.r] + + playershield = [args.state.player.x - 10, args.state.player.y - 10, + args.state.player.w + 20, args.state.player.h + 20, + "sprites/square/blue.png", args.state.player.r, 50] + end + + if (args.state.inputlist[0] == "back-attack") + playerjab = [args.state.player.x - 20, args.state.player.y, + args.state.player.w - 10, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r, 255] + end + + if (args.state.inputlist[0] == "forward-attack") + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r, 255] + end + + if (args.state.inputlist[0] == "up-attack") + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] + end + + if (args.state.inputlist[0] == "dair") + playerupper = [args.state.player.x, args.state.player.y - 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] + end + + if (args.state.inputlist[0] == "dash-attack") + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/violet.png", args.state.player.r + 90, 255] + + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/violet.png", args.state.player.r, 255] + end + end + + args.outputs.sprites << playerjab + args.outputs.sprites << playerupper + args.outputs.sprites << player + args.outputs.sprites << playershield + + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge + [i * 64, args.state.bridge_top - 64, 64, 64] + end +end + +# Performs calculations to move objects on the screen +def calc args + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. + args.state.player.x += args.state.player.dx + args.state.player.y += args.state.player.dy + + # Since acceleration is the change in velocity, the change in y (dy) increases every frame + args.state.player.dy += args.state.gravity + + # player's y position is either current y position or y position of top of + # bridge, whichever has a greater value + # ensures that the player never goes below the bridge + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) + + # player's x position is either the current x position or 0, whichever has a greater value + # ensures that the player doesn't go too far left (out of the screen's scope) + args.state.player.x = args.state.player.x.greater(0) + + # player is not falling if it is located on the top of the bridge + args.state.player.falling = false if args.state.player.y == args.state.bridge_top + #args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player +end + +# Resets the player by changing its properties back to the values they had at initialization +def reset_player args + args.state.player.x = 0 + args.state.player.y = args.state.bridge_top + args.state.player.dy = 0 + args.state.player.dx = 0 + args.state.enemy.hammers.clear # empties hammer collection + args.state.enemy.hammer_queue.clear # empties hammer_queue + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) +end + +# Processes input from the user to move the player +def input args + if args.state.inputlist.length > 5 + args.state.inputlist.pop + end + + should_process_special_move = (args.inputs.keyboard.key_down.j) || + (args.inputs.keyboard.key_down.k) || + (args.inputs.keyboard.key_down.a) || + (args.inputs.keyboard.key_down.d) || + (args.inputs.controller_one.key_down.y) || + (args.inputs.controller_one.key_down.x) || + (args.inputs.controller_one.key_down.left) || + (args.inputs.controller_one.key_down.right) + + if (should_process_special_move) + if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) || + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y) + args.state.inputlist.unshift("shield") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && + (args.state.inputlist[0] == "forward-attack") && ((args.state.tick_count - args.state.lastpush) <= 15) + args.state.inputlist.unshift("dash-attack") + args.state.player.dx = 20 + elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) || + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left) + args.state.inputlist.unshift("back-attack") + elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j) + args.state.inputlist.unshift("forward-attack") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && + (args.state.player.y > 128) + args.state.inputlist.unshift("dair") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) + args.state.inputlist.unshift("up-attack") + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) && + (args.state.inputlist[0] == "<") && + ((args.state.tick_count - args.state.lastpush) <= 10) + args.state.inputlist.unshift("<<") + args.state.player.dx = -15 + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) + args.state.inputlist.unshift("<") + args.state.timeleft = args.state.tick_count + elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d) + args.state.inputlist.unshift(">") + end + + args.state.lastpush = args.state.tick_count + end + + if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame + + # if the time that has passed since the jump is less than the player's jump duration and + # the player is not falling + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump + end + end + + # if the space bar is in the "up" state (or not being pressed down) + if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2 + args.state.player.jumped_at = nil # jumped_at is empty + args.state.player.falling = true # the player is falling + end + + if args.inputs.left # if left key is pressed + if args.state.player.dx < -5 + args.state.player.dx = args.state.player.dx + else + args.state.player.dx = -5 + end + + elsif args.inputs.right # if right key is pressed + if args.state.player.dx > 5 + args.state.player.dx = args.state.player.dx + else + args.state.player.dx = 5 + end + else + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down + end + + if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10) + args.state.player.dx *= 0.95 + end +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end + +</code></pre> +<h3 id='----lowrez---nokia-3310---main-rb'>Lowrez - Nokia 3310 - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_lowrez/nokia_3310/app/main.rb require 'app/nokia.rb' @@ -25620,7 +27770,7 @@ def render_debug args text: text, size_enum: -1.5, r: 255, g: 255, b: 255 - }.label + }.label! end args.outputs.debug << { @@ -25630,7 +27780,7 @@ def render_debug args size_enum: -0.5, alignment_enum: 1, r: 255, g: 255, b: 255 - }.label + }.label! end def snake_demo args @@ -25640,7 +27790,7 @@ end $gtk.reset </code></pre> -<h3 id='----lowrez---nokia-3310---nokia.rb'>Lowrez - Nokia 3310 - nokia.rb</h3> +<h3 id='----lowrez---nokia-3310---nokia-rb'>Lowrez - Nokia 3310 - nokia.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_lowrez/nokia_3310/app/nokia.rb # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-) # Head over to main.rb and study the code there. @@ -25880,7 +28030,7 @@ module GTK g: 240, b: 216, a: 100 - }.line + }.line! end (NOKIA_WIDTH + 1).map_with_index do |i| @@ -25893,7 +28043,7 @@ module GTK g: 240, b: 216, a: 100 - }.line + }.line! end @args.state.overlay_rendered = true @@ -25903,7 +28053,7 @@ module GTK end </code></pre> -<h3 id='----lowrez---resolution-64x64---lowrez.rb'>Lowrez - Resolution 64x64 - lowrez.rb</h3> +<h3 id='----lowrez---resolution-64x64---lowrez-rb'>Lowrez - Resolution 64x64 - lowrez.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-) # Head over to main.rb and study the code there. @@ -26077,7 +28227,7 @@ module GTK end </code></pre> -<h3 id='----lowrez---resolution-64x64---main.rb'>Lowrez - Resolution 64x64 - main.rb</h3> +<h3 id='----lowrez---resolution-64x64---main-rb'>Lowrez - Resolution 64x64 - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_lowrez/resolution_64x64/app/main.rb require 'app/lowrez.rb' @@ -26641,7 +28791,7 @@ def render_debug args g: 128, b: 128, a: 80 - }.line + }.line! args.outputs.static_debug << { x: LOWREZ_X_OFFSET + (i * 10), @@ -26652,7 +28802,7 @@ def render_debug args g: 128, b: 128, a: 80 - }.line + }.line! end end @@ -26679,7 +28829,7 @@ def render_debug args y: 720 - (i * 20), text: text, size_enum: -1.5 - }.label + }.label! end args.outputs.debug << { @@ -26688,15 +28838,382 @@ def render_debug args text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.", size_enum: -0.5, alignment_enum: 1 - }.label + }.label! +end + +$gtk.reset + +</code></pre> +<h3 id='----mario---jumping---main-rb'>Mario - Jumping - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_mario/01_jumping/app/main.rb +def tick args + defaults args + render args + input args + calc args +end + +def defaults args + args.state.player.x ||= args.grid.w.half + args.state.player.y ||= 0 + args.state.player.size ||= 100 + args.state.player.dy ||= 0 + args.state.player.action ||= :jumping + args.state.jump.power = 20 + args.state.jump.increase_frames = 10 + args.state.jump.increase_power = 1 + args.state.gravity = -1 +end + +def render args + args.outputs.sprites << { + x: args.state.player.x - + args.state.player.size.half, + y: args.state.player.y, + w: args.state.player.size, + h: args.state.player.size, + path: 'sprites/square/red.png' + } +end + +def input args + if args.inputs.keyboard.key_down.space + if args.state.player.action == :standing + args.state.player.action = :jumping + args.state.player.dy = args.state.jump.power + + # record when the action took place + current_frame = args.state.tick_count + args.state.player.action_at = current_frame + end + end + + # if the space bar is being held + if args.inputs.keyboard.key_held.space + # is the player jumping + is_jumping = args.state.player.action == :jumping + + # when was the jump performed + time_of_jump = args.state.player.action_at + + # how much time has passed since the jump + jump_elapsed_time = time_of_jump.elapsed_time + + # how much time is allowed for increasing power + time_allowed = args.state.jump.increase_frames + + # if the player is jumping + # and the elapsed time is less than + # the allowed time + if is_jumping && jump_elapsed_time < time_allowed + # increase the dy by the increase power + power_to_add = args.state.jump.increase_power + args.state.player.dy += power_to_add + end + end +end + +def calc args + if args.state.player.action == :jumping + args.state.player.y += args.state.player.dy + args.state.player.dy += args.state.gravity + end + + if args.state.player.y < 0 + args.state.player.y = 0 + args.state.player.action = :standing + end +end + +</code></pre> +<h3 id='----mario---jumping-and-collisions---main-rb'>Mario - Jumping And Collisions - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_mario/02_jumping_and_collisions/app/main.rb +class Game + attr_gtk + + def tick + defaults + render + input + calc + end + + def defaults + return if state.tick_count != 0 + + player.x = 64 + player.y = 800 + player.size = 50 + player.dx = 0 + player.dy = 0 + player.action = :falling + + player.max_speed = 20 + player.jump_power = 15 + player.jump_air_time = 15 + player.jump_increase_power = 1 + + state.gravity = -1 + state.drag = 0.001 + state.tile_size = 64 + state.tiles ||= [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 3, ordinal_y: 0 }, + { ordinal_x: 4, ordinal_y: 0 }, + { ordinal_x: 5, ordinal_y: 0 }, + { ordinal_x: 6, ordinal_y: 0 }, + { ordinal_x: 7, ordinal_y: 0 }, + { ordinal_x: 8, ordinal_y: 0 }, + { ordinal_x: 9, ordinal_y: 0 }, + { ordinal_x: 10, ordinal_y: 0 }, + { ordinal_x: 11, ordinal_y: 0 }, + { ordinal_x: 12, ordinal_y: 0 }, + + { ordinal_x: 9, ordinal_y: 3 }, + { ordinal_x: 10, ordinal_y: 3 }, + { ordinal_x: 11, ordinal_y: 3 }, + ] + + tiles.each do |t| + t.rect = { x: t.ordinal_x * 64, + y: t.ordinal_y * 64, + w: 64, + h: 64 } + end + end + + def render + render_player + render_tiles + # render_grid + end + + def input + input_jump + input_move + end + + def calc + calc_player_rect + calc_left + calc_right + calc_below + calc_above + calc_player_dy + calc_player_dx + calc_game_over + end + + def render_player + outputs.sprites << { + x: player.x, + y: player.y, + w: player.size, + h: player.size, + path: 'sprites/square/red.png' + } + end + + def render_tiles + outputs.sprites << state.tiles.map do |t| + t.merge path: 'sprites/square/white.png', + x: t.ordinal_x * 64, + y: t.ordinal_y * 64, + w: 64, + h: 64 + end + end + + def render_grid + if state.tick_count == 0 + outputs[:grid].background_color = [0, 0, 0, 0] + outputs[:grid].borders << available_brick_locations + outputs[:grid].labels << available_brick_locations.map do |b| + [ + b.merge(text: "#{b.ordinal_x},#{b.ordinal_y}", + x: b.x + 2, + y: b.y + 2, + size_enum: -3, + vertical_alignment_enum: 0, + blendmode_enum: 0), + b.merge(text: "#{b.x},#{b.y}", + x: b.x + 2, + y: b.y + 2 + 20, + size_enum: -3, + vertical_alignment_enum: 0, + blendmode_enum: 0) + ] + end + end + + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :grid } + end + + def input_jump + if inputs.keyboard.key_down.space + player_jump + end + + if inputs.keyboard.key_held.space + player_jump_increase_air_time + end + end + + def input_move + if player.dx.abs < 20 + if inputs.keyboard.left + player.dx -= 2 + elsif inputs.keyboard.right + player.dx += 2 + end + end + end + + def calc_game_over + if player.y < -64 + player.x = 64 + player.y = 800 + player.dx = 0 + player.dy = 0 + end + end + + def calc_player_rect + player.rect = player_current_rect + player.next_rect = player_next_rect + player.prev_rect = player_prev_rect + end + + def calc_player_dx + player.dx = player_next_dx + player.x += player.dx + end + + def calc_player_dy + player.y += player.dy + player.dy = player_next_dy + end + + def calc_below + return unless player.dy < 0 + tiles_below = tiles_find { |t| t.rect.top <= player.prev_rect.y } + collision = tiles_find_colliding tiles_below, (player.rect.merge y: player.next_rect.y) + if collision + player.y = collision.rect.y + state.tile_size + player.dy = 0 + player.action = :standing + else + player.action = :falling + end + end + + def calc_left + return unless player.dx < 0 && player_next_dx < 0 + tiles_left = tiles_find { |t| t.rect.right <= player.prev_rect.left } + collision = tiles_find_colliding tiles_left, (player.rect.merge x: player.next_rect.x) + return unless collision + player.x = collision.rect.right + player.dx = 0 + end + + def calc_right + return unless player.dx > 0 && player_next_dx > 0 + tiles_right = tiles_find { |t| t.rect.left >= player.prev_rect.right } + collision = tiles_find_colliding tiles_right, (player.rect.merge x: player.next_rect.x) + return unless collision + player.x = collision.rect.left - player.rect.w + player.dx = 0 + end + + def calc_above + return unless player.dy > 0 + tiles_above = tiles_find { |t| t.rect.y >= player.prev_rect.y } + collision = tiles_find_colliding tiles_above, (player.rect.merge y: player.next_rect.y) + return unless collision + player.dy = 0 + player.y = collision.rect.bottom - player.rect.h + end + + def player_current_rect + { x: player.x, y: player.y, w: player.size, h: player.size } + end + + def available_brick_locations + (0..19).to_a + .product(0..11) + .map do |(ordinal_x, ordinal_y)| + { ordinal_x: ordinal_x, + ordinal_y: ordinal_y, + x: ordinal_x * 64, + y: ordinal_y * 64, + w: 64, + h: 64 } + end + end + + def player + state.player ||= args.state.new_entity :player + end + + def player_next_dy + player.dy + state.gravity + state.drag ** 2 * -1 + end + + def player_next_dx + player.dx * 0.8 + end + + def player_next_rect + player.rect.merge x: player.x + player_next_dx, + y: player.y + player_next_dy + end + + def player_prev_rect + player.rect.merge x: player.x - player.dx, + y: player.y - player.dy + end + + def player_jump + return if player.action != :standing + player.action = :jumping + player.dy = state.player.jump_power + current_frame = state.tick_count + player.action_at = current_frame + end + + def player_jump_increase_air_time + return if player.action != :jumping + return if player.action_at.elapsed_time >= player.jump_air_time + player.dy += player.jump_increase_power + end + + def tiles + state.tiles + end + + def tiles_find_colliding tiles, target + tiles.find { |t| t.rect.intersect_rect? target } + end + + def tiles_find &block + tiles.find_all(&block) + end +end + +def tick args + $game ||= Game.new + $game.args = args + $game.tick end $gtk.reset </code></pre> -<h3 id='----platformer---clepto-frog---main.rb'>Platformer - Clepto Frog - main.rb</h3> +<h3 id='----platformer---clepto-frog---main-rb'>Platformer - Clepto Frog - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/clepto_frog/app/main.rb -MAP_FILE_PATH = 'app/map.txt' +MAP_FILE_PATH = 'map.txt' require 'app/map.rb' @@ -26751,35 +29268,7 @@ class CleptoFrog def render_intro outputs.labels << [640, 700, "Clepto Frog", 4, 1] - if state.tick_count >= 120 - outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", - 4, 1, 0, 0, 0, 255 * 120.ease(60)] - end - - if state.tick_count >= 240 - outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", - 4, 1, 0, 0, 0, 255 * 240.ease(60)] - end - - if state.tick_count >= 360 - outputs.labels << [640, 540, "\"Uh...\" - New Guy", - 4, 1, 0, 0, 0, 255 * 360.ease(60)] - end - - if state.tick_count >= 480 - outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", - 4, 1, 0, 0, 0, 255 * 480.ease(60)] - end - - if state.tick_count >= 600 - outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", - 4, 1, 0, 0, 0, 255 * 600.ease(60)] - end - - outputs.sprites << [640 - 50, 360 - 50, 100, 100, - "sprites/square-green.png"] - - if state.tick_count == 800 + if state.tick_count == 120 state.scene = :game state.game_start_at = state.tick_count end @@ -26787,7 +29276,7 @@ class CleptoFrog def tick defaults - if state.scene == :intro && state.tick_count <= 800 + if state.scene == :intro && state.tick_count <= 120 render_intro elsif state.scene == :ending render_ending @@ -26890,15 +29379,15 @@ class CleptoFrog if state.god_mode # SHOW HIDE COLLISIONS - outputs.sprites << state.world.map do |x, y, w, h| - x = vx(x) - y = vy(y) + outputs.sprites << state.world.map do |rect| + x = vx(rect.x) + y = vy(rect.y) if x > -80 && x < 1280 && y > -80 && y < 720 { x: x, y: y, - w: vw(w || state.tile_size), - h: vh(h || state.tile_size), + w: vw(rect.w || state.tile_size), + h: vh(rect.h || state.tile_size), path: 'sprites/square-gray.png', a: 128 } @@ -26921,8 +29410,10 @@ class CleptoFrog # Creates sprite following mouse to help indicate which sprite you have selected - outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, - state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite + outputs.primitives << [inputs.mouse.position.x - 32 * state.camera_scale, + inputs.mouse.position.y - 32 * state.camera_scale, + state.tile_size * state.camera_scale, + state.tile_size * state.camera_scale, 'sprites/square-indigo.png', 0, 100].sprite end render_mini_map @@ -27003,6 +29494,29 @@ class CleptoFrog set_camera_scale 1 end + if inputs.mouse.click + state.id_seed += 1 + id = state.id_seed + x = state.camera_x + (inputs.mouse.click.x.fdiv(state.camera_scale) - 32) + y = state.camera_y + (inputs.mouse.click.y.fdiv(state.camera_scale) - 32) + x = ((x + 2).idiv 4) * 4 + y = ((y + 2).idiv 4) * 4 + w = 64 + h = 64 + candidate_rect = { id: id, x: x, y: y, w: w, h: h } + scaled_candidate_rect = { x: x + 30, y: y + 30, w: w - 60, h: h - 60 } + to_remove = state.world.find { |r| r.intersect_rect? scaled_candidate_rect } + if to_remove && args.inputs.keyboard.x + state.world.reject! { |r| r.id == to_remove.id } + else + state.world << candidate_rect + end + export_map + state.world_lookup = {} + state.world_collision_rects = nil + calc_world_lookup + end + if input_up? state.y += 10 state.dy = 0 @@ -27024,12 +29538,6 @@ class CleptoFrog if state.scene == :game process_inputs_player_movement process_inputs_god_mode - elsif state.scene == :intro - if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space - if Kernel.tick_count < 600 - Kernel.tick_count = 600 - end - end end end @@ -27127,17 +29635,6 @@ class CleptoFrog end end - def add_floors - # floors - state.world += [ - [0, 0, 10000, 40], - [0, 1670, 3250, 60], - [6691, 1653, 3290, 60], - [1521, 3792, 7370, 60], - [0, 5137, 3290, 60] - ] - end - def attempt_load_world_from_file return if state.world # exported_world = gtk.read_file(MAP_FILE_PATH) @@ -27145,26 +29642,11 @@ class CleptoFrog state.objects = [] if $collisions - $collisions.map do |x, y, w, h| - state.world << [x, y, w, h] + state.id_seed ||= 0 + $collisions.each do |x, y, w, h| + state.id_seed += 1 + state.world << { id: state.id_seed, x: x, y: y, w: w, h: h } end - - add_floors - # elsif exported_world - # exported_world.each_line.map do |l| - # tokens = l.strip.split(',') - # x = tokens[0].to_i - # y = tokens[1].to_i - # type = tokens[2].to_i - # if type == 1 - # state.world << [x, y, state.tile_size, state.tile_size] - # elsif type == 2 - # w, h, path = tokens[3..-1] - # state.objects << [x, y, w.to_i, h.to_i, path] - # end - # end - - # add_floors end if $mugs @@ -27185,23 +29667,24 @@ class CleptoFrog # Searches through the world and finds the cordinates that exist state.world_lookup = {} - state.world.each do |x, y, w, h| - state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true + state.world.each do |rect| + state.world_lookup[rect.id] = rect end # Assigns collision rects for every sprite drawn state.world_collision_rects = state.world_lookup .keys - .map do |x, y, w, h| + .map do |key| + rect = state.world_lookup[key] s = state.tile_size - w ||= s - h ||= s + rect.w ||= s + rect.h ||= s { - args: [x, y, w, h], - left_right: [x, y + 4, w, h - 6], - top: [x + 4, y + 6, w - 8, h - 6], - bottom: [x + 1, y - 1, w - 2, h - 8], + args: rect, + left_right: { x: rect.x, y: rect.y + 4, w: rect.w, h: rect.h - 6 }, + top: { x: rect.x + 4, y: rect.y + 6, w: rect.w - 8, h: rect.h - 6 }, + bottom: { x: rect.x + 1, y: rect.y - 1, w: rect.w - 2, h: rect.h - 8 }, } end @@ -27257,12 +29740,21 @@ class CleptoFrog def end_of_tongue p = state.tongue_angle.vector(state.tongue_length) - [start_of_tongue.x + p.x, start_of_tongue.y + p.y] + { x: start_of_tongue.x + p.x, y: start_of_tongue.y + p.y } end def calc_shooting + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + end + + def calc_shooting_increment return unless state.action == :shooting - state.tongue_length += 30 + state.tongue_length += 5 potential_anchor = end_of_tongue if potential_anchor.x <= 0 state.anchor_point = potential_anchor @@ -27281,9 +29773,9 @@ class CleptoFrog state.action = :anchored outputs.sounds << 'sounds/attached.wav' else - anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] + anchor_rect = { x: potential_anchor.x - 5, y: potential_anchor.y - 5, w: 10, h: 10 } collision = state.world_collision_rects.find_all do |v| - [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) + v[:args].intersect_rect?(anchor_rect) end.first if collision state.anchor_point = potential_anchor @@ -27379,7 +29871,7 @@ class CleptoFrog .first return unless left_side_collisions - state.x = left_side_collisions[:left_right].right + state.x = left_side_collisions[:left_right].right + 1 state.dx = state.dy.abs * 0.8 state.collision_on_x = true end @@ -27394,7 +29886,7 @@ class CleptoFrog .first return unless right_side_collisions - state.x = right_side_collisions[:left_right].left - state.tile_size + state.x = right_side_collisions[:left_right].left - state.tile_size - 1 state.dx = state.dx.abs * 0.8 * -1 state.collision_on_x = true end @@ -27410,7 +29902,7 @@ class CleptoFrog .first return unless ceil_collisions - state.y = ceil_collisions[:bottom].y - state.tile_size + state.y = ceil_collisions[:bottom].y - state.tile_size - 1 state.dy = state.dy.abs * 0.8 * -1 state.collision_on_y = true end @@ -27423,13 +29915,17 @@ class CleptoFrog end def export_map - export_string = state.world.map do |x, y| - "#{x},#{y},1" - end + export_string = "$collisions = [\n" + export_string += state.world.map do |rect| + "[#{rect.x},#{rect.y},#{rect.w},#{rect.h}]," + end.join "\n" + export_string += "\n]\n\n" + export_string += "$mugs = [\n" export_string += state.objects.map do |x, y, w, h, path| - "#{x},#{y},2,#{w},#{h},#{path}" - end - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) + "[#{x},#{y},#{w},#{h},'#{path}']," + end.join "\n" + export_string += "\n]\n\n" + gtk.write_file(MAP_FILE_PATH, export_string) state.map_saved_at = state.tick_count end @@ -27562,7 +30058,7 @@ def tick_instructions args, text, y = 715 end </code></pre> -<h3 id='----platformer---clepto-frog---map.rb'>Platformer - Clepto Frog - map.rb</h3> +<h3 id='----platformer---clepto-frog---map-rb'>Platformer - Clepto Frog - map.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/clepto_frog/app/map.rb $collisions = [ [326, 463, 64, 64], @@ -28555,6 +31051,11 @@ $collisions = [ [4459, 3997, 64, 64], [76, 5215, 64, 64], [39, 5217, 64, 64], + [0, 0, 10000, 40], + [0, 1670, 3250, 60], + [6691, 1653, 3290, 60], + [1521, 3792, 7370, 60], + [0, 5137, 3290, 60] ] $mugs = [ @@ -28591,14 +31092,14 @@ $mugs = [ ] </code></pre> -<h3 id='----platformer---gorillas-basic---credits.txt'>Platformer - Gorillas Basic - credits.txt</h3> +<h3 id='----platformer---gorillas-basic---credits-txt'>Platformer - Gorillas Basic - credits.txt</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt code: Amir Rajan, https://twitter.com/amirrajan graphics: Nick Culbertson, https://twitter.com/MobyPixel </code></pre> -<h3 id='----platformer---gorillas-basic---main.rb'>Platformer - Gorillas Basic - main.rb</h3> +<h3 id='----platformer---gorillas-basic---main-rb'>Platformer - Gorillas Basic - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/gorillas_basic/app/main.rb class YouSoBasicGorillas attr_accessor :outputs, :grid, :state, :inputs @@ -28975,7 +31476,7 @@ def tick args end </code></pre> -<h3 id='----platformer---gorillas-basic---tests.rb'>Platformer - Gorillas Basic - tests.rb</h3> +<h3 id='----platformer---gorillas-basic---tests-rb'>Platformer - Gorillas Basic - tests.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/gorillas_basic/app/tests.rb $gtk.reset 100 $gtk.supress_framerate_warning = true @@ -28983,7 +31484,7 @@ $gtk.require 'app/tests/building_generation_tests.rb' $gtk.tests.start </code></pre> -<h3 id='----platformer---gorillas-basic---tests---building_generation_tests.rb'>Platformer - Gorillas Basic - Tests - building_generation_tests.rb</h3> +<h3 id='----platformer---gorillas-basic---tests---building_generation_tests-rb'>Platformer - Gorillas Basic - Tests - building_generation_tests.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb def test_solids args, assert game = YouSoBasicGorillas.new @@ -29002,7 +31503,7 @@ def test_solids args, assert end </code></pre> -<h3 id='----platformer---the-little-probe---main.rb'>Platformer - The Little Probe - main.rb</h3> +<h3 id='----platformer---the-little-probe---main-rb'>Platformer - The Little Probe - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/the_little_probe/app/main.rb class FallingCircle attr_gtk @@ -29400,6 +31901,7 @@ class FallingCircle end def load_lines file + return unless state.snaps data = gtk.read_file(file) || "" data.each_line .reject { |l| l.strip.length == 0 } @@ -29458,10 +31960,10 @@ class FallingCircle results[:point] = { x: x, y: y } results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 } results[:trajectory] = trajectory(results) - results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| + results[:impacts] = terrain.find_all { |t| t && (line_near_rect? results[:rect], t) }.map do |t| { terrain: t, - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), type: :terrain } end.reject { |t| !point_within_line? t[:point], t[:terrain] } @@ -29469,10 +31971,10 @@ class FallingCircle results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t| { terrain: t, - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), type: :lava } - end.reject { |t| !point_within_line? t[:point], t[:terrain] } + end.reject { |t| !t || (!point_within_line? t[:point], t[:terrain]) } results end @@ -29485,6 +31987,7 @@ class FallingCircle end def calc_terrains_to_monitor + return unless circle.impacts circle.impact = nil circle.impacts.each do |i| circle.terrains_to_monitor[i[:terrain]] ||= { @@ -29893,7 +32396,7 @@ def reset end </code></pre> -<h3 id='----platformer---the-little-probe---data---level.txt'>Platformer - The Little Probe - Data - level.txt</h3> +<h3 id='----platformer---the-little-probe---data---level-txt'>Platformer - The Little Probe - Data - level.txt</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/the_little_probe/data/level.txt 640,8840,1180,8840 -60,10220,0,9960 @@ -31377,7 +33880,7 @@ end 1910,11280,2200,11180 923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157 </code></pre> -<h3 id='----platformer---the-little-probe---data---level_lava.txt'>Platformer - The Little Probe - Data - level_lava.txt</h3> +<h3 id='----platformer---the-little-probe---data---level_lava-txt'>Platformer - The Little Probe - Data - level_lava.txt</h3> <pre><code class="language-ruby"># ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt 100,10740,500,10780 500,10780,960,10760 @@ -31615,7 +34118,7 @@ end 2200,11130,2360,11090 1840,11230,2200,11130 </code></pre> -<h3 id='----rpg-narrative---choose-your-own-adventure---decision.rb'>Rpg Narrative - Choose Your Own Adventure - decision.rb</h3> +<h3 id='----rpg-narrative---choose-your-own-adventure---decision-rb'>Rpg Narrative - Choose Your Own Adventure - decision.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb # Hey there! Welcome to Four Decisions. Here is how you # create your decision tree. Remove =being and =end from the text to @@ -31656,7 +34159,7 @@ def game end </code></pre> -<h3 id='----rpg-narrative---choose-your-own-adventure---main.rb'>Rpg Narrative - Choose Your Own Adventure - main.rb</h3> +<h3 id='----rpg-narrative---choose-your-own-adventure---main-rb'>Rpg Narrative - Choose Your Own Adventure - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb =begin @@ -31792,7 +34295,7 @@ end $gtk.reset </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---lowrez_simulator.rb'>Rpg Narrative - Return Of Serenity - lowrez_simulator.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---lowrez_simulator-rb'>Rpg Narrative - Return Of Serenity - lowrez_simulator.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb ################################################################################### # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES @@ -31887,7 +34390,7 @@ def render_gridlines_if_needed args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---main.rb'>Rpg Narrative - Return Of Serenity - main.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---main-rb'>Rpg Narrative - Return Of Serenity - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb require 'app/require.rb' @@ -32364,7 +34867,7 @@ def player_xs args, x, y end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---require.rb'>Rpg Narrative - Return Of Serenity - require.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---require-rb'>Rpg Narrative - Return Of Serenity - require.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb require 'app/lowrez_simulator.rb' require 'app/storyline_day_one.rb' @@ -32379,7 +34882,7 @@ require 'app/storyline_final_decision.rb' require 'app/storyline.rb' </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline.rb'>Rpg Narrative - Return Of Serenity - storyline.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline-rb'>Rpg Narrative - Return Of Serenity - storyline.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb def hotspot_top [4, 61, 56, 3] @@ -32529,7 +35032,7 @@ def reload_current_scene end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_anka.rb'>Rpg Narrative - Return Of Serenity - storyline_anka.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_anka-rb'>Rpg Narrative - Return Of Serenity - storyline_anka.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb def anka_inside_room args { @@ -32660,7 +35163,7 @@ def replied_to_anka_back_home args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_blinking_light.rb'>Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_blinking_light-rb'>Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb def the_blinking_light args { @@ -32739,7 +35242,7 @@ def blinking_light_inside_mainframe args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_day_one.rb'>Rpg Narrative - Return Of Serenity - storyline_day_one.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_day_one-rb'>Rpg Narrative - Return Of Serenity - storyline_day_one.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb def day_one_beginning args { @@ -32949,7 +35452,7 @@ def explaining_the_special_power_inside_computer args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_final_decision.rb'>Rpg Narrative - Return Of Serenity - storyline_final_decision.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_final_decision-rb'>Rpg Narrative - Return Of Serenity - storyline_final_decision.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb def final_decision_side_of_home args { @@ -33089,7 +35592,7 @@ def final_decision_ship_status_shared args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_final_message.rb'>Rpg Narrative - Return Of Serenity - storyline_final_message.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_final_message-rb'>Rpg Narrative - Return Of Serenity - storyline_final_message.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb def final_message_sad args { @@ -33309,7 +35812,7 @@ def final_message_summary args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_alive.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_alive-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb def serenity_alive_side_of_home args { @@ -33532,7 +36035,7 @@ def serenity_alive_current_message args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_bio.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_bio-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb def serenity_bio_infront_of_home args { @@ -33687,7 +36190,7 @@ def bad_dream_last_reply args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_introduction.rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_serenity_introduction-rb'>Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb # decision_graph "Message from Sasha", # "I should reply.", @@ -33786,7 +36289,7 @@ def replied_to_introduction_side_of_home args end </code></pre> -<h3 id='----rpg-narrative---return-of-serenity---storyline_speed_of_light.rb'>Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb</h3> +<h3 id='----rpg-narrative---return-of-serenity---storyline_speed_of_light-rb'>Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb def speed_of_light_front_of_home args { @@ -33894,7 +36397,7 @@ def speed_of_light_end_of_day args end </code></pre> -<h3 id='----rpg-roguelike---roguelike-starting-point---constants.rb'>Rpg Roguelike - Roguelike Starting Point - constants.rb</h3> +<h3 id='----rpg-roguelike---roguelike-starting-point---constants-rb'>Rpg Roguelike - Roguelike Starting Point - constants.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_roguelike/01_roguelike_starting_point/app/constants.rb SHOW_LEGEND = true SOURCE_TILE_SIZE = 16 @@ -33906,7 +36409,7 @@ TILE_B = 0 TILE_A = 255 </code></pre> -<h3 id='----rpg-roguelike---roguelike-starting-point---legend.rb'>Rpg Roguelike - Roguelike Starting Point - legend.rb</h3> +<h3 id='----rpg-roguelike---roguelike-starting-point---legend-rb'>Rpg Roguelike - Roguelike Starting Point - legend.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_roguelike/01_roguelike_starting_point/app/legend.rb def tick_legend args return unless SHOW_LEGEND @@ -33975,7 +36478,7 @@ def tick_legend args end </code></pre> -<h3 id='----rpg-roguelike---roguelike-starting-point---main.rb'>Rpg Roguelike - Roguelike Starting Point - main.rb</h3> +<h3 id='----rpg-roguelike---roguelike-starting-point---main-rb'>Rpg Roguelike - Roguelike Starting Point - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_roguelike/01_roguelike_starting_point/app/main.rb require 'app/constants.rb' require 'app/sprite_lookup.rb' @@ -34076,7 +36579,7 @@ def tile_in_game x, y, tile_key end </code></pre> -<h3 id='----rpg-roguelike---roguelike-starting-point---sprite_lookup.rb'>Rpg Roguelike - Roguelike Starting Point - sprite_lookup.rb</h3> +<h3 id='----rpg-roguelike---roguelike-starting-point---sprite_lookup-rb'>Rpg Roguelike - Roguelike Starting Point - sprite_lookup.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_roguelike/01_roguelike_starting_point/app/sprite_lookup.rb def sprite_lookup { @@ -34204,7 +36707,7 @@ end $gtk.args.state.reserved.sprite_lookup = sprite_lookup </code></pre> -<h3 id='----rpg-roguelike---roguelike-line-of-sight---main.rb'>Rpg Roguelike - Roguelike Line Of Sight - main.rb</h3> +<h3 id='----rpg-roguelike---roguelike-line-of-sight---main-rb'>Rpg Roguelike - Roguelike Line Of Sight - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_roguelike/02_roguelike_line_of_sight/app/main.rb =begin @@ -34647,7 +37150,7 @@ def tick args end </code></pre> -<h3 id='----rpg-tactical---hexagonal-grid---main.rb'>Rpg Tactical - Hexagonal Grid - main.rb</h3> +<h3 id='----rpg-tactical---hexagonal-grid---main-rb'>Rpg Tactical - Hexagonal Grid - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb class HexagonTileGame attr_gtk @@ -34719,7 +37222,7 @@ end $gtk.reset </code></pre> -<h3 id='----rpg-tactical---isometric-grid---main.rb'>Rpg Tactical - Isometric Grid - main.rb</h3> +<h3 id='----rpg-tactical---isometric-grid---main-rb'>Rpg Tactical - Isometric Grid - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb class Isometric attr_accessor :grid, :inputs, :state, :outputs @@ -34985,7 +37488,150 @@ def tick args end </code></pre> -<h3 id='----rpg-topdown---topdown-starting-point---main.rb'>Rpg Topdown - Topdown Starting Point - main.rb</h3> +<h3 id='----rpg-topdown---topdown-casino---main-rb'>Rpg Topdown - Topdown Casino - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_rpg_topdown/topdown_casino/app/main.rb +$gtk.reset + +def coinflip + rand < 0.5 +end + +class Game + attr_accessor :args + + def text_font + return nil #"rpg.ttf" + end + + def text_color + [ 255, 255, 255, 255 ] + end + + def set_gem_values + @args.state.gem0 = ((coinflip) ? 100 : 20) + @args.state.gem1 = ((coinflip) ? -10 : -50) + @args.state.gem2 = ((coinflip) ? -10 : -30) + if coinflip + tmp = @args.state.gem0 + @args.state.gem0 = @args.state.gem1 + @args.state.gem1 = tmp + end + if coinflip + tmp = @args.state.gem1 + @args.state.gem1 = @args.state.gem2 + @args.state.gem2 = tmp + end + if coinflip + tmp = @args.state.gem0 + @args.state.gem0 = @args.state.gem2 + @args.state.gem2 = tmp + end + end + + def initialize args + @args = args + @args.state.animticks = 0 + @args.state.score = 0 + @args.state.gem_chosen = false + @args.state.round_finished = false + @args.state.gem0_x = 197 + @args.state.gem0_y = 720-274 + @args.state.gem1_x = 623 + @args.state.gem1_y = 720-274 + @args.state.gem2_x = 1049 + @args.state.gem2_y = 720-274 + @args.state.hero_sprite = "sprites/herodown100.png" + @args.state.hero_x = 608 + @args.state.hero_y = 720-656 + set_gem_values + end + + def render_gem_value x, y, gem + if @args.state.gem_chosen + @args.outputs.labels << [ x, y + 96, gem.to_s, 1, 1, *text_color, text_font ] + end + end + + def render + gemsprite = ((@args.state.animticks % 400) < 200) ? 'sprites/gem200.png' : 'sprites/gem400.png' + @args.outputs.background_color = [ 0, 0, 0, 255 ] + @args.outputs.sprites << [608, 720-150, 64, 64, 'sprites/oldman.png'] + @args.outputs.sprites << [300, 720-150, 64, 64, 'sprites/fire.png'] + @args.outputs.sprites << [900, 720-150, 64, 64, 'sprites/fire.png'] + @args.outputs.sprites << [@args.state.gem0_x, @args.state.gem0_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.gem1_x, @args.state.gem1_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.gem2_x, @args.state.gem2_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.hero_x, @args.state.hero_y, 64, 64, @args.state.hero_sprite] + + @args.outputs.labels << [ 630, 720-30, "IT'S A SECRET TO EVERYONE.", 1, 1, *text_color, text_font ] + @args.outputs.labels << [ 50, 720-85, @args.state.score.to_s, 1, 1, *text_color, text_font ] + render_gem_value @args.state.gem0_x, @args.state.gem0_y, @args.state.gem0 + render_gem_value @args.state.gem1_x, @args.state.gem1_y, @args.state.gem1 + render_gem_value @args.state.gem2_x, @args.state.gem2_y, @args.state.gem2 + end + + def calc + @args.state.animticks += 16 + + return unless @args.state.gem_chosen + @args.state.round_finished_debounce ||= 60 * 3 + @args.state.round_finished_debounce -= 1 + return if @args.state.round_finished_debounce > 0 + + @args.state.gem_chosen = false + @args.state.hero.sprite[0] = 'sprites/herodown100.png' + @args.state.hero.sprite[1] = 608 + @args.state.hero.sprite[2] = 656 + @args.state.round_finished_debounce = nil + set_gem_values + end + + def walk xdir, ydir, anim + @args.state.hero_sprite = "sprites/#{anim}#{(((@args.state.animticks % 200) < 100) ? '100' : '200')}.png" + @args.state.hero_x += 5 * xdir + @args.state.hero_y += 5 * ydir + end + + def check_gem_touching gem_x, gem_y, gem + return if @args.state.gem_chosen + herorect = [ @args.state.hero_x, @args.state.hero_y, 64, 64 ] + return if !herorect.intersect_rect?([gem_x, gem_y, 32, 64]) + @args.state.gem_chosen = true + @args.state.score += gem + @args.outputs.sounds << ((gem < 0) ? 'sounds/lose.wav' : 'sounds/win.wav') + end + + def input + if @args.inputs.keyboard.key_held.left + walk(-1.0, 0.0, 'heroleft') + elsif @args.inputs.keyboard.key_held.right + walk(1.0, 0.0, 'heroright') + elsif @args.inputs.keyboard.key_held.up + walk(0.0, 1.0, 'heroup') + elsif @args.inputs.keyboard.key_held.down + walk(0.0, -1.0, 'herodown') + end + + check_gem_touching(@args.state.gem0_x, @args.state.gem0_y, @args.state.gem0) + check_gem_touching(@args.state.gem1_x, @args.state.gem1_y, @args.state.gem1) + check_gem_touching(@args.state.gem2_x, @args.state.gem2_y, @args.state.gem2) + end + + def tick + input + calc + render + end +end + +def tick args + args.state.game ||= Game.new args + args.state.game.args = args + args.state.game.tick +end + +</code></pre> +<h3 id='----rpg-topdown---topdown-starting-point---main-rb'>Rpg Topdown - Topdown Starting Point - main.rb</h3> <pre><code class="language-ruby"># ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb =begin @@ -35097,11 +37743,190 @@ def move_player args, *vector end </code></pre> +<h3 id='----teenytiny---teenytiny-starting-point---main-rb'>Teenytiny - Teenytiny Starting Point - main.rb</h3> +<pre><code class="language-ruby"># ./samples/99_genre_teenytiny/teenytiny_starting_point/app/main.rb +# full documenation is at http://docs.dragonruby.org +# be sure to come to the discord if you hit any snags: http://discord.dragonruby.org +def tick args + # ==================================================== + # initialize default variables + # ==================================================== + + # ruby has an operator called ||= which means "only initialize this if it's nil" + args.state.count_down ||= 20 * 60 # set the count down to 20 seconds + # set the initial position of the target + args.state.target ||= { x: args.grid.w.half, + y: args.grid.h.half, + w: 20, + h: 20 } + + # set the initial position of the player + args.state.player ||= { x: 50, + y: 50, + w: 20, + h: 20 } + + # set the player movement speed + args.state.player_speed ||= 5 + + # set the score + args.state.score ||= 0 + args.state.teleports ||= 3 + + # set the instructions + args.state.instructions ||= "Get to the red goal! Use arrow keys to move. Spacebar to teleport (use them carefully)!" + + # ==================================================== + # render the game + # ==================================================== + args.outputs.labels << { x: args.grid.w.half, y: args.grid.h - 10, + text: args.state.instructions, + alignment_enum: 1 } + + # check if it's game over. if so, then render game over + # otherwise render the current time left + if game_over? args + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 40, + text: "game over! (press r to start over)", + alignment_enum: 1 } + else + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 40, + text: "time left: #{(args.state.count_down.idiv 60) + 1}", + alignment_enum: 1 } + end + + # render the score + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 70, + text: "score: #{args.state.score}", + alignment_enum: 1 } + + # render the player with teleport count + args.outputs.sprites << { x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/square-green.png' } + + args.outputs.labels << { x: args.state.player.x + 10, + y: args.state.player.y + 40, + text: "teleports: #{args.state.teleports}", + alignment_enum: 1, size_enum: -2 } + + # render the target + args.outputs.sprites << { x: args.state.target.x, + y: args.state.target.y, + w: args.state.target.w, + h: args.state.target.h, + path: 'sprites/square-red.png' } + + # ==================================================== + # run simulation + # ==================================================== + + # count down calculation + args.state.count_down -= 1 + args.state.count_down = -1 if args.state.count_down < -1 + + # ==================================================== + # process player input + # ==================================================== + # if it isn't game over let them move + if !game_over? args + dir_y = 0 + dir_x = 0 + + # determine the change horizontally + if args.inputs.keyboard.up + dir_y += args.state.player_speed + elsif args.inputs.keyboard.down + dir_y -= args.state.player_speed + end + + # determine the change vertically + if args.inputs.keyboard.left + dir_x -= args.state.player_speed + elsif args.inputs.keyboard.right + dir_x += args.state.player_speed + end + + # determine if teleport can be used + if args.inputs.keyboard.key_down.space && args.state.teleports > 0 + args.state.teleports -= 1 + dir_x *= 20 + dir_y *= 20 + end + + # apply change to player + args.state.player.x += dir_x + args.state.player.y += dir_y + else + # if r is pressed, reset the game + if args.inputs.keyboard.key_down.r + $gtk.reset + return + end + end + + # ==================================================== + # determine score + # ==================================================== + + # calculate new score if the player is at goal + if !game_over? args + + # if the player is at the goal, then move the goal + if args.state.player.intersect_rect? args.state.target + # increment the goal + args.state.score += 1 + + # move the goal to a random location + args.state.target = { x: (rand args.grid.w), y: (rand args.grid.h), w: 20, h: 20 } + + # make sure the goal is inside the view area + if args.state.target.x < 0 + args.state.target.x += 20 + elsif args.state.target.x > 1280 + args.state.target.x -= 20 + end + + # make sure the goal is inside the view area + if args.state.target.y < 0 + args.state.target.y += 20 + elsif args.state.target.y > 720 + args.state.target.y -= 20 + end + end + end +end + +def game_over? args + args.state.count_down < 0 +end + +$gtk.reset + +</code></pre> +<h3 id='----teenytiny---teenytiny-starting-point---license-txt'>Teenytiny - Teenytiny Starting Point - license.txt</h3> +<pre><code class="language-ruby"># ./samples/99_genre_teenytiny/teenytiny_starting_point/license.txt +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +</code></pre> <h2 id='---oss'>OSS</h2> <p> Follows is a source code listing for all files that have been open sourced. This code can be found online at <a href='https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/'>https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/</a>. </p> -<h3 id='----args.rb'>args.rb</h3> +<h3 id='----args-rb'>args.rb</h3> <pre><code class="language-ruby"># ./dragon/args.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -35115,66 +37940,32 @@ module GTK class Args include ArgsDeprecated include Serialize - - # Contains information related to input devices and input events. - # - # @return [Inputs] + attr_accessor :cvars attr_accessor :inputs - - # Contains the means to interact with output devices such as the screen. - # - # @return [Outputs] attr_accessor :outputs - - # Contains the means to interact with the audio mixer. - # - # @return [Hash] attr_accessor :audio - - # Contains display size information to assist in positioning things on the screen. - # - # @return [Grid] attr_accessor :grid - - # Provides access to game play recording facilities within Game Toolkit. - # - # @return [Recording] attr_accessor :recording - - # Gives you access to geometry related functions. - # - # @return [Geometry] attr_accessor :geometry - attr_accessor :fn - - # This is where you'll put state associated with your video game. - # - # @return [OpenEntity] attr_accessor :state - - # Gives you access to the top level DragonRuby runtime. - # - # @return [Runtime] + attr_accessor :temp_state attr_accessor :runtime alias_method :gtk, :runtime - attr_accessor :passes - attr_accessor :wizards - attr_accessor :layout - attr_accessor :easing - attr_accessor :string def initialize runtime, recording @inputs = Inputs.new @outputs = Outputs.new args: self + @cvars = {} @audio = {} @passes = [] @state = OpenEntity.new + @temp_state = OpenEntity.new @state.tick_count = -1 @runtime = runtime @recording = recording @@ -35204,11 +37995,12 @@ module GTK def serialize { - state: state.as_hash, - inputs: inputs.serialize, - passes: passes.serialize, - outputs: outputs.serialize, - grid: grid.serialize + state: state.as_hash, + temp_state: temp_state.as_hash, + inputs: inputs.serialize, + passes: passes.serialize, + outputs: outputs.serialize, + grid: grid.serialize } end @@ -35340,11 +38132,28 @@ module GTK def autocomplete_methods [:inputs, :outputs, :gtk, :state, :geometry, :audio, :grid, :layout, :fn] end + + def method_missing name, *args, &block + if (args.length <= 1) && (@state.as_hash.key? name) + raise <<-S +* ERROR - :#{name} method missing on ~#{self.class.name}~. +The method + :#{name} +with args + #{args} +doesn't exist on #{inspect}. +** POSSIBLE SOLUTION - ~args.state.#{name}~ exists. +Did you forget ~.state~ before ~.#{name}~? +S + end + + super + end end end </code></pre> -<h3 id='----assert.rb'>assert.rb</h3> +<h3 id='----assert-rb'>assert.rb</h3> <pre><code class="language-ruby"># ./dragon/assert.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -35372,10 +38181,10 @@ To add an assertion open up this class and write: class Assert def custom_assertion actual, expected, message = nil - # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). + # this tells Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). @assertion_performed = true - # perform your custom logic here and rais an exception to denote a failure. + # perform your custom logic here and raise an exception to denote a failure. raise "Some Error. #{message}." end @@ -35385,14 +38194,14 @@ end attr :assertion_performed =begin -Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). +Use this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). =end def ok! @assertion_performed = true end =begin -Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. +Assert if a value is a truthy value. All assert methods take an optional final parameter that is the message to display to the user. @example @@ -35446,7 +38255,7 @@ end @assertion_performed = true if actual != expected actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip - message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}\n#{message}" raise message end nil @@ -35456,7 +38265,7 @@ end @assertion_performed = true if actual == expected actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip - message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}\n#{message}" raise message end nil @@ -35486,7 +38295,7 @@ end end </code></pre> -<h3 id='----attr_gtk.rb'>attr_gtk.rb</h3> +<h3 id='----attr_gtk-rb'>attr_gtk.rb</h3> <pre><code class="language-ruby"># ./dragon/attr_gtk.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -35509,6 +38318,10 @@ module AttrGTK args.state end + def temp_state + args.temp_state + end + def inputs args.inputs end @@ -35536,11 +38349,20 @@ module AttrGTK def layout args.layout end + + def new_entity entity_type, init_hash = nil, &block + args.state.new_entity entity_type, init_hash, &block + end + + def new_entity_strict entity_type, init_hash = nil, &block + args.state.new_entity_strict entity_type, init_hash, &block + end end </code></pre> -<h3 id='----attr_sprite.rb'>attr_sprite.rb</h3> +<h3 id='----attr_sprite-rb'>attr_sprite.rb</h3> <pre><code class="language-ruby"># ./dragon/attr_sprite.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # attr_sprite.rb has been released under MIT (*only this file*). @@ -35580,7 +38402,7 @@ module AttrSprite attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, :tile_y, :tile_w, :tile_h, :flip_horizontally, :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, - :source_x, :source_y, :source_w, :source_h + :source_x, :source_y, :source_w, :source_h, :blendmode_enum def primitive_marker :sprite @@ -35600,8 +38422,9 @@ module AttrSprite end </code></pre> -<h3 id='----console.rb'>console.rb</h3> +<h3 id='----console-rb'>console.rb</h3> <pre><code class="language-ruby"># ./dragon/console.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console.rb has been released under MIT (*only this file*). @@ -35613,17 +38436,20 @@ module GTK class Console include ConsoleDeprecated - attr_accessor :show_reason, :log, :logo, :background_color, - :text_color, :animation_duration, + attr_accessor :show_reason, :log, :logo, + :animation_duration, :max_log_lines, :max_history, :log, - :last_command_errored, :last_command, :error_color, :shown_at, - :header_color, :archived_log, :last_log_lines, :last_log_lines_count, + :last_command_errored, :last_command, :shown_at, + :archived_log, :last_log_lines, :last_log_lines_count, :suppress_left_arrow_behavior, :command_set_at, :toast_ids, :bottom, - :font_style, :menu + :font_style, :menu, + :background_color, :spam_color, :text_color, :warn_color, + :error_color, :header_color, :code_color, :comment_color, + :debug_color, :unfiltered_color def initialize - @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) + @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1) @menu = Menu.new self @disabled = false @log_offset = 0 @@ -35638,13 +38464,22 @@ module GTK @command_history_index = -1 @nonhistory_input = '' @logo = 'console-logo.png' - @history_fname = 'console_history.txt' + @history_fname = 'logs/console_history.txt' @background_color = Color.new [0, 0, 0, 224] - @text_color = Color.new [255, 255, 255] - @error_color = Color.new [200, 50, 50] @header_color = Color.new [100, 200, 220] + @code_color = Color.new [210, 168, 255] + @comment_color = Color.new [0, 200, 100] @animation_duration = 1.seconds @shown_at = -1 + + # these are the colors for text at various log levels. + @spam_color = Color.new [160, 160, 160] + @debug_color = Color.new [0, 255, 0] + @text_color = Color.new [255, 255, 255] + @warn_color = Color.new [255, 255, 0] + @error_color = Color.new [200, 50, 50] + @unfiltered_color = Color.new [0, 255, 255] + load_history end @@ -35710,7 +38545,13 @@ module GTK nil end - def add_text obj + def add_text obj, loglevel=-1 + # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic" + loglevel = -1 if loglevel < 0 + loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down) + loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well + colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil + @last_log_lines_count ||= 1 @log_invocation_count += 1 @@ -35719,12 +38560,18 @@ module GTK log_lines = [] str.each_line do |s| - s.wrapped_lines(self.console_text_width).each do |l| - log_lines << l + if colorstr.nil? + s.wrapped_lines(self.console_text_width).each do |l| + log_lines << l + end + else + s.wrapped_lines(self.console_text_width).each do |l| + log_lines << "#{colorstr}#{l}" + end end end - if log_lines == @last_log_lines + if log_lines == @last_log_lines && log_lines.length != 0 @last_log_lines_count += 1 new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})" if log_lines.length > 1 @@ -35917,6 +38764,8 @@ S if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa' $gtk.request_quit + elsif cmd.start_with? ':' + send ((cmd.gsub '-', '_').gsub ':', '') else puts "-> #{cmd}" begin @@ -35925,13 +38774,19 @@ S if $results.nil? puts "=> nil" elsif $results == :console_silent_eval + # do nothing since the console is silent else puts "=> #{$results}" end @last_command_errored = false rescue Exception => e try_search_docs e - puts "* EXCEPTION: #{e}" + # if an exception is thrown and the bactrace includes something helpful, then show it + if (e.backtrace || []).first && (e.backtrace.first.include? "(eval)") + puts "* EXCEPTION: #{e}" + else + puts "* EXCEPTION: #{e}\n#{e.__backtrace_to_org__}" + end end end end @@ -35991,10 +38846,12 @@ S def mouse_wheel_scroll args @inertia ||= 0 - if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 - @inertia = 1 - elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 - @inertia = -1 + if args.inputs.mouse.wheel + if args.inputs.mouse.wheel.y > 0 + @inertia = 1 + elsif args.inputs.mouse.wheel.y < 0 + @inertia = -1 + end end if args.inputs.mouse.click @@ -36003,13 +38860,11 @@ S return if @inertia == 0 - if @inertia != 0 - @inertia = (@inertia * 0.7) - if @inertia > 0 - @log_offset -= 1 - elsif @inertia < 0 - @log_offset += 1 - end + @inertia = (@inertia * 0.7) + if @inertia > 0 + @log_offset += 1 + elsif @inertia < 0 + @log_offset -= 1 end if @inertia.abs < 0.01 @@ -36027,6 +38882,7 @@ S if console_toggle_key_down? args args.inputs.text.clear toggle + args.inputs.keyboard.clear if !@visible end return unless visible? @@ -36038,7 +38894,16 @@ S @log_offset = 0 if @log_offset < 0 if args.inputs.keyboard.key_down.enter - eval_the_set_command + if slide_progress > 0.5 + # in the event of an exception, the console window pops up + # and is pre-filled with $gtk.reset. + # there is an annoying scenario where the exception could be thrown + # by pressing enter (while playing the game). if you press enter again + # quickly, then the game is reset which closes the console. + # so enter in the console is only evaluated if the slide_progress + # is atleast half way down the page. + eval_the_set_command + end elsif args.inputs.keyboard.key_down.v if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta prompt << $gtk.ffi_misc.getclipboard @@ -36115,7 +38980,7 @@ S def write_line(args, left, y, str, archived: false) color = color_for_log_entry(str) color = color.mult_alpha(0.5) if archived - + str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color) end @@ -36158,6 +39023,11 @@ S end render_log_offset args + + args.outputs.reserved << { x: 10.from_right, y: @bottom + 10, + text: "Press CTRL+g or ESCAPE to clear the prompt.", + vertical_alignment_enum: 0, + alignment_enum: 2, r: 80, g: 80, b: 80 }.label! end def render_log_offset args @@ -36180,7 +39050,7 @@ S end def include_subdued_markers? text - include_any_words? text, subdued_markers + (text.start_with? "* INFO: ") && (include_any_words? text, subdued_markers) end def include_any_words? text, words @@ -36326,8 +39196,34 @@ S (log_entry.start_with? "**** ") end - def color_for_log_entry(log_entry) - if include_row_marker? log_entry + def code? log_entry + (just_symbol? log_entry) || (codeblock_marker? log_entry) + end + + def just_symbol? log_entry + scrubbed = log_entry.gsub("*", "").strip + (scrubbed.start_with? ":") && (!scrubbed.include? " ") && (!scrubbed.include? "=>") + end + + def code_comment? log_entry + return true if log_entry.strip.start_with?("# ") + return false + end + + def codeblock_marker? log_entry + return true if log_entry.strip.start_with?("#+begin_src") + return true if log_entry.strip.start_with?("#+end_src") + return false + end + + def color_for_plain_text log_entry + log_entry = log_entry[4..-1] if log_entry.start_with? "!c!" + + if code? log_entry + @code_color + elsif code_comment? log_entry + @comment_color + elsif include_row_marker? log_entry @text_color elsif include_error_marker? log_entry @error_color @@ -36342,6 +39238,29 @@ S end end + def color_for_log_entry(log_entry) + if log_entry.start_with?('!c!') # loglevel color specified. + return case log_entry[3..3].to_i + when 0 # spam + @spam_color + when 1 # debug + @debug_color + #when 2 # info (caught by the `else` block.) + # @text_color + when 3 # warn + @warn_color + when 4 # error + @error_color + when 5 # unfiltered + @unfiltered_color + else + color_for_plain_text log_entry + end + end + + return color_for_plain_text log_entry + end + def prompt @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width) end @@ -36374,8 +39293,9 @@ S end </code></pre> -<h3 id='----console_color.rb'>console_color.rb</h3> +<h3 id='----console_color-rb'>console_color.rb</h3> <pre><code class="language-ruby"># ./dragon/console_color.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_color.rb has been released under MIT (*only this file*). @@ -36400,6 +39320,10 @@ module GTK @color end + def to_s + "GTK::Console::Color #{to_h}" + end + def to_h { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } end @@ -36408,8 +39332,9 @@ module GTK end </code></pre> -<h3 id='----console_font_style.rb'>console_font_style.rb</h3> +<h3 id='----console_font_style-rb'>console_font_style.rb</h3> <pre><code class="language-ruby"># ./dragon/console_font_style.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_font_style.rb has been released under MIT (*only this file*). @@ -36445,15 +39370,16 @@ module GTK size_enum: size_enum, alignment_enum: alignment_enum, **color.to_h, - }.label + }.label! end end end end </code></pre> -<h3 id='----console_menu.rb'>console_menu.rb</h3> +<h3 id='----console_menu-rb'>console_menu.rb</h3> <pre><code class="language-ruby"># ./dragon/console_menu.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_menu.rb has been released under MIT (*only this file*). @@ -36507,7 +39433,7 @@ module GTK def itch_wizard_clicked @console.scroll_to_bottom - $wizards.itch.start + $wizards.itch.restart end def docs_clicked @@ -36532,6 +39458,7 @@ module GTK @buttons = [ (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked), (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), + *custom_buttons ] elsif @menu_shown == :hidden @buttons = [ @@ -36590,8 +39517,8 @@ module GTK method: method }.let do |entity| primitives = [] - primitives << entity[:rect].merge(a: 164).solid - primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border + primitives << entity[:rect].solid!(a: 164) + primitives << entity[:rect].border!(r: 255, g: 255, b: 255) primitives << text.wrapped_lines(5) .map_with_index do |l, i| [ @@ -36615,8 +39542,9 @@ module GTK end </code></pre> -<h3 id='----console_prompt.rb'>console_prompt.rb</h3> +<h3 id='----console_prompt-rb'>console_prompt.rb</h3> <pre><code class="language-ruby"># ./dragon/console_prompt.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_prompt.rb has been released under MIT (*only this file*). @@ -36776,11 +39704,11 @@ S # partition the original list of items into a string to be printed items.each_slice(columns).each_with_index do |cells, i| - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns pretty_print_row cells, string_width, cell_width, column_width, columns end - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns end end @@ -36793,17 +39721,17 @@ S "#{" " * (string_width.length - c.length) } #{c} |" end.join - # remove seperators between empty values + # remove separators between empty values formated_row = formated_row.gsub(" | ", " ") puts formated_row end - def pretty_print_row_seperator string_width, cell_width, column_width, columns + def pretty_print_row_separator string_width, cell_width, column_width, columns # this is a joint: +-------- column_joint = "+#{"-" * cell_width}" - # multiple joints create a row seperator: +----+----+ + # multiple joints create a row separator: +----+----+ puts (column_joint * columns) + "+" end @@ -36812,12 +39740,12 @@ S args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 0.5, y: y + 5, x2: x + @cursor_position_px + 0.5, - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 1, y: y + 5, x2: x + @cursor_position_px + 1, - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) # debugging rectangle for string # args.outputs.reserved << (@cursor_color.to_h.merge x: x, @@ -36892,7 +39820,7 @@ S end </code></pre> -<h3 id='----controller.rb'>controller.rb</h3> +<h3 id='----controller-rb'>controller.rb</h3> <pre><code class="language-ruby"># ./dragon/controller.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37018,7 +39946,7 @@ end </code></pre> -<h3 id='----controller/config.rb'>controller/config.rb</h3> +<h3 id='----controller/config-rb'>controller/config.rb</h3> <pre><code class="language-ruby"># ./dragon/controller/config.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37421,7 +40349,7 @@ module GTK end </code></pre> -<h3 id='----controller/keys.rb'>controller/keys.rb</h3> +<h3 id='----controller/keys-rb'>controller/keys.rb</h3> <pre><code class="language-ruby"># ./dragon/controller/keys.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37439,7 +40367,7 @@ module GTK :l1, :r1, :l2, :r2, :l3, :r3, - :start, :select, + :start, :select, :home, :directional_up, :directional_down, :directional_left, :directional_right ].freeze @@ -37447,6 +40375,22 @@ module GTK attr label end + def back + @select + end + + def back= value + @select = value + end + + def guide + @home + end + + def guide= value + @home = value + end + # Activate a key. # # @return [void] @@ -37476,7 +40420,7 @@ module GTK end </code></pre> -<h3 id='----directional_input_helper_methods.rb'>directional_input_helper_methods.rb</h3> +<h3 id='----directional_input_helper_methods-rb'>directional_input_helper_methods.rb</h3> <pre><code class="language-ruby"># ./dragon/directional_input_helper_methods.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37493,7 +40437,7 @@ module GTK error_message = <<-S * ERROR -The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy: +The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy: - (#{ directional_methods.join("|") }) - key_held.(#{ directional_methods.join("|") }) @@ -37550,6 +40494,12 @@ S end end + def directional_angle + return nil unless directional_vector + + Math.atan2(up_down, left_right).to_degrees + end + def method_missing m, *args # combine the key with ctrl_ if m.to_s.start_with?("ctrl_") @@ -37572,7 +40522,7 @@ S end </code></pre> -<h3 id='----easing.rb'>easing.rb</h3> +<h3 id='----easing-rb'>easing.rb</h3> <pre><code class="language-ruby"># ./dragon/easing.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37585,8 +40535,8 @@ module GTK ease_extended start_tick, current_tick, start_tick + duration, - (initial_value *definitions), - (final_value *definitions), + initial_value(*definitions), + final_value(*definitions), *definitions end @@ -37672,7 +40622,7 @@ end Easing = GTK::Easing </code></pre> -<h3 id='----entity.rb'>entity.rb</h3> +<h3 id='----entity-rb'>entity.rb</h3> <pre><code class="language-ruby"># ./dragon/entity.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37767,7 +40717,7 @@ S end </code></pre> -<h3 id='----geometry.rb'>geometry.rb</h3> +<h3 id='----geometry-rb'>geometry.rb</h3> <pre><code class="language-ruby"># ./dragon/geometry.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -37776,6 +40726,22 @@ end module GTK module Geometry + def self.rotate_point point, angle, around = nil + s = Math.sin angle.to_radians + c = Math.cos angle.to_radians + px = point.x + py = point.y + cx = 0 + cy = 0 + if around + cx = around.x + cy = around.y + end + + point.merge(x: ((px - cx) * c - (py - cy) * s) + cx, + y: ((px - cx) * s + (py - cy) * c) + cy) + end + # Returns f(t) for a cubic Bezier curve. def self.cubic_bezier t, a, b, c, d s = 1 - t @@ -37857,7 +40823,7 @@ module GTK rescue Exception => e raise e, <<-S * ERROR: -center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +center_inside_rect for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -37874,7 +40840,7 @@ S rescue Exception => e raise e, <<-S * ERROR: -center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +center_inside_rect_x for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -37891,7 +40857,7 @@ S rescue Exception => e raise e, <<-S * ERROR: -center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +center_inside_rect_y for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -37900,7 +40866,7 @@ S end - # Returns a primitive that is anchored/repositioned based off its retangle. + # Returns a primitive that is anchored/repositioned based off its rectangle. # @gtk def anchor_rect anchor_x, anchor_y current_w = self.w @@ -37943,8 +40909,16 @@ S end # @gtk - def self.line_y_intercept line - line.y - line_slope(line) * line.x + def self.line_y_intercept line, replace_infinity: nil + line.y - line_slope(line, replace_infinity: replace_infinity) * line.x + rescue Exception => e +raise <<-S +* ERROR: ~Geometry::line_y_intercept~ +The following exception was thrown for line: #{line} +#{e} + +Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. +S end # @gtk @@ -38020,14 +40994,22 @@ S end # @gtk - def self.line_intersect line_one, line_two - m1 = line_slope(line_one) - m2 = line_slope(line_two) - b1 = line_y_intercept(line_one) - b2 = line_y_intercept(line_two) + def self.line_intersect line_one, line_two, replace_infinity: nil + m1 = line_slope(line_one, replace_infinity: replace_infinity) + m2 = line_slope(line_two, replace_infinity: replace_infinity) + b1 = line_y_intercept(line_one, replace_infinity: replace_infinity) + b2 = line_y_intercept(line_two, replace_infinity: replace_infinity) x = (b1 - b2) / (m2 - m1) y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2)) [x, y] + rescue Exception => e +raise <<-S +* ERROR: ~Geometry::line_intersect~ +The following exception was thrown for line_one: #{line_one}, line_two: #{line_two} +#{e} + +Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. +S end def self.contract_intersect_rect? @@ -38036,10 +41018,10 @@ S # @gtk def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 - return false if rect_one.right - tolerance < rect_two.left + tolerance - return false if rect_one.left + tolerance > rect_two.right - tolerance - return false if rect_one.top - tolerance < rect_two.bottom + tolerance - return false if rect_one.bottom + tolerance > rect_two.top - tolerance + return false if ((rect_one.x + rect_one.w) - tolerance) < (rect_two.x + tolerance) + return false if (rect_one.x + tolerance) > ((rect_two.x + rect_two.w) - tolerance) + return false if ((rect_one.y + rect_one.h) - tolerance) < (rect_two.y + tolerance) + return false if (rect_one.y + tolerance) > ((rect_two.y + rect_two.h) - tolerance) return true rescue Exception => e context_help_rect_one = (rect_one.__help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] @@ -38067,6 +41049,7 @@ S - rect_one: #{rect_one} - rect_two: #{rect_two} #{context_help} +\n#{e} S end @@ -38077,14 +41060,14 @@ S y = y.shift_down(size * anchor_y) [x, y, size, size] rescue Exception => e - raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" end # @gtk def self.distance point_one, point_two Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2) rescue Exception => e - raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}." + raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}.\n#{e}" end # @gtk @@ -38093,31 +41076,34 @@ S d_x = end_point.x - start_point.x Math::PI.+(Math.atan2(d_y, d_x)).to_degrees rescue Exception => e - raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" end # @gtk def self.angle_to start_point, end_point angle_from end_point, start_point rescue Exception => e - raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" end # @gtk def self.point_inside_circle? point, circle_center_point, radius (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2 rescue Exception => e - raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}" + raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}.\n#{e}" end # @gtk def self.inside_rect? inner_rect, outer_rect, tolerance = 0.0 + return nil if !inner_rect + return nil if !outer_rect + inner_rect.x + tolerance >= outer_rect.x - tolerance && - inner_rect.right - tolerance <= outer_rect.right + tolerance && + (inner_rect.x + inner_rect.w) - tolerance <= (outer_rect.x + outer_rect.w) + tolerance && inner_rect.y + tolerance >= outer_rect.y - tolerance && - inner_rect.top - tolerance <= outer_rect.top + tolerance + (inner_rect.y + inner_rect.h) - tolerance <= (outer_rect.y + outer_rect.h) + tolerance rescue Exception => e - raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}." + raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}.\n#{e}" end # @gtk @@ -38152,7 +41138,7 @@ S return rect end rescue Exception => e - raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" end # @gtk @@ -38166,13 +41152,27 @@ S anchor_x: anchor_x, anchor_y: anchor_y rescue Exception => e - raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]." + raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)].\n#{e}" + end + + def self.rect_to_line rect + l = rect.to_hash.line + l.merge(x2: l.x + l.w - 1, + y2: l.y + l.h) + end + + def self.rect_center_point rect + { x: rect.x + rect.w.half, y: rect.y + rect.h.half } + end + + def rect_center_point + Geometry.rect_center_point self end end # module Geometry end # module GTK </code></pre> -<h3 id='----grid.rb'>grid.rb</h3> +<h3 id='----grid-rb'>grid.rb</h3> <pre><code class="language-ruby"># ./dragon/grid.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -38361,11 +41361,19 @@ module GTK def bottom_right [@right, @bottom].point end + + def x + 0 + end + + def y + 0 + end end end </code></pre> -<h3 id='----inputs.rb'>inputs.rb</h3> +<h3 id='----inputs-rb'>inputs.rb</h3> <pre><code class="language-ruby"># ./dragon/inputs.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -38560,6 +41568,30 @@ module GTK } end + def self.method_to_key_hash + return @method_to_key_hash if @method_to_key_hash + @method_to_key_hash = {} + string_representation_overrides ||= { + backspace: '\b' + } + char_to_method_hash.each do |k, v| + v.each do |vi| + t = { char_or_raw_key: k } + + if k.is_a? Numeric + t[:raw_key] = k + t[:string_representation] = "raw_key == #{k}" + else + t[:char] = k + t[:string_representation] = "\"#{k.strip}\"" + end + + @method_to_key_hash[vi] = t + end + end + @method_to_key_hash + end + def self.char_to_method char, int = nil methods = char_to_method_hash[char] || char_to_method_hash[int] methods ? methods.dup : [char.to_sym || int] @@ -38658,7 +41690,8 @@ module GTK value = Kernel.tick_count if value collection.each do |m| - self.instance_variable_set("@#{m.to_s}".to_sym, value) + m_to_s = m.to_s + self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0 rescue Exception => e raise e, <<-S * ERROR: @@ -38674,24 +41707,32 @@ S end def method_missing m, *args - begin - define_singleton_method(m) do - r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) - clear_key m - return r - end + if KeyboardKeys.method_to_key_hash[m.without_ending_bang] + begin + define_singleton_method(m) do + r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) + clear_key m + return r + end - return self.send m - rescue Exception => e - log_important "#{e}" + return self.send m + rescue Exception => e + log_important "#{e}" + end end + did_you_mean = KeyboardKeys.method_to_key_hash.find_all do |k, v| + k.to_s[0..1] == m.to_s[0..1] + end.map {|k, v| ":#{k} (#{v[:string_representation]})" } + did_you_mean_string = "" + did_you_mean_string = ". Did you mean #{did_you_mean.join ", "}?" + raise <<-S * ERROR: -There is no member on the keyboard called #{m}. Here is a to_s representation of what's available: - -#{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")} +#{KeyboardKeys.method_to_key_hash.map { |k, v| "** :#{k} #{v.string_representation}" }.join("\n")} +There is no key on the keyboard called :#{m}#{did_you_mean_string}. +Full list of available keys =:points_up:=. S end @@ -39075,6 +42116,10 @@ module GTK (controller_one && controller_one.directional_vector) end + def directional_angle + keyboard.directional_angle || (controller_one && controller_one.directional_angle) + end + # Returns a signal indicating right (`1`), left (`-1`), or neither ('0'). # # @return [Integer] @@ -39142,21 +42187,16 @@ module GTK end </code></pre> -<h3 id='----ios_wizard.rb'>ios_wizard.rb</h3> +<h3 id='----ios_wizard-rb'>ios_wizard.rb</h3> <pre><code class="language-ruby"># ./dragon/ios_wizard.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # ios_wizard.rb has been released under MIT (*only this file*). -class WizardException < Exception - attr_accessor :console_primitives - - def initialize *console_primitives - @console_primitives = console_primitives - end -end +# Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński -class IOSWizard +class IOSWizard < Wizard def initialize @doctor_executed_at = 0 end @@ -39169,23 +42209,46 @@ class IOSWizard @steps ||= [] end - def steps_development_build + def prerequisite_steps [ :check_for_xcode, :check_for_brew, :check_for_certs, - :check_for_device, - :check_for_dev_profile, + ] + end + + def app_metadata_retrieval_steps + [ :determine_team_identifier, :determine_app_name, :determine_app_id, - :blow_away_temp, + ] + end + + def steps_development_build + [ + *prerequisite_steps, + + :check_for_device, + :check_for_dev_profile, + + *app_metadata_retrieval_steps, + :determine_devcert, + + :clear_tmp_directory, :stage_app, + :development_write_info_plist, + :write_entitlements_plist, :compile_icons, - :create_payload_directory, + :clear_payload_directory, + + :create_payload_directory_dev, + + :create_payload, :code_sign_payload, + :create_ipa, :deploy ] @@ -39193,20 +42256,28 @@ class IOSWizard def steps_production_build [ - :check_for_xcode, - :check_for_brew, - :check_for_certs, + *prerequisite_steps, + :check_for_distribution_profile, - :determine_team_identifier, - :determine_app_name, - :determine_app_id, - :blow_away_temp, + :determine_app_version, + + *app_metadata_retrieval_steps, + :determine_prodcert, + + :clear_tmp_directory, :stage_app, + :production_write_info_plist, + :write_entitlements_plist, :compile_icons, - :create_payload_directory, + :clear_payload_directory, + + :create_payload_directory_prod, + + :create_payload, :code_sign_payload, + :create_ipa, :print_publish_help ] @@ -39242,6 +42313,8 @@ class IOSWizard @steps = steps_development_build @steps = steps_production_build if @production_build @certificate_name = nil + @app_version = opts[:version] + @app_version = "1.0" if @opts[:env] == :dev && !@app_version init_wizard_status log_info "Starting iOS Wizard so we can deploy to your device." @start_at = Kernel.global_tick_count @@ -39263,8 +42336,10 @@ class IOSWizard log "=" * $console.console_text_width else log_error e.to_s + log e.__backtrace_to_org__ end + init_wizard_status $console.set_command "$wizards.ios.start env: :#{@opts[:env]}" end @@ -39371,13 +42446,70 @@ class IOSWizard return "profiles/development.mobileprovision" end + def ios_metadata_template + <<-S +# ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps. +# Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase + +# teamid needs to be set to your assigned Team Id which can be found at https://developer.apple.com/account/#/membership/ +teamid= +# appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list +appid= +# appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters. +appname= +# devcert is the certificate to use for development/deploying to your local device +devcert= +# prodcert is the certificate to use for distribution to the app store +prodcert= +S + end + + def ios_metadata + contents = $gtk.read_file 'metadata/ios_metadata.txt' + + if !contents + $gtk.write_file 'metadata/ios_metadata.txt', ios_metadata_template + contents = $gtk.read_file 'metadata/ios_metadata.txt' + end + + kvps = contents.each_line + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } + .map do |l| + key, value = l.split("=") + [key.strip.to_sym, value.strip] + end.flatten + Hash[*kvps] + end + + def game_metadata + contents = $gtk.read_file 'metadata/game_metadata.txt' + + kvps = contents.each_line + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } + .map do |l| + key, value = l.split("=") + [key.strip.to_sym, value.strip] + end.flatten + Hash[*kvps] + end + + def raise_ios_metadata_required + raise WizardException.new( + "* mygame/metadata/ios_metadata.txt needs to be filled out.", + "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.", + "Instructions for where the values should come from are within metadata/ios_metadata.txt." + ) + end + def determine_team_identifier - @team_name = (team_identifier_from_provisioning_profile @opts[:env]) - log_info "Team Identifer is: #{@team_name}" + @team_id = (ios_metadata.teamid || "") + raise_ios_metadata_required if @team_id.strip.length == 0 + log_info "Team Identifer is: #{@team_id}" end def determine_app_name - @app_name = (provisioning_profile_xml @opts[:env])[:children].first[:children].first[:children][1][:children].first[:data] + @app_name = (ios_metadata.appname || "") + raise_ios_metadata_required if @app_name.strip.length == 0 log_info "App name is: #{@app_name}." end @@ -39401,37 +42533,22 @@ class IOSWizard $gtk.parse_xml scrubbed end - def app_id_from_provisioning_profile environment - application_identifier_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| - if node[:children] && node[:children][0] && node[:children][0][:data] == "application-identifier" - application_identifier_index = i - break - end - end - - app_id_with_team_identifier = (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][application_identifier_index + 1][:children].first[:data] - team_identifer = team_identifier_from_provisioning_profile environment - app_id_with_team_identifier.gsub "#{team_identifer}.", "" + def determine_app_id + @app_id = ios_metadata.appid + raise_ios_metadata_required if @app_id.strip.length == 0 + log_info "App Identifier is set to: #{@app_id}" end - def team_identifier_from_provisioning_profile environment - team_identifer_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] - - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| - if node[:children] && node[:children][0] && node[:children][0][:data] == "com.apple.developer.team-identifier" - team_identifer_index = i - break - end - end - - (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][team_identifer_index + 1][:children].first[:data] + def determine_devcert + @certificate_name = ios_metadata.devcert + raise_ios_metadata_required if @certificate_name.strip.length == 0 + log_info "Dev Certificate is set to: #{@certificate_name}" end - def determine_app_id - @app_id = app_id_from_provisioning_profile @opts[:env] - - log_info "App Identifier is set to : #{@app_id}" + def determine_prodcert + @certificate_name = ios_metadata.prodcert + raise_ios_metadata_required if @certificate_name.strip.length == 0 + log_info "Production (Distribution) Certificate is set to: #{@certificate_name}" end def set_app_name name @@ -39449,16 +42566,10 @@ class IOSWizard end end - def blow_away_temp + def clear_tmp_directory sh "rm -rf #{tmp_directory}" end - def stage_app - log_info "Staging." - sh "mkdir -p #{tmp_directory}" - sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" - end - def set_app_id id log_info = "App Id set to: #{id}" @app_id = id @@ -39489,34 +42600,13 @@ class IOSWizard def check_for_certs log_info "Attempting to find certificates on your computer." - if !cli_app_exist?(security_cli_app) - raise WizardException.new( - "* It doesn't look like you have #{security_cli_app}.", - "** 1. Open Disk Utility and run First Aid.", - { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") }, - ) - end - - if valid_certs.length == 0 - raise WizardException.new( - "* It doesn't look like you have any valid certs installed.", - "** 1. Open Xcode.", - "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.", - { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") }, - "** 3. After loggin in, select Manage Certificates...", - { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") }, - "** 4. Add a certificate for Apple Development.", - { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") }, - ) - raise "You do not have any Apple development certs on this computer." - end - if @production_build - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name] + @certificate_name = ios_metadata[:prodcert] else - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name] + @certificate_name = ios_metadata[:devcert] end - log_info "I will be using Certificate: '#{@certificate_name}'." + + log_info "I will be using certificate: '#{@certificate_name}'." end def idevice_id_cli_app @@ -39531,24 +42621,6 @@ class IOSWizard "xcodebuild" end - def valid_certs - certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l| - if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution")) - l.strip - else - nil - end - end.reject_nil.map do |l| - number, id, name = l.split(' ', 3) - name = name.gsub("\"", "") if name - { - number: 1, - id: id, - name: name - } - end - end - def connected_devices sh("idevice_id -l").strip.each_line.map do |l| l.strip @@ -39590,7 +42662,8 @@ XML log_info "Creating Entitlements.plist" - $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_name}.#{@app_id}").strip + $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip + $gtk.write_file_root "tmp/ios/Entitlements.txt", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip sh "/usr/bin/plutil -convert binary1 \"#{tmp_directory}/Entitlements.plist\"" sh "/usr/bin/plutil -convert xml1 \"#{tmp_directory}/Entitlements.plist\"" @@ -39628,15 +42701,15 @@ XML <key>CFBundleExecutable</key> <string>:app_name</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.6</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>5.6</string> + <string>:app_version</string> <key>CFBundleIcons</key> <dict> <key>CFBundlePrimaryIcon</key> @@ -39785,13 +42858,13 @@ XML <key>CFBundleIdentifier</key> <string>:app_id</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundleName</key> <string>:app_name</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.2</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> @@ -39799,7 +42872,7 @@ XML <string>iPhoneOS</string> </array> <key>CFBundleVersion</key> - <string>5.2</string> + <string>:app_version</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> @@ -39885,6 +42958,7 @@ XML info_plist_string.gsub!(":app_id", @app_id) $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip @info_plist_written = true end @@ -39938,13 +43012,13 @@ XML <key>CFBundleIdentifier</key> <string>:app_id</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundleName</key> <string>:app_name</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.2</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> @@ -39952,7 +43026,7 @@ XML <string>iPhoneOS</string> </array> <key>CFBundleVersion</key> - <string>5.2</string> + <string>:app_version</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> @@ -40036,8 +43110,10 @@ XML info_plist_string.gsub!(":app_name", @app_name) info_plist_string.gsub!(":app_id", @app_id) + info_plist_string.gsub!(":app_version", @app_version) $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip @info_plist_written = true end @@ -40059,28 +43135,56 @@ XML "#{relative_path}/#{$gtk.cli_arguments[:dragonruby]}" end - def write_ip_address + def embed_mobileprovision + sh %Q[cp #{@provisioning_profile_path} "#{app_path}/embedded.mobileprovision"] + sh %Q[/usr/bin/plutil -convert binary1 "#{app_path}/Info.plist"] + end + + def clear_payload_directory + sh %Q[rm "#{@app_name}".ipa] + sh %Q[rm -rf "#{app_path}/app"] + sh %Q[rm -rf "#{app_path}/sounds"] + sh %Q[rm -rf "#{app_path}/sprites"] + sh %Q[rm -rf "#{app_path}/data"] + sh %Q[rm -rf "#{app_path}/fonts"] + end + + def stage_app + log_info "Staging." + sh "mkdir -p #{tmp_directory}" + sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" + sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"] + sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"] + sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"] + sh %Q[cp -r "#{root_folder}/data/" "#{app_path}/data/"] + sh %Q[cp -r "#{root_folder}/fonts/" "#{app_path}/fonts/"] + end + + def create_payload + sh %Q[mkdir -p #{tmp_directory}/ipa_root/Payload] + sh %Q[cp -r "#{app_path}" "#{tmp_directory}/ipa_root/Payload"] + sh %Q[chmod -R 755 "#{tmp_directory}/ipa_root/Payload"] + end + + def create_payload_directory_dev + # write dev machine's ip address for hotloading $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip + + embed_mobileprovision + clear_payload_directory + stage_app end - def create_payload_directory - sh "cp #{@provisioning_profile_path} \"#{app_path}/embedded.mobileprovision\"" - sh "/usr/bin/plutil -convert binary1 \"#{app_path}/Info.plist\"" - write_ip_address - sh "rm \"#{@app_name}\".ipa" - sh "rm -rf \"#{app_path}/app\"" - sh "rm -rf \"#{app_path}/sounds\"" - sh "rm -rf \"#{app_path}/sprites\"" - sh "rm -rf \"#{app_path}/data\"" - sh "rm -rf \"#{app_path}/fonts\"" - sh "cp -r \"#{root_folder}/app/\" \"#{app_path}/app/\"" - sh "cp -r \"#{root_folder}/sounds/\" \"#{app_path}/sounds/\"" - sh "cp -r \"#{root_folder}/sprites/\" \"#{app_path}/sprites/\"" - sh "cp -r \"#{root_folder}/data/\" \"#{app_path}/data/\"" - sh "cp -r \"#{root_folder}/fonts/\" \"#{app_path}/fonts/\"" - sh "mkdir -p #{tmp_directory}/ipa_root/Payload" - sh "cp -r \"#{app_path}\" \"#{tmp_directory}/ipa_root/Payload\"" - sh "chmod -R 755 \"#{tmp_directory}/ipa_root/Payload\"" + def create_payload_directory_prod + # production builds does not hotload ip address + sh %Q[rm "#{root_folder}/app/server_ip_address.txt"] + + embed_mobileprovision + stage_app + + # production build marker + sh %Q[mkdir -p "#{app_path}/metadata/"] + sh %Q[touch metadata/DRAGONRUBY_PRODUCTION_BUILD] end def create_ipa @@ -40113,10 +43217,22 @@ SCRIPT end def print_publish_help - log_info "Go to https://appstoreconnect.apple.com/apps and create an App if you haven't already done so." - log_info "Go to https://appleid.apple.com and create a 'Application Specific Password'." - log_info "To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." - log_info "Your app is located at ./tmp/ios/#{@app_name}.ipa" + has_transporter = (sh "ls /Applications/Transporter.app").include? "Contents" + if !has_transporter + $gtk.openurl "https://apps.apple.com/us/app/transporter/id1450874784?mt=12" + $console.set_command "$wizards.ios.start env: :#{@opts[:env]}, version: \"#{@opts[:version]}\"" + raise WizardException.new( + "* To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." + ) + else + sh "mkdir ./tmp/ios/intermediary_artifacts" + sh "mv \"#{tmp_directory}/#{@app_name}.app\" #{tmp_directory}/intermediary_artifacts/" + sh "mv \"#{tmp_directory}/do_zip.sh\" #{tmp_directory}/intermediary_artifacts" + sh "mv \"#{tmp_directory}/Entitlements.plist\" #{tmp_directory}/intermediary_artifacts" + sh "mv \"#{tmp_directory}/ipa_root\" #{tmp_directory}/intermediary_artifacts/" + sh "open /Applications/Transporter.app" + sh "open ./tmp/ios/" + end end def compile_icons @@ -40137,47 +43253,44 @@ S sh "cp -r \"#{root_folder}/native/\" \"#{app_path}/native/\"" sh "CODESIGN_ALLOCATE=\"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate\" /usr/bin/codesign -f -s \"#{@certificate_name}\" --entitlements #{tmp_directory}/Entitlements.plist \"#{tmp_directory}/#{@app_name}.app/native/ios-device/ext.dylib\"" end + + def set_version version + @app_version = version + start env: @opts[:env], version: version + end + + def app_version + log_info "Attempting to retrieve App Version from metadata/ios_metadata.txt." + ios_version_number = (ios_metadata.version || "").strip + if ios_version_number.length == 0 + log_info "Not found. Attempting to retrieve App Version from metadata/game_metadata.txt." + ios_version_number = (game_metadata.version || "").strip + end + ios_version_number + end + + def determine_app_version + @app_version = app_version + return if @app_version + end end </code></pre> -<h3 id='----itch_wizard.rb'>itch_wizard.rb</h3> +<h3 id='----itch_wizard-rb'>itch_wizard.rb</h3> <pre><code class="language-ruby"># ./dragon/itch_wizard.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # itch_wizard.rb has been released under MIT (*only this file*). -class ItchWizard +class ItchWizard < Wizard def steps [ :check_metadata, - :deploy + :deploy, ] end - def metadata_file_path - "metadata/game_metadata.txt" - end - - def get_metadata - metadata = $gtk.read_file metadata_file_path - - if !metadata - write_blank_metadata - metadata = $gtk.read_file metadata_file_path - end - - dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a - - { - dev_id: dev_id.strip, - dev_title: dev_title.strip, - game_id: game_id.strip, - game_title: game_title.strip, - version: version.strip, - icon: icon.strip - } - end - def write_blank_metadata $gtk.write_file metadata_file_path, <<-S.strip #devid=myname @@ -40195,7 +43308,7 @@ S write_blank_metadata end - if metadata_text.each_line.to_a.length != 6 + if metadata_text.strip.each_line.to_a.length < 6 write_blank_metadata end @@ -40207,70 +43320,67 @@ S if metadata[:dev_id].start_with?("#") || !@dev_id log "* PROMPT: Please provide your username for Itch." - $console.set_command "$wizards.itch.set_dev_id \"your-itch-username\"" + $console.set_command "$wizards.itch.set_dev_id \"#{metadata[:dev_id]}\"" return :need_dev_id end if metadata[:dev_title].start_with?("#") || !@dev_title log "* PROMPT: Please provide developer's/company's name that you want displayed." - $console.set_command "$wizards.itch.set_dev_title \"Your Name\"" + $console.set_command "$wizards.itch.set_dev_title \"#{metadata[:dev_title]}\"" return :need_dev_title end if metadata[:game_id].start_with?("#") || !@game_id log "* PROMPT: Please provide the id for you game. This is the id you specified when you set up a new game page on Itch." - $console.set_command "$wizards.itch.set_game_id \"your-game-id\"" + $console.set_command "$wizards.itch.set_game_id \"#{metadata[:game_id]}\"" return :need_game_id end if metadata[:game_title].start_with?("#") || !@game_title log "* PROMPT: Please provide the display name for your game. (This can include spaces)" - $console.set_command "$wizards.itch.set_game_title \"Your Game\"" + $console.set_command "$wizards.itch.set_game_title \"#{metadata[:game_title]}\"" return :need_game_title end if metadata[:version].start_with?("#") || !@version log "* PROMPT: Please provide the version for your game." - $console.set_command "$wizards.itch.set_version \"1.0\"" + $console.set_command "$wizards.itch.set_version \"#{metadata[:version]}\"" return :need_version end if metadata[:icon].start_with?("#") || !@icon log "* PROMPT: Please provide icon path for your game." - $console.set_command "$wizards.itch.set_icon \"icon.png\"" + $console.set_command "$wizards.itch.set_icon \"#{metadata[:icon]}\"" return :need_icon end + puts "here!! success!!!" + return :success end def set_dev_id value @dev_id = value - write_metadata start end def set_dev_title value @dev_title = value - write_metadata start end def set_game_id value @game_id = value - write_metadata start end def set_game_title value @game_title = value - write_metadata start end def set_version value @version = value - write_metadata start end @@ -40313,7 +43423,7 @@ S end if @icon - text += "icon=metadata/#{@icon}\n" + text += "icon=#{@icon}\n" else text += "#icon=metadata/icon.png\n" end @@ -40331,10 +43441,25 @@ S def deploy log_info "* Running dragonruby-publish: #{package_command}" - results = $gtk.exec package_command + $gtk.openurl "http://itch.io/dashboard" if $gtk.platform == "Mac OS X" + if $gtk.platform? :mac + $gtk.exec "rm -rf ./builds" + end + results = $gtk.exec "#{package_command} --only-package" + puts File.expand_path("./builds") + log "#+begin_src" log results log "#+end_src" + + if $gtk.platform? :mac + $gtk.exec "open ./builds/" + elsif $gtk.platform? :windows + $gtk.exec "powershell \"ii .\"" + end + + $gtk.openurl "https://itch.io/dashboard" + :success end @@ -40345,7 +43470,7 @@ S steps.each do |m| begin log_info "Running Itch Wizard Step: ~$wizards.itch.#{m}~" - result = (send m) || :success if @wizard_status[m][:result] != :success + result = (send m) || :success @wizard_status[m][:result] = result if result != :success log_info "Exiting wizard. :#{result}" @@ -40412,8 +43537,9 @@ S end </code></pre> -<h3 id='----layout.rb'>layout.rb</h3> +<h3 id='----layout-rb'>layout.rb</h3> <pre><code class="language-ruby"># ./dragon/layout.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # layout.rb has been released under MIT (*only this file*). @@ -40692,10 +43818,18 @@ module GTK device.grid_area.row_count end + def row_max_index + row_count - 1 + end + def col_count device.grid_area.col_count end + def col_max_index + col_count - 1 + end + def gutter_height device.grid_area.gutter end @@ -40718,18 +43852,124 @@ module GTK def rect_defaults { - row: nil, - col: nil, - h: 1, - w: 1, - dx: 0, - dy: 0, - rect: :control_rect + row: nil, + col: nil, + h: 1, + w: 1, + dx: 0, + dx_ratio: 1, + dy: 0, + dy_ratio: 1, + dh_ratio: 1, + dw_ratio: 1, + merge: nil, + rect: :control_rect } end - def rect opts + def row n + (rect row: n, col: 0, w: 0, h: 0).x + end + + def row_from_bottom n + (rect row: row_count - n, col: 0, w: 0, h: 0).x + end + + def col n + (rect row: 0, col: n, w: 0, h: 0).y + end + + def col_from_right n + (rect row: 0, col: col_max_index - n, w: 0, h: 0).y + end + + def w n + (rect row: 0, col: 0, w: n, h: 1).w + end + + def h n + (rect row: 0, col: 0, w: 1, h: n).h + end + + def rect_group opts + group = opts.group + r = opts.row || 0 + r = row_max_index - opts.row_from_bottom if opts.row_from_bottom + c = opts.col || 0 + c = col_max_index - opts.col_from_right if opts.col_from_right + drow = opts.drow || 0 + dcol = opts.dcol || 0 + w = opts.w || 0 + h = opts.h || 0 + merge = opts[:merge] + + running_row = r + running_col = c + + running_col = calc_col_offset(opts.col_offset) if opts.col_offset + running_row = calc_row_offset(opts.row_offset) if opts.row_offset + + group.map do |i| + group_layout_opts = i.layout || {} + group_layout_opts = group_layout_opts.merge row: running_row, + col: running_col, + merge: merge, + w: w, h: h + result = (rect group_layout_opts).merge i + + if (i.is_a? Hash) && (i.primitive_marker == :label) + if i.alignment_enum == 1 + result.x += result.w.half + elsif i.alignment_enum == 2 + result.x += result.w + end + end + + running_row += drow + running_col += dcol + result + end + end + + def calc_row_offset opts = {} + count = opts[:count] || opts[:length] || 0 + h = opts.h || 1 + (row_count - (count * h)) / 2.0 + end + + def calc_col_offset opts = {} + count = opts[:count] || opts[:length] || 0 + w = opts.w || 1 + (col_count - (count * w)) / 2.0 + end + + def point opts = {} + opts.w = 1 + opts.h = 1 + opts.row ||= 0 + opts.col ||= 0 + r = rect opts + r.x += r.w * opts.col_anchor if opts.col_anchor + r.y += r.h * opts.row_anchor if opts.row_anchor + r + end + + def rect *all_opts + if all_opts.length == 1 + opts = all_opts.first + else + opts = {} + all_opts.each do |o| + opts.merge! o + end + end + + opts.row = row_max_index - opts.row_from_bottom if opts.row_from_bottom + opts.col = col_max_index - opts.col_from_right if opts.col_from_right opts = rect_defaults.merge opts + opts.row ||= 0 + opts.col ||= 0 + result = send opts[:rect] if opts[:row] && opts[:col] && opts[:w] && opts[:h] col = rect_col opts[:col], opts[:w] @@ -40737,7 +43977,9 @@ module GTK result = control_rect.merge x: col.x, y: row.y, w: col.w, - h: row.h + h: row.h, + center_x: col.center_x, + center_y: row.center_y elsif opts[:row] && !opts[:col] result = rect_row opts[:row], opts[:h] elsif !opts[:row] && opts[:col] @@ -40775,13 +44017,21 @@ module GTK result[:h] += device.grid_area.gutter * 2 end - result[:x] += opts[:dx] if opts[:dx] - result[:y] += opts[:dy] if opts[:dy] - result[:w] += opts[:dw] if opts[:dw] - result[:h] += opts[:dh] if opts[:dh] + result[:x] += opts[:dx] if opts[:dx] + result[:x] *= opts[:dx_ratio] if opts[:dx_ratio] + result[:y] += opts[:dy] if opts[:dy] + result[:y] *= opts[:dy_ratio] if opts[:dy_ratio] + result[:w] += opts[:dw] if opts[:dw] + result[:w] *= opts[:dw_ratio] if opts[:dw_ratio] + result[:h] += opts[:dh] if opts[:dh] + result[:h] *= opts[:dh_ratio] if opts[:dh_ratio] + result.merge! opts[:merge] if opts[:merge] result[:row] = opts[:row] result[:col] = opts[:col] + result[:h] = result[:h].clamp 0 + result[:w] = result[:w].clamp 0 + if $gtk.args.grid.name == :center result[:x] -= 640 result[:y] -= 360 @@ -40816,7 +44066,7 @@ module GTK row_y = device.h - row_y - row_h - result = control_rect.merge y: row_y, h: row_h + result = control_rect.merge y: row_y, h: row_h, center_y: (row_y + row_h.half) @rect_cache[:row][index][h] = result @rect_cache[:row][index][h] end @@ -40839,7 +44089,7 @@ module GTK col_w = col_w.to_i col_w -= 1 if col_w.odd? - result = control_rect.merge x: col_x, w: col_w + result = control_rect.merge x: col_x, w: col_w, center_x: (col_x + col_w.half) @rect_cache[:col][index][w] = result @rect_cache[:col][index][w] end @@ -40890,6 +44140,26 @@ module GTK @device end + def debug_primitives opts = {} + @primitives ||= col_count.map_with_index do |col| + row_count.map_with_index do |row| + cell = rect row: row, col: col + center = Geometry.rect_center_point cell + [ + cell.merge(opts).border, + cell.merge(opts) + .label!(x: center.x, + y: center.y, + text: "#{row},#{col}", + size_enum: -3, + vertical_alignment_enum: 1, + alignment_enum: 1) + ] + end + end + @primitives + end + def serialize { device: @device.serialize, @@ -40903,11 +44173,18 @@ module GTK def to_s serialize.to_s end + + def reset + @primitives = nil + @rect_cache ||= {} + @rect_cache.clear + end + end end </code></pre> -<h3 id='----log.rb'>log.rb</h3> +<h3 id='----log-rb'>log.rb</h3> <pre><code class="language-ruby"># ./dragon/log.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -41040,6 +44317,11 @@ module GTK self.puts message end + def self.reset + @once = {} + nil + end + def self.puts_once *ids, message id = "#{ids}" @once ||= {} @@ -41175,7 +44457,54 @@ class Object end </code></pre> -<h3 id='----numeric.rb'>numeric.rb</h3> +<h3 id='----metadata-rb'>metadata.rb</h3> +<pre><code class="language-ruby"># ./dragon/metadata.rb +# coding: utf-8 +# Copyright 2021 DragonRuby LLC +# MIT License +# metadata.rb has been released under MIT (*only this file*). + +# Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński + +module Metadata + def metadata_file_path + "metadata/game_metadata.txt" + end + + def get_metadata + metadata = $gtk.read_file metadata_file_path + + if !metadata + write_blank_metadata + metadata = $gtk.read_file metadata_file_path + end + + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a + + { + dev_id: dev_id.strip, + dev_title: dev_title.strip, + game_id: game_id.strip, + game_title: game_title.strip, + version: version.strip, + icon: icon.strip + } + end + + def write_blank_metadata + $gtk.write_file metadata_file_path, <<-S.strip +#devid=myname +#devtitle=My Name +#gameid=mygame +#gametitle=My Game +#version=0.1 +#icon=metadata/icon.png +S + end +end + +</code></pre> +<h3 id='----numeric-rb'>numeric.rb</h3> <pre><code class="language-ruby"># ./dragon/numeric.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -41192,6 +44521,35 @@ class Numeric alias_method :lte, :<= alias_method :__original_eq_eq__, :== unless Numeric.instance_methods.include? :__original_eq_eq__ + def to_layout_row opts = {} + $layout.rect(row: self, + col: opts.col || 0, + w: opts.w || 0, + h: opts.h || 0).y + end + + def to_layout_col opts = {} + $layout.rect(row: 0, + col: self, + w: opts.w || 0, + h: opts.h || 0).x + end + + def to_layout_w + $layout.rect(row: 0, col: 0, w: self, h: 1).w + end + + def to_layout_h + $layout.rect(row: 0, col: 0, w: 1, h: self).h + end + + def to_layout_row_from_bottom opts = {} + ($layout.row_max_index - self).to_layout_row opts + end + + def to_layout_col_from_right opts = {} + ($layout.col_max_index - self).to_layout_col opts + end # Converts a numeric value representing seconds into frames. # @@ -41207,10 +44565,26 @@ class Numeric self / 2.0 end + def third + self / 3.0 + end + + def quarter + self / 4.0 + end + def to_byte clamp(0, 255).to_i end + def clamp *opts + min = (opts.at 0) + max = (opts.at 1) + return min if min && self < min + return max if max && self > max + return self + end + def clamp_wrap min, max max, min = min, max if min > max return self if self >= min && self <= max @@ -41435,7 +44809,7 @@ S self * Math::PI.fdiv(180) end - # Converts a number representing an angle in radians to degress. + # Converts a number representing an angle in radians to degrees. # # @gtk def to_degrees @@ -41452,21 +44826,21 @@ S GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y) end - # Returns a normal vector for a number that represents an angle in degress. + # Returns a normal vector for a number that represents an angle in degrees. # # @gtk def vector max_value = 1 [vector_x(max_value), vector_y(max_value)] end - # Returns the y component of a normal vector for a number that represents an angle in degress. + # Returns the y component of a normal vector for a number that represents an angle in degrees. # # @gtk def vector_y max_value = 1 max_value * Math.sin(self.to_radians) end - # Returns the x component of a normal vector for a number that represents an angle in degress. + # Returns the x component of a normal vector for a number that represents an angle in degrees. # # @gtk def vector_x max_value = 1 @@ -41493,6 +44867,18 @@ S (self % n) == 0 end + def multiply n + self * n + end + + def fmult n + self * n.to_f + end + + def imult n + (self * n).to_i + end + def mult n self * n end @@ -41594,32 +44980,6 @@ S (0..self).to_a end - def >= other - return false if !other - return gte other - end - - def > other - return false if !other - return gt other - end - - def <= other - return false if !other - return lte other - end - - def < other - return false if !other - return gt other - end - - def == other - return true if __original_eq_eq__ other - return __original_eq_eq__ other.entity_id if other.is_a? OpenEntity - return false - end - # @gtk def map unless block_given? @@ -41705,34 +45065,6 @@ The object above is not a Numeric. S end - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - def serialize self end @@ -41758,6 +45090,10 @@ S def self.clamp n, min, max n.clamp min, max end + + def mid? l, r + (between? l, r) || (between? r, l) + end end class Fixnum @@ -41783,40 +45119,6 @@ class Fixnum return !even? end - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def == other - return true if __original_eq_eq__ other - return __original_eq_eq__ other.entity_id if other.is_a? GTK::OpenEntity - return false - end - # Returns `-1` if the number is less than `0`. `+1` if the number # is greater than `0`. Returns `0` if the number is equal to `0`. # @@ -41872,34 +45174,6 @@ class Float alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__ alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__ - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - def serialize self end @@ -41941,10 +45215,278 @@ class Integer def nan? false end + + def center other + (self - other).abs.fdiv(2) + end +end + +</code></pre> +<h3 id='----recording-rb'>recording.rb</h3> +<pre><code class="language-ruby"># ./dragon/recording.rb +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# recording.rb has been released under MIT (*only this file*). + +module GTK + # FIXME: Gross + # @gtk + class Replay + # @gtk + def self.start file_name = nil + $recording.start_replay file_name + end + + # @gtk + def self.stop + $recording.stop_replay + end + end + + # @gtk + class Recording + def initialize runtime + @runtime = runtime + @tick_count = 0 + @global_input_order = 1 + end + + def tick + @tick_count += 1 + end + + def start_recording seed_number = nil + if !seed_number + log <<-S +* ERROR: +To start recording, you must provide an integer value to +seed random number generation. +S + $console.set_command "$recording.start SEED_NUMBER" + return + end + + if @is_recording + log <<-S +* ERROR: +You are already recording, first cancel (or stop) the current recording. +S + $console.set_command "$recording.cancel" + return + end + + if @is_replaying + log <<-S +* ERROR: +You are currently replaying a recording, first stop the replay. +S + return + end + + log_info <<-S +Recording has begun with RNG seed value set to #{seed_number}. +To stop recording use stop_recording(filename). +The recording will stop without saving a file if a filename is nil. +S + + $console.set_command "$recording.stop 'replay.txt'" + @runtime.__reset__ + @seed_number = seed_number + @runtime.set_rng seed_number + + @tick_count = 0 + @global_input_order = 1 + @is_recording = true + @input_history = [] + @runtime.notify! "Recording started. When completed, open the console to save it using $recording.stop FILE_NAME (or cancel).", 300 + end + + # @gtk + def start seed_number = nil + start_recording seed_number + end + + def is_replaying? + @is_replaying + end + + def is_recording? + @is_recording + end + + # @gtk + def stop file_name = nil + stop_recording file_name + end + + # @gtk + def cancel + stop_recording_core + @runtime.notify! "Recording cancelled." + end + + def stop_recording file_name = nil + if !file_name + log <<-S +* ERROR: +To please specify a file name when calling: +$recording.stop FILE_NAME + +If you do NOT want to save the recording, call: +$recording.cancel +S + $console.set_command "$recording.stop 'replay.txt'" + return + end + + if !@is_recording + log_info "You are not currently recording. Use start_recording(seed_number) to start recording." + $console.set_command "$recording.start" + return + end + + if file_name + text = "replay_version 2.0\n" + text << "stopped_at #{@tick_count}\n" + text << "seed #{@seed_number}\n" + text << "recorded_at #{Time.now.to_s}\n" + @input_history.each do |items| + text << "#{items}\n" + end + @runtime.write_file file_name, text + @runtime.write_file 'last_replay.txt', text + log_info "The recording has been saved successfully at #{file_name}. You can use start_replay(\"#{file_name}\") to replay the recording." + end + + $console.set_command "$replay.start '#{file_name}'" + stop_recording_core + @runtime.notify! "Recording saved to #{file_name}. To replay it: $replay.start \"#{file_name}\"." + log_info "You can run the replay later on startup using: ./dragonruby mygame --replay #{@replay_file_name}" + nil + end + + def stop_recording_core + @is_recording = false + @input_history = nil + @last_history = nil + @runtime.__reset__ + end + + def start_replay file_name = nil + if !file_name + log <<-S +* ERROR: +Please provide a file name to $recording.start. +S + $console.set_command "$replay.start 'replay.txt'" + return + end + + text = @runtime.read_file file_name + return false unless text + + if text.each_line.first.strip != "replay_version 2.0" + raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)." + end + + @replay_file_name = file_name + + $replay_data = { input_history: { } } + text.each_line do |l| + if l.strip.length == 0 + next + elsif l.start_with? 'replay_version' + next + elsif l.start_with? 'seed' + $replay_data[:seed] = l.split(' ').last.to_i + elsif l.start_with? 'stopped_at' + $replay_data[:stopped_at] = l.split(' ').last.to_i + elsif l.start_with? 'recorded_at' + $replay_data[:recorded_at] = l.split(' ')[1..-1].join(' ') + elsif l.start_with? '[' + name, value_1, value_2, value_count, id, tick_count = l.strip.gsub('[', '').gsub(']', '').split(',') + $replay_data[:input_history][tick_count.to_i] ||= [] + $replay_data[:input_history][tick_count.to_i] << { + id: id.to_i, + name: name.gsub(':', '').to_sym, + value_1: value_1.to_f, + value_2: value_2.to_f, + value_count: value_count.to_i + } + else + raise "Replay data seems corrupt. I don't know how to parse #{l}." + end + end + + $replay_data[:input_history].keys.each do |key| + $replay_data[:input_history][key] = $replay_data[:input_history][key].sort_by {|input| input[:id]} + end + + @runtime.__reset__ + @runtime.set_rng $replay_data[:seed] + @tick_count = 0 + @is_replaying = true + log_info "Replay has been started." + @runtime.notify! "Replay started [#{@replay_file_name}]." + end + + def stop_replay notification_message = "Replay has been stopped." + if !is_replaying? + log <<-S +* ERROR: +No replay is currently running. Call $replay.start FILE_NAME to start a replay. +S + + $console.set_command "$replay.start 'replay.txt'" + return + end + log_info notification_message + @is_replaying = false + $replay_data = nil + @tick_count = 0 + @global_input_order = 1 + $console.set_command_silent "$replay.start '#{@replay_file_name}'" + @runtime.__reset__ + @runtime.notify! notification_message + end + + def record_input_history name, value_1, value_2, value_count, clear_cache = false + return if @is_replaying + return unless @is_recording + @input_history << [name, value_1, value_2, value_count, @global_input_order, @tick_count] + @global_input_order += 1 + end + + def stage_replay_values + return unless @is_replaying + return unless $replay_data + + if $replay_data[:stopped_at] <= @tick_count + stop_replay "Replay completed [#{@replay_file_name}]. To rerun, bring up the Console and press enter." + return + end + + inputs_this_tick = $replay_data[:input_history][@tick_count] + + if @tick_count.zmod? 60 + log_info "Replay ends in #{($replay_data[:stopped_at] - @tick_count).idiv 60} second(s)." + end + + return unless inputs_this_tick + inputs_this_tick.each do |v| + args = [] + args << v[:value_1] if v[:value_count] >= 1 + args << v[:value_2] if v[:value_count] >= 2 + args << :replay + $gtk.send v[:name], *args + end + end + end end </code></pre> -<h3 id='----remote_hotload_client.rb'>remote_hotload_client.rb</h3> +<h3 id='----remote_hotload_client-rb'>remote_hotload_client.rb</h3> <pre><code class="language-ruby"># ./dragon/remote_hotload_client.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -41995,7 +45537,7 @@ module GTK def local_state @local_state ||= OpenEntity.new @local_state.hotload_client ||= @local_state.new_entity(:hotload_client, - notes: "This enitity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", + notes: "This entity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", changes: { }, changes_queue: [], reloaded_files_times: []) @@ -42141,8 +45683,9 @@ module GTK end </code></pre> -<h3 id='----runtime/autocomplete.rb'>runtime/autocomplete.rb</h3> +<h3 id='----runtime/autocomplete-rb'>runtime/autocomplete.rb</h3> <pre><code class="language-ruby"># ./dragon/runtime/autocomplete.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # autocomplete.rb has been released under MIT (*only this file*). @@ -42169,7 +45712,7 @@ module GTK sub_index = index - previous_line[:sum] word = (cursor_line[:line][0..sub_index - 1]).strip token = (word.split " ")[-1] - dots = (token.split ".") + dots = (token.split ".").flat_map { |s| s.split "[" }.flat_map { |s| s.split "]" }.flat_map { |s| s.split "(" }.flat_map { |s| s.split ")" } dot = dots[-1] end @@ -42190,6 +45733,10 @@ module GTK ignores ||= [] ignores = [ignores].flatten keys = keys.map { |k| k.to_s } + keys = keys.reject { |k| k.include? '"' } + .reject { |k| k.start_with? "'" } + .reject { |k| k.include? "," } + .reject { |k| k.start_with? "#" } others = ["def", "end"] + [ :entity_keys_by_ref, :entity_name, @@ -42247,6 +45794,10 @@ module GTK return autocomplete_filter_methods lookup_result.call if lookup_result + if dot[0].upcase == dot[0] && (Object.const_defined? dot.to_sym) + return (Object.const_get dot.to_sym).autocomplete_methods + end + start_collecting = false dots_after_state = dots.find_all do |s| if s == "state" @@ -42262,10 +45813,16 @@ module GTK target = target.as_hash[k.to_sym] if target.respond_to? :as_hash end - return autocomplete_filter_methods target.as_hash.keys + if target.respond_to? :as_hash + return autocomplete_filter_methods target.as_hash.keys + else + return autocomplete_filter_methods target.autocomplete_methods + end end + text = text.each_line.reject { |l| l.strip.start_with? "#" }.join "\n" + text = text.each_line.map { |l| l.split("#").first }.join "\n" text.gsub!("[", " ") text.gsub!("]", " ") text.gsub!("(", " ") @@ -42281,153 +45838,156 @@ module GTK end # end GTK </code></pre> -<h3 id='----runtime/draw.rb'>runtime/draw.rb</h3> -<pre><code class="language-ruby"># ./dragon/runtime/draw.rb +<h3 id='----runtime/benchmark-rb'>runtime/benchmark.rb</h3> +<pre><code class="language-ruby"># ./dragon/runtime/benchmark.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License -# draw.rb has been released under MIT (*only this file*). +# benchmark.rb has been released under MIT (*only this file*). module GTK class Runtime - module Draw - def primitives pass - if $top_level.respond_to? :primitives_override - return $top_level.tick_render @args, pass - end - - # Don't change this draw order unless you understand - # the implications. - - # pass.solids.each { |s| draw_solid s } - # while loops are faster than each with block + module Benchmark + def benchmark_single iterations, name, proc + log <<-S +** Invoking :#{name}... +S idx = 0 - length = pass.solids.length - while idx < pass.solids.length - draw_solid (pass.solids.at idx) # accessing an array using .value instead of [] is faster + r = nil + time_start = Time.now + while idx < iterations + r = proc.call idx += 1 end + result = (Time.now - time_start).round 3 - # pass.static_solids.each { |s| draw_solid s } - idx = 0 - length = pass.static_solids.length - while idx < length - draw_solid (pass.static_solids.at idx) - idx += 1 - end + { name: name, + time: result, + time_ms: (result * 1000).to_i } + end - # pass.sprites.each { |s| draw_sprite s } - idx = 0 - length = pass.sprites.length - while idx < length - draw_sprite (pass.sprites.at idx) - idx += 1 - end + def benchmark opts = {} + iterations = opts.iterations - # pass.static_sprites.each { |s| draw_sprite s } - idx = 0 - length = pass.static_sprites.length - while idx < length - draw_sprite (pass.static_sprites.at idx) - idx += 1 - end + log <<-S +* BENCHMARK: Started +** Caller: #{(caller || []).first} +** Iterations: #{iterations} +S + procs = opts.find_all { |k, v| v.respond_to? :call } + + times = procs.map do |(name, proc)| + benchmark_single iterations, name, proc + end.sort_by { |r| r.time } + + first_place = times.first + second_place = times.second || first_place + + times = times.map do |candidate| + average_time = first_place.time + .add(candidate.time) + .abs + .fdiv(2) + + difference_percentage = 0 + if average_time == 0 + difference_percentage = 0 + else + difference_percentage = first_place.time + .subtract(candidate.time) + .abs + .fdiv(average_time) + .imult(100) + end - # pass.primitives.each { |p| draw_primitive p } - idx = 0 - length = pass.primitives.length - while idx < length - draw_primitive (pass.primitives.at idx) - idx += 1 + difference_time = ((first_place.time - candidate.time) * 1000).round + candidate.merge(difference_percentage: difference_percentage, + difference_time: difference_time) end - # pass.static_primitives.each { |p| draw_primitive p } - idx = 0 - length = pass.static_primitives.length - while idx < length - draw_primitive (pass.static_primitives.at idx) - idx += 1 + too_small_to_measure = false + if (first_place.time + second_place.time) == 0 + too_small_to_measure = true + difference_percentage = 0 + log <<-S +* BENCHMARK: Average time for experiments were too small. Increase the number of iterations. +S + else + difference_percentage = (((first_place.time - second_place.time).abs.fdiv((first_place.time + second_place.time).abs.fdiv(2))) * 100).round end - # pass.labels.each { |l| draw_label l } - idx = 0 - length = pass.labels.length - while idx < length - draw_label (pass.labels.at idx) - idx += 1 - end + difference_time = first_place.time.-(second_place.time).*(1000).abs.round - # pass.static_labels.each { |l| draw_label l } - idx = 0 - length = pass.static_labels.length - while idx < length - draw_label (pass.static_labels.at idx) - idx += 1 - end - - # pass.lines.each { |l| draw_line l } - idx = 0 - length = pass.lines.length - while idx < length - draw_line (pass.lines.at idx) - idx += 1 - end + r = { + iterations: iterations, + first_place: first_place, + second_place: second_place, + difference_time: difference_time, + difference_percentage: difference_percentage, + times: times, + too_small_to_measure: too_small_to_measure + } - # pass.static_lines.each { |l| draw_line l } - idx = 0 - length = pass.static_lines.length - while idx < pass.static_lines.length - draw_line (pass.static_lines.at idx) - idx += 1 - end + log_message = [] + only_one_result = first_place.name == second_place.name - # pass.borders.each { |b| draw_border b } - idx = 0 - length = pass.borders.length - while idx < length - draw_border (pass.borders.at idx) - idx += 1 + if only_one_result + log <<-S +* BENCHMARK: #{r.first_place.name} completed in #{r.first_place.time_ms}ms." +S + else + log <<-S +* BENCHMARK: #{r.message} +** Fastest: #{r.first_place.name.inspect} +** Second: #{r.second_place.name.inspect} +** Margin: #{r.difference_percentage}% (#{r.difference_time.abs}ms) #{r.first_place.time_ms}ms vs #{r.second_place.time_ms}ms. +** Times: +#{r.times.map { |t| "*** #{t.name}: #{t.time_ms}ms (#{t.difference_percentage}% #{t.difference_time.abs}ms)." }.join("\n")} +S end - # pass.static_borders.each { |b| draw_border b } - idx = 0 - length = pass.static_borders.length - while idx < length - draw_border (pass.static_borders.at idx) - idx += 1 - end + r + end + end + end +end - if !$gtk.production - # pass.debug.each { |r| draw_primitive r } - idx = 0 - length = pass.debug.length - while idx < length - draw_primitive (pass.debug.at idx) - idx += 1 - end +</code></pre> +<h3 id='----runtime/draw-rb'>runtime/draw.rb</h3> +<pre><code class="language-ruby"># ./dragon/runtime/draw.rb +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# draw.rb has been released under MIT (*only this file*). - # pass.static_debug.each { |r| draw_primitive r } - idx = 0 - length = pass.static_debug.length - while idx < length - draw_primitive (pass.static_debug.at idx) - idx += 1 - end +module GTK + class Runtime + module Draw + def primitives pass + if $top_level.respond_to? :primitives_override + return $top_level.tick_render @args, pass end - # pass.reserved.each { |r| draw_primitive r } - idx = 0 - length = pass.reserved.length - while idx < length - draw_primitive (pass.reserved.at idx) - idx += 1 + fn.each_send pass.solids, self, :draw_solid + fn.each_send pass.static_solids, self, :draw_solid + fn.each_send pass.sprites, self, :draw_sprite + fn.each_send pass.static_sprites, self, :draw_sprite + fn.each_send pass.primitives, self, :draw_primitive + fn.each_send pass.static_primitives, self, :draw_primitive + fn.each_send pass.labels, self, :draw_label + fn.each_send pass.static_labels, self, :draw_label + fn.each_send pass.lines, self, :draw_line + fn.each_send pass.static_lines, self, :draw_line + fn.each_send pass.borders, self, :draw_border + fn.each_send pass.static_borders, self, :draw_border + + if !self.production + fn.each_send pass.debug, self, :draw_primitive + fn.each_send pass.static_debug, self, :draw_primitive end - # pass.static_reserved.each { |r| draw_primitive r } - idx = 0 - length = pass.static_reserved.length - while idx < length - draw_primitive (pass.static_reserved.at idx) - idx += 1 - end + fn.each_send pass.reserved, self, :draw_primitive + fn.each_send pass.static_reserved, self, :draw_primitive rescue Exception => e pause! pretty_print_exception_and_export! e @@ -42438,7 +45998,10 @@ module GTK if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_solid s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h, + s.r, s.g, s.b, s.a, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :solid @@ -42449,14 +46012,16 @@ module GTK if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_sprite_3 s.x, s.y, s.w, s.h, - s.path.s_or_default, + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h, + (s.path || '').to_s, s.angle, s.a, s.r, s.g, s.b, s.tile_x, s.tile_y, s.tile_w, s.tile_h, !!s.flip_horizontally, !!s.flip_vertically, s.angle_anchor_x, s.angle_anchor_y, - s.source_x, s.source_y, s.source_w, s.source_h + s.source_x, s.source_y, s.source_w, s.source_h, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :sprite @@ -42467,7 +46032,8 @@ module GTK if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_screenshot s.path.s_or_default, + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_screenshot (s.path || '').to_s, s.x, s.y, s.w, s.h, s.angle, s.a, s.r, s.g, s.b, @@ -42485,10 +46051,14 @@ module GTK if l.respond_to? :draw_override l.draw_override @ffi_draw else - @ffi_draw.draw_label l.x, l.y, l.text.s_or_default, - l.size_enum, l.alignment_enum, - l.r, l.g, l.b, l.a, - l.font.s_or_default(nil) + l = l.as_hash if l.is_a? OpenEntity + @ffi_draw.draw_label_3 l.x, l.y, + (l.text || '').to_s, + l.size_enum, l.alignment_enum, + l.r, l.g, l.b, l.a, + l.font, + (l.vertical_alignment_enum || 2), + (l.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed l, e, :label @@ -42499,7 +46069,22 @@ module GTK if l.respond_to? :draw_override l.draw_override @ffi_draw else - @ffi_draw.draw_line l.x, l.y, l.x2, l.y2, l.r, l.g, l.b, l.a + l = l.as_hash if l.is_a? OpenEntity + if l.x2 + @ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2, + l.r, l.g, l.b, l.a, + (l.blendmode_enum || 1) + else + w = l.w || 0 + w = 1 if w == 0 + h = l.h || 0 + h = 1 if h == 0 + @ffi_draw.draw_line_2 l.x, l.y, + l.x + w - 1, + l.y + h - 1, + l.r, l.g, l.b, l.a, + (l.blendmode_enum || 1) + end end rescue Exception => e raise_conversion_for_rendering_failed l, e, :line @@ -42510,7 +46095,10 @@ module GTK if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_border s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_border_2 s.x, s.y, s.w, s.h, + s.r, s.g, s.b, s.a, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :border @@ -42530,14 +46118,14 @@ module GTK pause! pretty_print_exception_and_export! e end - end end end </code></pre> -<h3 id='----runtime/framerate.rb'>runtime/framerate.rb</h3> +<h3 id='----runtime/framerate-rb'>runtime/framerate.rb</h3> <pre><code class="language-ruby"># ./dragon/runtime/framerate.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # framerate.rb has been released under MIT (*only this file*). @@ -42573,13 +46161,8 @@ module GTK if @tick_speed_count > 60 * 2 if framerate_below_threshold? @last_framerate = current_framerate - if [email protected]? - if !@framerate_important_notification_happened - log_important framerate_warning_message - else - log framerate_warning_message - end - @framerate_important_notification_happened = true + if [email protected]? && [email protected]_replaying? + log framerate_warning_message end end @@ -42623,8 +46206,9 @@ module GTK end # end module GTK </code></pre> -<h3 id='----runtime/framerate_diagnostics.rb'>runtime/framerate_diagnostics.rb</h3> +<h3 id='----runtime/framerate_diagnostics-rb'>runtime/framerate_diagnostics.rb</h3> <pre><code class="language-ruby"># ./dragon/runtime/framerate_diagnostics.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # framerate_diagnostics.rb has been released under MIT (*only this file*). @@ -42742,7 +46326,7 @@ If this warning is getting annoying put the following in your tick method: def framerate_diagnostics_primitives [ - { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid, + { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid!, { x: 5, y: 5.from_top, @@ -42751,7 +46335,7 @@ If this warning is getting annoying put the following in your tick method: g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 20.from_top, @@ -42760,7 +46344,7 @@ If this warning is getting annoying put the following in your tick method: g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 35.from_top, @@ -42769,7 +46353,7 @@ If this warning is getting annoying put the following in your tick method: g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 50.from_top, @@ -42778,7 +46362,7 @@ If this warning is getting annoying put the following in your tick method: g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 65.from_top, @@ -42787,7 +46371,7 @@ If this warning is getting annoying put the following in your tick method: g: 255, b: 255, size_enum: -2 - }.label, + }.label!, ] end @@ -42796,7 +46380,7 @@ If this warning is getting annoying put the following in your tick method: end </code></pre> -<h3 id='----runtime/hotload.rb'>runtime/hotload.rb</h3> +<h3 id='----runtime/hotload-rb'>runtime/hotload.rb</h3> <pre><code class="language-ruby"># ./dragon/runtime/hotload.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -42810,7 +46394,14 @@ module GTK def hotload_init @hotload_if_needed = 0 @mailbox_if_needed = 0 + + # schema for file_mtimes + # { FILE_PATH: { current: (Time as Fixnum), + # last: (Time as Fixnum) }, + # FILE_PATH: { current: (Time as Fixnum), + # last: (Time as Fixnum) } } @file_mtimes = { } + @suppress_mailbox = true files_to_reload.each { |f| init_mtimes f } init_mtimes 'app/mailbox.rb' @@ -42848,6 +46439,7 @@ module GTK 'dragon/symbol.rb', 'dragon/numeric_deprecated.rb', 'dragon/numeric.rb', + 'dragon/hash_deprecated.rb', 'dragon/hash.rb', 'dragon/outputs_deprecated.rb', 'dragon/array_docs.rb', @@ -42880,6 +46472,7 @@ module GTK 'dragon/trace.rb', 'dragon/readme_docs.rb', 'dragon/hotload_client.rb', + 'dragon/wizards.rb', 'dragon/ios_wizard.rb', 'dragon/itch_wizard.rb', ] + core_files_to_reload + @required_files @@ -42898,10 +46491,8 @@ module GTK end def init_mtimes file - current_key = "current_#{file}".to_sym - last_key = "last_#{file}".to_sym - @file_mtimes[current_key] ||= @ffi_file.mtime(file) - @file_mtimes[last_key] ||= @ffi_file.mtime(file) + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), + last: @ffi_file.mtime(file) } end def hotload_source_files @@ -42933,32 +46524,43 @@ module GTK end def hotload_if_needed + return if Kernel.tick_count < 0 hotload_source_files check_mailbox end def on_load_succeeded file - @rcb_sender.files_reloaded << file - @rcb_sender.reloaded_files << file + self.files_reloaded << file + self.reloaded_files << file Trace.untrace_classes! end + def reset_all_mtimes + @file_mtimes.each do |file, _| + @file_mtimes[file].current = @ffi_file.mtime(file) + @file_mtimes[file].last = @file_mtimes[file].current + end + + files_to_reload.each do |file, _| + @file_mtimes[file] ||= {} + @file_mtimes[file].current = @ffi_file.mtime(file) + @file_mtimes[file].last = @file_mtimes[file].current + end + end + def reload_if_needed file, force = false - current_key = "current_#{file}".to_sym - last_key = "last_#{file}".to_sym - @file_mtimes[current_key] ||= nil - @file_mtimes[last_key] ||= nil - @file_mtimes[current_key] = @ffi_file.mtime(file) - return if !force && @file_mtimes[last_key] == @file_mtimes[current_key] + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), last: @ffi_file.mtime(file) } + @file_mtimes[file].current = @ffi_file.mtime(file) + return if !force && @file_mtimes[file].current == @file_mtimes[file].last on_load_succeeded file if reload_ruby_file file - @file_mtimes[last_key] = @file_mtimes[current_key] + @file_mtimes[file].last = @file_mtimes[file].current end end end end </code></pre> -<h3 id='----string.rb'>string.rb</h3> +<h3 id='----string-rb'>string.rb</h3> <pre><code class="language-ruby"># ./dragon/string.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -42991,6 +46593,30 @@ S end end + def char_byte + return nil if self.length == 0 + c = self.each_char.first.bytes + c = c.first if c.is_a? Enumerable + c + end + + def insert_character_at index, char + t = each_char.to_a + t = (t.insert index, char) + t.join + end + + def excluding_character_at index + t = each_char.to_a + t.delete_at index + t.join + end + + def excluding_last_character + return "" if self.length <= 1 + return excluding_character_at(self.length - 1) + end + def end_with_bang? self[-1] == "!" end @@ -43070,7 +46696,7 @@ S end </code></pre> -<h3 id='----tests.rb'>tests.rb</h3> +<h3 id='----tests-rb'>tests.rb</h3> <pre><code class="language-ruby"># ./dragon/tests.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -43206,14 +46832,14 @@ S log "#{self.failed.length} test(s) failed." self.failed.each do |h| log "**** Test name: :#{h[:m]}" - log "#{h[:e].to_s.gsub("* ERROR:", "").strip}" + log "#{h[:e].to_s.gsub("* ERROR:", "").strip}\n#{h[:e].__backtrace_to_org__}" end end end end </code></pre> -<h3 id='----trace.rb'>trace.rb</h3> +<h3 id='----trace-rb'>trace.rb</h3> <pre><code class="language-ruby"># ./dragon/trace.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC @@ -43401,12 +47027,153 @@ module GTK end </code></pre> -<h3 id='----wizards.rb'>wizards.rb</h3> +<h3 id='----tweetcart-rb'>tweetcart.rb</h3> +<pre><code class="language-ruby"># ./dragon/tweetcart.rb +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# tweetcart.rb has been released under MIT (*only this file*). + +def $top_level.TICK &block + $top_level.define_method(:tick) do |args| + args.outputs[:scene].w = 160 + args.outputs[:scene].h = 90 + args.outputs[:scene].background_color = [0, 0, 0, 0] + block.call args + args.outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :scene } + end + + def $top_level.bg! *rgb + r,g,b = rgb + r ||= 255 + g ||= r + b ||= g + $args.outputs.background_color = [r, g, b] + end + + def $top_level.slds + $args.outputs[:scene].sprites + end + + def $top_level.slds! *os + if (os.first.is_a? Numeric) + sld!(*os) + else + os.each { |o| sld!(*o) } + end + end + + def $top_level.sld! *params + x, y, w, h, r, g, b, a = nil + if params.length == 2 + x, y = params + elsif params.length == 3 && (params.last.is_a? Array) + x = params[0] + y = params[1] + r, g, b, a = params[2] + r ||= 255 + g ||= r + b ||= g + a ||= 255 + elsif params.length == 4 + x, y, w, h = params + elsif params.length == 5 && (params.last.is_a? Array) + x = params[0] + y = params[1] + w = params[2] + h = params[3] + r,g,b,a = params[4] + r ||= 255 + g ||= r + b ||= g + a ||= 255 + elsif params.length >= 7 + x, y, w, h, r, g, b = params + else + raise "I don't know how to render #{params} with reasonable defaults." + end + + w ||= 1 + h ||= 1 + r ||= 255 + g ||= 255 + b ||= 255 + a ||= 255 + + slds << { x: x, y: y, + w: w, h: h, + r: r, g: g, b: b, a: a, + path: :pixel } + end +end + +=begin +wht = [255] * 3 +red = [255, 0, 0] +blu = [0, 130, 255] +purp = [150, 80, 255] + +TICK { + bg! 0 + + slds << [0, 0, 3, 3, 0, 255, 0, 255] + + sld! 10, 10 + sld! 20, 20, 3, 2 + sld! 30, 30, 2, 2, red + sld! 35, 35, blu + + slds! 40, 40 + + slds! [50, 50], + [60, 60, purp], + [70, 70, 10, 10, wht], + [80, 80, 4, 4, 255, 0, 255] +} +=end + +</code></pre> +<h3 id='----wizards-rb'>wizards.rb</h3> <pre><code class="language-ruby"># ./dragon/wizards.rb +# coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # wizards.rb has been released under MIT (*only this file*). +class Wizard + def metadata_file_path + "metadata/game_metadata.txt" + end + + def get_metadata + metadata = $gtk.read_file metadata_file_path + + if !metadata + write_blank_metadata + metadata = $gtk.read_file metadata_file_path + end + + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a + + { + dev_id: dev_id.strip.gsub("#", "").gsub("devid=", ""), + dev_title: dev_title.strip.gsub("#", "").gsub("devtitle=", ""), + game_id: game_id.strip.gsub("#", "").gsub("gameid=", ""), + game_title: game_title.strip.gsub("#", "").gsub("gametitle=", ""), + version: version.strip.gsub("#", "").gsub("version=", ""), + icon: icon.strip.gsub("#", "").gsub("icon=", "") + } + end +end + +class WizardException < Exception + attr_accessor :console_primitives + + def initialize *console_primitives + @console_primitives = console_primitives + end +end + module GTK class Wizards attr_accessor :ios, :itch diff --git a/docs/docs.txt b/docs/docs.txt index 0b543de..c0cc841 100644 --- a/docs/docs.txt +++ b/docs/docs.txt @@ -11,8 +11,6 @@ to get fancy you can provide a ~lambda~ to filter documentation: docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } #+end_src -[[docs_search.gif]] - * Hello World Welcome to DragonRuby Game Toolkit. Take the steps below to get started. @@ -37,20 +35,25 @@ Reply with: I am a Dragon Rider. #+end_quote -* Watch Some Intro Videos +* Intro Videos + +Here are some videos to help you get the lay of the land. -Each video is only 20 minutes and all of them will fit into a lunch -break. So please watch them: +** Quick Api Tour 1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] -2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] -3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] -The second and third videos are not required if you are proficient -with Ruby, but *definitely* watch the first one. +** If You Are Completely New to Ruby and Programming + +1. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +2. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] +3. You may also want to try this free course provided at [[http://dragonruby.school]]. + +** If You Have Game Dev Experience -You may also want to try this free course provided at -[[http://dragonruby.school]]. +1. Building Tetris - Part 1: [[https://youtu.be/xZMwRSbC4rY]] +2. Building Tetris - Part 2: [[https://youtu.be/C3LLzDUDgz4]] +3. Low Res Game Jam Tutorial: [[https://youtu.be/pCI90ukKCME]] * Getting Started Tutorial @@ -392,7 +395,7 @@ Console type: ~$wizards.ios.start~ and you will be guided through the deployment process. To deploy to Android, you need to have an Android emulator/device, and -a environment that is able to run Android SDK. ~dragonruby-publish~ +an environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look @@ -411,7 +414,7 @@ The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is -compensated with a strong commitment to the following principals. +compensated with a strong commitment to the following principles. ** Challenge The Status Quo @@ -440,10 +443,10 @@ overwhelms beginners who are new to the engine or programming in general. DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy -would be render primitives: the spectrum of options allows renderable constructs take -the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), +would be render primitives: the spectrum of options allows renderable constructs that +take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), -open and string entities (more work than hashes, but yields cleaner apis), +open and strict entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create). @@ -570,7 +573,7 @@ The elevator pitch is: DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo -Switch, PS4, Xbox, and Scadia. +Switch, PS4, Xbox, and Stadia. **** What does Multilevel Cross-platform mean? @@ -648,7 +651,7 @@ file called ~repl.rb~ and put it in ~mygame/app/repl.rb~: - If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal). -- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. +- All ~puts~ statements will also be saved to ~logs/puts.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. 4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored. @@ -684,7 +687,7 @@ challenges in creating something that is compatible. You can use DragonRuby's replay capabilities to troubleshoot: 1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added). -2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. +2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recording by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. 3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~. 4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release. 5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago. @@ -697,7 +700,7 @@ Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]]. On a more serious note, Ruby's _quantity_ levels aren't what they used -to be. And that's totally fine. Every one chases the new and shiny. +to be. And that's totally fine. Everyone chases the new and shiny. What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. @@ -771,13 +774,11 @@ questions asked. *** But still, you should offer a free version. So I can try it out and see if I like it. -You can try our [web-based sandbox environment](). But it won't do the -runtime justice. Or just come to our [Slack]() or [Discord]() channel -and ask questions. We'd be happy to have a one on one video chat with -you and show off all the cool stuff we're doing. +You can try our web-based sandbox environment at [[http://fiddle.dragonruby.org]]. But it won't do the +runtime justice. Or just come to our Discord Channel at [[http://discord.dragonruby.org]] and ask questions. +We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. -Seriously just buy it. Get a refund if you don't like it. We make it -stupid easy to do so. +Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so. *** I still think you should do a free version. Think of all people who would give it a shot. @@ -897,11 +898,15 @@ You can represent a sprite as a ~Hash~: flip_vertically: false, flip_horizontally: false, angle_anchor_x: 0.5, - angle_anchor_y: 1.0 + angle_anchor_y: 1.0, + blendmode_enum: 1 } end #+end_src +The ~blendmode_enum~ value can be set to ~0~ (no blending), ~1~ (alpha blending), +~2~ (additive blending), ~3~ (modulo blending), ~4~ (multiply blending). + You can represent a sprite as an ~object~: #+begin_src ruby @@ -911,7 +916,7 @@ You can represent a sprite as an ~object~: :source_x, :source_y, :source_w, :source_h, :tile_x, :tile_y, :tile_w, :tile_h, :flip_horizontally, :flip_vertically, - :angle_anchor_x, :angle_anchor_y + :angle_anchor_x, :angle_anchor_y, :blendmode_enum def primitive_marker :sprite @@ -997,16 +1002,17 @@ You can add additional metadata about your game within a label, which requires y #+begin_src def tick args args.outputs.labels << { - x: 200, - y: 550, - text: "dragonruby", - size_enum: 2, - alignment_enum: 1, - r: 155, - g: 50, - b: 50, - a: 255, - font: "fonts/manaspc.ttf", + x: 200, + y: 550, + text: "dragonruby", + size_enum: 2, + alignment_enum: 1, + r: 155, + g: 50, + b: 50, + a: 255, + font: "fonts/manaspc.ttf", + vertical_alignment_enum: 0, # 0 is bottom, 1 is middle, 2 is top # You can add any properties you like (this will be ignored/won't cause errors) game_data_one: "Something", game_data_two: { @@ -1039,6 +1045,21 @@ You can get the render size of any string using ~args.gtk.calcstringbox~. end #+end_src +** Rendering Labels With New Line Characters And Wrapping + +You can use a strategy like the following to create multiple labels from a String. + +#+begin_src ruby + def tick args + long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elitteger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim." + max_character_length = 30 + long_strings_split = args.string.wrapped_lines long_string, max_character_length + args.outputs.labels << long_strings_split.map_with_index do |s, i| + { x: 10, y: 600 - (i * 20), text: s } + end + end +#+end_src + ** How To Play A Sound Sounds that end ~.wav~ will play once: @@ -1195,7 +1216,7 @@ Returns ~true~ if: the ~right~ arrow or ~d~ key is pressed or held on the ~keybo *** ~.left_right~ Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.left~ and ~args.inputs.right~. *** ~.up_down~ -Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.up~ and ~args.inputs.down~. +Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.down~ and ~args.inputs.up~. *** ~.text~ OR ~.history~ Returns a string that represents the last key that was pressed on the keyboard. *** ~.mouse~ @@ -1229,17 +1250,17 @@ The properties ~args.inputs.mouse.(click|down|previous_click|up)~ each return ~n that has an ~x~, ~y~ properties along with helper functions to determine collision: ~inside_rect?~, ~inside_circle~. *** ~.controller_one~, ~.controller_two~ Represents controllers connected to the usb ports. -**** ~.up +**** ~.up~ Returns ~true~ if ~up~ is pressed or held on the directional or left analog. -**** ~.down +**** ~.down~ Returns ~true~ if ~down~ is pressed or held on the directional or left analog. -**** ~.left +**** ~.left~ Returns ~true~ if ~left~ is pressed or held on the directional or left analog. -**** ~.right +**** ~.right~ Returns ~true~ if ~right~ is pressed or held on the directional or left analog. -**** ~.left_right +**** ~.left_right~ Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.controller_(one|two).left~ and ~args.inputs.controller_(one|two).right~. -**** ~.up_down +**** ~.up_down~ Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.controller_(one|two).up~ and ~args.inputs.controller_(one|two).down~. **** ~.(left_analog_x_raw|right_analog_x_raw)~ Returns the raw integer value for the analog's horizontal movement (~-32,000 to +32,000~). @@ -1249,13 +1270,13 @@ Returns the raw integer value for the analog's vertical movement (~-32,000 to +3 Returns a number between ~-1~ and ~1~ which represents the percentage the analog is moved horizontally as a ratio of the maximum horizontal movement. **** ~.left_analog_y_perc|right_analog_y_perc)~ Returns a number between ~-1~ and ~1~ which represents the percentage the analog is moved vertically as a ratio of the maximum vertical movement. -**** ~.directional_up)~ +**** ~.directional_up~ Returns ~true~ if ~up~ is pressed or held on the directional. -**** ~.directional_down)~ +**** ~.directional_down~ Returns ~true~ if ~down~ is pressed or held on the directional. -**** ~.directional_left)~ +**** ~.directional_left~ Returns ~true~ if ~left~ is pressed or held on the directional. -**** ~.directional_right)~ +**** ~.directional_right~ Returns ~true~ if ~right~ is pressed or held on the directional. **** ~.(a|b|x|y|l1|r1|l2|r2|l3|r3|start|select)~ Returns ~true~ if the specific button is pressed or held. @@ -1411,6 +1432,14 @@ Send a Primitive to this collection to render an unfilled rectangle to the scree Send any Primitive to this collection which represents things you render to the screen for debugging purposes. Primitives in this collection will not be rendered in a production release of your game. ** ~args.geometry~ This property contains geometric functions. Functions can be invoked via ~args.geometry.FUNCTION~. + +Here are some general notes with regards to the arguments these geometric functions accept. + +1. ~Rectangles~ can be represented as an ~Array~ with four (or more) values ~[x, y, w, h]~, as a ~Hash~ ~{ x:, y:, w:, h: }~ or an object that responds to ~x~, ~y~, ~w~, and ~h~. +2. ~Points~ can be represent as an ~Array~ with two (or more) values ~[x, y]~, as a ~Hash~ ~{ x:, y:}~ or an object that responds to ~x~, and ~y~. +3. ~Lines~ can be represented as an ~Array~ with four (or more) values ~[x, y, x2, y2]~, as a ~Hash~ ~{ x:, y:, x2:, y2: }~ or an object that responds to ~x~, ~y~, ~x2~, and ~y2~. +4. ~Angles~ are represented as degrees (not radians). + *** ~.inside_rect? rect_1, rect_2~ Returns ~true~ if ~rect_1~ is inside ~rect_2~. *** ~.intersect_rect? rect_2, rect_2~ @@ -1625,6 +1654,34 @@ is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file a end #+end_src +* DOCS: ~GTK::Runtime#benchmark~ +You can use this function to compare the relative performance of methods. + +#+begin_src ruby + def tick args + # press r to run benchmark + if args.inputs.keyboard.key_down.r + args.gtk.console.show + args.gtk.benchmark iterations: 1000, # number of iterations + # label for experiment + using_numeric_map: -> () { + # experiment body + v = 100.map do |i| + i * 100 + end + }, + # label for experiment + using_numeric_times: -> () { + # experiment body + v = [] + 100.times do |i| + v << i * 100 + end + } + end + end +#+end_src + * DOCS: ~Array~ The Array class has been extend to provide methods that @@ -1975,7 +2032,7 @@ wide and 90 pixels tall. ** Rendering a solid using an Array with colors and alpha -The value for the color and alpha is an number between ~0~ and ~255~. The +The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified. Creates a green solid rectangle with an opacity of 50%. @@ -2011,7 +2068,7 @@ be provided in any order. ** Rendering a solid using a Class You can also create a class with solid/border properties and render it as a primitive. -ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ +ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class. Here is an example: @@ -2070,6 +2127,106 @@ You have to use ~args.outputs.borders~: #+end_src +* DOCS: ~GTK::Outputs#sprites~ + +Add primitives to this collection to render a sprite to the screen. + +** Rendering a sprite using an Array + +Creates a sprite of a white circle located at 100, 100. 160 pixels +wide and 90 pixels tall. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT PATH + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png] + end +#+end_src + +** Rendering a sprite using an Array with colors and alpha + +The value for the color and alpha is a number between ~0~ and ~255~. The +alpha property is optional and will be set to ~255~ if not specified. + +Creates a green circle sprite with an opacity of 50%. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT PATH ANGLE ALPHA RED GREEN BLUE + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png", 0, 128, 0, 255, 0] + end +#+end_src + +** Rendering a sprite using a Hash + +If you want a more readable invocation. You can use the following hash to create a sprite. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +#+begin_src + def tick args + args.outputs.sprites << { + x: 0, + y: 0, + w: 100, + h: 100, + path: "sprites/circle/white.png", + angle: 0, + a: 255, + r: 0, + g: 255, + b: 0 + } + end +#+end_src + +** Rendering a solid using a Class + +You can also create a class with solid/border properties and render it as a primitive. +ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ +must be defined on the class. + +Here is an example: + +#+begin_src + # Create type with ALL sprite properties AND primitive_marker + class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b + + def primitive_marker + :sprite + end + end + + # Inherit from type + class Circle < Sprite + # constructor + def initialize x, y, size, path + self.x = x + self.y = y + self.w = size + self.h = size + self.path = path + end + def serlialize + {x:self.x, y:self.y, w:self.w, h:self.h, path:self.path} + end + + def inspect + serlialize.to_s + end + + def to_s + serlialize.to_s + end + end + def tick args + # render circle sprite + args.outputs.sprites << Circle.new(10, 10, 32,"sprites/circle/white.png") + end +#+end_src + + * DOCS: ~GTK::Outputs#screenshots~ Add a hash to this collection to take a screenshot and save as png file. @@ -2133,12 +2290,12 @@ The ~GTK::MousePoint~ has the following properties. - ~x~: Integer representing the mouse's x. - ~y~: Integer representing the mouse's y. - ~point~: Array with the ~x~ and ~y~ values. -- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +- ~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +- ~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +- ~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +- ~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +- ~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). - ~created_at~: The tick (~args.state.tick_count~) that this structure was created. - ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created. @@ -3580,7 +3737,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 0, b: 200, a: 255, - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! # Primitives can hold anything, and can be given a label in the following forms args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label @@ -3594,7 +3751,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 0, b: 200, a: 255, - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! end def tick_instructions args, text, y = 715 @@ -3831,771 +3988,6 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -*** Rendering Basics - Audio Mixer - main.rb -#+begin_src ruby - # ./samples/01_rendering_basics/06_audio_mixer/app/main.rb - $gtk.reset - - $boxsize = 30 - - def render_sources args - mouse_in_panel = (args.state.selected != 0) && args.inputs.mouse.position.inside_rect?([900, 450, 340, 250]) - mouse_new_down = (args.state.mouse_held == 1) - - if (mouse_new_down && !mouse_in_panel) - args.state.selected = 0 # will reset below if we hit something. - end - - args.audio.keys.each { |k| - s = args.audio[k] - - if (mouse_new_down) && !mouse_in_panel && args.inputs.mouse.position.inside_rect?([s[:screenx], s[:screeny], $boxsize, $boxsize]) - args.state.selected = k - args.state.dragging_source = true - end - - isselected = (k == args.state.selected) - - if isselected && args.state.dragging_source - # you can hang anything on the audio hashes you want, so we store the - # actual screen position so it doesn't scale weirdly vs your mouse. - s[:screenx] = args.inputs.mouse.x - ($boxsize / 2) - s[:screeny] = args.inputs.mouse.y - ($boxsize / 2) - - s[:screeny] = 50 if s[:screeny] < 50 - s[:screeny] = (719 - $boxsize) if s[:screeny] > (719 - $boxsize) - s[:screenx] = 0 if s[:screenx] < 0 - s[:screenx] = (1279 - $boxsize) if s[:screenx] > (1279 - $boxsize) - - s[:x] = ((s[:screenx] / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range - s[:y] = ((s[:screeny] / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range - end - - color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] - args.outputs.primitives << [s[:screenx], s[:screeny], $boxsize, $boxsize, *color].solid - } - end - - def render_panel args - s = args.audio[args.state.selected] - return if s.nil? - mouse_down = (args.state.mouse_held > 0) - - args.outputs.primitives << [900, 450, 340, 250, 127, 127, 200, 255].solid - args.outputs.primitives << [1075, 690, "Source ##{args.state.selected}", 3, 1, 255, 255, 255].label - args.outputs.primitives << [910, 660, 1230, 660, 255, 255, 255].line - args.outputs.primitives << [910, 650, "screen: (#{s[:screenx].to_i}, #{s[:screeny].to_i})", 0, 0, 255, 255, 255].label - args.outputs.primitives << [910, 625, "position: (#{s[:x].round(5).to_s[0..6]}, #{s[:y].round(5).to_s[0..6]})", 0, 0, 255, 255, 255].label - - slider = [1022, 586, 200, 7] - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) - s[:pitch] = ((args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)) * 2.0 - end - slidercolor = (s[:pitch] / 2.0) * 255 - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid - args.outputs.primitives << [910, 600, "pitch: #{s[:pitch].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label - - slider = [1022, 561, 200, 7] - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) - s[:gain] = (args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0) - end - slidercolor = s[:gain] * 255 - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid - args.outputs.primitives << [910, 575, "gain: #{s[:gain].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label - - checkbox = [1022, 533, 10, 12] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) - s[:looping] = !s[:looping] - end - checkboxcolor = s[:looping] ? 255 : 0 - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid - args.outputs.primitives << [910, 550, "looping:", 0, 0, 255, 255, 255].label - - checkbox = [1022, 508, 10, 12] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) - s[:paused] = !s[:paused] - end - checkboxcolor = s[:paused] ? 255 : 0 - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid - args.outputs.primitives << [910, 525, "paused:", 0, 0, 255, 255, 255].label - - button = [910, 460, 320, 20] - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(button) - args.audio.delete(args.state.selected) - args.state.selected = 0 - end - args.outputs.primitives << [*button, 255, 0, 0, 255].solid - args.outputs.primitives << [button[0] + (button[2] / 2), button[1]+20, "DELETE SOURCE", 0, 1, 255, 255, 0].label - end - - def spawn_new_sound args, num - input = nil - input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}" - - # Spawn randomly in an area that won't be covered by UI. - screenx = (rand * 600.0) + 200.0 - screeny = (rand * 400.0) + 100.0 - - args.state.next_sound_index += 1 - - # you can hang anything on the audio hashes you want, so we store the - # actual screen position in here for convenience. - args.audio[args.state.next_sound_index] = { - input: input, - screenx: screenx, - screeny: screeny, - x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range - y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range - z: 0.0, - gain: 1.0, - pitch: 1.0, - looping: true, - paused: false - } - - args.state.selected = args.state.next_sound_index - end - - def render_launcher args - total = 6 - x = (1280 - (total * $boxsize * 3)) / 2 - y = 10 - args.outputs.primitives << [0, 0, 1280, ((y*2) + $boxsize), 127, 127, 127, 255].solid - for i in 1..total - args.outputs.primitives << [x, y, $boxsize, $boxsize, 255, 255, 255, 255].solid - args.outputs.primitives << [x+8, y+28, i.to_s, 3, 0, 0, 0, 255, 255].label - if args.inputs.mouse.click && args.inputs.mouse.click.point.inside_rect?([x, y, $boxsize, $boxsize]) - spawn_new_sound args, i - end - x = x + ($boxsize * 3) - end - end - - def render_ui args - render_launcher args - render_panel args - end - - def tick args - args.state.mouse_held ||= 0 - args.state.dragging_source ||= false - args.state.selected ||= 0 - args.state.next_sound_index ||= 0 - - if args.inputs.mouse.up - args.state.mouse_held = 0 - args.state.dragging_source = false - elsif args.inputs.mouse.down || (args.state.mouse_held > 0) - args.state.mouse_held += 1 - else - end - - args.outputs.background_color = [ 0, 0, 0, 255 ] - render_sources args - render_ui args - end - -#+end_src - -*** Rendering Basics - Sound Synthesis - main.rb -#+begin_src ruby - # ./samples/01_rendering_basics/07_sound_synthesis/app/main.rb - begin # region: top level tick methods - def tick args - defaults args - render args - input args - process_audio_queue args - end - - def defaults args - args.state.sine_waves ||= {} - args.state.square_waves ||= {} - args.state.saw_tooth_waves ||= {} - args.state.triangle_waves ||= {} - args.state.audio_queue ||= [] - args.state.buttons ||= [ - (frequency_buttons args), - (sine_wave_note_buttons args), - (bell_buttons args), - (square_wave_note_buttons args), - (saw_tooth_wave_note_buttons args), - (triangle_wave_note_buttons args), - ].flatten - end - - def render args - args.outputs.borders << args.state.buttons.map { |b| b[:border] } - args.outputs.labels << args.state.buttons.map { |b| b[:label] } - args.outputs.labels << args.layout - .rect(row: 0, col: 11.5) - .yield_self { |r| r.merge y: r.y + r.h } - .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", - alignment_enum: 1) - end - - - def input args - args.state.buttons.each do |b| - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) - parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " - args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" - send b[:method_to_call], args, b - end - end - - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) - args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' - end - end - - def process_audio_queue args - to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } - args.state.audio_queue -= to_queue - to_queue.each { |a| args.audio[a[:id]] = a } - - args.audio.find_all { |k, v| v[:decay_rate] } - .each { |k, v| v[:gain] -= v[:decay_rate] } - - sounds_to_stop = args.audio - .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } - .map { |k, v| k } - - sounds_to_stop.each { |k| args.audio.delete k } - end - end - - begin # region: button definitions, ui layout, callback functions - def button args, opts - button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) - - button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 - - label_offset_x = 5 - label_offset_y = 30 - - button_def[:label] = button_def[:rect].merge text: opts[:text], - size_enum: -2.5, - x: button_def[:rect].x + label_offset_x, - y: button_def[:rect].y + label_offset_y - - button_def - end - - def play_sine_wave args, sender - queue_sine_wave args, - frequency: sender[:frequency], - duration: 1.seconds, - fade_out: true - end - - def play_note args, sender - method_to_call = :queue_sine_wave - method_to_call = :queue_square_wave if sender[:type] == :square - method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth - method_to_call = :queue_triangle_wave if sender[:type] == :triangle - method_to_call = :queue_bell if sender[:type] == :bell - - send method_to_call, args, - frequency: (frequency_for note: sender[:note], octave: sender[:octave]), - duration: 1.seconds, - fade_out: true - end - - def frequency_buttons args - [ - (button args, - row: 4.0, col: 0, text: "300hz", - frequency: 300, - method_to_call: :play_sine_wave), - (button args, - row: 5.0, col: 0, text: "400hz", - frequency: 400, - method_to_call: :play_sine_wave), - (button args, - row: 6.0, col: 0, text: "500hz", - frequency: 500, - method_to_call: :play_sine_wave), - ] - end - - def sine_wave_note_buttons args - [ - (button args, - row: 1.5, col: 2, text: "Sine C4", - note: :c, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 2.5, col: 2, text: "Sine D4", - note: :d, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 3.5, col: 2, text: "Sine E4", - note: :e, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 4.5, col: 2, text: "Sine F4", - note: :f, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 5.5, col: 2, text: "Sine G4", - note: :g, octave: 4, type: :sine, method_to_call: :play_note), - (button args, - row: 6.5, col: 2, text: "Sine A5", - note: :a, octave: 5, type: :sine, method_to_call: :play_note), - (button args, - row: 7.5, col: 2, text: "Sine B5", - note: :b, octave: 5, type: :sine, method_to_call: :play_note), - (button args, - row: 8.5, col: 2, text: "Sine C5", - note: :c, octave: 5, type: :sine, method_to_call: :play_note), - ] - end - - def square_wave_note_buttons args - [ - (button args, - row: 1.5, col: 6, text: "Square C4", - note: :c, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 2.5, col: 6, text: "Square D4", - note: :d, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 3.5, col: 6, text: "Square E4", - note: :e, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 4.5, col: 6, text: "Square F4", - note: :f, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 5.5, col: 6, text: "Square G4", - note: :g, octave: 4, type: :square, method_to_call: :play_note), - (button args, - row: 6.5, col: 6, text: "Square A5", - note: :a, octave: 5, type: :square, method_to_call: :play_note), - (button args, - row: 7.5, col: 6, text: "Square B5", - note: :b, octave: 5, type: :square, method_to_call: :play_note), - (button args, - row: 8.5, col: 6, text: "Square C5", - note: :c, octave: 5, type: :square, method_to_call: :play_note), - ] - end - def saw_tooth_wave_note_buttons args - [ - (button args, - row: 1.5, col: 8, text: "Saw C4", - note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 2.5, col: 8, text: "Saw D4", - note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 3.5, col: 8, text: "Saw E4", - note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 4.5, col: 8, text: "Saw F4", - note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 5.5, col: 8, text: "Saw G4", - note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 6.5, col: 8, text: "Saw A5", - note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 7.5, col: 8, text: "Saw B5", - note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), - (button args, - row: 8.5, col: 8, text: "Saw C5", - note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), - ] - end - - def triangle_wave_note_buttons args - [ - (button args, - row: 1.5, col: 10, text: "Triangle C4", - note: :c, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 2.5, col: 10, text: "Triangle D4", - note: :d, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 3.5, col: 10, text: "Triangle E4", - note: :e, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 4.5, col: 10, text: "Triangle F4", - note: :f, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 5.5, col: 10, text: "Triangle G4", - note: :g, octave: 4, type: :triangle, method_to_call: :play_note), - (button args, - row: 6.5, col: 10, text: "Triangle A5", - note: :a, octave: 5, type: :triangle, method_to_call: :play_note), - (button args, - row: 7.5, col: 10, text: "Triangle B5", - note: :b, octave: 5, type: :triangle, method_to_call: :play_note), - (button args, - row: 8.5, col: 10, text: "Triangle C5", - note: :c, octave: 5, type: :triangle, method_to_call: :play_note), - ] - end - - def bell_buttons args - [ - (button args, - row: 1.5, col: 4, text: "Bell C4", - note: :c, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 2.5, col: 4, text: "Bell D4", - note: :d, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 3.5, col: 4, text: "Bell E4", - note: :e, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 4.5, col: 4, text: "Bell F4", - note: :f, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 5.5, col: 4, text: "Bell G4", - note: :g, octave: 4, type: :bell, method_to_call: :play_note), - (button args, - row: 6.5, col: 4, text: "Bell A5", - note: :a, octave: 5, type: :bell, method_to_call: :play_note), - (button args, - row: 7.5, col: 4, text: "Bell B5", - note: :b, octave: 5, type: :bell, method_to_call: :play_note), - (button args, - row: 8.5, col: 4, text: "Bell C5", - note: :c, octave: 5, type: :bell, method_to_call: :play_note), - ] - end - end - - begin # region: wave generation - begin # sine wave - def defaults_sine_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def sine_wave_for opts = {} - opts = defaults_sine_wave_for.merge opts - frequency = opts[:frequency] - sample_rate = opts[:sample_rate] - period_size = (sample_rate.fdiv frequency).ceil - period_size.map_with_index do |i| - Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) - end.to_a - end - - def defaults_queue_sine_wave - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def queue_sine_wave args, opts = {} - opts = defaults_queue_sine_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate - args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.sine_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: sine_wave - end - end - - begin # region: square wave - def defaults_square_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def square_wave_for opts = {} - opts = defaults_square_wave_for.merge opts - sine_wave = sine_wave_for opts - sine_wave.map do |v| - if v >= 0 - 1.0 - else - -1.0 - end - end.to_a - end - - def defaults_queue_square_wave - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } - end - - def queue_square_wave args, opts = {} - opts = defaults_queue_square_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate - args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.square_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: square_wave - end - end - - begin # region: saw tooth wave - def defaults_saw_tooth_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def saw_tooth_wave_for opts = {} - opts = defaults_saw_tooth_wave_for.merge opts - sine_wave = sine_wave_for opts - period_size = sine_wave.length - sine_wave.map_with_index do |v, i| - (((i % period_size).fdiv period_size) * 2) - 1 - end - end - - def defaults_queue_saw_tooth_wave - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } - end - - def queue_saw_tooth_wave args, opts = {} - opts = defaults_queue_saw_tooth_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate - args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: saw_tooth_wave - end - end - - begin # region: triangle wave - def defaults_triangle_wave_for - { frequency: 440, sample_rate: 48000 } - end - - def triangle_wave_for opts = {} - opts = defaults_saw_tooth_wave_for.merge opts - sine_wave = sine_wave_for opts - period_size = sine_wave.length - sine_wave.map_with_index do |v, i| - ratio = (i.fdiv period_size) - if ratio <= 0.5 - (ratio * 4) - 1 - else - ratio -= 0.5 - 1 - (ratio * 4) - end - end - end - - def defaults_queue_triangle_wave - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def queue_triangle_wave args, opts = {} - opts = defaults_queue_triangle_wave.merge opts - frequency = opts[:frequency] - sample_rate = 48000 - - triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate - args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate - - proc = lambda do - generate_audio_data args.state.triangle_waves[frequency], sample_rate - end - - audio_state = new_audio_state args, opts - audio_state[:input] = [1, sample_rate, proc] - queue_audio args, audio_state: audio_state, wave: triangle_wave - end - end - - begin # region: bell - def defaults_queue_bell - { frequency: 440, duration: 1.seconds, queue_in: 0 } - end - - def queue_bell args, opts = {} - (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } - end - - def bell_harmonics - [ - { frequency_ratio: 0.5, duration_ratio: 1.00 }, - { frequency_ratio: 1.0, duration_ratio: 0.80 }, - { frequency_ratio: 2.0, duration_ratio: 0.60 }, - { frequency_ratio: 3.0, duration_ratio: 0.40 }, - { frequency_ratio: 4.2, duration_ratio: 0.25 }, - { frequency_ratio: 5.4, duration_ratio: 0.20 }, - { frequency_ratio: 6.8, duration_ratio: 0.15 } - ] - end - - def defaults_bell_to_sine_waves - { frequency: 440, duration: 1.seconds, queue_in: 0 } - end - - def bell_to_sine_waves opts = {} - opts = defaults_bell_to_sine_waves.merge opts - bell_harmonics.map do |b| - { - frequency: opts[:frequency] * b[:frequency_ratio], - duration: opts[:duration] * b[:duration_ratio], - queue_in: opts[:queue_in], - gain: (1.fdiv bell_harmonics.length), - fade_out: true - } - end - end - end - - begin # audio entity construction - def generate_audio_data sine_wave, sample_rate - sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil - copy_count = (sample_size.fdiv sine_wave.length).ceil - sine_wave * copy_count - end - - def defaults_new_audio_state - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } - end - - def new_audio_state args, opts = {} - opts = defaults_new_audio_state.merge opts - decay_rate = 0 - decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] - frequency = opts[:frequency] - sample_rate = 48000 - - { - id: (new_id! args), - frequency: frequency, - sample_rate: 48000, - stop_at: args.tick_count + opts[:queue_in] + opts[:duration], - gain: opts[:gain].to_f, - queue_at: args.state.tick_count + opts[:queue_in], - decay_rate: decay_rate, - pitch: 1.0, - looping: true, - paused: false - } - end - - def queue_audio args, opts = {} - graph_wave args, opts[:wave], opts[:audio_state][:frequency] - args.state.audio_queue << opts[:audio_state] - end - - def new_id! args - args.state.audio_id ||= 0 - args.state.audio_id += 1 - end - - def graph_wave args, wave, frequency - if args.state.tick_count != args.state.graphed_at - args.outputs.static_lines.clear - args.outputs.static_sprites.clear - end - - wave = wave - - r, g, b = frequency.to_i % 85, - frequency.to_i % 170, - frequency.to_i % 255 - - starting_rect = args.layout.rect(row: 5, col: 13) - x_scale = 10 - y_scale = 100 - max_points = 25 - - points = wave - if wave.length > max_points - resolution = wave.length.idiv max_points - points = wave.find_all.with_index { |y, i| (i % resolution == 0) } - end - - args.outputs.static_lines << points.map_with_index do |y, x| - next_y = points[x + 1] - - if next_y - { - x: starting_rect.x + (x * x_scale), - y: starting_rect.y + starting_rect.h.half + y_scale * y, - x2: starting_rect.x + ((x + 1) * x_scale), - y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, - r: r, - g: g, - b: b - } - end - end - - args.outputs.static_sprites << points.map_with_index do |y, x| - { - x: (starting_rect.x + (x * x_scale)) - 2, - y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, - w: 4, - h: 4, - path: 'sprites/square-white.png', - r: r, - g: g, - b: b - } - end - - args.state.graphed_at = args.state.tick_count - end - end - - begin # region: musical note mapping - def defaults_frequency_for - { note: :a, octave: 5, sharp: false, flat: false } - end - - def frequency_for opts = {} - opts = defaults_frequency_for.merge opts - octave_offset_multiplier = opts[:octave] - 5 - note = note_frequencies_octave_5[opts[:note]] - if octave_offset_multiplier < 0 - note = note * 1 / (octave_offset_multiplier.abs + 1) - elsif octave_offset_multiplier > 0 - note = note * (octave_offset_multiplier.abs + 1) / 1 - end - note - end - - def note_frequencies_octave_5 - { - a: 440.0, - a_sharp: 466.16, b_flat: 466.16, - b: 493.88, - c: 523.25, - c_sharp: 554.37, d_flat: 587.33, - d: 587.33, - d_sharp: 622.25, e_flat: 659.25, - e: 659.25, - f: 698.25, - f_sharp: 739.99, g_flat: 739.99, - g: 783.99, - g_sharp: 830.61, a_flat: 830.61 - } - end - end - end - - $gtk.reset - -#+end_src - *** Input Basics - Keyboard - main.rb #+begin_src ruby # ./samples/02_input_basics/01_keyboard/app/main.rb @@ -4626,9 +4018,9 @@ Follows is a source code listing for all files that have been open sourced. This def tick args tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 # Notice how small_font accounts for all the remaining parameters - args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] - args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] - args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 0), text: "Current game time: #{args.state.tick_count}", size_enum: -1 } + args.outputs.labels << { x: 460, y: row_to_px(args, 2), text: "Keyboard input: args.inputs.keyboard.key_up.h", size_enum: -1 } + args.outputs.labels << { x: 460, y: row_to_px(args, 3), text: "Press \"h\" on the keyboard.", size_enum: -1 } # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key if args.inputs.keyboard.key_up.h @@ -4639,27 +4031,19 @@ Follows is a source code listing for all files that have been open sourced. This args.state.h_pressed_at ||= false if args.state.h_pressed_at - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" was pressed at time: #{args.state.h_pressed_at}", size_enum: -1 } else - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" has never been pressed.", size_enum: -1 } end tick_help_text args end - def small_font - # This method provides some values for the construction of labels - # Specifically, Size, Alignment, & RGBA - # This makes it so that custom parameters don't have to be repeatedly typed. - # Additionally "small_font" provides programmers with more information than some numbers - [-2, 0, 0, 0, 0, 255] - end - - def row_to_px args, row_number + def row_to_px args, row_number, y_offset = 20 # This takes a row_number and converts it to pixels DragonRuby understands. # Row 0 starts 5 units below the top of the grid # Each row afterward is 20 units lower - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (y_offset * row_number) end # Don't worry about understanding the code within this method just yet. @@ -4689,17 +4073,17 @@ Follows is a source code listing for all files that have been open sourced. This end end - args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] + args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: "This is the api for the keys you've pressed:", size_enum: -1, r: 180 } if !args.state.help_available args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] return end - args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] - args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] - args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] - args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] + args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: "args.inputs.keyboard", size_enum: -2 } + args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_down", size_enum: -2 } + args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_held", size_enum: -2 } + args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_up", size_enum: -2 } fill_history args, :key_value_history, :down_or_held, nil fill_history args, :key_down_value_history, :down, :key_down @@ -4745,12 +4129,8 @@ Follows is a source code listing for all files that have been open sourced. This end idx += 2 [ - [x, row_to_px(args, idx - 2), - " .#{k} is #{current_value || "nil"}", - small_font], - [x, row_to_px(args, idx - 1), - " was #{v}", - small_font] + { x: x, y: row_to_px(args, idx + 0, 16), text: " .#{k} is #{current_value || "nil"}", size_enum: -2 }, + { x: x, y: row_to_px(args, idx + 1, 16), text: " was #{v}", size_enum: -2 } ] end end @@ -4765,13 +4145,51 @@ Follows is a source code listing for all files that have been open sourced. This args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, + size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", + size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end #+end_src +*** Input Basics - Moving A Sprite - main.rb +#+begin_src ruby + # ./samples/02_input_basics/01_moving_a_sprite/app/main.rb + def tick args + # create a player and set default values + # for the player's x, y, w (width), and h (height) + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.state.player.w ||= 50 + args.state.player.h ||= 50 + + # render the player to the screen + args.outputs.sprites << { x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/square/green.png' } + + # move the player around using the keyboard + if args.inputs.up + args.state.player.y += 10 + elsif args.inputs.down + args.state.player.y -= 10 + end + + if args.inputs.left + args.state.player.x -= 10 + elsif args.inputs.right + args.state.player.x += 10 + end + end + + $gtk.reset + +#+end_src + *** Input Basics - Mouse - main.rb #+begin_src ruby # ./samples/02_input_basics/02_mouse/app/main.rb @@ -4809,7 +4227,7 @@ Follows is a source code listing for all files that have been open sourced. This # Use args.inputs.mouse.click.created_at # To see how many frames its been since the click occurred - # Use args.inputs.mouse.click.creat_at_elapsed + # Use args.inputs.mouse.click.created_at_elapsed # Saving the click in args.state can be quite useful @@ -4838,11 +4256,7 @@ Follows is a source code listing for all files that have been open sourced. This # This method effectively combines the row_to_px and small_font methods # It changes the given row value to a DragonRuby pixel value # and adds the customization parameters - [x, row_to_px(args, row), message, small_font] - end - - def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, alignment_enum: -2 } end def row_to_px args, row_number @@ -4858,9 +4272,9 @@ Follows is a source code listing for all files that have been open sourced. This args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end #+end_src @@ -4912,7 +4326,7 @@ Follows is a source code listing for all files that have been open sourced. This args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") - box = [785, 370, 50, 50, 0, 0, 170] + box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 } args.outputs.borders << box # Saves the most recent click into args.state @@ -4934,11 +4348,7 @@ Follows is a source code listing for all files that have been open sourced. This end def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] - end - - def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } end def row_to_px args, row_number @@ -4954,9 +4364,9 @@ Follows is a source code listing for all files that have been open sourced. This args.state.key_event_occurred = true end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end #+end_src @@ -5008,9 +4418,15 @@ Follows is a source code listing for all files that have been open sourced. This # They are stored in game so that they do not get reset every tick if args.inputs.mouse.click if !args.state.box_collision_one - args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] + args.state.box_collision_one = { x: args.inputs.mouse.click.point.x - 25, + y: args.inputs.mouse.click.point.y - 25, + w: 125, h: 125, + r: 180, g: 0, b: 0, a: 180 } elsif !args.state.box_collision_two - args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] + args.state.box_collision_two = { x: args.inputs.mouse.click.point.x - 25, + y: args.inputs.mouse.click.point.y - 25, + w: 125, h: 125, + r: 0, g: 0, b: 180, a: 180 } else args.state.box_collision_one = nil args.state.box_collision_two = nil @@ -5037,15 +4453,11 @@ Follows is a source code listing for all files that have been open sourced. This end def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] - end - - def small_font - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } end def row_to_px args, row_number - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (20 * row_number) end def tick_instructions args, text, y = 715 @@ -5111,57 +4523,51 @@ Follows is a source code listing for all files that have been open sourced. This def process_inputs state.buttons = [] - state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] - state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] - - state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] - state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] - - state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] - state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] - - state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] - state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] - state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] - state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] - - state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] - state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] - state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] - state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] - - state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, - 100 + inputs.controller_one.left_analog_y_perc * 100, - inputs.controller_one.key_held.l3, - "L3"] - - state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, - 100 + inputs.controller_one.right_analog_y_perc * 100, - inputs.controller_one.key_held.r3, - "R3"] + state.buttons << { x: 100, y: 500, active: inputs.controller_one.key_held.l1, text: "L1"} + state.buttons << { x: 100, y: 600, active: inputs.controller_one.key_held.l2, text: "L2"} + state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"} + state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"} + state.buttons << { x: 540, y: 450, active: inputs.controller_one.key_held.select, text: "Select"} + state.buttons << { x: 660, y: 450, active: inputs.controller_one.key_held.start, text: "Start"} + state.buttons << { x: 200, y: 300, active: inputs.controller_one.key_held.left, text: "Left"} + state.buttons << { x: 300, y: 400, active: inputs.controller_one.key_held.up, text: "Up"} + state.buttons << { x: 400, y: 300, active: inputs.controller_one.key_held.right, text: "Right"} + state.buttons << { x: 300, y: 200, active: inputs.controller_one.key_held.down, text: "Down"} + state.buttons << { x: 800, y: 300, active: inputs.controller_one.key_held.x, text: "X"} + state.buttons << { x: 900, y: 400, active: inputs.controller_one.key_held.y, text: "Y"} + state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"} + state.buttons << { x: 900, y: 200, active: inputs.controller_one.key_held.b, text: "B"} + state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100, + y: 100 + inputs.controller_one.left_analog_y_perc * 100, + active: inputs.controller_one.key_held.l3, + text: "L3" } + state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100, + y: 100 + inputs.controller_one.right_analog_y_perc * 100, + active: inputs.controller_one.key_held.r3, + text: "R3" } end # Gives each button a square shape. # If the button is being pressed or held (which means it is considered active), # the square is filled in. Otherwise, the button simply has a border. def render - state.buttons.each do |x, y, active, text| - rect = [x, y, 75, 75] + state.buttons.each do |b| + rect = { x: b.x, y: b.y, w: 75, h: 75 } - if active # if button is pressed + if b.active # if button is pressed outputs.solids << rect # rect is output as solid (filled in) else outputs.borders << rect # otherwise, output as border end # Outputs the text of each button using labels. - outputs.labels << [x, y + 95, text] # add 95 to place label above button + outputs.labels << { x: b.x, y: b.y + 95, text: b.text } # add 95 to place label above button end - outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] - outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] - outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] - outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] + outputs.labels << { x: 10, y: 60, text: "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)" } + outputs.labels << { x: 10, y: 30, text: "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)" } + outputs.labels << { x: 900, y: 60, text: "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)" } + outputs.labels << { x: 900, y: 30, text: "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)" } end end @@ -5212,10 +4618,12 @@ Follows is a source code listing for all files that have been open sourced. This # the next new touch will be finger_one again, but until then, new touches # don't fill in earlier slots. if !args.inputs.finger_one.nil? - args.outputs.primitives << [640, 650, "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", 5, 1, 255, 255, 255].label + args.outputs.primitives << { x: 640, y: 650, text: "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end if !args.inputs.finger_two.nil? - args.outputs.primitives << [640, 600, "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", 5, 1, 255, 255, 255].label + args.outputs.primitives << { x: 640, y: 600, text: "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! end # Here's the more flexible interface: this will report as many simultaneous @@ -5236,11 +4644,10 @@ Follows is a source code listing for all files that have been open sourced. This r = (color & 0xFF0000) >> 16 g = (color & 0x00FF00) >> 8 b = (color & 0x0000FF) - args.outputs.primitives << [v.x - (size / 2), v.y + (size / 2), size, size, r, g, b, 255].solid - args.outputs.primitives << [v.x, v.y + size, k.to_s, 0, 1, 0, 0, 0].label + args.outputs.primitives << { x: v.x - (size / 2), y: v.y + (size / 2), w: size, h: size, r: r, g: g, b: b, a: 255 }.solid! + args.outputs.primitives << { x: v.x, y: v.y + size, text: k.to_s, alignment_enum: 1 }.label! } end - #+end_src @@ -5280,6 +4687,8 @@ Follows is a source code listing for all files that have been open sourced. This # in this tick "entry point": `looping_animation`, and the # second method is `one_time_animation`. def tick args + # uncomment the line below to see animation play out in slow motion + # args.gtk.slowmo! 6 looping_animation args one_time_animation args end @@ -5312,22 +4721,22 @@ Follows is a source code listing for all files that have been open sourced. This does_sprite_loop # Now that we have `sprite_index, we can present the correct file. - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 100, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } # Try changing the numbers below to see how the animation changes: - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] + args.outputs.sprites << { x: 100, y: 200, w: 100, h: 100, path: "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png" } end # This function shows how to animate a sprite that executes # only once when the "f" key is pressed. def one_time_animation args # This is just a label the shows instructions within the game. - args.outputs.labels << [220, 350, "(press f to animate)"] + args.outputs.labels << { x: 220, y: 350, text: "(press f to animate)" } # If "f" is pressed on the keyboard... if args.inputs.keyboard.key_down.f # Print the frame that "f" was pressed on. - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.state.tick_count}" # And MOST IMPORTANTLY set the point it time to start the animation, # equal to "now" which is represented as args.state.tick_count. @@ -5360,7 +4769,7 @@ Follows is a source code listing for all files that have been open sourced. This sprite_index ||= 0 # Present the sprite. - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 300, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." end @@ -7353,9 +6762,9 @@ Follows is a source code listing for all files that have been open sourced. This mouse_overlay = mouse_overlay.merge r: 255 if state.delete_mode if state.mouse_held - outputs.primitives << mouse_overlay.border + outputs.primitives << mouse_overlay.border! else - outputs.primitives << mouse_overlay.solid + outputs.primitives << mouse_overlay.solid! end end @@ -7419,7 +6828,7 @@ Follows is a source code listing for all files that have been open sourced. This def calc_below return unless player.dy <= 0 - tiles_below = find_tiles { |t| t.rect.top <= player.y } + tiles_below = find_tiles { |t| t.rect.top <= player.prev_rect.y } collision = find_colliding_tile tiles_below, (player.rect.merge y: player.next_rect.y) return unless collision if collision.neighbors.b == :none && player.jumped_down_at.elapsed_time < 10 @@ -7450,7 +6859,7 @@ Follows is a source code listing for all files that have been open sourced. This def calc_above return unless player.dy > 0 - tiles_above = find_tiles { |t| t.rect.y >= player.y } + tiles_above = find_tiles { |t| t.rect.y >= player.prev_rect.y } collision = find_colliding_tile tiles_above, (player.rect.merge y: player.next_rect.y) return unless collision return if collision.neighbors.t == :none @@ -7459,17 +6868,17 @@ Follows is a source code listing for all files that have been open sourced. This end def calc_player_dx - player.y += player.dy - player.dy += state.gravity - player.dy += player.dy * state.drag ** 2 * -1 - end - - def calc_player_dy player.dx = player.dx.clamp(-5, 5) player.dx *= 0.9 player.x += player.dx end + def calc_player_dy + player.y += player.dy + player.dy += state.gravity + player.dy += player.dy * state.drag ** 2 * -1 + end + def reset_player player.x = 100 player.y = 720 @@ -7613,8 +7022,7 @@ Follows is a source code listing for all files that have been open sourced. This input end - # Sets default values - def defaults + def init_game s.platforms ||= [ # initializes platforms collection with two platforms using hashes new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher @@ -7637,6 +7045,11 @@ Follows is a source code listing for all files that have been open sourced. This s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) end + # Sets default values + def defaults + init_game + end + # Outputs objects onto the screen def render outputs.solids << s.platforms.map do |p| # outputs platforms onto screen @@ -7724,7 +7137,9 @@ Follows is a source code listing for all files that have been open sourced. This rect: nil) end else + # game over s.as_hash.clear # otherwise clear the hash (no new platform is necessary) + init_game end end @@ -7863,15 +7278,15 @@ Follows is a source code listing for all files that have been open sourced. This # ./samples/04_physics_and_collisions/08_bouncing_on_collision/app/block.rb DEGREES_TO_RADIANS = Math::PI / 180 - class Block + class Block def initialize(x, y, block_size, rotation) @x = x - @y = y + @y = y @block_size = block_size @rotation = rotation #The repel velocity? - @velocity = {x: 2, y: 0} + @velocity = {x: 2, y: 0} horizontal_offset = (3 * block_size) * Math.cos(rotation * DEGREES_TO_RADIANS) vertical_offset = block_size * Math.sin(rotation * DEGREES_TO_RADIANS) @@ -7899,7 +7314,7 @@ Follows is a source code listing for all files that have been open sourced. This @imaginary_line = [ @x1, @y1, @x2, @y2 ] end - + end def draw args @@ -7943,7 +7358,7 @@ Follows is a source code listing for all files that have been open sourced. This collision = false if @rotation >= 0 - if (current_area < min_area && + if (current_area < min_area && current_area > 0 && args.state.ball.center.y > @y1 && args.state.ball.center.x < @x2) @@ -7951,7 +7366,7 @@ Follows is a source code listing for all files that have been open sourced. This collision = true end else - if (current_area < min_area && + if (current_area < min_area && current_area > 0 && args.state.ball.center.y > @y2 && args.state.ball.center.x > @x1) @@ -7959,7 +7374,7 @@ Follows is a source code listing for all files that have been open sourced. This collision = true end end - + return collision end @@ -7980,7 +7395,7 @@ Follows is a source code listing for all files that have been open sourced. This x:args.state.ball.center.x-args.state.ball.velocity.x, y:args.state.ball.center.y-args.state.ball.velocity.y } - + velocityMag = (args.state.ball.velocity.x**2 + args.state.ball.velocity.y**2)**0.5 # the current velocity magnitude of the ball theta_ball = Math.atan2(args.state.ball.velocity.y, args.state.ball.velocity.x) #the angle of the ball's velocity theta_repel = (180 * DEGREES_TO_RADIANS) - theta_ball + (@rotation * DEGREES_TO_RADIANS) @@ -8002,7 +7417,7 @@ Follows is a source code listing for all files that have been open sourced. This dampener = 0.3 ynew *= dampener * 0.5 - + #If the bounce is very low, that means the ball is rolling and we don't want to dampenen the X velocity if ynew > -0.1 xnew *= dampener @@ -8011,7 +7426,7 @@ Follows is a source code listing for all files that have been open sourced. This #Add the sine component of gravity back in (X component) gravity_x = 4 * Math.sin(@rotation * DEGREES_TO_RADIANS) xnew += gravity_x - + args.state.ball.velocity.x = -xnew args.state.ball.velocity.y = -ynew @@ -10425,12 +9840,23 @@ Follows is a source code listing for all files that have been open sourced. This # Starts the game with player x's turn and creates an array (to_a) for space combinations. # Calls methods necessary for the game to run properly. def tick - state.current_turn ||= :x - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + init_new_game render_board input_board end + def init_new_game + state.current_turn ||= :x + state.space_combinations ||= [-1, 0, 1].product([-1, 0, 1]).to_a + + state.spaces ||= {} + + state.space_combinations.each do |x, y| + state.spaces[x] ||= {} + state.spaces[x][y] ||= state.new_entity(:space) + end + end + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. def render_board square_size = 80 @@ -10506,6 +9932,7 @@ Follows is a source code listing for all files that have been open sourced. This def input_restart_game return unless state.game_over gtk.reset + init_new_game end # Checks if x or o won the game. @@ -10822,7 +10249,7 @@ Follows is a source code listing for all files that have been open sourced. This def calc_kill_zombie # Find all zombies that intersect with the player. They are considered killed. - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + killed_this_frame = state.zombies.find_all { |z| z.sprite && (z.sprite.intersect_rect? state.player_sprite) } state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies @@ -11650,6 +11077,1126 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Audio - Audio Mixer - main.rb +#+begin_src ruby + # ./samples/07_advanced_audio/01_audio_mixer/app/main.rb + # these are the properties that you can sent on args.audio + def spawn_new_sound args, name, path + # Spawn randomly in an area that won't be covered by UI. + screenx = (rand * 600.0) + 200.0 + screeny = (rand * 400.0) + 100.0 + + id = new_sound_id! args + # you can hang anything on the audio hashes you want, so we store the + # actual screen position in here for convenience. + args.audio[id] = { + name: name, + input: path, + screenx: screenx, + screeny: screeny, + x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range + y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range + z: 0.0, + gain: 1.0, + pitch: 1.0, + looping: true, + paused: false + } + + args.state.selected = id + end + + # these are values you can change on the ~args.audio~ data structure + def input_panel args + return unless args.state.panel + return if args.state.dragging + + audio_entry = args.audio[args.state.selected] + results = args.state.panel + + if args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.pitch_slider_rect.rect) + audio_entry.pitch = 2.0 * ((args.inputs.mouse.x - results.pitch_slider_rect.x).to_f / (results.pitch_slider_rect.w - 1.0)) + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.playtime_slider_rect.rect) + audio_entry.playtime = audio_entry.length_ * ((args.inputs.mouse.x - results.playtime_slider_rect.x).to_f / (results.playtime_slider_rect.w - 1.0)) + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.gain_slider_rect.rect) + audio_entry.gain = (args.inputs.mouse.x - results.gain_slider_rect.x).to_f / (results.gain_slider_rect.w - 1.0) + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.looping_checkbox_rect.rect) + audio_entry.looping = !audio_entry.looping + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.paused_checkbox_rect.rect) + audio_entry.paused = !audio_entry.paused + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.delete_button_rect.rect) + args.audio.delete args.state.selected + end + end + + def render_sources args + args.outputs.primitives << args.audio.keys.map do |k| + s = args.audio[k] + + isselected = (k == args.state.selected) + + color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] + [ + [s.screenx, s.screeny, args.state.boxsize, args.state.boxsize, *color].solid, + + { + x: s.screenx + args.state.boxsize.half, + y: s.screeny, + text: s.name, + r: 255, + g: 255, + b: 255, + alignment_enum: 1 + }.label! + ] + end + end + + def playtime_str t + return "" unless t + minutes = (t / 60.0).floor + seconds = t - (minutes * 60.0).to_f + return minutes.to_s + ':' + seconds.floor.to_s + ((seconds - seconds.floor).to_s + "000")[1..3] + end + + def label_with_drop_shadow x, y, text + [ + { x: x + 1, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, + { x: x + 2, y: y + 0, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, + { x: x + 0, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 200, g: 200, b: 200 }.label! + ] + end + + def check_box opts = {} + checkbox_template = opts.args.layout.rect(w: 0.5, h: 0.5, col: 2) + final_rect = checkbox_template.center_inside_rect_y(opts.args.layout.rect(row: opts.row, col: opts.col)) + color = { r: 0, g: 0, b: 0 } + color = { r: 255, g: 255, b: 255 } if opts.checked + + { + rect: final_rect, + primitives: [ + (final_rect.to_solid color) + ] + } + end + + def progress_bar opts = {} + outer_rect = opts.args.layout.rect(row: opts.row, col: opts.col, w: 5, h: 1) + color = opts.percentage * 255 + baseline_progress_bar = opts.args + .layout + .rect(w: 5, h: 0.5) + + final_rect = baseline_progress_bar.center_inside_rect(outer_rect) + center = final_rect.rect_center_point + + { + rect: final_rect, + primitives: [ + final_rect.merge(r: color, g: color, b: color, a: 128).solid!, + label_with_drop_shadow(center.x, center.y, opts.text) + ] + } + end + + def panel_primitives args, audio_entry + results = { primitives: [] } + + return results unless audio_entry + + # this uses DRGTK's layout apis to layout the controls + # imagine the screen is split into equal cells (24 cells across, 12 cells up and down) + # args.layout.rect returns a hash which we merge values with to create primitives + # using args.layout.rect removes the need for pixel pushing + + # args.outputs.debug << args.layout.debug_primitives(r: 255, g: 255, b: 255) + + white_color = { r: 255, g: 255, b: 255 } + label_style = white_color.merge(vertical_alignment_enum: 1) + + # panel background + results.primitives << args.layout.rect(row: 0, col: 0, w: 7, h: 6, include_col_gutter: true, include_row_gutter: true) + .border!(r: 255, g: 255, b: 255) + + # title + results.primitives << args.layout.point(row: 0, col: 3.5, row_anchor: 0.5) + .merge(label_style) + .merge(text: "Source #{args.state.selected} (#{args.audio[args.state.selected].name})", + size_enum: 3, + alignment_enum: 1) + + # seperator line + results.primitives << args.layout.rect(row: 1, col: 0, w: 7, h: 0) + .line!(white_color) + + # screen location + results.primitives << args.layout.point(row: 1.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "screen:") + + results.primitives << args.layout.point(row: 1.0, col: 2, row_anchor: 0.5) + .merge(label_style) + .merge(text: "(#{audio_entry.screenx.to_i}, #{audio_entry.screeny.to_i})") + + # position + results.primitives << args.layout.point(row: 1.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "position:") + + results.primitives << args.layout.point(row: 1.5, col: 2, row_anchor: 0.5) + .merge(label_style) + .merge(text: "(#{audio_entry[:x].round(5).to_s[0..6]}, #{audio_entry[:y].round(5).to_s[0..6]})") + + results.primitives << args.layout.point(row: 2.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "pitch:") + + results.pitch_slider_rect = progress_bar(row: 2.0, col: 2, + percentage: audio_entry.pitch / 2.0, + text: "#{audio_entry.pitch.to_sf}", + args: args) + + results.primitives << results.pitch_slider_rect.primitives + + results.primitives << args.layout.point(row: 2.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "playtime:") + + results.playtime_slider_rect = progress_bar(args: args, + row: 2.5, + col: 2, + percentage: (audio_entry.playtime || 1) / (audio_entry.length_ || 1), + text: "#{playtime_str(audio_entry.playtime)} / #{playtime_str(audio_entry.length_)}") + + results.primitives << results.playtime_slider_rect.primitives + + results.primitives << args.layout.point(row: 3.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "gain:") + + results.gain_slider_rect = progress_bar(args: args, + row: 3.0, + col: 2, + percentage: audio_entry.gain, + text: "#{audio_entry.gain.to_sf}") + + results.primitives << results.gain_slider_rect.primitives + + + results.primitives << args.layout.point(row: 3.5, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "looping:") + + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) + + results.looping_checkbox_rect = check_box(args: args, row: 3.5, col: 2, checked: audio_entry.looping) + results.primitives << results.looping_checkbox_rect.primitives + + results.primitives << args.layout.point(row: 4.0, col: 0, row_anchor: 0.5) + .merge(label_style) + .merge(text: "paused:") + + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) + + results.paused_checkbox_rect = check_box(args: args, row: 4.0, col: 2, checked: !audio_entry.paused) + results.primitives << results.paused_checkbox_rect.primitives + + results.delete_button_rect = { rect: args.layout.rect(row: 5, col: 0, w: 7, h: 1) } + + results.primitives << results.delete_button_rect.to_solid(r: 180) + + results.primitives << args.layout.point(row: 5, col: 3.5, row_anchor: 0.5) + .merge(label_style) + .merge(text: "DELETE", alignment_enum: 1) + + return results + end + + def render_panel args + args.state.panel = nil + audio_entry = args.audio[args.state.selected] + return unless audio_entry + + mouse_down = (args.state.mouse_held >= 0) + args.state.panel = panel_primitives args, audio_entry + args.outputs.primitives << args.state.panel.primitives + end + + def new_sound_id! args + args.state.sound_id ||= 0 + args.state.sound_id += 1 + args.state.sound_id + end + + def render_launcher args + args.outputs.primitives << args.state.spawn_sound_buttons.map(&:primitives) + end + + def render_ui args + render_launcher args + render_panel args + end + + def tick args + defaults args + render args + input args + end + + def input args + if !args.audio[args.state.selected] + args.state.selected = nil + args.state.dragging = nil + end + + # spawn button and node interaction + if args.inputs.mouse.click + spawn_sound_button = args.state.spawn_sound_buttons.find { |b| args.inputs.mouse.inside_rect? b.rect } + + audio_click_key, audio_click_value = args.audio.find do |k, v| + args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] + end + + if spawn_sound_button + args.state.selected = nil + spawn_new_sound args, spawn_sound_button.name, spawn_sound_button.path + elsif audio_click_key + args.state.selected = audio_click_key + end + end + + if args.state.mouse_state == :held && args.state.selected + v = args.audio[args.state.selected] + if args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] + args.state.dragging = args.state.selected + end + + if args.state.dragging + s = args.audio[args.state.selected] + # you can hang anything on the audio hashes you want, so we store the + # actual screen position so it doesn't scale weirdly vs your mouse. + s.screenx = args.inputs.mouse.x - (args.state.boxsize / 2) + s.screeny = args.inputs.mouse.y - (args.state.boxsize / 2) + + s.screeny = 50 if s.screeny < 50 + s.screeny = (719 - args.state.boxsize) if s.screeny > (719 - args.state.boxsize) + s.screenx = 0 if s.screenx < 0 + s.screenx = (1279 - args.state.boxsize) if s.screenx > (1279 - args.state.boxsize) + + s.x = ((s.screenx / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range + s.y = ((s.screeny / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range + end + elsif args.state.mouse_state == :released + args.state.dragging = nil + end + + input_panel args + end + + def defaults args + args.state.mouse_state ||= :released + args.state.dragging_source ||= false + args.state.selected ||= 0 + args.state.next_sound_index ||= 0 + args.state.boxsize ||= 30 + args.state.sound_files ||= [ + { name: :tada, path: "sounds/tada.wav" }, + { name: :splash, path: "sounds/splash.wav" }, + { name: :drum, path: "sounds/drum.wav" }, + { name: :spring, path: "sounds/spring.wav" }, + { name: :music, path: "sounds/music.ogg" } + ] + + # generate buttons based off the sound collection above + args.state.spawn_sound_buttons ||= begin + # create a group of buttons + # column centered (using col_offset to calculate the column offset) + # where each item is 2 columns apart + rects = args.layout.rect_group row: 11, + col_offset: { + count: args.state.sound_files.length, + w: 2 + }, + dcol: 2, + w: 2, + h: 1, + group: args.state.sound_files + + # now that you have the rects + # construct the metadata for the buttons + rects.map do |rect| + { + rect: rect, + name: rect.name, + path: rect.path, + primitives: [ + rect.to_border(r: 255, g: 255, b: 255), + rect.to_label(x: rect.center_x, + y: rect.center_y, + text: "#{rect.name}", + alignment_enum: 1, + vertical_alignment_enum: 1, + r: 255, g: 255, b: 255) + ] + } + end + end + + if args.inputs.mouse.up + args.state.mouse_state = :released + args.state.dragging_source = false + elsif args.inputs.mouse.down + args.state.mouse_state = :held + end + + args.outputs.background_color = [ 0, 0, 0, 255 ] + end + + def render args + render_ui args + render_sources args + end + +#+end_src + +*** Advanced Audio - Audio Mixer - server_ip_address.txt +#+begin_src ruby + # ./samples/07_advanced_audio/01_audio_mixer/app/server_ip_address.txt + 192.168.1.65 +#+end_src + +*** Advanced Audio - Sound Synthesis - main.rb +#+begin_src ruby + # ./samples/07_advanced_audio/02_sound_synthesis/app/main.rb + begin # region: top level tick methods + def tick args + defaults args + render args + input args + process_audio_queue args + end + + def defaults args + args.state.sine_waves ||= {} + args.state.square_waves ||= {} + args.state.saw_tooth_waves ||= {} + args.state.triangle_waves ||= {} + args.state.audio_queue ||= [] + args.state.buttons ||= [ + (frequency_buttons args), + (sine_wave_note_buttons args), + (bell_buttons args), + (square_wave_note_buttons args), + (saw_tooth_wave_note_buttons args), + (triangle_wave_note_buttons args), + ].flatten + end + + def render args + args.outputs.borders << args.state.buttons.map { |b| b[:border] } + args.outputs.labels << args.state.buttons.map { |b| b[:label] } + args.outputs.labels << args.layout + .rect(row: 0, col: 11.5) + .yield_self { |r| r.merge y: r.y + r.h } + .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", + alignment_enum: 1) + end + + + def input args + args.state.buttons.each do |b| + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) + parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " + args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" + send b[:method_to_call], args, b + end + end + + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) + args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' + end + end + + def process_audio_queue args + to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } + args.state.audio_queue -= to_queue + to_queue.each { |a| args.audio[a[:id]] = a } + + args.audio.find_all { |k, v| v[:decay_rate] } + .each { |k, v| v[:gain] -= v[:decay_rate] } + + sounds_to_stop = args.audio + .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } + .map { |k, v| k } + + sounds_to_stop.each { |k| args.audio.delete k } + end + end + + begin # region: button definitions, ui layout, callback functions + def button args, opts + button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) + + button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 + + label_offset_x = 5 + label_offset_y = 30 + + button_def[:label] = button_def[:rect].merge text: opts[:text], + size_enum: -2.5, + x: button_def[:rect].x + label_offset_x, + y: button_def[:rect].y + label_offset_y + + button_def + end + + def play_sine_wave args, sender + queue_sine_wave args, + frequency: sender[:frequency], + duration: 1.seconds, + fade_out: true + end + + def play_note args, sender + method_to_call = :queue_sine_wave + method_to_call = :queue_square_wave if sender[:type] == :square + method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth + method_to_call = :queue_triangle_wave if sender[:type] == :triangle + method_to_call = :queue_bell if sender[:type] == :bell + + send method_to_call, args, + frequency: (frequency_for note: sender[:note], octave: sender[:octave]), + duration: 1.seconds, + fade_out: true + end + + def frequency_buttons args + [ + (button args, + row: 4.0, col: 0, text: "300hz", + frequency: 300, + method_to_call: :play_sine_wave), + (button args, + row: 5.0, col: 0, text: "400hz", + frequency: 400, + method_to_call: :play_sine_wave), + (button args, + row: 6.0, col: 0, text: "500hz", + frequency: 500, + method_to_call: :play_sine_wave), + ] + end + + def sine_wave_note_buttons args + [ + (button args, + row: 1.5, col: 2, text: "Sine C4", + note: :c, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 2.5, col: 2, text: "Sine D4", + note: :d, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 3.5, col: 2, text: "Sine E4", + note: :e, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 4.5, col: 2, text: "Sine F4", + note: :f, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 5.5, col: 2, text: "Sine G4", + note: :g, octave: 4, type: :sine, method_to_call: :play_note), + (button args, + row: 6.5, col: 2, text: "Sine A5", + note: :a, octave: 5, type: :sine, method_to_call: :play_note), + (button args, + row: 7.5, col: 2, text: "Sine B5", + note: :b, octave: 5, type: :sine, method_to_call: :play_note), + (button args, + row: 8.5, col: 2, text: "Sine C5", + note: :c, octave: 5, type: :sine, method_to_call: :play_note), + ] + end + + def square_wave_note_buttons args + [ + (button args, + row: 1.5, col: 6, text: "Square C4", + note: :c, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 2.5, col: 6, text: "Square D4", + note: :d, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 3.5, col: 6, text: "Square E4", + note: :e, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 4.5, col: 6, text: "Square F4", + note: :f, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 5.5, col: 6, text: "Square G4", + note: :g, octave: 4, type: :square, method_to_call: :play_note), + (button args, + row: 6.5, col: 6, text: "Square A5", + note: :a, octave: 5, type: :square, method_to_call: :play_note), + (button args, + row: 7.5, col: 6, text: "Square B5", + note: :b, octave: 5, type: :square, method_to_call: :play_note), + (button args, + row: 8.5, col: 6, text: "Square C5", + note: :c, octave: 5, type: :square, method_to_call: :play_note), + ] + end + def saw_tooth_wave_note_buttons args + [ + (button args, + row: 1.5, col: 8, text: "Saw C4", + note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 2.5, col: 8, text: "Saw D4", + note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 3.5, col: 8, text: "Saw E4", + note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 4.5, col: 8, text: "Saw F4", + note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 5.5, col: 8, text: "Saw G4", + note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 6.5, col: 8, text: "Saw A5", + note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 7.5, col: 8, text: "Saw B5", + note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), + (button args, + row: 8.5, col: 8, text: "Saw C5", + note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), + ] + end + + def triangle_wave_note_buttons args + [ + (button args, + row: 1.5, col: 10, text: "Triangle C4", + note: :c, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 2.5, col: 10, text: "Triangle D4", + note: :d, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 3.5, col: 10, text: "Triangle E4", + note: :e, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 4.5, col: 10, text: "Triangle F4", + note: :f, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 5.5, col: 10, text: "Triangle G4", + note: :g, octave: 4, type: :triangle, method_to_call: :play_note), + (button args, + row: 6.5, col: 10, text: "Triangle A5", + note: :a, octave: 5, type: :triangle, method_to_call: :play_note), + (button args, + row: 7.5, col: 10, text: "Triangle B5", + note: :b, octave: 5, type: :triangle, method_to_call: :play_note), + (button args, + row: 8.5, col: 10, text: "Triangle C5", + note: :c, octave: 5, type: :triangle, method_to_call: :play_note), + ] + end + + def bell_buttons args + [ + (button args, + row: 1.5, col: 4, text: "Bell C4", + note: :c, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 2.5, col: 4, text: "Bell D4", + note: :d, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 3.5, col: 4, text: "Bell E4", + note: :e, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 4.5, col: 4, text: "Bell F4", + note: :f, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 5.5, col: 4, text: "Bell G4", + note: :g, octave: 4, type: :bell, method_to_call: :play_note), + (button args, + row: 6.5, col: 4, text: "Bell A5", + note: :a, octave: 5, type: :bell, method_to_call: :play_note), + (button args, + row: 7.5, col: 4, text: "Bell B5", + note: :b, octave: 5, type: :bell, method_to_call: :play_note), + (button args, + row: 8.5, col: 4, text: "Bell C5", + note: :c, octave: 5, type: :bell, method_to_call: :play_note), + ] + end + end + + begin # region: wave generation + begin # sine wave + def defaults_sine_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def sine_wave_for opts = {} + opts = defaults_sine_wave_for.merge opts + frequency = opts[:frequency] + sample_rate = opts[:sample_rate] + period_size = (sample_rate.fdiv frequency).ceil + period_size.map_with_index do |i| + Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) + end.to_a + end + + def defaults_queue_sine_wave + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def queue_sine_wave args, opts = {} + opts = defaults_queue_sine_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate + args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.sine_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: sine_wave + end + end + + begin # region: square wave + def defaults_square_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def square_wave_for opts = {} + opts = defaults_square_wave_for.merge opts + sine_wave = sine_wave_for opts + sine_wave.map do |v| + if v >= 0 + 1.0 + else + -1.0 + end + end.to_a + end + + def defaults_queue_square_wave + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } + end + + def queue_square_wave args, opts = {} + opts = defaults_queue_square_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate + args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.square_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: square_wave + end + end + + begin # region: saw tooth wave + def defaults_saw_tooth_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def saw_tooth_wave_for opts = {} + opts = defaults_saw_tooth_wave_for.merge opts + sine_wave = sine_wave_for opts + period_size = sine_wave.length + sine_wave.map_with_index do |v, i| + (((i % period_size).fdiv period_size) * 2) - 1 + end + end + + def defaults_queue_saw_tooth_wave + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } + end + + def queue_saw_tooth_wave args, opts = {} + opts = defaults_queue_saw_tooth_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate + args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: saw_tooth_wave + end + end + + begin # region: triangle wave + def defaults_triangle_wave_for + { frequency: 440, sample_rate: 48000 } + end + + def triangle_wave_for opts = {} + opts = defaults_saw_tooth_wave_for.merge opts + sine_wave = sine_wave_for opts + period_size = sine_wave.length + sine_wave.map_with_index do |v, i| + ratio = (i.fdiv period_size) + if ratio <= 0.5 + (ratio * 4) - 1 + else + ratio -= 0.5 + 1 - (ratio * 4) + end + end + end + + def defaults_queue_triangle_wave + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def queue_triangle_wave args, opts = {} + opts = defaults_queue_triangle_wave.merge opts + frequency = opts[:frequency] + sample_rate = 48000 + + triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate + args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate + + proc = lambda do + generate_audio_data args.state.triangle_waves[frequency], sample_rate + end + + audio_state = new_audio_state args, opts + audio_state[:input] = [1, sample_rate, proc] + queue_audio args, audio_state: audio_state, wave: triangle_wave + end + end + + begin # region: bell + def defaults_queue_bell + { frequency: 440, duration: 1.seconds, queue_in: 0 } + end + + def queue_bell args, opts = {} + (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } + end + + def bell_harmonics + [ + { frequency_ratio: 0.5, duration_ratio: 1.00 }, + { frequency_ratio: 1.0, duration_ratio: 0.80 }, + { frequency_ratio: 2.0, duration_ratio: 0.60 }, + { frequency_ratio: 3.0, duration_ratio: 0.40 }, + { frequency_ratio: 4.2, duration_ratio: 0.25 }, + { frequency_ratio: 5.4, duration_ratio: 0.20 }, + { frequency_ratio: 6.8, duration_ratio: 0.15 } + ] + end + + def defaults_bell_to_sine_waves + { frequency: 440, duration: 1.seconds, queue_in: 0 } + end + + def bell_to_sine_waves opts = {} + opts = defaults_bell_to_sine_waves.merge opts + bell_harmonics.map do |b| + { + frequency: opts[:frequency] * b[:frequency_ratio], + duration: opts[:duration] * b[:duration_ratio], + queue_in: opts[:queue_in], + gain: (1.fdiv bell_harmonics.length), + fade_out: true + } + end + end + end + + begin # audio entity construction + def generate_audio_data sine_wave, sample_rate + sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil + copy_count = (sample_size.fdiv sine_wave.length).ceil + sine_wave * copy_count + end + + def defaults_new_audio_state + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } + end + + def new_audio_state args, opts = {} + opts = defaults_new_audio_state.merge opts + decay_rate = 0 + decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] + frequency = opts[:frequency] + sample_rate = 48000 + + { + id: (new_id! args), + frequency: frequency, + sample_rate: 48000, + stop_at: args.tick_count + opts[:queue_in] + opts[:duration], + gain: opts[:gain].to_f, + queue_at: args.state.tick_count + opts[:queue_in], + decay_rate: decay_rate, + pitch: 1.0, + looping: true, + paused: false + } + end + + def queue_audio args, opts = {} + graph_wave args, opts[:wave], opts[:audio_state][:frequency] + args.state.audio_queue << opts[:audio_state] + end + + def new_id! args + args.state.audio_id ||= 0 + args.state.audio_id += 1 + end + + def graph_wave args, wave, frequency + if args.state.tick_count != args.state.graphed_at + args.outputs.static_lines.clear + args.outputs.static_sprites.clear + end + + wave = wave + + r, g, b = frequency.to_i % 85, + frequency.to_i % 170, + frequency.to_i % 255 + + starting_rect = args.layout.rect(row: 5, col: 13) + x_scale = 10 + y_scale = 100 + max_points = 25 + + points = wave + if wave.length > max_points + resolution = wave.length.idiv max_points + points = wave.find_all.with_index { |y, i| (i % resolution == 0) } + end + + args.outputs.static_lines << points.map_with_index do |y, x| + next_y = points[x + 1] + + if next_y + { + x: starting_rect.x + (x * x_scale), + y: starting_rect.y + starting_rect.h.half + y_scale * y, + x2: starting_rect.x + ((x + 1) * x_scale), + y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, + r: r, + g: g, + b: b + } + end + end + + args.outputs.static_sprites << points.map_with_index do |y, x| + { + x: (starting_rect.x + (x * x_scale)) - 2, + y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, + w: 4, + h: 4, + path: 'sprites/square-white.png', + r: r, + g: g, + b: b + } + end + + args.state.graphed_at = args.state.tick_count + end + end + + begin # region: musical note mapping + def defaults_frequency_for + { note: :a, octave: 5, sharp: false, flat: false } + end + + def frequency_for opts = {} + opts = defaults_frequency_for.merge opts + octave_offset_multiplier = opts[:octave] - 5 + note = note_frequencies_octave_5[opts[:note]] + if octave_offset_multiplier < 0 + note = note * 1 / (octave_offset_multiplier.abs + 1) + elsif octave_offset_multiplier > 0 + note = note * (octave_offset_multiplier.abs + 1) / 1 + end + note + end + + def note_frequencies_octave_5 + { + a: 440.0, + a_sharp: 466.16, b_flat: 466.16, + b: 493.88, + c: 523.25, + c_sharp: 554.37, d_flat: 587.33, + d: 587.33, + d_sharp: 622.25, e_flat: 659.25, + e: 659.25, + f: 698.25, + f_sharp: 739.99, g_flat: 739.99, + g: 783.99, + g_sharp: 830.61, a_flat: 830.61 + } + end + end + end + + $gtk.reset + +#+end_src + +*** Advanced Rendering - Labels With Wrapped Text - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/00_labels_with_wrapped_text/app/main.rb + def tick args + # defaults + args.state.scroll_location ||= 0 + args.state.textbox.messages ||= [] + args.state.textbox.scroll ||= 0 + + # render + args.outputs.background_color = [0, 0, 0, 255] + render_messages args + render_instructions args + + # inputs + if args.inputs.keyboard.key_down.one + queue_message args, "Hello there neighbour! my name is mark, how is your day today?" + end + + if args.inputs.keyboard.key_down.two + queue_message args, "I'm doing great sir, actually I'm having a picnic today" + end + + if args.inputs.keyboard.key_down.three + queue_message args, "Well that sounds wonderful!" + end + + if args.inputs.keyboard.key_down.home + args.state.scroll_location = 1 + end + + if args.inputs.keyboard.key_down.delete + clear_message_queue args + end + end + + def queue_message args, msg + args.state.textbox.messages.concat msg.wrapped_lines 50 + end + + def clear_message_queue args + args.state.textbox.messages = nil + args.state.textbox.scroll = 0 + end + + def render_messages args + args.outputs[:textbox].w = 400 + args.outputs[:textbox].h = 720 + + args.outputs.primitives << args.state.textbox.messages.each_with_index.map do |s, idx| + { + x: 0, + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, + text: s, + size_enum: -3, + alignment_enum: 0, + r: 255, g:255, b: 255, a: 255 + } + end + + args.outputs[:textbox].labels << args.state.textbox.messages.each_with_index.map do |s, idx| + { + x: 0, + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, + text: s, + size_enum: -3, + alignment_enum: 0, + r: 255, g:255, b: 255, a: 255 + } + end + + args.outputs[:textbox].borders << [0, 0, args.outputs[:textbox].w, 720] + + args.state.textbox.scroll += args.inputs.mouse.wheel.y unless args.inputs.mouse.wheel.nil? + + if args.state.scroll_location > 0 + args.state.textbox.scroll = 0 + args.state.scroll_location = 0 + end + + args.outputs.sprites << [900, 0, args.outputs[:textbox].w, 720, :textbox] + end + + def render_instructions args + args.outputs.labels << [30, + 30.from_top, + "press 1, 2, 3 to display messages, MOUSE WHEEL to scroll, HOME to go to top, BACKSPACE to delete.", + 0, 255, 255] + + args.outputs.primitives << [0, 55.from_top, 1280, 30, :pixel, 0, 255, 0, 0, 0].sprite + end + +#+end_src + +*** Advanced Rendering - Rotating Label - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/00_rotating_label/app/main.rb + def tick args + # set the render target width and height to match the label + args.outputs[:scene].w = 220 + args.outputs[:scene].h = 30 + + + # make the background transparent + args.outputs[:scene].background_color = [255, 255, 255, 0] + + # set the blendmode of the label to 0 (no blending) + # center it inside of the scene + # set the vertical_alignment_enum to 1 (center) + args.outputs[:scene].labels << { x: 0, + y: 15, + text: "label in render target", + blendmode_enum: 0, + vertical_alignment_enum: 1 } + + # add a border to the render target + args.outputs[:scene].borders << { x: 0, + y: 0, + w: args.outputs[:scene].w, + h: args.outputs[:scene].h } + + # add the rendertarget to the main output as a sprite + args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half, + y: 360 - args.outputs[:scene].h.half, + w: args.outputs[:scene].w, + h: args.outputs[:scene].h, + angle: args.state.tick_count, + path: :scene } + end + +#+end_src + *** Advanced Rendering - Simple Render Targets - main.rb #+begin_src ruby # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb @@ -12602,7 +13149,7 @@ Follows is a source code listing for all files that have been open sourced. This flip_horizontally: false, angle_anchor_x: 0.5, # rotation center set to middle angle_anchor_y: 0.5 - }.sprite + }.sprite! # Outputs label as primitive using a hash args.outputs.primitives << { @@ -12616,7 +13163,7 @@ Follows is a source code listing for all files that have been open sourced. This b: 50, a: 255, # transparency font: "fonts/manaspc.ttf" # font style - }.label + }.label! # Outputs solid as primitive using a hash args.outputs.primitives << { @@ -12628,7 +13175,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 50, b: 50, a: 255 # transparency - }.solid + }.solid! # Outputs border as primitive using a hash # Same parameters as solid @@ -12641,7 +13188,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 50, b: 50, a: 255 # transparency - }.border + }.border! # Outputs line as primitive using a hash args.outputs.primitives << { @@ -12653,7 +13200,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 50, b: 50, a: 255 # transparency - }.line + }.line! end #+end_src @@ -12705,9 +13252,108 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Rendering - Simple Camera - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/07_simple_camera/app/main.rb + def tick args + # variables you can play around with + args.state.world.w ||= 1280 + args.state.world.h ||= 720 + + args.state.player.x ||= 0 + args.state.player.y ||= 0 + args.state.player.size ||= 32 + + args.state.enemy.x ||= 700 + args.state.enemy.y ||= 700 + args.state.enemy.size ||= 16 + + args.state.camera.x ||= 640 + args.state.camera.y ||= 300 + args.state.camera.scale ||= 1.0 + args.state.camera.show_empty_space ||= :yes + + # instructions + args.outputs.primitives << { x: 0, y: 80.from_top, w: 360, h: 80, r: 0, g: 0, b: 0, a: 128 }.solid! + args.outputs.primitives << { x: 10, y: 10.from_top, text: "arrow keys to move around", r: 255, g: 255, b: 255}.label! + args.outputs.primitives << { x: 10, y: 30.from_top, text: "+/- to change zoom of camera", r: 255, g: 255, b: 255}.label! + args.outputs.primitives << { x: 10, y: 50.from_top, text: "tab to change camera edge behavior", r: 255, g: 255, b: 255}.label! + + # render scene + args.outputs[:scene].w = args.state.world.w + args.outputs[:scene].h = args.state.world.h + + args.outputs[:scene].solids << { x: 0, y: 0, w: args.state.world.w, h: args.state.world.h, r: 20, g: 60, b: 80 } + args.outputs[:scene].solids << { x: args.state.player.x, y: args.state.player.y, + w: args.state.player.size, h: args.state.player.size, r: 80, g: 155, b: 80 } + args.outputs[:scene].solids << { x: args.state.enemy.x, y: args.state.enemy.y, + w: args.state.enemy.size, h: args.state.enemy.size, r: 155, g: 80, b: 80 } + + # render camera + scene_position = calc_scene_position args + args.outputs.sprites << { x: scene_position.x, + y: scene_position.y, + w: scene_position.w, + h: scene_position.h, + path: :scene } + + # move player + if args.inputs.directional_angle + args.state.player.x += args.inputs.directional_angle.vector_x * 5 + args.state.player.y += args.inputs.directional_angle.vector_y * 5 + args.state.player.x = args.state.player.x.clamp(0, args.state.world.w - args.state.player.size) + args.state.player.y = args.state.player.y.clamp(0, args.state.world.h - args.state.player.size) + end + + # +/- to zoom in and out + if args.inputs.keyboard.plus && args.state.tick_count.zmod?(3) + args.state.camera.scale += 0.05 + elsif args.inputs.keyboard.hyphen && args.state.tick_count.zmod?(3) + args.state.camera.scale -= 0.05 + elsif args.inputs.keyboard.key_down.tab + if args.state.camera.show_empty_space == :yes + args.state.camera.show_empty_space = :no + else + args.state.camera.show_empty_space = :yes + end + end + + args.state.camera.scale = args.state.camera.scale.greater(0.1) + end + + def calc_scene_position args + result = { x: args.state.camera.x - (args.state.player.x * args.state.camera.scale), + y: args.state.camera.y - (args.state.player.y * args.state.camera.scale), + w: args.state.world.w * args.state.camera.scale, + h: args.state.world.h * args.state.camera.scale, + scale: args.state.camera.scale } + + return result if args.state.camera.show_empty_space == :yes + + if result.w < args.grid.w + result.merge!(x: (args.grid.w - result.w).half) + elsif (args.state.player.x * result.scale) < args.grid.w.half + result.merge!(x: 10) + elsif (result.x + result.w) < args.grid.w + result.merge!(x: - result.w + (args.grid.w - 10)) + end + + if result.h < args.grid.h + result.merge!(y: (args.grid.h - result.h).half) + elsif (result.y) > 10 + result.merge!(y: 10) + elsif (result.y + result.h) < args.grid.h + result.merge!(y: - result.h + (args.grid.h - 10)) + end + + result + end + +#+end_src + *** Advanced Rendering - Splitscreen Camera - main.rb #+begin_src ruby - # ./samples/07_advanced_rendering/07_splitscreen_camera/app/main.rb + # ./samples/07_advanced_rendering/08_splitscreen_camera/app/main.rb class CameraMovement attr_accessor :state, :inputs, :outputs, :grid @@ -12716,7 +13362,7 @@ Follows is a source code listing for all files that have been open sourced. This def serialize {state: state, inputs: inputs, outputs: outputs, grid: grid } end - + def inspect serialize.to_s end @@ -12786,12 +13432,12 @@ Follows is a source code listing for all files that have been open sourced. This default_player(0, 0, 64, 64, "sprites/player/player_#{state.player_cyan.orientation}_standing.png") end - + def new_player_magenta default_player(64, 0, 64, 64, "sprites/player/player_#{state.player_magenta.orientation}_standing.png") end - + def new_camera_magenta default_camera(0,0,720,720) end @@ -12803,7 +13449,8 @@ Follows is a source code listing for all files that have been open sourced. This def new_camera_center default_camera(0,0,1280,720) end - + + def new_room default_floor_tile(0,0,1024,1024,'sprites/rooms/camera_room.png') end @@ -12828,7 +13475,7 @@ Follows is a source code listing for all files that have been open sourced. This state.player_cyan.x += state.player_cyan.dx state.player_cyan.y += state.player_cyan.dy end - + def calc_player_magenta state.player_magenta.x += state.player_magenta.dx state.player_magenta.y += state.player_magenta.dy @@ -12843,7 +13490,7 @@ Follows is a source code listing for all files that have been open sourced. This state.camera_center.x += (targetX - state.camera_center.x) * 0.1 * timeScale state.camera_center.y += (targetY - state.camera_center.y) * 0.1 * timeScale end - + def calc_camera_magenta timeScale = 1 @@ -12880,7 +13527,7 @@ Follows is a source code listing for all files that have been open sourced. This def calc_trauma_decay state.trauma = state.trauma * 0.9 end - + def calc_random_float_range(min, max) rand * (max-min) + min end @@ -12908,7 +13555,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255} end - + def render_player_magenta outputs[:scene].sprites << {x: state.player_magenta.x, y: state.player_magenta.y, @@ -12954,16 +13601,16 @@ Follows is a source code listing for all files that have been open sourced. This render_camera_magenta_scene render_camera_cyan_scene - angle = Math.atan((state.player_magenta.y - state.player_cyan.y)/(state.player_magenta.x- state.player_cyan.x)) * 180/Math::PI + angle = Math.atan((state.player_magenta.y - state.player_cyan.y)/(state.player_magenta.x- state.player_cyan.x)) * 180/Math::PI output_split_camera angle - + end def render_camera_magenta_scene zoomFactor = 1 offsetX = 32 offsetY = 32 - + outputs[:scene_magenta].sprites << {x: (-state.camera_magenta.x*2), y: (-state.camera_magenta.y), w: outputs[:scene].width*2, @@ -12989,7 +13636,7 @@ Follows is a source code listing for all files that have been open sourced. This outputs.labels << [128,64,"#{quadrant}",8,2,255,0,255,255] if quadrant == 1 set_camera_attributes(w: 640, h: 720, m_x: 640, m_y: 0, c_x: 0, c_y: 0) - + elsif quadrant == 2 set_camera_attributes(w: 1280, h: 360, m_x: 0, m_y: 360, c_x: 0, c_y: 0) @@ -13007,7 +13654,7 @@ Follows is a source code listing for all files that have been open sourced. This state.camera_cyan.h = h + 64 outputs[:scene_cyan].width = (w) * 2 outputs[:scene_cyan].height = h - + state.camera_magenta.w = w + 64 state.camera_magenta.h = h + 64 outputs[:scene_magenta].width = (w) * 2 @@ -13019,7 +13666,7 @@ Follows is a source code listing for all files that have been open sourced. This path: :scene_magenta} outputs.sprites << {x: c_x, y: c_y, - w: w, + w: w, h: h, path: :scene_cyan} end @@ -13027,7 +13674,7 @@ Follows is a source code listing for all files that have been open sourced. This def add_trauma amount state.trauma = [state.trauma + amount, 1.0].min end - + def remove_trauma amount state.trauma = [state.trauma - amount, 0.0].max end @@ -13067,7 +13714,7 @@ Follows is a source code listing for all files that have been open sourced. This outputs.labels << [128,512,"#{state.player_cyan.x.round()}",8,2,0,255,255,255] outputs.labels << [128,480,"#{state.player_cyan.y.round()}",8,2,0,255,255,255] end - + def input_move_magenta if inputs.keyboard.key_held.w state.player_magenta.dy = 5 @@ -13101,14 +13748,14 @@ Follows is a source code listing for all files that have been open sourced. This $camera_movement.outputs = args.outputs $camera_movement.state = args.state $camera_movement.grid = args.grid - $camera_movement.tick + $camera_movement.tick end #+end_src *** Advanced Rendering - Z Targeting Camera - main.rb #+begin_src ruby - # ./samples/07_advanced_rendering/08_z_targeting_camera/app/main.rb + # ./samples/07_advanced_rendering/09_z_targeting_camera/app/main.rb class Game attr_gtk @@ -13218,6 +13865,114 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Rendering - Blend Modes - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/10_blend_modes/app/main.rb + $gtk.reset + + def draw_blendmode args, mode + w = 160 + h = w + args.state.x += (1280-w) / (args.state.blendmodes.length + 1) + x = args.state.x + y = (720 - h) / 2 + s = 'sprites/blue-feathered.png' + args.outputs.sprites << { blendmode_enum: mode.value, x: x, y: y, w: w, h: h, path: s } + args.outputs.labels << [x + (w/2), y, mode.name.to_s, 1, 1, 255, 255, 255] + end + + def tick args + + # Different blend modes do different things, depending on what they + # blend against (in this case, the pixels of the background color). + args.state.bg_element ||= 1 + args.state.bg_color ||= 255 + args.state.bg_color_direction ||= 1 + bg_r = (args.state.bg_element == 1) ? args.state.bg_color : 0 + bg_g = (args.state.bg_element == 2) ? args.state.bg_color : 0 + bg_b = (args.state.bg_element == 3) ? args.state.bg_color : 0 + args.state.bg_color += args.state.bg_color_direction + if (args.state.bg_color_direction > 0) && (args.state.bg_color >= 255) + args.state.bg_color_direction = -1 + args.state.bg_color = 255 + elsif (args.state.bg_color_direction < 0) && (args.state.bg_color <= 0) + args.state.bg_color_direction = 1 + args.state.bg_color = 0 + args.state.bg_element += 1 + if args.state.bg_element >= 4 + args.state.bg_element = 1 + end + end + + args.outputs.background_color = [ bg_r, bg_g, bg_b, 255 ] + + args.state.blendmodes ||= [ + { name: :none, value: 0 }, + { name: :blend, value: 1 }, + { name: :add, value: 2 }, + { name: :mod, value: 3 }, + { name: :mul, value: 4 } + ] + + args.state.x = 0 # reset this, draw_blendmode will increment it. + args.state.blendmodes.each { |blendmode| draw_blendmode args, blendmode } + end + +#+end_src + +*** Advanced Rendering - Render Target Noclear - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/11_render_target_noclear/app/main.rb + def tick args + args.state.x ||= 500 + args.state.y ||= 350 + args.state.xinc ||= 7 + args.state.yinc ||= 7 + args.state.bgcolor ||= 1 + args.state.bginc ||= 1 + + # clear the render target on the first tick, and then never again. Draw + # another box to it every tick, accumulating over time. + clear_target = (args.state.tick_count == 0) || (args.inputs.keyboard.key_down.space) + args.render_target(:accumulation).background_color = [ 0, 0, 0, 0 ]; + args.render_target(:accumulation).clear_before_render = clear_target + args.render_target(:accumulation).solids << [args.state.x, args.state.y, 25, 25, 255, 0, 0, 255]; + args.state.x += args.state.xinc + args.state.y += args.state.yinc + args.state.bgcolor += args.state.bginc + + # animation upkeep...change where we draw the next box and what color the + # window background will be. + if args.state.xinc > 0 && args.state.x >= 1280 + args.state.xinc = -7 + elsif args.state.xinc < 0 && args.state.x < 0 + args.state.xinc = 7 + end + + if args.state.yinc > 0 && args.state.y >= 720 + args.state.yinc = -7 + elsif args.state.yinc < 0 && args.state.y < 0 + args.state.yinc = 7 + end + + if args.state.bginc > 0 && args.state.bgcolor >= 255 + args.state.bginc = -1 + elsif args.state.bginc < 0 && args.state.bgcolor <= 0 + args.state.bginc = 1 + end + + # clear the screen to a shade of blue and draw the render target, which + # is not clearing every frame, on top of it. Note that you can NOT opt to + # skip clearing the screen, only render targets. The screen clears every + # frame; double-buffering would prevent correct updates between frames. + args.outputs.background_color = [ 0, 0, args.state.bgcolor, 255 ] + args.outputs.sprites << [ 0, 0, 1280, 720, :accumulation ] + end + + $gtk.reset + +#+end_src + *** Tweening Lerping Easing Functions - Easing Functions - main.rb #+begin_src ruby # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb @@ -13710,7 +14465,11 @@ Follows is a source code listing for all files that have been open sourced. This # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Hashes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13780,7 +14539,99 @@ Follows is a source code listing for all files that have been open sourced. This # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Open Entities" + puts "* INFO: Please specify the number of sprites to render." + args.gtk.console.set_command "reset_with count: 100" + end + + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| new_star args } + end + + # update + args.state.stars.each { |s| move_star args, s } + + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end + + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +*** Performance - Sprites As Struct - main.rb +#+begin_src ruby + # ./samples/09_performance/03_sprites_as_struct/app/main.rb + # create a Struct variant that allows for named parameters on construction. + class NamedStruct < Struct + def initialize **opts + super(*members.map { |k| opts[k] }) + end + end + + # create a Star NamedStruct + Star = NamedStruct.new(:x, :y, :w, :h, :path, :s, + :angle, :angle_anchor_x, :angle_anchor_y, + :r, :g, :b, :a, + :tile_x, :tile_y, + :tile_w, :tile_h, + :source_x, :source_y, + :source_w, :source_h, + :flip_horizontally, :flip_vertically, + :blendmode_enum) + + # Sprites represented as Structs. They require a little bit more code than Hashes, + # but are the a little faster to render too. + def random_x args + (args.grid.w.randomize :ratio) * -1 + end + + def random_y args + (args.grid.h.randomize :ratio) * -1 + end + + def random_speed + 1 + (4.randomize :ratio) + end + + def new_star args + Star.new x: (random_x args), + y: (random_y args), + w: 4, h: 4, + path: 'sprites/tiny-star.png', + s: random_speed + end + + def move_star args, star + star.x += star[:s] + star.y += star[:s] + if star.x > args.grid.w || star.y > args.grid.h + star.x = (random_x args) + star.y = (random_y args) + star[:s] = random_speed + end + end + + def tick args + args.state.star_count ||= 0 + + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Structs" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13808,7 +14659,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Performance - Sprites As Strict Entities - main.rb #+begin_src ruby - # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb + # ./samples/09_performance/04_sprites_as_strict_entities/app/main.rb # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ # yields apis access similar to Entities, but all properties that can be set on the # entity must be predefined with a default value. Strict entities do not support the @@ -13854,7 +14705,11 @@ Follows is a source code listing for all files that have been open sourced. This # sets console command when sample app initially opens if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Strict Entities" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13882,7 +14737,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Performance - Sprites As Classes - main.rb #+begin_src ruby - # ./samples/09_performance/04_sprites_as_classes/app/main.rb + # ./samples/09_performance/05_sprites_as_classes/app/main.rb # Sprites represented as Classes using the queue ~args.outputs.sprites~. # gives you full control of property declaration and method invocation. # They are more performant than OpenEntities and StrictEntities, but more code upfront. @@ -13911,6 +14766,11 @@ Follows is a source code listing for all files that have been open sourced. This def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Sprites, Classes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -13938,7 +14798,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Performance - Static Sprites As Classes - main.rb #+begin_src ruby - # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb + # ./samples/09_performance/06_static_sprites_as_classes/app/main.rb # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held # by reference. You get better performance, but you are mutating state of held objects @@ -13968,19 +14828,24 @@ Follows is a source code listing for all files that have been open sourced. This def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Static Sprites, Classes" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end # init if args.state.tick_count == 0 args.state.stars = args.state.star_count.map { |i| Star.new args.grid } + args.outputs.static_sprites << args.state.stars end # update args.state.stars.each(&:move) # render - args.outputs.sprites << args.state.stars args.outputs.background_color = [0, 0, 0] args.outputs.primitives << args.gtk.current_framerate_primitives end @@ -13995,7 +14860,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Performance - Static Sprites As Classes With Custom Drawing - main.rb #+begin_src ruby - # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb + # ./samples/09_performance/07_static_sprites_as_classes_with_custom_drawing/app/main.rb # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. # is the fastest approach. This is comparable to what other game engines set as the default behavior. # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing @@ -14038,10 +14903,21 @@ Follows is a source code listing for all files that have been open sourced. This # path, # angle, # alpha, red_saturation, green_saturation, blue_saturation + # tile_x, tile_y, tile_w, tile_h, # flip_horizontally, flip_vertically, - # tile_x, tile_y, tile_w, tile_h # angle_anchor_x, angle_anchor_y, # source_x, source_y, source_w, source_h + + # The argument order for ffi_draw.draw_sprite_4 is: + # x, y, w, h, + # path, + # angle, + # alpha, red_saturation, green_saturation, blue_saturation + # tile_x, tile_y, tile_w, tile_h, + # flip_horizontally, flip_vertically, + # angle_anchor_x, angle_anchor_y, + # source_x, source_y, source_w, source_h, + # blendmode_enum end end @@ -14049,6 +14925,11 @@ Follows is a source code listing for all files that have been open sourced. This def tick args # sets console command when sample app initially opens if Kernel.global_tick_count == 0 + puts "" + puts "" + puts "=========================================================" + puts "* INFO: Static Sprites, Classes, Draw Override" + puts "* INFO: Please specify the number of sprites to render." args.gtk.console.set_command "reset_with count: 100" end @@ -14073,7 +14954,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Performance - Collision Limits - main.rb #+begin_src ruby - # ./samples/09_performance/07_collision_limits/app/main.rb + # ./samples/09_performance/08_collision_limits/app/main.rb =begin Reminders: @@ -14132,6 +15013,31 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Debugging - Logging - main.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/00_logging/app/main.rb + def tick args + args.outputs.background_color = [255, 255, 255, 0] + if args.state.tick_count == 0 + args.gtk.log_spam "log level spam" + args.gtk.log_debug "log level debug" + args.gtk.log_info "log level info" + args.gtk.log_warn "log level warn" + args.gtk.log_error "log level error" + args.gtk.log_unfiltered "log level unfiltered" + puts "This is a puts call" + args.gtk.console.show + end + + if args.state.tick_count == 60 + puts "This is a puts call on tick 60" + elsif args.state.tick_count == 120 + puts "This is a puts call on tick 120" + end + end + +#+end_src + *** Advanced Debugging - Trace Debugging - main.rb #+begin_src ruby # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb @@ -14219,6 +15125,55 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Debugging - Unit Tests - benchmark_api_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/benchmark_api_tests.rb + def test_benchmark_api args, assert + result = args.gtk.benchmark iterations: 100, + only_one: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + } + + assert.equal! result.first_place.name, :only_one + + result = args.gtk.benchmark iterations: 100, + iterations_100: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + }, + iterations_50: -> () { + r = 0 + (1..50).each do |i| + r += 1 + end + } + + assert.equal! result.first_place.name, :iterations_50 + + result = args.gtk.benchmark iterations: 1, + iterations_100: -> () { + r = 0 + (1..100).each do |i| + r += 1 + end + }, + iterations_50: -> () { + r = 0 + (1..50).each do |i| + r += 1 + end + } + + assert.equal! result.too_small_to_measure, true + end + +#+end_src + *** Advanced Debugging - Unit Tests - exception_raising_tests.rb #+begin_src ruby # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb @@ -14739,6 +15694,142 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Advanced Debugging - Unit Tests - pretty_format_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/pretty_format_tests.rb + def H opts + opts + end + + def A *opts + opts + end + + def assert_format args, assert, hash, expected + actual = args.fn.pretty_format hash + assert.are_equal! actual, expected + end + + def test_pretty_print args, assert + # ============================= + # hash with single value + # ============================= + input = (H first_name: "John") + expected = <<-S + {:first_name "John"} + S + (assert_format args, assert, input, expected) + + # ============================= + # hash with two values + # ============================= + input = (H first_name: "John", last_name: "Smith") + expected = <<-S + {:first_name "John" + :last_name "Smith"} + S + + (assert_format args, assert, input, expected) + + # ============================= + # hash with inner hash + # ============================= + input = (H first_name: "John", + last_name: "Smith", + middle_initial: "I", + so: (H first_name: "Pocahontas", + last_name: "Tsenacommacah"), + friends: (A (H first_name: "Side", last_name: "Kick"), + (H first_name: "Tim", last_name: "Wizard"))) + expected = <<-S + {:first_name "John" + :last_name "Smith" + :middle_initial "I" + :so {:first_name "Pocahontas" + :last_name "Tsenacommacah"} + :friends [{:first_name "Side" + :last_name "Kick"} + {:first_name "Tim" + :last_name "Wizard"}]} + S + + (assert_format args, assert, input, expected) + + # ============================= + # array with one value + # ============================= + input = (A 1) + expected = <<-S + [1] + S + (assert_format args, assert, input, expected) + + # ============================= + # array with multiple values + # ============================= + input = (A 1, 2, 3) + expected = <<-S + [1 + 2 + 3] + S + (assert_format args, assert, input, expected) + + # ============================= + # array with multiple values hashes + # ============================= + input = (A (H first_name: "Side", last_name: "Kick"), + (H first_name: "Tim", last_name: "Wizard")) + expected = <<-S + [{:first_name "Side" + :last_name "Kick"} + {:first_name "Tim" + :last_name "Wizard"}] + S + + (assert_format args, assert, input, expected) + end + + def test_nested_nested args, assert + # ============================= + # nested array in nested hash + # ============================= + input = (H type: :root, + text: "Root", + children: (A (H level: 1, + text: "Level 1", + children: (A (H level: 2, + text: "Level 2", + children: []))))) + + expected = <<-S + {:type :root + :text "Root" + :children [{:level 1 + :text "Level 1" + :children [{:level 2 + :text "Level 2" + :children []}]}]} + + S + + (assert_format args, assert, input, expected) + end + + def test_scene args, assert + script = <<-S + * Scene 1 + ** Narrator + They say happy endings don't exist. + ** Narrator + They say true love is a lie. + S + input = parse_org args, script + puts (args.fn.pretty_format input) + end + +#+end_src + *** Advanced Debugging - Unit Tests - require_tests.rb #+begin_src ruby # ./samples/10_advanced_debugging/03_unit_tests/require_tests.rb @@ -14790,12 +15881,12 @@ Follows is a source code listing for all files that have been open sourced. This GTK::Entity.__reset_id__! args.state.player_one = "test" result = args.gtk.serialize_state args.state - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" GTK::Entity.__reset_id__! args.gtk.write_file 'state.txt', '' result = args.gtk.serialize_state 'state.txt', args.state - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" end def test_deserialize args, assert @@ -14844,7 +15935,7 @@ Follows is a source code listing for all files that have been open sourced. This args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) serialized_state = args.gtk.serialize_state args.state - assert.equal! serialized_state, '{:entity_id=>9, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' + assert.equal! serialized_state, '{:entity_id=>7, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' GTK::Entity.__reset_id__! deserialized_state = args.gtk.deserialize_state serialized_state @@ -14901,6 +15992,18 @@ Follows is a source code listing for all files that have been open sourced. This deserialized_state = args.gtk.deserialize_state serialized_state assert.equal! deserialized_state.strict_entity.one, deserialized_state.strict_entity.two end + + def test_serialization_excludes_thrash_count args, assert + GTK::Entity.__reset_id__! + args.state.player.name = "Ryu" + # force a nil pun + if args.state.player.age > 30 + end + assert.equal! args.state.player.as_hash[:__thrash_count__][:>], 1 + result = args.gtk.serialize_state args.state + assert.false! (result.include? "__thrash_count__"), + "The __thrash_count__ key exists in state when it shouldn't have." + end #+end_src @@ -15063,11 +16166,13 @@ Follows is a source code listing for all files that have been open sourced. This *** Http - Retrieve Images - main.rb #+begin_src ruby # ./samples/11_http/01_retrieve_images/app/main.rb + $gtk.register_cvar 'app.warn_seconds', "seconds to wait before starting", :uint, 11 + def tick args args.outputs.background_color = [0, 0, 0] # Show a warning at the start. - args.state.warning_debounce ||= 11 * 60 + args.state.warning_debounce ||= args.cvars['app.warn_seconds'].value * 60 if args.state.warning_debounce > 0 args.state.warning_debounce -= 1 args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] @@ -15119,11 +16224,12 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -*** Http - Web Server - main.rb +*** Http - In Game Web Server Http Get - main.rb #+begin_src ruby - # ./samples/11_http/02_web_server/app/main.rb + # ./samples/11_http/02_in_game_web_server_http_get/app/main.rb def tick args args.state.port ||= 3000 + args.state.reqnum ||= 0 # by default the embedded webserver runs on port 9001 (the port number is over 9000) and is disabled in a production build # to enable the http server in a production build, you need to manually start # the server up: @@ -15152,6 +16258,84 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Http - In Game Web Server Http Post - main.rb +#+begin_src ruby + # ./samples/11_http/03_in_game_web_server_http_post/app/main.rb + def tick args + # defaults + args.state.post_button = args.layout.rect(row: 0, col: 0, w: 5, h: 1).merge(text: "execute http_post") + args.state.post_body_button = args.layout.rect(row: 1, col: 0, w: 5, h: 1).merge(text: "execute http_post_body") + args.state.request_to_s ||= "" + args.state.request_body ||= "" + + # render + args.state.post_button.yield_self do |b| + args.outputs.borders << b + args.outputs.labels << b.merge(text: b.text, + y: b.y + 30, + x: b.x + 10) + end + + args.state.post_body_button.yield_self do |b| + args.outputs.borders << b + args.outputs.labels << b.merge(text: b.text, + y: b.y + 30, + x: b.x + 10) + end + + draw_label args, 0, 6, "Request:", args.state.request_to_s + draw_label args, 0, 14, "Request Body Unaltered:", args.state.request_body + + # input + if args.inputs.mouse.click + # ============= HTTP_POST ============= + if (args.inputs.mouse.inside_rect? args.state.post_button) + # ========= DATA TO SEND =========== + form_fields = { "userId" => "#{Time.now.to_i}" } + # ================================== + + args.gtk.http_post "http://localhost:9001/testing", + form_fields, + ["Content-Type: application/x-www-form-urlencoded"] + + args.gtk.notify! "http_post" + end + + # ============= HTTP_POST_BODY ============= + if (args.inputs.mouse.inside_rect? args.state.post_body_button) + # =========== DATA TO SEND ============== + json = "{ \"userId\": \"#{Time.now.to_i}\"}" + # ================================== + + args.gtk.http_post_body "http://localhost:9001/testing", + json, + ["Content-Type: application/json", "Content-Length: #{json.length}"] + + args.gtk.notify! "http_post_body" + end + end + + # calc + args.inputs.http_requests.each do |r| + puts "#{r}" + if r.uri == "/testing" + puts r + args.state.request_to_s = "#{r}" + args.state.request_body = r.raw_body + r.respond 200, "ok" + end + end + end + + def draw_label args, row, col, header, text + label_pos = args.layout.rect(row: row, col: col, w: 0, h: 0) + args.outputs.labels << "#{header}\n\n#{text}".wrapped_lines(80).map_with_index do |l, i| + { x: label_pos.x, y: label_pos.y - (i * 15), text: l, size_enum: -2 } + end + end + +#+end_src + *** C Extensions - Basics - main.rb #+begin_src ruby # ./samples/12_c_extensions/01_basics/app/main.rb @@ -16588,8 +17772,8 @@ Follows is a source code listing for all files that have been open sourced. This calc # Calc Path end - render - input + render + input end def defaults @@ -16666,7 +17850,7 @@ Follows is a source code listing for all files that have been open sourced. This [24, 9] => true, [25, 8] => true, [25, 9] => true, - } + } # Variables that are used by the breadth first search # Storing cells that the search has visited, prevents unnecessary steps @@ -16685,36 +17869,36 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.current_input ||= :none + state.current_input ||= :none end def calc # Setup the search to start from the star - search.frontier << grid.star + search.frontier << grid.star search.came_from[grid.star] = nil # Until there are no more cells to expand from - until search.frontier.empty? + until search.frontier.empty? # Takes the next frontier cell - new_frontier = search.frontier.shift + new_frontier = search.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless search.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) + unless search.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited in the first grid # Unless the target has been visited # Add the neighbor to the frontier and remember which cell it came from - search.frontier << neighbor + search.frontier << neighbor search.came_from[neighbor] = new_frontier end end end end - + # Draws everything onto the screen def render - render_background + render_background # render_heat_map render_walls # render_path @@ -16733,7 +17917,7 @@ Follows is a source code listing for all files that have been open sourced. This if current_cell && parent_cell outputs.lines << [(current_cell.x + 0.5) * grid.cell_size, (current_cell.y + 0.5) * grid.cell_size, (parent_cell.x + 0.5) * grid.cell_size, (parent_cell.y + 0.5) * grid.cell_size, purple] - + end render_trail(parent_cell) end @@ -16759,8 +17943,8 @@ Follows is a source code listing for all files that have been open sourced. This # Draws what the grid looks like with nothing on it def render_background - render_unvisited - render_grid_lines + render_unvisited + render_grid_lines end # Draws both grids @@ -16775,7 +17959,7 @@ Follows is a source code listing for all files that have been open sourced. This end for y in 0..grid.height - outputs.lines << horizontal_line(y) + outputs.lines << horizontal_line(y) end end @@ -16791,7 +17975,7 @@ Follows is a source code listing for all files that have been open sourced. This # Draws the walls on both grids def render_walls - grid.walls.each_key do |wall| + grid.walls.each_key do |wall| outputs.solids << [scale_up(wall), wall_color] end end @@ -16799,12 +17983,12 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the star on both grids def render_star outputs.sprites << [scale_up(grid.star), 'star.png'] - end + end # Renders the target on both grids def render_target outputs.sprites << [scale_up(grid.target), 'target.png'] - end + end # Labels the grids def render_labels @@ -16864,14 +18048,14 @@ Follows is a source code listing for all files that have been open sourced. This # The program has to remember that the user is dragging an object # even when the mouse is no longer over that object # So detecting input and processing input is separate - # detect_input - # process_input + # detect_input + # process_input if inputs.mouse.up state.current_input = :none elsif star_clicked? state.current_input = :star end - + if mouse_inside_grid? unless grid.target == cell_closest_to_mouse grid.target = cell_closest_to_mouse @@ -16889,33 +18073,33 @@ Follows is a source code listing for all files that have been open sourced. This # mouse left click is held def detect_input # When the mouse is up, nothing is being edited - if inputs.mouse.up - state.current_input = :none + if inputs.mouse.up + state.current_input = :none # When the star in the no second grid is clicked - elsif star_clicked? - state.current_input = :star + elsif star_clicked? + state.current_input = :star # When the target in the no second grid is clicked - elsif target_clicked? - state.current_input = :target + elsif target_clicked? + state.current_input = :target # When a wall in the first grid is clicked - elsif wall_clicked? - state.current_input = :remove_wall + elsif wall_clicked? + state.current_input = :remove_wall # When the first grid is clicked - elsif grid_clicked? + elsif grid_clicked? state.current_input = :add_wall end end # Processes click and drag based on what the user is currently dragging def process_input - if state.current_input == :star - input_star - elsif state.current_input == :target - input_target - elsif state.current_input == :remove_wall - input_remove_wall - elsif state.current_input == :add_wall - input_add_wall + if state.current_input == :star + input_star + elsif state.current_input == :target + input_target + elsif state.current_input == :remove_wall + input_remove_wall + elsif state.current_input == :add_wall + input_add_wall end end @@ -16923,10 +18107,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def input_star - old_star = grid.star.clone + old_star = grid.star.clone grid.star = cell_closest_to_mouse - unless old_star == grid.star - reset_search + unless old_star == grid.star + reset_search end end @@ -16934,10 +18118,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchs the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def input_target - old_target = grid.target.clone + old_target = grid.target.clone grid.target = cell_closest_to_mouse - unless old_target == grid.target - reset_search + unless old_target == grid.target + reset_search end end @@ -16946,32 +18130,32 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if mouse_inside_grid? + if mouse_inside_grid? if grid.walls.has_key?(cell_closest_to_mouse) - grid.walls.delete(cell_closest_to_mouse) - reset_search + grid.walls.delete(cell_closest_to_mouse) + reset_search end end end # Adds a wall in the first grid in the cell the mouse is over def input_add_wall - if mouse_inside_grid? + if mouse_inside_grid? unless grid.walls.has_key?(cell_closest_to_mouse) - grid.walls[cell_closest_to_mouse] = true - reset_search + grid.walls[cell_closest_to_mouse] = true + reset_search end end end - + # Whenever the user edits the grid, # The search has to be reset_searchd upto the current step # with the current grid as the initial state of the grid def reset_search # Reset_Searchs the search - search.frontier = [] - search.came_from = {} + search.frontier = [] + search.came_from = {} search.path = {} end @@ -16979,21 +18163,21 @@ Follows is a source code listing for all files that have been open sourced. This # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x, cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y] unless cell.x == 0 - neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 + neighbors << [cell.x, cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y] unless cell.x == 0 + neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 # Sorts the neighbors so the rendered path is a zigzag path # Cells in a diagonal direction are given priority # Comment this line to see the difference neighbors = neighbors.sort_by { |neighbor_x, neighbor_y| proximity_to_star(neighbor_x, neighbor_y) } - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -17018,13 +18202,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # Signal that the user is going to be moving the star from the first grid @@ -17052,13 +18236,13 @@ Follows is a source code listing for all files that have been open sourced. This # Light brown def unvisited_color - [221, 212, 213] + [221, 212, 213] # [255, 255, 255] end # Camo Green def wall_color - [134, 134, 120] + [134, 134, 120] end # Pastel White @@ -17096,7 +18280,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Breadth First Search tick is called - $breadcrumbs ||= Breadcrumbs.new(args) + $breadcrumbs ||= Breadcrumbs.new $breadcrumbs.args = args $breadcrumbs.tick end @@ -17153,8 +18337,8 @@ Follows is a source code listing for all files that have been open sourced. This # And calculate the path calc_path end - render - input + render + input end def defaults @@ -17170,14 +18354,14 @@ Follows is a source code listing for all files that have been open sourced. This # This step is roughly the grid's width * height # When anim_steps equals max_steps no more calculations will occur # and the slider will be at the end - state.max_steps ||= args.state.grid.width * args.state.grid.height + state.max_steps ||= args.state.grid.width * args.state.grid.height # The location of the star and walls of the grid # They can be modified to have a different initial grid # Walls are stored in a hash for quick look up when doing the search state.star ||= [2, 8] state.target ||= [10, 5] - state.walls ||= {} + state.walls ||= {} # Variables that are used by the breadth first search # Storing cells that the search has visited, prevents unnecessary steps @@ -17200,12 +18384,12 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.current_input ||= :none + state.current_input ||= :none end # Draws everything onto the screen def render - render_background + render_background render_heat_map render_walls render_path @@ -17218,8 +18402,8 @@ Follows is a source code listing for all files that have been open sourced. This # Draws what the grid looks like with nothing on it def render_background - render_unvisited - render_grid_lines + render_unvisited + render_grid_lines end # Draws both grids @@ -17236,7 +18420,7 @@ Follows is a source code listing for all files that have been open sourced. This end for y in 0..grid.height - outputs.lines << horizontal_line(y) + outputs.lines << horizontal_line(y) outputs.lines << early_exit_horizontal_line(y) end end @@ -17263,7 +18447,7 @@ Follows is a source code listing for all files that have been open sourced. This # Draws the walls on both grids def render_walls - state.walls.each_key do |wall| + state.walls.each_key do |wall| outputs.solids << [scale_up(wall), wall_color] outputs.solids << [early_exit_scale_up(wall), wall_color] end @@ -17273,13 +18457,13 @@ Follows is a source code listing for all files that have been open sourced. This def render_star outputs.sprites << [scale_up(state.star), 'star.png'] outputs.sprites << [early_exit_scale_up(state.star), 'star.png'] - end + end # Renders the target on both grids def render_target outputs.sprites << [scale_up(state.target), 'target.png'] outputs.sprites << [early_exit_scale_up(state.target), 'target.png'] - end + end # Labels the grids def render_labels @@ -17371,8 +18555,8 @@ Follows is a source code listing for all files that have been open sourced. This # The program has to remember that the user is dragging an object # even when the mouse is no longer over that object # So detecting input and processing input is separate - detect_input - process_input + detect_input + process_input end # Determines what the user is editing and stores the value @@ -17380,53 +18564,53 @@ Follows is a source code listing for all files that have been open sourced. This # mouse left click is held def detect_input # When the mouse is up, nothing is being edited - if inputs.mouse.up - state.current_input = :none + if inputs.mouse.up + state.current_input = :none # When the star in the no second grid is clicked - elsif star_clicked? - state.current_input = :star + elsif star_clicked? + state.current_input = :star # When the star in the second grid is clicked - elsif star2_clicked? - state.current_input = :star2 + elsif star2_clicked? + state.current_input = :star2 # When the target in the no second grid is clicked - elsif target_clicked? - state.current_input = :target + elsif target_clicked? + state.current_input = :target # When the target in the second grid is clicked - elsif target2_clicked? - state.current_input = :target2 + elsif target2_clicked? + state.current_input = :target2 # When a wall in the first grid is clicked - elsif wall_clicked? - state.current_input = :remove_wall + elsif wall_clicked? + state.current_input = :remove_wall # When a wall in the second grid is clicked - elsif wall2_clicked? + elsif wall2_clicked? state.current_input = :remove_wall2 # When the first grid is clicked - elsif grid_clicked? + elsif grid_clicked? state.current_input = :add_wall # When the second grid is clicked - elsif grid2_clicked? + elsif grid2_clicked? state.current_input = :add_wall2 end end # Processes click and drag based on what the user is currently dragging def process_input - if state.current_input == :star - input_star + if state.current_input == :star + input_star elsif state.current_input == :star2 - input_star2 - elsif state.current_input == :target - input_target - elsif state.current_input == :target2 - input_target2 - elsif state.current_input == :remove_wall - input_remove_wall + input_star2 + elsif state.current_input == :target + input_target + elsif state.current_input == :target2 + input_target2 + elsif state.current_input == :remove_wall + input_remove_wall elsif state.current_input == :remove_wall2 - input_remove_wall2 - elsif state.current_input == :add_wall - input_add_wall - elsif state.current_input == :add_wall2 - input_add_wall2 + input_remove_wall2 + elsif state.current_input == :add_wall + input_add_wall + elsif state.current_input == :add_wall2 + input_add_wall2 end end @@ -17434,10 +18618,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def input_star - old_star = state.star.clone + old_star = state.star.clone state.star = cell_closest_to_mouse - unless old_star == state.star - reset_search + unless old_star == state.star + reset_search end end @@ -17445,10 +18629,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def input_star2 - old_star = state.star.clone + old_star = state.star.clone state.star = cell_closest_to_mouse2 - unless old_star == state.star - reset_search + unless old_star == state.star + reset_search end end @@ -17456,10 +18640,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchs the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def input_target - old_target = state.target.clone + old_target = state.target.clone state.target = cell_closest_to_mouse - unless old_target == state.target - reset_search + unless old_target == state.target + reset_search end end @@ -17467,10 +18651,10 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchs the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def input_target2 - old_target = state.target.clone + old_target = state.target.clone state.target = cell_closest_to_mouse2 - unless old_target == state.target - reset_search + unless old_target == state.target + reset_search end end @@ -17479,10 +18663,10 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if mouse_inside_grid? + if mouse_inside_grid? if state.walls.has_key?(cell_closest_to_mouse) - state.walls.delete(cell_closest_to_mouse) - reset_search + state.walls.delete(cell_closest_to_mouse) + reset_search end end end @@ -17492,31 +18676,31 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if mouse_inside_grid2? + if mouse_inside_grid2? if state.walls.has_key?(cell_closest_to_mouse2) - state.walls.delete(cell_closest_to_mouse2) - reset_search + state.walls.delete(cell_closest_to_mouse2) + reset_search end end end # Adds a wall in the first grid in the cell the mouse is over def input_add_wall - if mouse_inside_grid? + if mouse_inside_grid? unless state.walls.has_key?(cell_closest_to_mouse) - state.walls[cell_closest_to_mouse] = true - reset_search + state.walls[cell_closest_to_mouse] = true + reset_search end end end - + # Adds a wall in the second grid in the cell the mouse is over def input_add_wall2 - if mouse_inside_grid2? + if mouse_inside_grid2? unless state.walls.has_key?(cell_closest_to_mouse2) - state.walls[cell_closest_to_mouse2] = true - reset_search + state.walls[cell_closest_to_mouse2] = true + reset_search end end end @@ -17526,10 +18710,10 @@ Follows is a source code listing for all files that have been open sourced. This # with the current grid as the initial state of the grid def reset_search # Reset_Searchs the search - state.frontier = [] - state.visited = {} - state.early_exit_visited = {} - state.came_from = {} + state.frontier = [] + state.visited = {} + state.early_exit_visited = {} + state.came_from = {} state.path = {} end @@ -17537,23 +18721,23 @@ Follows is a source code listing for all files that have been open sourced. This def step # The setup to the search # Runs once when there are no visited cells - if state.visited.empty? - state.visited[state.star] = true - state.early_exit_visited[state.star] = true - state.frontier << state.star + if state.visited.empty? + state.visited[state.star] = true + state.early_exit_visited[state.star] = true + state.frontier << state.star state.came_from[state.star] = nil end # A step in the search - unless state.frontier.empty? + unless state.frontier.empty? # Takes the next frontier cell - new_frontier = state.frontier.shift + new_frontier = state.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless state.visited.has_key?(neighbor) || state.walls.has_key?(neighbor) + unless state.visited.has_key?(neighbor) || state.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited in the first grid - state.visited[neighbor] = true + state.visited[neighbor] = true # Unless the target has been visited unless state.visited.has_key?(state.target) # Mark the neighbor as visited in the second grid as well @@ -17561,32 +18745,32 @@ Follows is a source code listing for all files that have been open sourced. This end # Add the neighbor to the frontier and remember which cell it came from - state.frontier << neighbor + state.frontier << neighbor state.came_from[neighbor] = new_frontier end end end end - + # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x, cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y] unless cell.x == 0 - neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 + neighbors << [cell.x, cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y] unless cell.x == 0 + neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 # Sorts the neighbors so the rendered path is a zigzag path # Cells in a diagonal direction are given priority # Comment this line to see the difference neighbors = neighbors.sort_by { |neighbor_x, neighbor_y| proximity_to_star(neighbor_x, neighbor_y) } - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -17611,13 +18795,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -17625,15 +18809,15 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the second grid helps with this def cell_closest_to_mouse2 # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= grid.width + 1 # Bound x and y to the first grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # Signal that the user is going to be moving the star from the first grid @@ -17712,12 +18896,12 @@ Follows is a source code listing for all files that have been open sourced. This # Light brown def unvisited_color - [221, 212, 213] + [221, 212, 213] end # Camo Green def wall_color - [134, 134, 120] + [134, 134, 120] end # Pastel White @@ -17747,7 +18931,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Breadth First Search tick is called - $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new(args) + $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new $early_exit_breadth_first_search.args = args $early_exit_breadth_first_search.tick end @@ -17783,8 +18967,8 @@ Follows is a source code listing for all files that have been open sourced. This # The next step in the search is calculated def tick defaults - render - input + render + input calc end @@ -17801,7 +18985,7 @@ Follows is a source code listing for all files that have been open sourced. This # Walls are stored in a hash for quick look up when doing the search state.star ||= [1, 5] state.target ||= [8, 4] - state.walls ||= {[1, 1] => true, [2, 1] => true, [3, 1] => true, [1, 2] => true, [2, 2] => true, [3, 2] => true} + state.walls ||= {[1, 1] => true, [2, 1] => true, [3, 1] => true, [1, 2] => true, [2, 2] => true, [3, 2] => true} state.hills ||= { [4, 1] => true, [5, 1] => true, @@ -17836,7 +19020,7 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.user_input ||= :none + state.user_input ||= :none # Values that are used for the breadth first search # Keeping track of what cells were visited prevents counting cells multiple times @@ -17860,7 +19044,7 @@ Follows is a source code listing for all files that have been open sourced. This # Draws everything onto the screen def render - render_background + render_background render_heat_maps @@ -17875,8 +19059,8 @@ Follows is a source code listing for all files that have been open sourced. This # Draws what the grid looks like with nothing on it def render_background - render_unvisited - render_grid_lines + render_unvisited + render_grid_lines render_labels end @@ -17895,7 +19079,7 @@ Follows is a source code listing for all files that have been open sourced. This end for y in 0..grid.height - outputs.lines << horizontal_line(y) + outputs.lines << horizontal_line(y) outputs.lines << shifted_horizontal_line(y) end end @@ -18008,16 +19192,16 @@ Follows is a source code listing for all files that have been open sourced. This def render_star outputs.sprites << [scale_up(state.star), 'star.png'] outputs.sprites << [move_and_scale_up(state.star), 'star.png'] - end + end # Renders the target on both grids def render_target outputs.sprites << [scale_up(state.target), 'target.png'] outputs.sprites << [move_and_scale_up(state.target), 'target.png'] - end + end def render_hills - state.hills.each_key do |hill| + state.hills.each_key do |hill| outputs.solids << [scale_up(hill), hill_color] outputs.solids << [move_and_scale_up(hill), hill_color] end @@ -18025,7 +19209,7 @@ Follows is a source code listing for all files that have been open sourced. This # Draws the walls on both grids def render_walls - state.walls.each_key do |wall| + state.walls.each_key do |wall| outputs.solids << [scale_up(wall), wall_color] outputs.solids << [move_and_scale_up(wall), wall_color] end @@ -18108,7 +19292,7 @@ Follows is a source code listing for all files that have been open sourced. This # If the mouse was clicked this tick if inputs.mouse.down # Determine what the user is editing and edit the state.user_input variable - determine_input + determine_input end # Process user input based on user_input variable and current mouse position @@ -18121,43 +19305,43 @@ Follows is a source code listing for all files that have been open sourced. This # mouse left click is held def determine_input # If the mouse is over the star in the first grid - if mouse_over_star? + if mouse_over_star? # The user is editing the star from the first grid - state.user_input = :star + state.user_input = :star # If the mouse is over the star in the second grid - elsif mouse_over_star2? + elsif mouse_over_star2? # The user is editing the star from the second grid - state.user_input = :star2 + state.user_input = :star2 # If the mouse is over the target in the first grid - elsif mouse_over_target? + elsif mouse_over_target? # The user is editing the target from the first grid - state.user_input = :target + state.user_input = :target # If the mouse is over the target in the second grid - elsif mouse_over_target2? + elsif mouse_over_target2? # The user is editing the target from the second grid - state.user_input = :target2 + state.user_input = :target2 # If the mouse is over a wall in the first grid - elsif mouse_over_wall? + elsif mouse_over_wall? # The user is removing a wall from the first grid - state.user_input = :remove_wall + state.user_input = :remove_wall # If the mouse is over a wall in the second grid - elsif mouse_over_wall2? + elsif mouse_over_wall2? # The user is removing a wall from the second grid state.user_input = :remove_wall2 # If the mouse is over a hill in the first grid - elsif mouse_over_hill? + elsif mouse_over_hill? # The user is adding a wall from the first grid - state.user_input = :add_wall + state.user_input = :add_wall # If the mouse is over a hill in the second grid - elsif mouse_over_hill2? + elsif mouse_over_hill2? # The user is adding a wall from the second grid state.user_input = :add_wall2 # If the mouse is over the first grid - elsif mouse_over_grid? + elsif mouse_over_grid? # The user is adding a hill from the first grid state.user_input = :add_hill # If the mouse is over the second grid - elsif mouse_over_grid2? + elsif mouse_over_grid2? # The user is adding a hill from the second grid state.user_input = :add_hill2 end @@ -18165,26 +19349,26 @@ Follows is a source code listing for all files that have been open sourced. This # Processes click and drag based on what the user is currently dragging def process_input - if state.user_input == :star - input_star + if state.user_input == :star + input_star elsif state.user_input == :star2 - input_star2 - elsif state.user_input == :target - input_target - elsif state.user_input == :target2 - input_target2 - elsif state.user_input == :remove_wall - input_remove_wall + input_star2 + elsif state.user_input == :target + input_target + elsif state.user_input == :target2 + input_target2 + elsif state.user_input == :remove_wall + input_remove_wall elsif state.user_input == :remove_wall2 - input_remove_wall2 - elsif state.user_input == :add_hill - input_add_hill - elsif state.user_input == :add_hill2 - input_add_hill2 - elsif state.user_input == :add_wall - input_add_wall - elsif state.user_input == :add_wall2 - input_add_wall2 + input_remove_wall2 + elsif state.user_input == :add_hill + input_add_hill + elsif state.user_input == :add_hill2 + input_add_hill2 + elsif state.user_input == :add_wall + input_add_wall + elsif state.user_input == :add_wall2 + input_add_wall2 end end @@ -18197,26 +19381,26 @@ Follows is a source code listing for all files that have been open sourced. This calc_dijkstra end end - + def calc_breadth_first # Sets up the Breadth First Search - breadth_first_search.visited[state.star] = true - breadth_first_search.frontier << state.star + breadth_first_search.visited[state.star] = true + breadth_first_search.frontier << state.star breadth_first_search.came_from[state.star] = nil until breadth_first_search.frontier.empty? return if breadth_first_search.visited.has_key?(state.target) # A step in the search # Takes the next frontier cell - new_frontier = breadth_first_search.frontier.shift + new_frontier = breadth_first_search.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do | neighbor | + adjacent_neighbors(new_frontier).each do | neighbor | # That have not been visited and are not walls - unless breadth_first_search.visited.has_key?(neighbor) || state.walls.has_key?(neighbor) + unless breadth_first_search.visited.has_key?(neighbor) || state.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited in the first grid - breadth_first_search.visited[neighbor] = true - breadth_first_search.frontier << neighbor + breadth_first_search.visited[neighbor] = true + breadth_first_search.frontier << neighbor # Remember which cell the neighbor came from breadth_first_search.came_from[neighbor] = new_frontier end @@ -18276,12 +19460,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def input_star - old_star = state.star.clone + old_star = state.star.clone unless cell_closest_to_mouse == state.target - state.star = cell_closest_to_mouse + state.star = cell_closest_to_mouse end - unless old_star == state.star - reset_search + unless old_star == state.star + reset_search end end @@ -18289,12 +19473,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def input_star2 - old_star = state.star.clone + old_star = state.star.clone unless cell_closest_to_mouse2 == state.target state.star = cell_closest_to_mouse2 end - unless old_star == state.star - reset_search + unless old_star == state.star + reset_search end end @@ -18302,12 +19486,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchs the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def input_target - old_target = state.target.clone + old_target = state.target.clone unless cell_closest_to_mouse == state.star state.target = cell_closest_to_mouse end - unless old_target == state.target - reset_search + unless old_target == state.target + reset_search end end @@ -18315,12 +19499,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchs the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def input_target2 - old_target = state.target.clone + old_target = state.target.clone unless cell_closest_to_mouse2 == state.star state.target = cell_closest_to_mouse2 end - unless old_target == state.target - reset_search + unless old_target == state.target + reset_search end end @@ -18329,11 +19513,11 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if mouse_over_grid? + if mouse_over_grid? if state.walls.has_key?(cell_closest_to_mouse) or state.hills.has_key?(cell_closest_to_mouse) - state.walls.delete(cell_closest_to_mouse) - state.hills.delete(cell_closest_to_mouse) - reset_search + state.walls.delete(cell_closest_to_mouse) + state.hills.delete(cell_closest_to_mouse) + reset_search end end end @@ -18343,21 +19527,21 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if mouse_over_grid2? + if mouse_over_grid2? if state.walls.has_key?(cell_closest_to_mouse2) or state.hills.has_key?(cell_closest_to_mouse2) - state.walls.delete(cell_closest_to_mouse2) - state.hills.delete(cell_closest_to_mouse2) - reset_search + state.walls.delete(cell_closest_to_mouse2) + state.hills.delete(cell_closest_to_mouse2) + reset_search end end end # Adds a hill in the first grid in the cell the mouse is over def input_add_hill - if mouse_over_grid? + if mouse_over_grid? unless state.hills.has_key?(cell_closest_to_mouse) - state.hills[cell_closest_to_mouse] = true - reset_search + state.hills[cell_closest_to_mouse] = true + reset_search end end end @@ -18365,32 +19549,32 @@ Follows is a source code listing for all files that have been open sourced. This # Adds a hill in the second grid in the cell the mouse is over def input_add_hill2 - if mouse_over_grid2? + if mouse_over_grid2? unless state.hills.has_key?(cell_closest_to_mouse2) - state.hills[cell_closest_to_mouse2] = true - reset_search + state.hills[cell_closest_to_mouse2] = true + reset_search end end end # Adds a wall in the first grid in the cell the mouse is over def input_add_wall - if mouse_over_grid? + if mouse_over_grid? unless state.walls.has_key?(cell_closest_to_mouse) - state.hills.delete(cell_closest_to_mouse) - state.walls[cell_closest_to_mouse] = true - reset_search + state.hills.delete(cell_closest_to_mouse) + state.walls[cell_closest_to_mouse] = true + reset_search end end end # Adds a wall in the second grid in the cell the mouse is over def input_add_wall2 - if mouse_over_grid2? + if mouse_over_grid2? unless state.walls.has_key?(cell_closest_to_mouse2) - state.hills.delete(cell_closest_to_mouse2) - state.walls[cell_closest_to_mouse2] = true - reset_search + state.hills.delete(cell_closest_to_mouse2) + state.walls[cell_closest_to_mouse2] = true + reset_search end end end @@ -18413,21 +19597,21 @@ Follows is a source code listing for all files that have been open sourced. This # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x , cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 - neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 + neighbors << [cell.x , cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 + neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 # Sorts the neighbors so the rendered path is a zigzag path # Cells in a diagonal direction are given priority # Comment this line to see the difference neighbors = neighbors.sort_by { |neighbor_x, neighbor_y| proximity_to_star(neighbor_x, neighbor_y) } - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -18452,13 +19636,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -18466,17 +19650,17 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the second grid helps with this def cell_closest_to_mouse2 # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= grid.width + 1 # Bound x and y to the first grid x = 0 if x < 0 y = 0 if y < 0 - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # Signal that the user is going to be moving the star from the first grid @@ -18549,12 +19733,12 @@ Follows is a source code listing for all files that have been open sourced. This # Light brown def unvisited_color - [221, 212, 213] + [221, 212, 213] end # Camo Green def wall_color - [134, 134, 120] + [134, 134, 120] end # Pastel White @@ -18597,7 +19781,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Dijkstra tick method is called - $movement_costs ||= Movement_Costs.new(args) + $movement_costs ||= Movement_Costs.new $movement_costs.args = args $movement_costs.tick end @@ -18624,13 +19808,13 @@ Follows is a source code listing for all files that have been open sourced. This def tick defaults - render - input + render + input # If animation is playing, and max steps have not been reached # Move the search a step forward if state.play && state.current_step < state.max_steps # Variable that tells the program what step to recalculate up to - state.current_step += 1 + state.current_step += 1 move_searches_one_step_forward end end @@ -18652,7 +19836,7 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.user_input ||= :none + state.user_input ||= :none # These variables allow the breadth first search to take place # Came_from is a hash with a key of a cell and a value of the cell that was expanded from to find the key. @@ -18677,7 +19861,7 @@ Follows is a source code listing for all files that have been open sourced. This # Unless the current step has a value unless state.current_step # Set the current step to 10 - state.current_step = 10 + state.current_step = 10 # And calculate the searches up to step 10 recalculate_searches end @@ -18687,7 +19871,7 @@ Follows is a source code listing for all files that have been open sourced. This # This step is roughly the grid's width * height # When anim_steps equals max_steps no more calculations will occur # and the slider will be at the end - state.max_steps = grid.width * grid.height + state.max_steps = grid.width * grid.height # Whether the animation should play or not # If true, every tick moves anim_steps forward one @@ -18780,7 +19964,7 @@ Follows is a source code listing for all files that have been open sourced. This # If the mouse was clicked this tick if inputs.mouse.down # Determine what the user is editing and appropriately edit the state.user_input variable - determine_input + determine_input end # Process user input based on user_input variable and current mouse position @@ -18793,35 +19977,35 @@ Follows is a source code listing for all files that have been open sourced. This if mouse_over_slider? state.user_input = :slider # If the mouse is over the star in the first grid - elsif bfs_mouse_over_star? + elsif bfs_mouse_over_star? # The user is editing the star from the first grid - state.user_input = :bfs_star + state.user_input = :bfs_star # If the mouse is over the star in the second grid - elsif heuristic_mouse_over_star? + elsif heuristic_mouse_over_star? # The user is editing the star from the second grid - state.user_input = :heuristic_star + state.user_input = :heuristic_star # If the mouse is over the target in the first grid - elsif bfs_mouse_over_target? + elsif bfs_mouse_over_target? # The user is editing the target from the first grid - state.user_input = :bfs_target + state.user_input = :bfs_target # If the mouse is over the target in the second grid - elsif heuristic_mouse_over_target? + elsif heuristic_mouse_over_target? # The user is editing the target from the second grid - state.user_input = :heuristic_target + state.user_input = :heuristic_target # If the mouse is over a wall in the first grid - elsif bfs_mouse_over_wall? + elsif bfs_mouse_over_wall? # The user is removing a wall from the first grid - state.user_input = :bfs_remove_wall + state.user_input = :bfs_remove_wall # If the mouse is over a wall in the second grid - elsif heuristic_mouse_over_wall? + elsif heuristic_mouse_over_wall? # The user is removing a wall from the second grid state.user_input = :heuristic_remove_wall # If the mouse is over the first grid - elsif bfs_mouse_over_grid? + elsif bfs_mouse_over_grid? # The user is adding a wall from the first grid state.user_input = :bfs_add_wall # If the mouse is over the second grid - elsif heuristic_mouse_over_grid? + elsif heuristic_mouse_over_grid? # The user is adding a wall from the second grid state.user_input = :heuristic_add_wall end @@ -18831,22 +20015,22 @@ Follows is a source code listing for all files that have been open sourced. This def process_input if state.user_input == :slider process_input_slider - elsif state.user_input == :bfs_star - process_input_bfs_star + elsif state.user_input == :bfs_star + process_input_bfs_star elsif state.user_input == :heuristic_star - process_input_heuristic_star - elsif state.user_input == :bfs_target - process_input_bfs_target - elsif state.user_input == :heuristic_target - process_input_heuristic_target - elsif state.user_input == :bfs_remove_wall - process_input_bfs_remove_wall + process_input_heuristic_star + elsif state.user_input == :bfs_target + process_input_bfs_target + elsif state.user_input == :heuristic_target + process_input_heuristic_target + elsif state.user_input == :bfs_remove_wall + process_input_bfs_remove_wall elsif state.user_input == :heuristic_remove_wall - process_input_heuristic_remove_wall - elsif state.user_input == :bfs_add_wall - process_input_bfs_add_wall - elsif state.user_input == :heuristic_add_wall - process_input_heuristic_add_wall + process_input_heuristic_remove_wall + elsif state.user_input == :bfs_add_wall + process_input_bfs_add_wall + elsif state.user_input == :heuristic_add_wall + process_input_heuristic_add_wall end end @@ -18923,7 +20107,7 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << bfs_horizontal_line(y) + outputs.lines << bfs_horizontal_line(y) end end @@ -18938,10 +20122,10 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << heuristic_horizontal_line(y) + outputs.lines << heuristic_horizontal_line(y) end end - + # Returns a vertical line for a column of the first grid def bfs_vertical_line column bfs_scale_up([column, 0, column, grid.height]) @@ -18976,7 +20160,7 @@ Follows is a source code listing for all files that have been open sourced. This def render_bfs_target outputs.sprites << [bfs_scale_up(grid.target), 'target.png'] end - + # Renders the target on the second grid def render_heuristic_target outputs.sprites << [heuristic_scale_up(grid.target), 'target.png'] @@ -18984,14 +20168,14 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the walls on the first grid def render_bfs_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [bfs_scale_up(wall), wall_color] end end # Renders the walls on the second grid def render_heuristic_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [heuristic_scale_up(wall), wall_color] end end @@ -19012,14 +20196,14 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the frontier cells on the first grid def render_bfs_frontier - bfs.frontier.each do | frontier_cell | + bfs.frontier.each do | frontier_cell | outputs.solids << [bfs_scale_up(frontier_cell), frontier_color, 200] end end # Renders the frontier cells on the second grid def render_heuristic_frontier - heuristic.frontier.each do | frontier_cell | + heuristic.frontier.each do | frontier_cell | outputs.solids << [heuristic_scale_up(frontier_cell), frontier_color, 200] end end @@ -19103,14 +20287,14 @@ Follows is a source code listing for all files that have been open sourced. This # Checks and handles input for the buttons # Called when the mouse is lifted def input_buttons - input_left_button - input_center_button - input_right_button + input_left_button + input_center_button + input_right_button end # Checks if the previous step button is clicked # If it is, it pauses the animation and moves the search one step backward - def input_left_button + def input_left_button if left_button_clicked? state.play = false state.current_step -= 1 @@ -19122,7 +20306,7 @@ Follows is a source code listing for all files that have been open sourced. This # Inverses whether the animation is playing or not when clicked def input_center_button if center_button_clicked? || inputs.keyboard.key_down.space - state.play = !state.play + state.play = !state.play end end @@ -19130,8 +20314,8 @@ Follows is a source code listing for all files that have been open sourced. This # If it is, it pauses the animation and moves the search one step forward def input_right_button if right_button_clicked? - state.play = false - state.current_step += 1 + state.play = false + state.current_step += 1 move_searches_one_step_forward end end @@ -19212,12 +20396,12 @@ Follows is a source code listing for all files that have been open sourced. This # on the slider # Changes the step of the search to be animated def process_input_slider - state.play = false + state.play = false mouse_x = inputs.mouse.point.x # Bounds the mouse_x to the closest x value on the slider line - mouse_x = slider.x if mouse_x < slider.x - mouse_x = slider.x + slider.w if mouse_x > slider.x + slider.w + mouse_x = slider.x if mouse_x < slider.x + mouse_x = slider.x + slider.w if mouse_x > slider.x + slider.w # Sets the current search step to the one represented by the mouse x value # The slider's circle moves due to the render_slider method using anim_steps @@ -19230,12 +20414,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_bfs_star - old_star = grid.star.clone + old_star = grid.star.clone unless bfs_cell_closest_to_mouse == grid.target - grid.star = bfs_cell_closest_to_mouse + grid.star = bfs_cell_closest_to_mouse end - unless old_star == grid.star - recalculate_searches + unless old_star == grid.star + recalculate_searches end end @@ -19243,12 +20427,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_heuristic_star - old_star = grid.star.clone + old_star = grid.star.clone unless heuristic_cell_closest_to_mouse == grid.target grid.star = heuristic_cell_closest_to_mouse end - unless old_star == grid.star - recalculate_searches + unless old_star == grid.star + recalculate_searches end end @@ -19256,12 +20440,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only recalculate_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_bfs_target - old_target = grid.target.clone + old_target = grid.target.clone unless bfs_cell_closest_to_mouse == grid.star grid.target = bfs_cell_closest_to_mouse end - unless old_target == grid.target - recalculate_searches + unless old_target == grid.target + recalculate_searches end end @@ -19269,12 +20453,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only recalculate_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_heuristic_target - old_target = grid.target.clone + old_target = grid.target.clone unless heuristic_cell_closest_to_mouse == grid.star grid.target = heuristic_cell_closest_to_mouse end - unless old_target == grid.target - recalculate_searches + unless old_target == grid.target + recalculate_searches end end @@ -19283,10 +20467,10 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if bfs_mouse_over_grid? + if bfs_mouse_over_grid? if grid.walls.has_key?(bfs_cell_closest_to_mouse) - grid.walls.delete(bfs_cell_closest_to_mouse) - recalculate_searches + grid.walls.delete(bfs_cell_closest_to_mouse) + recalculate_searches end end end @@ -19296,29 +20480,29 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if heuristic_mouse_over_grid? + if heuristic_mouse_over_grid? if grid.walls.has_key?(heuristic_cell_closest_to_mouse) - grid.walls.delete(heuristic_cell_closest_to_mouse) - recalculate_searches + grid.walls.delete(heuristic_cell_closest_to_mouse) + recalculate_searches end end end # Adds a wall in the first grid in the cell the mouse is over def process_input_bfs_add_wall - if bfs_mouse_over_grid? + if bfs_mouse_over_grid? unless grid.walls.has_key?(bfs_cell_closest_to_mouse) - grid.walls[bfs_cell_closest_to_mouse] = true - recalculate_searches + grid.walls[bfs_cell_closest_to_mouse] = true + recalculate_searches end end end # Adds a wall in the second grid in the cell the mouse is over def process_input_heuristic_add_wall - if heuristic_mouse_over_grid? + if heuristic_mouse_over_grid? unless grid.walls.has_key?(heuristic_cell_closest_to_mouse) - grid.walls[heuristic_cell_closest_to_mouse] = true - recalculate_searches + grid.walls[heuristic_cell_closest_to_mouse] = true + recalculate_searches end end end @@ -19328,13 +20512,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def bfs_cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -19342,17 +20526,17 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the second grid helps with this def heuristic_cell_closest_to_mouse # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= grid.width + 1 # Bound x and y to the first grid x = 0 if x < 0 y = 0 if y < 0 - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end def recalculate_searches @@ -19377,22 +20561,22 @@ Follows is a source code listing for all files that have been open sourced. This return if bfs.came_from.has_key?(grid.target) # Only runs at the beginning of the search as setup. - if bfs.came_from.empty? - bfs.frontier << grid.star - bfs.came_from[grid.star] = nil + if bfs.came_from.empty? + bfs.frontier << grid.star + bfs.came_from[grid.star] = nil end # A step in the search - unless bfs.frontier.empty? + unless bfs.frontier.empty? # Takes the next frontier cell - new_frontier = bfs.frontier.shift + new_frontier = bfs.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless bfs.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) + unless bfs.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - bfs.frontier << neighbor - bfs.came_from[neighbor] = new_frontier + bfs.frontier << neighbor + bfs.came_from[neighbor] = new_frontier end end end @@ -19447,12 +20631,12 @@ Follows is a source code listing for all files that have been open sourced. This # Get the next cell to explore from new_frontier = heuristic.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless heuristic.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) + unless heuristic.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - heuristic.frontier << neighbor - heuristic.came_from[neighbor] = new_frontier + heuristic.frontier << neighbor + heuristic.came_from[neighbor] = new_frontier end end end @@ -19496,16 +20680,16 @@ Follows is a source code listing for all files that have been open sourced. This # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x , cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 - neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 + neighbors << [cell.x , cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 + neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -19554,7 +20738,7 @@ Follows is a source code listing for all files that have been open sourced. This def wall_color [134, 134, 120] # Camo Green end - + def visited_color [204, 191, 179] # Dark Brown end @@ -19562,7 +20746,7 @@ Follows is a source code listing for all files that have been open sourced. This def frontier_color [103, 136, 204] # Blue end - + def path_color [231, 230, 228] # Pastel White end @@ -19583,7 +20767,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Breadth First Search tick is called - $heuristic_with_walls ||= Heuristic_With_Walls.new(args) + $heuristic_with_walls ||= Heuristic_With_Walls.new $heuristic_with_walls.args = args $heuristic_with_walls.tick end @@ -19610,13 +20794,13 @@ Follows is a source code listing for all files that have been open sourced. This def tick defaults - render - input + render + input # If animation is playing, and max steps have not been reached # Move the search a step forward if state.play && state.current_step < state.max_steps # Variable that tells the program what step to recalculate up to - state.current_step += 1 + state.current_step += 1 move_searches_one_step_forward end end @@ -19671,7 +20855,7 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.user_input ||= :none + state.user_input ||= :none # These variables allow the breadth first search to take place # Came_from is a hash with a key of a cell and a value of the cell that was expanded from to find the key. @@ -19696,7 +20880,7 @@ Follows is a source code listing for all files that have been open sourced. This # Unless the current step has a value unless state.current_step # Set the current step to 10 - state.current_step = 10 + state.current_step = 10 # And calculate the searches up to step 10 recalculate_searches end @@ -19706,7 +20890,7 @@ Follows is a source code listing for all files that have been open sourced. This # This step is roughly the grid's width * height # When anim_steps equals max_steps no more calculations will occur # and the slider will be at the end - state.max_steps = grid.width * grid.height + state.max_steps = grid.width * grid.height # Whether the animation should play or not # If true, every tick moves anim_steps forward one @@ -19799,7 +20983,7 @@ Follows is a source code listing for all files that have been open sourced. This # If the mouse was clicked this tick if inputs.mouse.down # Determine what the user is editing and appropriately edit the state.user_input variable - determine_input + determine_input end # Process user input based on user_input variable and current mouse position @@ -19812,35 +20996,35 @@ Follows is a source code listing for all files that have been open sourced. This if mouse_over_slider? state.user_input = :slider # If the mouse is over the star in the first grid - elsif bfs_mouse_over_star? + elsif bfs_mouse_over_star? # The user is editing the star from the first grid - state.user_input = :bfs_star + state.user_input = :bfs_star # If the mouse is over the star in the second grid - elsif heuristic_mouse_over_star? + elsif heuristic_mouse_over_star? # The user is editing the star from the second grid - state.user_input = :heuristic_star + state.user_input = :heuristic_star # If the mouse is over the target in the first grid - elsif bfs_mouse_over_target? + elsif bfs_mouse_over_target? # The user is editing the target from the first grid - state.user_input = :bfs_target + state.user_input = :bfs_target # If the mouse is over the target in the second grid - elsif heuristic_mouse_over_target? + elsif heuristic_mouse_over_target? # The user is editing the target from the second grid - state.user_input = :heuristic_target + state.user_input = :heuristic_target # If the mouse is over a wall in the first grid - elsif bfs_mouse_over_wall? + elsif bfs_mouse_over_wall? # The user is removing a wall from the first grid - state.user_input = :bfs_remove_wall + state.user_input = :bfs_remove_wall # If the mouse is over a wall in the second grid - elsif heuristic_mouse_over_wall? + elsif heuristic_mouse_over_wall? # The user is removing a wall from the second grid state.user_input = :heuristic_remove_wall # If the mouse is over the first grid - elsif bfs_mouse_over_grid? + elsif bfs_mouse_over_grid? # The user is adding a wall from the first grid state.user_input = :bfs_add_wall # If the mouse is over the second grid - elsif heuristic_mouse_over_grid? + elsif heuristic_mouse_over_grid? # The user is adding a wall from the second grid state.user_input = :heuristic_add_wall end @@ -19850,22 +21034,22 @@ Follows is a source code listing for all files that have been open sourced. This def process_input if state.user_input == :slider process_input_slider - elsif state.user_input == :bfs_star - process_input_bfs_star + elsif state.user_input == :bfs_star + process_input_bfs_star elsif state.user_input == :heuristic_star - process_input_heuristic_star - elsif state.user_input == :bfs_target - process_input_bfs_target - elsif state.user_input == :heuristic_target - process_input_heuristic_target - elsif state.user_input == :bfs_remove_wall - process_input_bfs_remove_wall + process_input_heuristic_star + elsif state.user_input == :bfs_target + process_input_bfs_target + elsif state.user_input == :heuristic_target + process_input_heuristic_target + elsif state.user_input == :bfs_remove_wall + process_input_bfs_remove_wall elsif state.user_input == :heuristic_remove_wall - process_input_heuristic_remove_wall - elsif state.user_input == :bfs_add_wall - process_input_bfs_add_wall - elsif state.user_input == :heuristic_add_wall - process_input_heuristic_add_wall + process_input_heuristic_remove_wall + elsif state.user_input == :bfs_add_wall + process_input_bfs_add_wall + elsif state.user_input == :heuristic_add_wall + process_input_heuristic_add_wall end end @@ -19942,7 +21126,7 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << bfs_horizontal_line(y) + outputs.lines << bfs_horizontal_line(y) end end @@ -19957,10 +21141,10 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << heuristic_horizontal_line(y) + outputs.lines << heuristic_horizontal_line(y) end end - + # Returns a vertical line for a column of the first grid def bfs_vertical_line column bfs_scale_up([column, 0, column, grid.height]) @@ -19995,7 +21179,7 @@ Follows is a source code listing for all files that have been open sourced. This def render_bfs_target outputs.sprites << [bfs_scale_up(grid.target), 'target.png'] end - + # Renders the target on the second grid def render_heuristic_target outputs.sprites << [heuristic_scale_up(grid.target), 'target.png'] @@ -20003,14 +21187,14 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the walls on the first grid def render_bfs_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [bfs_scale_up(wall), wall_color] end end # Renders the walls on the second grid def render_heuristic_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [heuristic_scale_up(wall), wall_color] end end @@ -20031,14 +21215,14 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the frontier cells on the first grid def render_bfs_frontier - bfs.frontier.each do | frontier_cell | + bfs.frontier.each do | frontier_cell | outputs.solids << [bfs_scale_up(frontier_cell), frontier_color, 200] end end # Renders the frontier cells on the second grid def render_heuristic_frontier - heuristic.frontier.each do | frontier_cell | + heuristic.frontier.each do | frontier_cell | outputs.solids << [heuristic_scale_up(frontier_cell), frontier_color, 200] end end @@ -20122,14 +21306,14 @@ Follows is a source code listing for all files that have been open sourced. This # Checks and handles input for the buttons # Called when the mouse is lifted def input_buttons - input_left_button - input_center_button - input_right_button + input_left_button + input_center_button + input_right_button end # Checks if the previous step button is clicked # If it is, it pauses the animation and moves the search one step backward - def input_left_button + def input_left_button if left_button_clicked? state.play = false state.current_step -= 1 @@ -20141,7 +21325,7 @@ Follows is a source code listing for all files that have been open sourced. This # Inverses whether the animation is playing or not when clicked def input_center_button if center_button_clicked? || inputs.keyboard.key_down.space - state.play = !state.play + state.play = !state.play end end @@ -20149,8 +21333,8 @@ Follows is a source code listing for all files that have been open sourced. This # If it is, it pauses the animation and moves the search one step forward def input_right_button if right_button_clicked? - state.play = false - state.current_step += 1 + state.play = false + state.current_step += 1 move_searches_one_step_forward end end @@ -20231,12 +21415,12 @@ Follows is a source code listing for all files that have been open sourced. This # on the slider # Changes the step of the search to be animated def process_input_slider - state.play = false + state.play = false mouse_x = inputs.mouse.point.x # Bounds the mouse_x to the closest x value on the slider line - mouse_x = slider.x if mouse_x < slider.x - mouse_x = slider.x + slider.w if mouse_x > slider.x + slider.w + mouse_x = slider.x if mouse_x < slider.x + mouse_x = slider.x + slider.w if mouse_x > slider.x + slider.w # Sets the current search step to the one represented by the mouse x value # The slider's circle moves due to the render_slider method using anim_steps @@ -20249,12 +21433,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_bfs_star - old_star = grid.star.clone + old_star = grid.star.clone unless bfs_cell_closest_to_mouse == grid.target - grid.star = bfs_cell_closest_to_mouse + grid.star = bfs_cell_closest_to_mouse end - unless old_star == grid.star - recalculate_searches + unless old_star == grid.star + recalculate_searches end end @@ -20262,12 +21446,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_heuristic_star - old_star = grid.star.clone + old_star = grid.star.clone unless heuristic_cell_closest_to_mouse == grid.target grid.star = heuristic_cell_closest_to_mouse end - unless old_star == grid.star - recalculate_searches + unless old_star == grid.star + recalculate_searches end end @@ -20275,12 +21459,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only recalculate_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_bfs_target - old_target = grid.target.clone + old_target = grid.target.clone unless bfs_cell_closest_to_mouse == grid.star grid.target = bfs_cell_closest_to_mouse end - unless old_target == grid.target - recalculate_searches + unless old_target == grid.target + recalculate_searches end end @@ -20288,12 +21472,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only recalculate_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_heuristic_target - old_target = grid.target.clone + old_target = grid.target.clone unless heuristic_cell_closest_to_mouse == grid.star grid.target = heuristic_cell_closest_to_mouse end - unless old_target == grid.target - recalculate_searches + unless old_target == grid.target + recalculate_searches end end @@ -20302,10 +21486,10 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if bfs_mouse_over_grid? + if bfs_mouse_over_grid? if grid.walls.has_key?(bfs_cell_closest_to_mouse) - grid.walls.delete(bfs_cell_closest_to_mouse) - recalculate_searches + grid.walls.delete(bfs_cell_closest_to_mouse) + recalculate_searches end end end @@ -20315,29 +21499,29 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if heuristic_mouse_over_grid? + if heuristic_mouse_over_grid? if grid.walls.has_key?(heuristic_cell_closest_to_mouse) - grid.walls.delete(heuristic_cell_closest_to_mouse) - recalculate_searches + grid.walls.delete(heuristic_cell_closest_to_mouse) + recalculate_searches end end end # Adds a wall in the first grid in the cell the mouse is over def process_input_bfs_add_wall - if bfs_mouse_over_grid? + if bfs_mouse_over_grid? unless grid.walls.has_key?(bfs_cell_closest_to_mouse) - grid.walls[bfs_cell_closest_to_mouse] = true - recalculate_searches + grid.walls[bfs_cell_closest_to_mouse] = true + recalculate_searches end end end # Adds a wall in the second grid in the cell the mouse is over def process_input_heuristic_add_wall - if heuristic_mouse_over_grid? + if heuristic_mouse_over_grid? unless grid.walls.has_key?(heuristic_cell_closest_to_mouse) - grid.walls[heuristic_cell_closest_to_mouse] = true - recalculate_searches + grid.walls[heuristic_cell_closest_to_mouse] = true + recalculate_searches end end end @@ -20347,13 +21531,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def bfs_cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -20361,17 +21545,17 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the second grid helps with this def heuristic_cell_closest_to_mouse # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= grid.width + 1 # Bound x and y to the first grid x = 0 if x < 0 y = 0 if y < 0 - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end def recalculate_searches @@ -20396,22 +21580,22 @@ Follows is a source code listing for all files that have been open sourced. This return if bfs.came_from.has_key?(grid.target) # Only runs at the beginning of the search as setup. - if bfs.came_from.empty? - bfs.frontier << grid.star - bfs.came_from[grid.star] = nil + if bfs.came_from.empty? + bfs.frontier << grid.star + bfs.came_from[grid.star] = nil end # A step in the search - unless bfs.frontier.empty? + unless bfs.frontier.empty? # Takes the next frontier cell - new_frontier = bfs.frontier.shift + new_frontier = bfs.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless bfs.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) + unless bfs.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - bfs.frontier << neighbor - bfs.came_from[neighbor] = new_frontier + bfs.frontier << neighbor + bfs.came_from[neighbor] = new_frontier end end end @@ -20466,12 +21650,12 @@ Follows is a source code listing for all files that have been open sourced. This # Get the next cell to explore from new_frontier = heuristic.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do |neighbor| + adjacent_neighbors(new_frontier).each do |neighbor| # That have not been visited and are not walls - unless heuristic.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) + unless heuristic.came_from.has_key?(neighbor) || grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - heuristic.frontier << neighbor - heuristic.came_from[neighbor] = new_frontier + heuristic.frontier << neighbor + heuristic.came_from[neighbor] = new_frontier end end end @@ -20515,16 +21699,16 @@ Follows is a source code listing for all files that have been open sourced. This # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x , cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 - neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 + neighbors << [cell.x , cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 + neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -20573,7 +21757,7 @@ Follows is a source code listing for all files that have been open sourced. This def wall_color [134, 134, 120] # Camo Green end - + def visited_color [204, 191, 179] # Dark Brown end @@ -20581,7 +21765,7 @@ Follows is a source code listing for all files that have been open sourced. This def frontier_color [103, 136, 204] # Blue end - + def path_color [231, 230, 228] # Pastel White end @@ -20602,7 +21786,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Breadth First Search tick is called - $heuristic ||= Heuristic.new(args) + $heuristic ||= Heuristic.new $heuristic.args = args $heuristic.tick end @@ -20630,8 +21814,8 @@ Follows is a source code listing for all files that have been open sourced. This def tick defaults - render - input + render + input if dijkstra.came_from.empty? calc_searches @@ -20684,7 +21868,7 @@ Follows is a source code listing for all files that have been open sourced. This # We store this value, because we want to remember the value even when # the user's cursor is no longer over what they're interacting with, but # they are still clicking down on the mouse. - state.user_input ||= :none + state.user_input ||= :none # These variables allow the breadth first search to take place # Came_from is a hash with a key of a cell and a value of the cell that was expanded from to find the key. @@ -20762,7 +21946,7 @@ Follows is a source code listing for all files that have been open sourced. This # If the mouse was clicked this tick if inputs.mouse.down # Determine what the user is editing and appropriately edit the state.user_input variable - determine_input + determine_input end # Process user input based on user_input variable and current mouse position @@ -20773,51 +21957,51 @@ Follows is a source code listing for all files that have been open sourced. This # This method is called when the mouse is clicked down def determine_input # If the mouse is over the star in the first grid - if dijkstra_mouse_over_star? + if dijkstra_mouse_over_star? # The user is editing the star from the first grid - state.user_input = :dijkstra_star + state.user_input = :dijkstra_star # If the mouse is over the star in the second grid - elsif greedy_mouse_over_star? + elsif greedy_mouse_over_star? # The user is editing the star from the second grid - state.user_input = :greedy_star + state.user_input = :greedy_star # If the mouse is over the star in the third grid - elsif a_star_mouse_over_star? + elsif a_star_mouse_over_star? # The user is editing the star from the third grid - state.user_input = :a_star_star + state.user_input = :a_star_star # If the mouse is over the target in the first grid - elsif dijkstra_mouse_over_target? + elsif dijkstra_mouse_over_target? # The user is editing the target from the first grid - state.user_input = :dijkstra_target + state.user_input = :dijkstra_target # If the mouse is over the target in the second grid - elsif greedy_mouse_over_target? + elsif greedy_mouse_over_target? # The user is editing the target from the second grid - state.user_input = :greedy_target + state.user_input = :greedy_target # If the mouse is over the target in the third grid - elsif a_star_mouse_over_target? + elsif a_star_mouse_over_target? # The user is editing the target from the third grid - state.user_input = :a_star_target + state.user_input = :a_star_target # If the mouse is over a wall in the first grid - elsif dijkstra_mouse_over_wall? + elsif dijkstra_mouse_over_wall? # The user is removing a wall from the first grid - state.user_input = :dijkstra_remove_wall + state.user_input = :dijkstra_remove_wall # If the mouse is over a wall in the second grid - elsif greedy_mouse_over_wall? + elsif greedy_mouse_over_wall? # The user is removing a wall from the second grid state.user_input = :greedy_remove_wall # If the mouse is over a wall in the third grid - elsif a_star_mouse_over_wall? + elsif a_star_mouse_over_wall? # The user is removing a wall from the third grid state.user_input = :a_star_remove_wall # If the mouse is over the first grid - elsif dijkstra_mouse_over_grid? + elsif dijkstra_mouse_over_grid? # The user is adding a wall from the first grid state.user_input = :dijkstra_add_wall # If the mouse is over the second grid - elsif greedy_mouse_over_grid? + elsif greedy_mouse_over_grid? # The user is adding a wall from the second grid state.user_input = :greedy_add_wall # If the mouse is over the third grid - elsif a_star_mouse_over_grid? + elsif a_star_mouse_over_grid? # The user is adding a wall from the third grid state.user_input = :a_star_add_wall end @@ -20825,30 +22009,30 @@ Follows is a source code listing for all files that have been open sourced. This # Processes click and drag based on what the user is currently dragging def process_input - if state.user_input == :dijkstra_star - process_input_dijkstra_star + if state.user_input == :dijkstra_star + process_input_dijkstra_star elsif state.user_input == :greedy_star - process_input_greedy_star + process_input_greedy_star elsif state.user_input == :a_star_star - process_input_a_star_star - elsif state.user_input == :dijkstra_target - process_input_dijkstra_target - elsif state.user_input == :greedy_target - process_input_greedy_target - elsif state.user_input == :a_star_target - process_input_a_star_target - elsif state.user_input == :dijkstra_remove_wall - process_input_dijkstra_remove_wall + process_input_a_star_star + elsif state.user_input == :dijkstra_target + process_input_dijkstra_target + elsif state.user_input == :greedy_target + process_input_greedy_target + elsif state.user_input == :a_star_target + process_input_a_star_target + elsif state.user_input == :dijkstra_remove_wall + process_input_dijkstra_remove_wall elsif state.user_input == :greedy_remove_wall - process_input_greedy_remove_wall + process_input_greedy_remove_wall elsif state.user_input == :a_star_remove_wall - process_input_a_star_remove_wall - elsif state.user_input == :dijkstra_add_wall - process_input_dijkstra_add_wall - elsif state.user_input == :greedy_add_wall - process_input_greedy_add_wall - elsif state.user_input == :a_star_add_wall - process_input_a_star_add_wall + process_input_a_star_remove_wall + elsif state.user_input == :dijkstra_add_wall + process_input_dijkstra_add_wall + elsif state.user_input == :greedy_add_wall + process_input_greedy_add_wall + elsif state.user_input == :a_star_add_wall + process_input_a_star_add_wall end end @@ -20863,7 +22047,7 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << dijkstra_horizontal_line(y) + outputs.lines << dijkstra_horizontal_line(y) end end @@ -20878,7 +22062,7 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << greedy_horizontal_line(y) + outputs.lines << greedy_horizontal_line(y) end end @@ -20893,10 +22077,10 @@ Follows is a source code listing for all files that have been open sourced. This # The horizontal grid lines for y in 0..grid.height - outputs.lines << a_star_horizontal_line(y) + outputs.lines << a_star_horizontal_line(y) end end - + # Returns a vertical line for a column of the first grid def dijkstra_vertical_line column dijkstra_scale_up([column, 0, column, grid.height]) @@ -20946,7 +22130,7 @@ Follows is a source code listing for all files that have been open sourced. This def render_dijkstra_target outputs.sprites << [dijkstra_scale_up(grid.target), 'target.png'] end - + # Renders the target on the second grid def render_greedy_target outputs.sprites << [greedy_scale_up(grid.target), 'target.png'] @@ -20959,21 +22143,21 @@ Follows is a source code listing for all files that have been open sourced. This # Renders the walls on the first grid def render_dijkstra_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [dijkstra_scale_up(wall), wall_color] end end # Renders the walls on the second grid def render_greedy_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [greedy_scale_up(wall), wall_color] end end # Renders the walls on the third grid def render_a_star_walls - grid.walls.each_key do | wall | + grid.walls.each_key do | wall | outputs.solids << [a_star_scale_up(wall), wall_color] end end @@ -21173,12 +22357,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_dijkstra_star - old_star = grid.star.clone + old_star = grid.star.clone unless dijkstra_cell_closest_to_mouse == grid.target - grid.star = dijkstra_cell_closest_to_mouse + grid.star = dijkstra_cell_closest_to_mouse end - unless old_star == grid.star - reset_searches + unless old_star == grid.star + reset_searches end end @@ -21186,12 +22370,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_greedy_star - old_star = grid.star.clone + old_star = grid.star.clone unless greedy_cell_closest_to_mouse == grid.target grid.star = greedy_cell_closest_to_mouse end - unless old_star == grid.star - reset_searches + unless old_star == grid.star + reset_searches end end @@ -21199,12 +22383,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only resets the search if the star changes position # Called whenever the user is editing the star (puts mouse down on star) def process_input_a_star_star - old_star = grid.star.clone + old_star = grid.star.clone unless a_star_cell_closest_to_mouse == grid.target grid.star = a_star_cell_closest_to_mouse end - unless old_star == grid.star - reset_searches + unless old_star == grid.star + reset_searches end end @@ -21212,12 +22396,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_dijkstra_target - old_target = grid.target.clone + old_target = grid.target.clone unless dijkstra_cell_closest_to_mouse == grid.star grid.target = dijkstra_cell_closest_to_mouse end - unless old_target == grid.target - reset_searches + unless old_target == grid.target + reset_searches end end @@ -21225,12 +22409,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_greedy_target - old_target = grid.target.clone + old_target = grid.target.clone unless greedy_cell_closest_to_mouse == grid.star grid.target = greedy_cell_closest_to_mouse end - unless old_target == grid.target - reset_searches + unless old_target == grid.target + reset_searches end end @@ -21238,12 +22422,12 @@ Follows is a source code listing for all files that have been open sourced. This # Only reset_searchess the search if the target changes position # Called whenever the user is editing the target (puts mouse down on target) def process_input_a_star_target - old_target = grid.target.clone + old_target = grid.target.clone unless a_star_cell_closest_to_mouse == grid.star grid.target = a_star_cell_closest_to_mouse end - unless old_target == grid.target - reset_searches + unless old_target == grid.target + reset_searches end end @@ -21252,10 +22436,10 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if dijkstra_mouse_over_grid? + if dijkstra_mouse_over_grid? if grid.walls.has_key?(dijkstra_cell_closest_to_mouse) - grid.walls.delete(dijkstra_cell_closest_to_mouse) - reset_searches + grid.walls.delete(dijkstra_cell_closest_to_mouse) + reset_searches end end end @@ -21265,10 +22449,10 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if greedy_mouse_over_grid? + if greedy_mouse_over_grid? if grid.walls.has_key?(greedy_cell_closest_to_mouse) - grid.walls.delete(greedy_cell_closest_to_mouse) - reset_searches + grid.walls.delete(greedy_cell_closest_to_mouse) + reset_searches end end end @@ -21278,40 +22462,40 @@ Follows is a source code listing for all files that have been open sourced. This # The mouse needs to be inside the grid, because we only want to remove walls # the cursor is directly over # Recalculations should only occur when a wall is actually deleted - if a_star_mouse_over_grid? + if a_star_mouse_over_grid? if grid.walls.has_key?(a_star_cell_closest_to_mouse) - grid.walls.delete(a_star_cell_closest_to_mouse) - reset_searches + grid.walls.delete(a_star_cell_closest_to_mouse) + reset_searches end end end # Adds a wall in the first grid in the cell the mouse is over def process_input_dijkstra_add_wall - if dijkstra_mouse_over_grid? + if dijkstra_mouse_over_grid? unless grid.walls.has_key?(dijkstra_cell_closest_to_mouse) - grid.walls[dijkstra_cell_closest_to_mouse] = true - reset_searches + grid.walls[dijkstra_cell_closest_to_mouse] = true + reset_searches end end end # Adds a wall in the second grid in the cell the mouse is over def process_input_greedy_add_wall - if greedy_mouse_over_grid? + if greedy_mouse_over_grid? unless grid.walls.has_key?(greedy_cell_closest_to_mouse) - grid.walls[greedy_cell_closest_to_mouse] = true - reset_searches + grid.walls[greedy_cell_closest_to_mouse] = true + reset_searches end end end # Adds a wall in the third grid in the cell the mouse is over def process_input_a_star_add_wall - if a_star_mouse_over_grid? + if a_star_mouse_over_grid? unless grid.walls.has_key?(a_star_cell_closest_to_mouse) - grid.walls[a_star_cell_closest_to_mouse] = true - reset_searches + grid.walls[a_star_cell_closest_to_mouse] = true + reset_searches end end end @@ -21321,13 +22505,13 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse helps with this def dijkstra_cell_closest_to_mouse # Closest cell to the mouse in the first grid - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Bound x and y to the grid - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -21335,17 +22519,17 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the second grid helps with this def greedy_cell_closest_to_mouse # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= grid.width + 1 # Bound x and y to the first grid x = 0 if x < 0 y = 0 if y < 0 - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end # When the user grabs the star and puts their cursor to the far right @@ -21353,17 +22537,17 @@ Follows is a source code listing for all files that have been open sourced. This # Finding the cell closest to the mouse in the third grid helps with this def a_star_cell_closest_to_mouse # Closest cell grid to the mouse in the second - x = (inputs.mouse.point.x / grid.cell_size).to_i - y = (inputs.mouse.point.y / grid.cell_size).to_i + x = (inputs.mouse.point.x / grid.cell_size).to_i + y = (inputs.mouse.point.y / grid.cell_size).to_i # Translate the cell to the first grid x -= (grid.width + 1) * 2 # Bound x and y to the first grid x = 0 if x < 0 y = 0 if y < 0 - x = grid.width - 1 if x > grid.width - 1 - y = grid.height - 1 if y > grid.height - 1 + x = grid.width - 1 if x > grid.width - 1 + y = grid.height - 1 if y > grid.height - 1 # Return closest cell - [x, y] + [x, y] end def reset_searches @@ -21391,21 +22575,21 @@ Follows is a source code listing for all files that have been open sourced. This def calc_dijkstra # Sets up the search to begin from the star - dijkstra.frontier << grid.star - dijkstra.came_from[grid.star] = nil - dijkstra.cost_so_far[grid.star] = 0 + dijkstra.frontier << grid.star + dijkstra.came_from[grid.star] = nil + dijkstra.cost_so_far[grid.star] = 0 # Until the target is found or there are no more cells to explore from until dijkstra.came_from.has_key?(grid.target) or dijkstra.frontier.empty? # Take the next frontier cell. The first element is the cell, the second is the priority. new_frontier = dijkstra.frontier.shift#[0] # For each of its neighbors - adjacent_neighbors(new_frontier).each do | neighbor | + adjacent_neighbors(new_frontier).each do | neighbor | # That have not been visited and are not walls - unless dijkstra.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) + unless dijkstra.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited dijkstra.frontier << neighbor - dijkstra.came_from[neighbor] = new_frontier + dijkstra.came_from[neighbor] = new_frontier dijkstra.cost_so_far[neighbor] = dijkstra.cost_so_far[new_frontier] + 1 end end @@ -21426,20 +22610,20 @@ Follows is a source code listing for all files that have been open sourced. This def calc_greedy # Sets up the search to begin from the star - greedy.frontier << grid.star - greedy.came_from[grid.star] = nil + greedy.frontier << grid.star + greedy.came_from[grid.star] = nil # Until the target is found or there are no more cells to explore from until greedy.came_from.has_key?(grid.target) or greedy.frontier.empty? # Take the next frontier cell - new_frontier = greedy.frontier.shift + new_frontier = greedy.frontier.shift # For each of its neighbors - adjacent_neighbors(new_frontier).each do | neighbor | + adjacent_neighbors(new_frontier).each do | neighbor | # That have not been visited and are not walls - unless greedy.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) + unless greedy.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - greedy.frontier << neighbor - greedy.came_from[neighbor] = new_frontier + greedy.frontier << neighbor + greedy.came_from[neighbor] = new_frontier end end # Sort the frontier so that cells that are in a zigzag pattern are prioritized over those in an line @@ -21469,12 +22653,12 @@ Follows is a source code listing for all files that have been open sourced. This current_frontier = a_star.frontier.shift # For each of that cells neighbors - adjacent_neighbors(current_frontier).each do | neighbor | + adjacent_neighbors(current_frontier).each do | neighbor | # That have not been visited and are not walls - unless a_star.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) + unless a_star.came_from.has_key?(neighbor) or grid.walls.has_key?(neighbor) # Add them to the frontier and mark them as visited - a_star.frontier << neighbor - a_star.came_from[neighbor] = current_frontier + a_star.frontier << neighbor + a_star.came_from[neighbor] = current_frontier a_star.cost_so_far[neighbor] = a_star.cost_so_far[current_frontier] + 1 end end @@ -21556,16 +22740,16 @@ Follows is a source code listing for all files that have been open sourced. This # Returns a list of adjacent cells # Used to determine what the next cells to be added to the frontier are def adjacent_neighbors(cell) - neighbors = [] + neighbors = [] # Gets all the valid neighbors into the array # From southern neighbor, clockwise - neighbors << [cell.x , cell.y - 1] unless cell.y == 0 - neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 - neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 - neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 + neighbors << [cell.x , cell.y - 1] unless cell.y == 0 + neighbors << [cell.x - 1, cell.y ] unless cell.x == 0 + neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1 + neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1 - neighbors + neighbors end # Finds the vertical and horizontal distance of a cell from the star @@ -21610,11 +22794,11 @@ Follows is a source code listing for all files that have been open sourced. This def wall_color [134, 134, 120] # Camo Green end - + def visited_color [204, 191, 179] # Dark Brown end - + def path_color [231, 230, 228] # Pastel White end @@ -21637,7 +22821,7 @@ Follows is a source code listing for all files that have been open sourced. This end # Every tick, new args are passed, and the Breadth First Search tick is called - $a_star_algorithm ||= A_Star_Algorithm.new(args) + $a_star_algorithm ||= A_Star_Algorithm.new $a_star_algorithm.args = args $a_star_algorithm.tick end @@ -22173,6 +23357,363 @@ Follows is a source code listing for all files that have been open sourced. This https://en.wikipedia.org/wiki/OFF_(file_format) #+end_src +*** 3d - Yaw Pitch Roll - main.rb +#+begin_src ruby + # ./samples/99_genre_3d/03_yaw_pitch_roll/app/main.rb + class Game + attr_gtk + + def tick + defaults + render + input + end + + def matrix_mul m, v + (hmap x: ((m.x.x * v.x) + (m.x.y * v.y) + (m.x.z * v.z) + (m.x.w * v.w)), + y: ((m.y.x * v.x) + (m.y.y * v.y) + (m.y.z * v.z) + (m.y.w * v.w)), + z: ((m.z.x * v.x) + (m.z.y * v.y) + (m.z.z * v.z) + (m.z.w * v.w)), + w: ((m.w.x * v.x) + (m.w.y * v.y) + (m.w.z * v.z) + (m.w.w * v.w))) + end + + def player_ship + [ + # engine back + { x: -1, y: -1, z: 1, w: 0 }, + { x: -1, y: 1, z: 1, w: 0 }, + + { x: -1, y: 1, z: 1, w: 0 }, + { x: 1, y: 1, z: 1, w: 0 }, + + { x: 1, y: 1, z: 1, w: 0 }, + { x: 1, y: -1, z: 1, w: 0 }, + + { x: 1, y: -1, z: 1, w: 0 }, + { x: -1, y: -1, z: 1, w: 0 }, + + # engine front + { x: -1, y: -1, z: -1, w: 0 }, + { x: -1, y: 1, z: -1, w: 0 }, + + { x: -1, y: 1, z: -1, w: 0 }, + { x: 1, y: 1, z: -1, w: 0 }, + + { x: 1, y: 1, z: -1, w: 0 }, + { x: 1, y: -1, z: -1, w: 0 }, + + { x: 1, y: -1, z: -1, w: 0 }, + { x: -1, y: -1, z: -1, w: 0 }, + + # engine left + { x: -1, z: -1, y: -1, w: 0 }, + { x: -1, z: -1, y: 1, w: 0 }, + + { x: -1, z: -1, y: 1, w: 0 }, + { x: -1, z: 1, y: 1, w: 0 }, + + { x: -1, z: 1, y: 1, w: 0 }, + { x: -1, z: 1, y: -1, w: 0 }, + + { x: -1, z: 1, y: -1, w: 0 }, + { x: -1, z: -1, y: -1, w: 0 }, + + # engine right + { x: 1, z: -1, y: -1, w: 0 }, + { x: 1, z: -1, y: 1, w: 0 }, + + { x: 1, z: -1, y: 1, w: 0 }, + { x: 1, z: 1, y: 1, w: 0 }, + + { x: 1, z: 1, y: 1, w: 0 }, + { x: 1, z: 1, y: -1, w: 0 }, + + { x: 1, z: 1, y: -1, w: 0 }, + { x: 1, z: -1, y: -1, w: 0 }, + + # top front of engine to front of ship + { x: 1, y: 1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + { x: 0, y: -1, z: 9, w: 0 }, + { x: -1, y: 1, z: 1, w: 0 }, + + # bottom front of engine + { x: 1, y: -1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + { x: -1, y: -1, z: 1, w: 0 }, + { x: 0, y: -1, z: 9, w: 0 }, + + # right wing + # front of wing + { x: 1, y: 0.10, z: 1, w: 0 }, + { x: 9, y: 0.10, z: -1, w: 0 }, + + { x: 9, y: 0.10, z: -1, w: 0 }, + { x: 10, y: 0.10, z: -2, w: 0 }, + + # back of wing + { x: 1, y: 0.10, z: -1, w: 0 }, + { x: 9, y: 0.10, z: -1, w: 0 }, + + { x: 10, y: 0.10, z: -2, w: 0 }, + { x: 8, y: 0.10, z: -1, w: 0 }, + + # front of wing + { x: 1, y: -0.10, z: 1, w: 0 }, + { x: 9, y: -0.10, z: -1, w: 0 }, + + { x: 9, y: -0.10, z: -1, w: 0 }, + { x: 10, y: -0.10, z: -2, w: 0 }, + + # back of wing + { x: 1, y: -0.10, z: -1, w: 0 }, + { x: 9, y: -0.10, z: -1, w: 0 }, + + { x: 10, y: -0.10, z: -2, w: 0 }, + { x: 8, y: -0.10, z: -1, w: 0 }, + + # left wing + # front of wing + { x: -1, y: 0.10, z: 1, w: 0 }, + { x: -9, y: 0.10, z: -1, w: 0 }, + + { x: -9, y: 0.10, z: -1, w: 0 }, + { x: -10, y: 0.10, z: -2, w: 0 }, + + # back of wing + { x: -1, y: 0.10, z: -1, w: 0 }, + { x: -9, y: 0.10, z: -1, w: 0 }, + + { x: -10, y: 0.10, z: -2, w: 0 }, + { x: -8, y: 0.10, z: -1, w: 0 }, + + # front of wing + { x: -1, y: -0.10, z: 1, w: 0 }, + { x: -9, y: -0.10, z: -1, w: 0 }, + + { x: -9, y: -0.10, z: -1, w: 0 }, + { x: -10, y: -0.10, z: -2, w: 0 }, + + # back of wing + { x: -1, y: -0.10, z: -1, w: 0 }, + { x: -9, y: -0.10, z: -1, w: 0 }, + + { x: -10, y: -0.10, z: -2, w: 0 }, + { x: -8, y: -0.10, z: -1, w: 0 }, + + # left fin + # top + { x: -1, y: 0.10, z: 1, w: 0 }, + { x: -1, y: 3, z: -3, w: 0 }, + + { x: -1, y: 0.10, z: -1, w: 0 }, + { x: -1, y: 3, z: -3, w: 0 }, + + { x: -1.1, y: 0.10, z: 1, w: 0 }, + { x: -1.1, y: 3, z: -3, w: 0 }, + + { x: -1.1, y: 0.10, z: -1, w: 0 }, + { x: -1.1, y: 3, z: -3, w: 0 }, + + # bottom + { x: -1, y: -0.10, z: 1, w: 0 }, + { x: -1, y: -2, z: -2, w: 0 }, + + { x: -1, y: -0.10, z: -1, w: 0 }, + { x: -1, y: -2, z: -2, w: 0 }, + + { x: -1.1, y: -0.10, z: 1, w: 0 }, + { x: -1.1, y: -2, z: -2, w: 0 }, + + { x: -1.1, y: -0.10, z: -1, w: 0 }, + { x: -1.1, y: -2, z: -2, w: 0 }, + + # right fin + { x: 1, y: 0.10, z: 1, w: 0 }, + { x: 1, y: 3, z: -3, w: 0 }, + + { x: 1, y: 0.10, z: -1, w: 0 }, + { x: 1, y: 3, z: -3, w: 0 }, + + { x: 1.1, y: 0.10, z: 1, w: 0 }, + { x: 1.1, y: 3, z: -3, w: 0 }, + + { x: 1.1, y: 0.10, z: -1, w: 0 }, + { x: 1.1, y: 3, z: -3, w: 0 }, + + # bottom + { x: 1, y: -0.10, z: 1, w: 0 }, + { x: 1, y: -2, z: -2, w: 0 }, + + { x: 1, y: -0.10, z: -1, w: 0 }, + { x: 1, y: -2, z: -2, w: 0 }, + + { x: 1.1, y: -0.10, z: 1, w: 0 }, + { x: 1.1, y: -2, z: -2, w: 0 }, + + { x: 1.1, y: -0.10, z: -1, w: 0 }, + { x: 1.1, y: -2, z: -2, w: 0 }, + ] + end + + def defaults + state.points ||= player_ship + state.shifted_points ||= state.points.map { |point| point } + + state.scale ||= 1 + state.angle_x ||= 0 + state.angle_y ||= 0 + state.angle_z ||= 0 + end + + def matrix_new x0, y0, z0, w0, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3 + (hmap x: (hmap x: x0, y: y0, z: z0, w: w0), + y: (hmap x: x1, y: y1, z: z1, w: w1), + z: (hmap x: x2, y: y2, z: z2, w: w2), + w: (hmap x: x3, y: y3, z: z3, w: w3)) + end + + def angle_z_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new cos_t, -sin_t, 0, 0, + sin_t, cos_t, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1) + end + + def angle_y_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new cos_t, 0, sin_t, 0, + 0, 1, 0, 0, + -sin_t, 0, cos_t, 0, + 0, 0, 0, 1) + end + + def angle_x_matrix degrees + cos_t = Math.cos degrees.to_radians + sin_t = Math.sin degrees.to_radians + (matrix_new 1, 0, 0, 0, + 0, cos_t, -sin_t, 0, + 0, sin_t, cos_t, 0, + 0, 0, 0, 1) + end + + def scale_matrix factor + (matrix_new factor, 0, 0, 0, + 0, factor, 0, 0, + 0, 0, factor, 0, + 0, 0, 0, 1) + end + + def input + if (inputs.keyboard.shift && inputs.keyboard.p) + state.scale -= 0.1 + elsif inputs.keyboard.p + state.scale += 0.1 + end + + if inputs.mouse.wheel + state.scale += inputs.mouse.wheel.y + end + + state.scale = state.scale.clamp(0.1, 1000) + + if (inputs.keyboard.shift && inputs.keyboard.y) || inputs.keyboard.right + state.angle_y += 1 + elsif (inputs.keyboard.y) || inputs.keyboard.left + state.angle_y -= 1 + end + + if (inputs.keyboard.shift && inputs.keyboard.x) || inputs.keyboard.down + state.angle_x -= 1 + elsif (inputs.keyboard.x || inputs.keyboard.up) + state.angle_x += 1 + end + + if inputs.keyboard.shift && inputs.keyboard.z + state.angle_z += 1 + elsif inputs.keyboard.z + state.angle_z -= 1 + end + + if inputs.keyboard.zero + state.angle_x = 0 + state.angle_y = 0 + state.angle_z = 0 + end + + angle_x = state.angle_x + angle_y = state.angle_y + angle_z = state.angle_z + scale = state.scale + + s_matrix = scale_matrix state.scale + x_matrix = angle_z_matrix angle_z + y_matrix = angle_y_matrix angle_y + z_matrix = angle_x_matrix angle_x + + state.shifted_points = state.points.map do |point| + (matrix_mul s_matrix, + (matrix_mul z_matrix, + (matrix_mul x_matrix, + (matrix_mul y_matrix, point)))).merge(original: point) + end + end + + def thick_line line + [ + line.merge(y: line.y - 1, y2: line.y2 - 1, r: 0, g: 0, b: 0), + line.merge(x: line.x - 1, x2: line.x2 - 1, r: 0, g: 0, b: 0), + line.merge(x: line.x - 0, x2: line.x2 - 0, r: 0, g: 0, b: 0), + line.merge(y: line.y + 1, y2: line.y2 + 1, r: 0, g: 0, b: 0), + line.merge(x: line.x + 1, x2: line.x2 + 1, r: 0, g: 0, b: 0) + ] + end + + def render + outputs.lines << state.shifted_points.each_slice(2).map do |(p1, p2)| + perc = 0 + thick_line({ x: p1.x.*(10) + 640, y: p1.y.*(10) + 320, + x2: p2.x.*(10) + 640, y2: p2.y.*(10) + 320, + r: 255 * perc, + g: 255 * perc, + b: 255 * perc }) + end + + outputs.labels << [ 10, 700, "angle_x: #{state.angle_x.to_sf}", 0] + outputs.labels << [ 10, 670, "x, shift+x", 0] + + outputs.labels << [210, 700, "angle_y: #{state.angle_y.to_sf}", 0] + outputs.labels << [210, 670, "y, shift+y", 0] + + outputs.labels << [410, 700, "angle_z: #{state.angle_z.to_sf}", 0] + outputs.labels << [410, 670, "z, shift+z", 0] + + outputs.labels << [610, 700, "scale: #{state.scale.to_sf}", 0] + outputs.labels << [610, 670, "p, shift+p", 0] + end + end + + $game = Game.new + + def tick args + $game.args = args + $game.tick + end + + def set_angles x, y, z + $game.state.angle_x = x + $game.state.angle_y = y + $game.state.angle_z = z + end + + $gtk.reset + +#+end_src + *** Arcade - Bullet Hell - main.rb #+begin_src ruby # ./samples/99_genre_arcade/bullet_hell/app/main.rb @@ -22791,31 +24332,36 @@ Follows is a source code listing for all files that have been open sourced. This end def render_score - outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label - outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label - outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + outputs.primitives << { x: 10, y: 710, text: "HI SCORE: #{state.hi_score}", **large_white_typeset } + outputs.primitives << { x: 10, y: 680, text: "SCORE: #{state.score}", **large_white_typeset } + outputs.primitives << { x: 10, y: 650, text: "DIFFICULTY: #{state.difficulty.upcase}", **large_white_typeset } end def render_menu return unless state.scene == :menu render_overlay - outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] - outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] - outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] - outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] - outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] - outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] - outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + outputs.labels << { x: 640, y: 700, text: "Flappy Dragon", size_enum: 50, alignment_enum: 1, **white } + outputs.labels << { x: 640, y: 500, text: "Instructions: Press Spacebar to flap. Don't die.", size_enum: 4, alignment_enum: 1, **white } + outputs.labels << { x: 430, y: 430, text: "[Tab] Change difficulty", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 430, y: 400, text: "[Enter] Start at New Difficulty ", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 430, y: 370, text: "[Escape] Cancel/Resume ", size_enum: 4, alignment_enum: 0, **white } + outputs.labels << { x: 640, y: 300, text: "(mouse, touch, and game controllers work, too!) ", size_enum: 4, alignment_enum: 1, **white } + outputs.labels << { x: 640, y: 200, text: "Difficulty: #{state.new_difficulty.capitalize}", size_enum: 4, alignment_enum: 1, **white } - outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] - outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] - outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] - outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + outputs.labels << { x: 10, y: 100, text: "Code: @amirrajan", **white } + outputs.labels << { x: 10, y: 80, text: "Art: @mobypixel", **white } + outputs.labels << { x: 10, y: 60, text: "Music: @mobypixel", **white } + outputs.labels << { x: 10, y: 40, text: "Engine: DragonRuby GTK", **white } end def render_overlay - outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + overlay_rect = grid.rect.scale_rect(1.1, 0, 0) + outputs.primitives << { x: overlay_rect.x, + y: overlay_rect.y, + w: overlay_rect.w, + h: overlay_rect.h, + r: 0, g: 0, b: 0, a: 230 }.solid! end def render_game @@ -22828,14 +24374,14 @@ Follows is a source code listing for all files that have been open sourced. This def render_game_over return unless state.scene == :game - outputs.labels << [638, 358, score_text, 20, 1] - outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] - outputs.labels << [638, 428, countdown_text, 20, 1] - outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + outputs.labels << { x: 638, y: 358, text: score_text, size_enum: 20, alignment_enum: 1 } + outputs.labels << { x: 635, y: 360, text: score_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } + outputs.labels << { x: 638, y: 428, text: countdown_text, size_enum: 20, alignment_enum: 1 } + outputs.labels << { x: 635, y: 430, text: countdown_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } end def render_background - outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: 'sprites/background.png' } scroll_point_at = state.tick_count scroll_point_at = state.scene_at if state.scene == :menu @@ -22847,11 +24393,18 @@ Follows is a source code listing for all files that have been open sourced. This outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) end + def scrolling_background at, path, rate, y = 0 + [ + { x: 0 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path }, + { x: 1440 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path } + ] + end + def render_walls state.walls.each do |w| w.sprites = [ - [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], - [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] + { x: w.x, y: w.bottom_height - 720, w: 100, h: 720, path: 'sprites/wall.png', angle: 180 }, + { x: w.x, y: w.top_y, w: 100, h: 720, path: 'sprites/wallbottom.png', angle: 0 } ] end outputs.sprites << state.walls.map(&:sprites) @@ -22860,15 +24413,13 @@ Follows is a source code listing for all files that have been open sourced. This def render_dragon state.show_death = true if state.countdown == 3.seconds - render_debug_hitbox false - if state.show_death == false || !state.death_at animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } else sprite_name = "sprites/dragon_die.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction @@ -22878,20 +24429,12 @@ Follows is a source code listing for all files that have been open sourced. This outputs.sprites << state.dragon_sprite end - def render_debug_hitbox show - return unless show - outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite - outputs.borders << state.walls.flat_map do |w| - w.sprites.map { |s| [s.rect, 255, 0, 0] } - end - end - def render_flash return unless state.flash_at - outputs.primitives << [grid.rect, - white, - 255 * state.flash_at.ease(20, :flip)].solid + outputs.primitives << { **grid.rect.to_hash, + **white, + a: 255 * state.flash_at.ease(20, :flip) }.solid! state.flash_at = 0 if state.flash_at.elapsed_time > 20 end @@ -23011,19 +24554,12 @@ Follows is a source code listing for all files that have been open sourced. This end end - def scrolling_background at, path, rate, y = 0 - [ - [ 0 - at.*(rate) % 1440, y, 1440, 720, path], - [1440 - at.*(rate) % 1440, y, 1440, 720, path] - ] - end - def white - [255, 255, 255] + { r: 255, g: 255, b: 255 } end def large_white_typeset - [5, 0, 255, 255, 255] + { size_enum: 5, alignment_enum: 0, r: 255, g: 255, b: 255 } end def at_beginning? @@ -23032,9 +24568,9 @@ Follows is a source code listing for all files that have been open sourced. This def dragon_collision_box state.dragon_sprite - .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) - .rect_shift_right(10) - .rect_shift_up(state.dy * 2) + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) + .rect_shift_right(10) + .rect_shift_up(state.dy * 2) end def game_over? @@ -23043,7 +24579,7 @@ Follows is a source code listing for all files that have been open sourced. This state.walls .flat_map { |w| w.sprites } .any? do |s| - s.intersect_rect?(dragon_collision_box) + s && s.intersect_rect?(dragon_collision_box) end end @@ -24345,6 +25881,131 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Crafting - Farming Game Starting Point - main.rb +#+begin_src ruby + # ./samples/99_genre_crafting/farming_game_starting_point/app/main.rb + def tick args + args.state.tile_size = 80 + args.state.player_speed = 4 + args.state.player ||= tile(args, 7, 3, 0, 128, 180) + generate_map args + #press j to plant a green onion + if args.inputs.keyboard.j + #change this part you can change what you want to plant + args.state.walls << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y)/args.state.tile_size), 255, 255, 255) + args.state.plants << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y+80)/args.state.tile_size), 0, 160, 0) + end + # Adds walls, background, and player to args.outputs.solids so they appear on screen + args.outputs.solids << [0,0,1280,720, 237,189,101] + args.outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + args.outputs.solids << args.state.walls + args.outputs.solids << args.state.player + args.outputs.solids << args.state.plants + args.outputs.labels << [320, 640, "press J to plant", 3, 1, 255, 0, 0, 200] + + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed + end + + # Sets position, size, and color of the tile + def tile args, x, y, *color + [x * args.state.tile_size, # sets definition for array using method parameters + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values + args.state.tile_size, + args.state.tile_size, + *color] + end + + # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) + def generate_map args + return if args.state.area + + # Creates the area of the map. There are 9 rows running horizontally across the screen + # and 16 columns running vertically on the screen. Any spot with a "1" is not + # open for the player to move into (and is green), and any spot with a "0" is available + # for the player to move in. + args.state.area = [ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + ].reverse # reverses the order of the area collection + + # By reversing the order, the way that the area appears above is how it appears + # on the screen in the game. If we did not reverse, the map would appear inverted. + + #The wall starts off with no tiles. + args.state.walls = [] + args.state.plants = [] + + # If v is 1, a green tile is added to args.state.walls. + # If v is 2, a black tile is created as the goal. + args.state.area.map_2d do |y, x, v| + if v == 1 + args.state.walls << tile(args, x, y, 255, 160, 156) # green tile + end + end + end + + # Allows the player to move their box around the screen + def move_player args, *vector + box = args.state.player.shift_rect(vector) # box is able to move at an angle + + # If the player's box hits a wall, it is not able to move further in that direction + return if args.state.walls + .any_intersect_rect?(box) + + # Player's box is able to move at angles (not just the four general directions) fast + args.state.player = + args.state.player + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then + vector.y * args.state.player_speed) # the box will move extremely slow + end + +#+end_src + +*** Crafting - Farming Game Starting Point - tests.rb +#+begin_src ruby + # ./samples/99_genre_crafting/farming_game_starting_point/app/tests.rb + # For advanced users:
+ # You can put some quick verification tests here, any method
+ # that starts with the `test_` will be run when you save this file.
+
+ # Here is an example test and game
+
+ # To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick
+
+ class MySuperHappyFunGame
+ attr_gtk
+
+ def tick
+ outputs.solids << [100, 100, 300, 300]
+ end
+ end
+
+ def test_universe args, assert
+ game = MySuperHappyFunGame.new
+ game.args = args
+ game.tick
+ assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick"
+ assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending"
+ puts "test_universe completed successfully"
+ end
+
+ puts "running tests"
+ $gtk.reset 100
+ $gtk.log_level = :off
+ $gtk.tests.start
+ +#+end_src + *** Dev Tools - Add Buttons To Console - main.rb #+begin_src ruby # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb @@ -24515,12 +26176,12 @@ Follows is a source code listing for all files that have been open sourced. This label = { x: b.x + state.buttons_frame_selection.size.half, y: b.y, text: "#{i + 1}", r: 180, g: 180, b: 180, - size_enum: -4, alignment_enum: 1 }.label + size_enum: -4, alignment_enum: 1 }.label! - selection_border = b.merge(r: 40, g: 40, b: 40).border + selection_border = b.merge(r: 40, g: 40, b: 40).border! if i == state.animation_frames_selected_index - selection_border = b.merge(r: 40, g: 230, b: 200).border + selection_border = b.merge(r: 40, g: 230, b: 200).border! end [selection_border, label] @@ -25257,6 +26918,528 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Dungeon Crawl - Classics Jam - main.rb +#+begin_src ruby + # ./samples/99_genre_dungeon_crawl/classics_jam/app/main.rb + class Game + attr_gtk + + def tick + defaults + render + input + calc + end + + def defaults + player.x ||= 640 + player.y ||= 360 + player.w ||= 16 + player.h ||= 16 + player.attacked_at ||= -1 + player.angle ||= 0 + player.future_player ||= future_player_position 0, 0 + player.projectiles ||= [] + player.damage ||= 0 + state.level ||= create_level level_one_template + end + + def render + outputs.sprites << level.walls.map do |w| + w.merge(path: 'sprites/square/gray.png') + end + + outputs.sprites << level.spawn_locations.map do |s| + s.merge(path: 'sprites/square/blue.png') + end + + outputs.sprites << player.projectiles.map do |p| + p.merge(path: 'sprites/square/blue.png') + end + + outputs.sprites << level.enemies.map do |e| + e.merge(path: 'sprites/square/red.png') + end + + outputs.sprites << player.merge(path: 'sprites/circle/green.png', angle: player.angle) + + outputs.labels << { x: 30, y: 30.from_top, text: "damage: #{player.damage || 0}" } + end + + def input + player.angle = inputs.directional_angle || player.angle + if inputs.controller_one.key_down.a || inputs.keyboard.key_down.space + player.attacked_at = state.tick_count + end + end + + def calc + calc_player + calc_projectiles + calc_enemies + calc_spawn_locations + end + + def calc_player + if player.attacked_at == state.tick_count + player.projectiles << { at: state.tick_count, + x: player.x, + y: player.y, + angle: player.angle, + w: 4, + h: 4 }.center_inside_rect(player) + end + + if player.attacked_at.elapsed_time > 5 + future_player = future_player_position inputs.left_right * 2, inputs.up_down * 2 + future_player_collision = future_collision player, future_player, level.walls + player.x = future_player_collision.x if !future_player_collision.dx_collision + player.y = future_player_collision.y if !future_player_collision.dy_collision + end + end + + def calc_projectile_collisions entities + entities.each do |e| + e.damage ||= 0 + player.projectiles.each do |p| + if !p.collided && (p.intersect_rect? e) + p.collided = true + e.damage += 1 + end + end + end + end + + def calc_projectiles + player.projectiles.map! do |p| + dx, dy = p.angle.vector 10 + p.merge(x: p.x + dx, y: p.y + dy) + end + + calc_projectile_collisions level.walls + level.enemies + level.spawn_locations + player.projectiles.reject! { |p| p.at.elapsed_time > 10000 } + player.projectiles.reject! { |p| p.collided } + level.enemies.reject! { |e| e.damage > e.hp } + level.spawn_locations.reject! { |s| s.damage > s.hp } + end + + def calc_enemies + level.enemies.map! do |e| + dx = 0 + dx = 1 if e.x < player.x + dx = -1 if e.x > player.x + dy = 0 + dy = 1 if e.y < player.y + dy = -1 if e.y > player.y + future_e = future_entity_position dx, dy, e + future_e_collision = future_collision e, future_e, level.enemies + level.walls + e.next_x = e.x + e.next_y = e.y + e.next_x = future_e_collision.x if !future_e_collision.dx_collision + e.next_y = future_e_collision.y if !future_e_collision.dy_collision + e + end + + level.enemies.map! do |e| + e.x = e.next_x + e.y = e.next_y + e + end + + level.enemies.each do |e| + player.damage += 1 if e.intersect_rect? player + end + end + + def calc_spawn_locations + level.spawn_locations.map! do |s| + s.merge(countdown: s.countdown - 1) + end + level.spawn_locations + .find_all { |s| s.countdown.neg? } + .each do |s| + s.countdown = s.rate + s.merge(countdown: s.rate) + new_enemy = create_enemy s + if !(level.enemies.find { |e| e.intersect_rect? new_enemy }) + level.enemies << new_enemy + end + end + end + + def create_enemy spawn_location + to_cell(spawn_location.ordinal_x, spawn_location.ordinal_y).merge hp: 2 + end + + def create_level level_template + { + walls: level_template.walls.map { |w| to_cell(w.ordinal_x, w.ordinal_y).merge(w) }, + enemies: [], + spawn_locations: level_template.spawn_locations.map { |s| to_cell(s.ordinal_x, s.ordinal_y).merge(s) } + } + end + + def level_one_template + { + walls: [{ ordinal_x: 25, ordinal_y: 20}, + { ordinal_x: 25, ordinal_y: 21}, + { ordinal_x: 25, ordinal_y: 22}, + { ordinal_x: 25, ordinal_y: 23}], + spawn_locations: [{ ordinal_x: 10, ordinal_y: 10, rate: 120, countdown: 0, hp: 5 }] + } + end + + def player + state.player ||= {} + end + + def level + state.level ||= {} + end + + def future_collision entity, future_entity, others + dx_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dx) } + dy_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dy) } + + { + dx_collision: dx_collision, + x: future_entity.dx.x, + dy_collision: dy_collision, + y: future_entity.dy.y + } + end + + def future_entity_position dx, dy, entity + { + dx: entity.merge(x: entity.x + dx), + dy: entity.merge(y: entity.y + dy), + both: entity.merge(x: entity.x + dx, y: entity.y + dy) + } + end + + def future_player_position dx, dy + future_entity_position dx, dy, player + end + + def to_cell ordinal_x, ordinal_y + { x: ordinal_x * 16, y: ordinal_y * 16, w: 16, h: 16 } + end + end + + def tick args + $game ||= Game.new + $game.args = args + $game.tick + end + + $gtk.reset + $game = nil + +#+end_src + +*** Fighting - Special Move Inputs - main.rb +#+begin_src ruby + # ./samples/99_genre_fighting/01_special_move_inputs/app/main.rb + def tick args + #tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." + defaults args + render args + input args + calc args + end + + # sets default values and creates empty collections + # initialization only happens in the first frame + def defaults args + fiddle args + + args.state.tick_count = args.state.tick_count + args.state.bridge_top = 128 + args.state.player.x ||= 0 # initializes player's properties + args.state.player.y ||= args.state.bridge_top + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.dy ||= 0 + args.state.player.dx ||= 0 + args.state.player.r ||= 0 + args.state.game_over_at ||= 0 + args.state.animation_time ||=0 + + args.state.timeleft ||=0 + args.state.timeright ||=0 + args.state.lastpush ||=0 + + args.state.inputlist ||= ["j","k","l"] + end + + # sets enemy, player, hammer values + def fiddle args + args.state.gravity = -0.5 + args.state.player_jump_power = 10 # sets player values + args.state.player_jump_power_duration = 5 + args.state.player_max_run_speed = 20 + args.state.player_speed_slowdown_rate = 0.9 + args.state.player_acceleration = 0.9 + end + + # outputs objects onto the screen + def render args + if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01) + args.state.player.dx = 0 + end + + #move list + (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3, + merge: { vertical_alignment_enum: 0, size_enum: -2 }, + group: [ + { text: "move: WASD" }, + { text: "jump: Space" }, + { text: "attack forwards: J (while on ground" }, + { text: "attack upwards: K (while on groud)" }, + { text: "attack backwards: J (while on ground and holding A)" }, + { text: "attack downwards: K (while in air)" }, + { text: "dash attack: J, K in quick succession." }, + { text: "shield: hold J, K at the same time." }, + { text: "dash backwards: A, A in quick succession." }, + ]).into args.outputs.labels + + # registered moves + args.outputs.labels << { x: 0.to_layout_col, + y: 0.to_layout_row, + text: "input history", + size_enum: -2, + vertical_alignment_enum: 0 } + + (args.state.inputlist.take(5)).map do |s| + { text: s, size_enum: -2, vertical_alignment_enum: 0 } + end.yield_self do |group| + (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels + end + + + #sprites + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/white.png", + args.state.player.r] + + playershield = [args.state.player.x - 20, args.state.player.y - 10, + args.state.player.w + 20, args.state.player.h + 20, + "sprites/square/blue.png", + args.state.player.r, + 0] + + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", + args.state.player.r, + 0] + + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", + args.state.player.r+90, + 0] + + if ((args.state.tick_count - args.state.lastpush) <= 15) + if (args.state.inputlist[0] == "<<") + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/yellow.png", args.state.player.r] + end + + if (args.state.inputlist[0] == "shield") + player = [args.state.player.x, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/square/indigo.png", args.state.player.r] + + playershield = [args.state.player.x - 10, args.state.player.y - 10, + args.state.player.w + 20, args.state.player.h + 20, + "sprites/square/blue.png", args.state.player.r, 50] + end + + if (args.state.inputlist[0] == "back-attack") + playerjab = [args.state.player.x - 20, args.state.player.y, + args.state.player.w - 10, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r, 255] + end + + if (args.state.inputlist[0] == "forward-attack") + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r, 255] + end + + if (args.state.inputlist[0] == "up-attack") + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] + end + + if (args.state.inputlist[0] == "dair") + playerupper = [args.state.player.x, args.state.player.y - 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] + end + + if (args.state.inputlist[0] == "dash-attack") + playerupper = [args.state.player.x, args.state.player.y + 32, + args.state.player.w, args.state.player.h, + "sprites/isometric/violet.png", args.state.player.r + 90, 255] + + playerjab = [args.state.player.x + 32, args.state.player.y, + args.state.player.w, args.state.player.h, + "sprites/isometric/violet.png", args.state.player.r, 255] + end + end + + args.outputs.sprites << playerjab + args.outputs.sprites << playerupper + args.outputs.sprites << player + args.outputs.sprites << playershield + + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge + [i * 64, args.state.bridge_top - 64, 64, 64] + end + end + + # Performs calculations to move objects on the screen + def calc args + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. + args.state.player.x += args.state.player.dx + args.state.player.y += args.state.player.dy + + # Since acceleration is the change in velocity, the change in y (dy) increases every frame + args.state.player.dy += args.state.gravity + + # player's y position is either current y position or y position of top of + # bridge, whichever has a greater value + # ensures that the player never goes below the bridge + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) + + # player's x position is either the current x position or 0, whichever has a greater value + # ensures that the player doesn't go too far left (out of the screen's scope) + args.state.player.x = args.state.player.x.greater(0) + + # player is not falling if it is located on the top of the bridge + args.state.player.falling = false if args.state.player.y == args.state.bridge_top + #args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player + end + + # Resets the player by changing its properties back to the values they had at initialization + def reset_player args + args.state.player.x = 0 + args.state.player.y = args.state.bridge_top + args.state.player.dy = 0 + args.state.player.dx = 0 + args.state.enemy.hammers.clear # empties hammer collection + args.state.enemy.hammer_queue.clear # empties hammer_queue + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) + end + + # Processes input from the user to move the player + def input args + if args.state.inputlist.length > 5 + args.state.inputlist.pop + end + + should_process_special_move = (args.inputs.keyboard.key_down.j) || + (args.inputs.keyboard.key_down.k) || + (args.inputs.keyboard.key_down.a) || + (args.inputs.keyboard.key_down.d) || + (args.inputs.controller_one.key_down.y) || + (args.inputs.controller_one.key_down.x) || + (args.inputs.controller_one.key_down.left) || + (args.inputs.controller_one.key_down.right) + + if (should_process_special_move) + if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) || + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y) + args.state.inputlist.unshift("shield") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && + (args.state.inputlist[0] == "forward-attack") && ((args.state.tick_count - args.state.lastpush) <= 15) + args.state.inputlist.unshift("dash-attack") + args.state.player.dx = 20 + elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) || + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left) + args.state.inputlist.unshift("back-attack") + elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j) + args.state.inputlist.unshift("forward-attack") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && + (args.state.player.y > 128) + args.state.inputlist.unshift("dair") + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) + args.state.inputlist.unshift("up-attack") + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) && + (args.state.inputlist[0] == "<") && + ((args.state.tick_count - args.state.lastpush) <= 10) + args.state.inputlist.unshift("<<") + args.state.player.dx = -15 + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) + args.state.inputlist.unshift("<") + args.state.timeleft = args.state.tick_count + elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d) + args.state.inputlist.unshift(">") + end + + args.state.lastpush = args.state.tick_count + end + + if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame + + # if the time that has passed since the jump is less than the player's jump duration and + # the player is not falling + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump + end + end + + # if the space bar is in the "up" state (or not being pressed down) + if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2 + args.state.player.jumped_at = nil # jumped_at is empty + args.state.player.falling = true # the player is falling + end + + if args.inputs.left # if left key is pressed + if args.state.player.dx < -5 + args.state.player.dx = args.state.player.dx + else + args.state.player.dx = -5 + end + + elsif args.inputs.right # if right key is pressed + if args.state.player.dx > 5 + args.state.player.dx = args.state.player.dx + else + args.state.player.dx = 5 + end + else + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down + end + + if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10) + args.state.player.dx *= 0.95 + end + end + + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + *** Lowrez - Nokia 3310 - main.rb #+begin_src ruby # ./samples/99_genre_lowrez/nokia_3310/app/main.rb @@ -25867,7 +28050,7 @@ Follows is a source code listing for all files that have been open sourced. This text: text, size_enum: -1.5, r: 255, g: 255, b: 255 - }.label + }.label! end args.outputs.debug << { @@ -25877,7 +28060,7 @@ Follows is a source code listing for all files that have been open sourced. This size_enum: -0.5, alignment_enum: 1, r: 255, g: 255, b: 255 - }.label + }.label! end def snake_demo args @@ -26129,7 +28312,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 240, b: 216, a: 100 - }.line + }.line! end (NOKIA_WIDTH + 1).map_with_index do |i| @@ -26142,7 +28325,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 240, b: 216, a: 100 - }.line + }.line! end @args.state.overlay_rendered = true @@ -26894,7 +29077,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 128, b: 128, a: 80 - }.line + }.line! args.outputs.static_debug << { x: LOWREZ_X_OFFSET + (i * 10), @@ -26905,7 +29088,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 128, b: 128, a: 80 - }.line + }.line! end end @@ -26932,7 +29115,7 @@ Follows is a source code listing for all files that have been open sourced. This y: 720 - (i * 20), text: text, size_enum: -1.5 - }.label + }.label! end args.outputs.debug << { @@ -26941,7 +29124,378 @@ Follows is a source code listing for all files that have been open sourced. This text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.", size_enum: -0.5, alignment_enum: 1 - }.label + }.label! + end + + $gtk.reset + +#+end_src + +*** Mario - Jumping - main.rb +#+begin_src ruby + # ./samples/99_genre_mario/01_jumping/app/main.rb + def tick args + defaults args + render args + input args + calc args + end + + def defaults args + args.state.player.x ||= args.grid.w.half + args.state.player.y ||= 0 + args.state.player.size ||= 100 + args.state.player.dy ||= 0 + args.state.player.action ||= :jumping + args.state.jump.power = 20 + args.state.jump.increase_frames = 10 + args.state.jump.increase_power = 1 + args.state.gravity = -1 + end + + def render args + args.outputs.sprites << { + x: args.state.player.x - + args.state.player.size.half, + y: args.state.player.y, + w: args.state.player.size, + h: args.state.player.size, + path: 'sprites/square/red.png' + } + end + + def input args + if args.inputs.keyboard.key_down.space + if args.state.player.action == :standing + args.state.player.action = :jumping + args.state.player.dy = args.state.jump.power + + # record when the action took place + current_frame = args.state.tick_count + args.state.player.action_at = current_frame + end + end + + # if the space bar is being held + if args.inputs.keyboard.key_held.space + # is the player jumping + is_jumping = args.state.player.action == :jumping + + # when was the jump performed + time_of_jump = args.state.player.action_at + + # how much time has passed since the jump + jump_elapsed_time = time_of_jump.elapsed_time + + # how much time is allowed for increasing power + time_allowed = args.state.jump.increase_frames + + # if the player is jumping + # and the elapsed time is less than + # the allowed time + if is_jumping && jump_elapsed_time < time_allowed + # increase the dy by the increase power + power_to_add = args.state.jump.increase_power + args.state.player.dy += power_to_add + end + end + end + + def calc args + if args.state.player.action == :jumping + args.state.player.y += args.state.player.dy + args.state.player.dy += args.state.gravity + end + + if args.state.player.y < 0 + args.state.player.y = 0 + args.state.player.action = :standing + end + end + +#+end_src + +*** Mario - Jumping And Collisions - main.rb +#+begin_src ruby + # ./samples/99_genre_mario/02_jumping_and_collisions/app/main.rb + class Game + attr_gtk + + def tick + defaults + render + input + calc + end + + def defaults + return if state.tick_count != 0 + + player.x = 64 + player.y = 800 + player.size = 50 + player.dx = 0 + player.dy = 0 + player.action = :falling + + player.max_speed = 20 + player.jump_power = 15 + player.jump_air_time = 15 + player.jump_increase_power = 1 + + state.gravity = -1 + state.drag = 0.001 + state.tile_size = 64 + state.tiles ||= [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 3, ordinal_y: 0 }, + { ordinal_x: 4, ordinal_y: 0 }, + { ordinal_x: 5, ordinal_y: 0 }, + { ordinal_x: 6, ordinal_y: 0 }, + { ordinal_x: 7, ordinal_y: 0 }, + { ordinal_x: 8, ordinal_y: 0 }, + { ordinal_x: 9, ordinal_y: 0 }, + { ordinal_x: 10, ordinal_y: 0 }, + { ordinal_x: 11, ordinal_y: 0 }, + { ordinal_x: 12, ordinal_y: 0 }, + + { ordinal_x: 9, ordinal_y: 3 }, + { ordinal_x: 10, ordinal_y: 3 }, + { ordinal_x: 11, ordinal_y: 3 }, + ] + + tiles.each do |t| + t.rect = { x: t.ordinal_x * 64, + y: t.ordinal_y * 64, + w: 64, + h: 64 } + end + end + + def render + render_player + render_tiles + # render_grid + end + + def input + input_jump + input_move + end + + def calc + calc_player_rect + calc_left + calc_right + calc_below + calc_above + calc_player_dy + calc_player_dx + calc_game_over + end + + def render_player + outputs.sprites << { + x: player.x, + y: player.y, + w: player.size, + h: player.size, + path: 'sprites/square/red.png' + } + end + + def render_tiles + outputs.sprites << state.tiles.map do |t| + t.merge path: 'sprites/square/white.png', + x: t.ordinal_x * 64, + y: t.ordinal_y * 64, + w: 64, + h: 64 + end + end + + def render_grid + if state.tick_count == 0 + outputs[:grid].background_color = [0, 0, 0, 0] + outputs[:grid].borders << available_brick_locations + outputs[:grid].labels << available_brick_locations.map do |b| + [ + b.merge(text: "#{b.ordinal_x},#{b.ordinal_y}", + x: b.x + 2, + y: b.y + 2, + size_enum: -3, + vertical_alignment_enum: 0, + blendmode_enum: 0), + b.merge(text: "#{b.x},#{b.y}", + x: b.x + 2, + y: b.y + 2 + 20, + size_enum: -3, + vertical_alignment_enum: 0, + blendmode_enum: 0) + ] + end + end + + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :grid } + end + + def input_jump + if inputs.keyboard.key_down.space + player_jump + end + + if inputs.keyboard.key_held.space + player_jump_increase_air_time + end + end + + def input_move + if player.dx.abs < 20 + if inputs.keyboard.left + player.dx -= 2 + elsif inputs.keyboard.right + player.dx += 2 + end + end + end + + def calc_game_over + if player.y < -64 + player.x = 64 + player.y = 800 + player.dx = 0 + player.dy = 0 + end + end + + def calc_player_rect + player.rect = player_current_rect + player.next_rect = player_next_rect + player.prev_rect = player_prev_rect + end + + def calc_player_dx + player.dx = player_next_dx + player.x += player.dx + end + + def calc_player_dy + player.y += player.dy + player.dy = player_next_dy + end + + def calc_below + return unless player.dy < 0 + tiles_below = tiles_find { |t| t.rect.top <= player.prev_rect.y } + collision = tiles_find_colliding tiles_below, (player.rect.merge y: player.next_rect.y) + if collision + player.y = collision.rect.y + state.tile_size + player.dy = 0 + player.action = :standing + else + player.action = :falling + end + end + + def calc_left + return unless player.dx < 0 && player_next_dx < 0 + tiles_left = tiles_find { |t| t.rect.right <= player.prev_rect.left } + collision = tiles_find_colliding tiles_left, (player.rect.merge x: player.next_rect.x) + return unless collision + player.x = collision.rect.right + player.dx = 0 + end + + def calc_right + return unless player.dx > 0 && player_next_dx > 0 + tiles_right = tiles_find { |t| t.rect.left >= player.prev_rect.right } + collision = tiles_find_colliding tiles_right, (player.rect.merge x: player.next_rect.x) + return unless collision + player.x = collision.rect.left - player.rect.w + player.dx = 0 + end + + def calc_above + return unless player.dy > 0 + tiles_above = tiles_find { |t| t.rect.y >= player.prev_rect.y } + collision = tiles_find_colliding tiles_above, (player.rect.merge y: player.next_rect.y) + return unless collision + player.dy = 0 + player.y = collision.rect.bottom - player.rect.h + end + + def player_current_rect + { x: player.x, y: player.y, w: player.size, h: player.size } + end + + def available_brick_locations + (0..19).to_a + .product(0..11) + .map do |(ordinal_x, ordinal_y)| + { ordinal_x: ordinal_x, + ordinal_y: ordinal_y, + x: ordinal_x * 64, + y: ordinal_y * 64, + w: 64, + h: 64 } + end + end + + def player + state.player ||= args.state.new_entity :player + end + + def player_next_dy + player.dy + state.gravity + state.drag ** 2 * -1 + end + + def player_next_dx + player.dx * 0.8 + end + + def player_next_rect + player.rect.merge x: player.x + player_next_dx, + y: player.y + player_next_dy + end + + def player_prev_rect + player.rect.merge x: player.x - player.dx, + y: player.y - player.dy + end + + def player_jump + return if player.action != :standing + player.action = :jumping + player.dy = state.player.jump_power + current_frame = state.tick_count + player.action_at = current_frame + end + + def player_jump_increase_air_time + return if player.action != :jumping + return if player.action_at.elapsed_time >= player.jump_air_time + player.dy += player.jump_increase_power + end + + def tiles + state.tiles + end + + def tiles_find_colliding tiles, target + tiles.find { |t| t.rect.intersect_rect? target } + end + + def tiles_find &block + tiles.find_all(&block) + end + end + + def tick args + $game ||= Game.new + $game.args = args + $game.tick end $gtk.reset @@ -26951,7 +29505,7 @@ Follows is a source code listing for all files that have been open sourced. This *** Platformer - Clepto Frog - main.rb #+begin_src ruby # ./samples/99_genre_platformer/clepto_frog/app/main.rb - MAP_FILE_PATH = 'app/map.txt' + MAP_FILE_PATH = 'map.txt' require 'app/map.rb' @@ -27006,35 +29560,7 @@ Follows is a source code listing for all files that have been open sourced. This def render_intro outputs.labels << [640, 700, "Clepto Frog", 4, 1] - if state.tick_count >= 120 - outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", - 4, 1, 0, 0, 0, 255 * 120.ease(60)] - end - - if state.tick_count >= 240 - outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", - 4, 1, 0, 0, 0, 255 * 240.ease(60)] - end - - if state.tick_count >= 360 - outputs.labels << [640, 540, "\"Uh...\" - New Guy", - 4, 1, 0, 0, 0, 255 * 360.ease(60)] - end - - if state.tick_count >= 480 - outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", - 4, 1, 0, 0, 0, 255 * 480.ease(60)] - end - - if state.tick_count >= 600 - outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", - 4, 1, 0, 0, 0, 255 * 600.ease(60)] - end - - outputs.sprites << [640 - 50, 360 - 50, 100, 100, - "sprites/square-green.png"] - - if state.tick_count == 800 + if state.tick_count == 120 state.scene = :game state.game_start_at = state.tick_count end @@ -27042,7 +29568,7 @@ Follows is a source code listing for all files that have been open sourced. This def tick defaults - if state.scene == :intro && state.tick_count <= 800 + if state.scene == :intro && state.tick_count <= 120 render_intro elsif state.scene == :ending render_ending @@ -27145,15 +29671,15 @@ Follows is a source code listing for all files that have been open sourced. This if state.god_mode # SHOW HIDE COLLISIONS - outputs.sprites << state.world.map do |x, y, w, h| - x = vx(x) - y = vy(y) + outputs.sprites << state.world.map do |rect| + x = vx(rect.x) + y = vy(rect.y) if x > -80 && x < 1280 && y > -80 && y < 720 { x: x, y: y, - w: vw(w || state.tile_size), - h: vh(h || state.tile_size), + w: vw(rect.w || state.tile_size), + h: vh(rect.h || state.tile_size), path: 'sprites/square-gray.png', a: 128 } @@ -27176,8 +29702,10 @@ Follows is a source code listing for all files that have been open sourced. This # Creates sprite following mouse to help indicate which sprite you have selected - outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, - state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite + outputs.primitives << [inputs.mouse.position.x - 32 * state.camera_scale, + inputs.mouse.position.y - 32 * state.camera_scale, + state.tile_size * state.camera_scale, + state.tile_size * state.camera_scale, 'sprites/square-indigo.png', 0, 100].sprite end render_mini_map @@ -27258,6 +29786,29 @@ Follows is a source code listing for all files that have been open sourced. This set_camera_scale 1 end + if inputs.mouse.click + state.id_seed += 1 + id = state.id_seed + x = state.camera_x + (inputs.mouse.click.x.fdiv(state.camera_scale) - 32) + y = state.camera_y + (inputs.mouse.click.y.fdiv(state.camera_scale) - 32) + x = ((x + 2).idiv 4) * 4 + y = ((y + 2).idiv 4) * 4 + w = 64 + h = 64 + candidate_rect = { id: id, x: x, y: y, w: w, h: h } + scaled_candidate_rect = { x: x + 30, y: y + 30, w: w - 60, h: h - 60 } + to_remove = state.world.find { |r| r.intersect_rect? scaled_candidate_rect } + if to_remove && args.inputs.keyboard.x + state.world.reject! { |r| r.id == to_remove.id } + else + state.world << candidate_rect + end + export_map + state.world_lookup = {} + state.world_collision_rects = nil + calc_world_lookup + end + if input_up? state.y += 10 state.dy = 0 @@ -27279,12 +29830,6 @@ Follows is a source code listing for all files that have been open sourced. This if state.scene == :game process_inputs_player_movement process_inputs_god_mode - elsif state.scene == :intro - if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space - if Kernel.tick_count < 600 - Kernel.tick_count = 600 - end - end end end @@ -27382,17 +29927,6 @@ Follows is a source code listing for all files that have been open sourced. This end end - def add_floors - # floors - state.world += [ - [0, 0, 10000, 40], - [0, 1670, 3250, 60], - [6691, 1653, 3290, 60], - [1521, 3792, 7370, 60], - [0, 5137, 3290, 60] - ] - end - def attempt_load_world_from_file return if state.world # exported_world = gtk.read_file(MAP_FILE_PATH) @@ -27400,26 +29934,11 @@ Follows is a source code listing for all files that have been open sourced. This state.objects = [] if $collisions - $collisions.map do |x, y, w, h| - state.world << [x, y, w, h] + state.id_seed ||= 0 + $collisions.each do |x, y, w, h| + state.id_seed += 1 + state.world << { id: state.id_seed, x: x, y: y, w: w, h: h } end - - add_floors - # elsif exported_world - # exported_world.each_line.map do |l| - # tokens = l.strip.split(',') - # x = tokens[0].to_i - # y = tokens[1].to_i - # type = tokens[2].to_i - # if type == 1 - # state.world << [x, y, state.tile_size, state.tile_size] - # elsif type == 2 - # w, h, path = tokens[3..-1] - # state.objects << [x, y, w.to_i, h.to_i, path] - # end - # end - - # add_floors end if $mugs @@ -27440,23 +29959,24 @@ Follows is a source code listing for all files that have been open sourced. This # Searches through the world and finds the cordinates that exist state.world_lookup = {} - state.world.each do |x, y, w, h| - state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true + state.world.each do |rect| + state.world_lookup[rect.id] = rect end # Assigns collision rects for every sprite drawn state.world_collision_rects = state.world_lookup .keys - .map do |x, y, w, h| + .map do |key| + rect = state.world_lookup[key] s = state.tile_size - w ||= s - h ||= s + rect.w ||= s + rect.h ||= s { - args: [x, y, w, h], - left_right: [x, y + 4, w, h - 6], - top: [x + 4, y + 6, w - 8, h - 6], - bottom: [x + 1, y - 1, w - 2, h - 8], + args: rect, + left_right: { x: rect.x, y: rect.y + 4, w: rect.w, h: rect.h - 6 }, + top: { x: rect.x + 4, y: rect.y + 6, w: rect.w - 8, h: rect.h - 6 }, + bottom: { x: rect.x + 1, y: rect.y - 1, w: rect.w - 2, h: rect.h - 8 }, } end @@ -27512,12 +30032,21 @@ Follows is a source code listing for all files that have been open sourced. This def end_of_tongue p = state.tongue_angle.vector(state.tongue_length) - [start_of_tongue.x + p.x, start_of_tongue.y + p.y] + { x: start_of_tongue.x + p.x, y: start_of_tongue.y + p.y } end def calc_shooting + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + calc_shooting_increment + end + + def calc_shooting_increment return unless state.action == :shooting - state.tongue_length += 30 + state.tongue_length += 5 potential_anchor = end_of_tongue if potential_anchor.x <= 0 state.anchor_point = potential_anchor @@ -27536,9 +30065,9 @@ Follows is a source code listing for all files that have been open sourced. This state.action = :anchored outputs.sounds << 'sounds/attached.wav' else - anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] + anchor_rect = { x: potential_anchor.x - 5, y: potential_anchor.y - 5, w: 10, h: 10 } collision = state.world_collision_rects.find_all do |v| - [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) + v[:args].intersect_rect?(anchor_rect) end.first if collision state.anchor_point = potential_anchor @@ -27634,7 +30163,7 @@ Follows is a source code listing for all files that have been open sourced. This .first return unless left_side_collisions - state.x = left_side_collisions[:left_right].right + state.x = left_side_collisions[:left_right].right + 1 state.dx = state.dy.abs * 0.8 state.collision_on_x = true end @@ -27649,7 +30178,7 @@ Follows is a source code listing for all files that have been open sourced. This .first return unless right_side_collisions - state.x = right_side_collisions[:left_right].left - state.tile_size + state.x = right_side_collisions[:left_right].left - state.tile_size - 1 state.dx = state.dx.abs * 0.8 * -1 state.collision_on_x = true end @@ -27665,7 +30194,7 @@ Follows is a source code listing for all files that have been open sourced. This .first return unless ceil_collisions - state.y = ceil_collisions[:bottom].y - state.tile_size + state.y = ceil_collisions[:bottom].y - state.tile_size - 1 state.dy = state.dy.abs * 0.8 * -1 state.collision_on_y = true end @@ -27678,13 +30207,17 @@ Follows is a source code listing for all files that have been open sourced. This end def export_map - export_string = state.world.map do |x, y| - "#{x},#{y},1" - end + export_string = "$collisions = [\n" + export_string += state.world.map do |rect| + "[#{rect.x},#{rect.y},#{rect.w},#{rect.h}]," + end.join "\n" + export_string += "\n]\n\n" + export_string += "$mugs = [\n" export_string += state.objects.map do |x, y, w, h, path| - "#{x},#{y},2,#{w},#{h},#{path}" - end - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) + "[#{x},#{y},#{w},#{h},'#{path}']," + end.join "\n" + export_string += "\n]\n\n" + gtk.write_file(MAP_FILE_PATH, export_string) state.map_saved_at = state.tick_count end @@ -28812,6 +31345,11 @@ Follows is a source code listing for all files that have been open sourced. This [4459, 3997, 64, 64], [76, 5215, 64, 64], [39, 5217, 64, 64], + [0, 0, 10000, 40], + [0, 1670, 3250, 60], + [6691, 1653, 3290, 60], + [1521, 3792, 7370, 60], + [0, 5137, 3290, 60] ] $mugs = [ @@ -29667,6 +32205,7 @@ Follows is a source code listing for all files that have been open sourced. This end def load_lines file + return unless state.snaps data = gtk.read_file(file) || "" data.each_line .reject { |l| l.strip.length == 0 } @@ -29725,10 +32264,10 @@ Follows is a source code listing for all files that have been open sourced. This results[:point] = { x: x, y: y } results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 } results[:trajectory] = trajectory(results) - results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| + results[:impacts] = terrain.find_all { |t| t && (line_near_rect? results[:rect], t) }.map do |t| { terrain: t, - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), type: :terrain } end.reject { |t| !point_within_line? t[:point], t[:terrain] } @@ -29736,10 +32275,10 @@ Follows is a source code listing for all files that have been open sourced. This results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t| { terrain: t, - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), type: :lava } - end.reject { |t| !point_within_line? t[:point], t[:terrain] } + end.reject { |t| !t || (!point_within_line? t[:point], t[:terrain]) } results end @@ -29752,6 +32291,7 @@ Follows is a source code listing for all files that have been open sourced. This end def calc_terrains_to_monitor + return unless circle.impacts circle.impact = nil circle.impacts.each do |i| circle.terrains_to_monitor[i[:terrain]] ||= { @@ -35301,6 +37841,151 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Rpg Topdown - Topdown Casino - main.rb +#+begin_src ruby + # ./samples/99_genre_rpg_topdown/topdown_casino/app/main.rb + $gtk.reset + + def coinflip + rand < 0.5 + end + + class Game + attr_accessor :args + + def text_font + return nil #"rpg.ttf" + end + + def text_color + [ 255, 255, 255, 255 ] + end + + def set_gem_values + @args.state.gem0 = ((coinflip) ? 100 : 20) + @args.state.gem1 = ((coinflip) ? -10 : -50) + @args.state.gem2 = ((coinflip) ? -10 : -30) + if coinflip + tmp = @args.state.gem0 + @args.state.gem0 = @args.state.gem1 + @args.state.gem1 = tmp + end + if coinflip + tmp = @args.state.gem1 + @args.state.gem1 = @args.state.gem2 + @args.state.gem2 = tmp + end + if coinflip + tmp = @args.state.gem0 + @args.state.gem0 = @args.state.gem2 + @args.state.gem2 = tmp + end + end + + def initialize args + @args = args + @args.state.animticks = 0 + @args.state.score = 0 + @args.state.gem_chosen = false + @args.state.round_finished = false + @args.state.gem0_x = 197 + @args.state.gem0_y = 720-274 + @args.state.gem1_x = 623 + @args.state.gem1_y = 720-274 + @args.state.gem2_x = 1049 + @args.state.gem2_y = 720-274 + @args.state.hero_sprite = "sprites/herodown100.png" + @args.state.hero_x = 608 + @args.state.hero_y = 720-656 + set_gem_values + end + + def render_gem_value x, y, gem + if @args.state.gem_chosen + @args.outputs.labels << [ x, y + 96, gem.to_s, 1, 1, *text_color, text_font ] + end + end + + def render + gemsprite = ((@args.state.animticks % 400) < 200) ? 'sprites/gem200.png' : 'sprites/gem400.png' + @args.outputs.background_color = [ 0, 0, 0, 255 ] + @args.outputs.sprites << [608, 720-150, 64, 64, 'sprites/oldman.png'] + @args.outputs.sprites << [300, 720-150, 64, 64, 'sprites/fire.png'] + @args.outputs.sprites << [900, 720-150, 64, 64, 'sprites/fire.png'] + @args.outputs.sprites << [@args.state.gem0_x, @args.state.gem0_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.gem1_x, @args.state.gem1_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.gem2_x, @args.state.gem2_y, 32, 64, gemsprite] + @args.outputs.sprites << [@args.state.hero_x, @args.state.hero_y, 64, 64, @args.state.hero_sprite] + + @args.outputs.labels << [ 630, 720-30, "IT'S A SECRET TO EVERYONE.", 1, 1, *text_color, text_font ] + @args.outputs.labels << [ 50, 720-85, @args.state.score.to_s, 1, 1, *text_color, text_font ] + render_gem_value @args.state.gem0_x, @args.state.gem0_y, @args.state.gem0 + render_gem_value @args.state.gem1_x, @args.state.gem1_y, @args.state.gem1 + render_gem_value @args.state.gem2_x, @args.state.gem2_y, @args.state.gem2 + end + + def calc + @args.state.animticks += 16 + + return unless @args.state.gem_chosen + @args.state.round_finished_debounce ||= 60 * 3 + @args.state.round_finished_debounce -= 1 + return if @args.state.round_finished_debounce > 0 + + @args.state.gem_chosen = false + @args.state.hero.sprite[0] = 'sprites/herodown100.png' + @args.state.hero.sprite[1] = 608 + @args.state.hero.sprite[2] = 656 + @args.state.round_finished_debounce = nil + set_gem_values + end + + def walk xdir, ydir, anim + @args.state.hero_sprite = "sprites/#{anim}#{(((@args.state.animticks % 200) < 100) ? '100' : '200')}.png" + @args.state.hero_x += 5 * xdir + @args.state.hero_y += 5 * ydir + end + + def check_gem_touching gem_x, gem_y, gem + return if @args.state.gem_chosen + herorect = [ @args.state.hero_x, @args.state.hero_y, 64, 64 ] + return if !herorect.intersect_rect?([gem_x, gem_y, 32, 64]) + @args.state.gem_chosen = true + @args.state.score += gem + @args.outputs.sounds << ((gem < 0) ? 'sounds/lose.wav' : 'sounds/win.wav') + end + + def input + if @args.inputs.keyboard.key_held.left + walk(-1.0, 0.0, 'heroleft') + elsif @args.inputs.keyboard.key_held.right + walk(1.0, 0.0, 'heroright') + elsif @args.inputs.keyboard.key_held.up + walk(0.0, 1.0, 'heroup') + elsif @args.inputs.keyboard.key_held.down + walk(0.0, -1.0, 'herodown') + end + + check_gem_touching(@args.state.gem0_x, @args.state.gem0_y, @args.state.gem0) + check_gem_touching(@args.state.gem1_x, @args.state.gem1_y, @args.state.gem1) + check_gem_touching(@args.state.gem2_x, @args.state.gem2_y, @args.state.gem2) + end + + def tick + input + calc + render + end + end + + def tick args + args.state.game ||= Game.new args + args.state.game.args = args + args.state.game.tick + end + +#+end_src + *** Rpg Topdown - Topdown Starting Point - main.rb #+begin_src ruby # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb @@ -35415,6 +38100,189 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** Teenytiny - Teenytiny Starting Point - main.rb +#+begin_src ruby + # ./samples/99_genre_teenytiny/teenytiny_starting_point/app/main.rb + # full documenation is at http://docs.dragonruby.org + # be sure to come to the discord if you hit any snags: http://discord.dragonruby.org + def tick args + # ==================================================== + # initialize default variables + # ==================================================== + + # ruby has an operator called ||= which means "only initialize this if it's nil" + args.state.count_down ||= 20 * 60 # set the count down to 20 seconds + # set the initial position of the target + args.state.target ||= { x: args.grid.w.half, + y: args.grid.h.half, + w: 20, + h: 20 } + + # set the initial position of the player + args.state.player ||= { x: 50, + y: 50, + w: 20, + h: 20 } + + # set the player movement speed + args.state.player_speed ||= 5 + + # set the score + args.state.score ||= 0 + args.state.teleports ||= 3 + + # set the instructions + args.state.instructions ||= "Get to the red goal! Use arrow keys to move. Spacebar to teleport (use them carefully)!" + + # ==================================================== + # render the game + # ==================================================== + args.outputs.labels << { x: args.grid.w.half, y: args.grid.h - 10, + text: args.state.instructions, + alignment_enum: 1 } + + # check if it's game over. if so, then render game over + # otherwise render the current time left + if game_over? args + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 40, + text: "game over! (press r to start over)", + alignment_enum: 1 } + else + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 40, + text: "time left: #{(args.state.count_down.idiv 60) + 1}", + alignment_enum: 1 } + end + + # render the score + args.outputs.labels << { x: args.grid.w.half, + y: args.grid.h - 70, + text: "score: #{args.state.score}", + alignment_enum: 1 } + + # render the player with teleport count + args.outputs.sprites << { x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/square-green.png' } + + args.outputs.labels << { x: args.state.player.x + 10, + y: args.state.player.y + 40, + text: "teleports: #{args.state.teleports}", + alignment_enum: 1, size_enum: -2 } + + # render the target + args.outputs.sprites << { x: args.state.target.x, + y: args.state.target.y, + w: args.state.target.w, + h: args.state.target.h, + path: 'sprites/square-red.png' } + + # ==================================================== + # run simulation + # ==================================================== + + # count down calculation + args.state.count_down -= 1 + args.state.count_down = -1 if args.state.count_down < -1 + + # ==================================================== + # process player input + # ==================================================== + # if it isn't game over let them move + if !game_over? args + dir_y = 0 + dir_x = 0 + + # determine the change horizontally + if args.inputs.keyboard.up + dir_y += args.state.player_speed + elsif args.inputs.keyboard.down + dir_y -= args.state.player_speed + end + + # determine the change vertically + if args.inputs.keyboard.left + dir_x -= args.state.player_speed + elsif args.inputs.keyboard.right + dir_x += args.state.player_speed + end + + # determine if teleport can be used + if args.inputs.keyboard.key_down.space && args.state.teleports > 0 + args.state.teleports -= 1 + dir_x *= 20 + dir_y *= 20 + end + + # apply change to player + args.state.player.x += dir_x + args.state.player.y += dir_y + else + # if r is pressed, reset the game + if args.inputs.keyboard.key_down.r + $gtk.reset + return + end + end + + # ==================================================== + # determine score + # ==================================================== + + # calculate new score if the player is at goal + if !game_over? args + + # if the player is at the goal, then move the goal + if args.state.player.intersect_rect? args.state.target + # increment the goal + args.state.score += 1 + + # move the goal to a random location + args.state.target = { x: (rand args.grid.w), y: (rand args.grid.h), w: 20, h: 20 } + + # make sure the goal is inside the view area + if args.state.target.x < 0 + args.state.target.x += 20 + elsif args.state.target.x > 1280 + args.state.target.x -= 20 + end + + # make sure the goal is inside the view area + if args.state.target.y < 0 + args.state.target.y += 20 + elsif args.state.target.y > 720 + args.state.target.y -= 20 + end + end + end + end + + def game_over? args + args.state.count_down < 0 + end + + $gtk.reset + +#+end_src + +*** Teenytiny - Teenytiny Starting Point - license.txt +#+begin_src ruby + # ./samples/99_genre_teenytiny/teenytiny_starting_point/license.txt + Copyright 2019 DragonRuby LLC + + MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#+end_src + ** OSS Follows is a source code listing for all files that have been open sourced. This code can be found online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]]. *** args.rb @@ -35432,66 +38300,32 @@ Follows is a source code listing for all files that have been open sourced. This class Args include ArgsDeprecated include Serialize - - # Contains information related to input devices and input events. - # - # @return [Inputs] + attr_accessor :cvars attr_accessor :inputs - - # Contains the means to interact with output devices such as the screen. - # - # @return [Outputs] attr_accessor :outputs - - # Contains the means to interact with the audio mixer. - # - # @return [Hash] attr_accessor :audio - - # Contains display size information to assist in positioning things on the screen. - # - # @return [Grid] attr_accessor :grid - - # Provides access to game play recording facilities within Game Toolkit. - # - # @return [Recording] attr_accessor :recording - - # Gives you access to geometry related functions. - # - # @return [Geometry] attr_accessor :geometry - attr_accessor :fn - - # This is where you'll put state associated with your video game. - # - # @return [OpenEntity] attr_accessor :state - - # Gives you access to the top level DragonRuby runtime. - # - # @return [Runtime] + attr_accessor :temp_state attr_accessor :runtime alias_method :gtk, :runtime - attr_accessor :passes - attr_accessor :wizards - attr_accessor :layout - attr_accessor :easing - attr_accessor :string def initialize runtime, recording @inputs = Inputs.new @outputs = Outputs.new args: self + @cvars = {} @audio = {} @passes = [] @state = OpenEntity.new + @temp_state = OpenEntity.new @state.tick_count = -1 @runtime = runtime @recording = recording @@ -35521,11 +38355,12 @@ Follows is a source code listing for all files that have been open sourced. This def serialize { - state: state.as_hash, - inputs: inputs.serialize, - passes: passes.serialize, - outputs: outputs.serialize, - grid: grid.serialize + state: state.as_hash, + temp_state: temp_state.as_hash, + inputs: inputs.serialize, + passes: passes.serialize, + outputs: outputs.serialize, + grid: grid.serialize } end @@ -35657,6 +38492,23 @@ Follows is a source code listing for all files that have been open sourced. This def autocomplete_methods [:inputs, :outputs, :gtk, :state, :geometry, :audio, :grid, :layout, :fn] end + + def method_missing name, *args, &block + if (args.length <= 1) && (@state.as_hash.key? name) + raise <<-S + * ERROR - :#{name} method missing on ~#{self.class.name}~. + The method + :#{name} + with args + #{args} + doesn't exist on #{inspect}. + ** POSSIBLE SOLUTION - ~args.state.#{name}~ exists. + Did you forget ~.state~ before ~.#{name}~? + S + end + + super + end end end @@ -35691,10 +38543,10 @@ Follows is a source code listing for all files that have been open sourced. This class Assert def custom_assertion actual, expected, message = nil - # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). + # this tells Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). @assertion_performed = true - # perform your custom logic here and rais an exception to denote a failure. + # perform your custom logic here and raise an exception to denote a failure. raise "Some Error. #{message}." end @@ -35704,14 +38556,14 @@ Follows is a source code listing for all files that have been open sourced. This attr :assertion_performed =begin - Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). + Use this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). =end def ok! @assertion_performed = true end =begin - Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. + Assert if a value is a truthy value. All assert methods take an optional final parameter that is the message to display to the user. @example @@ -35765,7 +38617,7 @@ Follows is a source code listing for all files that have been open sourced. This @assertion_performed = true if actual != expected actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip - message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}\n#{message}" raise message end nil @@ -35775,7 +38627,7 @@ Follows is a source code listing for all files that have been open sourced. This @assertion_performed = true if actual == expected actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip - message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}\n#{message}" raise message end nil @@ -35830,6 +38682,10 @@ Follows is a source code listing for all files that have been open sourced. This args.state end + def temp_state + args.temp_state + end + def inputs args.inputs end @@ -35857,6 +38713,14 @@ Follows is a source code listing for all files that have been open sourced. This def layout args.layout end + + def new_entity entity_type, init_hash = nil, &block + args.state.new_entity entity_type, init_hash, &block + end + + def new_entity_strict entity_type, init_hash = nil, &block + args.state.new_entity_strict entity_type, init_hash, &block + end end #+end_src @@ -35864,6 +38728,7 @@ Follows is a source code listing for all files that have been open sourced. This *** attr_sprite.rb #+begin_src ruby # ./dragon/attr_sprite.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # attr_sprite.rb has been released under MIT (*only this file*). @@ -35903,7 +38768,7 @@ Follows is a source code listing for all files that have been open sourced. This attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, :tile_y, :tile_w, :tile_h, :flip_horizontally, :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, - :source_x, :source_y, :source_w, :source_h + :source_x, :source_y, :source_w, :source_h, :blendmode_enum def primitive_marker :sprite @@ -35927,6 +38792,7 @@ Follows is a source code listing for all files that have been open sourced. This *** console.rb #+begin_src ruby # ./dragon/console.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console.rb has been released under MIT (*only this file*). @@ -35938,17 +38804,20 @@ Follows is a source code listing for all files that have been open sourced. This class Console include ConsoleDeprecated - attr_accessor :show_reason, :log, :logo, :background_color, - :text_color, :animation_duration, + attr_accessor :show_reason, :log, :logo, + :animation_duration, :max_log_lines, :max_history, :log, - :last_command_errored, :last_command, :error_color, :shown_at, - :header_color, :archived_log, :last_log_lines, :last_log_lines_count, + :last_command_errored, :last_command, :shown_at, + :archived_log, :last_log_lines, :last_log_lines_count, :suppress_left_arrow_behavior, :command_set_at, :toast_ids, :bottom, - :font_style, :menu + :font_style, :menu, + :background_color, :spam_color, :text_color, :warn_color, + :error_color, :header_color, :code_color, :comment_color, + :debug_color, :unfiltered_color def initialize - @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) + @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1) @menu = Menu.new self @disabled = false @log_offset = 0 @@ -35963,13 +38832,22 @@ Follows is a source code listing for all files that have been open sourced. This @command_history_index = -1 @nonhistory_input = '' @logo = 'console-logo.png' - @history_fname = 'console_history.txt' + @history_fname = 'logs/console_history.txt' @background_color = Color.new [0, 0, 0, 224] - @text_color = Color.new [255, 255, 255] - @error_color = Color.new [200, 50, 50] @header_color = Color.new [100, 200, 220] + @code_color = Color.new [210, 168, 255] + @comment_color = Color.new [0, 200, 100] @animation_duration = 1.seconds @shown_at = -1 + + # these are the colors for text at various log levels. + @spam_color = Color.new [160, 160, 160] + @debug_color = Color.new [0, 255, 0] + @text_color = Color.new [255, 255, 255] + @warn_color = Color.new [255, 255, 0] + @error_color = Color.new [200, 50, 50] + @unfiltered_color = Color.new [0, 255, 255] + load_history end @@ -36035,7 +38913,13 @@ Follows is a source code listing for all files that have been open sourced. This nil end - def add_text obj + def add_text obj, loglevel=-1 + # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic" + loglevel = -1 if loglevel < 0 + loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down) + loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well + colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil + @last_log_lines_count ||= 1 @log_invocation_count += 1 @@ -36044,12 +38928,18 @@ Follows is a source code listing for all files that have been open sourced. This log_lines = [] str.each_line do |s| - s.wrapped_lines(self.console_text_width).each do |l| - log_lines << l + if colorstr.nil? + s.wrapped_lines(self.console_text_width).each do |l| + log_lines << l + end + else + s.wrapped_lines(self.console_text_width).each do |l| + log_lines << "#{colorstr}#{l}" + end end end - if log_lines == @last_log_lines + if log_lines == @last_log_lines && log_lines.length != 0 @last_log_lines_count += 1 new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})" if log_lines.length > 1 @@ -36242,6 +39132,8 @@ Follows is a source code listing for all files that have been open sourced. This if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa' $gtk.request_quit + elsif cmd.start_with? ':' + send ((cmd.gsub '-', '_').gsub ':', '') else puts "-> #{cmd}" begin @@ -36250,13 +39142,19 @@ Follows is a source code listing for all files that have been open sourced. This if $results.nil? puts "=> nil" elsif $results == :console_silent_eval + # do nothing since the console is silent else puts "=> #{$results}" end @last_command_errored = false rescue Exception => e try_search_docs e - puts "* EXCEPTION: #{e}" + # if an exception is thrown and the bactrace includes something helpful, then show it + if (e.backtrace || []).first && (e.backtrace.first.include? "(eval)") + puts "* EXCEPTION: #{e}" + else + puts "* EXCEPTION: #{e}\n#{e.__backtrace_to_org__}" + end end end end @@ -36316,10 +39214,12 @@ Follows is a source code listing for all files that have been open sourced. This def mouse_wheel_scroll args @inertia ||= 0 - if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 - @inertia = 1 - elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 - @inertia = -1 + if args.inputs.mouse.wheel + if args.inputs.mouse.wheel.y > 0 + @inertia = 1 + elsif args.inputs.mouse.wheel.y < 0 + @inertia = -1 + end end if args.inputs.mouse.click @@ -36328,13 +39228,11 @@ Follows is a source code listing for all files that have been open sourced. This return if @inertia == 0 - if @inertia != 0 - @inertia = (@inertia * 0.7) - if @inertia > 0 - @log_offset -= 1 - elsif @inertia < 0 - @log_offset += 1 - end + @inertia = (@inertia * 0.7) + if @inertia > 0 + @log_offset += 1 + elsif @inertia < 0 + @log_offset -= 1 end if @inertia.abs < 0.01 @@ -36352,6 +39250,7 @@ Follows is a source code listing for all files that have been open sourced. This if console_toggle_key_down? args args.inputs.text.clear toggle + args.inputs.keyboard.clear if !@visible end return unless visible? @@ -36363,7 +39262,16 @@ Follows is a source code listing for all files that have been open sourced. This @log_offset = 0 if @log_offset < 0 if args.inputs.keyboard.key_down.enter - eval_the_set_command + if slide_progress > 0.5 + # in the event of an exception, the console window pops up + # and is pre-filled with $gtk.reset. + # there is an annoying scenario where the exception could be thrown + # by pressing enter (while playing the game). if you press enter again + # quickly, then the game is reset which closes the console. + # so enter in the console is only evaluated if the slide_progress + # is atleast half way down the page. + eval_the_set_command + end elsif args.inputs.keyboard.key_down.v if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta prompt << $gtk.ffi_misc.getclipboard @@ -36440,7 +39348,7 @@ Follows is a source code listing for all files that have been open sourced. This def write_line(args, left, y, str, archived: false) color = color_for_log_entry(str) color = color.mult_alpha(0.5) if archived - + str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color) end @@ -36483,6 +39391,11 @@ Follows is a source code listing for all files that have been open sourced. This end render_log_offset args + + args.outputs.reserved << { x: 10.from_right, y: @bottom + 10, + text: "Press CTRL+g or ESCAPE to clear the prompt.", + vertical_alignment_enum: 0, + alignment_enum: 2, r: 80, g: 80, b: 80 }.label! end def render_log_offset args @@ -36505,7 +39418,7 @@ Follows is a source code listing for all files that have been open sourced. This end def include_subdued_markers? text - include_any_words? text, subdued_markers + (text.start_with? "* INFO: ") && (include_any_words? text, subdued_markers) end def include_any_words? text, words @@ -36651,8 +39564,34 @@ Follows is a source code listing for all files that have been open sourced. This (log_entry.start_with? "**** ") end - def color_for_log_entry(log_entry) - if include_row_marker? log_entry + def code? log_entry + (just_symbol? log_entry) || (codeblock_marker? log_entry) + end + + def just_symbol? log_entry + scrubbed = log_entry.gsub("*", "").strip + (scrubbed.start_with? ":") && (!scrubbed.include? " ") && (!scrubbed.include? "=>") + end + + def code_comment? log_entry + return true if log_entry.strip.start_with?("# ") + return false + end + + def codeblock_marker? log_entry + return true if log_entry.strip.start_with?("#+begin_src") + return true if log_entry.strip.start_with?("#+end_src") + return false + end + + def color_for_plain_text log_entry + log_entry = log_entry[4..-1] if log_entry.start_with? "!c!" + + if code? log_entry + @code_color + elsif code_comment? log_entry + @comment_color + elsif include_row_marker? log_entry @text_color elsif include_error_marker? log_entry @error_color @@ -36667,6 +39606,29 @@ Follows is a source code listing for all files that have been open sourced. This end end + def color_for_log_entry(log_entry) + if log_entry.start_with?('!c!') # loglevel color specified. + return case log_entry[3..3].to_i + when 0 # spam + @spam_color + when 1 # debug + @debug_color + #when 2 # info (caught by the `else` block.) + # @text_color + when 3 # warn + @warn_color + when 4 # error + @error_color + when 5 # unfiltered + @unfiltered_color + else + color_for_plain_text log_entry + end + end + + return color_for_plain_text log_entry + end + def prompt @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width) end @@ -36703,6 +39665,7 @@ Follows is a source code listing for all files that have been open sourced. This *** console_color.rb #+begin_src ruby # ./dragon/console_color.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_color.rb has been released under MIT (*only this file*). @@ -36727,6 +39690,10 @@ Follows is a source code listing for all files that have been open sourced. This @color end + def to_s + "GTK::Console::Color #{to_h}" + end + def to_h { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } end @@ -36739,6 +39706,7 @@ Follows is a source code listing for all files that have been open sourced. This *** console_font_style.rb #+begin_src ruby # ./dragon/console_font_style.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_font_style.rb has been released under MIT (*only this file*). @@ -36774,7 +39742,7 @@ Follows is a source code listing for all files that have been open sourced. This size_enum: size_enum, alignment_enum: alignment_enum, **color.to_h, - }.label + }.label! end end end @@ -36785,6 +39753,7 @@ Follows is a source code listing for all files that have been open sourced. This *** console_menu.rb #+begin_src ruby # ./dragon/console_menu.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_menu.rb has been released under MIT (*only this file*). @@ -36838,7 +39807,7 @@ Follows is a source code listing for all files that have been open sourced. This def itch_wizard_clicked @console.scroll_to_bottom - $wizards.itch.start + $wizards.itch.restart end def docs_clicked @@ -36863,6 +39832,7 @@ Follows is a source code listing for all files that have been open sourced. This @buttons = [ (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked), (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), + *custom_buttons ] elsif @menu_shown == :hidden @buttons = [ @@ -36921,8 +39891,8 @@ Follows is a source code listing for all files that have been open sourced. This method: method }.let do |entity| primitives = [] - primitives << entity[:rect].merge(a: 164).solid - primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border + primitives << entity[:rect].solid!(a: 164) + primitives << entity[:rect].border!(r: 255, g: 255, b: 255) primitives << text.wrapped_lines(5) .map_with_index do |l, i| [ @@ -36950,6 +39920,7 @@ Follows is a source code listing for all files that have been open sourced. This *** console_prompt.rb #+begin_src ruby # ./dragon/console_prompt.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # console_prompt.rb has been released under MIT (*only this file*). @@ -37023,14 +39994,14 @@ Follows is a source code listing for all files that have been open sourced. This return if @cursor_position.zero? new_pos = @cursor_position - 1 - (is_word_boundary? @current_input_str[new_pos]) ? + (is_word_boundary? @current_input_str[new_pos]) ? (new_pos -= 1 until !(is_word_boundary? @current_input_str[new_pos - 1]) || new_pos.zero?): (new_pos -= 1 until (is_word_boundary? @current_input_str[new_pos - 1]) || new_pos.zero?) @cursor_position = new_pos update_cursor_position_px end - + def move_cursor_right @cursor_position += 1 if @cursor_position < current_input_str.length update_cursor_position_px @@ -37043,7 +40014,7 @@ Follows is a source code listing for all files that have been open sourced. This (is_word_boundary? @current_input_str[new_pos]) ? (new_pos += 1 until !(is_word_boundary? @current_input_str[new_pos]) || (new_pos.equal? str_len)): (new_pos += 1 until (is_word_boundary? @current_input_str[new_pos]) || (new_pos.equal? str_len)) - + @cursor_position = new_pos update_cursor_position_px end @@ -37109,11 +40080,11 @@ Follows is a source code listing for all files that have been open sourced. This # partition the original list of items into a string to be printed items.each_slice(columns).each_with_index do |cells, i| - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns pretty_print_row cells, string_width, cell_width, column_width, columns end - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns end end @@ -37126,17 +40097,17 @@ Follows is a source code listing for all files that have been open sourced. This "#{" " * (string_width.length - c.length) } #{c} |" end.join - # remove seperators between empty values + # remove separators between empty values formated_row = formated_row.gsub(" | ", " ") puts formated_row end - def pretty_print_row_seperator string_width, cell_width, column_width, columns + def pretty_print_row_separator string_width, cell_width, column_width, columns # this is a joint: +-------- column_joint = "+#{"-" * cell_width}" - # multiple joints create a row seperator: +----+----+ + # multiple joints create a row separator: +----+----+ puts (column_joint * columns) + "+" end @@ -37145,12 +40116,12 @@ Follows is a source code listing for all files that have been open sourced. This args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 0.5, y: y + 5, x2: x + @cursor_position_px + 0.5, - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 1, y: y + 5, x2: x + @cursor_position_px + 1, - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) # debugging rectangle for string # args.outputs.reserved << (@cursor_color.to_h.merge x: x, @@ -37778,7 +40749,7 @@ Follows is a source code listing for all files that have been open sourced. This :l1, :r1, :l2, :r2, :l3, :r3, - :start, :select, + :start, :select, :home, :directional_up, :directional_down, :directional_left, :directional_right ].freeze @@ -37786,6 +40757,22 @@ Follows is a source code listing for all files that have been open sourced. This attr label end + def back + @select + end + + def back= value + @select = value + end + + def guide + @home + end + + def guide= value + @home = value + end + # Activate a key. # # @return [void] @@ -37834,7 +40821,7 @@ Follows is a source code listing for all files that have been open sourced. This error_message = <<-S * ERROR - The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy: + The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy: - (#{ directional_methods.join("|") }) - key_held.(#{ directional_methods.join("|") }) @@ -37891,6 +40878,12 @@ Follows is a source code listing for all files that have been open sourced. This end end + def directional_angle + return nil unless directional_vector + + Math.atan2(up_down, left_right).to_degrees + end + def method_missing m, *args # combine the key with ctrl_ if m.to_s.start_with?("ctrl_") @@ -37928,8 +40921,8 @@ Follows is a source code listing for all files that have been open sourced. This ease_extended start_tick, current_tick, start_tick + duration, - (initial_value *definitions), - (final_value *definitions), + initial_value(*definitions), + final_value(*definitions), *definitions end @@ -38123,6 +41116,22 @@ Follows is a source code listing for all files that have been open sourced. This module GTK module Geometry + def self.rotate_point point, angle, around = nil + s = Math.sin angle.to_radians + c = Math.cos angle.to_radians + px = point.x + py = point.y + cx = 0 + cy = 0 + if around + cx = around.x + cy = around.y + end + + point.merge(x: ((px - cx) * c - (py - cy) * s) + cx, + y: ((px - cx) * s + (py - cy) * c) + cy) + end + # Returns f(t) for a cubic Bezier curve. def self.cubic_bezier t, a, b, c, d s = 1 - t @@ -38204,7 +41213,7 @@ Follows is a source code listing for all files that have been open sourced. This rescue Exception => e raise e, <<-S * ERROR: - center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -38221,7 +41230,7 @@ Follows is a source code listing for all files that have been open sourced. This rescue Exception => e raise e, <<-S * ERROR: - center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect_x for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -38238,7 +41247,7 @@ Follows is a source code listing for all files that have been open sourced. This rescue Exception => e raise e, <<-S * ERROR: - center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect_y for self #{self} and other_rect #{other_rect}.\n#{e}. S end @@ -38247,7 +41256,7 @@ Follows is a source code listing for all files that have been open sourced. This end - # Returns a primitive that is anchored/repositioned based off its retangle. + # Returns a primitive that is anchored/repositioned based off its rectangle. # @gtk def anchor_rect anchor_x, anchor_y current_w = self.w @@ -38290,8 +41299,16 @@ Follows is a source code listing for all files that have been open sourced. This end # @gtk - def self.line_y_intercept line - line.y - line_slope(line) * line.x + def self.line_y_intercept line, replace_infinity: nil + line.y - line_slope(line, replace_infinity: replace_infinity) * line.x + rescue Exception => e + raise <<-S + * ERROR: ~Geometry::line_y_intercept~ + The following exception was thrown for line: #{line} + #{e} + + Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. + S end # @gtk @@ -38367,14 +41384,22 @@ Follows is a source code listing for all files that have been open sourced. This end # @gtk - def self.line_intersect line_one, line_two - m1 = line_slope(line_one) - m2 = line_slope(line_two) - b1 = line_y_intercept(line_one) - b2 = line_y_intercept(line_two) + def self.line_intersect line_one, line_two, replace_infinity: nil + m1 = line_slope(line_one, replace_infinity: replace_infinity) + m2 = line_slope(line_two, replace_infinity: replace_infinity) + b1 = line_y_intercept(line_one, replace_infinity: replace_infinity) + b2 = line_y_intercept(line_two, replace_infinity: replace_infinity) x = (b1 - b2) / (m2 - m1) y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2)) [x, y] + rescue Exception => e + raise <<-S + * ERROR: ~Geometry::line_intersect~ + The following exception was thrown for line_one: #{line_one}, line_two: #{line_two} + #{e} + + Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. + S end def self.contract_intersect_rect? @@ -38383,10 +41408,10 @@ Follows is a source code listing for all files that have been open sourced. This # @gtk def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 - return false if rect_one.right - tolerance < rect_two.left + tolerance - return false if rect_one.left + tolerance > rect_two.right - tolerance - return false if rect_one.top - tolerance < rect_two.bottom + tolerance - return false if rect_one.bottom + tolerance > rect_two.top - tolerance + return false if ((rect_one.x + rect_one.w) - tolerance) < (rect_two.x + tolerance) + return false if (rect_one.x + tolerance) > ((rect_two.x + rect_two.w) - tolerance) + return false if ((rect_one.y + rect_one.h) - tolerance) < (rect_two.y + tolerance) + return false if (rect_one.y + tolerance) > ((rect_two.y + rect_two.h) - tolerance) return true rescue Exception => e context_help_rect_one = (rect_one.__help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] @@ -38414,6 +41439,7 @@ Follows is a source code listing for all files that have been open sourced. This - rect_one: #{rect_one} - rect_two: #{rect_two} #{context_help} + \n#{e} S end @@ -38424,14 +41450,14 @@ Follows is a source code listing for all files that have been open sourced. This y = y.shift_down(size * anchor_y) [x, y, size, size] rescue Exception => e - raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" end # @gtk def self.distance point_one, point_two Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2) rescue Exception => e - raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}." + raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}.\n#{e}" end # @gtk @@ -38440,31 +41466,34 @@ Follows is a source code listing for all files that have been open sourced. This d_x = end_point.x - start_point.x Math::PI.+(Math.atan2(d_y, d_x)).to_degrees rescue Exception => e - raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" end # @gtk def self.angle_to start_point, end_point angle_from end_point, start_point rescue Exception => e - raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" end # @gtk def self.point_inside_circle? point, circle_center_point, radius (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2 rescue Exception => e - raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}" + raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}.\n#{e}" end # @gtk def self.inside_rect? inner_rect, outer_rect, tolerance = 0.0 + return nil if !inner_rect + return nil if !outer_rect + inner_rect.x + tolerance >= outer_rect.x - tolerance && - inner_rect.right - tolerance <= outer_rect.right + tolerance && + (inner_rect.x + inner_rect.w) - tolerance <= (outer_rect.x + outer_rect.w) + tolerance && inner_rect.y + tolerance >= outer_rect.y - tolerance && - inner_rect.top - tolerance <= outer_rect.top + tolerance + (inner_rect.y + inner_rect.h) - tolerance <= (outer_rect.y + outer_rect.h) + tolerance rescue Exception => e - raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}." + raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}.\n#{e}" end # @gtk @@ -38499,7 +41528,7 @@ Follows is a source code listing for all files that have been open sourced. This return rect end rescue Exception => e - raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" end # @gtk @@ -38513,7 +41542,21 @@ Follows is a source code listing for all files that have been open sourced. This anchor_x: anchor_x, anchor_y: anchor_y rescue Exception => e - raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]." + raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)].\n#{e}" + end + + def self.rect_to_line rect + l = rect.to_hash.line + l.merge(x2: l.x + l.w - 1, + y2: l.y + l.h) + end + + def self.rect_center_point rect + { x: rect.x + rect.w.half, y: rect.y + rect.h.half } + end + + def rect_center_point + Geometry.rect_center_point self end end # module Geometry end # module GTK @@ -38710,6 +41753,14 @@ Follows is a source code listing for all files that have been open sourced. This def bottom_right [@right, @bottom].point end + + def x + 0 + end + + def y + 0 + end end end @@ -38911,6 +41962,30 @@ Follows is a source code listing for all files that have been open sourced. This } end + def self.method_to_key_hash + return @method_to_key_hash if @method_to_key_hash + @method_to_key_hash = {} + string_representation_overrides ||= { + backspace: '\b' + } + char_to_method_hash.each do |k, v| + v.each do |vi| + t = { char_or_raw_key: k } + + if k.is_a? Numeric + t[:raw_key] = k + t[:string_representation] = "raw_key == #{k}" + else + t[:char] = k + t[:string_representation] = "\"#{k.strip}\"" + end + + @method_to_key_hash[vi] = t + end + end + @method_to_key_hash + end + def self.char_to_method char, int = nil methods = char_to_method_hash[char] || char_to_method_hash[int] methods ? methods.dup : [char.to_sym || int] @@ -39009,7 +42084,8 @@ Follows is a source code listing for all files that have been open sourced. This value = Kernel.tick_count if value collection.each do |m| - self.instance_variable_set("@#{m.to_s}".to_sym, value) + m_to_s = m.to_s + self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0 rescue Exception => e raise e, <<-S * ERROR: @@ -39025,24 +42101,32 @@ Follows is a source code listing for all files that have been open sourced. This end def method_missing m, *args - begin - define_singleton_method(m) do - r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) - clear_key m - return r - end + if KeyboardKeys.method_to_key_hash[m.without_ending_bang] + begin + define_singleton_method(m) do + r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) + clear_key m + return r + end - return self.send m - rescue Exception => e - log_important "#{e}" + return self.send m + rescue Exception => e + log_important "#{e}" + end end + did_you_mean = KeyboardKeys.method_to_key_hash.find_all do |k, v| + k.to_s[0..1] == m.to_s[0..1] + end.map {|k, v| ":#{k} (#{v[:string_representation]})" } + did_you_mean_string = "" + did_you_mean_string = ". Did you mean #{did_you_mean.join ", "}?" + raise <<-S * ERROR: - There is no member on the keyboard called #{m}. Here is a to_s representation of what's available: - - #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")} + #{KeyboardKeys.method_to_key_hash.map { |k, v| "** :#{k} #{v.string_representation}" }.join("\n")} + There is no key on the keyboard called :#{m}#{did_you_mean_string}. + Full list of available keys =:points_up:=. S end @@ -39426,6 +42510,10 @@ Follows is a source code listing for all files that have been open sourced. This (controller_one && controller_one.directional_vector) end + def directional_angle + keyboard.directional_angle || (controller_one && controller_one.directional_angle) + end + # Returns a signal indicating right (`1`), left (`-1`), or neither ('0'). # # @return [Integer] @@ -39497,19 +42585,14 @@ Follows is a source code listing for all files that have been open sourced. This *** ios_wizard.rb #+begin_src ruby # ./dragon/ios_wizard.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # ios_wizard.rb has been released under MIT (*only this file*). - class WizardException < Exception - attr_accessor :console_primitives - - def initialize *console_primitives - @console_primitives = console_primitives - end - end + # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński - class IOSWizard + class IOSWizard < Wizard def initialize @doctor_executed_at = 0 end @@ -39522,23 +42605,46 @@ Follows is a source code listing for all files that have been open sourced. This @steps ||= [] end - def steps_development_build + def prerequisite_steps [ :check_for_xcode, :check_for_brew, :check_for_certs, - :check_for_device, - :check_for_dev_profile, + ] + end + + def app_metadata_retrieval_steps + [ :determine_team_identifier, :determine_app_name, :determine_app_id, - :blow_away_temp, + ] + end + + def steps_development_build + [ + *prerequisite_steps, + + :check_for_device, + :check_for_dev_profile, + + *app_metadata_retrieval_steps, + :determine_devcert, + + :clear_tmp_directory, :stage_app, + :development_write_info_plist, + :write_entitlements_plist, :compile_icons, - :create_payload_directory, + :clear_payload_directory, + + :create_payload_directory_dev, + + :create_payload, :code_sign_payload, + :create_ipa, :deploy ] @@ -39546,20 +42652,28 @@ Follows is a source code listing for all files that have been open sourced. This def steps_production_build [ - :check_for_xcode, - :check_for_brew, - :check_for_certs, + *prerequisite_steps, + :check_for_distribution_profile, - :determine_team_identifier, - :determine_app_name, - :determine_app_id, - :blow_away_temp, + :determine_app_version, + + *app_metadata_retrieval_steps, + :determine_prodcert, + + :clear_tmp_directory, :stage_app, + :production_write_info_plist, + :write_entitlements_plist, :compile_icons, - :create_payload_directory, + :clear_payload_directory, + + :create_payload_directory_prod, + + :create_payload, :code_sign_payload, + :create_ipa, :print_publish_help ] @@ -39595,6 +42709,8 @@ Follows is a source code listing for all files that have been open sourced. This @steps = steps_development_build @steps = steps_production_build if @production_build @certificate_name = nil + @app_version = opts[:version] + @app_version = "1.0" if @opts[:env] == :dev && !@app_version init_wizard_status log_info "Starting iOS Wizard so we can deploy to your device." @start_at = Kernel.global_tick_count @@ -39616,8 +42732,10 @@ Follows is a source code listing for all files that have been open sourced. This log "=" * $console.console_text_width else log_error e.to_s + log e.__backtrace_to_org__ end + init_wizard_status $console.set_command "$wizards.ios.start env: :#{@opts[:env]}" end @@ -39724,13 +42842,70 @@ Follows is a source code listing for all files that have been open sourced. This return "profiles/development.mobileprovision" end + def ios_metadata_template + <<-S + # ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps. + # Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase + + # teamid needs to be set to your assigned Team Id which can be found at https://developer.apple.com/account/#/membership/ + teamid= + # appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list + appid= + # appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters. + appname= + # devcert is the certificate to use for development/deploying to your local device + devcert= + # prodcert is the certificate to use for distribution to the app store + prodcert= + S + end + + def ios_metadata + contents = $gtk.read_file 'metadata/ios_metadata.txt' + + if !contents + $gtk.write_file 'metadata/ios_metadata.txt', ios_metadata_template + contents = $gtk.read_file 'metadata/ios_metadata.txt' + end + + kvps = contents.each_line + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } + .map do |l| + key, value = l.split("=") + [key.strip.to_sym, value.strip] + end.flatten + Hash[*kvps] + end + + def game_metadata + contents = $gtk.read_file 'metadata/game_metadata.txt' + + kvps = contents.each_line + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } + .map do |l| + key, value = l.split("=") + [key.strip.to_sym, value.strip] + end.flatten + Hash[*kvps] + end + + def raise_ios_metadata_required + raise WizardException.new( + "* mygame/metadata/ios_metadata.txt needs to be filled out.", + "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.", + "Instructions for where the values should come from are within metadata/ios_metadata.txt." + ) + end + def determine_team_identifier - @team_name = (team_identifier_from_provisioning_profile @opts[:env]) - log_info "Team Identifer is: #{@team_name}" + @team_id = (ios_metadata.teamid || "") + raise_ios_metadata_required if @team_id.strip.length == 0 + log_info "Team Identifer is: #{@team_id}" end def determine_app_name - @app_name = (provisioning_profile_xml @opts[:env])[:children].first[:children].first[:children][1][:children].first[:data] + @app_name = (ios_metadata.appname || "") + raise_ios_metadata_required if @app_name.strip.length == 0 log_info "App name is: #{@app_name}." end @@ -39754,37 +42929,22 @@ Follows is a source code listing for all files that have been open sourced. This $gtk.parse_xml scrubbed end - def app_id_from_provisioning_profile environment - application_identifier_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| - if node[:children] && node[:children][0] && node[:children][0][:data] == "application-identifier" - application_identifier_index = i - break - end - end - - app_id_with_team_identifier = (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][application_identifier_index + 1][:children].first[:data] - team_identifer = team_identifier_from_provisioning_profile environment - app_id_with_team_identifier.gsub "#{team_identifer}.", "" + def determine_app_id + @app_id = ios_metadata.appid + raise_ios_metadata_required if @app_id.strip.length == 0 + log_info "App Identifier is set to: #{@app_id}" end - def team_identifier_from_provisioning_profile environment - team_identifer_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] - - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| - if node[:children] && node[:children][0] && node[:children][0][:data] == "com.apple.developer.team-identifier" - team_identifer_index = i - break - end - end - - (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][team_identifer_index + 1][:children].first[:data] + def determine_devcert + @certificate_name = ios_metadata.devcert + raise_ios_metadata_required if @certificate_name.strip.length == 0 + log_info "Dev Certificate is set to: #{@certificate_name}" end - def determine_app_id - @app_id = app_id_from_provisioning_profile @opts[:env] - - log_info "App Identifier is set to : #{@app_id}" + def determine_prodcert + @certificate_name = ios_metadata.prodcert + raise_ios_metadata_required if @certificate_name.strip.length == 0 + log_info "Production (Distribution) Certificate is set to: #{@certificate_name}" end def set_app_name name @@ -39802,16 +42962,10 @@ Follows is a source code listing for all files that have been open sourced. This end end - def blow_away_temp + def clear_tmp_directory sh "rm -rf #{tmp_directory}" end - def stage_app - log_info "Staging." - sh "mkdir -p #{tmp_directory}" - sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" - end - def set_app_id id log_info = "App Id set to: #{id}" @app_id = id @@ -39842,34 +42996,13 @@ Follows is a source code listing for all files that have been open sourced. This def check_for_certs log_info "Attempting to find certificates on your computer." - if !cli_app_exist?(security_cli_app) - raise WizardException.new( - "* It doesn't look like you have #{security_cli_app}.", - "** 1. Open Disk Utility and run First Aid.", - { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") }, - ) - end - - if valid_certs.length == 0 - raise WizardException.new( - "* It doesn't look like you have any valid certs installed.", - "** 1. Open Xcode.", - "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.", - { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") }, - "** 3. After loggin in, select Manage Certificates...", - { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") }, - "** 4. Add a certificate for Apple Development.", - { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") }, - ) - raise "You do not have any Apple development certs on this computer." - end - if @production_build - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name] + @certificate_name = ios_metadata[:prodcert] else - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name] + @certificate_name = ios_metadata[:devcert] end - log_info "I will be using Certificate: '#{@certificate_name}'." + + log_info "I will be using certificate: '#{@certificate_name}'." end def idevice_id_cli_app @@ -39884,24 +43017,6 @@ Follows is a source code listing for all files that have been open sourced. This "xcodebuild" end - def valid_certs - certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l| - if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution")) - l.strip - else - nil - end - end.reject_nil.map do |l| - number, id, name = l.split(' ', 3) - name = name.gsub("\"", "") if name - { - number: 1, - id: id, - name: name - } - end - end - def connected_devices sh("idevice_id -l").strip.each_line.map do |l| l.strip @@ -39943,7 +43058,8 @@ Follows is a source code listing for all files that have been open sourced. This log_info "Creating Entitlements.plist" - $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_name}.#{@app_id}").strip + $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip + $gtk.write_file_root "tmp/ios/Entitlements.txt", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip sh "/usr/bin/plutil -convert binary1 \"#{tmp_directory}/Entitlements.plist\"" sh "/usr/bin/plutil -convert xml1 \"#{tmp_directory}/Entitlements.plist\"" @@ -39981,15 +43097,15 @@ Follows is a source code listing for all files that have been open sourced. This <key>CFBundleExecutable</key> <string>:app_name</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.6</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>5.6</string> + <string>:app_version</string> <key>CFBundleIcons</key> <dict> <key>CFBundlePrimaryIcon</key> @@ -40138,13 +43254,13 @@ Follows is a source code listing for all files that have been open sourced. This <key>CFBundleIdentifier</key> <string>:app_id</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundleName</key> <string>:app_name</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.2</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> @@ -40152,7 +43268,7 @@ Follows is a source code listing for all files that have been open sourced. This <string>iPhoneOS</string> </array> <key>CFBundleVersion</key> - <string>5.2</string> + <string>:app_version</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> @@ -40238,6 +43354,7 @@ Follows is a source code listing for all files that have been open sourced. This info_plist_string.gsub!(":app_id", @app_id) $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip @info_plist_written = true end @@ -40291,13 +43408,13 @@ Follows is a source code listing for all files that have been open sourced. This <key>CFBundleIdentifier</key> <string>:app_id</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>:app_version</string> <key>CFBundleName</key> <string>:app_name</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>5.2</string> + <string>:app_version</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleSupportedPlatforms</key> @@ -40305,7 +43422,7 @@ Follows is a source code listing for all files that have been open sourced. This <string>iPhoneOS</string> </array> <key>CFBundleVersion</key> - <string>5.2</string> + <string>:app_version</string> <key>DTCompiler</key> <string>com.apple.compilers.llvm.clang.1_0</string> <key>DTPlatformBuild</key> @@ -40389,8 +43506,10 @@ Follows is a source code listing for all files that have been open sourced. This info_plist_string.gsub!(":app_name", @app_name) info_plist_string.gsub!(":app_id", @app_id) + info_plist_string.gsub!(":app_version", @app_version) $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip @info_plist_written = true end @@ -40412,28 +43531,56 @@ Follows is a source code listing for all files that have been open sourced. This "#{relative_path}/#{$gtk.cli_arguments[:dragonruby]}" end - def write_ip_address + def embed_mobileprovision + sh %Q[cp #{@provisioning_profile_path} "#{app_path}/embedded.mobileprovision"] + sh %Q[/usr/bin/plutil -convert binary1 "#{app_path}/Info.plist"] + end + + def clear_payload_directory + sh %Q[rm "#{@app_name}".ipa] + sh %Q[rm -rf "#{app_path}/app"] + sh %Q[rm -rf "#{app_path}/sounds"] + sh %Q[rm -rf "#{app_path}/sprites"] + sh %Q[rm -rf "#{app_path}/data"] + sh %Q[rm -rf "#{app_path}/fonts"] + end + + def stage_app + log_info "Staging." + sh "mkdir -p #{tmp_directory}" + sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" + sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"] + sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"] + sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"] + sh %Q[cp -r "#{root_folder}/data/" "#{app_path}/data/"] + sh %Q[cp -r "#{root_folder}/fonts/" "#{app_path}/fonts/"] + end + + def create_payload + sh %Q[mkdir -p #{tmp_directory}/ipa_root/Payload] + sh %Q[cp -r "#{app_path}" "#{tmp_directory}/ipa_root/Payload"] + sh %Q[chmod -R 755 "#{tmp_directory}/ipa_root/Payload"] + end + + def create_payload_directory_dev + # write dev machine's ip address for hotloading $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip + + embed_mobileprovision + clear_payload_directory + stage_app end - def create_payload_directory - sh "cp #{@provisioning_profile_path} \"#{app_path}/embedded.mobileprovision\"" - sh "/usr/bin/plutil -convert binary1 \"#{app_path}/Info.plist\"" - write_ip_address - sh "rm \"#{@app_name}\".ipa" - sh "rm -rf \"#{app_path}/app\"" - sh "rm -rf \"#{app_path}/sounds\"" - sh "rm -rf \"#{app_path}/sprites\"" - sh "rm -rf \"#{app_path}/data\"" - sh "rm -rf \"#{app_path}/fonts\"" - sh "cp -r \"#{root_folder}/app/\" \"#{app_path}/app/\"" - sh "cp -r \"#{root_folder}/sounds/\" \"#{app_path}/sounds/\"" - sh "cp -r \"#{root_folder}/sprites/\" \"#{app_path}/sprites/\"" - sh "cp -r \"#{root_folder}/data/\" \"#{app_path}/data/\"" - sh "cp -r \"#{root_folder}/fonts/\" \"#{app_path}/fonts/\"" - sh "mkdir -p #{tmp_directory}/ipa_root/Payload" - sh "cp -r \"#{app_path}\" \"#{tmp_directory}/ipa_root/Payload\"" - sh "chmod -R 755 \"#{tmp_directory}/ipa_root/Payload\"" + def create_payload_directory_prod + # production builds does not hotload ip address + sh %Q[rm "#{root_folder}/app/server_ip_address.txt"] + + embed_mobileprovision + stage_app + + # production build marker + sh %Q[mkdir -p "#{app_path}/metadata/"] + sh %Q[touch metadata/DRAGONRUBY_PRODUCTION_BUILD] end def create_ipa @@ -40466,10 +43613,22 @@ Follows is a source code listing for all files that have been open sourced. This end def print_publish_help - log_info "Go to https://appstoreconnect.apple.com/apps and create an App if you haven't already done so." - log_info "Go to https://appleid.apple.com and create a 'Application Specific Password'." - log_info "To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." - log_info "Your app is located at ./tmp/ios/#{@app_name}.ipa" + has_transporter = (sh "ls /Applications/Transporter.app").include? "Contents" + if !has_transporter + $gtk.openurl "https://apps.apple.com/us/app/transporter/id1450874784?mt=12" + $console.set_command "$wizards.ios.start env: :#{@opts[:env]}, version: \"#{@opts[:version]}\"" + raise WizardException.new( + "* To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." + ) + else + sh "mkdir ./tmp/ios/intermediary_artifacts" + sh "mv \"#{tmp_directory}/#{@app_name}.app\" #{tmp_directory}/intermediary_artifacts/" + sh "mv \"#{tmp_directory}/do_zip.sh\" #{tmp_directory}/intermediary_artifacts" + sh "mv \"#{tmp_directory}/Entitlements.plist\" #{tmp_directory}/intermediary_artifacts" + sh "mv \"#{tmp_directory}/ipa_root\" #{tmp_directory}/intermediary_artifacts/" + sh "open /Applications/Transporter.app" + sh "open ./tmp/ios/" + end end def compile_icons @@ -40490,6 +43649,26 @@ Follows is a source code listing for all files that have been open sourced. This sh "cp -r \"#{root_folder}/native/\" \"#{app_path}/native/\"" sh "CODESIGN_ALLOCATE=\"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate\" /usr/bin/codesign -f -s \"#{@certificate_name}\" --entitlements #{tmp_directory}/Entitlements.plist \"#{tmp_directory}/#{@app_name}.app/native/ios-device/ext.dylib\"" end + + def set_version version + @app_version = version + start env: @opts[:env], version: version + end + + def app_version + log_info "Attempting to retrieve App Version from metadata/ios_metadata.txt." + ios_version_number = (ios_metadata.version || "").strip + if ios_version_number.length == 0 + log_info "Not found. Attempting to retrieve App Version from metadata/game_metadata.txt." + ios_version_number = (game_metadata.version || "").strip + end + ios_version_number + end + + def determine_app_version + @app_version = app_version + return if @app_version + end end #+end_src @@ -40497,42 +43676,19 @@ Follows is a source code listing for all files that have been open sourced. This *** itch_wizard.rb #+begin_src ruby # ./dragon/itch_wizard.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # itch_wizard.rb has been released under MIT (*only this file*). - class ItchWizard + class ItchWizard < Wizard def steps [ :check_metadata, - :deploy + :deploy, ] end - def metadata_file_path - "metadata/game_metadata.txt" - end - - def get_metadata - metadata = $gtk.read_file metadata_file_path - - if !metadata - write_blank_metadata - metadata = $gtk.read_file metadata_file_path - end - - dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a - - { - dev_id: dev_id.strip, - dev_title: dev_title.strip, - game_id: game_id.strip, - game_title: game_title.strip, - version: version.strip, - icon: icon.strip - } - end - def write_blank_metadata $gtk.write_file metadata_file_path, <<-S.strip #devid=myname @@ -40550,7 +43706,7 @@ Follows is a source code listing for all files that have been open sourced. This write_blank_metadata end - if metadata_text.each_line.to_a.length != 6 + if metadata_text.strip.each_line.to_a.length < 6 write_blank_metadata end @@ -40562,70 +43718,67 @@ Follows is a source code listing for all files that have been open sourced. This if metadata[:dev_id].start_with?("#") || !@dev_id log "* PROMPT: Please provide your username for Itch." - $console.set_command "$wizards.itch.set_dev_id \"your-itch-username\"" + $console.set_command "$wizards.itch.set_dev_id \"#{metadata[:dev_id]}\"" return :need_dev_id end if metadata[:dev_title].start_with?("#") || !@dev_title log "* PROMPT: Please provide developer's/company's name that you want displayed." - $console.set_command "$wizards.itch.set_dev_title \"Your Name\"" + $console.set_command "$wizards.itch.set_dev_title \"#{metadata[:dev_title]}\"" return :need_dev_title end if metadata[:game_id].start_with?("#") || !@game_id log "* PROMPT: Please provide the id for you game. This is the id you specified when you set up a new game page on Itch." - $console.set_command "$wizards.itch.set_game_id \"your-game-id\"" + $console.set_command "$wizards.itch.set_game_id \"#{metadata[:game_id]}\"" return :need_game_id end if metadata[:game_title].start_with?("#") || !@game_title log "* PROMPT: Please provide the display name for your game. (This can include spaces)" - $console.set_command "$wizards.itch.set_game_title \"Your Game\"" + $console.set_command "$wizards.itch.set_game_title \"#{metadata[:game_title]}\"" return :need_game_title end if metadata[:version].start_with?("#") || !@version log "* PROMPT: Please provide the version for your game." - $console.set_command "$wizards.itch.set_version \"1.0\"" + $console.set_command "$wizards.itch.set_version \"#{metadata[:version]}\"" return :need_version end if metadata[:icon].start_with?("#") || !@icon log "* PROMPT: Please provide icon path for your game." - $console.set_command "$wizards.itch.set_icon \"icon.png\"" + $console.set_command "$wizards.itch.set_icon \"#{metadata[:icon]}\"" return :need_icon end + puts "here!! success!!!" + return :success end def set_dev_id value @dev_id = value - write_metadata start end def set_dev_title value @dev_title = value - write_metadata start end def set_game_id value @game_id = value - write_metadata start end def set_game_title value @game_title = value - write_metadata start end def set_version value @version = value - write_metadata start end @@ -40668,7 +43821,7 @@ Follows is a source code listing for all files that have been open sourced. This end if @icon - text += "icon=metadata/#{@icon}\n" + text += "icon=#{@icon}\n" else text += "#icon=metadata/icon.png\n" end @@ -40686,10 +43839,25 @@ Follows is a source code listing for all files that have been open sourced. This def deploy log_info "* Running dragonruby-publish: #{package_command}" - results = $gtk.exec package_command + $gtk.openurl "http://itch.io/dashboard" if $gtk.platform == "Mac OS X" + if $gtk.platform? :mac + $gtk.exec "rm -rf ./builds" + end + results = $gtk.exec "#{package_command} --only-package" + puts File.expand_path("./builds") + log "#+begin_src" log results log "#+end_src" + + if $gtk.platform? :mac + $gtk.exec "open ./builds/" + elsif $gtk.platform? :windows + $gtk.exec "powershell \"ii .\"" + end + + $gtk.openurl "https://itch.io/dashboard" + :success end @@ -40700,7 +43868,7 @@ Follows is a source code listing for all files that have been open sourced. This steps.each do |m| begin log_info "Running Itch Wizard Step: ~$wizards.itch.#{m}~" - result = (send m) || :success if @wizard_status[m][:result] != :success + result = (send m) || :success @wizard_status[m][:result] = result if result != :success log_info "Exiting wizard. :#{result}" @@ -40771,6 +43939,7 @@ Follows is a source code listing for all files that have been open sourced. This *** layout.rb #+begin_src ruby # ./dragon/layout.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # layout.rb has been released under MIT (*only this file*). @@ -41049,10 +44218,18 @@ Follows is a source code listing for all files that have been open sourced. This device.grid_area.row_count end + def row_max_index + row_count - 1 + end + def col_count device.grid_area.col_count end + def col_max_index + col_count - 1 + end + def gutter_height device.grid_area.gutter end @@ -41075,18 +44252,124 @@ Follows is a source code listing for all files that have been open sourced. This def rect_defaults { - row: nil, - col: nil, - h: 1, - w: 1, - dx: 0, - dy: 0, - rect: :control_rect + row: nil, + col: nil, + h: 1, + w: 1, + dx: 0, + dx_ratio: 1, + dy: 0, + dy_ratio: 1, + dh_ratio: 1, + dw_ratio: 1, + merge: nil, + rect: :control_rect } end - def rect opts + def row n + (rect row: n, col: 0, w: 0, h: 0).x + end + + def row_from_bottom n + (rect row: row_count - n, col: 0, w: 0, h: 0).x + end + + def col n + (rect row: 0, col: n, w: 0, h: 0).y + end + + def col_from_right n + (rect row: 0, col: col_max_index - n, w: 0, h: 0).y + end + + def w n + (rect row: 0, col: 0, w: n, h: 1).w + end + + def h n + (rect row: 0, col: 0, w: 1, h: n).h + end + + def rect_group opts + group = opts.group + r = opts.row || 0 + r = row_max_index - opts.row_from_bottom if opts.row_from_bottom + c = opts.col || 0 + c = col_max_index - opts.col_from_right if opts.col_from_right + drow = opts.drow || 0 + dcol = opts.dcol || 0 + w = opts.w || 0 + h = opts.h || 0 + merge = opts[:merge] + + running_row = r + running_col = c + + running_col = calc_col_offset(opts.col_offset) if opts.col_offset + running_row = calc_row_offset(opts.row_offset) if opts.row_offset + + group.map do |i| + group_layout_opts = i.layout || {} + group_layout_opts = group_layout_opts.merge row: running_row, + col: running_col, + merge: merge, + w: w, h: h + result = (rect group_layout_opts).merge i + + if (i.is_a? Hash) && (i.primitive_marker == :label) + if i.alignment_enum == 1 + result.x += result.w.half + elsif i.alignment_enum == 2 + result.x += result.w + end + end + + running_row += drow + running_col += dcol + result + end + end + + def calc_row_offset opts = {} + count = opts[:count] || opts[:length] || 0 + h = opts.h || 1 + (row_count - (count * h)) / 2.0 + end + + def calc_col_offset opts = {} + count = opts[:count] || opts[:length] || 0 + w = opts.w || 1 + (col_count - (count * w)) / 2.0 + end + + def point opts = {} + opts.w = 1 + opts.h = 1 + opts.row ||= 0 + opts.col ||= 0 + r = rect opts + r.x += r.w * opts.col_anchor if opts.col_anchor + r.y += r.h * opts.row_anchor if opts.row_anchor + r + end + + def rect *all_opts + if all_opts.length == 1 + opts = all_opts.first + else + opts = {} + all_opts.each do |o| + opts.merge! o + end + end + + opts.row = row_max_index - opts.row_from_bottom if opts.row_from_bottom + opts.col = col_max_index - opts.col_from_right if opts.col_from_right opts = rect_defaults.merge opts + opts.row ||= 0 + opts.col ||= 0 + result = send opts[:rect] if opts[:row] && opts[:col] && opts[:w] && opts[:h] col = rect_col opts[:col], opts[:w] @@ -41094,7 +44377,9 @@ Follows is a source code listing for all files that have been open sourced. This result = control_rect.merge x: col.x, y: row.y, w: col.w, - h: row.h + h: row.h, + center_x: col.center_x, + center_y: row.center_y elsif opts[:row] && !opts[:col] result = rect_row opts[:row], opts[:h] elsif !opts[:row] && opts[:col] @@ -41132,13 +44417,21 @@ Follows is a source code listing for all files that have been open sourced. This result[:h] += device.grid_area.gutter * 2 end - result[:x] += opts[:dx] if opts[:dx] - result[:y] += opts[:dy] if opts[:dy] - result[:w] += opts[:dw] if opts[:dw] - result[:h] += opts[:dh] if opts[:dh] + result[:x] += opts[:dx] if opts[:dx] + result[:x] *= opts[:dx_ratio] if opts[:dx_ratio] + result[:y] += opts[:dy] if opts[:dy] + result[:y] *= opts[:dy_ratio] if opts[:dy_ratio] + result[:w] += opts[:dw] if opts[:dw] + result[:w] *= opts[:dw_ratio] if opts[:dw_ratio] + result[:h] += opts[:dh] if opts[:dh] + result[:h] *= opts[:dh_ratio] if opts[:dh_ratio] + result.merge! opts[:merge] if opts[:merge] result[:row] = opts[:row] result[:col] = opts[:col] + result[:h] = result[:h].clamp 0 + result[:w] = result[:w].clamp 0 + if $gtk.args.grid.name == :center result[:x] -= 640 result[:y] -= 360 @@ -41173,7 +44466,7 @@ Follows is a source code listing for all files that have been open sourced. This row_y = device.h - row_y - row_h - result = control_rect.merge y: row_y, h: row_h + result = control_rect.merge y: row_y, h: row_h, center_y: (row_y + row_h.half) @rect_cache[:row][index][h] = result @rect_cache[:row][index][h] end @@ -41196,7 +44489,7 @@ Follows is a source code listing for all files that have been open sourced. This col_w = col_w.to_i col_w -= 1 if col_w.odd? - result = control_rect.merge x: col_x, w: col_w + result = control_rect.merge x: col_x, w: col_w, center_x: (col_x + col_w.half) @rect_cache[:col][index][w] = result @rect_cache[:col][index][w] end @@ -41247,6 +44540,26 @@ Follows is a source code listing for all files that have been open sourced. This @device end + def debug_primitives opts = {} + @primitives ||= col_count.map_with_index do |col| + row_count.map_with_index do |row| + cell = rect row: row, col: col + center = Geometry.rect_center_point cell + [ + cell.merge(opts).border, + cell.merge(opts) + .label!(x: center.x, + y: center.y, + text: "#{row},#{col}", + size_enum: -3, + vertical_alignment_enum: 1, + alignment_enum: 1) + ] + end + end + @primitives + end + def serialize { device: @device.serialize, @@ -41260,6 +44573,13 @@ Follows is a source code listing for all files that have been open sourced. This def to_s serialize.to_s end + + def reset + @primitives = nil + @rect_cache ||= {} + @rect_cache.clear + end + end end @@ -41399,6 +44719,11 @@ Follows is a source code listing for all files that have been open sourced. This self.puts message end + def self.reset + @once = {} + nil + end + def self.puts_once *ids, message id = "#{ids}" @once ||= {} @@ -41535,6 +44860,55 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** metadata.rb +#+begin_src ruby + # ./dragon/metadata.rb + # coding: utf-8 + # Copyright 2021 DragonRuby LLC + # MIT License + # metadata.rb has been released under MIT (*only this file*). + + # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński + + module Metadata + def metadata_file_path + "metadata/game_metadata.txt" + end + + def get_metadata + metadata = $gtk.read_file metadata_file_path + + if !metadata + write_blank_metadata + metadata = $gtk.read_file metadata_file_path + end + + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a + + { + dev_id: dev_id.strip, + dev_title: dev_title.strip, + game_id: game_id.strip, + game_title: game_title.strip, + version: version.strip, + icon: icon.strip + } + end + + def write_blank_metadata + $gtk.write_file metadata_file_path, <<-S.strip + #devid=myname + #devtitle=My Name + #gameid=mygame + #gametitle=My Game + #version=0.1 + #icon=metadata/icon.png + S + end + end + +#+end_src + *** numeric.rb #+begin_src ruby # ./dragon/numeric.rb @@ -41553,6 +44927,35 @@ Follows is a source code listing for all files that have been open sourced. This alias_method :lte, :<= alias_method :__original_eq_eq__, :== unless Numeric.instance_methods.include? :__original_eq_eq__ + def to_layout_row opts = {} + $layout.rect(row: self, + col: opts.col || 0, + w: opts.w || 0, + h: opts.h || 0).y + end + + def to_layout_col opts = {} + $layout.rect(row: 0, + col: self, + w: opts.w || 0, + h: opts.h || 0).x + end + + def to_layout_w + $layout.rect(row: 0, col: 0, w: self, h: 1).w + end + + def to_layout_h + $layout.rect(row: 0, col: 0, w: 1, h: self).h + end + + def to_layout_row_from_bottom opts = {} + ($layout.row_max_index - self).to_layout_row opts + end + + def to_layout_col_from_right opts = {} + ($layout.col_max_index - self).to_layout_col opts + end # Converts a numeric value representing seconds into frames. # @@ -41568,10 +44971,26 @@ Follows is a source code listing for all files that have been open sourced. This self / 2.0 end + def third + self / 3.0 + end + + def quarter + self / 4.0 + end + def to_byte clamp(0, 255).to_i end + def clamp *opts + min = (opts.at 0) + max = (opts.at 1) + return min if min && self < min + return max if max && self > max + return self + end + def clamp_wrap min, max max, min = min, max if min > max return self if self >= min && self <= max @@ -41796,7 +45215,7 @@ Follows is a source code listing for all files that have been open sourced. This self * Math::PI.fdiv(180) end - # Converts a number representing an angle in radians to degress. + # Converts a number representing an angle in radians to degrees. # # @gtk def to_degrees @@ -41813,21 +45232,21 @@ Follows is a source code listing for all files that have been open sourced. This GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y) end - # Returns a normal vector for a number that represents an angle in degress. + # Returns a normal vector for a number that represents an angle in degrees. # # @gtk def vector max_value = 1 [vector_x(max_value), vector_y(max_value)] end - # Returns the y component of a normal vector for a number that represents an angle in degress. + # Returns the y component of a normal vector for a number that represents an angle in degrees. # # @gtk def vector_y max_value = 1 max_value * Math.sin(self.to_radians) end - # Returns the x component of a normal vector for a number that represents an angle in degress. + # Returns the x component of a normal vector for a number that represents an angle in degrees. # # @gtk def vector_x max_value = 1 @@ -41854,6 +45273,18 @@ Follows is a source code listing for all files that have been open sourced. This (self % n) == 0 end + def multiply n + self * n + end + + def fmult n + self * n.to_f + end + + def imult n + (self * n).to_i + end + def mult n self * n end @@ -41955,32 +45386,6 @@ Follows is a source code listing for all files that have been open sourced. This (0..self).to_a end - def >= other - return false if !other - return gte other - end - - def > other - return false if !other - return gt other - end - - def <= other - return false if !other - return lte other - end - - def < other - return false if !other - return gt other - end - - def == other - return true if __original_eq_eq__ other - return __original_eq_eq__ other.entity_id if other.is_a? OpenEntity - return false - end - # @gtk def map unless block_given? @@ -42066,34 +45471,6 @@ Follows is a source code listing for all files that have been open sourced. This S end - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - def serialize self end @@ -42119,6 +45496,10 @@ Follows is a source code listing for all files that have been open sourced. This def self.clamp n, min, max n.clamp min, max end + + def mid? l, r + (between? l, r) || (between? r, l) + end end class Fixnum @@ -42144,40 +45525,6 @@ Follows is a source code listing for all files that have been open sourced. This return !even? end - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def == other - return true if __original_eq_eq__ other - return __original_eq_eq__ other.entity_id if other.is_a? GTK::OpenEntity - return false - end - # Returns `-1` if the number is less than `0`. `+1` if the number # is greater than `0`. Returns `0` if the number is equal to `0`. # @@ -42233,34 +45580,6 @@ Follows is a source code listing for all files that have been open sourced. This alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__ alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__ - def - other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :-, e - end - - def + other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :+, e - end - - def * other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :*, e - end - - def / other - return nil unless other - super - rescue Exception => e - __raise_arithmetic_exception__ other, :/, e - end - def serialize self end @@ -42302,6 +45621,276 @@ Follows is a source code listing for all files that have been open sourced. This def nan? false end + + def center other + (self - other).abs.fdiv(2) + end + end + +#+end_src + +*** recording.rb +#+begin_src ruby + # ./dragon/recording.rb + # coding: utf-8 + # Copyright 2019 DragonRuby LLC + # MIT License + # recording.rb has been released under MIT (*only this file*). + + module GTK + # FIXME: Gross + # @gtk + class Replay + # @gtk + def self.start file_name = nil + $recording.start_replay file_name + end + + # @gtk + def self.stop + $recording.stop_replay + end + end + + # @gtk + class Recording + def initialize runtime + @runtime = runtime + @tick_count = 0 + @global_input_order = 1 + end + + def tick + @tick_count += 1 + end + + def start_recording seed_number = nil + if !seed_number + log <<-S + * ERROR: + To start recording, you must provide an integer value to + seed random number generation. + S + $console.set_command "$recording.start SEED_NUMBER" + return + end + + if @is_recording + log <<-S + * ERROR: + You are already recording, first cancel (or stop) the current recording. + S + $console.set_command "$recording.cancel" + return + end + + if @is_replaying + log <<-S + * ERROR: + You are currently replaying a recording, first stop the replay. + S + return + end + + log_info <<-S + Recording has begun with RNG seed value set to #{seed_number}. + To stop recording use stop_recording(filename). + The recording will stop without saving a file if a filename is nil. + S + + $console.set_command "$recording.stop 'replay.txt'" + @runtime.__reset__ + @seed_number = seed_number + @runtime.set_rng seed_number + + @tick_count = 0 + @global_input_order = 1 + @is_recording = true + @input_history = [] + @runtime.notify! "Recording started. When completed, open the console to save it using $recording.stop FILE_NAME (or cancel).", 300 + end + + # @gtk + def start seed_number = nil + start_recording seed_number + end + + def is_replaying? + @is_replaying + end + + def is_recording? + @is_recording + end + + # @gtk + def stop file_name = nil + stop_recording file_name + end + + # @gtk + def cancel + stop_recording_core + @runtime.notify! "Recording cancelled." + end + + def stop_recording file_name = nil + if !file_name + log <<-S + * ERROR: + To please specify a file name when calling: + $recording.stop FILE_NAME + + If you do NOT want to save the recording, call: + $recording.cancel + S + $console.set_command "$recording.stop 'replay.txt'" + return + end + + if !@is_recording + log_info "You are not currently recording. Use start_recording(seed_number) to start recording." + $console.set_command "$recording.start" + return + end + + if file_name + text = "replay_version 2.0\n" + text << "stopped_at #{@tick_count}\n" + text << "seed #{@seed_number}\n" + text << "recorded_at #{Time.now.to_s}\n" + @input_history.each do |items| + text << "#{items}\n" + end + @runtime.write_file file_name, text + @runtime.write_file 'last_replay.txt', text + log_info "The recording has been saved successfully at #{file_name}. You can use start_replay(\"#{file_name}\") to replay the recording." + end + + $console.set_command "$replay.start '#{file_name}'" + stop_recording_core + @runtime.notify! "Recording saved to #{file_name}. To replay it: $replay.start \"#{file_name}\"." + log_info "You can run the replay later on startup using: ./dragonruby mygame --replay #{@replay_file_name}" + nil + end + + def stop_recording_core + @is_recording = false + @input_history = nil + @last_history = nil + @runtime.__reset__ + end + + def start_replay file_name = nil + if !file_name + log <<-S + * ERROR: + Please provide a file name to $recording.start. + S + $console.set_command "$replay.start 'replay.txt'" + return + end + + text = @runtime.read_file file_name + return false unless text + + if text.each_line.first.strip != "replay_version 2.0" + raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)." + end + + @replay_file_name = file_name + + $replay_data = { input_history: { } } + text.each_line do |l| + if l.strip.length == 0 + next + elsif l.start_with? 'replay_version' + next + elsif l.start_with? 'seed' + $replay_data[:seed] = l.split(' ').last.to_i + elsif l.start_with? 'stopped_at' + $replay_data[:stopped_at] = l.split(' ').last.to_i + elsif l.start_with? 'recorded_at' + $replay_data[:recorded_at] = l.split(' ')[1..-1].join(' ') + elsif l.start_with? '[' + name, value_1, value_2, value_count, id, tick_count = l.strip.gsub('[', '').gsub(']', '').split(',') + $replay_data[:input_history][tick_count.to_i] ||= [] + $replay_data[:input_history][tick_count.to_i] << { + id: id.to_i, + name: name.gsub(':', '').to_sym, + value_1: value_1.to_f, + value_2: value_2.to_f, + value_count: value_count.to_i + } + else + raise "Replay data seems corrupt. I don't know how to parse #{l}." + end + end + + $replay_data[:input_history].keys.each do |key| + $replay_data[:input_history][key] = $replay_data[:input_history][key].sort_by {|input| input[:id]} + end + + @runtime.__reset__ + @runtime.set_rng $replay_data[:seed] + @tick_count = 0 + @is_replaying = true + log_info "Replay has been started." + @runtime.notify! "Replay started [#{@replay_file_name}]." + end + + def stop_replay notification_message = "Replay has been stopped." + if !is_replaying? + log <<-S + * ERROR: + No replay is currently running. Call $replay.start FILE_NAME to start a replay. + S + + $console.set_command "$replay.start 'replay.txt'" + return + end + log_info notification_message + @is_replaying = false + $replay_data = nil + @tick_count = 0 + @global_input_order = 1 + $console.set_command_silent "$replay.start '#{@replay_file_name}'" + @runtime.__reset__ + @runtime.notify! notification_message + end + + def record_input_history name, value_1, value_2, value_count, clear_cache = false + return if @is_replaying + return unless @is_recording + @input_history << [name, value_1, value_2, value_count, @global_input_order, @tick_count] + @global_input_order += 1 + end + + def stage_replay_values + return unless @is_replaying + return unless $replay_data + + if $replay_data[:stopped_at] <= @tick_count + stop_replay "Replay completed [#{@replay_file_name}]. To rerun, bring up the Console and press enter." + return + end + + inputs_this_tick = $replay_data[:input_history][@tick_count] + + if @tick_count.zmod? 60 + log_info "Replay ends in #{($replay_data[:stopped_at] - @tick_count).idiv 60} second(s)." + end + + return unless inputs_this_tick + inputs_this_tick.each do |v| + args = [] + args << v[:value_1] if v[:value_count] >= 1 + args << v[:value_2] if v[:value_count] >= 2 + args << :replay + $gtk.send v[:name], *args + end + end + end end #+end_src @@ -42358,7 +45947,7 @@ Follows is a source code listing for all files that have been open sourced. This def local_state @local_state ||= OpenEntity.new @local_state.hotload_client ||= @local_state.new_entity(:hotload_client, - notes: "This enitity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", + notes: "This entity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", changes: { }, changes_queue: [], reloaded_files_times: []) @@ -42508,6 +46097,7 @@ Follows is a source code listing for all files that have been open sourced. This *** runtime/autocomplete.rb #+begin_src ruby # ./dragon/runtime/autocomplete.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # autocomplete.rb has been released under MIT (*only this file*). @@ -42534,7 +46124,7 @@ Follows is a source code listing for all files that have been open sourced. This sub_index = index - previous_line[:sum] word = (cursor_line[:line][0..sub_index - 1]).strip token = (word.split " ")[-1] - dots = (token.split ".") + dots = (token.split ".").flat_map { |s| s.split "[" }.flat_map { |s| s.split "]" }.flat_map { |s| s.split "(" }.flat_map { |s| s.split ")" } dot = dots[-1] end @@ -42555,6 +46145,10 @@ Follows is a source code listing for all files that have been open sourced. This ignores ||= [] ignores = [ignores].flatten keys = keys.map { |k| k.to_s } + keys = keys.reject { |k| k.include? '"' } + .reject { |k| k.start_with? "'" } + .reject { |k| k.include? "," } + .reject { |k| k.start_with? "#" } others = ["def", "end"] + [ :entity_keys_by_ref, :entity_name, @@ -42612,6 +46206,10 @@ Follows is a source code listing for all files that have been open sourced. This return autocomplete_filter_methods lookup_result.call if lookup_result + if dot[0].upcase == dot[0] && (Object.const_defined? dot.to_sym) + return (Object.const_get dot.to_sym).autocomplete_methods + end + start_collecting = false dots_after_state = dots.find_all do |s| if s == "state" @@ -42627,10 +46225,16 @@ Follows is a source code listing for all files that have been open sourced. This target = target.as_hash[k.to_sym] if target.respond_to? :as_hash end - return autocomplete_filter_methods target.as_hash.keys + if target.respond_to? :as_hash + return autocomplete_filter_methods target.as_hash.keys + else + return autocomplete_filter_methods target.autocomplete_methods + end end + text = text.each_line.reject { |l| l.strip.start_with? "#" }.join "\n" + text = text.each_line.map { |l| l.split("#").first }.join "\n" text.gsub!("[", " ") text.gsub!("]", " ") text.gsub!("(", " ") @@ -42647,154 +46251,159 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -*** runtime/draw.rb +*** runtime/benchmark.rb #+begin_src ruby - # ./dragon/runtime/draw.rb + # ./dragon/runtime/benchmark.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License - # draw.rb has been released under MIT (*only this file*). + # benchmark.rb has been released under MIT (*only this file*). module GTK class Runtime - module Draw - def primitives pass - if $top_level.respond_to? :primitives_override - return $top_level.tick_render @args, pass - end - - # Don't change this draw order unless you understand - # the implications. - - # pass.solids.each { |s| draw_solid s } - # while loops are faster than each with block - idx = 0 - length = pass.solids.length - while idx < pass.solids.length - draw_solid (pass.solids.at idx) # accessing an array using .value instead of [] is faster - idx += 1 - end - - # pass.static_solids.each { |s| draw_solid s } + module Benchmark + def benchmark_single iterations, name, proc + log <<-S + ** Invoking :#{name}... + S idx = 0 - length = pass.static_solids.length - while idx < length - draw_solid (pass.static_solids.at idx) + r = nil + time_start = Time.now + while idx < iterations + r = proc.call idx += 1 end + result = (Time.now - time_start).round 3 - # pass.sprites.each { |s| draw_sprite s } - idx = 0 - length = pass.sprites.length - while idx < length - draw_sprite (pass.sprites.at idx) - idx += 1 - end + { name: name, + time: result, + time_ms: (result * 1000).to_i } + end - # pass.static_sprites.each { |s| draw_sprite s } - idx = 0 - length = pass.static_sprites.length - while idx < length - draw_sprite (pass.static_sprites.at idx) - idx += 1 - end + def benchmark opts = {} + iterations = opts.iterations - # pass.primitives.each { |p| draw_primitive p } - idx = 0 - length = pass.primitives.length - while idx < length - draw_primitive (pass.primitives.at idx) - idx += 1 - end - - # pass.static_primitives.each { |p| draw_primitive p } - idx = 0 - length = pass.static_primitives.length - while idx < length - draw_primitive (pass.static_primitives.at idx) - idx += 1 - end + log <<-S + * BENCHMARK: Started + ** Caller: #{(caller || []).first} + ** Iterations: #{iterations} + S + procs = opts.find_all { |k, v| v.respond_to? :call } + + times = procs.map do |(name, proc)| + benchmark_single iterations, name, proc + end.sort_by { |r| r.time } + + first_place = times.first + second_place = times.second || first_place + + times = times.map do |candidate| + average_time = first_place.time + .add(candidate.time) + .abs + .fdiv(2) + + difference_percentage = 0 + if average_time == 0 + difference_percentage = 0 + else + difference_percentage = first_place.time + .subtract(candidate.time) + .abs + .fdiv(average_time) + .imult(100) + end - # pass.labels.each { |l| draw_label l } - idx = 0 - length = pass.labels.length - while idx < length - draw_label (pass.labels.at idx) - idx += 1 + difference_time = ((first_place.time - candidate.time) * 1000).round + candidate.merge(difference_percentage: difference_percentage, + difference_time: difference_time) end - # pass.static_labels.each { |l| draw_label l } - idx = 0 - length = pass.static_labels.length - while idx < length - draw_label (pass.static_labels.at idx) - idx += 1 + too_small_to_measure = false + if (first_place.time + second_place.time) == 0 + too_small_to_measure = true + difference_percentage = 0 + log <<-S + * BENCHMARK: Average time for experiments were too small. Increase the number of iterations. + S + else + difference_percentage = (((first_place.time - second_place.time).abs.fdiv((first_place.time + second_place.time).abs.fdiv(2))) * 100).round end - # pass.lines.each { |l| draw_line l } - idx = 0 - length = pass.lines.length - while idx < length - draw_line (pass.lines.at idx) - idx += 1 - end + difference_time = first_place.time.-(second_place.time).*(1000).abs.round - # pass.static_lines.each { |l| draw_line l } - idx = 0 - length = pass.static_lines.length - while idx < pass.static_lines.length - draw_line (pass.static_lines.at idx) - idx += 1 - end + r = { + iterations: iterations, + first_place: first_place, + second_place: second_place, + difference_time: difference_time, + difference_percentage: difference_percentage, + times: times, + too_small_to_measure: too_small_to_measure + } - # pass.borders.each { |b| draw_border b } - idx = 0 - length = pass.borders.length - while idx < length - draw_border (pass.borders.at idx) - idx += 1 - end + log_message = [] + only_one_result = first_place.name == second_place.name - # pass.static_borders.each { |b| draw_border b } - idx = 0 - length = pass.static_borders.length - while idx < length - draw_border (pass.static_borders.at idx) - idx += 1 + if only_one_result + log <<-S + * BENCHMARK: #{r.first_place.name} completed in #{r.first_place.time_ms}ms." + S + else + log <<-S + * BENCHMARK: #{r.message} + ** Fastest: #{r.first_place.name.inspect} + ** Second: #{r.second_place.name.inspect} + ** Margin: #{r.difference_percentage}% (#{r.difference_time.abs}ms) #{r.first_place.time_ms}ms vs #{r.second_place.time_ms}ms. + ** Times: + #{r.times.map { |t| "*** #{t.name}: #{t.time_ms}ms (#{t.difference_percentage}% #{t.difference_time.abs}ms)." }.join("\n")} + S end - if !$gtk.production - # pass.debug.each { |r| draw_primitive r } - idx = 0 - length = pass.debug.length - while idx < length - draw_primitive (pass.debug.at idx) - idx += 1 - end + r + end + end + end + end + +#+end_src + +*** runtime/draw.rb +#+begin_src ruby + # ./dragon/runtime/draw.rb + # coding: utf-8 + # Copyright 2019 DragonRuby LLC + # MIT License + # draw.rb has been released under MIT (*only this file*). - # pass.static_debug.each { |r| draw_primitive r } - idx = 0 - length = pass.static_debug.length - while idx < length - draw_primitive (pass.static_debug.at idx) - idx += 1 - end + module GTK + class Runtime + module Draw + def primitives pass + if $top_level.respond_to? :primitives_override + return $top_level.tick_render @args, pass end - # pass.reserved.each { |r| draw_primitive r } - idx = 0 - length = pass.reserved.length - while idx < length - draw_primitive (pass.reserved.at idx) - idx += 1 + fn.each_send pass.solids, self, :draw_solid + fn.each_send pass.static_solids, self, :draw_solid + fn.each_send pass.sprites, self, :draw_sprite + fn.each_send pass.static_sprites, self, :draw_sprite + fn.each_send pass.primitives, self, :draw_primitive + fn.each_send pass.static_primitives, self, :draw_primitive + fn.each_send pass.labels, self, :draw_label + fn.each_send pass.static_labels, self, :draw_label + fn.each_send pass.lines, self, :draw_line + fn.each_send pass.static_lines, self, :draw_line + fn.each_send pass.borders, self, :draw_border + fn.each_send pass.static_borders, self, :draw_border + + if !self.production + fn.each_send pass.debug, self, :draw_primitive + fn.each_send pass.static_debug, self, :draw_primitive end - # pass.static_reserved.each { |r| draw_primitive r } - idx = 0 - length = pass.static_reserved.length - while idx < length - draw_primitive (pass.static_reserved.at idx) - idx += 1 - end + fn.each_send pass.reserved, self, :draw_primitive + fn.each_send pass.static_reserved, self, :draw_primitive rescue Exception => e pause! pretty_print_exception_and_export! e @@ -42805,7 +46414,10 @@ Follows is a source code listing for all files that have been open sourced. This if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_solid s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h, + s.r, s.g, s.b, s.a, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :solid @@ -42816,14 +46428,16 @@ Follows is a source code listing for all files that have been open sourced. This if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_sprite_3 s.x, s.y, s.w, s.h, - s.path.s_or_default, + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h, + (s.path || '').to_s, s.angle, s.a, s.r, s.g, s.b, s.tile_x, s.tile_y, s.tile_w, s.tile_h, !!s.flip_horizontally, !!s.flip_vertically, s.angle_anchor_x, s.angle_anchor_y, - s.source_x, s.source_y, s.source_w, s.source_h + s.source_x, s.source_y, s.source_w, s.source_h, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :sprite @@ -42834,7 +46448,8 @@ Follows is a source code listing for all files that have been open sourced. This if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_screenshot s.path.s_or_default, + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_screenshot (s.path || '').to_s, s.x, s.y, s.w, s.h, s.angle, s.a, s.r, s.g, s.b, @@ -42852,10 +46467,14 @@ Follows is a source code listing for all files that have been open sourced. This if l.respond_to? :draw_override l.draw_override @ffi_draw else - @ffi_draw.draw_label l.x, l.y, l.text.s_or_default, - l.size_enum, l.alignment_enum, - l.r, l.g, l.b, l.a, - l.font.s_or_default(nil) + l = l.as_hash if l.is_a? OpenEntity + @ffi_draw.draw_label_3 l.x, l.y, + (l.text || '').to_s, + l.size_enum, l.alignment_enum, + l.r, l.g, l.b, l.a, + l.font, + (l.vertical_alignment_enum || 2), + (l.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed l, e, :label @@ -42866,7 +46485,22 @@ Follows is a source code listing for all files that have been open sourced. This if l.respond_to? :draw_override l.draw_override @ffi_draw else - @ffi_draw.draw_line l.x, l.y, l.x2, l.y2, l.r, l.g, l.b, l.a + l = l.as_hash if l.is_a? OpenEntity + if l.x2 + @ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2, + l.r, l.g, l.b, l.a, + (l.blendmode_enum || 1) + else + w = l.w || 0 + w = 1 if w == 0 + h = l.h || 0 + h = 1 if h == 0 + @ffi_draw.draw_line_2 l.x, l.y, + l.x + w - 1, + l.y + h - 1, + l.r, l.g, l.b, l.a, + (l.blendmode_enum || 1) + end end rescue Exception => e raise_conversion_for_rendering_failed l, e, :line @@ -42877,7 +46511,10 @@ Follows is a source code listing for all files that have been open sourced. This if s.respond_to? :draw_override s.draw_override @ffi_draw else - @ffi_draw.draw_border s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity + @ffi_draw.draw_border_2 s.x, s.y, s.w, s.h, + s.r, s.g, s.b, s.a, + (s.blendmode_enum || 1) end rescue Exception => e raise_conversion_for_rendering_failed s, e, :border @@ -42897,7 +46534,6 @@ Follows is a source code listing for all files that have been open sourced. This pause! pretty_print_exception_and_export! e end - end end end @@ -42907,6 +46543,7 @@ Follows is a source code listing for all files that have been open sourced. This *** runtime/framerate.rb #+begin_src ruby # ./dragon/runtime/framerate.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # framerate.rb has been released under MIT (*only this file*). @@ -42942,13 +46579,8 @@ Follows is a source code listing for all files that have been open sourced. This if @tick_speed_count > 60 * 2 if framerate_below_threshold? @last_framerate = current_framerate - if [email protected]? - if !@framerate_important_notification_happened - log_important framerate_warning_message - else - log framerate_warning_message - end - @framerate_important_notification_happened = true + if [email protected]? && [email protected]_replaying? + log framerate_warning_message end end @@ -42996,6 +46628,7 @@ Follows is a source code listing for all files that have been open sourced. This *** runtime/framerate_diagnostics.rb #+begin_src ruby # ./dragon/runtime/framerate_diagnostics.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # framerate_diagnostics.rb has been released under MIT (*only this file*). @@ -43113,7 +46746,7 @@ Follows is a source code listing for all files that have been open sourced. This def framerate_diagnostics_primitives [ - { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid, + { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid!, { x: 5, y: 5.from_top, @@ -43122,7 +46755,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 20.from_top, @@ -43131,7 +46764,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 35.from_top, @@ -43140,7 +46773,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 50.from_top, @@ -43149,7 +46782,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255, size_enum: -2 - }.label, + }.label!, { x: 5, y: 65.from_top, @@ -43158,7 +46791,7 @@ Follows is a source code listing for all files that have been open sourced. This g: 255, b: 255, size_enum: -2 - }.label, + }.label!, ] end @@ -43183,7 +46816,14 @@ Follows is a source code listing for all files that have been open sourced. This def hotload_init @hotload_if_needed = 0 @mailbox_if_needed = 0 + + # schema for file_mtimes + # { FILE_PATH: { current: (Time as Fixnum), + # last: (Time as Fixnum) }, + # FILE_PATH: { current: (Time as Fixnum), + # last: (Time as Fixnum) } } @file_mtimes = { } + @suppress_mailbox = true files_to_reload.each { |f| init_mtimes f } init_mtimes 'app/mailbox.rb' @@ -43221,6 +46861,7 @@ Follows is a source code listing for all files that have been open sourced. This 'dragon/symbol.rb', 'dragon/numeric_deprecated.rb', 'dragon/numeric.rb', + 'dragon/hash_deprecated.rb', 'dragon/hash.rb', 'dragon/outputs_deprecated.rb', 'dragon/array_docs.rb', @@ -43253,6 +46894,7 @@ Follows is a source code listing for all files that have been open sourced. This 'dragon/trace.rb', 'dragon/readme_docs.rb', 'dragon/hotload_client.rb', + 'dragon/wizards.rb', 'dragon/ios_wizard.rb', 'dragon/itch_wizard.rb', ] + core_files_to_reload + @required_files @@ -43271,10 +46913,8 @@ Follows is a source code listing for all files that have been open sourced. This end def init_mtimes file - current_key = "current_#{file}".to_sym - last_key = "last_#{file}".to_sym - @file_mtimes[current_key] ||= @ffi_file.mtime(file) - @file_mtimes[last_key] ||= @ffi_file.mtime(file) + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), + last: @ffi_file.mtime(file) } end def hotload_source_files @@ -43306,25 +46946,36 @@ Follows is a source code listing for all files that have been open sourced. This end def hotload_if_needed + return if Kernel.tick_count < 0 hotload_source_files check_mailbox end def on_load_succeeded file - @rcb_sender.files_reloaded << file - @rcb_sender.reloaded_files << file + self.files_reloaded << file + self.reloaded_files << file Trace.untrace_classes! end + def reset_all_mtimes + @file_mtimes.each do |file, _| + @file_mtimes[file].current = @ffi_file.mtime(file) + @file_mtimes[file].last = @file_mtimes[file].current + end + + files_to_reload.each do |file, _| + @file_mtimes[file] ||= {} + @file_mtimes[file].current = @ffi_file.mtime(file) + @file_mtimes[file].last = @file_mtimes[file].current + end + end + def reload_if_needed file, force = false - current_key = "current_#{file}".to_sym - last_key = "last_#{file}".to_sym - @file_mtimes[current_key] ||= nil - @file_mtimes[last_key] ||= nil - @file_mtimes[current_key] = @ffi_file.mtime(file) - return if !force && @file_mtimes[last_key] == @file_mtimes[current_key] + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), last: @ffi_file.mtime(file) } + @file_mtimes[file].current = @ffi_file.mtime(file) + return if !force && @file_mtimes[file].current == @file_mtimes[file].last on_load_succeeded file if reload_ruby_file file - @file_mtimes[last_key] = @file_mtimes[current_key] + @file_mtimes[file].last = @file_mtimes[file].current end end end @@ -43366,6 +47017,30 @@ Follows is a source code listing for all files that have been open sourced. This end end + def char_byte + return nil if self.length == 0 + c = self.each_char.first.bytes + c = c.first if c.is_a? Enumerable + c + end + + def insert_character_at index, char + t = each_char.to_a + t = (t.insert index, char) + t.join + end + + def excluding_character_at index + t = each_char.to_a + t.delete_at index + t.join + end + + def excluding_last_character + return "" if self.length <= 1 + return excluding_character_at(self.length - 1) + end + def end_with_bang? self[-1] == "!" end @@ -43583,7 +47258,7 @@ Follows is a source code listing for all files that have been open sourced. This log "#{self.failed.length} test(s) failed." self.failed.each do |h| log "**** Test name: :#{h[:m]}" - log "#{h[:e].to_s.gsub("* ERROR:", "").strip}" + log "#{h[:e].to_s.gsub("* ERROR:", "").strip}\n#{h[:e].__backtrace_to_org__}" end end end @@ -43781,13 +47456,156 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src +*** tweetcart.rb +#+begin_src ruby + # ./dragon/tweetcart.rb + # coding: utf-8 + # Copyright 2019 DragonRuby LLC + # MIT License + # tweetcart.rb has been released under MIT (*only this file*). + + def $top_level.TICK &block + $top_level.define_method(:tick) do |args| + args.outputs[:scene].w = 160 + args.outputs[:scene].h = 90 + args.outputs[:scene].background_color = [0, 0, 0, 0] + block.call args + args.outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :scene } + end + + def $top_level.bg! *rgb + r,g,b = rgb + r ||= 255 + g ||= r + b ||= g + $args.outputs.background_color = [r, g, b] + end + + def $top_level.slds + $args.outputs[:scene].sprites + end + + def $top_level.slds! *os + if (os.first.is_a? Numeric) + sld!(*os) + else + os.each { |o| sld!(*o) } + end + end + + def $top_level.sld! *params + x, y, w, h, r, g, b, a = nil + if params.length == 2 + x, y = params + elsif params.length == 3 && (params.last.is_a? Array) + x = params[0] + y = params[1] + r, g, b, a = params[2] + r ||= 255 + g ||= r + b ||= g + a ||= 255 + elsif params.length == 4 + x, y, w, h = params + elsif params.length == 5 && (params.last.is_a? Array) + x = params[0] + y = params[1] + w = params[2] + h = params[3] + r,g,b,a = params[4] + r ||= 255 + g ||= r + b ||= g + a ||= 255 + elsif params.length >= 7 + x, y, w, h, r, g, b = params + else + raise "I don't know how to render #{params} with reasonable defaults." + end + + w ||= 1 + h ||= 1 + r ||= 255 + g ||= 255 + b ||= 255 + a ||= 255 + + slds << { x: x, y: y, + w: w, h: h, + r: r, g: g, b: b, a: a, + path: :pixel } + end + end + + =begin + wht = [255] * 3 + red = [255, 0, 0] + blu = [0, 130, 255] + purp = [150, 80, 255] + + TICK { + bg! 0 + + slds << [0, 0, 3, 3, 0, 255, 0, 255] + + sld! 10, 10 + sld! 20, 20, 3, 2 + sld! 30, 30, 2, 2, red + sld! 35, 35, blu + + slds! 40, 40 + + slds! [50, 50], + [60, 60, purp], + [70, 70, 10, 10, wht], + [80, 80, 4, 4, 255, 0, 255] + } + =end + +#+end_src + *** wizards.rb #+begin_src ruby # ./dragon/wizards.rb + # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License # wizards.rb has been released under MIT (*only this file*). + class Wizard + def metadata_file_path + "metadata/game_metadata.txt" + end + + def get_metadata + metadata = $gtk.read_file metadata_file_path + + if !metadata + write_blank_metadata + metadata = $gtk.read_file metadata_file_path + end + + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a + + { + dev_id: dev_id.strip.gsub("#", "").gsub("devid=", ""), + dev_title: dev_title.strip.gsub("#", "").gsub("devtitle=", ""), + game_id: game_id.strip.gsub("#", "").gsub("gameid=", ""), + game_title: game_title.strip.gsub("#", "").gsub("gametitle=", ""), + version: version.strip.gsub("#", "").gsub("version=", ""), + icon: icon.strip.gsub("#", "").gsub("icon=", "") + } + end + end + + class WizardException < Exception + attr_accessor :console_primitives + + def initialize *console_primitives + @console_primitives = console_primitives + end + end + module GTK class Wizards attr_accessor :ios, :itch diff --git a/docs/parse_log.txt b/docs/parse_log.txt index 5f10281..047852d 100644 --- a/docs/parse_log.txt +++ b/docs/parse_log.txt @@ -40,11 +40,6 @@ To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fa - End of paragraph detected. *** True Line Result -** Processing line: ~[[docs_search.gif]]~ -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result -[[docs_search.gif]] ** Processing line: ~* Hello World~ - Header detected. *** True Line Result @@ -126,50 +121,91 @@ I am a Dragon Rider. - End of paragraph detected. *** True Line Result -** Processing line: ~* Watch Some Intro Videos~ +** Processing line: ~* Intro Videos~ - Header detected. *** True Line Result *** True Line Result -* Watch Some Intro Videos +* Intro Videos ** Processing line: ~~ - End of paragraph detected. *** True Line Result -** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch~ -** Processing line: ~break. So please watch them:~ +** Processing line: ~Here are some videos to help you get the lay of the land.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them: +Here are some videos to help you get the lay of the land. +** Processing line: ~** Quick Api Tour~ +- Header detected. +*** True Line Result + +*** True Line Result +** Quick Api Tour +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ - Line was identified as a start of a list. *** True Line Result -** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ -- Line was identified as a continuation of a list. +** Processing line: ~~ +- End of paragraph detected. *** True Line Result 1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] -** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +** Processing line: ~** If You Are Completely New to Ruby and Programming~ +- Header detected. +*** True Line Result + +*** True Line Result +** If You Are Completely New to Ruby and Programming +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~1. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ - Line was identified as a continuation of a list. *** True Line Result -2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +1. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +** Processing line: ~3. You may also want to try this free course provided at [[http://dragonruby.school]].~ +- Line was identified as a continuation of a list. +*** True Line Result +2. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] ** Processing line: ~~ - End of paragraph detected. *** True Line Result -3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] -** Processing line: ~The second and third videos are not required if you are proficient~ -** Processing line: ~with Ruby, but *definitely* watch the first one.~ +3. You may also want to try this free course provided at [[http://dragonruby.school]]. +** Processing line: ~** If You Have Game Dev Experience~ +- Header detected. +*** True Line Result + +*** True Line Result +** If You Have Game Dev Experience ** Processing line: ~~ - End of paragraph detected. *** True Line Result -The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one. -** Processing line: ~You may also want to try this free course provided at~ -** Processing line: ~[[http://dragonruby.school]].~ + +** Processing line: ~1. Building Tetris - Part 1: [[https://youtu.be/xZMwRSbC4rY]]~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. Building Tetris - Part 2: [[https://youtu.be/C3LLzDUDgz4]]~ +- Line was identified as a continuation of a list. +*** True Line Result +1. Building Tetris - Part 1: [[https://youtu.be/xZMwRSbC4rY]] +** Processing line: ~3. Low Res Game Jam Tutorial: [[https://youtu.be/pCI90ukKCME]]~ +- Line was identified as a continuation of a list. +*** True Line Result +2. Building Tetris - Part 2: [[https://youtu.be/C3LLzDUDgz4]] ** Processing line: ~~ - End of paragraph detected. *** True Line Result -You may also want to try this free course provided at [[http://dragonruby.school]]. +3. Low Res Game Jam Tutorial: [[https://youtu.be/pCI90ukKCME]] ** Processing line: ~* Getting Started Tutorial~ - Header detected. *** True Line Result @@ -1115,7 +1151,7 @@ If you have a Pro subscription, you also have the capability to deploy to mobile *** True Line Result To deploy to iOS, you need to have a Mac running MacOS Catalina, an iOS device, and an active/paid Developer Account with Apple. From the Console type: ~$wizards.ios.start~ and you will be guided through the deployment process. ** Processing line: ~To deploy to Android, you need to have an Android emulator/device, and~ -** Processing line: ~a environment that is able to run Android SDK. ~dragonruby-publish~~ +** Processing line: ~an environment that is able to run Android SDK. ~dragonruby-publish~~ ** Processing line: ~will create an APK for you. From there, you can sign the APK and~ ** Processing line: ~install it to your device. The signing and installation procedure~ ** Processing line: ~varies from OS to OS. Here's an example of what the command might look~ @@ -1123,7 +1159,7 @@ To deploy to iOS, you need to have a Mac running MacOS Catalina, an iOS device, ** Processing line: ~~ - End of paragraph detected. *** True Line Result -To deploy to Android, you need to have an Android emulator/device, and a environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like: +To deploy to Android, you need to have an Android emulator/device, and an environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like: ** Processing line: ~#+begin_src~ - Line was identified as the beginning of a code block. *** True Line Result @@ -1168,11 +1204,11 @@ To deploy to Android, you need to have an Android emulator/device, and a environ ** Processing line: ~game engines. Given that Game Toolkit is a relatively new engine,~ ** Processing line: ~there are definitely features that are missing. So having a big check~ ** Processing line: ~list of "all the cool things" is not this engine's forte. This is~ -** Processing line: ~compensated with a strong commitment to the following principals.~ +** Processing line: ~compensated with a strong commitment to the following principles.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. +The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principles. ** Processing line: ~** Challenge The Status Quo~ - Header detected. *** True Line Result @@ -1238,16 +1274,16 @@ There is a programming idiom in software called "The Pit of Success". The term n ** Processing line: ~DragonRuby's philosophy is to provide multiple options across the "make it~ ** Processing line: ~fast" vs "make it right" spectrum, with incremental/intuitive~ ** Processing line: ~transitions between the options provided. A concrete example of this philosophy~ -** Processing line: ~would be render primitives: the spectrum of options allows renderable constructs take~ -** Processing line: ~the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with),~ +** Processing line: ~would be render primitives: the spectrum of options allows renderable constructs that~ +** Processing line: ~take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with),~ ** Processing line: ~hashes (a little more work, but gives you the ability to add additional properties),~ -** Processing line: ~open and string entities (more work than hashes, but yields cleaner apis),~ +** Processing line: ~open and strict entities (more work than hashes, but yields cleaner apis),~ ** Processing line: ~and finally - if you really need full power/flexibility in rendering - classes~ ** Processing line: ~(which take the most amount of code and programming knowledge to create).~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and string entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create). +DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs that take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and strict entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create). ** Processing line: ~** Release Early and Often~ - Header detected. *** True Line Result @@ -1558,11 +1594,11 @@ The elevator pitch is: ** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels"~ ** Processing line: ~within the runtime allows us to target platforms no other Ruby can~ ** Processing line: ~target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo~ -** Processing line: ~Switch, PS4, Xbox, and Scadia.~ +** Processing line: ~Switch, PS4, Xbox, and Stadia.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Stadia. ** Processing line: ~**** What does Multilevel Cross-platform mean?~ - Header detected. *** True Line Result @@ -1770,14 +1806,14 @@ You can use DragonRuby's Console within the game to inspect object and execute s - End of paragraph detected. *** True Line Result - If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal). -** Processing line: ~- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +** Processing line: ~- All ~puts~ statements will also be saved to ~logs/puts.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ - Line was identified as a list. *** True Line Result ** Processing line: ~~ - End of paragraph detected. *** True Line Result -- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. +- All ~puts~ statements will also be saved to ~logs/puts.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. ** Processing line: ~4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored.~ ** Processing line: ~~ - End of paragraph detected. @@ -1897,14 +1933,14 @@ You can use DragonRuby's replay capabilities to troubleshoot: - Line was identified as a start of a list. *** True Line Result -** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recording by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ - Line was identified as a continuation of a list. *** True Line Result 1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added). ** Processing line: ~3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~.~ - Line was identified as a continuation of a list. *** True Line Result -2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. +2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recording by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. ** Processing line: ~4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release.~ - Line was identified as a continuation of a list. *** True Line Result @@ -1944,11 +1980,11 @@ You can use DragonRuby's replay capabilities to troubleshoot: *** True Line Result Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]]. ** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used~ -** Processing line: ~to be. And that's totally fine. Every one chases the new and shiny.~ +** Processing line: ~to be. And that's totally fine. Everyone chases the new and shiny.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny. +On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Everyone chases the new and shiny. ** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow~ ** Processing line: ~Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ ** Processing line: ~~ @@ -2134,16 +2170,14 @@ Just contact Amir at [email protected] with a short explanation of your - End of paragraph detected. *** True Line Result -** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the~ -** Processing line: ~runtime justice. Or just come to our [Slack]() or [Discord]() channel~ -** Processing line: ~and ask questions. We'd be happy to have a one on one video chat with~ -** Processing line: ~you and show off all the cool stuff we're doing.~ +** Processing line: ~You can try our web-based sandbox environment at [[http://fiddle.dragonruby.org]]. But it won't do the~ +** Processing line: ~runtime justice. Or just come to our Discord Channel at [[http://discord.dragonruby.org]] and ask questions.~ +** Processing line: ~We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. -** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it~ -** Processing line: ~stupid easy to do so.~ +You can try our web-based sandbox environment at [[http://fiddle.dragonruby.org]]. But it won't do the runtime justice. Or just come to our Discord Channel at [[http://discord.dragonruby.org]] and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. +** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -2556,10 +2590,14 @@ You can represent a sprite as a ~Hash~: - Inside source: true *** True Line Result angle_anchor_x: 0.5, -** Processing line: ~ angle_anchor_y: 1.0~ +** Processing line: ~ angle_anchor_y: 1.0,~ - Inside source: true *** True Line Result - angle_anchor_y: 1.0 + angle_anchor_y: 1.0, +** Processing line: ~ blendmode_enum: 1~ +- Inside source: true +*** True Line Result + blendmode_enum: 1 ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -2576,6 +2614,12 @@ You can represent a sprite as a ~Hash~: - End of paragraph detected. *** True Line Result +** Processing line: ~The ~blendmode_enum~ value can be set to ~0~ (no blending), ~1~ (alpha blending),~ +** Processing line: ~~2~ (additive blending), ~3~ (modulo blending), ~4~ (multiply blending).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The ~blendmode_enum~ value can be set to ~0~ (no blending), ~1~ (alpha blending), ~2~ (additive blending), ~3~ (modulo blending), ~4~ (multiply blending). ** Processing line: ~You can represent a sprite as an ~object~:~ ** Processing line: ~~ - End of paragraph detected. @@ -2611,10 +2655,10 @@ You can represent a sprite as an ~object~: - Inside source: true *** True Line Result :flip_horizontally, :flip_vertically, -** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ +** Processing line: ~ :angle_anchor_x, :angle_anchor_y, :blendmode_enum~ - Inside source: true *** True Line Result - :angle_anchor_x, :angle_anchor_y + :angle_anchor_x, :angle_anchor_y, :blendmode_enum ** Processing line: ~~ - Inside source: true *** True Line Result @@ -2941,46 +2985,50 @@ You can add additional metadata about your game within a label, which requires y - Inside source: true *** True Line Result args.outputs.labels << { -** Processing line: ~ x: 200,~ +** Processing line: ~ x: 200,~ - Inside source: true *** True Line Result - x: 200, -** Processing line: ~ y: 550,~ + x: 200, +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ text: "dragonruby",~ + y: 550, +** Processing line: ~ text: "dragonruby",~ - Inside source: true *** True Line Result - text: "dragonruby", -** Processing line: ~ size_enum: 2,~ + text: "dragonruby", +** Processing line: ~ size_enum: 2,~ - Inside source: true *** True Line Result - size_enum: 2, -** Processing line: ~ alignment_enum: 1,~ + size_enum: 2, +** Processing line: ~ alignment_enum: 1,~ - Inside source: true *** True Line Result - alignment_enum: 1, -** Processing line: ~ r: 155,~ + alignment_enum: 1, +** Processing line: ~ r: 155,~ - Inside source: true *** True Line Result - r: 155, -** Processing line: ~ g: 50,~ + r: 155, +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255,~ + b: 50, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ font: "fonts/manaspc.ttf",~ + a: 255, +** Processing line: ~ font: "fonts/manaspc.ttf",~ - Inside source: true *** True Line Result - font: "fonts/manaspc.ttf", + font: "fonts/manaspc.ttf", +** Processing line: ~ vertical_alignment_enum: 0, # 0 is bottom, 1 is middle, 2 is top~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 0, # 0 is bottom, 1 is middle, 2 is top ** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ - Inside source: true *** True Line Result @@ -3110,6 +3158,67 @@ You can get the render size of any string using ~args.gtk.calcstringbox~. - End of paragraph detected. *** True Line Result +** Processing line: ~** Rendering Labels With New Line Characters And Wrapping~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering Labels With New Line Characters And Wrapping +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can use a strategy like the following to create multiple labels from a String.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can use a strategy like the following to create multiple labels from a String. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elitteger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim."~ +- Inside source: true +*** True Line Result + long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elitteger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim." +** Processing line: ~ max_character_length = 30~ +- Inside source: true +*** True Line Result + max_character_length = 30 +** Processing line: ~ long_strings_split = args.string.wrapped_lines long_string, max_character_length~ +- Inside source: true +*** True Line Result + long_strings_split = args.string.wrapped_lines long_string, max_character_length +** Processing line: ~ args.outputs.labels << long_strings_split.map_with_index do |s, i|~ +- Inside source: true +*** True Line Result + args.outputs.labels << long_strings_split.map_with_index do |s, i| +** Processing line: ~ { x: 10, y: 600 - (i * 20), text: s }~ +- Inside source: true +*** True Line Result + { x: 10, y: 600 - (i * 20), text: s } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~** How To Play A Sound~ - Header detected. *** True Line Result @@ -3699,11 +3808,11 @@ Returns ~true~ if: the ~right~ arrow or ~d~ key is pressed or held on the ~keybo Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.left~ and ~args.inputs.right~. *** True Line Result *** ~.up_down~ -** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.up~ and ~args.inputs.down~.~ +** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.down~ and ~args.inputs.up~.~ ** Processing line: ~*** ~.text~ OR ~.history~~ - Header detected. *** True Line Result -Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.up~ and ~args.inputs.down~. +Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.down~ and ~args.inputs.up~. *** True Line Result *** ~.text~ OR ~.history~ ** Processing line: ~Returns a string that represents the last key that was pressed on the keyboard.~ @@ -3785,13 +3894,23 @@ Returns a bitmask for all buttons on the mouse: ~1~ for a button in the ~down~ s **** ~mouse.wheel~ ** Processing line: ~Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred.~ ** Processing line: ~***** ~.x~~ +- Header detected. +*** True Line Result +Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred. +*** True Line Result +***** ~.x~ ** Processing line: ~Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis.~ ** Processing line: ~***** ~.y~~ +- Header detected. +*** True Line Result +Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis. +*** True Line Result +***** ~.y~ ** Processing line: ~Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis.~ ** Processing line: ~**** ~.click~ OR ~.down~, ~.previous_click~, ~.up~~ - Header detected. *** True Line Result -Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred. ***** ~.x~ Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis. ***** ~.y~ Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis. +Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis. *** True Line Result **** ~.click~ OR ~.down~, ~.previous_click~, ~.up~ ** Processing line: ~The properties ~args.inputs.mouse.(click|down|previous_click|up)~ each return ~nil~ if the mouse button event didn't occur. And return an Entity~ @@ -3803,47 +3922,47 @@ The properties ~args.inputs.mouse.(click|down|previous_click|up)~ each return ~n *** True Line Result *** ~.controller_one~, ~.controller_two~ ** Processing line: ~Represents controllers connected to the usb ports.~ -** Processing line: ~**** ~.up~ +** Processing line: ~**** ~.up~~ - Header detected. *** True Line Result Represents controllers connected to the usb ports. *** True Line Result -**** ~.up +**** ~.up~ ** Processing line: ~Returns ~true~ if ~up~ is pressed or held on the directional or left analog.~ -** Processing line: ~**** ~.down~ +** Processing line: ~**** ~.down~~ - Header detected. *** True Line Result Returns ~true~ if ~up~ is pressed or held on the directional or left analog. *** True Line Result -**** ~.down +**** ~.down~ ** Processing line: ~Returns ~true~ if ~down~ is pressed or held on the directional or left analog.~ -** Processing line: ~**** ~.left~ +** Processing line: ~**** ~.left~~ - Header detected. *** True Line Result Returns ~true~ if ~down~ is pressed or held on the directional or left analog. *** True Line Result -**** ~.left +**** ~.left~ ** Processing line: ~Returns ~true~ if ~left~ is pressed or held on the directional or left analog.~ -** Processing line: ~**** ~.right~ +** Processing line: ~**** ~.right~~ - Header detected. *** True Line Result Returns ~true~ if ~left~ is pressed or held on the directional or left analog. *** True Line Result -**** ~.right +**** ~.right~ ** Processing line: ~Returns ~true~ if ~right~ is pressed or held on the directional or left analog.~ -** Processing line: ~**** ~.left_right~ +** Processing line: ~**** ~.left_right~~ - Header detected. *** True Line Result Returns ~true~ if ~right~ is pressed or held on the directional or left analog. *** True Line Result -**** ~.left_right +**** ~.left_right~ ** Processing line: ~Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.controller_(one|two).left~ and ~args.inputs.controller_(one|two).right~.~ -** Processing line: ~**** ~.up_down~ +** Processing line: ~**** ~.up_down~~ - Header detected. *** True Line Result Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.controller_(one|two).left~ and ~args.inputs.controller_(one|two).right~. *** True Line Result -**** ~.up_down +**** ~.up_down~ ** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.controller_(one|two).up~ and ~args.inputs.controller_(one|two).down~.~ ** Processing line: ~**** ~.(left_analog_x_raw|right_analog_x_raw)~~ - Header detected. @@ -3873,33 +3992,33 @@ Returns a number between ~-1~ and ~1~ which represents the percentage the analog *** True Line Result **** ~.left_analog_y_perc|right_analog_y_perc)~ ** Processing line: ~Returns a number between ~-1~ and ~1~ which represents the percentage the analog is moved vertically as a ratio of the maximum vertical movement.~ -** Processing line: ~**** ~.directional_up)~~ +** Processing line: ~**** ~.directional_up~~ - Header detected. *** True Line Result Returns a number between ~-1~ and ~1~ which represents the percentage the analog is moved vertically as a ratio of the maximum vertical movement. *** True Line Result -**** ~.directional_up)~ +**** ~.directional_up~ ** Processing line: ~Returns ~true~ if ~up~ is pressed or held on the directional.~ -** Processing line: ~**** ~.directional_down)~~ +** Processing line: ~**** ~.directional_down~~ - Header detected. *** True Line Result Returns ~true~ if ~up~ is pressed or held on the directional. *** True Line Result -**** ~.directional_down)~ +**** ~.directional_down~ ** Processing line: ~Returns ~true~ if ~down~ is pressed or held on the directional.~ -** Processing line: ~**** ~.directional_left)~~ +** Processing line: ~**** ~.directional_left~~ - Header detected. *** True Line Result Returns ~true~ if ~down~ is pressed or held on the directional. *** True Line Result -**** ~.directional_left)~ +**** ~.directional_left~ ** Processing line: ~Returns ~true~ if ~left~ is pressed or held on the directional.~ -** Processing line: ~**** ~.directional_right)~~ +** Processing line: ~**** ~.directional_right~~ - Header detected. *** True Line Result Returns ~true~ if ~left~ is pressed or held on the directional. *** True Line Result -**** ~.directional_right)~ +**** ~.directional_right~ ** Processing line: ~Returns ~true~ if ~right~ is pressed or held on the directional.~ ** Processing line: ~**** ~.(a|b|x|y|l1|r1|l2|r2|l3|r3|start|select)~~ - Header detected. @@ -4491,10 +4610,39 @@ Send any Primitive to this collection which represents things you render to the *** True Line Result ** ~args.geometry~ ** Processing line: ~This property contains geometric functions. Functions can be invoked via ~args.geometry.FUNCTION~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This property contains geometric functions. Functions can be invoked via ~args.geometry.FUNCTION~. +** Processing line: ~Here are some general notes with regards to the arguments these geometric functions accept.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here are some general notes with regards to the arguments these geometric functions accept. +** Processing line: ~1. ~Rectangles~ can be represented as an ~Array~ with four (or more) values ~[x, y, w, h]~, as a ~Hash~ ~{ x:, y:, w:, h: }~ or an object that responds to ~x~, ~y~, ~w~, and ~h~.~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. ~Points~ can be represent as an ~Array~ with two (or more) values ~[x, y]~, as a ~Hash~ ~{ x:, y:}~ or an object that responds to ~x~, and ~y~.~ +- Line was identified as a continuation of a list. +*** True Line Result +1. ~Rectangles~ can be represented as an ~Array~ with four (or more) values ~[x, y, w, h]~, as a ~Hash~ ~{ x:, y:, w:, h: }~ or an object that responds to ~x~, ~y~, ~w~, and ~h~. +** Processing line: ~3. ~Lines~ can be represented as an ~Array~ with four (or more) values ~[x, y, x2, y2]~, as a ~Hash~ ~{ x:, y:, x2:, y2: }~ or an object that responds to ~x~, ~y~, ~x2~, and ~y2~.~ +- Line was identified as a continuation of a list. +*** True Line Result +2. ~Points~ can be represent as an ~Array~ with two (or more) values ~[x, y]~, as a ~Hash~ ~{ x:, y:}~ or an object that responds to ~x~, and ~y~. +** Processing line: ~4. ~Angles~ are represented as degrees (not radians).~ +- Line was identified as a continuation of a list. +*** True Line Result +3. ~Lines~ can be represented as an ~Array~ with four (or more) values ~[x, y, x2, y2]~, as a ~Hash~ ~{ x:, y:, x2:, y2: }~ or an object that responds to ~x~, ~y~, ~x2~, and ~y2~. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +4. ~Angles~ are represented as degrees (not radians). ** Processing line: ~*** ~.inside_rect? rect_1, rect_2~~ - Header detected. *** True Line Result -This property contains geometric functions. Functions can be invoked via ~args.geometry.FUNCTION~. + *** True Line Result *** ~.inside_rect? rect_1, rect_2~ ** Processing line: ~Returns ~true~ if ~rect_1~ is inside ~rect_2~.~ @@ -5121,11 +5269,18 @@ Shows the mouse cursor. *** True Line Result *** ~.hide_cursor~ ** Processing line: ~Hides the mouse cursor.~ -** Processing line: ~*** ~.cursor_shown?~~ +** Processing line: ~*** ~.set_cursor path, dx, dy~~ - Header detected. *** True Line Result Hides the mouse cursor. *** True Line Result +*** ~.set_cursor path, dx, dy~ +** Processing line: ~Sets the system cursor to a sprite ~path~ with an offset of ~dx~ and ~dy~.~ +** Processing line: ~*** ~.cursor_shown?~~ +- Header detected. +*** True Line Result +Sets the system cursor to a sprite ~path~ with an offset of ~dx~ and ~dy~. +*** True Line Result *** ~.cursor_shown?~ ** Processing line: ~Returns ~true~ if the mouse cursor is shown.~ ** Processing line: ~*** ~.set_window_fullscreen enabled~~ @@ -5259,6 +5414,119 @@ This function takes in two parameters. The first parameter is the file path and - End of paragraph detected. *** True Line Result +** Processing line: ~* DOCS: ~GTK::Runtime#benchmark~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Runtime#benchmark~ +** Processing line: ~You can use this function to compare the relative performance of methods.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can use this function to compare the relative performance of methods. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # press r to run benchmark~ +- Inside source: true +*** True Line Result + # press r to run benchmark +** Processing line: ~ if args.inputs.keyboard.key_down.r~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.r +** Processing line: ~ args.gtk.console.show~ +- Inside source: true +*** True Line Result + args.gtk.console.show +** Processing line: ~ args.gtk.benchmark iterations: 1000, # number of iterations~ +- Inside source: true +*** True Line Result + args.gtk.benchmark iterations: 1000, # number of iterations +** Processing line: ~ # label for experiment~ +- Inside source: true +*** True Line Result + # label for experiment +** Processing line: ~ using_numeric_map: -> () {~ +- Inside source: true +*** True Line Result + using_numeric_map: -> () { +** Processing line: ~ # experiment body~ +- Inside source: true +*** True Line Result + # experiment body +** Processing line: ~ v = 100.map do |i|~ +- Inside source: true +*** True Line Result + v = 100.map do |i| +** Processing line: ~ i * 100~ +- Inside source: true +*** True Line Result + i * 100 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ },~ +- Inside source: true +*** True Line Result + }, +** Processing line: ~ # label for experiment~ +- Inside source: true +*** True Line Result + # label for experiment +** Processing line: ~ using_numeric_times: -> () {~ +- Inside source: true +*** True Line Result + using_numeric_times: -> () { +** Processing line: ~ # experiment body~ +- Inside source: true +*** True Line Result + # experiment body +** Processing line: ~ v = []~ +- Inside source: true +*** True Line Result + v = [] +** Processing line: ~ 100.times do |i|~ +- Inside source: true +*** True Line Result + 100.times do |i| +** Processing line: ~ v << i * 100~ +- Inside source: true +*** True Line Result + v << i * 100 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~* DOCS: ~Array~~ - Header detected. *** True Line Result @@ -6575,12 +6843,12 @@ Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixe - End of paragraph detected. *** True Line Result -** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The~ +** Processing line: ~The value for the color and alpha is a number between ~0~ and ~255~. The~ ** Processing line: ~alpha property is optional and will be set to ~255~ if not specified.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified. +The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified. ** Processing line: ~Creates a green solid rectangle with an opacity of 50%.~ ** Processing line: ~~ - End of paragraph detected. @@ -6706,12 +6974,12 @@ If you want a more readable invocation. You can use the following hash to create *** True Line Result ** Processing line: ~You can also create a class with solid/border properties and render it as a primitive.~ -** Processing line: ~ALL properties must on the class. *Additionally*, a method called ~primitive_marker~~ +** Processing line: ~ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~~ ** Processing line: ~must be defined on the class.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class. +You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class. ** Processing line: ~Here is an example:~ ** Processing line: ~~ - End of paragraph detected. @@ -6926,6 +7194,385 @@ You have to use ~args.outputs.borders~: - End of paragraph detected. *** True Line Result +** Processing line: ~* DOCS: ~GTK::Outputs#sprites~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Outputs#sprites~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Add primitives to this collection to render a sprite to the screen.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Add primitives to this collection to render a sprite to the screen. +** Processing line: ~** Rendering a sprite using an Array~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a sprite using an Array +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Creates a sprite of a white circle located at 100, 100. 160 pixels~ +** Processing line: ~wide and 90 pixels tall.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Creates a sprite of a white circle located at 100, 100. 160 pixels wide and 90 pixels tall. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT PATH~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT PATH +** Processing line: ~ args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a sprite using an Array with colors and alpha~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a sprite using an Array with colors and alpha +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The value for the color and alpha is a number between ~0~ and ~255~. The~ +** Processing line: ~alpha property is optional and will be set to ~255~ if not specified.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified. +** Processing line: ~Creates a green circle sprite with an opacity of 50%.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Creates a green circle sprite with an opacity of 50%. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT PATH ANGLE ALPHA RED GREEN BLUE~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT PATH ANGLE ALPHA RED GREEN BLUE +** Processing line: ~ args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png", 0, 128, 0, 255, 0]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png", 0, 128, 0, 255, 0] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a sprite using a Hash~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a sprite using a Hash +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~If you want a more readable invocation. You can use the following hash to create a sprite.~ +** Processing line: ~Any parameters that are not specified will be given a default value. The keys of the hash can~ +** Processing line: ~be provided in any order.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you want a more readable invocation. You can use the following hash to create a sprite. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.sprites << {~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { +** Processing line: ~ x: 0,~ +- Inside source: true +*** True Line Result + x: 0, +** Processing line: ~ y: 0,~ +- Inside source: true +*** True Line Result + y: 0, +** Processing line: ~ w: 100,~ +- Inside source: true +*** True Line Result + w: 100, +** Processing line: ~ h: 100,~ +- Inside source: true +*** True Line Result + h: 100, +** Processing line: ~ path: "sprites/circle/white.png",~ +- Inside source: true +*** True Line Result + path: "sprites/circle/white.png", +** Processing line: ~ angle: 0,~ +- Inside source: true +*** True Line Result + angle: 0, +** Processing line: ~ a: 255,~ +- Inside source: true +*** True Line Result + a: 255, +** Processing line: ~ r: 0,~ +- Inside source: true +*** True Line Result + r: 0, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 0~ +- Inside source: true +*** True Line Result + b: 0 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a solid using a Class~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a solid using a Class +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive.~ +** Processing line: ~ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~~ +** Processing line: ~must be defined on the class.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class. +** Processing line: ~Here is an example:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here is an example: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ +- Inside source: true +*** True Line Result + # Create type with ALL sprite properties AND primitive_marker +** Processing line: ~ class Sprite~ +- Inside source: true +*** True Line Result + class Sprite +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b~ +- Inside source: true +*** True Line Result + attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def primitive_marker~ +- Inside source: true +*** True Line Result + def primitive_marker +** Processing line: ~ :sprite~ +- Inside source: true +*** True Line Result + :sprite +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Inherit from type~ +- Inside source: true +*** True Line Result + # Inherit from type +** Processing line: ~ class Circle < Sprite~ +- Inside source: true +*** True Line Result + class Circle < Sprite +** Processing line: ~ # constructor~ +- Inside source: true +*** True Line Result + # constructor +** Processing line: ~ def initialize x, y, size, path~ +- Inside source: true +*** True Line Result + def initialize x, y, size, path +** Processing line: ~ self.x = x~ +- Inside source: true +*** True Line Result + self.x = x +** Processing line: ~ self.y = y~ +- Inside source: true +*** True Line Result + self.y = y +** Processing line: ~ self.w = size~ +- Inside source: true +*** True Line Result + self.w = size +** Processing line: ~ self.h = size~ +- Inside source: true +*** True Line Result + self.h = size +** Processing line: ~ self.path = path~ +- Inside source: true +*** True Line Result + self.path = path +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ def serlialize~ +- Inside source: true +*** True Line Result + def serlialize +** Processing line: ~ {x:self.x, y:self.y, w:self.w, h:self.h, path:self.path}~ +- Inside source: true +*** True Line Result + {x:self.x, y:self.y, w:self.w, h:self.h, path:self.path} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def inspect~ +- Inside source: true +*** True Line Result + def inspect +** Processing line: ~ serlialize.to_s~ +- Inside source: true +*** True Line Result + serlialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ serlialize.to_s~ +- Inside source: true +*** True Line Result + serlialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # render circle sprite~ +- Inside source: true +*** True Line Result + # render circle sprite +** Processing line: ~ args.outputs.sprites << Circle.new(10, 10, 32,"sprites/circle/white.png")~ +- Inside source: true +*** True Line Result + args.outputs.sprites << Circle.new(10, 10, 32,"sprites/circle/white.png") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~* DOCS: ~GTK::Outputs#screenshots~~ - Header detected. *** True Line Result @@ -7163,34 +7810,34 @@ The ~GTK::MousePoint~ has the following properties. - Line was identified as a list. *** True Line Result - ~y~: Integer representing the mouse's y. -** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result - ~point~: Array with the ~x~ and ~y~ values. -** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result -- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- ~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result -- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- ~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result -- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- ~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result -- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). -** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- ~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line was identified as a list. *** True Line Result -- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). ** Processing line: ~- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ - Line was identified as a list. *** True Line Result -- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions). ** Processing line: ~- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ - Line was identified as a list. *** True Line Result @@ -12924,10 +13571,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 255, -** Processing line: ~ font: "manaspc.ttf" }.label~ +** Processing line: ~ font: "manaspc.ttf" }.label!~ - Inside source: true *** True Line Result - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -12980,10 +13627,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 255, -** Processing line: ~ font: "manaspc.ttf" }.label~ +** Processing line: ~ font: "manaspc.ttf" }.label!~ - Inside source: true *** True Line Result - font: "manaspc.ttf" }.label + font: "manaspc.ttf" }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13944,3074 +14591,6 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~*** Rendering Basics - Audio Mixer - main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -*** Rendering Basics - Audio Mixer - main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # ./samples/01_rendering_basics/06_audio_mixer/app/main.rb~ -- Inside source: true -*** True Line Result - # ./samples/01_rendering_basics/06_audio_mixer/app/main.rb -** Processing line: ~ $gtk.reset~ -- Inside source: true -*** True Line Result - $gtk.reset -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ $boxsize = 30~ -- Inside source: true -*** True Line Result - $boxsize = 30 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_sources args~ -- Inside source: true -*** True Line Result - def render_sources args -** Processing line: ~ mouse_in_panel = (args.state.selected != 0) && args.inputs.mouse.position.inside_rect?([900, 450, 340, 250])~ -- Inside source: true -*** True Line Result - mouse_in_panel = (args.state.selected != 0) && args.inputs.mouse.position.inside_rect?([900, 450, 340, 250]) -** Processing line: ~ mouse_new_down = (args.state.mouse_held == 1)~ -- Inside source: true -*** True Line Result - mouse_new_down = (args.state.mouse_held == 1) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if (mouse_new_down && !mouse_in_panel)~ -- Inside source: true -*** True Line Result - if (mouse_new_down && !mouse_in_panel) -** Processing line: ~ args.state.selected = 0 # will reset below if we hit something.~ -- Inside source: true -*** True Line Result - args.state.selected = 0 # will reset below if we hit something. -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.audio.keys.each { |k|~ -- Inside source: true -*** True Line Result - args.audio.keys.each { |k| -** Processing line: ~ s = args.audio[k]~ -- Inside source: true -*** True Line Result - s = args.audio[k] -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if (mouse_new_down) && !mouse_in_panel && args.inputs.mouse.position.inside_rect?([s[:screenx], s[:screeny], $boxsize, $boxsize])~ -- Inside source: true -*** True Line Result - if (mouse_new_down) && !mouse_in_panel && args.inputs.mouse.position.inside_rect?([s[:screenx], s[:screeny], $boxsize, $boxsize]) -** Processing line: ~ args.state.selected = k~ -- Inside source: true -*** True Line Result - args.state.selected = k -** Processing line: ~ args.state.dragging_source = true~ -- Inside source: true -*** True Line Result - args.state.dragging_source = true -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ isselected = (k == args.state.selected)~ -- Inside source: true -*** True Line Result - isselected = (k == args.state.selected) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if isselected && args.state.dragging_source~ -- Inside source: true -*** True Line Result - if isselected && args.state.dragging_source -** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ -- Inside source: true -*** True Line Result - # you can hang anything on the audio hashes you want, so we store the -** Processing line: ~ # actual screen position so it doesn't scale weirdly vs your mouse.~ -- Inside source: true -*** True Line Result - # actual screen position so it doesn't scale weirdly vs your mouse. -** Processing line: ~ s[:screenx] = args.inputs.mouse.x - ($boxsize / 2)~ -- Inside source: true -*** True Line Result - s[:screenx] = args.inputs.mouse.x - ($boxsize / 2) -** Processing line: ~ s[:screeny] = args.inputs.mouse.y - ($boxsize / 2)~ -- Inside source: true -*** True Line Result - s[:screeny] = args.inputs.mouse.y - ($boxsize / 2) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ s[:screeny] = 50 if s[:screeny] < 50~ -- Inside source: true -*** True Line Result - s[:screeny] = 50 if s[:screeny] < 50 -** Processing line: ~ s[:screeny] = (719 - $boxsize) if s[:screeny] > (719 - $boxsize)~ -- Inside source: true -*** True Line Result - s[:screeny] = (719 - $boxsize) if s[:screeny] > (719 - $boxsize) -** Processing line: ~ s[:screenx] = 0 if s[:screenx] < 0~ -- Inside source: true -*** True Line Result - s[:screenx] = 0 if s[:screenx] < 0 -** Processing line: ~ s[:screenx] = (1279 - $boxsize) if s[:screenx] > (1279 - $boxsize)~ -- Inside source: true -*** True Line Result - s[:screenx] = (1279 - $boxsize) if s[:screenx] > (1279 - $boxsize) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ s[:x] = ((s[:screenx] / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ -- Inside source: true -*** True Line Result - s[:x] = ((s[:screenx] / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range -** Processing line: ~ s[:y] = ((s[:screeny] / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ -- Inside source: true -*** True Line Result - s[:y] = ((s[:screeny] / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ]~ -- Inside source: true -*** True Line Result - color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] -** Processing line: ~ args.outputs.primitives << [s[:screenx], s[:screeny], $boxsize, $boxsize, *color].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [s[:screenx], s[:screeny], $boxsize, $boxsize, *color].solid -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_panel args~ -- Inside source: true -*** True Line Result - def render_panel args -** Processing line: ~ s = args.audio[args.state.selected]~ -- Inside source: true -*** True Line Result - s = args.audio[args.state.selected] -** Processing line: ~ return if s.nil?~ -- Inside source: true -*** True Line Result - return if s.nil? -** Processing line: ~ mouse_down = (args.state.mouse_held > 0)~ -- Inside source: true -*** True Line Result - mouse_down = (args.state.mouse_held > 0) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.primitives << [900, 450, 340, 250, 127, 127, 200, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [900, 450, 340, 250, 127, 127, 200, 255].solid -** Processing line: ~ args.outputs.primitives << [1075, 690, "Source ##{args.state.selected}", 3, 1, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [1075, 690, "Source ##{args.state.selected}", 3, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.primitives << [910, 660, 1230, 660, 255, 255, 255].line~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 660, 1230, 660, 255, 255, 255].line -** Processing line: ~ args.outputs.primitives << [910, 650, "screen: (#{s[:screenx].to_i}, #{s[:screeny].to_i})", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 650, "screen: (#{s[:screenx].to_i}, #{s[:screeny].to_i})", 0, 0, 255, 255, 255].label -** Processing line: ~ args.outputs.primitives << [910, 625, "position: (#{s[:x].round(5).to_s[0..6]}, #{s[:y].round(5).to_s[0..6]})", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 625, "position: (#{s[:x].round(5).to_s[0..6]}, #{s[:y].round(5).to_s[0..6]})", 0, 0, 255, 255, 255].label -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ slider = [1022, 586, 200, 7]~ -- Inside source: true -*** True Line Result - slider = [1022, 586, 200, 7] -** Processing line: ~ if mouse_down && args.inputs.mouse.position.inside_rect?(slider)~ -- Inside source: true -*** True Line Result - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) -** Processing line: ~ s[:pitch] = ((args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)) * 2.0~ -- Inside source: true -*** True Line Result - s[:pitch] = ((args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)) * 2.0 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ slidercolor = (s[:pitch] / 2.0) * 255~ -- Inside source: true -*** True Line Result - slidercolor = (s[:pitch] / 2.0) * 255 -** Processing line: ~ args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid -** Processing line: ~ args.outputs.primitives << [910, 600, "pitch: #{s[:pitch].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 600, "pitch: #{s[:pitch].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ slider = [1022, 561, 200, 7]~ -- Inside source: true -*** True Line Result - slider = [1022, 561, 200, 7] -** Processing line: ~ if mouse_down && args.inputs.mouse.position.inside_rect?(slider)~ -- Inside source: true -*** True Line Result - if mouse_down && args.inputs.mouse.position.inside_rect?(slider) -** Processing line: ~ s[:gain] = (args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)~ -- Inside source: true -*** True Line Result - s[:gain] = (args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ slidercolor = s[:gain] * 255~ -- Inside source: true -*** True Line Result - slidercolor = s[:gain] * 255 -** Processing line: ~ args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid -** Processing line: ~ args.outputs.primitives << [910, 575, "gain: #{s[:gain].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 575, "gain: #{s[:gain].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ checkbox = [1022, 533, 10, 12]~ -- Inside source: true -*** True Line Result - checkbox = [1022, 533, 10, 12] -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox)~ -- Inside source: true -*** True Line Result - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) -** Processing line: ~ s[:looping] = !s[:looping]~ -- Inside source: true -*** True Line Result - s[:looping] = !s[:looping] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ checkboxcolor = s[:looping] ? 255 : 0~ -- Inside source: true -*** True Line Result - checkboxcolor = s[:looping] ? 255 : 0 -** Processing line: ~ args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid -** Processing line: ~ args.outputs.primitives << [910, 550, "looping:", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 550, "looping:", 0, 0, 255, 255, 255].label -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ checkbox = [1022, 508, 10, 12]~ -- Inside source: true -*** True Line Result - checkbox = [1022, 508, 10, 12] -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox)~ -- Inside source: true -*** True Line Result - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox) -** Processing line: ~ s[:paused] = !s[:paused]~ -- Inside source: true -*** True Line Result - s[:paused] = !s[:paused] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ checkboxcolor = s[:paused] ? 255 : 0~ -- Inside source: true -*** True Line Result - checkboxcolor = s[:paused] ? 255 : 0 -** Processing line: ~ args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid -** Processing line: ~ args.outputs.primitives << [910, 525, "paused:", 0, 0, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [910, 525, "paused:", 0, 0, 255, 255, 255].label -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ button = [910, 460, 320, 20]~ -- Inside source: true -*** True Line Result - button = [910, 460, 320, 20] -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(button)~ -- Inside source: true -*** True Line Result - if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(button) -** Processing line: ~ args.audio.delete(args.state.selected)~ -- Inside source: true -*** True Line Result - args.audio.delete(args.state.selected) -** Processing line: ~ args.state.selected = 0~ -- Inside source: true -*** True Line Result - args.state.selected = 0 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ args.outputs.primitives << [*button, 255, 0, 0, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [*button, 255, 0, 0, 255].solid -** Processing line: ~ args.outputs.primitives << [button[0] + (button[2] / 2), button[1]+20, "DELETE SOURCE", 0, 1, 255, 255, 0].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [button[0] + (button[2] / 2), button[1]+20, "DELETE SOURCE", 0, 1, 255, 255, 0].label -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def spawn_new_sound args, num~ -- Inside source: true -*** True Line Result - def spawn_new_sound args, num -** Processing line: ~ input = nil~ -- Inside source: true -*** True Line Result - input = nil -** Processing line: ~ input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}"~ -- Inside source: true -*** True Line Result - input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}" -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # Spawn randomly in an area that won't be covered by UI.~ -- Inside source: true -*** True Line Result - # Spawn randomly in an area that won't be covered by UI. -** Processing line: ~ screenx = (rand * 600.0) + 200.0~ -- Inside source: true -*** True Line Result - screenx = (rand * 600.0) + 200.0 -** Processing line: ~ screeny = (rand * 400.0) + 100.0~ -- Inside source: true -*** True Line Result - screeny = (rand * 400.0) + 100.0 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.state.next_sound_index += 1~ -- Inside source: true -*** True Line Result - args.state.next_sound_index += 1 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ -- Inside source: true -*** True Line Result - # you can hang anything on the audio hashes you want, so we store the -** Processing line: ~ # actual screen position in here for convenience.~ -- Inside source: true -*** True Line Result - # actual screen position in here for convenience. -** Processing line: ~ args.audio[args.state.next_sound_index] = {~ -- Inside source: true -*** True Line Result - args.audio[args.state.next_sound_index] = { -** Processing line: ~ input: input,~ -- Inside source: true -*** True Line Result - input: input, -** Processing line: ~ screenx: screenx,~ -- Inside source: true -*** True Line Result - screenx: screenx, -** Processing line: ~ screeny: screeny,~ -- Inside source: true -*** True Line Result - screeny: screeny, -** Processing line: ~ x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ -- Inside source: true -*** True Line Result - x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range -** Processing line: ~ y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ -- Inside source: true -*** True Line Result - y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range -** Processing line: ~ z: 0.0,~ -- Inside source: true -*** True Line Result - z: 0.0, -** Processing line: ~ gain: 1.0,~ -- Inside source: true -*** True Line Result - gain: 1.0, -** Processing line: ~ pitch: 1.0,~ -- Inside source: true -*** True Line Result - pitch: 1.0, -** Processing line: ~ looping: true,~ -- Inside source: true -*** True Line Result - looping: true, -** Processing line: ~ paused: false~ -- Inside source: true -*** True Line Result - paused: false -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.state.selected = args.state.next_sound_index~ -- Inside source: true -*** True Line Result - args.state.selected = args.state.next_sound_index -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_launcher args~ -- Inside source: true -*** True Line Result - def render_launcher args -** Processing line: ~ total = 6~ -- Inside source: true -*** True Line Result - total = 6 -** Processing line: ~ x = (1280 - (total * $boxsize * 3)) / 2~ -- Inside source: true -*** True Line Result - x = (1280 - (total * $boxsize * 3)) / 2 -** Processing line: ~ y = 10~ -- Inside source: true -*** True Line Result - y = 10 -** Processing line: ~ args.outputs.primitives << [0, 0, 1280, ((y*2) + $boxsize), 127, 127, 127, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [0, 0, 1280, ((y*2) + $boxsize), 127, 127, 127, 255].solid -** Processing line: ~ for i in 1..total~ -- Inside source: true -*** True Line Result - for i in 1..total -** Processing line: ~ args.outputs.primitives << [x, y, $boxsize, $boxsize, 255, 255, 255, 255].solid~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [x, y, $boxsize, $boxsize, 255, 255, 255, 255].solid -** Processing line: ~ args.outputs.primitives << [x+8, y+28, i.to_s, 3, 0, 0, 0, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.primitives << [x+8, y+28, i.to_s, 3, 0, 0, 0, 255, 255].label -** Processing line: ~ if args.inputs.mouse.click && args.inputs.mouse.click.point.inside_rect?([x, y, $boxsize, $boxsize])~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.click && args.inputs.mouse.click.point.inside_rect?([x, y, $boxsize, $boxsize]) -** Processing line: ~ spawn_new_sound args, i~ -- Inside source: true -*** True Line Result - spawn_new_sound args, i -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ x = x + ($boxsize * 3)~ -- Inside source: true -*** True Line Result - x = x + ($boxsize * 3) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_ui args~ -- Inside source: true -*** True Line Result - def render_ui args -** Processing line: ~ render_launcher args~ -- Inside source: true -*** True Line Result - render_launcher args -** Processing line: ~ render_panel args~ -- Inside source: true -*** True Line Result - render_panel args -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ args.state.mouse_held ||= 0~ -- Inside source: true -*** True Line Result - args.state.mouse_held ||= 0 -** Processing line: ~ args.state.dragging_source ||= false~ -- Inside source: true -*** True Line Result - args.state.dragging_source ||= false -** Processing line: ~ args.state.selected ||= 0~ -- Inside source: true -*** True Line Result - args.state.selected ||= 0 -** Processing line: ~ args.state.next_sound_index ||= 0~ -- Inside source: true -*** True Line Result - args.state.next_sound_index ||= 0 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if args.inputs.mouse.up~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.up -** Processing line: ~ args.state.mouse_held = 0~ -- Inside source: true -*** True Line Result - args.state.mouse_held = 0 -** Processing line: ~ args.state.dragging_source = false~ -- Inside source: true -*** True Line Result - args.state.dragging_source = false -** Processing line: ~ elsif args.inputs.mouse.down || (args.state.mouse_held > 0)~ -- Inside source: true -*** True Line Result - elsif args.inputs.mouse.down || (args.state.mouse_held > 0) -** Processing line: ~ args.state.mouse_held += 1~ -- Inside source: true -*** True Line Result - args.state.mouse_held += 1 -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.background_color = [ 0, 0, 0, 255 ]~ -- Inside source: true -*** True Line Result - args.outputs.background_color = [ 0, 0, 0, 255 ] -** Processing line: ~ render_sources args~ -- Inside source: true -*** True Line Result - render_sources args -** Processing line: ~ render_ui args~ -- Inside source: true -*** True Line Result - render_ui args -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~*** Rendering Basics - Sound Synthesis - main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -*** Rendering Basics - Sound Synthesis - main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # ./samples/01_rendering_basics/07_sound_synthesis/app/main.rb~ -- Inside source: true -*** True Line Result - # ./samples/01_rendering_basics/07_sound_synthesis/app/main.rb -** Processing line: ~ begin # region: top level tick methods~ -- Inside source: true -*** True Line Result - begin # region: top level tick methods -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ defaults args~ -- Inside source: true -*** True Line Result - defaults args -** Processing line: ~ render args~ -- Inside source: true -*** True Line Result - render args -** Processing line: ~ input args~ -- Inside source: true -*** True Line Result - input args -** Processing line: ~ process_audio_queue args~ -- Inside source: true -*** True Line Result - process_audio_queue args -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults args~ -- Inside source: true -*** True Line Result - def defaults args -** Processing line: ~ args.state.sine_waves ||= {}~ -- Inside source: true -*** True Line Result - args.state.sine_waves ||= {} -** Processing line: ~ args.state.square_waves ||= {}~ -- Inside source: true -*** True Line Result - args.state.square_waves ||= {} -** Processing line: ~ args.state.saw_tooth_waves ||= {}~ -- Inside source: true -*** True Line Result - args.state.saw_tooth_waves ||= {} -** Processing line: ~ args.state.triangle_waves ||= {}~ -- Inside source: true -*** True Line Result - args.state.triangle_waves ||= {} -** Processing line: ~ args.state.audio_queue ||= []~ -- Inside source: true -*** True Line Result - args.state.audio_queue ||= [] -** Processing line: ~ args.state.buttons ||= [~ -- Inside source: true -*** True Line Result - args.state.buttons ||= [ -** Processing line: ~ (frequency_buttons args),~ -- Inside source: true -*** True Line Result - (frequency_buttons args), -** Processing line: ~ (sine_wave_note_buttons args),~ -- Inside source: true -*** True Line Result - (sine_wave_note_buttons args), -** Processing line: ~ (bell_buttons args),~ -- Inside source: true -*** True Line Result - (bell_buttons args), -** Processing line: ~ (square_wave_note_buttons args),~ -- Inside source: true -*** True Line Result - (square_wave_note_buttons args), -** Processing line: ~ (saw_tooth_wave_note_buttons args),~ -- Inside source: true -*** True Line Result - (saw_tooth_wave_note_buttons args), -** Processing line: ~ (triangle_wave_note_buttons args),~ -- Inside source: true -*** True Line Result - (triangle_wave_note_buttons args), -** Processing line: ~ ].flatten~ -- Inside source: true -*** True Line Result - ].flatten -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render args~ -- Inside source: true -*** True Line Result - def render args -** Processing line: ~ args.outputs.borders << args.state.buttons.map { |b| b[:border] }~ -- Inside source: true -*** True Line Result - args.outputs.borders << args.state.buttons.map { |b| b[:border] } -** Processing line: ~ args.outputs.labels << args.state.buttons.map { |b| b[:label] }~ -- Inside source: true -*** True Line Result - args.outputs.labels << args.state.buttons.map { |b| b[:label] } -** Processing line: ~ args.outputs.labels << args.layout~ -- Inside source: true -*** True Line Result - args.outputs.labels << args.layout -** Processing line: ~ .rect(row: 0, col: 11.5)~ -- Inside source: true -*** True Line Result - .rect(row: 0, col: 11.5) -** Processing line: ~ .yield_self { |r| r.merge y: r.y + r.h }~ -- Inside source: true -*** True Line Result - .yield_self { |r| r.merge y: r.y + r.h } -** Processing line: ~ .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.",~ -- Inside source: true -*** True Line Result - .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", -** Processing line: ~ alignment_enum: 1)~ -- Inside source: true -*** True Line Result - alignment_enum: 1) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def input args~ -- Inside source: true -*** True Line Result - def input args -** Processing line: ~ args.state.buttons.each do |b|~ -- Inside source: true -*** True Line Result - args.state.buttons.each do |b| -** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect])~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) -** Processing line: ~ parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", "~ -- Inside source: true -*** True Line Result - parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " -** Processing line: ~ args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}"~ -- Inside source: true -*** True Line Result - args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" -** Processing line: ~ send b[:method_to_call], args, b~ -- Inside source: true -*** True Line Result - send b[:method_to_call], args, b -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half }))~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) -** Processing line: ~ args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan'~ -- Inside source: true -*** True Line Result - args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def process_audio_queue args~ -- Inside source: true -*** True Line Result - def process_audio_queue args -** Processing line: ~ to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count }~ -- Inside source: true -*** True Line Result - to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } -** Processing line: ~ args.state.audio_queue -= to_queue~ -- Inside source: true -*** True Line Result - args.state.audio_queue -= to_queue -** Processing line: ~ to_queue.each { |a| args.audio[a[:id]] = a }~ -- Inside source: true -*** True Line Result - to_queue.each { |a| args.audio[a[:id]] = a } -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.audio.find_all { |k, v| v[:decay_rate] }~ -- Inside source: true -*** True Line Result - args.audio.find_all { |k, v| v[:decay_rate] } -** Processing line: ~ .each { |k, v| v[:gain] -= v[:decay_rate] }~ -- Inside source: true -*** True Line Result - .each { |k, v| v[:gain] -= v[:decay_rate] } -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ sounds_to_stop = args.audio~ -- Inside source: true -*** True Line Result - sounds_to_stop = args.audio -** Processing line: ~ .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] }~ -- Inside source: true -*** True Line Result - .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } -** Processing line: ~ .map { |k, v| k }~ -- Inside source: true -*** True Line Result - .map { |k, v| k } -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ sounds_to_stop.each { |k| args.audio.delete k }~ -- Inside source: true -*** True Line Result - sounds_to_stop.each { |k| args.audio.delete k } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: button definitions, ui layout, callback functions~ -- Inside source: true -*** True Line Result - begin # region: button definitions, ui layout, callback functions -** Processing line: ~ def button args, opts~ -- Inside source: true -*** True Line Result - def button args, opts -** Processing line: ~ button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1))~ -- Inside source: true -*** True Line Result - button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0~ -- Inside source: true -*** True Line Result - button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ label_offset_x = 5~ -- Inside source: true -*** True Line Result - label_offset_x = 5 -** Processing line: ~ label_offset_y = 30~ -- Inside source: true -*** True Line Result - label_offset_y = 30 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ button_def[:label] = button_def[:rect].merge text: opts[:text],~ -- Inside source: true -*** True Line Result - button_def[:label] = button_def[:rect].merge text: opts[:text], -** Processing line: ~ size_enum: -2.5,~ -- Inside source: true -*** True Line Result - size_enum: -2.5, -** Processing line: ~ x: button_def[:rect].x + label_offset_x,~ -- Inside source: true -*** True Line Result - x: button_def[:rect].x + label_offset_x, -** Processing line: ~ y: button_def[:rect].y + label_offset_y~ -- Inside source: true -*** True Line Result - y: button_def[:rect].y + label_offset_y -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ button_def~ -- Inside source: true -*** True Line Result - button_def -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def play_sine_wave args, sender~ -- Inside source: true -*** True Line Result - def play_sine_wave args, sender -** Processing line: ~ queue_sine_wave args,~ -- Inside source: true -*** True Line Result - queue_sine_wave args, -** Processing line: ~ frequency: sender[:frequency],~ -- Inside source: true -*** True Line Result - frequency: sender[:frequency], -** Processing line: ~ duration: 1.seconds,~ -- Inside source: true -*** True Line Result - duration: 1.seconds, -** Processing line: ~ fade_out: true~ -- Inside source: true -*** True Line Result - fade_out: true -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def play_note args, sender~ -- Inside source: true -*** True Line Result - def play_note args, sender -** Processing line: ~ method_to_call = :queue_sine_wave~ -- Inside source: true -*** True Line Result - method_to_call = :queue_sine_wave -** Processing line: ~ method_to_call = :queue_square_wave if sender[:type] == :square~ -- Inside source: true -*** True Line Result - method_to_call = :queue_square_wave if sender[:type] == :square -** Processing line: ~ method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth~ -- Inside source: true -*** True Line Result - method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth -** Processing line: ~ method_to_call = :queue_triangle_wave if sender[:type] == :triangle~ -- Inside source: true -*** True Line Result - method_to_call = :queue_triangle_wave if sender[:type] == :triangle -** Processing line: ~ method_to_call = :queue_bell if sender[:type] == :bell~ -- Inside source: true -*** True Line Result - method_to_call = :queue_bell if sender[:type] == :bell -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ send method_to_call, args,~ -- Inside source: true -*** True Line Result - send method_to_call, args, -** Processing line: ~ frequency: (frequency_for note: sender[:note], octave: sender[:octave]),~ -- Inside source: true -*** True Line Result - frequency: (frequency_for note: sender[:note], octave: sender[:octave]), -** Processing line: ~ duration: 1.seconds,~ -- Inside source: true -*** True Line Result - duration: 1.seconds, -** Processing line: ~ fade_out: true~ -- Inside source: true -*** True Line Result - fade_out: true -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def frequency_buttons args~ -- Inside source: true -*** True Line Result - def frequency_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.0, col: 0, text: "300hz",~ -- Inside source: true -*** True Line Result - row: 4.0, col: 0, text: "300hz", -** Processing line: ~ frequency: 300,~ -- Inside source: true -*** True Line Result - frequency: 300, -** Processing line: ~ method_to_call: :play_sine_wave),~ -- Inside source: true -*** True Line Result - method_to_call: :play_sine_wave), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.0, col: 0, text: "400hz",~ -- Inside source: true -*** True Line Result - row: 5.0, col: 0, text: "400hz", -** Processing line: ~ frequency: 400,~ -- Inside source: true -*** True Line Result - frequency: 400, -** Processing line: ~ method_to_call: :play_sine_wave),~ -- Inside source: true -*** True Line Result - method_to_call: :play_sine_wave), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.0, col: 0, text: "500hz",~ -- Inside source: true -*** True Line Result - row: 6.0, col: 0, text: "500hz", -** Processing line: ~ frequency: 500,~ -- Inside source: true -*** True Line Result - frequency: 500, -** Processing line: ~ method_to_call: :play_sine_wave),~ -- Inside source: true -*** True Line Result - method_to_call: :play_sine_wave), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def sine_wave_note_buttons args~ -- Inside source: true -*** True Line Result - def sine_wave_note_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 1.5, col: 2, text: "Sine C4",~ -- Inside source: true -*** True Line Result - row: 1.5, col: 2, text: "Sine C4", -** Processing line: ~ note: :c, octave: 4, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 4, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 2.5, col: 2, text: "Sine D4",~ -- Inside source: true -*** True Line Result - row: 2.5, col: 2, text: "Sine D4", -** Processing line: ~ note: :d, octave: 4, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :d, octave: 4, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 3.5, col: 2, text: "Sine E4",~ -- Inside source: true -*** True Line Result - row: 3.5, col: 2, text: "Sine E4", -** Processing line: ~ note: :e, octave: 4, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :e, octave: 4, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.5, col: 2, text: "Sine F4",~ -- Inside source: true -*** True Line Result - row: 4.5, col: 2, text: "Sine F4", -** Processing line: ~ note: :f, octave: 4, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :f, octave: 4, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.5, col: 2, text: "Sine G4",~ -- Inside source: true -*** True Line Result - row: 5.5, col: 2, text: "Sine G4", -** Processing line: ~ note: :g, octave: 4, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :g, octave: 4, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.5, col: 2, text: "Sine A5",~ -- Inside source: true -*** True Line Result - row: 6.5, col: 2, text: "Sine A5", -** Processing line: ~ note: :a, octave: 5, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :a, octave: 5, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 7.5, col: 2, text: "Sine B5",~ -- Inside source: true -*** True Line Result - row: 7.5, col: 2, text: "Sine B5", -** Processing line: ~ note: :b, octave: 5, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :b, octave: 5, type: :sine, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 8.5, col: 2, text: "Sine C5",~ -- Inside source: true -*** True Line Result - row: 8.5, col: 2, text: "Sine C5", -** Processing line: ~ note: :c, octave: 5, type: :sine, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 5, type: :sine, method_to_call: :play_note), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def square_wave_note_buttons args~ -- Inside source: true -*** True Line Result - def square_wave_note_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 1.5, col: 6, text: "Square C4",~ -- Inside source: true -*** True Line Result - row: 1.5, col: 6, text: "Square C4", -** Processing line: ~ note: :c, octave: 4, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 4, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 2.5, col: 6, text: "Square D4",~ -- Inside source: true -*** True Line Result - row: 2.5, col: 6, text: "Square D4", -** Processing line: ~ note: :d, octave: 4, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :d, octave: 4, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 3.5, col: 6, text: "Square E4",~ -- Inside source: true -*** True Line Result - row: 3.5, col: 6, text: "Square E4", -** Processing line: ~ note: :e, octave: 4, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :e, octave: 4, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.5, col: 6, text: "Square F4",~ -- Inside source: true -*** True Line Result - row: 4.5, col: 6, text: "Square F4", -** Processing line: ~ note: :f, octave: 4, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :f, octave: 4, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.5, col: 6, text: "Square G4",~ -- Inside source: true -*** True Line Result - row: 5.5, col: 6, text: "Square G4", -** Processing line: ~ note: :g, octave: 4, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :g, octave: 4, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.5, col: 6, text: "Square A5",~ -- Inside source: true -*** True Line Result - row: 6.5, col: 6, text: "Square A5", -** Processing line: ~ note: :a, octave: 5, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :a, octave: 5, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 7.5, col: 6, text: "Square B5",~ -- Inside source: true -*** True Line Result - row: 7.5, col: 6, text: "Square B5", -** Processing line: ~ note: :b, octave: 5, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :b, octave: 5, type: :square, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 8.5, col: 6, text: "Square C5",~ -- Inside source: true -*** True Line Result - row: 8.5, col: 6, text: "Square C5", -** Processing line: ~ note: :c, octave: 5, type: :square, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 5, type: :square, method_to_call: :play_note), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ def saw_tooth_wave_note_buttons args~ -- Inside source: true -*** True Line Result - def saw_tooth_wave_note_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 1.5, col: 8, text: "Saw C4",~ -- Inside source: true -*** True Line Result - row: 1.5, col: 8, text: "Saw C4", -** Processing line: ~ note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 2.5, col: 8, text: "Saw D4",~ -- Inside source: true -*** True Line Result - row: 2.5, col: 8, text: "Saw D4", -** Processing line: ~ note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 3.5, col: 8, text: "Saw E4",~ -- Inside source: true -*** True Line Result - row: 3.5, col: 8, text: "Saw E4", -** Processing line: ~ note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.5, col: 8, text: "Saw F4",~ -- Inside source: true -*** True Line Result - row: 4.5, col: 8, text: "Saw F4", -** Processing line: ~ note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.5, col: 8, text: "Saw G4",~ -- Inside source: true -*** True Line Result - row: 5.5, col: 8, text: "Saw G4", -** Processing line: ~ note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.5, col: 8, text: "Saw A5",~ -- Inside source: true -*** True Line Result - row: 6.5, col: 8, text: "Saw A5", -** Processing line: ~ note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 7.5, col: 8, text: "Saw B5",~ -- Inside source: true -*** True Line Result - row: 7.5, col: 8, text: "Saw B5", -** Processing line: ~ note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 8.5, col: 8, text: "Saw C5",~ -- Inside source: true -*** True Line Result - row: 8.5, col: 8, text: "Saw C5", -** Processing line: ~ note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def triangle_wave_note_buttons args~ -- Inside source: true -*** True Line Result - def triangle_wave_note_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 1.5, col: 10, text: "Triangle C4",~ -- Inside source: true -*** True Line Result - row: 1.5, col: 10, text: "Triangle C4", -** Processing line: ~ note: :c, octave: 4, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 4, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 2.5, col: 10, text: "Triangle D4",~ -- Inside source: true -*** True Line Result - row: 2.5, col: 10, text: "Triangle D4", -** Processing line: ~ note: :d, octave: 4, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :d, octave: 4, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 3.5, col: 10, text: "Triangle E4",~ -- Inside source: true -*** True Line Result - row: 3.5, col: 10, text: "Triangle E4", -** Processing line: ~ note: :e, octave: 4, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :e, octave: 4, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.5, col: 10, text: "Triangle F4",~ -- Inside source: true -*** True Line Result - row: 4.5, col: 10, text: "Triangle F4", -** Processing line: ~ note: :f, octave: 4, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :f, octave: 4, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.5, col: 10, text: "Triangle G4",~ -- Inside source: true -*** True Line Result - row: 5.5, col: 10, text: "Triangle G4", -** Processing line: ~ note: :g, octave: 4, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :g, octave: 4, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.5, col: 10, text: "Triangle A5",~ -- Inside source: true -*** True Line Result - row: 6.5, col: 10, text: "Triangle A5", -** Processing line: ~ note: :a, octave: 5, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :a, octave: 5, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 7.5, col: 10, text: "Triangle B5",~ -- Inside source: true -*** True Line Result - row: 7.5, col: 10, text: "Triangle B5", -** Processing line: ~ note: :b, octave: 5, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :b, octave: 5, type: :triangle, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 8.5, col: 10, text: "Triangle C5",~ -- Inside source: true -*** True Line Result - row: 8.5, col: 10, text: "Triangle C5", -** Processing line: ~ note: :c, octave: 5, type: :triangle, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 5, type: :triangle, method_to_call: :play_note), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def bell_buttons args~ -- Inside source: true -*** True Line Result - def bell_buttons args -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 1.5, col: 4, text: "Bell C4",~ -- Inside source: true -*** True Line Result - row: 1.5, col: 4, text: "Bell C4", -** Processing line: ~ note: :c, octave: 4, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 4, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 2.5, col: 4, text: "Bell D4",~ -- Inside source: true -*** True Line Result - row: 2.5, col: 4, text: "Bell D4", -** Processing line: ~ note: :d, octave: 4, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :d, octave: 4, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 3.5, col: 4, text: "Bell E4",~ -- Inside source: true -*** True Line Result - row: 3.5, col: 4, text: "Bell E4", -** Processing line: ~ note: :e, octave: 4, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :e, octave: 4, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 4.5, col: 4, text: "Bell F4",~ -- Inside source: true -*** True Line Result - row: 4.5, col: 4, text: "Bell F4", -** Processing line: ~ note: :f, octave: 4, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :f, octave: 4, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 5.5, col: 4, text: "Bell G4",~ -- Inside source: true -*** True Line Result - row: 5.5, col: 4, text: "Bell G4", -** Processing line: ~ note: :g, octave: 4, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :g, octave: 4, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 6.5, col: 4, text: "Bell A5",~ -- Inside source: true -*** True Line Result - row: 6.5, col: 4, text: "Bell A5", -** Processing line: ~ note: :a, octave: 5, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :a, octave: 5, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 7.5, col: 4, text: "Bell B5",~ -- Inside source: true -*** True Line Result - row: 7.5, col: 4, text: "Bell B5", -** Processing line: ~ note: :b, octave: 5, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :b, octave: 5, type: :bell, method_to_call: :play_note), -** Processing line: ~ (button args,~ -- Inside source: true -*** True Line Result - (button args, -** Processing line: ~ row: 8.5, col: 4, text: "Bell C5",~ -- Inside source: true -*** True Line Result - row: 8.5, col: 4, text: "Bell C5", -** Processing line: ~ note: :c, octave: 5, type: :bell, method_to_call: :play_note),~ -- Inside source: true -*** True Line Result - note: :c, octave: 5, type: :bell, method_to_call: :play_note), -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: wave generation~ -- Inside source: true -*** True Line Result - begin # region: wave generation -** Processing line: ~ begin # sine wave~ -- Inside source: true -*** True Line Result - begin # sine wave -** Processing line: ~ def defaults_sine_wave_for~ -- Inside source: true -*** True Line Result - def defaults_sine_wave_for -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -- Inside source: true -*** True Line Result - { frequency: 440, sample_rate: 48000 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def sine_wave_for opts = {}~ -- Inside source: true -*** True Line Result - def sine_wave_for opts = {} -** Processing line: ~ opts = defaults_sine_wave_for.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_sine_wave_for.merge opts -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = opts[:sample_rate]~ -- Inside source: true -*** True Line Result - sample_rate = opts[:sample_rate] -** Processing line: ~ period_size = (sample_rate.fdiv frequency).ceil~ -- Inside source: true -*** True Line Result - period_size = (sample_rate.fdiv frequency).ceil -** Processing line: ~ period_size.map_with_index do |i|~ -- Inside source: true -*** True Line Result - period_size.map_with_index do |i| -** Processing line: ~ Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i)~ -- Inside source: true -*** True Line Result - Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) -** Processing line: ~ end.to_a~ -- Inside source: true -*** True Line Result - end.to_a -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_queue_sine_wave~ -- Inside source: true -*** True Line Result - def defaults_queue_sine_wave -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_sine_wave args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_sine_wave args, opts = {} -** Processing line: ~ opts = defaults_queue_sine_wave.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_queue_sine_wave.merge opts -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = 48000~ -- Inside source: true -*** True Line Result - sample_rate = 48000 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~ args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ proc = lambda do~ -- Inside source: true -*** True Line Result - proc = lambda do -** Processing line: ~ generate_audio_data args.state.sine_waves[frequency], sample_rate~ -- Inside source: true -*** True Line Result - generate_audio_data args.state.sine_waves[frequency], sample_rate -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ audio_state = new_audio_state args, opts~ -- Inside source: true -*** True Line Result - audio_state = new_audio_state args, opts -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -- Inside source: true -*** True Line Result - audio_state[:input] = [1, sample_rate, proc] -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: sine_wave~ -- Inside source: true -*** True Line Result - queue_audio args, audio_state: audio_state, wave: sine_wave -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: square wave~ -- Inside source: true -*** True Line Result - begin # region: square wave -** Processing line: ~ def defaults_square_wave_for~ -- Inside source: true -*** True Line Result - def defaults_square_wave_for -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -- Inside source: true -*** True Line Result - { frequency: 440, sample_rate: 48000 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def square_wave_for opts = {}~ -- Inside source: true -*** True Line Result - def square_wave_for opts = {} -** Processing line: ~ opts = defaults_square_wave_for.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_square_wave_for.merge opts -** Processing line: ~ sine_wave = sine_wave_for opts~ -- Inside source: true -*** True Line Result - sine_wave = sine_wave_for opts -** Processing line: ~ sine_wave.map do |v|~ -- Inside source: true -*** True Line Result - sine_wave.map do |v| -** Processing line: ~ if v >= 0~ -- Inside source: true -*** True Line Result - if v >= 0 -** Processing line: ~ 1.0~ -- Inside source: true -*** True Line Result - 1.0 -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ -1.0~ -- Inside source: true -*** True Line Result - -1.0 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end.to_a~ -- Inside source: true -*** True Line Result - end.to_a -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_queue_square_wave~ -- Inside source: true -*** True Line Result - def defaults_queue_square_wave -** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_square_wave args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_square_wave args, opts = {} -** Processing line: ~ opts = defaults_queue_square_wave.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_queue_square_wave.merge opts -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = 48000~ -- Inside source: true -*** True Line Result - sample_rate = 48000 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~ args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ proc = lambda do~ -- Inside source: true -*** True Line Result - proc = lambda do -** Processing line: ~ generate_audio_data args.state.square_waves[frequency], sample_rate~ -- Inside source: true -*** True Line Result - generate_audio_data args.state.square_waves[frequency], sample_rate -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ audio_state = new_audio_state args, opts~ -- Inside source: true -*** True Line Result - audio_state = new_audio_state args, opts -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -- Inside source: true -*** True Line Result - audio_state[:input] = [1, sample_rate, proc] -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: square_wave~ -- Inside source: true -*** True Line Result - queue_audio args, audio_state: audio_state, wave: square_wave -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: saw tooth wave~ -- Inside source: true -*** True Line Result - begin # region: saw tooth wave -** Processing line: ~ def defaults_saw_tooth_wave_for~ -- Inside source: true -*** True Line Result - def defaults_saw_tooth_wave_for -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -- Inside source: true -*** True Line Result - { frequency: 440, sample_rate: 48000 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def saw_tooth_wave_for opts = {}~ -- Inside source: true -*** True Line Result - def saw_tooth_wave_for opts = {} -** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_saw_tooth_wave_for.merge opts -** Processing line: ~ sine_wave = sine_wave_for opts~ -- Inside source: true -*** True Line Result - sine_wave = sine_wave_for opts -** Processing line: ~ period_size = sine_wave.length~ -- Inside source: true -*** True Line Result - period_size = sine_wave.length -** Processing line: ~ sine_wave.map_with_index do |v, i|~ -- Inside source: true -*** True Line Result - sine_wave.map_with_index do |v, i| -** Processing line: ~ (((i % period_size).fdiv period_size) * 2) - 1~ -- Inside source: true -*** True Line Result - (((i % period_size).fdiv period_size) * 2) - 1 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_queue_saw_tooth_wave~ -- Inside source: true -*** True Line Result - def defaults_queue_saw_tooth_wave -** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_saw_tooth_wave args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_saw_tooth_wave args, opts = {} -** Processing line: ~ opts = defaults_queue_saw_tooth_wave.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_queue_saw_tooth_wave.merge opts -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = 48000~ -- Inside source: true -*** True Line Result - sample_rate = 48000 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~ args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ proc = lambda do~ -- Inside source: true -*** True Line Result - proc = lambda do -** Processing line: ~ generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate~ -- Inside source: true -*** True Line Result - generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ audio_state = new_audio_state args, opts~ -- Inside source: true -*** True Line Result - audio_state = new_audio_state args, opts -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -- Inside source: true -*** True Line Result - audio_state[:input] = [1, sample_rate, proc] -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: saw_tooth_wave~ -- Inside source: true -*** True Line Result - queue_audio args, audio_state: audio_state, wave: saw_tooth_wave -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: triangle wave~ -- Inside source: true -*** True Line Result - begin # region: triangle wave -** Processing line: ~ def defaults_triangle_wave_for~ -- Inside source: true -*** True Line Result - def defaults_triangle_wave_for -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -- Inside source: true -*** True Line Result - { frequency: 440, sample_rate: 48000 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def triangle_wave_for opts = {}~ -- Inside source: true -*** True Line Result - def triangle_wave_for opts = {} -** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_saw_tooth_wave_for.merge opts -** Processing line: ~ sine_wave = sine_wave_for opts~ -- Inside source: true -*** True Line Result - sine_wave = sine_wave_for opts -** Processing line: ~ period_size = sine_wave.length~ -- Inside source: true -*** True Line Result - period_size = sine_wave.length -** Processing line: ~ sine_wave.map_with_index do |v, i|~ -- Inside source: true -*** True Line Result - sine_wave.map_with_index do |v, i| -** Processing line: ~ ratio = (i.fdiv period_size)~ -- Inside source: true -*** True Line Result - ratio = (i.fdiv period_size) -** Processing line: ~ if ratio <= 0.5~ -- Inside source: true -*** True Line Result - if ratio <= 0.5 -** Processing line: ~ (ratio * 4) - 1~ -- Inside source: true -*** True Line Result - (ratio * 4) - 1 -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ ratio -= 0.5~ -- Inside source: true -*** True Line Result - ratio -= 0.5 -** Processing line: ~ 1 - (ratio * 4)~ -- Inside source: true -*** True Line Result - 1 - (ratio * 4) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_queue_triangle_wave~ -- Inside source: true -*** True Line Result - def defaults_queue_triangle_wave -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_triangle_wave args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_triangle_wave args, opts = {} -** Processing line: ~ opts = defaults_queue_triangle_wave.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_queue_triangle_wave.merge opts -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = 48000~ -- Inside source: true -*** True Line Result - sample_rate = 48000 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~ args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate~ -- Inside source: true -*** True Line Result - args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ proc = lambda do~ -- Inside source: true -*** True Line Result - proc = lambda do -** Processing line: ~ generate_audio_data args.state.triangle_waves[frequency], sample_rate~ -- Inside source: true -*** True Line Result - generate_audio_data args.state.triangle_waves[frequency], sample_rate -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ audio_state = new_audio_state args, opts~ -- Inside source: true -*** True Line Result - audio_state = new_audio_state args, opts -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -- Inside source: true -*** True Line Result - audio_state[:input] = [1, sample_rate, proc] -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: triangle_wave~ -- Inside source: true -*** True Line Result - queue_audio args, audio_state: audio_state, wave: triangle_wave -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: bell~ -- Inside source: true -*** True Line Result - begin # region: bell -** Processing line: ~ def defaults_queue_bell~ -- Inside source: true -*** True Line Result - def defaults_queue_bell -** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 1.seconds, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_bell args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_bell args, opts = {} -** Processing line: ~ (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b }~ -- Inside source: true -*** True Line Result - (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def bell_harmonics~ -- Inside source: true -*** True Line Result - def bell_harmonics -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ { frequency_ratio: 0.5, duration_ratio: 1.00 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 0.5, duration_ratio: 1.00 }, -** Processing line: ~ { frequency_ratio: 1.0, duration_ratio: 0.80 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 1.0, duration_ratio: 0.80 }, -** Processing line: ~ { frequency_ratio: 2.0, duration_ratio: 0.60 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 2.0, duration_ratio: 0.60 }, -** Processing line: ~ { frequency_ratio: 3.0, duration_ratio: 0.40 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 3.0, duration_ratio: 0.40 }, -** Processing line: ~ { frequency_ratio: 4.2, duration_ratio: 0.25 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 4.2, duration_ratio: 0.25 }, -** Processing line: ~ { frequency_ratio: 5.4, duration_ratio: 0.20 },~ -- Inside source: true -*** True Line Result - { frequency_ratio: 5.4, duration_ratio: 0.20 }, -** Processing line: ~ { frequency_ratio: 6.8, duration_ratio: 0.15 }~ -- Inside source: true -*** True Line Result - { frequency_ratio: 6.8, duration_ratio: 0.15 } -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_bell_to_sine_waves~ -- Inside source: true -*** True Line Result - def defaults_bell_to_sine_waves -** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 1.seconds, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def bell_to_sine_waves opts = {}~ -- Inside source: true -*** True Line Result - def bell_to_sine_waves opts = {} -** Processing line: ~ opts = defaults_bell_to_sine_waves.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_bell_to_sine_waves.merge opts -** Processing line: ~ bell_harmonics.map do |b|~ -- Inside source: true -*** True Line Result - bell_harmonics.map do |b| -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ frequency: opts[:frequency] * b[:frequency_ratio],~ -- Inside source: true -*** True Line Result - frequency: opts[:frequency] * b[:frequency_ratio], -** Processing line: ~ duration: opts[:duration] * b[:duration_ratio],~ -- Inside source: true -*** True Line Result - duration: opts[:duration] * b[:duration_ratio], -** Processing line: ~ queue_in: opts[:queue_in],~ -- Inside source: true -*** True Line Result - queue_in: opts[:queue_in], -** Processing line: ~ gain: (1.fdiv bell_harmonics.length),~ -- Inside source: true -*** True Line Result - gain: (1.fdiv bell_harmonics.length), -** Processing line: ~ fade_out: true~ -- Inside source: true -*** True Line Result - fade_out: true -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # audio entity construction~ -- Inside source: true -*** True Line Result - begin # audio entity construction -** Processing line: ~ def generate_audio_data sine_wave, sample_rate~ -- Inside source: true -*** True Line Result - def generate_audio_data sine_wave, sample_rate -** Processing line: ~ sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil~ -- Inside source: true -*** True Line Result - sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil -** Processing line: ~ copy_count = (sample_size.fdiv sine_wave.length).ceil~ -- Inside source: true -*** True Line Result - copy_count = (sample_size.fdiv sine_wave.length).ceil -** Processing line: ~ sine_wave * copy_count~ -- Inside source: true -*** True Line Result - sine_wave * copy_count -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def defaults_new_audio_state~ -- Inside source: true -*** True Line Result - def defaults_new_audio_state -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -- Inside source: true -*** True Line Result - { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def new_audio_state args, opts = {}~ -- Inside source: true -*** True Line Result - def new_audio_state args, opts = {} -** Processing line: ~ opts = defaults_new_audio_state.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_new_audio_state.merge opts -** Processing line: ~ decay_rate = 0~ -- Inside source: true -*** True Line Result - decay_rate = 0 -** Processing line: ~ decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out]~ -- Inside source: true -*** True Line Result - decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] -** Processing line: ~ frequency = opts[:frequency]~ -- Inside source: true -*** True Line Result - frequency = opts[:frequency] -** Processing line: ~ sample_rate = 48000~ -- Inside source: true -*** True Line Result - sample_rate = 48000 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ id: (new_id! args),~ -- Inside source: true -*** True Line Result - id: (new_id! args), -** Processing line: ~ frequency: frequency,~ -- Inside source: true -*** True Line Result - frequency: frequency, -** Processing line: ~ sample_rate: 48000,~ -- Inside source: true -*** True Line Result - sample_rate: 48000, -** Processing line: ~ stop_at: args.tick_count + opts[:queue_in] + opts[:duration],~ -- Inside source: true -*** True Line Result - stop_at: args.tick_count + opts[:queue_in] + opts[:duration], -** Processing line: ~ gain: opts[:gain].to_f,~ -- Inside source: true -*** True Line Result - gain: opts[:gain].to_f, -** Processing line: ~ queue_at: args.state.tick_count + opts[:queue_in],~ -- Inside source: true -*** True Line Result - queue_at: args.state.tick_count + opts[:queue_in], -** Processing line: ~ decay_rate: decay_rate,~ -- Inside source: true -*** True Line Result - decay_rate: decay_rate, -** Processing line: ~ pitch: 1.0,~ -- Inside source: true -*** True Line Result - pitch: 1.0, -** Processing line: ~ looping: true,~ -- Inside source: true -*** True Line Result - looping: true, -** Processing line: ~ paused: false~ -- Inside source: true -*** True Line Result - paused: false -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def queue_audio args, opts = {}~ -- Inside source: true -*** True Line Result - def queue_audio args, opts = {} -** Processing line: ~ graph_wave args, opts[:wave], opts[:audio_state][:frequency]~ -- Inside source: true -*** True Line Result - graph_wave args, opts[:wave], opts[:audio_state][:frequency] -** Processing line: ~ args.state.audio_queue << opts[:audio_state]~ -- Inside source: true -*** True Line Result - args.state.audio_queue << opts[:audio_state] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def new_id! args~ -- Inside source: true -*** True Line Result - def new_id! args -** Processing line: ~ args.state.audio_id ||= 0~ -- Inside source: true -*** True Line Result - args.state.audio_id ||= 0 -** Processing line: ~ args.state.audio_id += 1~ -- Inside source: true -*** True Line Result - args.state.audio_id += 1 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def graph_wave args, wave, frequency~ -- Inside source: true -*** True Line Result - def graph_wave args, wave, frequency -** Processing line: ~ if args.state.tick_count != args.state.graphed_at~ -- Inside source: true -*** True Line Result - if args.state.tick_count != args.state.graphed_at -** Processing line: ~ args.outputs.static_lines.clear~ -- Inside source: true -*** True Line Result - args.outputs.static_lines.clear -** Processing line: ~ args.outputs.static_sprites.clear~ -- Inside source: true -*** True Line Result - args.outputs.static_sprites.clear -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ wave = wave~ -- Inside source: true -*** True Line Result - wave = wave -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ r, g, b = frequency.to_i % 85,~ -- Inside source: true -*** True Line Result - r, g, b = frequency.to_i % 85, -** Processing line: ~ frequency.to_i % 170,~ -- Inside source: true -*** True Line Result - frequency.to_i % 170, -** Processing line: ~ frequency.to_i % 255~ -- Inside source: true -*** True Line Result - frequency.to_i % 255 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ starting_rect = args.layout.rect(row: 5, col: 13)~ -- Inside source: true -*** True Line Result - starting_rect = args.layout.rect(row: 5, col: 13) -** Processing line: ~ x_scale = 10~ -- Inside source: true -*** True Line Result - x_scale = 10 -** Processing line: ~ y_scale = 100~ -- Inside source: true -*** True Line Result - y_scale = 100 -** Processing line: ~ max_points = 25~ -- Inside source: true -*** True Line Result - max_points = 25 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ points = wave~ -- Inside source: true -*** True Line Result - points = wave -** Processing line: ~ if wave.length > max_points~ -- Inside source: true -*** True Line Result - if wave.length > max_points -** Processing line: ~ resolution = wave.length.idiv max_points~ -- Inside source: true -*** True Line Result - resolution = wave.length.idiv max_points -** Processing line: ~ points = wave.find_all.with_index { |y, i| (i % resolution == 0) }~ -- Inside source: true -*** True Line Result - points = wave.find_all.with_index { |y, i| (i % resolution == 0) } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.static_lines << points.map_with_index do |y, x|~ -- Inside source: true -*** True Line Result - args.outputs.static_lines << points.map_with_index do |y, x| -** Processing line: ~ next_y = points[x + 1]~ -- Inside source: true -*** True Line Result - next_y = points[x + 1] -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if next_y~ -- Inside source: true -*** True Line Result - if next_y -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ x: starting_rect.x + (x * x_scale),~ -- Inside source: true -*** True Line Result - x: starting_rect.x + (x * x_scale), -** Processing line: ~ y: starting_rect.y + starting_rect.h.half + y_scale * y,~ -- Inside source: true -*** True Line Result - y: starting_rect.y + starting_rect.h.half + y_scale * y, -** Processing line: ~ x2: starting_rect.x + ((x + 1) * x_scale),~ -- Inside source: true -*** True Line Result - x2: starting_rect.x + ((x + 1) * x_scale), -** Processing line: ~ y2: starting_rect.y + starting_rect.h.half + y_scale * next_y,~ -- Inside source: true -*** True Line Result - y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, -** Processing line: ~ r: r,~ -- Inside source: true -*** True Line Result - r: r, -** Processing line: ~ g: g,~ -- Inside source: true -*** True Line Result - g: g, -** Processing line: ~ b: b~ -- Inside source: true -*** True Line Result - b: b -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.static_sprites << points.map_with_index do |y, x|~ -- Inside source: true -*** True Line Result - args.outputs.static_sprites << points.map_with_index do |y, x| -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ x: (starting_rect.x + (x * x_scale)) - 2,~ -- Inside source: true -*** True Line Result - x: (starting_rect.x + (x * x_scale)) - 2, -** Processing line: ~ y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2,~ -- Inside source: true -*** True Line Result - y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, -** Processing line: ~ w: 4,~ -- Inside source: true -*** True Line Result - w: 4, -** Processing line: ~ h: 4,~ -- Inside source: true -*** True Line Result - h: 4, -** Processing line: ~ path: 'sprites/square-white.png',~ -- Inside source: true -*** True Line Result - path: 'sprites/square-white.png', -** Processing line: ~ r: r,~ -- Inside source: true -*** True Line Result - r: r, -** Processing line: ~ g: g,~ -- Inside source: true -*** True Line Result - g: g, -** Processing line: ~ b: b~ -- Inside source: true -*** True Line Result - b: b -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.state.graphed_at = args.state.tick_count~ -- Inside source: true -*** True Line Result - args.state.graphed_at = args.state.tick_count -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ begin # region: musical note mapping~ -- Inside source: true -*** True Line Result - begin # region: musical note mapping -** Processing line: ~ def defaults_frequency_for~ -- Inside source: true -*** True Line Result - def defaults_frequency_for -** Processing line: ~ { note: :a, octave: 5, sharp: false, flat: false }~ -- Inside source: true -*** True Line Result - { note: :a, octave: 5, sharp: false, flat: false } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def frequency_for opts = {}~ -- Inside source: true -*** True Line Result - def frequency_for opts = {} -** Processing line: ~ opts = defaults_frequency_for.merge opts~ -- Inside source: true -*** True Line Result - opts = defaults_frequency_for.merge opts -** Processing line: ~ octave_offset_multiplier = opts[:octave] - 5~ -- Inside source: true -*** True Line Result - octave_offset_multiplier = opts[:octave] - 5 -** Processing line: ~ note = note_frequencies_octave_5[opts[:note]]~ -- Inside source: true -*** True Line Result - note = note_frequencies_octave_5[opts[:note]] -** Processing line: ~ if octave_offset_multiplier < 0~ -- Inside source: true -*** True Line Result - if octave_offset_multiplier < 0 -** Processing line: ~ note = note * 1 / (octave_offset_multiplier.abs + 1)~ -- Inside source: true -*** True Line Result - note = note * 1 / (octave_offset_multiplier.abs + 1) -** Processing line: ~ elsif octave_offset_multiplier > 0~ -- Inside source: true -*** True Line Result - elsif octave_offset_multiplier > 0 -** Processing line: ~ note = note * (octave_offset_multiplier.abs + 1) / 1~ -- Inside source: true -*** True Line Result - note = note * (octave_offset_multiplier.abs + 1) / 1 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ note~ -- Inside source: true -*** True Line Result - note -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def note_frequencies_octave_5~ -- Inside source: true -*** True Line Result - def note_frequencies_octave_5 -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ a: 440.0,~ -- Inside source: true -*** True Line Result - a: 440.0, -** Processing line: ~ a_sharp: 466.16, b_flat: 466.16,~ -- Inside source: true -*** True Line Result - a_sharp: 466.16, b_flat: 466.16, -** Processing line: ~ b: 493.88,~ -- Inside source: true -*** True Line Result - b: 493.88, -** Processing line: ~ c: 523.25,~ -- Inside source: true -*** True Line Result - c: 523.25, -** Processing line: ~ c_sharp: 554.37, d_flat: 587.33,~ -- Inside source: true -*** True Line Result - c_sharp: 554.37, d_flat: 587.33, -** Processing line: ~ d: 587.33,~ -- Inside source: true -*** True Line Result - d: 587.33, -** Processing line: ~ d_sharp: 622.25, e_flat: 659.25,~ -- Inside source: true -*** True Line Result - d_sharp: 622.25, e_flat: 659.25, -** Processing line: ~ e: 659.25,~ -- Inside source: true -*** True Line Result - e: 659.25, -** Processing line: ~ f: 698.25,~ -- Inside source: true -*** True Line Result - f: 698.25, -** Processing line: ~ f_sharp: 739.99, g_flat: 739.99,~ -- Inside source: true -*** True Line Result - f_sharp: 739.99, g_flat: 739.99, -** Processing line: ~ g: 783.99,~ -- Inside source: true -*** True Line Result - g: 783.99, -** Processing line: ~ g_sharp: 830.61, a_flat: 830.61~ -- Inside source: true -*** True Line Result - g_sharp: 830.61, a_flat: 830.61 -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ $gtk.reset~ -- Inside source: true -*** True Line Result - $gtk.reset -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - ** Processing line: ~*** Input Basics - Keyboard - main.rb~ - Header detected. *** True Line Result @@ -17136,18 +14715,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Notice how small_font accounts for all the remaining parameters -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 0), text: "Current game time: #{args.state.tick_count}", size_enum: -1 }~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ + args.outputs.labels << { x: 460, y: row_to_px(args, 0), text: "Current game time: #{args.state.tick_count}", size_enum: -1 } +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 2), text: "Keyboard input: args.inputs.keyboard.key_up.h", size_enum: -1 }~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ + args.outputs.labels << { x: 460, y: row_to_px(args, 2), text: "Keyboard input: args.inputs.keyboard.key_up.h", size_enum: -1 } +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 3), text: "Press \"h\" on the keyboard.", size_enum: -1 }~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 3), text: "Press \"h\" on the keyboard.", size_enum: -1 } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -17188,18 +14767,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if args.state.h_pressed_at -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" was pressed at time: #{args.state.h_pressed_at}", size_enum: -1 }~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" was pressed at time: #{args.state.h_pressed_at}", size_enum: -1 } ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" has never been pressed.", size_enum: -1 }~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] + args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" has never been pressed.", size_enum: -1 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17220,42 +14799,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def small_font~ -- Inside source: true -*** True Line Result - def small_font -** Processing line: ~ # This method provides some values for the construction of labels~ -- Inside source: true -*** True Line Result - # This method provides some values for the construction of labels -** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ -- Inside source: true -*** True Line Result - # Specifically, Size, Alignment, & RGBA -** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ -- Inside source: true -*** True Line Result - # This makes it so that custom parameters don't have to be repeatedly typed. -** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ +** Processing line: ~ def row_to_px args, row_number, y_offset = 20~ - Inside source: true *** True Line Result - # Additionally "small_font" provides programmers with more information than some numbers -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -- Inside source: true -*** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def row_to_px args, row_number~ -- Inside source: true -*** True Line Result - def row_to_px args, row_number + def row_to_px args, row_number, y_offset = 20 ** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ - Inside source: true *** True Line Result @@ -17268,10 +14815,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Each row afterward is 20 units lower -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ args.grid.top - 5 - (y_offset * row_number)~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (y_offset * row_number) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17388,10 +14935,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: "This is the api for the keys you've pressed:", size_enum: -1, r: 180 }~ - Inside source: true *** True Line Result - args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] + args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: "This is the api for the keys you've pressed:", size_enum: -1, r: 180 } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -17416,22 +14963,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: "args.inputs.keyboard", size_enum: -2 }~ - Inside source: true *** True Line Result - args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] -** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ + args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: "args.inputs.keyboard", size_enum: -2 } +** Processing line: ~ args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_down", size_enum: -2 }~ - Inside source: true *** True Line Result - args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] -** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ + args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_down", size_enum: -2 } +** Processing line: ~ args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_held", size_enum: -2 }~ - Inside source: true *** True Line Result - args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] -** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ + args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_held", size_enum: -2 } +** Processing line: ~ args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_up", size_enum: -2 }~ - Inside source: true *** True Line Result - args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] + args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_up", size_enum: -2 } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -17612,30 +15159,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result [ -** Processing line: ~ [x, row_to_px(args, idx - 2),~ -- Inside source: true -*** True Line Result - [x, row_to_px(args, idx - 2), -** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ -- Inside source: true -*** True Line Result - " .#{k} is #{current_value || "nil"}", -** Processing line: ~ small_font],~ -- Inside source: true -*** True Line Result - small_font], -** Processing line: ~ [x, row_to_px(args, idx - 1),~ -- Inside source: true -*** True Line Result - [x, row_to_px(args, idx - 1), -** Processing line: ~ " was #{v}",~ +** Processing line: ~ { x: x, y: row_to_px(args, idx + 0, 16), text: " .#{k} is #{current_value || "nil"}", size_enum: -2 },~ - Inside source: true *** True Line Result - " was #{v}", -** Processing line: ~ small_font]~ + { x: x, y: row_to_px(args, idx + 0, 16), text: " .#{k} is #{current_value || "nil"}", size_enum: -2 }, +** Processing line: ~ { x: x, y: row_to_px(args, idx + 1, 16), text: " was #{v}", size_enum: -2 }~ - Inside source: true *** True Line Result - small_font] + { x: x, y: row_to_px(args, idx + 1, 16), text: " was #{v}", size_enum: -2 } ** Processing line: ~ ]~ - Inside source: true *** True Line Result @@ -17692,18 +15223,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text,~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 640, y: y, text: text, +** Processing line: ~ size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)",~ +- Inside source: true +*** True Line Result + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", +** Processing line: ~ size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +- Inside source: true +*** True Line Result + size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17720,6 +15259,154 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Input Basics - Moving A Sprite - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Input Basics - Moving A Sprite - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/02_input_basics/01_moving_a_sprite/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/02_input_basics/01_moving_a_sprite/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # create a player and set default values~ +- Inside source: true +*** True Line Result + # create a player and set default values +** Processing line: ~ # for the player's x, y, w (width), and h (height)~ +- Inside source: true +*** True Line Result + # for the player's x, y, w (width), and h (height) +** Processing line: ~ args.state.player.x ||= 100~ +- Inside source: true +*** True Line Result + args.state.player.x ||= 100 +** Processing line: ~ args.state.player.y ||= 100~ +- Inside source: true +*** True Line Result + args.state.player.y ||= 100 +** Processing line: ~ args.state.player.w ||= 50~ +- Inside source: true +*** True Line Result + args.state.player.w ||= 50 +** Processing line: ~ args.state.player.h ||= 50~ +- Inside source: true +*** True Line Result + args.state.player.h ||= 50 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render the player to the screen~ +- Inside source: true +*** True Line Result + # render the player to the screen +** Processing line: ~ args.outputs.sprites << { x: args.state.player.x,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: args.state.player.x, +** Processing line: ~ y: args.state.player.y,~ +- Inside source: true +*** True Line Result + y: args.state.player.y, +** Processing line: ~ w: args.state.player.w,~ +- Inside source: true +*** True Line Result + w: args.state.player.w, +** Processing line: ~ h: args.state.player.h,~ +- Inside source: true +*** True Line Result + h: args.state.player.h, +** Processing line: ~ path: 'sprites/square/green.png' }~ +- Inside source: true +*** True Line Result + path: 'sprites/square/green.png' } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # move the player around using the keyboard~ +- Inside source: true +*** True Line Result + # move the player around using the keyboard +** Processing line: ~ if args.inputs.up~ +- Inside source: true +*** True Line Result + if args.inputs.up +** Processing line: ~ args.state.player.y += 10~ +- Inside source: true +*** True Line Result + args.state.player.y += 10 +** Processing line: ~ elsif args.inputs.down~ +- Inside source: true +*** True Line Result + elsif args.inputs.down +** Processing line: ~ args.state.player.y -= 10~ +- Inside source: true +*** True Line Result + args.state.player.y -= 10 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.left~ +- Inside source: true +*** True Line Result + if args.inputs.left +** Processing line: ~ args.state.player.x -= 10~ +- Inside source: true +*** True Line Result + args.state.player.x -= 10 +** Processing line: ~ elsif args.inputs.right~ +- Inside source: true +*** True Line Result + elsif args.inputs.right +** Processing line: ~ args.state.player.x += 10~ +- Inside source: true +*** True Line Result + args.state.player.x += 10 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Input Basics - Mouse - main.rb~ - Header detected. *** True Line Result @@ -17872,10 +15559,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # To see how many frames its been since the click occurred -** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ +** Processing line: ~ # Use args.inputs.mouse.click.created_at_elapsed~ - Inside source: true *** True Line Result - # Use args.inputs.mouse.click.creat_at_elapsed + # Use args.inputs.mouse.click.created_at_elapsed ** Processing line: ~~ - Inside source: true *** True Line Result @@ -17988,26 +15675,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # and adds the customization parameters -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -- Inside source: true -*** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def small_font~ -- Inside source: true -*** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, alignment_enum: -2 }~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, alignment_enum: -2 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18068,18 +15739,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18288,10 +15959,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ +** Processing line: ~ box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 }~ - Inside source: true *** True Line Result - box = [785, 370, 50, 50, 0, 0, 170] + box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 } ** Processing line: ~ args.outputs.borders << box~ - Inside source: true *** True Line Result @@ -18376,26 +16047,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def small_label args, x, row, message -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, size_enum: -2 }~ - Inside source: true *** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def small_font~ -- Inside source: true -*** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -- Inside source: true -*** True Line Result - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18456,18 +16111,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid! +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18676,18 +16331,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if !args.state.box_collision_one -** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ +** Processing line: ~ args.state.box_collision_one = { x: args.inputs.mouse.click.point.x - 25,~ +- Inside source: true +*** True Line Result + args.state.box_collision_one = { x: args.inputs.mouse.click.point.x - 25, +** Processing line: ~ y: args.inputs.mouse.click.point.y - 25,~ +- Inside source: true +*** True Line Result + y: args.inputs.mouse.click.point.y - 25, +** Processing line: ~ w: 125, h: 125,~ - Inside source: true *** True Line Result - args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] + w: 125, h: 125, +** Processing line: ~ r: 180, g: 0, b: 0, a: 180 }~ +- Inside source: true +*** True Line Result + r: 180, g: 0, b: 0, a: 180 } ** Processing line: ~ elsif !args.state.box_collision_two~ - Inside source: true *** True Line Result elsif !args.state.box_collision_two -** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ +** Processing line: ~ args.state.box_collision_two = { x: args.inputs.mouse.click.point.x - 25,~ - Inside source: true *** True Line Result - args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] + args.state.box_collision_two = { x: args.inputs.mouse.click.point.x - 25, +** Processing line: ~ y: args.inputs.mouse.click.point.y - 25,~ +- Inside source: true +*** True Line Result + y: args.inputs.mouse.click.point.y - 25, +** Processing line: ~ w: 125, h: 125,~ +- Inside source: true +*** True Line Result + w: 125, h: 125, +** Processing line: ~ r: 0, g: 0, b: 180, a: 180 }~ +- Inside source: true +*** True Line Result + r: 0, g: 0, b: 180, a: 180 } ** Processing line: ~ else~ - Inside source: true *** True Line Result @@ -18792,26 +16471,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def small_label args, x, row, message -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -- Inside source: true -*** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, size_enum: -2 }~ - Inside source: true *** True Line Result - -** Processing line: ~ def small_font~ -- Inside source: true -*** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -- Inside source: true -*** True Line Result - [-2, 0, 0, 0, 0, 255] + { x: x, y: row_to_px(args, row), text: message, size_enum: -2 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18824,10 +16487,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def row_to_px args, row_number -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ args.grid.top - 5 - (20 * row_number)~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.grid.top - 5 - (20 * row_number) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19092,118 +16755,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ +** Processing line: ~ state.buttons << { x: 100, y: 500, active: inputs.controller_one.key_held.l1, text: "L1"}~ - Inside source: true *** True Line Result - state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] -** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ + state.buttons << { x: 100, y: 500, active: inputs.controller_one.key_held.l1, text: "L1"} +** Processing line: ~ state.buttons << { x: 100, y: 600, active: inputs.controller_one.key_held.l2, text: "L2"}~ - Inside source: true *** True Line Result - state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] -** Processing line: ~~ + state.buttons << { x: 100, y: 600, active: inputs.controller_one.key_held.l2, text: "L2"} +** Processing line: ~ state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"}~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ + state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"} +** Processing line: ~ state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"}~ - Inside source: true *** True Line Result - state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] -** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ + state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"} +** Processing line: ~ state.buttons << { x: 540, y: 450, active: inputs.controller_one.key_held.select, text: "Select"}~ - Inside source: true *** True Line Result - state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] -** Processing line: ~~ + state.buttons << { x: 540, y: 450, active: inputs.controller_one.key_held.select, text: "Select"} +** Processing line: ~ state.buttons << { x: 660, y: 450, active: inputs.controller_one.key_held.start, text: "Start"}~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ + state.buttons << { x: 660, y: 450, active: inputs.controller_one.key_held.start, text: "Start"} +** Processing line: ~ state.buttons << { x: 200, y: 300, active: inputs.controller_one.key_held.left, text: "Left"}~ - Inside source: true *** True Line Result - state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] -** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ + state.buttons << { x: 200, y: 300, active: inputs.controller_one.key_held.left, text: "Left"} +** Processing line: ~ state.buttons << { x: 300, y: 400, active: inputs.controller_one.key_held.up, text: "Up"}~ - Inside source: true *** True Line Result - state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] -** Processing line: ~~ + state.buttons << { x: 300, y: 400, active: inputs.controller_one.key_held.up, text: "Up"} +** Processing line: ~ state.buttons << { x: 400, y: 300, active: inputs.controller_one.key_held.right, text: "Right"}~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ -- Inside source: true -*** True Line Result - state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] -** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ -- Inside source: true -*** True Line Result - state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] -** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ -- Inside source: true -*** True Line Result - state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] -** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ -- Inside source: true -*** True Line Result - state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ -- Inside source: true -*** True Line Result - state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] -** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ + state.buttons << { x: 400, y: 300, active: inputs.controller_one.key_held.right, text: "Right"} +** Processing line: ~ state.buttons << { x: 300, y: 200, active: inputs.controller_one.key_held.down, text: "Down"}~ - Inside source: true *** True Line Result - state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] -** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ + state.buttons << { x: 300, y: 200, active: inputs.controller_one.key_held.down, text: "Down"} +** Processing line: ~ state.buttons << { x: 800, y: 300, active: inputs.controller_one.key_held.x, text: "X"}~ - Inside source: true *** True Line Result - state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] -** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ + state.buttons << { x: 800, y: 300, active: inputs.controller_one.key_held.x, text: "X"} +** Processing line: ~ state.buttons << { x: 900, y: 400, active: inputs.controller_one.key_held.y, text: "Y"}~ - Inside source: true *** True Line Result - state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] -** Processing line: ~~ + state.buttons << { x: 900, y: 400, active: inputs.controller_one.key_held.y, text: "Y"} +** Processing line: ~ state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"}~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ + state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"} +** Processing line: ~ state.buttons << { x: 900, y: 200, active: inputs.controller_one.key_held.b, text: "B"}~ - Inside source: true *** True Line Result - state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, -** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ + state.buttons << { x: 900, y: 200, active: inputs.controller_one.key_held.b, text: "B"} +** Processing line: ~ state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100,~ - Inside source: true *** True Line Result - 100 + inputs.controller_one.left_analog_y_perc * 100, -** Processing line: ~ inputs.controller_one.key_held.l3,~ + state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100, +** Processing line: ~ y: 100 + inputs.controller_one.left_analog_y_perc * 100,~ - Inside source: true *** True Line Result - inputs.controller_one.key_held.l3, -** Processing line: ~ "L3"]~ + y: 100 + inputs.controller_one.left_analog_y_perc * 100, +** Processing line: ~ active: inputs.controller_one.key_held.l3,~ - Inside source: true *** True Line Result - "L3"] -** Processing line: ~~ + active: inputs.controller_one.key_held.l3, +** Processing line: ~ text: "L3" }~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ + text: "L3" } +** Processing line: ~ state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100,~ - Inside source: true *** True Line Result - state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, -** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ + state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100, +** Processing line: ~ y: 100 + inputs.controller_one.right_analog_y_perc * 100,~ - Inside source: true *** True Line Result - 100 + inputs.controller_one.right_analog_y_perc * 100, -** Processing line: ~ inputs.controller_one.key_held.r3,~ + y: 100 + inputs.controller_one.right_analog_y_perc * 100, +** Processing line: ~ active: inputs.controller_one.key_held.r3,~ - Inside source: true *** True Line Result - inputs.controller_one.key_held.r3, -** Processing line: ~ "R3"]~ + active: inputs.controller_one.key_held.r3, +** Processing line: ~ text: "R3" }~ - Inside source: true *** True Line Result - "R3"] + text: "R3" } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19228,22 +16867,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def render -** Processing line: ~ state.buttons.each do |x, y, active, text|~ +** Processing line: ~ state.buttons.each do |b|~ - Inside source: true *** True Line Result - state.buttons.each do |x, y, active, text| -** Processing line: ~ rect = [x, y, 75, 75]~ + state.buttons.each do |b| +** Processing line: ~ rect = { x: b.x, y: b.y, w: 75, h: 75 }~ - Inside source: true *** True Line Result - rect = [x, y, 75, 75] + rect = { x: b.x, y: b.y, w: 75, h: 75 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if active # if button is pressed~ +** Processing line: ~ if b.active # if button is pressed~ - Inside source: true *** True Line Result - if active # if button is pressed + if b.active # if button is pressed ** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ - Inside source: true *** True Line Result @@ -19268,10 +16907,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Outputs the text of each button using labels. -** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ +** Processing line: ~ outputs.labels << { x: b.x, y: b.y + 95, text: b.text } # add 95 to place label above button~ - Inside source: true *** True Line Result - outputs.labels << [x, y + 95, text] # add 95 to place label above button + outputs.labels << { x: b.x, y: b.y + 95, text: b.text } # add 95 to place label above button ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19280,22 +16919,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ +** Processing line: ~ outputs.labels << { x: 10, y: 60, text: "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)" }~ - Inside source: true *** True Line Result - outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] -** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ + outputs.labels << { x: 10, y: 60, text: "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)" } +** Processing line: ~ outputs.labels << { x: 10, y: 30, text: "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)" }~ - Inside source: true *** True Line Result - outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] -** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ + outputs.labels << { x: 10, y: 30, text: "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)" } +** Processing line: ~ outputs.labels << { x: 900, y: 60, text: "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)" }~ - Inside source: true *** True Line Result - outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] -** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ + outputs.labels << { x: 900, y: 60, text: "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)" } +** Processing line: ~ outputs.labels << { x: 900, y: 30, text: "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)" }~ - Inside source: true *** True Line Result - outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] + outputs.labels << { x: 900, y: 30, text: "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)" } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19500,10 +17139,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if !args.inputs.finger_one.nil? -** Processing line: ~ args.outputs.primitives << [640, 650, "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", 5, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.primitives << { x: 640, y: 650, text: "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).",~ +- Inside source: true +*** True Line Result + args.outputs.primitives << { x: 640, y: 650, text: "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", +** Processing line: ~ size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ - Inside source: true *** True Line Result - args.outputs.primitives << [640, 650, "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", 5, 1, 255, 255, 255].label + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19512,10 +17155,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if !args.inputs.finger_two.nil? -** Processing line: ~ args.outputs.primitives << [640, 600, "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", 5, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.primitives << { x: 640, y: 600, text: "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).",~ - Inside source: true *** True Line Result - args.outputs.primitives << [640, 600, "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", 5, 1, 255, 255, 255].label + args.outputs.primitives << { x: 640, y: 600, text: "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", +** Processing line: ~ size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +- Inside source: true +*** True Line Result + size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19596,14 +17243,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result b = (color & 0x0000FF) -** Processing line: ~ args.outputs.primitives << [v.x - (size / 2), v.y + (size / 2), size, size, r, g, b, 255].solid~ +** Processing line: ~ args.outputs.primitives << { x: v.x - (size / 2), y: v.y + (size / 2), w: size, h: size, r: r, g: g, b: b, a: 255 }.solid!~ - Inside source: true *** True Line Result - args.outputs.primitives << [v.x - (size / 2), v.y + (size / 2), size, size, r, g, b, 255].solid -** Processing line: ~ args.outputs.primitives << [v.x, v.y + size, k.to_s, 0, 1, 0, 0, 0].label~ + args.outputs.primitives << { x: v.x - (size / 2), y: v.y + (size / 2), w: size, h: size, r: r, g: g, b: b, a: 255 }.solid! +** Processing line: ~ args.outputs.primitives << { x: v.x, y: v.y + size, text: k.to_s, alignment_enum: 1 }.label!~ - Inside source: true *** True Line Result - args.outputs.primitives << [v.x, v.y + size, k.to_s, 0, 1, 0, 0, 0].label + args.outputs.primitives << { x: v.x, y: v.y + size, text: k.to_s, alignment_enum: 1 }.label! ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -19616,10 +17263,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -19776,6 +17419,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def tick args +** Processing line: ~ # uncomment the line below to see animation play out in slow motion~ +- Inside source: true +*** True Line Result + # uncomment the line below to see animation play out in slow motion +** Processing line: ~ # args.gtk.slowmo! 6~ +- Inside source: true +*** True Line Result + # args.gtk.slowmo! 6 ** Processing line: ~ looping_animation args~ - Inside source: true *** True Line Result @@ -19904,10 +17555,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Now that we have `sprite_index, we can present the correct file. -** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 100, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" }~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 100, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -19916,10 +17567,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Try changing the numbers below to see how the animation changes: -** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 200, w: 100, h: 100, path: "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png" }~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] + args.outputs.sprites << { x: 100, y: 200, w: 100, h: 100, path: "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png" } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19944,10 +17595,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # This is just a label the shows instructions within the game. -** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ +** Processing line: ~ args.outputs.labels << { x: 220, y: 350, text: "(press f to animate)" }~ - Inside source: true *** True Line Result - args.outputs.labels << [220, 350, "(press f to animate)"] + args.outputs.labels << { x: 220, y: 350, text: "(press f to animate)" } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -19964,10 +17615,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Print the frame that "f" was pressed on. -** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ +** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.state.tick_count}"~ - Inside source: true *** True Line Result - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.state.tick_count}" ** Processing line: ~~ - Inside source: true *** True Line Result @@ -20096,10 +17747,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Present the sprite. -** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 300, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" }~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + args.outputs.sprites << { x: 100, y: 300, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -28104,18 +25755,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if state.mouse_held -** Processing line: ~ outputs.primitives << mouse_overlay.border~ +** Processing line: ~ outputs.primitives << mouse_overlay.border!~ - Inside source: true *** True Line Result - outputs.primitives << mouse_overlay.border + outputs.primitives << mouse_overlay.border! ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ outputs.primitives << mouse_overlay.solid~ +** Processing line: ~ outputs.primitives << mouse_overlay.solid!~ - Inside source: true *** True Line Result - outputs.primitives << mouse_overlay.solid + outputs.primitives << mouse_overlay.solid! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28368,10 +26019,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless player.dy <= 0 -** Processing line: ~ tiles_below = find_tiles { |t| t.rect.top <= player.y }~ +** Processing line: ~ tiles_below = find_tiles { |t| t.rect.top <= player.prev_rect.y }~ - Inside source: true *** True Line Result - tiles_below = find_tiles { |t| t.rect.top <= player.y } + tiles_below = find_tiles { |t| t.rect.top <= player.prev_rect.y } ** Processing line: ~ collision = find_colliding_tile tiles_below, (player.rect.merge y: player.next_rect.y)~ - Inside source: true *** True Line Result @@ -28492,10 +26143,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless player.dy > 0 -** Processing line: ~ tiles_above = find_tiles { |t| t.rect.y >= player.y }~ +** Processing line: ~ tiles_above = find_tiles { |t| t.rect.y >= player.prev_rect.y }~ - Inside source: true *** True Line Result - tiles_above = find_tiles { |t| t.rect.y >= player.y } + tiles_above = find_tiles { |t| t.rect.y >= player.prev_rect.y } ** Processing line: ~ collision = find_colliding_tile tiles_above, (player.rect.merge y: player.next_rect.y)~ - Inside source: true *** True Line Result @@ -28528,18 +26179,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def calc_player_dx -** Processing line: ~ player.y += player.dy~ +** Processing line: ~ player.dx = player.dx.clamp(-5, 5)~ - Inside source: true *** True Line Result - player.y += player.dy -** Processing line: ~ player.dy += state.gravity~ + player.dx = player.dx.clamp(-5, 5) +** Processing line: ~ player.dx *= 0.9~ - Inside source: true *** True Line Result - player.dy += state.gravity -** Processing line: ~ player.dy += player.dy * state.drag ** 2 * -1~ + player.dx *= 0.9 +** Processing line: ~ player.x += player.dx~ - Inside source: true *** True Line Result - player.dy += player.dy * state.drag ** 2 * -1 + player.x += player.dx ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28552,18 +26203,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def calc_player_dy -** Processing line: ~ player.dx = player.dx.clamp(-5, 5)~ +** Processing line: ~ player.y += player.dy~ - Inside source: true *** True Line Result - player.dx = player.dx.clamp(-5, 5) -** Processing line: ~ player.dx *= 0.9~ + player.y += player.dy +** Processing line: ~ player.dy += state.gravity~ - Inside source: true *** True Line Result - player.dx *= 0.9 -** Processing line: ~ player.x += player.dx~ + player.dy += state.gravity +** Processing line: ~ player.dy += player.dy * state.drag ** 2 * -1~ - Inside source: true *** True Line Result - player.x += player.dx + player.dy += player.dy * state.drag ** 2 * -1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -29148,14 +26799,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values~ -- Inside source: true -*** True Line Result - # Sets default values -** Processing line: ~ def defaults~ +** Processing line: ~ def init_game~ - Inside source: true *** True Line Result - def defaults + def init_game ** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ - Inside source: true *** True Line Result @@ -29244,6 +26891,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ # Sets default values~ +- Inside source: true +*** True Line Result + # Sets default values +** Processing line: ~ def defaults~ +- Inside source: true +*** True Line Result + def defaults +** Processing line: ~ init_game~ +- Inside source: true +*** True Line Result + init_game +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # Outputs objects onto the screen~ - Inside source: true *** True Line Result @@ -29592,10 +27259,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else +** Processing line: ~ # game over~ +- Inside source: true +*** True Line Result + # game over ** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ - Inside source: true *** True Line Result s.as_hash.clear # otherwise clear the hash (no new platform is necessary) +** Processing line: ~ init_game~ +- Inside source: true +*** True Line Result + init_game ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40480,14 +38155,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def tick -** Processing line: ~ state.current_turn ||= :x~ -- Inside source: true -*** True Line Result - state.current_turn ||= :x -** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ +** Processing line: ~ init_new_game~ - Inside source: true *** True Line Result - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + init_new_game ** Processing line: ~ render_board~ - Inside source: true *** True Line Result @@ -40504,6 +38175,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def init_new_game~ +- Inside source: true +*** True Line Result + def init_new_game +** Processing line: ~ state.current_turn ||= :x~ +- Inside source: true +*** True Line Result + state.current_turn ||= :x +** Processing line: ~ state.space_combinations ||= [-1, 0, 1].product([-1, 0, 1]).to_a~ +- Inside source: true +*** True Line Result + state.space_combinations ||= [-1, 0, 1].product([-1, 0, 1]).to_a +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.spaces ||= {}~ +- Inside source: true +*** True Line Result + state.spaces ||= {} +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.space_combinations.each do |x, y|~ +- Inside source: true +*** True Line Result + state.space_combinations.each do |x, y| +** Processing line: ~ state.spaces[x] ||= {}~ +- Inside source: true +*** True Line Result + state.spaces[x] ||= {} +** Processing line: ~ state.spaces[x][y] ||= state.new_entity(:space)~ +- Inside source: true +*** True Line Result + state.spaces[x][y] ||= state.new_entity(:space) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ - Inside source: true *** True Line Result @@ -40804,6 +38523,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result gtk.reset +** Processing line: ~ init_new_game~ +- Inside source: true +*** True Line Result + init_new_game ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -42072,10 +39795,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Find all zombies that intersect with the player. They are considered killed. -** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ +** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite && (z.sprite.intersect_rect? state.player_sprite) }~ - Inside source: true *** True Line Result - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + killed_this_frame = state.zombies.find_all { |z| z.sprite && (z.sprite.intersect_rect? state.player_sprite) } ** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ - Inside source: true *** True Line Result @@ -45396,6 +43119,4506 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Audio - Audio Mixer - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Audio - Audio Mixer - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_audio/01_audio_mixer/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_audio/01_audio_mixer/app/main.rb +** Processing line: ~ # these are the properties that you can sent on args.audio~ +- Inside source: true +*** True Line Result + # these are the properties that you can sent on args.audio +** Processing line: ~ def spawn_new_sound args, name, path~ +- Inside source: true +*** True Line Result + def spawn_new_sound args, name, path +** Processing line: ~ # Spawn randomly in an area that won't be covered by UI.~ +- Inside source: true +*** True Line Result + # Spawn randomly in an area that won't be covered by UI. +** Processing line: ~ screenx = (rand * 600.0) + 200.0~ +- Inside source: true +*** True Line Result + screenx = (rand * 600.0) + 200.0 +** Processing line: ~ screeny = (rand * 400.0) + 100.0~ +- Inside source: true +*** True Line Result + screeny = (rand * 400.0) + 100.0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ id = new_sound_id! args~ +- Inside source: true +*** True Line Result + id = new_sound_id! args +** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ +- Inside source: true +*** True Line Result + # you can hang anything on the audio hashes you want, so we store the +** Processing line: ~ # actual screen position in here for convenience.~ +- Inside source: true +*** True Line Result + # actual screen position in here for convenience. +** Processing line: ~ args.audio[id] = {~ +- Inside source: true +*** True Line Result + args.audio[id] = { +** Processing line: ~ name: name,~ +- Inside source: true +*** True Line Result + name: name, +** Processing line: ~ input: path,~ +- Inside source: true +*** True Line Result + input: path, +** Processing line: ~ screenx: screenx,~ +- Inside source: true +*** True Line Result + screenx: screenx, +** Processing line: ~ screeny: screeny,~ +- Inside source: true +*** True Line Result + screeny: screeny, +** Processing line: ~ x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ +- Inside source: true +*** True Line Result + x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range +** Processing line: ~ y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ +- Inside source: true +*** True Line Result + y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range +** Processing line: ~ z: 0.0,~ +- Inside source: true +*** True Line Result + z: 0.0, +** Processing line: ~ gain: 1.0,~ +- Inside source: true +*** True Line Result + gain: 1.0, +** Processing line: ~ pitch: 1.0,~ +- Inside source: true +*** True Line Result + pitch: 1.0, +** Processing line: ~ looping: true,~ +- Inside source: true +*** True Line Result + looping: true, +** Processing line: ~ paused: false~ +- Inside source: true +*** True Line Result + paused: false +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.selected = id~ +- Inside source: true +*** True Line Result + args.state.selected = id +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # these are values you can change on the ~args.audio~ data structure~ +- Inside source: true +*** True Line Result + # these are values you can change on the ~args.audio~ data structure +** Processing line: ~ def input_panel args~ +- Inside source: true +*** True Line Result + def input_panel args +** Processing line: ~ return unless args.state.panel~ +- Inside source: true +*** True Line Result + return unless args.state.panel +** Processing line: ~ return if args.state.dragging~ +- Inside source: true +*** True Line Result + return if args.state.dragging +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_entry = args.audio[args.state.selected]~ +- Inside source: true +*** True Line Result + audio_entry = args.audio[args.state.selected] +** Processing line: ~ results = args.state.panel~ +- Inside source: true +*** True Line Result + results = args.state.panel +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.pitch_slider_rect.rect)~ +- Inside source: true +*** True Line Result + if args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.pitch_slider_rect.rect) +** Processing line: ~ audio_entry.pitch = 2.0 * ((args.inputs.mouse.x - results.pitch_slider_rect.x).to_f / (results.pitch_slider_rect.w - 1.0))~ +- Inside source: true +*** True Line Result + audio_entry.pitch = 2.0 * ((args.inputs.mouse.x - results.pitch_slider_rect.x).to_f / (results.pitch_slider_rect.w - 1.0)) +** Processing line: ~ elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.playtime_slider_rect.rect)~ +- Inside source: true +*** True Line Result + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.playtime_slider_rect.rect) +** Processing line: ~ audio_entry.playtime = audio_entry.length_ * ((args.inputs.mouse.x - results.playtime_slider_rect.x).to_f / (results.playtime_slider_rect.w - 1.0))~ +- Inside source: true +*** True Line Result + audio_entry.playtime = audio_entry.length_ * ((args.inputs.mouse.x - results.playtime_slider_rect.x).to_f / (results.playtime_slider_rect.w - 1.0)) +** Processing line: ~ elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.gain_slider_rect.rect)~ +- Inside source: true +*** True Line Result + elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.gain_slider_rect.rect) +** Processing line: ~ audio_entry.gain = (args.inputs.mouse.x - results.gain_slider_rect.x).to_f / (results.gain_slider_rect.w - 1.0)~ +- Inside source: true +*** True Line Result + audio_entry.gain = (args.inputs.mouse.x - results.gain_slider_rect.x).to_f / (results.gain_slider_rect.w - 1.0) +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.looping_checkbox_rect.rect)~ +- Inside source: true +*** True Line Result + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.looping_checkbox_rect.rect) +** Processing line: ~ audio_entry.looping = !audio_entry.looping~ +- Inside source: true +*** True Line Result + audio_entry.looping = !audio_entry.looping +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.paused_checkbox_rect.rect)~ +- Inside source: true +*** True Line Result + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.paused_checkbox_rect.rect) +** Processing line: ~ audio_entry.paused = !audio_entry.paused~ +- Inside source: true +*** True Line Result + audio_entry.paused = !audio_entry.paused +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.delete_button_rect.rect)~ +- Inside source: true +*** True Line Result + elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.delete_button_rect.rect) +** Processing line: ~ args.audio.delete args.state.selected~ +- Inside source: true +*** True Line Result + args.audio.delete args.state.selected +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_sources args~ +- Inside source: true +*** True Line Result + def render_sources args +** Processing line: ~ args.outputs.primitives << args.audio.keys.map do |k|~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.audio.keys.map do |k| +** Processing line: ~ s = args.audio[k]~ +- Inside source: true +*** True Line Result + s = args.audio[k] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ isselected = (k == args.state.selected)~ +- Inside source: true +*** True Line Result + isselected = (k == args.state.selected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ]~ +- Inside source: true +*** True Line Result + color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ] +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ [s.screenx, s.screeny, args.state.boxsize, args.state.boxsize, *color].solid,~ +- Inside source: true +*** True Line Result + [s.screenx, s.screeny, args.state.boxsize, args.state.boxsize, *color].solid, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: s.screenx + args.state.boxsize.half,~ +- Inside source: true +*** True Line Result + x: s.screenx + args.state.boxsize.half, +** Processing line: ~ y: s.screeny,~ +- Inside source: true +*** True Line Result + y: s.screeny, +** Processing line: ~ text: s.name,~ +- Inside source: true +*** True Line Result + text: s.name, +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ alignment_enum: 1~ +- Inside source: true +*** True Line Result + alignment_enum: 1 +** Processing line: ~ }.label!~ +- Inside source: true +*** True Line Result + }.label! +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def playtime_str t~ +- Inside source: true +*** True Line Result + def playtime_str t +** Processing line: ~ return "" unless t~ +- Inside source: true +*** True Line Result + return "" unless t +** Processing line: ~ minutes = (t / 60.0).floor~ +- Inside source: true +*** True Line Result + minutes = (t / 60.0).floor +** Processing line: ~ seconds = t - (minutes * 60.0).to_f~ +- Inside source: true +*** True Line Result + seconds = t - (minutes * 60.0).to_f +** Processing line: ~ return minutes.to_s + ':' + seconds.floor.to_s + ((seconds - seconds.floor).to_s + "000")[1..3]~ +- Inside source: true +*** True Line Result + return minutes.to_s + ':' + seconds.floor.to_s + ((seconds - seconds.floor).to_s + "000")[1..3] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def label_with_drop_shadow x, y, text~ +- Inside source: true +*** True Line Result + def label_with_drop_shadow x, y, text +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ { x: x + 1, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!,~ +- Inside source: true +*** True Line Result + { x: x + 1, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, +** Processing line: ~ { x: x + 2, y: y + 0, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!,~ +- Inside source: true +*** True Line Result + { x: x + 2, y: y + 0, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!, +** Processing line: ~ { x: x + 0, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 200, g: 200, b: 200 }.label!~ +- Inside source: true +*** True Line Result + { x: x + 0, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 200, g: 200, b: 200 }.label! +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def check_box opts = {}~ +- Inside source: true +*** True Line Result + def check_box opts = {} +** Processing line: ~ checkbox_template = opts.args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +- Inside source: true +*** True Line Result + checkbox_template = opts.args.layout.rect(w: 0.5, h: 0.5, col: 2) +** Processing line: ~ final_rect = checkbox_template.center_inside_rect_y(opts.args.layout.rect(row: opts.row, col: opts.col))~ +- Inside source: true +*** True Line Result + final_rect = checkbox_template.center_inside_rect_y(opts.args.layout.rect(row: opts.row, col: opts.col)) +** Processing line: ~ color = { r: 0, g: 0, b: 0 }~ +- Inside source: true +*** True Line Result + color = { r: 0, g: 0, b: 0 } +** Processing line: ~ color = { r: 255, g: 255, b: 255 } if opts.checked~ +- Inside source: true +*** True Line Result + color = { r: 255, g: 255, b: 255 } if opts.checked +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ rect: final_rect,~ +- Inside source: true +*** True Line Result + rect: final_rect, +** Processing line: ~ primitives: [~ +- Inside source: true +*** True Line Result + primitives: [ +** Processing line: ~ (final_rect.to_solid color)~ +- Inside source: true +*** True Line Result + (final_rect.to_solid color) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def progress_bar opts = {}~ +- Inside source: true +*** True Line Result + def progress_bar opts = {} +** Processing line: ~ outer_rect = opts.args.layout.rect(row: opts.row, col: opts.col, w: 5, h: 1)~ +- Inside source: true +*** True Line Result + outer_rect = opts.args.layout.rect(row: opts.row, col: opts.col, w: 5, h: 1) +** Processing line: ~ color = opts.percentage * 255~ +- Inside source: true +*** True Line Result + color = opts.percentage * 255 +** Processing line: ~ baseline_progress_bar = opts.args~ +- Inside source: true +*** True Line Result + baseline_progress_bar = opts.args +** Processing line: ~ .layout~ +- Inside source: true +*** True Line Result + .layout +** Processing line: ~ .rect(w: 5, h: 0.5)~ +- Inside source: true +*** True Line Result + .rect(w: 5, h: 0.5) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ final_rect = baseline_progress_bar.center_inside_rect(outer_rect)~ +- Inside source: true +*** True Line Result + final_rect = baseline_progress_bar.center_inside_rect(outer_rect) +** Processing line: ~ center = final_rect.rect_center_point~ +- Inside source: true +*** True Line Result + center = final_rect.rect_center_point +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ rect: final_rect,~ +- Inside source: true +*** True Line Result + rect: final_rect, +** Processing line: ~ primitives: [~ +- Inside source: true +*** True Line Result + primitives: [ +** Processing line: ~ final_rect.merge(r: color, g: color, b: color, a: 128).solid!,~ +- Inside source: true +*** True Line Result + final_rect.merge(r: color, g: color, b: color, a: 128).solid!, +** Processing line: ~ label_with_drop_shadow(center.x, center.y, opts.text)~ +- Inside source: true +*** True Line Result + label_with_drop_shadow(center.x, center.y, opts.text) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def panel_primitives args, audio_entry~ +- Inside source: true +*** True Line Result + def panel_primitives args, audio_entry +** Processing line: ~ results = { primitives: [] }~ +- Inside source: true +*** True Line Result + results = { primitives: [] } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return results unless audio_entry~ +- Inside source: true +*** True Line Result + return results unless audio_entry +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # this uses DRGTK's layout apis to layout the controls~ +- Inside source: true +*** True Line Result + # this uses DRGTK's layout apis to layout the controls +** Processing line: ~ # imagine the screen is split into equal cells (24 cells across, 12 cells up and down)~ +- Inside source: true +*** True Line Result + # imagine the screen is split into equal cells (24 cells across, 12 cells up and down) +** Processing line: ~ # args.layout.rect returns a hash which we merge values with to create primitives~ +- Inside source: true +*** True Line Result + # args.layout.rect returns a hash which we merge values with to create primitives +** Processing line: ~ # using args.layout.rect removes the need for pixel pushing~ +- Inside source: true +*** True Line Result + # using args.layout.rect removes the need for pixel pushing +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # args.outputs.debug << args.layout.debug_primitives(r: 255, g: 255, b: 255)~ +- Inside source: true +*** True Line Result + # args.outputs.debug << args.layout.debug_primitives(r: 255, g: 255, b: 255) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ white_color = { r: 255, g: 255, b: 255 }~ +- Inside source: true +*** True Line Result + white_color = { r: 255, g: 255, b: 255 } +** Processing line: ~ label_style = white_color.merge(vertical_alignment_enum: 1)~ +- Inside source: true +*** True Line Result + label_style = white_color.merge(vertical_alignment_enum: 1) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # panel background~ +- Inside source: true +*** True Line Result + # panel background +** Processing line: ~ results.primitives << args.layout.rect(row: 0, col: 0, w: 7, h: 6, include_col_gutter: true, include_row_gutter: true)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.rect(row: 0, col: 0, w: 7, h: 6, include_col_gutter: true, include_row_gutter: true) +** Processing line: ~ .border!(r: 255, g: 255, b: 255)~ +- Inside source: true +*** True Line Result + .border!(r: 255, g: 255, b: 255) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # title~ +- Inside source: true +*** True Line Result + # title +** Processing line: ~ results.primitives << args.layout.point(row: 0, col: 3.5, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 0, col: 3.5, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "Source #{args.state.selected} (#{args.audio[args.state.selected].name})",~ +- Inside source: true +*** True Line Result + .merge(text: "Source #{args.state.selected} (#{args.audio[args.state.selected].name})", +** Processing line: ~ size_enum: 3,~ +- Inside source: true +*** True Line Result + size_enum: 3, +** Processing line: ~ alignment_enum: 1)~ +- Inside source: true +*** True Line Result + alignment_enum: 1) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # seperator line~ +- Inside source: true +*** True Line Result + # seperator line +** Processing line: ~ results.primitives << args.layout.rect(row: 1, col: 0, w: 7, h: 0)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.rect(row: 1, col: 0, w: 7, h: 0) +** Processing line: ~ .line!(white_color)~ +- Inside source: true +*** True Line Result + .line!(white_color) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # screen location~ +- Inside source: true +*** True Line Result + # screen location +** Processing line: ~ results.primitives << args.layout.point(row: 1.0, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 1.0, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "screen:")~ +- Inside source: true +*** True Line Result + .merge(text: "screen:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 1.0, col: 2, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 1.0, col: 2, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "(#{audio_entry.screenx.to_i}, #{audio_entry.screeny.to_i})")~ +- Inside source: true +*** True Line Result + .merge(text: "(#{audio_entry.screenx.to_i}, #{audio_entry.screeny.to_i})") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # position~ +- Inside source: true +*** True Line Result + # position +** Processing line: ~ results.primitives << args.layout.point(row: 1.5, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 1.5, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "position:")~ +- Inside source: true +*** True Line Result + .merge(text: "position:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 1.5, col: 2, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 1.5, col: 2, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "(#{audio_entry[:x].round(5).to_s[0..6]}, #{audio_entry[:y].round(5).to_s[0..6]})")~ +- Inside source: true +*** True Line Result + .merge(text: "(#{audio_entry[:x].round(5).to_s[0..6]}, #{audio_entry[:y].round(5).to_s[0..6]})") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 2.0, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 2.0, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "pitch:")~ +- Inside source: true +*** True Line Result + .merge(text: "pitch:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.pitch_slider_rect = progress_bar(row: 2.0, col: 2,~ +- Inside source: true +*** True Line Result + results.pitch_slider_rect = progress_bar(row: 2.0, col: 2, +** Processing line: ~ percentage: audio_entry.pitch / 2.0,~ +- Inside source: true +*** True Line Result + percentage: audio_entry.pitch / 2.0, +** Processing line: ~ text: "#{audio_entry.pitch.to_sf}",~ +- Inside source: true +*** True Line Result + text: "#{audio_entry.pitch.to_sf}", +** Processing line: ~ args: args)~ +- Inside source: true +*** True Line Result + args: args) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << results.pitch_slider_rect.primitives~ +- Inside source: true +*** True Line Result + results.primitives << results.pitch_slider_rect.primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 2.5, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 2.5, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "playtime:")~ +- Inside source: true +*** True Line Result + .merge(text: "playtime:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.playtime_slider_rect = progress_bar(args: args,~ +- Inside source: true +*** True Line Result + results.playtime_slider_rect = progress_bar(args: args, +** Processing line: ~ row: 2.5,~ +- Inside source: true +*** True Line Result + row: 2.5, +** Processing line: ~ col: 2,~ +- Inside source: true +*** True Line Result + col: 2, +** Processing line: ~ percentage: (audio_entry.playtime || 1) / (audio_entry.length_ || 1),~ +- Inside source: true +*** True Line Result + percentage: (audio_entry.playtime || 1) / (audio_entry.length_ || 1), +** Processing line: ~ text: "#{playtime_str(audio_entry.playtime)} / #{playtime_str(audio_entry.length_)}")~ +- Inside source: true +*** True Line Result + text: "#{playtime_str(audio_entry.playtime)} / #{playtime_str(audio_entry.length_)}") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << results.playtime_slider_rect.primitives~ +- Inside source: true +*** True Line Result + results.primitives << results.playtime_slider_rect.primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 3.0, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 3.0, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "gain:")~ +- Inside source: true +*** True Line Result + .merge(text: "gain:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.gain_slider_rect = progress_bar(args: args,~ +- Inside source: true +*** True Line Result + results.gain_slider_rect = progress_bar(args: args, +** Processing line: ~ row: 3.0,~ +- Inside source: true +*** True Line Result + row: 3.0, +** Processing line: ~ col: 2,~ +- Inside source: true +*** True Line Result + col: 2, +** Processing line: ~ percentage: audio_entry.gain,~ +- Inside source: true +*** True Line Result + percentage: audio_entry.gain, +** Processing line: ~ text: "#{audio_entry.gain.to_sf}")~ +- Inside source: true +*** True Line Result + text: "#{audio_entry.gain.to_sf}") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << results.gain_slider_rect.primitives~ +- Inside source: true +*** True Line Result + results.primitives << results.gain_slider_rect.primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 3.5, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 3.5, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "looping:")~ +- Inside source: true +*** True Line Result + .merge(text: "looping:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +- Inside source: true +*** True Line Result + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.looping_checkbox_rect = check_box(args: args, row: 3.5, col: 2, checked: audio_entry.looping)~ +- Inside source: true +*** True Line Result + results.looping_checkbox_rect = check_box(args: args, row: 3.5, col: 2, checked: audio_entry.looping) +** Processing line: ~ results.primitives << results.looping_checkbox_rect.primitives~ +- Inside source: true +*** True Line Result + results.primitives << results.looping_checkbox_rect.primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 4.0, col: 0, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 4.0, col: 0, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "paused:")~ +- Inside source: true +*** True Line Result + .merge(text: "paused:") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +- Inside source: true +*** True Line Result + checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.paused_checkbox_rect = check_box(args: args, row: 4.0, col: 2, checked: !audio_entry.paused)~ +- Inside source: true +*** True Line Result + results.paused_checkbox_rect = check_box(args: args, row: 4.0, col: 2, checked: !audio_entry.paused) +** Processing line: ~ results.primitives << results.paused_checkbox_rect.primitives~ +- Inside source: true +*** True Line Result + results.primitives << results.paused_checkbox_rect.primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.delete_button_rect = { rect: args.layout.rect(row: 5, col: 0, w: 7, h: 1) }~ +- Inside source: true +*** True Line Result + results.delete_button_rect = { rect: args.layout.rect(row: 5, col: 0, w: 7, h: 1) } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << results.delete_button_rect.to_solid(r: 180)~ +- Inside source: true +*** True Line Result + results.primitives << results.delete_button_rect.to_solid(r: 180) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ results.primitives << args.layout.point(row: 5, col: 3.5, row_anchor: 0.5)~ +- Inside source: true +*** True Line Result + results.primitives << args.layout.point(row: 5, col: 3.5, row_anchor: 0.5) +** Processing line: ~ .merge(label_style)~ +- Inside source: true +*** True Line Result + .merge(label_style) +** Processing line: ~ .merge(text: "DELETE", alignment_enum: 1)~ +- Inside source: true +*** True Line Result + .merge(text: "DELETE", alignment_enum: 1) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return results~ +- Inside source: true +*** True Line Result + return results +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_panel args~ +- Inside source: true +*** True Line Result + def render_panel args +** Processing line: ~ args.state.panel = nil~ +- Inside source: true +*** True Line Result + args.state.panel = nil +** Processing line: ~ audio_entry = args.audio[args.state.selected]~ +- Inside source: true +*** True Line Result + audio_entry = args.audio[args.state.selected] +** Processing line: ~ return unless audio_entry~ +- Inside source: true +*** True Line Result + return unless audio_entry +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ mouse_down = (args.state.mouse_held >= 0)~ +- Inside source: true +*** True Line Result + mouse_down = (args.state.mouse_held >= 0) +** Processing line: ~ args.state.panel = panel_primitives args, audio_entry~ +- Inside source: true +*** True Line Result + args.state.panel = panel_primitives args, audio_entry +** Processing line: ~ args.outputs.primitives << args.state.panel.primitives~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.state.panel.primitives +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_sound_id! args~ +- Inside source: true +*** True Line Result + def new_sound_id! args +** Processing line: ~ args.state.sound_id ||= 0~ +- Inside source: true +*** True Line Result + args.state.sound_id ||= 0 +** Processing line: ~ args.state.sound_id += 1~ +- Inside source: true +*** True Line Result + args.state.sound_id += 1 +** Processing line: ~ args.state.sound_id~ +- Inside source: true +*** True Line Result + args.state.sound_id +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_launcher args~ +- Inside source: true +*** True Line Result + def render_launcher args +** Processing line: ~ args.outputs.primitives << args.state.spawn_sound_buttons.map(&:primitives)~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.state.spawn_sound_buttons.map(&:primitives) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_ui args~ +- Inside source: true +*** True Line Result + def render_ui args +** Processing line: ~ render_launcher args~ +- Inside source: true +*** True Line Result + render_launcher args +** Processing line: ~ render_panel args~ +- Inside source: true +*** True Line Result + render_panel args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ defaults args~ +- Inside source: true +*** True Line Result + defaults args +** Processing line: ~ render args~ +- Inside source: true +*** True Line Result + render args +** Processing line: ~ input args~ +- Inside source: true +*** True Line Result + input args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input args~ +- Inside source: true +*** True Line Result + def input args +** Processing line: ~ if !args.audio[args.state.selected]~ +- Inside source: true +*** True Line Result + if !args.audio[args.state.selected] +** Processing line: ~ args.state.selected = nil~ +- Inside source: true +*** True Line Result + args.state.selected = nil +** Processing line: ~ args.state.dragging = nil~ +- Inside source: true +*** True Line Result + args.state.dragging = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # spawn button and node interaction~ +- Inside source: true +*** True Line Result + # spawn button and node interaction +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ spawn_sound_button = args.state.spawn_sound_buttons.find { |b| args.inputs.mouse.inside_rect? b.rect }~ +- Inside source: true +*** True Line Result + spawn_sound_button = args.state.spawn_sound_buttons.find { |b| args.inputs.mouse.inside_rect? b.rect } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_click_key, audio_click_value = args.audio.find do |k, v|~ +- Inside source: true +*** True Line Result + audio_click_key, audio_click_value = args.audio.find do |k, v| +** Processing line: ~ args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize]~ +- Inside source: true +*** True Line Result + args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if spawn_sound_button~ +- Inside source: true +*** True Line Result + if spawn_sound_button +** Processing line: ~ args.state.selected = nil~ +- Inside source: true +*** True Line Result + args.state.selected = nil +** Processing line: ~ spawn_new_sound args, spawn_sound_button.name, spawn_sound_button.path~ +- Inside source: true +*** True Line Result + spawn_new_sound args, spawn_sound_button.name, spawn_sound_button.path +** Processing line: ~ elsif audio_click_key~ +- Inside source: true +*** True Line Result + elsif audio_click_key +** Processing line: ~ args.state.selected = audio_click_key~ +- Inside source: true +*** True Line Result + args.state.selected = audio_click_key +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.mouse_state == :held && args.state.selected~ +- Inside source: true +*** True Line Result + if args.state.mouse_state == :held && args.state.selected +** Processing line: ~ v = args.audio[args.state.selected]~ +- Inside source: true +*** True Line Result + v = args.audio[args.state.selected] +** Processing line: ~ if args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize]~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize] +** Processing line: ~ args.state.dragging = args.state.selected~ +- Inside source: true +*** True Line Result + args.state.dragging = args.state.selected +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.dragging~ +- Inside source: true +*** True Line Result + if args.state.dragging +** Processing line: ~ s = args.audio[args.state.selected]~ +- Inside source: true +*** True Line Result + s = args.audio[args.state.selected] +** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ +- Inside source: true +*** True Line Result + # you can hang anything on the audio hashes you want, so we store the +** Processing line: ~ # actual screen position so it doesn't scale weirdly vs your mouse.~ +- Inside source: true +*** True Line Result + # actual screen position so it doesn't scale weirdly vs your mouse. +** Processing line: ~ s.screenx = args.inputs.mouse.x - (args.state.boxsize / 2)~ +- Inside source: true +*** True Line Result + s.screenx = args.inputs.mouse.x - (args.state.boxsize / 2) +** Processing line: ~ s.screeny = args.inputs.mouse.y - (args.state.boxsize / 2)~ +- Inside source: true +*** True Line Result + s.screeny = args.inputs.mouse.y - (args.state.boxsize / 2) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ s.screeny = 50 if s.screeny < 50~ +- Inside source: true +*** True Line Result + s.screeny = 50 if s.screeny < 50 +** Processing line: ~ s.screeny = (719 - args.state.boxsize) if s.screeny > (719 - args.state.boxsize)~ +- Inside source: true +*** True Line Result + s.screeny = (719 - args.state.boxsize) if s.screeny > (719 - args.state.boxsize) +** Processing line: ~ s.screenx = 0 if s.screenx < 0~ +- Inside source: true +*** True Line Result + s.screenx = 0 if s.screenx < 0 +** Processing line: ~ s.screenx = (1279 - args.state.boxsize) if s.screenx > (1279 - args.state.boxsize)~ +- Inside source: true +*** True Line Result + s.screenx = (1279 - args.state.boxsize) if s.screenx > (1279 - args.state.boxsize) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ s.x = ((s.screenx / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ +- Inside source: true +*** True Line Result + s.x = ((s.screenx / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range +** Processing line: ~ s.y = ((s.screeny / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ +- Inside source: true +*** True Line Result + s.y = ((s.screeny / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ elsif args.state.mouse_state == :released~ +- Inside source: true +*** True Line Result + elsif args.state.mouse_state == :released +** Processing line: ~ args.state.dragging = nil~ +- Inside source: true +*** True Line Result + args.state.dragging = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ input_panel args~ +- Inside source: true +*** True Line Result + input_panel args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults args~ +- Inside source: true +*** True Line Result + def defaults args +** Processing line: ~ args.state.mouse_state ||= :released~ +- Inside source: true +*** True Line Result + args.state.mouse_state ||= :released +** Processing line: ~ args.state.dragging_source ||= false~ +- Inside source: true +*** True Line Result + args.state.dragging_source ||= false +** Processing line: ~ args.state.selected ||= 0~ +- Inside source: true +*** True Line Result + args.state.selected ||= 0 +** Processing line: ~ args.state.next_sound_index ||= 0~ +- Inside source: true +*** True Line Result + args.state.next_sound_index ||= 0 +** Processing line: ~ args.state.boxsize ||= 30~ +- Inside source: true +*** True Line Result + args.state.boxsize ||= 30 +** Processing line: ~ args.state.sound_files ||= [~ +- Inside source: true +*** True Line Result + args.state.sound_files ||= [ +** Processing line: ~ { name: :tada, path: "sounds/tada.wav" },~ +- Inside source: true +*** True Line Result + { name: :tada, path: "sounds/tada.wav" }, +** Processing line: ~ { name: :splash, path: "sounds/splash.wav" },~ +- Inside source: true +*** True Line Result + { name: :splash, path: "sounds/splash.wav" }, +** Processing line: ~ { name: :drum, path: "sounds/drum.mp3" },~ +- Inside source: true +*** True Line Result + { name: :drum, path: "sounds/drum.mp3" }, +** Processing line: ~ { name: :spring, path: "sounds/spring.wav" },~ +- Inside source: true +*** True Line Result + { name: :spring, path: "sounds/spring.wav" }, +** Processing line: ~ { name: :music, path: "sounds/music.ogg" }~ +- Inside source: true +*** True Line Result + { name: :music, path: "sounds/music.ogg" } +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # generate buttons based off the sound collection above~ +- Inside source: true +*** True Line Result + # generate buttons based off the sound collection above +** Processing line: ~ args.state.spawn_sound_buttons ||= begin~ +- Inside source: true +*** True Line Result + args.state.spawn_sound_buttons ||= begin +** Processing line: ~ # create a group of buttons~ +- Inside source: true +*** True Line Result + # create a group of buttons +** Processing line: ~ # column centered (using col_offset to calculate the column offset)~ +- Inside source: true +*** True Line Result + # column centered (using col_offset to calculate the column offset) +** Processing line: ~ # where each item is 2 columns apart~ +- Inside source: true +*** True Line Result + # where each item is 2 columns apart +** Processing line: ~ rects = args.layout.rect_group row: 11,~ +- Inside source: true +*** True Line Result + rects = args.layout.rect_group row: 11, +** Processing line: ~ col_offset: {~ +- Inside source: true +*** True Line Result + col_offset: { +** Processing line: ~ count: args.state.sound_files.length,~ +- Inside source: true +*** True Line Result + count: args.state.sound_files.length, +** Processing line: ~ w: 2~ +- Inside source: true +*** True Line Result + w: 2 +** Processing line: ~ },~ +- Inside source: true +*** True Line Result + }, +** Processing line: ~ dcol: 2,~ +- Inside source: true +*** True Line Result + dcol: 2, +** Processing line: ~ w: 2,~ +- Inside source: true +*** True Line Result + w: 2, +** Processing line: ~ h: 1,~ +- Inside source: true +*** True Line Result + h: 1, +** Processing line: ~ group: args.state.sound_files~ +- Inside source: true +*** True Line Result + group: args.state.sound_files +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # now that you have the rects~ +- Inside source: true +*** True Line Result + # now that you have the rects +** Processing line: ~ # construct the metadata for the buttons~ +- Inside source: true +*** True Line Result + # construct the metadata for the buttons +** Processing line: ~ rects.map do |rect|~ +- Inside source: true +*** True Line Result + rects.map do |rect| +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ rect: rect,~ +- Inside source: true +*** True Line Result + rect: rect, +** Processing line: ~ name: rect.name,~ +- Inside source: true +*** True Line Result + name: rect.name, +** Processing line: ~ path: rect.path,~ +- Inside source: true +*** True Line Result + path: rect.path, +** Processing line: ~ primitives: [~ +- Inside source: true +*** True Line Result + primitives: [ +** Processing line: ~ rect.to_border(r: 255, g: 255, b: 255),~ +- Inside source: true +*** True Line Result + rect.to_border(r: 255, g: 255, b: 255), +** Processing line: ~ rect.to_label(x: rect.center_x,~ +- Inside source: true +*** True Line Result + rect.to_label(x: rect.center_x, +** Processing line: ~ y: rect.center_y,~ +- Inside source: true +*** True Line Result + y: rect.center_y, +** Processing line: ~ text: "#{rect.name}",~ +- Inside source: true +*** True Line Result + text: "#{rect.name}", +** Processing line: ~ alignment_enum: 1,~ +- Inside source: true +*** True Line Result + alignment_enum: 1, +** Processing line: ~ vertical_alignment_enum: 1,~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 1, +** Processing line: ~ r: 255, g: 255, b: 255)~ +- Inside source: true +*** True Line Result + r: 255, g: 255, b: 255) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.mouse.up~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.up +** Processing line: ~ args.state.mouse_state = :released~ +- Inside source: true +*** True Line Result + args.state.mouse_state = :released +** Processing line: ~ args.state.dragging_source = false~ +- Inside source: true +*** True Line Result + args.state.dragging_source = false +** Processing line: ~ elsif args.inputs.mouse.down~ +- Inside source: true +*** True Line Result + elsif args.inputs.mouse.down +** Processing line: ~ args.state.mouse_state = :held~ +- Inside source: true +*** True Line Result + args.state.mouse_state = :held +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.background_color = [ 0, 0, 0, 255 ]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [ 0, 0, 0, 255 ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render args~ +- Inside source: true +*** True Line Result + def render args +** Processing line: ~ render_ui args~ +- Inside source: true +*** True Line Result + render_ui args +** Processing line: ~ render_sources args~ +- Inside source: true +*** True Line Result + render_sources args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Advanced Audio - Audio Mixer - server_ip_address.txt~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Audio - Audio Mixer - server_ip_address.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_audio/01_audio_mixer/app/server_ip_address.txt~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_audio/01_audio_mixer/app/server_ip_address.txt +** Processing line: ~ 192.168.1.65~ +- Inside source: true +*** True Line Result + 192.168.1.65 +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Advanced Audio - Sound Synthesis - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Audio - Sound Synthesis - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_audio/02_sound_synthesis/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_audio/02_sound_synthesis/app/main.rb +** Processing line: ~ begin # region: top level tick methods~ +- Inside source: true +*** True Line Result + begin # region: top level tick methods +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ defaults args~ +- Inside source: true +*** True Line Result + defaults args +** Processing line: ~ render args~ +- Inside source: true +*** True Line Result + render args +** Processing line: ~ input args~ +- Inside source: true +*** True Line Result + input args +** Processing line: ~ process_audio_queue args~ +- Inside source: true +*** True Line Result + process_audio_queue args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults args~ +- Inside source: true +*** True Line Result + def defaults args +** Processing line: ~ args.state.sine_waves ||= {}~ +- Inside source: true +*** True Line Result + args.state.sine_waves ||= {} +** Processing line: ~ args.state.square_waves ||= {}~ +- Inside source: true +*** True Line Result + args.state.square_waves ||= {} +** Processing line: ~ args.state.saw_tooth_waves ||= {}~ +- Inside source: true +*** True Line Result + args.state.saw_tooth_waves ||= {} +** Processing line: ~ args.state.triangle_waves ||= {}~ +- Inside source: true +*** True Line Result + args.state.triangle_waves ||= {} +** Processing line: ~ args.state.audio_queue ||= []~ +- Inside source: true +*** True Line Result + args.state.audio_queue ||= [] +** Processing line: ~ args.state.buttons ||= [~ +- Inside source: true +*** True Line Result + args.state.buttons ||= [ +** Processing line: ~ (frequency_buttons args),~ +- Inside source: true +*** True Line Result + (frequency_buttons args), +** Processing line: ~ (sine_wave_note_buttons args),~ +- Inside source: true +*** True Line Result + (sine_wave_note_buttons args), +** Processing line: ~ (bell_buttons args),~ +- Inside source: true +*** True Line Result + (bell_buttons args), +** Processing line: ~ (square_wave_note_buttons args),~ +- Inside source: true +*** True Line Result + (square_wave_note_buttons args), +** Processing line: ~ (saw_tooth_wave_note_buttons args),~ +- Inside source: true +*** True Line Result + (saw_tooth_wave_note_buttons args), +** Processing line: ~ (triangle_wave_note_buttons args),~ +- Inside source: true +*** True Line Result + (triangle_wave_note_buttons args), +** Processing line: ~ ].flatten~ +- Inside source: true +*** True Line Result + ].flatten +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render args~ +- Inside source: true +*** True Line Result + def render args +** Processing line: ~ args.outputs.borders << args.state.buttons.map { |b| b[:border] }~ +- Inside source: true +*** True Line Result + args.outputs.borders << args.state.buttons.map { |b| b[:border] } +** Processing line: ~ args.outputs.labels << args.state.buttons.map { |b| b[:label] }~ +- Inside source: true +*** True Line Result + args.outputs.labels << args.state.buttons.map { |b| b[:label] } +** Processing line: ~ args.outputs.labels << args.layout~ +- Inside source: true +*** True Line Result + args.outputs.labels << args.layout +** Processing line: ~ .rect(row: 0, col: 11.5)~ +- Inside source: true +*** True Line Result + .rect(row: 0, col: 11.5) +** Processing line: ~ .yield_self { |r| r.merge y: r.y + r.h }~ +- Inside source: true +*** True Line Result + .yield_self { |r| r.merge y: r.y + r.h } +** Processing line: ~ .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.",~ +- Inside source: true +*** True Line Result + .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.", +** Processing line: ~ alignment_enum: 1)~ +- Inside source: true +*** True Line Result + alignment_enum: 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input args~ +- Inside source: true +*** True Line Result + def input args +** Processing line: ~ args.state.buttons.each do |b|~ +- Inside source: true +*** True Line Result + args.state.buttons.each do |b| +** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect])~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect]) +** Processing line: ~ parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", "~ +- Inside source: true +*** True Line Result + parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", " +** Processing line: ~ args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}"~ +- Inside source: true +*** True Line Result + args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}" +** Processing line: ~ send b[:method_to_call], args, b~ +- Inside source: true +*** True Line Result + send b[:method_to_call], args, b +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half }))~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half })) +** Processing line: ~ args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan'~ +- Inside source: true +*** True Line Result + args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def process_audio_queue args~ +- Inside source: true +*** True Line Result + def process_audio_queue args +** Processing line: ~ to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count }~ +- Inside source: true +*** True Line Result + to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count } +** Processing line: ~ args.state.audio_queue -= to_queue~ +- Inside source: true +*** True Line Result + args.state.audio_queue -= to_queue +** Processing line: ~ to_queue.each { |a| args.audio[a[:id]] = a }~ +- Inside source: true +*** True Line Result + to_queue.each { |a| args.audio[a[:id]] = a } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.audio.find_all { |k, v| v[:decay_rate] }~ +- Inside source: true +*** True Line Result + args.audio.find_all { |k, v| v[:decay_rate] } +** Processing line: ~ .each { |k, v| v[:gain] -= v[:decay_rate] }~ +- Inside source: true +*** True Line Result + .each { |k, v| v[:gain] -= v[:decay_rate] } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sounds_to_stop = args.audio~ +- Inside source: true +*** True Line Result + sounds_to_stop = args.audio +** Processing line: ~ .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] }~ +- Inside source: true +*** True Line Result + .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] } +** Processing line: ~ .map { |k, v| k }~ +- Inside source: true +*** True Line Result + .map { |k, v| k } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sounds_to_stop.each { |k| args.audio.delete k }~ +- Inside source: true +*** True Line Result + sounds_to_stop.each { |k| args.audio.delete k } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: button definitions, ui layout, callback functions~ +- Inside source: true +*** True Line Result + begin # region: button definitions, ui layout, callback functions +** Processing line: ~ def button args, opts~ +- Inside source: true +*** True Line Result + def button args, opts +** Processing line: ~ button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1))~ +- Inside source: true +*** True Line Result + button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1)) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0~ +- Inside source: true +*** True Line Result + button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ label_offset_x = 5~ +- Inside source: true +*** True Line Result + label_offset_x = 5 +** Processing line: ~ label_offset_y = 30~ +- Inside source: true +*** True Line Result + label_offset_y = 30 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ button_def[:label] = button_def[:rect].merge text: opts[:text],~ +- Inside source: true +*** True Line Result + button_def[:label] = button_def[:rect].merge text: opts[:text], +** Processing line: ~ size_enum: -2.5,~ +- Inside source: true +*** True Line Result + size_enum: -2.5, +** Processing line: ~ x: button_def[:rect].x + label_offset_x,~ +- Inside source: true +*** True Line Result + x: button_def[:rect].x + label_offset_x, +** Processing line: ~ y: button_def[:rect].y + label_offset_y~ +- Inside source: true +*** True Line Result + y: button_def[:rect].y + label_offset_y +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ button_def~ +- Inside source: true +*** True Line Result + button_def +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def play_sine_wave args, sender~ +- Inside source: true +*** True Line Result + def play_sine_wave args, sender +** Processing line: ~ queue_sine_wave args,~ +- Inside source: true +*** True Line Result + queue_sine_wave args, +** Processing line: ~ frequency: sender[:frequency],~ +- Inside source: true +*** True Line Result + frequency: sender[:frequency], +** Processing line: ~ duration: 1.seconds,~ +- Inside source: true +*** True Line Result + duration: 1.seconds, +** Processing line: ~ fade_out: true~ +- Inside source: true +*** True Line Result + fade_out: true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def play_note args, sender~ +- Inside source: true +*** True Line Result + def play_note args, sender +** Processing line: ~ method_to_call = :queue_sine_wave~ +- Inside source: true +*** True Line Result + method_to_call = :queue_sine_wave +** Processing line: ~ method_to_call = :queue_square_wave if sender[:type] == :square~ +- Inside source: true +*** True Line Result + method_to_call = :queue_square_wave if sender[:type] == :square +** Processing line: ~ method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth~ +- Inside source: true +*** True Line Result + method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth +** Processing line: ~ method_to_call = :queue_triangle_wave if sender[:type] == :triangle~ +- Inside source: true +*** True Line Result + method_to_call = :queue_triangle_wave if sender[:type] == :triangle +** Processing line: ~ method_to_call = :queue_bell if sender[:type] == :bell~ +- Inside source: true +*** True Line Result + method_to_call = :queue_bell if sender[:type] == :bell +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ send method_to_call, args,~ +- Inside source: true +*** True Line Result + send method_to_call, args, +** Processing line: ~ frequency: (frequency_for note: sender[:note], octave: sender[:octave]),~ +- Inside source: true +*** True Line Result + frequency: (frequency_for note: sender[:note], octave: sender[:octave]), +** Processing line: ~ duration: 1.seconds,~ +- Inside source: true +*** True Line Result + duration: 1.seconds, +** Processing line: ~ fade_out: true~ +- Inside source: true +*** True Line Result + fade_out: true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def frequency_buttons args~ +- Inside source: true +*** True Line Result + def frequency_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.0, col: 0, text: "300hz",~ +- Inside source: true +*** True Line Result + row: 4.0, col: 0, text: "300hz", +** Processing line: ~ frequency: 300,~ +- Inside source: true +*** True Line Result + frequency: 300, +** Processing line: ~ method_to_call: :play_sine_wave),~ +- Inside source: true +*** True Line Result + method_to_call: :play_sine_wave), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.0, col: 0, text: "400hz",~ +- Inside source: true +*** True Line Result + row: 5.0, col: 0, text: "400hz", +** Processing line: ~ frequency: 400,~ +- Inside source: true +*** True Line Result + frequency: 400, +** Processing line: ~ method_to_call: :play_sine_wave),~ +- Inside source: true +*** True Line Result + method_to_call: :play_sine_wave), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.0, col: 0, text: "500hz",~ +- Inside source: true +*** True Line Result + row: 6.0, col: 0, text: "500hz", +** Processing line: ~ frequency: 500,~ +- Inside source: true +*** True Line Result + frequency: 500, +** Processing line: ~ method_to_call: :play_sine_wave),~ +- Inside source: true +*** True Line Result + method_to_call: :play_sine_wave), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def sine_wave_note_buttons args~ +- Inside source: true +*** True Line Result + def sine_wave_note_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 1.5, col: 2, text: "Sine C4",~ +- Inside source: true +*** True Line Result + row: 1.5, col: 2, text: "Sine C4", +** Processing line: ~ note: :c, octave: 4, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 4, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 2.5, col: 2, text: "Sine D4",~ +- Inside source: true +*** True Line Result + row: 2.5, col: 2, text: "Sine D4", +** Processing line: ~ note: :d, octave: 4, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :d, octave: 4, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 3.5, col: 2, text: "Sine E4",~ +- Inside source: true +*** True Line Result + row: 3.5, col: 2, text: "Sine E4", +** Processing line: ~ note: :e, octave: 4, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :e, octave: 4, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.5, col: 2, text: "Sine F4",~ +- Inside source: true +*** True Line Result + row: 4.5, col: 2, text: "Sine F4", +** Processing line: ~ note: :f, octave: 4, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :f, octave: 4, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.5, col: 2, text: "Sine G4",~ +- Inside source: true +*** True Line Result + row: 5.5, col: 2, text: "Sine G4", +** Processing line: ~ note: :g, octave: 4, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :g, octave: 4, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.5, col: 2, text: "Sine A5",~ +- Inside source: true +*** True Line Result + row: 6.5, col: 2, text: "Sine A5", +** Processing line: ~ note: :a, octave: 5, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :a, octave: 5, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 7.5, col: 2, text: "Sine B5",~ +- Inside source: true +*** True Line Result + row: 7.5, col: 2, text: "Sine B5", +** Processing line: ~ note: :b, octave: 5, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :b, octave: 5, type: :sine, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 8.5, col: 2, text: "Sine C5",~ +- Inside source: true +*** True Line Result + row: 8.5, col: 2, text: "Sine C5", +** Processing line: ~ note: :c, octave: 5, type: :sine, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 5, type: :sine, method_to_call: :play_note), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def square_wave_note_buttons args~ +- Inside source: true +*** True Line Result + def square_wave_note_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 1.5, col: 6, text: "Square C4",~ +- Inside source: true +*** True Line Result + row: 1.5, col: 6, text: "Square C4", +** Processing line: ~ note: :c, octave: 4, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 4, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 2.5, col: 6, text: "Square D4",~ +- Inside source: true +*** True Line Result + row: 2.5, col: 6, text: "Square D4", +** Processing line: ~ note: :d, octave: 4, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :d, octave: 4, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 3.5, col: 6, text: "Square E4",~ +- Inside source: true +*** True Line Result + row: 3.5, col: 6, text: "Square E4", +** Processing line: ~ note: :e, octave: 4, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :e, octave: 4, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.5, col: 6, text: "Square F4",~ +- Inside source: true +*** True Line Result + row: 4.5, col: 6, text: "Square F4", +** Processing line: ~ note: :f, octave: 4, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :f, octave: 4, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.5, col: 6, text: "Square G4",~ +- Inside source: true +*** True Line Result + row: 5.5, col: 6, text: "Square G4", +** Processing line: ~ note: :g, octave: 4, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :g, octave: 4, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.5, col: 6, text: "Square A5",~ +- Inside source: true +*** True Line Result + row: 6.5, col: 6, text: "Square A5", +** Processing line: ~ note: :a, octave: 5, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :a, octave: 5, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 7.5, col: 6, text: "Square B5",~ +- Inside source: true +*** True Line Result + row: 7.5, col: 6, text: "Square B5", +** Processing line: ~ note: :b, octave: 5, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :b, octave: 5, type: :square, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 8.5, col: 6, text: "Square C5",~ +- Inside source: true +*** True Line Result + row: 8.5, col: 6, text: "Square C5", +** Processing line: ~ note: :c, octave: 5, type: :square, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 5, type: :square, method_to_call: :play_note), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ def saw_tooth_wave_note_buttons args~ +- Inside source: true +*** True Line Result + def saw_tooth_wave_note_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 1.5, col: 8, text: "Saw C4",~ +- Inside source: true +*** True Line Result + row: 1.5, col: 8, text: "Saw C4", +** Processing line: ~ note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 2.5, col: 8, text: "Saw D4",~ +- Inside source: true +*** True Line Result + row: 2.5, col: 8, text: "Saw D4", +** Processing line: ~ note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 3.5, col: 8, text: "Saw E4",~ +- Inside source: true +*** True Line Result + row: 3.5, col: 8, text: "Saw E4", +** Processing line: ~ note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.5, col: 8, text: "Saw F4",~ +- Inside source: true +*** True Line Result + row: 4.5, col: 8, text: "Saw F4", +** Processing line: ~ note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.5, col: 8, text: "Saw G4",~ +- Inside source: true +*** True Line Result + row: 5.5, col: 8, text: "Saw G4", +** Processing line: ~ note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.5, col: 8, text: "Saw A5",~ +- Inside source: true +*** True Line Result + row: 6.5, col: 8, text: "Saw A5", +** Processing line: ~ note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 7.5, col: 8, text: "Saw B5",~ +- Inside source: true +*** True Line Result + row: 7.5, col: 8, text: "Saw B5", +** Processing line: ~ note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 8.5, col: 8, text: "Saw C5",~ +- Inside source: true +*** True Line Result + row: 8.5, col: 8, text: "Saw C5", +** Processing line: ~ note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def triangle_wave_note_buttons args~ +- Inside source: true +*** True Line Result + def triangle_wave_note_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 1.5, col: 10, text: "Triangle C4",~ +- Inside source: true +*** True Line Result + row: 1.5, col: 10, text: "Triangle C4", +** Processing line: ~ note: :c, octave: 4, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 4, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 2.5, col: 10, text: "Triangle D4",~ +- Inside source: true +*** True Line Result + row: 2.5, col: 10, text: "Triangle D4", +** Processing line: ~ note: :d, octave: 4, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :d, octave: 4, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 3.5, col: 10, text: "Triangle E4",~ +- Inside source: true +*** True Line Result + row: 3.5, col: 10, text: "Triangle E4", +** Processing line: ~ note: :e, octave: 4, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :e, octave: 4, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.5, col: 10, text: "Triangle F4",~ +- Inside source: true +*** True Line Result + row: 4.5, col: 10, text: "Triangle F4", +** Processing line: ~ note: :f, octave: 4, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :f, octave: 4, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.5, col: 10, text: "Triangle G4",~ +- Inside source: true +*** True Line Result + row: 5.5, col: 10, text: "Triangle G4", +** Processing line: ~ note: :g, octave: 4, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :g, octave: 4, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.5, col: 10, text: "Triangle A5",~ +- Inside source: true +*** True Line Result + row: 6.5, col: 10, text: "Triangle A5", +** Processing line: ~ note: :a, octave: 5, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :a, octave: 5, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 7.5, col: 10, text: "Triangle B5",~ +- Inside source: true +*** True Line Result + row: 7.5, col: 10, text: "Triangle B5", +** Processing line: ~ note: :b, octave: 5, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :b, octave: 5, type: :triangle, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 8.5, col: 10, text: "Triangle C5",~ +- Inside source: true +*** True Line Result + row: 8.5, col: 10, text: "Triangle C5", +** Processing line: ~ note: :c, octave: 5, type: :triangle, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 5, type: :triangle, method_to_call: :play_note), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def bell_buttons args~ +- Inside source: true +*** True Line Result + def bell_buttons args +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 1.5, col: 4, text: "Bell C4",~ +- Inside source: true +*** True Line Result + row: 1.5, col: 4, text: "Bell C4", +** Processing line: ~ note: :c, octave: 4, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 4, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 2.5, col: 4, text: "Bell D4",~ +- Inside source: true +*** True Line Result + row: 2.5, col: 4, text: "Bell D4", +** Processing line: ~ note: :d, octave: 4, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :d, octave: 4, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 3.5, col: 4, text: "Bell E4",~ +- Inside source: true +*** True Line Result + row: 3.5, col: 4, text: "Bell E4", +** Processing line: ~ note: :e, octave: 4, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :e, octave: 4, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 4.5, col: 4, text: "Bell F4",~ +- Inside source: true +*** True Line Result + row: 4.5, col: 4, text: "Bell F4", +** Processing line: ~ note: :f, octave: 4, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :f, octave: 4, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 5.5, col: 4, text: "Bell G4",~ +- Inside source: true +*** True Line Result + row: 5.5, col: 4, text: "Bell G4", +** Processing line: ~ note: :g, octave: 4, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :g, octave: 4, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 6.5, col: 4, text: "Bell A5",~ +- Inside source: true +*** True Line Result + row: 6.5, col: 4, text: "Bell A5", +** Processing line: ~ note: :a, octave: 5, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :a, octave: 5, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 7.5, col: 4, text: "Bell B5",~ +- Inside source: true +*** True Line Result + row: 7.5, col: 4, text: "Bell B5", +** Processing line: ~ note: :b, octave: 5, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :b, octave: 5, type: :bell, method_to_call: :play_note), +** Processing line: ~ (button args,~ +- Inside source: true +*** True Line Result + (button args, +** Processing line: ~ row: 8.5, col: 4, text: "Bell C5",~ +- Inside source: true +*** True Line Result + row: 8.5, col: 4, text: "Bell C5", +** Processing line: ~ note: :c, octave: 5, type: :bell, method_to_call: :play_note),~ +- Inside source: true +*** True Line Result + note: :c, octave: 5, type: :bell, method_to_call: :play_note), +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: wave generation~ +- Inside source: true +*** True Line Result + begin # region: wave generation +** Processing line: ~ begin # sine wave~ +- Inside source: true +*** True Line Result + begin # sine wave +** Processing line: ~ def defaults_sine_wave_for~ +- Inside source: true +*** True Line Result + def defaults_sine_wave_for +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +- Inside source: true +*** True Line Result + { frequency: 440, sample_rate: 48000 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def sine_wave_for opts = {}~ +- Inside source: true +*** True Line Result + def sine_wave_for opts = {} +** Processing line: ~ opts = defaults_sine_wave_for.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_sine_wave_for.merge opts +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = opts[:sample_rate]~ +- Inside source: true +*** True Line Result + sample_rate = opts[:sample_rate] +** Processing line: ~ period_size = (sample_rate.fdiv frequency).ceil~ +- Inside source: true +*** True Line Result + period_size = (sample_rate.fdiv frequency).ceil +** Processing line: ~ period_size.map_with_index do |i|~ +- Inside source: true +*** True Line Result + period_size.map_with_index do |i| +** Processing line: ~ Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i)~ +- Inside source: true +*** True Line Result + Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i) +** Processing line: ~ end.to_a~ +- Inside source: true +*** True Line Result + end.to_a +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_queue_sine_wave~ +- Inside source: true +*** True Line Result + def defaults_queue_sine_wave +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_sine_wave args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_sine_wave args, opts = {} +** Processing line: ~ opts = defaults_queue_sine_wave.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_queue_sine_wave.merge opts +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = 48000~ +- Inside source: true +*** True Line Result + sample_rate = 48000 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~ args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ proc = lambda do~ +- Inside source: true +*** True Line Result + proc = lambda do +** Processing line: ~ generate_audio_data args.state.sine_waves[frequency], sample_rate~ +- Inside source: true +*** True Line Result + generate_audio_data args.state.sine_waves[frequency], sample_rate +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_state = new_audio_state args, opts~ +- Inside source: true +*** True Line Result + audio_state = new_audio_state args, opts +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +- Inside source: true +*** True Line Result + audio_state[:input] = [1, sample_rate, proc] +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: sine_wave~ +- Inside source: true +*** True Line Result + queue_audio args, audio_state: audio_state, wave: sine_wave +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: square wave~ +- Inside source: true +*** True Line Result + begin # region: square wave +** Processing line: ~ def defaults_square_wave_for~ +- Inside source: true +*** True Line Result + def defaults_square_wave_for +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +- Inside source: true +*** True Line Result + { frequency: 440, sample_rate: 48000 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def square_wave_for opts = {}~ +- Inside source: true +*** True Line Result + def square_wave_for opts = {} +** Processing line: ~ opts = defaults_square_wave_for.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_square_wave_for.merge opts +** Processing line: ~ sine_wave = sine_wave_for opts~ +- Inside source: true +*** True Line Result + sine_wave = sine_wave_for opts +** Processing line: ~ sine_wave.map do |v|~ +- Inside source: true +*** True Line Result + sine_wave.map do |v| +** Processing line: ~ if v >= 0~ +- Inside source: true +*** True Line Result + if v >= 0 +** Processing line: ~ 1.0~ +- Inside source: true +*** True Line Result + 1.0 +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ -1.0~ +- Inside source: true +*** True Line Result + -1.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end.to_a~ +- Inside source: true +*** True Line Result + end.to_a +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_queue_square_wave~ +- Inside source: true +*** True Line Result + def defaults_queue_square_wave +** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_square_wave args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_square_wave args, opts = {} +** Processing line: ~ opts = defaults_queue_square_wave.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_queue_square_wave.merge opts +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = 48000~ +- Inside source: true +*** True Line Result + sample_rate = 48000 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~ args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ proc = lambda do~ +- Inside source: true +*** True Line Result + proc = lambda do +** Processing line: ~ generate_audio_data args.state.square_waves[frequency], sample_rate~ +- Inside source: true +*** True Line Result + generate_audio_data args.state.square_waves[frequency], sample_rate +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_state = new_audio_state args, opts~ +- Inside source: true +*** True Line Result + audio_state = new_audio_state args, opts +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +- Inside source: true +*** True Line Result + audio_state[:input] = [1, sample_rate, proc] +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: square_wave~ +- Inside source: true +*** True Line Result + queue_audio args, audio_state: audio_state, wave: square_wave +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: saw tooth wave~ +- Inside source: true +*** True Line Result + begin # region: saw tooth wave +** Processing line: ~ def defaults_saw_tooth_wave_for~ +- Inside source: true +*** True Line Result + def defaults_saw_tooth_wave_for +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +- Inside source: true +*** True Line Result + { frequency: 440, sample_rate: 48000 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def saw_tooth_wave_for opts = {}~ +- Inside source: true +*** True Line Result + def saw_tooth_wave_for opts = {} +** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_saw_tooth_wave_for.merge opts +** Processing line: ~ sine_wave = sine_wave_for opts~ +- Inside source: true +*** True Line Result + sine_wave = sine_wave_for opts +** Processing line: ~ period_size = sine_wave.length~ +- Inside source: true +*** True Line Result + period_size = sine_wave.length +** Processing line: ~ sine_wave.map_with_index do |v, i|~ +- Inside source: true +*** True Line Result + sine_wave.map_with_index do |v, i| +** Processing line: ~ (((i % period_size).fdiv period_size) * 2) - 1~ +- Inside source: true +*** True Line Result + (((i % period_size).fdiv period_size) * 2) - 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_queue_saw_tooth_wave~ +- Inside source: true +*** True Line Result + def defaults_queue_saw_tooth_wave +** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_saw_tooth_wave args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_saw_tooth_wave args, opts = {} +** Processing line: ~ opts = defaults_queue_saw_tooth_wave.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_queue_saw_tooth_wave.merge opts +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = 48000~ +- Inside source: true +*** True Line Result + sample_rate = 48000 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~ args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ proc = lambda do~ +- Inside source: true +*** True Line Result + proc = lambda do +** Processing line: ~ generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate~ +- Inside source: true +*** True Line Result + generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_state = new_audio_state args, opts~ +- Inside source: true +*** True Line Result + audio_state = new_audio_state args, opts +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +- Inside source: true +*** True Line Result + audio_state[:input] = [1, sample_rate, proc] +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: saw_tooth_wave~ +- Inside source: true +*** True Line Result + queue_audio args, audio_state: audio_state, wave: saw_tooth_wave +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: triangle wave~ +- Inside source: true +*** True Line Result + begin # region: triangle wave +** Processing line: ~ def defaults_triangle_wave_for~ +- Inside source: true +*** True Line Result + def defaults_triangle_wave_for +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +- Inside source: true +*** True Line Result + { frequency: 440, sample_rate: 48000 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def triangle_wave_for opts = {}~ +- Inside source: true +*** True Line Result + def triangle_wave_for opts = {} +** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_saw_tooth_wave_for.merge opts +** Processing line: ~ sine_wave = sine_wave_for opts~ +- Inside source: true +*** True Line Result + sine_wave = sine_wave_for opts +** Processing line: ~ period_size = sine_wave.length~ +- Inside source: true +*** True Line Result + period_size = sine_wave.length +** Processing line: ~ sine_wave.map_with_index do |v, i|~ +- Inside source: true +*** True Line Result + sine_wave.map_with_index do |v, i| +** Processing line: ~ ratio = (i.fdiv period_size)~ +- Inside source: true +*** True Line Result + ratio = (i.fdiv period_size) +** Processing line: ~ if ratio <= 0.5~ +- Inside source: true +*** True Line Result + if ratio <= 0.5 +** Processing line: ~ (ratio * 4) - 1~ +- Inside source: true +*** True Line Result + (ratio * 4) - 1 +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ ratio -= 0.5~ +- Inside source: true +*** True Line Result + ratio -= 0.5 +** Processing line: ~ 1 - (ratio * 4)~ +- Inside source: true +*** True Line Result + 1 - (ratio * 4) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_queue_triangle_wave~ +- Inside source: true +*** True Line Result + def defaults_queue_triangle_wave +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_triangle_wave args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_triangle_wave args, opts = {} +** Processing line: ~ opts = defaults_queue_triangle_wave.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_queue_triangle_wave.merge opts +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = 48000~ +- Inside source: true +*** True Line Result + sample_rate = 48000 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~ args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate~ +- Inside source: true +*** True Line Result + args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ proc = lambda do~ +- Inside source: true +*** True Line Result + proc = lambda do +** Processing line: ~ generate_audio_data args.state.triangle_waves[frequency], sample_rate~ +- Inside source: true +*** True Line Result + generate_audio_data args.state.triangle_waves[frequency], sample_rate +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ audio_state = new_audio_state args, opts~ +- Inside source: true +*** True Line Result + audio_state = new_audio_state args, opts +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +- Inside source: true +*** True Line Result + audio_state[:input] = [1, sample_rate, proc] +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: triangle_wave~ +- Inside source: true +*** True Line Result + queue_audio args, audio_state: audio_state, wave: triangle_wave +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: bell~ +- Inside source: true +*** True Line Result + begin # region: bell +** Processing line: ~ def defaults_queue_bell~ +- Inside source: true +*** True Line Result + def defaults_queue_bell +** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 1.seconds, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_bell args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_bell args, opts = {} +** Processing line: ~ (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b }~ +- Inside source: true +*** True Line Result + (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def bell_harmonics~ +- Inside source: true +*** True Line Result + def bell_harmonics +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ { frequency_ratio: 0.5, duration_ratio: 1.00 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 0.5, duration_ratio: 1.00 }, +** Processing line: ~ { frequency_ratio: 1.0, duration_ratio: 0.80 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 1.0, duration_ratio: 0.80 }, +** Processing line: ~ { frequency_ratio: 2.0, duration_ratio: 0.60 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 2.0, duration_ratio: 0.60 }, +** Processing line: ~ { frequency_ratio: 3.0, duration_ratio: 0.40 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 3.0, duration_ratio: 0.40 }, +** Processing line: ~ { frequency_ratio: 4.2, duration_ratio: 0.25 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 4.2, duration_ratio: 0.25 }, +** Processing line: ~ { frequency_ratio: 5.4, duration_ratio: 0.20 },~ +- Inside source: true +*** True Line Result + { frequency_ratio: 5.4, duration_ratio: 0.20 }, +** Processing line: ~ { frequency_ratio: 6.8, duration_ratio: 0.15 }~ +- Inside source: true +*** True Line Result + { frequency_ratio: 6.8, duration_ratio: 0.15 } +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_bell_to_sine_waves~ +- Inside source: true +*** True Line Result + def defaults_bell_to_sine_waves +** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 1.seconds, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def bell_to_sine_waves opts = {}~ +- Inside source: true +*** True Line Result + def bell_to_sine_waves opts = {} +** Processing line: ~ opts = defaults_bell_to_sine_waves.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_bell_to_sine_waves.merge opts +** Processing line: ~ bell_harmonics.map do |b|~ +- Inside source: true +*** True Line Result + bell_harmonics.map do |b| +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ frequency: opts[:frequency] * b[:frequency_ratio],~ +- Inside source: true +*** True Line Result + frequency: opts[:frequency] * b[:frequency_ratio], +** Processing line: ~ duration: opts[:duration] * b[:duration_ratio],~ +- Inside source: true +*** True Line Result + duration: opts[:duration] * b[:duration_ratio], +** Processing line: ~ queue_in: opts[:queue_in],~ +- Inside source: true +*** True Line Result + queue_in: opts[:queue_in], +** Processing line: ~ gain: (1.fdiv bell_harmonics.length),~ +- Inside source: true +*** True Line Result + gain: (1.fdiv bell_harmonics.length), +** Processing line: ~ fade_out: true~ +- Inside source: true +*** True Line Result + fade_out: true +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # audio entity construction~ +- Inside source: true +*** True Line Result + begin # audio entity construction +** Processing line: ~ def generate_audio_data sine_wave, sample_rate~ +- Inside source: true +*** True Line Result + def generate_audio_data sine_wave, sample_rate +** Processing line: ~ sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil~ +- Inside source: true +*** True Line Result + sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil +** Processing line: ~ copy_count = (sample_size.fdiv sine_wave.length).ceil~ +- Inside source: true +*** True Line Result + copy_count = (sample_size.fdiv sine_wave.length).ceil +** Processing line: ~ sine_wave * copy_count~ +- Inside source: true +*** True Line Result + sine_wave * copy_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults_new_audio_state~ +- Inside source: true +*** True Line Result + def defaults_new_audio_state +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +- Inside source: true +*** True Line Result + { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_audio_state args, opts = {}~ +- Inside source: true +*** True Line Result + def new_audio_state args, opts = {} +** Processing line: ~ opts = defaults_new_audio_state.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_new_audio_state.merge opts +** Processing line: ~ decay_rate = 0~ +- Inside source: true +*** True Line Result + decay_rate = 0 +** Processing line: ~ decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out]~ +- Inside source: true +*** True Line Result + decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out] +** Processing line: ~ frequency = opts[:frequency]~ +- Inside source: true +*** True Line Result + frequency = opts[:frequency] +** Processing line: ~ sample_rate = 48000~ +- Inside source: true +*** True Line Result + sample_rate = 48000 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ id: (new_id! args),~ +- Inside source: true +*** True Line Result + id: (new_id! args), +** Processing line: ~ frequency: frequency,~ +- Inside source: true +*** True Line Result + frequency: frequency, +** Processing line: ~ sample_rate: 48000,~ +- Inside source: true +*** True Line Result + sample_rate: 48000, +** Processing line: ~ stop_at: args.tick_count + opts[:queue_in] + opts[:duration],~ +- Inside source: true +*** True Line Result + stop_at: args.tick_count + opts[:queue_in] + opts[:duration], +** Processing line: ~ gain: opts[:gain].to_f,~ +- Inside source: true +*** True Line Result + gain: opts[:gain].to_f, +** Processing line: ~ queue_at: args.state.tick_count + opts[:queue_in],~ +- Inside source: true +*** True Line Result + queue_at: args.state.tick_count + opts[:queue_in], +** Processing line: ~ decay_rate: decay_rate,~ +- Inside source: true +*** True Line Result + decay_rate: decay_rate, +** Processing line: ~ pitch: 1.0,~ +- Inside source: true +*** True Line Result + pitch: 1.0, +** Processing line: ~ looping: true,~ +- Inside source: true +*** True Line Result + looping: true, +** Processing line: ~ paused: false~ +- Inside source: true +*** True Line Result + paused: false +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_audio args, opts = {}~ +- Inside source: true +*** True Line Result + def queue_audio args, opts = {} +** Processing line: ~ graph_wave args, opts[:wave], opts[:audio_state][:frequency]~ +- Inside source: true +*** True Line Result + graph_wave args, opts[:wave], opts[:audio_state][:frequency] +** Processing line: ~ args.state.audio_queue << opts[:audio_state]~ +- Inside source: true +*** True Line Result + args.state.audio_queue << opts[:audio_state] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_id! args~ +- Inside source: true +*** True Line Result + def new_id! args +** Processing line: ~ args.state.audio_id ||= 0~ +- Inside source: true +*** True Line Result + args.state.audio_id ||= 0 +** Processing line: ~ args.state.audio_id += 1~ +- Inside source: true +*** True Line Result + args.state.audio_id += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def graph_wave args, wave, frequency~ +- Inside source: true +*** True Line Result + def graph_wave args, wave, frequency +** Processing line: ~ if args.state.tick_count != args.state.graphed_at~ +- Inside source: true +*** True Line Result + if args.state.tick_count != args.state.graphed_at +** Processing line: ~ args.outputs.static_lines.clear~ +- Inside source: true +*** True Line Result + args.outputs.static_lines.clear +** Processing line: ~ args.outputs.static_sprites.clear~ +- Inside source: true +*** True Line Result + args.outputs.static_sprites.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ wave = wave~ +- Inside source: true +*** True Line Result + wave = wave +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ r, g, b = frequency.to_i % 85,~ +- Inside source: true +*** True Line Result + r, g, b = frequency.to_i % 85, +** Processing line: ~ frequency.to_i % 170,~ +- Inside source: true +*** True Line Result + frequency.to_i % 170, +** Processing line: ~ frequency.to_i % 255~ +- Inside source: true +*** True Line Result + frequency.to_i % 255 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ starting_rect = args.layout.rect(row: 5, col: 13)~ +- Inside source: true +*** True Line Result + starting_rect = args.layout.rect(row: 5, col: 13) +** Processing line: ~ x_scale = 10~ +- Inside source: true +*** True Line Result + x_scale = 10 +** Processing line: ~ y_scale = 100~ +- Inside source: true +*** True Line Result + y_scale = 100 +** Processing line: ~ max_points = 25~ +- Inside source: true +*** True Line Result + max_points = 25 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ points = wave~ +- Inside source: true +*** True Line Result + points = wave +** Processing line: ~ if wave.length > max_points~ +- Inside source: true +*** True Line Result + if wave.length > max_points +** Processing line: ~ resolution = wave.length.idiv max_points~ +- Inside source: true +*** True Line Result + resolution = wave.length.idiv max_points +** Processing line: ~ points = wave.find_all.with_index { |y, i| (i % resolution == 0) }~ +- Inside source: true +*** True Line Result + points = wave.find_all.with_index { |y, i| (i % resolution == 0) } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.static_lines << points.map_with_index do |y, x|~ +- Inside source: true +*** True Line Result + args.outputs.static_lines << points.map_with_index do |y, x| +** Processing line: ~ next_y = points[x + 1]~ +- Inside source: true +*** True Line Result + next_y = points[x + 1] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if next_y~ +- Inside source: true +*** True Line Result + if next_y +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: starting_rect.x + (x * x_scale),~ +- Inside source: true +*** True Line Result + x: starting_rect.x + (x * x_scale), +** Processing line: ~ y: starting_rect.y + starting_rect.h.half + y_scale * y,~ +- Inside source: true +*** True Line Result + y: starting_rect.y + starting_rect.h.half + y_scale * y, +** Processing line: ~ x2: starting_rect.x + ((x + 1) * x_scale),~ +- Inside source: true +*** True Line Result + x2: starting_rect.x + ((x + 1) * x_scale), +** Processing line: ~ y2: starting_rect.y + starting_rect.h.half + y_scale * next_y,~ +- Inside source: true +*** True Line Result + y2: starting_rect.y + starting_rect.h.half + y_scale * next_y, +** Processing line: ~ r: r,~ +- Inside source: true +*** True Line Result + r: r, +** Processing line: ~ g: g,~ +- Inside source: true +*** True Line Result + g: g, +** Processing line: ~ b: b~ +- Inside source: true +*** True Line Result + b: b +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.static_sprites << points.map_with_index do |y, x|~ +- Inside source: true +*** True Line Result + args.outputs.static_sprites << points.map_with_index do |y, x| +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: (starting_rect.x + (x * x_scale)) - 2,~ +- Inside source: true +*** True Line Result + x: (starting_rect.x + (x * x_scale)) - 2, +** Processing line: ~ y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2,~ +- Inside source: true +*** True Line Result + y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2, +** Processing line: ~ w: 4,~ +- Inside source: true +*** True Line Result + w: 4, +** Processing line: ~ h: 4,~ +- Inside source: true +*** True Line Result + h: 4, +** Processing line: ~ path: 'sprites/square-white.png',~ +- Inside source: true +*** True Line Result + path: 'sprites/square-white.png', +** Processing line: ~ r: r,~ +- Inside source: true +*** True Line Result + r: r, +** Processing line: ~ g: g,~ +- Inside source: true +*** True Line Result + g: g, +** Processing line: ~ b: b~ +- Inside source: true +*** True Line Result + b: b +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.graphed_at = args.state.tick_count~ +- Inside source: true +*** True Line Result + args.state.graphed_at = args.state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin # region: musical note mapping~ +- Inside source: true +*** True Line Result + begin # region: musical note mapping +** Processing line: ~ def defaults_frequency_for~ +- Inside source: true +*** True Line Result + def defaults_frequency_for +** Processing line: ~ { note: :a, octave: 5, sharp: false, flat: false }~ +- Inside source: true +*** True Line Result + { note: :a, octave: 5, sharp: false, flat: false } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def frequency_for opts = {}~ +- Inside source: true +*** True Line Result + def frequency_for opts = {} +** Processing line: ~ opts = defaults_frequency_for.merge opts~ +- Inside source: true +*** True Line Result + opts = defaults_frequency_for.merge opts +** Processing line: ~ octave_offset_multiplier = opts[:octave] - 5~ +- Inside source: true +*** True Line Result + octave_offset_multiplier = opts[:octave] - 5 +** Processing line: ~ note = note_frequencies_octave_5[opts[:note]]~ +- Inside source: true +*** True Line Result + note = note_frequencies_octave_5[opts[:note]] +** Processing line: ~ if octave_offset_multiplier < 0~ +- Inside source: true +*** True Line Result + if octave_offset_multiplier < 0 +** Processing line: ~ note = note * 1 / (octave_offset_multiplier.abs + 1)~ +- Inside source: true +*** True Line Result + note = note * 1 / (octave_offset_multiplier.abs + 1) +** Processing line: ~ elsif octave_offset_multiplier > 0~ +- Inside source: true +*** True Line Result + elsif octave_offset_multiplier > 0 +** Processing line: ~ note = note * (octave_offset_multiplier.abs + 1) / 1~ +- Inside source: true +*** True Line Result + note = note * (octave_offset_multiplier.abs + 1) / 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ note~ +- Inside source: true +*** True Line Result + note +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def note_frequencies_octave_5~ +- Inside source: true +*** True Line Result + def note_frequencies_octave_5 +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ a: 440.0,~ +- Inside source: true +*** True Line Result + a: 440.0, +** Processing line: ~ a_sharp: 466.16, b_flat: 466.16,~ +- Inside source: true +*** True Line Result + a_sharp: 466.16, b_flat: 466.16, +** Processing line: ~ b: 493.88,~ +- Inside source: true +*** True Line Result + b: 493.88, +** Processing line: ~ c: 523.25,~ +- Inside source: true +*** True Line Result + c: 523.25, +** Processing line: ~ c_sharp: 554.37, d_flat: 587.33,~ +- Inside source: true +*** True Line Result + c_sharp: 554.37, d_flat: 587.33, +** Processing line: ~ d: 587.33,~ +- Inside source: true +*** True Line Result + d: 587.33, +** Processing line: ~ d_sharp: 622.25, e_flat: 659.25,~ +- Inside source: true +*** True Line Result + d_sharp: 622.25, e_flat: 659.25, +** Processing line: ~ e: 659.25,~ +- Inside source: true +*** True Line Result + e: 659.25, +** Processing line: ~ f: 698.25,~ +- Inside source: true +*** True Line Result + f: 698.25, +** Processing line: ~ f_sharp: 739.99, g_flat: 739.99,~ +- Inside source: true +*** True Line Result + f_sharp: 739.99, g_flat: 739.99, +** Processing line: ~ g: 783.99,~ +- Inside source: true +*** True Line Result + g: 783.99, +** Processing line: ~ g_sharp: 830.61, a_flat: 830.61~ +- Inside source: true +*** True Line Result + g_sharp: 830.61, a_flat: 830.61 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Advanced Rendering - Labels With Wrapped Text - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Rendering - Labels With Wrapped Text - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/00_labels_with_wrapped_text/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_rendering/00_labels_with_wrapped_text/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # defaults~ +- Inside source: true +*** True Line Result + # defaults +** Processing line: ~ args.state.scroll_location ||= 0~ +- Inside source: true +*** True Line Result + args.state.scroll_location ||= 0 +** Processing line: ~ args.state.textbox.messages ||= []~ +- Inside source: true +*** True Line Result + args.state.textbox.messages ||= [] +** Processing line: ~ args.state.textbox.scroll ||= 0~ +- Inside source: true +*** True Line Result + args.state.textbox.scroll ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render~ +- Inside source: true +*** True Line Result + # render +** Processing line: ~ args.outputs.background_color = [0, 0, 0, 255]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [0, 0, 0, 255] +** Processing line: ~ render_messages args~ +- Inside source: true +*** True Line Result + render_messages args +** Processing line: ~ render_instructions args~ +- Inside source: true +*** True Line Result + render_instructions args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # inputs~ +- Inside source: true +*** True Line Result + # inputs +** Processing line: ~ if args.inputs.keyboard.key_down.one~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.one +** Processing line: ~ queue_message args, "Hello there neighbour! my name is mark, how is your day today?"~ +- Inside source: true +*** True Line Result + queue_message args, "Hello there neighbour! my name is mark, how is your day today?" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.keyboard.key_down.two~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.two +** Processing line: ~ queue_message args, "I'm doing great sir, actually I'm having a picnic today"~ +- Inside source: true +*** True Line Result + queue_message args, "I'm doing great sir, actually I'm having a picnic today" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.keyboard.key_down.three~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.three +** Processing line: ~ queue_message args, "Well that sounds wonderful!"~ +- Inside source: true +*** True Line Result + queue_message args, "Well that sounds wonderful!" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.keyboard.key_down.home~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.home +** Processing line: ~ args.state.scroll_location = 1~ +- Inside source: true +*** True Line Result + args.state.scroll_location = 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.keyboard.key_down.delete~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.delete +** Processing line: ~ clear_message_queue args~ +- Inside source: true +*** True Line Result + clear_message_queue args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def queue_message args, msg~ +- Inside source: true +*** True Line Result + def queue_message args, msg +** Processing line: ~ args.state.textbox.messages.concat msg.wrapped_lines 50~ +- Inside source: true +*** True Line Result + args.state.textbox.messages.concat msg.wrapped_lines 50 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def clear_message_queue args~ +- Inside source: true +*** True Line Result + def clear_message_queue args +** Processing line: ~ args.state.textbox.messages = nil~ +- Inside source: true +*** True Line Result + args.state.textbox.messages = nil +** Processing line: ~ args.state.textbox.scroll = 0~ +- Inside source: true +*** True Line Result + args.state.textbox.scroll = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_messages args~ +- Inside source: true +*** True Line Result + def render_messages args +** Processing line: ~ args.outputs[:textbox].w = 400~ +- Inside source: true +*** True Line Result + args.outputs[:textbox].w = 400 +** Processing line: ~ args.outputs[:textbox].h = 720~ +- Inside source: true +*** True Line Result + args.outputs[:textbox].h = 720 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.primitives << args.state.textbox.messages.each_with_index.map do |s, idx|~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.state.textbox.messages.each_with_index.map do |s, idx| +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 0,~ +- Inside source: true +*** True Line Result + x: 0, +** Processing line: ~ y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20,~ +- Inside source: true +*** True Line Result + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, +** Processing line: ~ text: s,~ +- Inside source: true +*** True Line Result + text: s, +** Processing line: ~ size_enum: -3,~ +- Inside source: true +*** True Line Result + size_enum: -3, +** Processing line: ~ alignment_enum: 0,~ +- Inside source: true +*** True Line Result + alignment_enum: 0, +** Processing line: ~ r: 255, g:255, b: 255, a: 255~ +- Inside source: true +*** True Line Result + r: 255, g:255, b: 255, a: 255 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs[:textbox].labels << args.state.textbox.messages.each_with_index.map do |s, idx|~ +- Inside source: true +*** True Line Result + args.outputs[:textbox].labels << args.state.textbox.messages.each_with_index.map do |s, idx| +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 0,~ +- Inside source: true +*** True Line Result + x: 0, +** Processing line: ~ y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20,~ +- Inside source: true +*** True Line Result + y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20, +** Processing line: ~ text: s,~ +- Inside source: true +*** True Line Result + text: s, +** Processing line: ~ size_enum: -3,~ +- Inside source: true +*** True Line Result + size_enum: -3, +** Processing line: ~ alignment_enum: 0,~ +- Inside source: true +*** True Line Result + alignment_enum: 0, +** Processing line: ~ r: 255, g:255, b: 255, a: 255~ +- Inside source: true +*** True Line Result + r: 255, g:255, b: 255, a: 255 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs[:textbox].borders << [0, 0, args.outputs[:textbox].w, 720]~ +- Inside source: true +*** True Line Result + args.outputs[:textbox].borders << [0, 0, args.outputs[:textbox].w, 720] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.textbox.scroll += args.inputs.mouse.wheel.y unless args.inputs.mouse.wheel.nil?~ +- Inside source: true +*** True Line Result + args.state.textbox.scroll += args.inputs.mouse.wheel.y unless args.inputs.mouse.wheel.nil? +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.scroll_location > 0~ +- Inside source: true +*** True Line Result + if args.state.scroll_location > 0 +** Processing line: ~ args.state.textbox.scroll = 0~ +- Inside source: true +*** True Line Result + args.state.textbox.scroll = 0 +** Processing line: ~ args.state.scroll_location = 0~ +- Inside source: true +*** True Line Result + args.state.scroll_location = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.sprites << [900, 0, args.outputs[:textbox].w, 720, :textbox]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [900, 0, args.outputs[:textbox].w, 720, :textbox] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_instructions args~ +- Inside source: true +*** True Line Result + def render_instructions args +** Processing line: ~ args.outputs.labels << [30,~ +- Inside source: true +*** True Line Result + args.outputs.labels << [30, +** Processing line: ~ 30.from_top,~ +- Inside source: true +*** True Line Result + 30.from_top, +** Processing line: ~ "press 1, 2, 3 to display messages, MOUSE WHEEL to scroll, HOME to go to top, BACKSPACE to delete.",~ +- Inside source: true +*** True Line Result + "press 1, 2, 3 to display messages, MOUSE WHEEL to scroll, HOME to go to top, BACKSPACE to delete.", +** Processing line: ~ 0, 255, 255]~ +- Inside source: true +*** True Line Result + 0, 255, 255] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.primitives << [0, 55.from_top, 1280, 30, :pixel, 0, 255, 0, 0, 0].sprite~ +- Inside source: true +*** True Line Result + args.outputs.primitives << [0, 55.from_top, 1280, 30, :pixel, 0, 255, 0, 0, 0].sprite +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Advanced Rendering - Rotating Label - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Rendering - Rotating Label - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/00_rotating_label/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_rendering/00_rotating_label/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # set the render target width and height to match the label~ +- Inside source: true +*** True Line Result + # set the render target width and height to match the label +** Processing line: ~ args.outputs[:scene].w = 220~ +- Inside source: true +*** True Line Result + args.outputs[:scene].w = 220 +** Processing line: ~ args.outputs[:scene].h = 30~ +- Inside source: true +*** True Line Result + args.outputs[:scene].h = 30 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # make the background transparent~ +- Inside source: true +*** True Line Result + # make the background transparent +** Processing line: ~ args.outputs[:scene].background_color = [255, 255, 255, 0]~ +- Inside source: true +*** True Line Result + args.outputs[:scene].background_color = [255, 255, 255, 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # set the blendmode of the label to 0 (no blending)~ +- Inside source: true +*** True Line Result + # set the blendmode of the label to 0 (no blending) +** Processing line: ~ # center it inside of the scene~ +- Inside source: true +*** True Line Result + # center it inside of the scene +** Processing line: ~ # set the vertical_alignment_enum to 1 (center)~ +- Inside source: true +*** True Line Result + # set the vertical_alignment_enum to 1 (center) +** Processing line: ~ args.outputs[:scene].labels << { x: 0,~ +- Inside source: true +*** True Line Result + args.outputs[:scene].labels << { x: 0, +** Processing line: ~ y: 15,~ +- Inside source: true +*** True Line Result + y: 15, +** Processing line: ~ text: "label in render target",~ +- Inside source: true +*** True Line Result + text: "label in render target", +** Processing line: ~ blendmode_enum: 0,~ +- Inside source: true +*** True Line Result + blendmode_enum: 0, +** Processing line: ~ vertical_alignment_enum: 1 }~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 1 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # add a border to the render target~ +- Inside source: true +*** True Line Result + # add a border to the render target +** Processing line: ~ args.outputs[:scene].borders << { x: 0,~ +- Inside source: true +*** True Line Result + args.outputs[:scene].borders << { x: 0, +** Processing line: ~ y: 0,~ +- Inside source: true +*** True Line Result + y: 0, +** Processing line: ~ w: args.outputs[:scene].w,~ +- Inside source: true +*** True Line Result + w: args.outputs[:scene].w, +** Processing line: ~ h: args.outputs[:scene].h }~ +- Inside source: true +*** True Line Result + h: args.outputs[:scene].h } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # add the rendertarget to the main output as a sprite~ +- Inside source: true +*** True Line Result + # add the rendertarget to the main output as a sprite +** Processing line: ~ args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half, +** Processing line: ~ y: 360 - args.outputs[:scene].h.half,~ +- Inside source: true +*** True Line Result + y: 360 - args.outputs[:scene].h.half, +** Processing line: ~ w: args.outputs[:scene].w,~ +- Inside source: true +*** True Line Result + w: args.outputs[:scene].w, +** Processing line: ~ h: args.outputs[:scene].h,~ +- Inside source: true +*** True Line Result + h: args.outputs[:scene].h, +** Processing line: ~ angle: args.state.tick_count,~ +- Inside source: true +*** True Line Result + angle: args.state.tick_count, +** Processing line: ~ path: :scene }~ +- Inside source: true +*** True Line Result + path: :scene } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Advanced Rendering - Simple Render Targets - main.rb~ - Header detected. *** True Line Result @@ -49224,10 +51447,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result angle_anchor_y: 0.5 -** Processing line: ~ }.sprite~ +** Processing line: ~ }.sprite!~ - Inside source: true *** True Line Result - }.sprite + }.sprite! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -49280,10 +51503,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result font: "fonts/manaspc.ttf" # font style -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -49328,10 +51551,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 255 # transparency -** Processing line: ~ }.solid~ +** Processing line: ~ }.solid!~ - Inside source: true *** True Line Result - }.solid + }.solid! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -49380,10 +51603,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 255 # transparency -** Processing line: ~ }.border~ +** Processing line: ~ }.border!~ - Inside source: true *** True Line Result - }.border + }.border! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -49428,10 +51651,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 255 # transparency -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ - Inside source: true *** True Line Result - }.line + }.line! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -49640,6 +51863,406 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Rendering - Simple Camera - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Rendering - Simple Camera - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/07_simple_camera/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_rendering/07_simple_camera/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # variables you can play around with~ +- Inside source: true +*** True Line Result + # variables you can play around with +** Processing line: ~ args.state.world.w ||= 1280~ +- Inside source: true +*** True Line Result + args.state.world.w ||= 1280 +** Processing line: ~ args.state.world.h ||= 720~ +- Inside source: true +*** True Line Result + args.state.world.h ||= 720 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.player.x ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.x ||= 0 +** Processing line: ~ args.state.player.y ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.y ||= 0 +** Processing line: ~ args.state.player.size ||= 32~ +- Inside source: true +*** True Line Result + args.state.player.size ||= 32 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.enemy.x ||= 700~ +- Inside source: true +*** True Line Result + args.state.enemy.x ||= 700 +** Processing line: ~ args.state.enemy.y ||= 700~ +- Inside source: true +*** True Line Result + args.state.enemy.y ||= 700 +** Processing line: ~ args.state.enemy.size ||= 16~ +- Inside source: true +*** True Line Result + args.state.enemy.size ||= 16 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.camera.x ||= 640~ +- Inside source: true +*** True Line Result + args.state.camera.x ||= 640 +** Processing line: ~ args.state.camera.y ||= 300~ +- Inside source: true +*** True Line Result + args.state.camera.y ||= 300 +** Processing line: ~ args.state.camera.scale ||= 1.0~ +- Inside source: true +*** True Line Result + args.state.camera.scale ||= 1.0 +** Processing line: ~ args.state.camera.show_empty_space ||= :yes~ +- Inside source: true +*** True Line Result + args.state.camera.show_empty_space ||= :yes +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # instructions~ +- Inside source: true +*** True Line Result + # instructions +** Processing line: ~ args.outputs.primitives << { x: 0, y: 80.from_top, w: 360, h: 80, r: 0, g: 0, b: 0, a: 128 }.solid!~ +- Inside source: true +*** True Line Result + args.outputs.primitives << { x: 0, y: 80.from_top, w: 360, h: 80, r: 0, g: 0, b: 0, a: 128 }.solid! +** Processing line: ~ args.outputs.primitives << { x: 10, y: 10.from_top, text: "arrow keys to move around", r: 255, g: 255, b: 255}.label!~ +- Inside source: true +*** True Line Result + args.outputs.primitives << { x: 10, y: 10.from_top, text: "arrow keys to move around", r: 255, g: 255, b: 255}.label! +** Processing line: ~ args.outputs.primitives << { x: 10, y: 30.from_top, text: "+/- to change zoom of camera", r: 255, g: 255, b: 255}.label!~ +- Inside source: true +*** True Line Result + args.outputs.primitives << { x: 10, y: 30.from_top, text: "+/- to change zoom of camera", r: 255, g: 255, b: 255}.label! +** Processing line: ~ args.outputs.primitives << { x: 10, y: 50.from_top, text: "tab to change camera edge behavior", r: 255, g: 255, b: 255}.label!~ +- Inside source: true +*** True Line Result + args.outputs.primitives << { x: 10, y: 50.from_top, text: "tab to change camera edge behavior", r: 255, g: 255, b: 255}.label! +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render scene~ +- Inside source: true +*** True Line Result + # render scene +** Processing line: ~ args.outputs[:scene].w = args.state.world.w~ +- Inside source: true +*** True Line Result + args.outputs[:scene].w = args.state.world.w +** Processing line: ~ args.outputs[:scene].h = args.state.world.h~ +- Inside source: true +*** True Line Result + args.outputs[:scene].h = args.state.world.h +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs[:scene].solids << { x: 0, y: 0, w: args.state.world.w, h: args.state.world.h, r: 20, g: 60, b: 80 }~ +- Inside source: true +*** True Line Result + args.outputs[:scene].solids << { x: 0, y: 0, w: args.state.world.w, h: args.state.world.h, r: 20, g: 60, b: 80 } +** Processing line: ~ args.outputs[:scene].solids << { x: args.state.player.x, y: args.state.player.y,~ +- Inside source: true +*** True Line Result + args.outputs[:scene].solids << { x: args.state.player.x, y: args.state.player.y, +** Processing line: ~ w: args.state.player.size, h: args.state.player.size, r: 80, g: 155, b: 80 }~ +- Inside source: true +*** True Line Result + w: args.state.player.size, h: args.state.player.size, r: 80, g: 155, b: 80 } +** Processing line: ~ args.outputs[:scene].solids << { x: args.state.enemy.x, y: args.state.enemy.y,~ +- Inside source: true +*** True Line Result + args.outputs[:scene].solids << { x: args.state.enemy.x, y: args.state.enemy.y, +** Processing line: ~ w: args.state.enemy.size, h: args.state.enemy.size, r: 155, g: 80, b: 80 }~ +- Inside source: true +*** True Line Result + w: args.state.enemy.size, h: args.state.enemy.size, r: 155, g: 80, b: 80 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render camera~ +- Inside source: true +*** True Line Result + # render camera +** Processing line: ~ scene_position = calc_scene_position args~ +- Inside source: true +*** True Line Result + scene_position = calc_scene_position args +** Processing line: ~ args.outputs.sprites << { x: scene_position.x,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: scene_position.x, +** Processing line: ~ y: scene_position.y,~ +- Inside source: true +*** True Line Result + y: scene_position.y, +** Processing line: ~ w: scene_position.w,~ +- Inside source: true +*** True Line Result + w: scene_position.w, +** Processing line: ~ h: scene_position.h,~ +- Inside source: true +*** True Line Result + h: scene_position.h, +** Processing line: ~ path: :scene }~ +- Inside source: true +*** True Line Result + path: :scene } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # move player~ +- Inside source: true +*** True Line Result + # move player +** Processing line: ~ if args.inputs.directional_angle~ +- Inside source: true +*** True Line Result + if args.inputs.directional_angle +** Processing line: ~ args.state.player.x += args.inputs.directional_angle.vector_x * 5~ +- Inside source: true +*** True Line Result + args.state.player.x += args.inputs.directional_angle.vector_x * 5 +** Processing line: ~ args.state.player.y += args.inputs.directional_angle.vector_y * 5~ +- Inside source: true +*** True Line Result + args.state.player.y += args.inputs.directional_angle.vector_y * 5 +** Processing line: ~ args.state.player.x = args.state.player.x.clamp(0, args.state.world.w - args.state.player.size)~ +- Inside source: true +*** True Line Result + args.state.player.x = args.state.player.x.clamp(0, args.state.world.w - args.state.player.size) +** Processing line: ~ args.state.player.y = args.state.player.y.clamp(0, args.state.world.h - args.state.player.size)~ +- Inside source: true +*** True Line Result + args.state.player.y = args.state.player.y.clamp(0, args.state.world.h - args.state.player.size) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # +/- to zoom in and out~ +- Inside source: true +*** True Line Result + # +/- to zoom in and out +** Processing line: ~ if args.inputs.keyboard.plus && args.state.tick_count.zmod?(3)~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.plus && args.state.tick_count.zmod?(3) +** Processing line: ~ args.state.camera.scale += 0.05~ +- Inside source: true +*** True Line Result + args.state.camera.scale += 0.05 +** Processing line: ~ elsif args.inputs.keyboard.hyphen && args.state.tick_count.zmod?(3)~ +- Inside source: true +*** True Line Result + elsif args.inputs.keyboard.hyphen && args.state.tick_count.zmod?(3) +** Processing line: ~ args.state.camera.scale -= 0.05~ +- Inside source: true +*** True Line Result + args.state.camera.scale -= 0.05 +** Processing line: ~ elsif args.inputs.keyboard.key_down.tab~ +- Inside source: true +*** True Line Result + elsif args.inputs.keyboard.key_down.tab +** Processing line: ~ if args.state.camera.show_empty_space == :yes~ +- Inside source: true +*** True Line Result + if args.state.camera.show_empty_space == :yes +** Processing line: ~ args.state.camera.show_empty_space = :no~ +- Inside source: true +*** True Line Result + args.state.camera.show_empty_space = :no +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.state.camera.show_empty_space = :yes~ +- Inside source: true +*** True Line Result + args.state.camera.show_empty_space = :yes +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.camera.scale = args.state.camera.scale.greater(0.1)~ +- Inside source: true +*** True Line Result + args.state.camera.scale = args.state.camera.scale.greater(0.1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_scene_position args~ +- Inside source: true +*** True Line Result + def calc_scene_position args +** Processing line: ~ result = { x: args.state.camera.x - (args.state.player.x * args.state.camera.scale),~ +- Inside source: true +*** True Line Result + result = { x: args.state.camera.x - (args.state.player.x * args.state.camera.scale), +** Processing line: ~ y: args.state.camera.y - (args.state.player.y * args.state.camera.scale),~ +- Inside source: true +*** True Line Result + y: args.state.camera.y - (args.state.player.y * args.state.camera.scale), +** Processing line: ~ w: args.state.world.w * args.state.camera.scale,~ +- Inside source: true +*** True Line Result + w: args.state.world.w * args.state.camera.scale, +** Processing line: ~ h: args.state.world.h * args.state.camera.scale,~ +- Inside source: true +*** True Line Result + h: args.state.world.h * args.state.camera.scale, +** Processing line: ~ scale: args.state.camera.scale }~ +- Inside source: true +*** True Line Result + scale: args.state.camera.scale } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return result if args.state.camera.show_empty_space == :yes~ +- Inside source: true +*** True Line Result + return result if args.state.camera.show_empty_space == :yes +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if result.w < args.grid.w~ +- Inside source: true +*** True Line Result + if result.w < args.grid.w +** Processing line: ~ result.merge!(x: (args.grid.w - result.w).half)~ +- Inside source: true +*** True Line Result + result.merge!(x: (args.grid.w - result.w).half) +** Processing line: ~ elsif (args.state.player.x * result.scale) < args.grid.w.half~ +- Inside source: true +*** True Line Result + elsif (args.state.player.x * result.scale) < args.grid.w.half +** Processing line: ~ result.merge!(x: 10)~ +- Inside source: true +*** True Line Result + result.merge!(x: 10) +** Processing line: ~ elsif (result.x + result.w) < args.grid.w~ +- Inside source: true +*** True Line Result + elsif (result.x + result.w) < args.grid.w +** Processing line: ~ result.merge!(x: - result.w + (args.grid.w - 10))~ +- Inside source: true +*** True Line Result + result.merge!(x: - result.w + (args.grid.w - 10)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if result.h < args.grid.h~ +- Inside source: true +*** True Line Result + if result.h < args.grid.h +** Processing line: ~ result.merge!(y: (args.grid.h - result.h).half)~ +- Inside source: true +*** True Line Result + result.merge!(y: (args.grid.h - result.h).half) +** Processing line: ~ elsif (result.y) > 10~ +- Inside source: true +*** True Line Result + elsif (result.y) > 10 +** Processing line: ~ result.merge!(y: 10)~ +- Inside source: true +*** True Line Result + result.merge!(y: 10) +** Processing line: ~ elsif (result.y + result.h) < args.grid.h~ +- Inside source: true +*** True Line Result + elsif (result.y + result.h) < args.grid.h +** Processing line: ~ result.merge!(y: - result.h + (args.grid.h - 10))~ +- Inside source: true +*** True Line Result + result.merge!(y: - result.h + (args.grid.h - 10)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ result~ +- Inside source: true +*** True Line Result + result +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Advanced Rendering - Splitscreen Camera - main.rb~ - Header detected. *** True Line Result @@ -49652,10 +52275,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/07_advanced_rendering/07_splitscreen_camera/app/main.rb~ +** Processing line: ~ # ./samples/07_advanced_rendering/08_splitscreen_camera/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/07_advanced_rendering/07_splitscreen_camera/app/main.rb + # ./samples/07_advanced_rendering/08_splitscreen_camera/app/main.rb ** Processing line: ~ class CameraMovement~ - Inside source: true *** True Line Result @@ -50040,6 +52663,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def new_room~ - Inside source: true *** True Line Result @@ -51260,10 +53887,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/07_advanced_rendering/08_z_targeting_camera/app/main.rb~ +** Processing line: ~ # ./samples/07_advanced_rendering/09_z_targeting_camera/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/07_advanced_rendering/08_z_targeting_camera/app/main.rb + # ./samples/07_advanced_rendering/09_z_targeting_camera/app/main.rb ** Processing line: ~ class Game~ - Inside source: true *** True Line Result @@ -51700,6 +54327,446 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Rendering - Blend Modes - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Rendering - Blend Modes - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/10_blend_modes/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_rendering/10_blend_modes/app/main.rb +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def draw_blendmode args, mode~ +- Inside source: true +*** True Line Result + def draw_blendmode args, mode +** Processing line: ~ w = 160~ +- Inside source: true +*** True Line Result + w = 160 +** Processing line: ~ h = w~ +- Inside source: true +*** True Line Result + h = w +** Processing line: ~ args.state.x += (1280-w) / (args.state.blendmodes.length + 1)~ +- Inside source: true +*** True Line Result + args.state.x += (1280-w) / (args.state.blendmodes.length + 1) +** Processing line: ~ x = args.state.x~ +- Inside source: true +*** True Line Result + x = args.state.x +** Processing line: ~ y = (720 - h) / 2~ +- Inside source: true +*** True Line Result + y = (720 - h) / 2 +** Processing line: ~ s = 'sprites/blue-feathered.png'~ +- Inside source: true +*** True Line Result + s = 'sprites/blue-feathered.png' +** Processing line: ~ args.outputs.sprites << { blendmode_enum: mode.value, x: x, y: y, w: w, h: h, path: s }~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { blendmode_enum: mode.value, x: x, y: y, w: w, h: h, path: s } +** Processing line: ~ args.outputs.labels << [x + (w/2), y, mode.name.to_s, 1, 1, 255, 255, 255]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [x + (w/2), y, mode.name.to_s, 1, 1, 255, 255, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Different blend modes do different things, depending on what they~ +- Inside source: true +*** True Line Result + # Different blend modes do different things, depending on what they +** Processing line: ~ # blend against (in this case, the pixels of the background color).~ +- Inside source: true +*** True Line Result + # blend against (in this case, the pixels of the background color). +** Processing line: ~ args.state.bg_element ||= 1~ +- Inside source: true +*** True Line Result + args.state.bg_element ||= 1 +** Processing line: ~ args.state.bg_color ||= 255~ +- Inside source: true +*** True Line Result + args.state.bg_color ||= 255 +** Processing line: ~ args.state.bg_color_direction ||= 1~ +- Inside source: true +*** True Line Result + args.state.bg_color_direction ||= 1 +** Processing line: ~ bg_r = (args.state.bg_element == 1) ? args.state.bg_color : 0~ +- Inside source: true +*** True Line Result + bg_r = (args.state.bg_element == 1) ? args.state.bg_color : 0 +** Processing line: ~ bg_g = (args.state.bg_element == 2) ? args.state.bg_color : 0~ +- Inside source: true +*** True Line Result + bg_g = (args.state.bg_element == 2) ? args.state.bg_color : 0 +** Processing line: ~ bg_b = (args.state.bg_element == 3) ? args.state.bg_color : 0~ +- Inside source: true +*** True Line Result + bg_b = (args.state.bg_element == 3) ? args.state.bg_color : 0 +** Processing line: ~ args.state.bg_color += args.state.bg_color_direction~ +- Inside source: true +*** True Line Result + args.state.bg_color += args.state.bg_color_direction +** Processing line: ~ if (args.state.bg_color_direction > 0) && (args.state.bg_color >= 255)~ +- Inside source: true +*** True Line Result + if (args.state.bg_color_direction > 0) && (args.state.bg_color >= 255) +** Processing line: ~ args.state.bg_color_direction = -1~ +- Inside source: true +*** True Line Result + args.state.bg_color_direction = -1 +** Processing line: ~ args.state.bg_color = 255~ +- Inside source: true +*** True Line Result + args.state.bg_color = 255 +** Processing line: ~ elsif (args.state.bg_color_direction < 0) && (args.state.bg_color <= 0)~ +- Inside source: true +*** True Line Result + elsif (args.state.bg_color_direction < 0) && (args.state.bg_color <= 0) +** Processing line: ~ args.state.bg_color_direction = 1~ +- Inside source: true +*** True Line Result + args.state.bg_color_direction = 1 +** Processing line: ~ args.state.bg_color = 0~ +- Inside source: true +*** True Line Result + args.state.bg_color = 0 +** Processing line: ~ args.state.bg_element += 1~ +- Inside source: true +*** True Line Result + args.state.bg_element += 1 +** Processing line: ~ if args.state.bg_element >= 4~ +- Inside source: true +*** True Line Result + if args.state.bg_element >= 4 +** Processing line: ~ args.state.bg_element = 1~ +- Inside source: true +*** True Line Result + args.state.bg_element = 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.background_color = [ bg_r, bg_g, bg_b, 255 ]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [ bg_r, bg_g, bg_b, 255 ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.blendmodes ||= [~ +- Inside source: true +*** True Line Result + args.state.blendmodes ||= [ +** Processing line: ~ { name: :none, value: 0 },~ +- Inside source: true +*** True Line Result + { name: :none, value: 0 }, +** Processing line: ~ { name: :blend, value: 1 },~ +- Inside source: true +*** True Line Result + { name: :blend, value: 1 }, +** Processing line: ~ { name: :add, value: 2 },~ +- Inside source: true +*** True Line Result + { name: :add, value: 2 }, +** Processing line: ~ { name: :mod, value: 3 },~ +- Inside source: true +*** True Line Result + { name: :mod, value: 3 }, +** Processing line: ~ { name: :mul, value: 4 }~ +- Inside source: true +*** True Line Result + { name: :mul, value: 4 } +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.x = 0 # reset this, draw_blendmode will increment it.~ +- Inside source: true +*** True Line Result + args.state.x = 0 # reset this, draw_blendmode will increment it. +** Processing line: ~ args.state.blendmodes.each { |blendmode| draw_blendmode args, blendmode }~ +- Inside source: true +*** True Line Result + args.state.blendmodes.each { |blendmode| draw_blendmode args, blendmode } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Advanced Rendering - Render Target Noclear - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Rendering - Render Target Noclear - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/11_render_target_noclear/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/07_advanced_rendering/11_render_target_noclear/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.x ||= 500~ +- Inside source: true +*** True Line Result + args.state.x ||= 500 +** Processing line: ~ args.state.y ||= 350~ +- Inside source: true +*** True Line Result + args.state.y ||= 350 +** Processing line: ~ args.state.xinc ||= 7~ +- Inside source: true +*** True Line Result + args.state.xinc ||= 7 +** Processing line: ~ args.state.yinc ||= 7~ +- Inside source: true +*** True Line Result + args.state.yinc ||= 7 +** Processing line: ~ args.state.bgcolor ||= 1~ +- Inside source: true +*** True Line Result + args.state.bgcolor ||= 1 +** Processing line: ~ args.state.bginc ||= 1~ +- Inside source: true +*** True Line Result + args.state.bginc ||= 1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # clear the render target on the first tick, and then never again. Draw~ +- Inside source: true +*** True Line Result + # clear the render target on the first tick, and then never again. Draw +** Processing line: ~ # another box to it every tick, accumulating over time.~ +- Inside source: true +*** True Line Result + # another box to it every tick, accumulating over time. +** Processing line: ~ clear_target = (args.state.tick_count == 0) || (args.inputs.keyboard.key_down.space)~ +- Inside source: true +*** True Line Result + clear_target = (args.state.tick_count == 0) || (args.inputs.keyboard.key_down.space) +** Processing line: ~ args.render_target(:accumulation).background_color = [ 0, 0, 0, 0 ];~ +- Inside source: true +*** True Line Result + args.render_target(:accumulation).background_color = [ 0, 0, 0, 0 ]; +** Processing line: ~ args.render_target(:accumulation).clear_before_render = clear_target~ +- Inside source: true +*** True Line Result + args.render_target(:accumulation).clear_before_render = clear_target +** Processing line: ~ args.render_target(:accumulation).solids << [args.state.x, args.state.y, 25, 25, 255, 0, 0, 255];~ +- Inside source: true +*** True Line Result + args.render_target(:accumulation).solids << [args.state.x, args.state.y, 25, 25, 255, 0, 0, 255]; +** Processing line: ~ args.state.x += args.state.xinc~ +- Inside source: true +*** True Line Result + args.state.x += args.state.xinc +** Processing line: ~ args.state.y += args.state.yinc~ +- Inside source: true +*** True Line Result + args.state.y += args.state.yinc +** Processing line: ~ args.state.bgcolor += args.state.bginc~ +- Inside source: true +*** True Line Result + args.state.bgcolor += args.state.bginc +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # animation upkeep...change where we draw the next box and what color the~ +- Inside source: true +*** True Line Result + # animation upkeep...change where we draw the next box and what color the +** Processing line: ~ # window background will be.~ +- Inside source: true +*** True Line Result + # window background will be. +** Processing line: ~ if args.state.xinc > 0 && args.state.x >= 1280~ +- Inside source: true +*** True Line Result + if args.state.xinc > 0 && args.state.x >= 1280 +** Processing line: ~ args.state.xinc = -7~ +- Inside source: true +*** True Line Result + args.state.xinc = -7 +** Processing line: ~ elsif args.state.xinc < 0 && args.state.x < 0~ +- Inside source: true +*** True Line Result + elsif args.state.xinc < 0 && args.state.x < 0 +** Processing line: ~ args.state.xinc = 7~ +- Inside source: true +*** True Line Result + args.state.xinc = 7 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.yinc > 0 && args.state.y >= 720~ +- Inside source: true +*** True Line Result + if args.state.yinc > 0 && args.state.y >= 720 +** Processing line: ~ args.state.yinc = -7~ +- Inside source: true +*** True Line Result + args.state.yinc = -7 +** Processing line: ~ elsif args.state.yinc < 0 && args.state.y < 0~ +- Inside source: true +*** True Line Result + elsif args.state.yinc < 0 && args.state.y < 0 +** Processing line: ~ args.state.yinc = 7~ +- Inside source: true +*** True Line Result + args.state.yinc = 7 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.bginc > 0 && args.state.bgcolor >= 255~ +- Inside source: true +*** True Line Result + if args.state.bginc > 0 && args.state.bgcolor >= 255 +** Processing line: ~ args.state.bginc = -1~ +- Inside source: true +*** True Line Result + args.state.bginc = -1 +** Processing line: ~ elsif args.state.bginc < 0 && args.state.bgcolor <= 0~ +- Inside source: true +*** True Line Result + elsif args.state.bginc < 0 && args.state.bgcolor <= 0 +** Processing line: ~ args.state.bginc = 1~ +- Inside source: true +*** True Line Result + args.state.bginc = 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # clear the screen to a shade of blue and draw the render target, which~ +- Inside source: true +*** True Line Result + # clear the screen to a shade of blue and draw the render target, which +** Processing line: ~ # is not clearing every frame, on top of it. Note that you can NOT opt to~ +- Inside source: true +*** True Line Result + # is not clearing every frame, on top of it. Note that you can NOT opt to +** Processing line: ~ # skip clearing the screen, only render targets. The screen clears every~ +- Inside source: true +*** True Line Result + # skip clearing the screen, only render targets. The screen clears every +** Processing line: ~ # frame; double-buffering would prevent correct updates between frames.~ +- Inside source: true +*** True Line Result + # frame; double-buffering would prevent correct updates between frames. +** Processing line: ~ args.outputs.background_color = [ 0, 0, args.state.bgcolor, 255 ]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [ 0, 0, args.state.bgcolor, 255 ] +** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, :accumulation ]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ 0, 0, 1280, 720, :accumulation ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Tweening Lerping Easing Functions - Easing Functions - main.rb~ - Header detected. *** True Line Result @@ -53688,10 +56755,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." + puts "=========================================================" +** Processing line: ~ puts "* INFO: Sprites, Hashes"~ +- Inside source: true +*** True Line Result + puts "* INFO: Sprites, Hashes" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -53972,10 +57055,382 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ +- Inside source: true +*** True Line Result + puts "=========================================================" +** Processing line: ~ puts "* INFO: Sprites, Open Entities"~ +- Inside source: true +*** True Line Result + puts "* INFO: Sprites, Open Entities" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." + puts "* INFO: Please specify the number of sprites to render." +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +- Inside source: true +*** True Line Result + args.gtk.console.set_command "reset_with count: 100" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # init~ +- Inside source: true +*** True Line Result + # init +** Processing line: ~ if args.state.tick_count == 0~ +- Inside source: true +*** True Line Result + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ +- Inside source: true +*** True Line Result + args.state.stars = args.state.star_count.map { |i| new_star args } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # update~ +- Inside source: true +*** True Line Result + # update +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ +- Inside source: true +*** True Line Result + args.state.stars.each { |s| move_star args, s } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render~ +- Inside source: true +*** True Line Result + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ +- Inside source: true +*** True Line Result + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.gtk.current_framerate_primitives +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # resets game, and assigns star count given by user~ +- Inside source: true +*** True Line Result + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ +- Inside source: true +*** True Line Result + def reset_with count: count +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ +- Inside source: true +*** True Line Result + $gtk.args.state.star_count = count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Performance - Sprites As Struct - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Performance - Sprites As Struct - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/09_performance/03_sprites_as_struct/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/09_performance/03_sprites_as_struct/app/main.rb +** Processing line: ~ # create a Struct variant that allows for named parameters on construction.~ +- Inside source: true +*** True Line Result + # create a Struct variant that allows for named parameters on construction. +** Processing line: ~ class NamedStruct < Struct~ +- Inside source: true +*** True Line Result + class NamedStruct < Struct +** Processing line: ~ def initialize **opts~ +- Inside source: true +*** True Line Result + def initialize **opts +** Processing line: ~ super(*members.map { |k| opts[k] })~ +- Inside source: true +*** True Line Result + super(*members.map { |k| opts[k] }) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # create a Star NamedStruct~ +- Inside source: true +*** True Line Result + # create a Star NamedStruct +** Processing line: ~ Star = NamedStruct.new(:x, :y, :w, :h, :path, :s,~ +- Inside source: true +*** True Line Result + Star = NamedStruct.new(:x, :y, :w, :h, :path, :s, +** Processing line: ~ :angle, :angle_anchor_x, :angle_anchor_y,~ +- Inside source: true +*** True Line Result + :angle, :angle_anchor_x, :angle_anchor_y, +** Processing line: ~ :r, :g, :b, :a,~ +- Inside source: true +*** True Line Result + :r, :g, :b, :a, +** Processing line: ~ :tile_x, :tile_y,~ +- Inside source: true +*** True Line Result + :tile_x, :tile_y, +** Processing line: ~ :tile_w, :tile_h,~ +- Inside source: true +*** True Line Result + :tile_w, :tile_h, +** Processing line: ~ :source_x, :source_y,~ +- Inside source: true +*** True Line Result + :source_x, :source_y, +** Processing line: ~ :source_w, :source_h,~ +- Inside source: true +*** True Line Result + :source_w, :source_h, +** Processing line: ~ :flip_horizontally, :flip_vertically,~ +- Inside source: true +*** True Line Result + :flip_horizontally, :flip_vertically, +** Processing line: ~ :blendmode_enum)~ +- Inside source: true +*** True Line Result + :blendmode_enum) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Sprites represented as Structs. They require a little bit more code than Hashes,~ +- Inside source: true +*** True Line Result + # Sprites represented as Structs. They require a little bit more code than Hashes, +** Processing line: ~ # but are the a little faster to render too.~ +- Inside source: true +*** True Line Result + # but are the a little faster to render too. +** Processing line: ~ def random_x args~ +- Inside source: true +*** True Line Result + def random_x args +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ +- Inside source: true +*** True Line Result + (args.grid.w.randomize :ratio) * -1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def random_y args~ +- Inside source: true +*** True Line Result + def random_y args +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ +- Inside source: true +*** True Line Result + (args.grid.h.randomize :ratio) * -1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def random_speed~ +- Inside source: true +*** True Line Result + def random_speed +** Processing line: ~ 1 + (4.randomize :ratio)~ +- Inside source: true +*** True Line Result + 1 + (4.randomize :ratio) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_star args~ +- Inside source: true +*** True Line Result + def new_star args +** Processing line: ~ Star.new x: (random_x args),~ +- Inside source: true +*** True Line Result + Star.new x: (random_x args), +** Processing line: ~ y: (random_y args),~ +- Inside source: true +*** True Line Result + y: (random_y args), +** Processing line: ~ w: 4, h: 4,~ +- Inside source: true +*** True Line Result + w: 4, h: 4, +** Processing line: ~ path: 'sprites/tiny-star.png',~ +- Inside source: true +*** True Line Result + path: 'sprites/tiny-star.png', +** Processing line: ~ s: random_speed~ +- Inside source: true +*** True Line Result + s: random_speed +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def move_star args, star~ +- Inside source: true +*** True Line Result + def move_star args, star +** Processing line: ~ star.x += star[:s]~ +- Inside source: true +*** True Line Result + star.x += star[:s] +** Processing line: ~ star.y += star[:s]~ +- Inside source: true +*** True Line Result + star.y += star[:s] +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ +- Inside source: true +*** True Line Result + if star.x > args.grid.w || star.y > args.grid.h +** Processing line: ~ star.x = (random_x args)~ +- Inside source: true +*** True Line Result + star.x = (random_x args) +** Processing line: ~ star.y = (random_y args)~ +- Inside source: true +*** True Line Result + star.y = (random_y args) +** Processing line: ~ star[:s] = random_speed~ +- Inside source: true +*** True Line Result + star[:s] = random_speed +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.star_count ||= 0~ +- Inside source: true +*** True Line Result + args.state.star_count ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # sets console command when sample app initially opens~ +- Inside source: true +*** True Line Result + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ +- Inside source: true +*** True Line Result + if Kernel.global_tick_count == 0 +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ +- Inside source: true +*** True Line Result + puts "=========================================================" +** Processing line: ~ puts "* INFO: Sprites, Structs"~ +- Inside source: true +*** True Line Result + puts "* INFO: Sprites, Structs" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -54088,10 +57543,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/04_sprites_as_strict_entities/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb + # ./samples/09_performance/04_sprites_as_strict_entities/app/main.rb ** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ - Inside source: true *** True Line Result @@ -54272,10 +57727,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." + puts "=========================================================" +** Processing line: ~ puts "* INFO: Sprites, Strict Entities"~ +- Inside source: true +*** True Line Result + puts "* INFO: Sprites, Strict Entities" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -54388,10 +57859,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/09_performance/04_sprites_as_classes/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/05_sprites_as_classes/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/09_performance/04_sprites_as_classes/app/main.rb + # ./samples/09_performance/05_sprites_as_classes/app/main.rb ** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ - Inside source: true *** True Line Result @@ -54504,6 +57975,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ +- Inside source: true +*** True Line Result + puts "=========================================================" +** Processing line: ~ puts "* INFO: Sprites, Classes"~ +- Inside source: true +*** True Line Result + puts "* INFO: Sprites, Classes" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -54616,10 +58107,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb + # ./samples/09_performance/06_static_sprites_as_classes/app/main.rb ** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ - Inside source: true *** True Line Result @@ -54736,6 +58227,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ +- Inside source: true +*** True Line Result + puts "=========================================================" +** Processing line: ~ puts "* INFO: Static Sprites, Classes"~ +- Inside source: true +*** True Line Result + puts "* INFO: Static Sprites, Classes" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -54760,6 +58271,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result args.state.stars = args.state.star_count.map { |i| Star.new args.grid } +** Processing line: ~ args.outputs.static_sprites << args.state.stars~ +- Inside source: true +*** True Line Result + args.outputs.static_sprites << args.state.stars ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -54784,10 +58299,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ -- Inside source: true -*** True Line Result - args.outputs.sprites << args.state.stars ** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result @@ -54848,10 +58359,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/07_static_sprites_as_classes_with_custom_drawing/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb + # ./samples/09_performance/07_static_sprites_as_classes_with_custom_drawing/app/main.rb ** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ - Inside source: true *** True Line Result @@ -55020,14 +58531,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # alpha, red_saturation, green_saturation, blue_saturation -** Processing line: ~ # flip_horizontally, flip_vertically,~ +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h,~ - Inside source: true *** True Line Result - # flip_horizontally, flip_vertically, -** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ + # tile_x, tile_y, tile_w, tile_h, +** Processing line: ~ # flip_horizontally, flip_vertically,~ - Inside source: true *** True Line Result - # tile_x, tile_y, tile_w, tile_h + # flip_horizontally, flip_vertically, ** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ - Inside source: true *** True Line Result @@ -55036,6 +58547,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # source_x, source_y, source_w, source_h +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_4 is:~ +- Inside source: true +*** True Line Result + # The argument order for ffi_draw.draw_sprite_4 is: +** Processing line: ~ # x, y, w, h,~ +- Inside source: true +*** True Line Result + # x, y, w, h, +** Processing line: ~ # path,~ +- Inside source: true +*** True Line Result + # path, +** Processing line: ~ # angle,~ +- Inside source: true +*** True Line Result + # angle, +** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ +- Inside source: true +*** True Line Result + # alpha, red_saturation, green_saturation, blue_saturation +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h,~ +- Inside source: true +*** True Line Result + # tile_x, tile_y, tile_w, tile_h, +** Processing line: ~ # flip_horizontally, flip_vertically,~ +- Inside source: true +*** True Line Result + # flip_horizontally, flip_vertically, +** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ +- Inside source: true +*** True Line Result + # angle_anchor_x, angle_anchor_y, +** Processing line: ~ # source_x, source_y, source_w, source_h,~ +- Inside source: true +*** True Line Result + # source_x, source_y, source_w, source_h, +** Processing line: ~ # blendmode_enum~ +- Inside source: true +*** True Line Result + # blendmode_enum ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -55064,6 +58619,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if Kernel.global_tick_count == 0 +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ puts "========================================================="~ +- Inside source: true +*** True Line Result + puts "=========================================================" +** Processing line: ~ puts "* INFO: Static Sprites, Classes, Draw Override"~ +- Inside source: true +*** True Line Result + puts "* INFO: Static Sprites, Classes, Draw Override" +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +- Inside source: true +*** True Line Result + puts "* INFO: Please specify the number of sprites to render." ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result @@ -55164,10 +58739,10 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/09_performance/07_collision_limits/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/08_collision_limits/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/09_performance/07_collision_limits/app/main.rb + # ./samples/09_performance/08_collision_limits/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -55400,6 +58975,110 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Debugging - Logging - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Debugging - Logging - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/00_logging/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/10_advanced_debugging/00_logging/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.background_color = [255, 255, 255, 0]~ +- Inside source: true +*** True Line Result + args.outputs.background_color = [255, 255, 255, 0] +** Processing line: ~ if args.state.tick_count == 0~ +- Inside source: true +*** True Line Result + if args.state.tick_count == 0 +** Processing line: ~ args.gtk.log_spam "log level spam"~ +- Inside source: true +*** True Line Result + args.gtk.log_spam "log level spam" +** Processing line: ~ args.gtk.log_debug "log level debug"~ +- Inside source: true +*** True Line Result + args.gtk.log_debug "log level debug" +** Processing line: ~ args.gtk.log_info "log level info"~ +- Inside source: true +*** True Line Result + args.gtk.log_info "log level info" +** Processing line: ~ args.gtk.log_warn "log level warn"~ +- Inside source: true +*** True Line Result + args.gtk.log_warn "log level warn" +** Processing line: ~ args.gtk.log_error "log level error"~ +- Inside source: true +*** True Line Result + args.gtk.log_error "log level error" +** Processing line: ~ args.gtk.log_unfiltered "log level unfiltered"~ +- Inside source: true +*** True Line Result + args.gtk.log_unfiltered "log level unfiltered" +** Processing line: ~ puts "This is a puts call"~ +- Inside source: true +*** True Line Result + puts "This is a puts call" +** Processing line: ~ args.gtk.console.show~ +- Inside source: true +*** True Line Result + args.gtk.console.show +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.tick_count == 60~ +- Inside source: true +*** True Line Result + if args.state.tick_count == 60 +** Processing line: ~ puts "This is a puts call on tick 60"~ +- Inside source: true +*** True Line Result + puts "This is a puts call on tick 60" +** Processing line: ~ elsif args.state.tick_count == 120~ +- Inside source: true +*** True Line Result + elsif args.state.tick_count == 120 +** Processing line: ~ puts "This is a puts call on tick 120"~ +- Inside source: true +*** True Line Result + puts "This is a puts call on tick 120" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Advanced Debugging - Trace Debugging - main.rb~ - Header detected. *** True Line Result @@ -55756,6 +59435,206 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Debugging - Unit Tests - benchmark_api_tests.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Debugging - Unit Tests - benchmark_api_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/benchmark_api_tests.rb~ +- Inside source: true +*** True Line Result + # ./samples/10_advanced_debugging/03_unit_tests/benchmark_api_tests.rb +** Processing line: ~ def test_benchmark_api args, assert~ +- Inside source: true +*** True Line Result + def test_benchmark_api args, assert +** Processing line: ~ result = args.gtk.benchmark iterations: 100,~ +- Inside source: true +*** True Line Result + result = args.gtk.benchmark iterations: 100, +** Processing line: ~ only_one: -> () {~ +- Inside source: true +*** True Line Result + only_one: -> () { +** Processing line: ~ r = 0~ +- Inside source: true +*** True Line Result + r = 0 +** Processing line: ~ (1..100).each do |i|~ +- Inside source: true +*** True Line Result + (1..100).each do |i| +** Processing line: ~ r += 1~ +- Inside source: true +*** True Line Result + r += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ assert.equal! result.first_place.name, :only_one~ +- Inside source: true +*** True Line Result + assert.equal! result.first_place.name, :only_one +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ result = args.gtk.benchmark iterations: 100,~ +- Inside source: true +*** True Line Result + result = args.gtk.benchmark iterations: 100, +** Processing line: ~ iterations_100: -> () {~ +- Inside source: true +*** True Line Result + iterations_100: -> () { +** Processing line: ~ r = 0~ +- Inside source: true +*** True Line Result + r = 0 +** Processing line: ~ (1..100).each do |i|~ +- Inside source: true +*** True Line Result + (1..100).each do |i| +** Processing line: ~ r += 1~ +- Inside source: true +*** True Line Result + r += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ },~ +- Inside source: true +*** True Line Result + }, +** Processing line: ~ iterations_50: -> () {~ +- Inside source: true +*** True Line Result + iterations_50: -> () { +** Processing line: ~ r = 0~ +- Inside source: true +*** True Line Result + r = 0 +** Processing line: ~ (1..50).each do |i|~ +- Inside source: true +*** True Line Result + (1..50).each do |i| +** Processing line: ~ r += 1~ +- Inside source: true +*** True Line Result + r += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ assert.equal! result.first_place.name, :iterations_50~ +- Inside source: true +*** True Line Result + assert.equal! result.first_place.name, :iterations_50 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ result = args.gtk.benchmark iterations: 1,~ +- Inside source: true +*** True Line Result + result = args.gtk.benchmark iterations: 1, +** Processing line: ~ iterations_100: -> () {~ +- Inside source: true +*** True Line Result + iterations_100: -> () { +** Processing line: ~ r = 0~ +- Inside source: true +*** True Line Result + r = 0 +** Processing line: ~ (1..100).each do |i|~ +- Inside source: true +*** True Line Result + (1..100).each do |i| +** Processing line: ~ r += 1~ +- Inside source: true +*** True Line Result + r += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ },~ +- Inside source: true +*** True Line Result + }, +** Processing line: ~ iterations_50: -> () {~ +- Inside source: true +*** True Line Result + iterations_50: -> () { +** Processing line: ~ r = 0~ +- Inside source: true +*** True Line Result + r = 0 +** Processing line: ~ (1..50).each do |i|~ +- Inside source: true +*** True Line Result + (1..50).each do |i| +** Processing line: ~ r += 1~ +- Inside source: true +*** True Line Result + r += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ assert.equal! result.too_small_to_measure, true~ +- Inside source: true +*** True Line Result + assert.equal! result.too_small_to_measure, true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Advanced Debugging - Unit Tests - exception_raising_tests.rb~ - Header detected. *** True Line Result @@ -57868,6 +61747,554 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Advanced Debugging - Unit Tests - pretty_format_tests.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Advanced Debugging - Unit Tests - pretty_format_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/pretty_format_tests.rb~ +- Inside source: true +*** True Line Result + # ./samples/10_advanced_debugging/03_unit_tests/pretty_format_tests.rb +** Processing line: ~ def H opts~ +- Inside source: true +*** True Line Result + def H opts +** Processing line: ~ opts~ +- Inside source: true +*** True Line Result + opts +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def A *opts~ +- Inside source: true +*** True Line Result + def A *opts +** Processing line: ~ opts~ +- Inside source: true +*** True Line Result + opts +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def assert_format args, assert, hash, expected~ +- Inside source: true +*** True Line Result + def assert_format args, assert, hash, expected +** Processing line: ~ actual = args.fn.pretty_format hash~ +- Inside source: true +*** True Line Result + actual = args.fn.pretty_format hash +** Processing line: ~ assert.are_equal! actual, expected~ +- Inside source: true +*** True Line Result + assert.are_equal! actual, expected +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_pretty_print args, assert~ +- Inside source: true +*** True Line Result + def test_pretty_print args, assert +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # hash with single value~ +- Inside source: true +*** True Line Result + # hash with single value +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (H first_name: "John")~ +- Inside source: true +*** True Line Result + input = (H first_name: "John") +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ {:first_name "John"}~ +- Inside source: true +*** True Line Result + {:first_name "John"} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # hash with two values~ +- Inside source: true +*** True Line Result + # hash with two values +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (H first_name: "John", last_name: "Smith")~ +- Inside source: true +*** True Line Result + input = (H first_name: "John", last_name: "Smith") +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ {:first_name "John"~ +- Inside source: true +*** True Line Result + {:first_name "John" +** Processing line: ~ :last_name "Smith"}~ +- Inside source: true +*** True Line Result + :last_name "Smith"} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # hash with inner hash~ +- Inside source: true +*** True Line Result + # hash with inner hash +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (H first_name: "John",~ +- Inside source: true +*** True Line Result + input = (H first_name: "John", +** Processing line: ~ last_name: "Smith",~ +- Inside source: true +*** True Line Result + last_name: "Smith", +** Processing line: ~ middle_initial: "I",~ +- Inside source: true +*** True Line Result + middle_initial: "I", +** Processing line: ~ so: (H first_name: "Pocahontas",~ +- Inside source: true +*** True Line Result + so: (H first_name: "Pocahontas", +** Processing line: ~ last_name: "Tsenacommacah"),~ +- Inside source: true +*** True Line Result + last_name: "Tsenacommacah"), +** Processing line: ~ friends: (A (H first_name: "Side", last_name: "Kick"),~ +- Inside source: true +*** True Line Result + friends: (A (H first_name: "Side", last_name: "Kick"), +** Processing line: ~ (H first_name: "Tim", last_name: "Wizard")))~ +- Inside source: true +*** True Line Result + (H first_name: "Tim", last_name: "Wizard"))) +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ {:first_name "John"~ +- Inside source: true +*** True Line Result + {:first_name "John" +** Processing line: ~ :last_name "Smith"~ +- Inside source: true +*** True Line Result + :last_name "Smith" +** Processing line: ~ :middle_initial "I"~ +- Inside source: true +*** True Line Result + :middle_initial "I" +** Processing line: ~ :so {:first_name "Pocahontas"~ +- Inside source: true +*** True Line Result + :so {:first_name "Pocahontas" +** Processing line: ~ :last_name "Tsenacommacah"}~ +- Inside source: true +*** True Line Result + :last_name "Tsenacommacah"} +** Processing line: ~ :friends [{:first_name "Side"~ +- Inside source: true +*** True Line Result + :friends [{:first_name "Side" +** Processing line: ~ :last_name "Kick"}~ +- Inside source: true +*** True Line Result + :last_name "Kick"} +** Processing line: ~ {:first_name "Tim"~ +- Inside source: true +*** True Line Result + {:first_name "Tim" +** Processing line: ~ :last_name "Wizard"}]}~ +- Inside source: true +*** True Line Result + :last_name "Wizard"}]} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # array with one value~ +- Inside source: true +*** True Line Result + # array with one value +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (A 1)~ +- Inside source: true +*** True Line Result + input = (A 1) +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ [1]~ +- Inside source: true +*** True Line Result + [1] +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # array with multiple values~ +- Inside source: true +*** True Line Result + # array with multiple values +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (A 1, 2, 3)~ +- Inside source: true +*** True Line Result + input = (A 1, 2, 3) +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ [1~ +- Inside source: true +*** True Line Result + [1 +** Processing line: ~ 2~ +- Inside source: true +*** True Line Result + 2 +** Processing line: ~ 3]~ +- Inside source: true +*** True Line Result + 3] +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # array with multiple values hashes~ +- Inside source: true +*** True Line Result + # array with multiple values hashes +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (A (H first_name: "Side", last_name: "Kick"),~ +- Inside source: true +*** True Line Result + input = (A (H first_name: "Side", last_name: "Kick"), +** Processing line: ~ (H first_name: "Tim", last_name: "Wizard"))~ +- Inside source: true +*** True Line Result + (H first_name: "Tim", last_name: "Wizard")) +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ [{:first_name "Side"~ +- Inside source: true +*** True Line Result + [{:first_name "Side" +** Processing line: ~ :last_name "Kick"}~ +- Inside source: true +*** True Line Result + :last_name "Kick"} +** Processing line: ~ {:first_name "Tim"~ +- Inside source: true +*** True Line Result + {:first_name "Tim" +** Processing line: ~ :last_name "Wizard"}]~ +- Inside source: true +*** True Line Result + :last_name "Wizard"}] +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_nested_nested args, assert~ +- Inside source: true +*** True Line Result + def test_nested_nested args, assert +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ # nested array in nested hash~ +- Inside source: true +*** True Line Result + # nested array in nested hash +** Processing line: ~ # =============================~ +- Inside source: true +*** True Line Result + # ============================= +** Processing line: ~ input = (H type: :root,~ +- Inside source: true +*** True Line Result + input = (H type: :root, +** Processing line: ~ text: "Root",~ +- Inside source: true +*** True Line Result + text: "Root", +** Processing line: ~ children: (A (H level: 1,~ +- Inside source: true +*** True Line Result + children: (A (H level: 1, +** Processing line: ~ text: "Level 1",~ +- Inside source: true +*** True Line Result + text: "Level 1", +** Processing line: ~ children: (A (H level: 2,~ +- Inside source: true +*** True Line Result + children: (A (H level: 2, +** Processing line: ~ text: "Level 2",~ +- Inside source: true +*** True Line Result + text: "Level 2", +** Processing line: ~ children: [])))))~ +- Inside source: true +*** True Line Result + children: []))))) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ expected = <<-S~ +- Inside source: true +*** True Line Result + expected = <<-S +** Processing line: ~ {:type :root~ +- Inside source: true +*** True Line Result + {:type :root +** Processing line: ~ :text "Root"~ +- Inside source: true +*** True Line Result + :text "Root" +** Processing line: ~ :children [{:level 1~ +- Inside source: true +*** True Line Result + :children [{:level 1 +** Processing line: ~ :text "Level 1"~ +- Inside source: true +*** True Line Result + :text "Level 1" +** Processing line: ~ :children [{:level 2~ +- Inside source: true +*** True Line Result + :children [{:level 2 +** Processing line: ~ :text "Level 2"~ +- Inside source: true +*** True Line Result + :text "Level 2" +** Processing line: ~ :children []}]}]}~ +- Inside source: true +*** True Line Result + :children []}]}]} +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ (assert_format args, assert, input, expected)~ +- Inside source: true +*** True Line Result + (assert_format args, assert, input, expected) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_scene args, assert~ +- Inside source: true +*** True Line Result + def test_scene args, assert +** Processing line: ~ script = <<-S~ +- Inside source: true +*** True Line Result + script = <<-S +** Processing line: ~ * Scene 1~ +- Inside source: true +*** True Line Result + * Scene 1 +** Processing line: ~ ** Narrator~ +- Inside source: true +*** True Line Result + ** Narrator +** Processing line: ~ They say happy endings don't exist.~ +- Inside source: true +*** True Line Result + They say happy endings don't exist. +** Processing line: ~ ** Narrator~ +- Inside source: true +*** True Line Result + ** Narrator +** Processing line: ~ They say true love is a lie.~ +- Inside source: true +*** True Line Result + They say true love is a lie. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ input = parse_org args, script~ +- Inside source: true +*** True Line Result + input = parse_org args, script +** Processing line: ~ puts (args.fn.pretty_format input)~ +- Inside source: true +*** True Line Result + puts (args.fn.pretty_format input) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Advanced Debugging - Unit Tests - require_tests.rb~ - Header detected. *** True Line Result @@ -58080,10 +62507,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result result = args.gtk.serialize_state args.state -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ +** Processing line: ~ assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ - Inside source: true *** True Line Result - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" ** Processing line: ~~ - Inside source: true *** True Line Result @@ -58100,10 +62527,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result result = args.gtk.serialize_state 'state.txt', args.state -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ +** Processing line: ~ assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ - Inside source: true *** True Line Result - assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" + assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -58296,10 +62723,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result serialized_state = args.gtk.serialize_state args.state -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>9, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}'~ +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>7, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}'~ - Inside source: true *** True Line Result - assert.equal! serialized_state, '{:entity_id=>9, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' + assert.equal! serialized_state, '{:entity_id=>7, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}' ** Processing line: ~~ - Inside source: true *** True Line Result @@ -58528,6 +62955,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def test_serialization_excludes_thrash_count args, assert~ +- Inside source: true +*** True Line Result + def test_serialization_excludes_thrash_count args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ +- Inside source: true +*** True Line Result + GTK::Entity.__reset_id__! +** Processing line: ~ args.state.player.name = "Ryu"~ +- Inside source: true +*** True Line Result + args.state.player.name = "Ryu" +** Processing line: ~ # force a nil pun~ +- Inside source: true +*** True Line Result + # force a nil pun +** Processing line: ~ if args.state.player.age > 30~ +- Inside source: true +*** True Line Result + if args.state.player.age > 30 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ assert.equal! args.state.player.as_hash[:__thrash_count__][:>], 1~ +- Inside source: true +*** True Line Result + assert.equal! args.state.player.as_hash[:__thrash_count__][:>], 1 +** Processing line: ~ result = args.gtk.serialize_state args.state~ +- Inside source: true +*** True Line Result + result = args.gtk.serialize_state args.state +** Processing line: ~ assert.false! (result.include? "__thrash_count__"),~ +- Inside source: true +*** True Line Result + assert.false! (result.include? "__thrash_count__"), +** Processing line: ~ "The __thrash_count__ key exists in state when it shouldn't have."~ +- Inside source: true +*** True Line Result + "The __thrash_count__ key exists in state when it shouldn't have." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -59184,6 +63659,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./samples/11_http/01_retrieve_images/app/main.rb +** Processing line: ~ $gtk.register_cvar 'app.warn_seconds', "seconds to wait before starting", :uint, 11~ +- Inside source: true +*** True Line Result + $gtk.register_cvar 'app.warn_seconds', "seconds to wait before starting", :uint, 11 +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def tick args~ - Inside source: true *** True Line Result @@ -59200,10 +63683,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Show a warning at the start. -** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ +** Processing line: ~ args.state.warning_debounce ||= args.cvars['app.warn_seconds'].value * 60~ - Inside source: true *** True Line Result - args.state.warning_debounce ||= 11 * 60 + args.state.warning_debounce ||= args.cvars['app.warn_seconds'].value * 60 ** Processing line: ~ if args.state.warning_debounce > 0~ - Inside source: true *** True Line Result @@ -59408,22 +63891,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~*** Http - Web Server - main.rb~ +** Processing line: ~*** Http - In Game Web Server Http Get - main.rb~ - Header detected. *** True Line Result *** True Line Result -*** Http - Web Server - main.rb +*** Http - In Game Web Server Http Get - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/11_http/02_web_server/app/main.rb~ +** Processing line: ~ # ./samples/11_http/02_in_game_web_server_http_get/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/11_http/02_web_server/app/main.rb + # ./samples/11_http/02_in_game_web_server_http_get/app/main.rb ** Processing line: ~ def tick args~ - Inside source: true *** True Line Result @@ -59432,6 +63915,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result args.state.port ||= 3000 +** Processing line: ~ args.state.reqnum ||= 0~ +- Inside source: true +*** True Line Result + args.state.reqnum ||= 0 ** Processing line: ~ # by default the embedded webserver runs on port 9001 (the port number is over 9000) and is disabled in a production build~ - Inside source: true *** True Line Result @@ -59544,6 +64031,322 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Http - In Game Web Server Http Post - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Http - In Game Web Server Http Post - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/11_http/03_in_game_web_server_http_post/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/11_http/03_in_game_web_server_http_post/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # defaults~ +- Inside source: true +*** True Line Result + # defaults +** Processing line: ~ args.state.post_button = args.layout.rect(row: 0, col: 0, w: 5, h: 1).merge(text: "execute http_post")~ +- Inside source: true +*** True Line Result + args.state.post_button = args.layout.rect(row: 0, col: 0, w: 5, h: 1).merge(text: "execute http_post") +** Processing line: ~ args.state.post_body_button = args.layout.rect(row: 1, col: 0, w: 5, h: 1).merge(text: "execute http_post_body")~ +- Inside source: true +*** True Line Result + args.state.post_body_button = args.layout.rect(row: 1, col: 0, w: 5, h: 1).merge(text: "execute http_post_body") +** Processing line: ~ args.state.request_to_s ||= ""~ +- Inside source: true +*** True Line Result + args.state.request_to_s ||= "" +** Processing line: ~ args.state.request_body ||= ""~ +- Inside source: true +*** True Line Result + args.state.request_body ||= "" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render~ +- Inside source: true +*** True Line Result + # render +** Processing line: ~ args.state.post_button.yield_self do |b|~ +- Inside source: true +*** True Line Result + args.state.post_button.yield_self do |b| +** Processing line: ~ args.outputs.borders << b~ +- Inside source: true +*** True Line Result + args.outputs.borders << b +** Processing line: ~ args.outputs.labels << b.merge(text: b.text,~ +- Inside source: true +*** True Line Result + args.outputs.labels << b.merge(text: b.text, +** Processing line: ~ y: b.y + 30,~ +- Inside source: true +*** True Line Result + y: b.y + 30, +** Processing line: ~ x: b.x + 10)~ +- Inside source: true +*** True Line Result + x: b.x + 10) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.post_body_button.yield_self do |b|~ +- Inside source: true +*** True Line Result + args.state.post_body_button.yield_self do |b| +** Processing line: ~ args.outputs.borders << b~ +- Inside source: true +*** True Line Result + args.outputs.borders << b +** Processing line: ~ args.outputs.labels << b.merge(text: b.text,~ +- Inside source: true +*** True Line Result + args.outputs.labels << b.merge(text: b.text, +** Processing line: ~ y: b.y + 30,~ +- Inside source: true +*** True Line Result + y: b.y + 30, +** Processing line: ~ x: b.x + 10)~ +- Inside source: true +*** True Line Result + x: b.x + 10) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ draw_label args, 0, 6, "Request:", args.state.request_to_s~ +- Inside source: true +*** True Line Result + draw_label args, 0, 6, "Request:", args.state.request_to_s +** Processing line: ~ draw_label args, 0, 14, "Request Body Unaltered:", args.state.request_body~ +- Inside source: true +*** True Line Result + draw_label args, 0, 14, "Request Body Unaltered:", args.state.request_body +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # input~ +- Inside source: true +*** True Line Result + # input +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ # ============= HTTP_POST =============~ +- Inside source: true +*** True Line Result + # ============= HTTP_POST ============= +** Processing line: ~ if (args.inputs.mouse.inside_rect? args.state.post_button)~ +- Inside source: true +*** True Line Result + if (args.inputs.mouse.inside_rect? args.state.post_button) +** Processing line: ~ # ========= DATA TO SEND ===========~ +- Inside source: true +*** True Line Result + # ========= DATA TO SEND =========== +** Processing line: ~ form_fields = { "userId" => "#{Time.now.to_i}" }~ +- Inside source: true +*** True Line Result + form_fields = { "userId" => "#{Time.now.to_i}" } +** Processing line: ~ # ==================================~ +- Inside source: true +*** True Line Result + # ================================== +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.gtk.http_post "http://localhost:9001/testing",~ +- Inside source: true +*** True Line Result + args.gtk.http_post "http://localhost:9001/testing", +** Processing line: ~ form_fields,~ +- Inside source: true +*** True Line Result + form_fields, +** Processing line: ~ ["Content-Type: application/x-www-form-urlencoded"]~ +- Inside source: true +*** True Line Result + ["Content-Type: application/x-www-form-urlencoded"] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.gtk.notify! "http_post"~ +- Inside source: true +*** True Line Result + args.gtk.notify! "http_post" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ============= HTTP_POST_BODY =============~ +- Inside source: true +*** True Line Result + # ============= HTTP_POST_BODY ============= +** Processing line: ~ if (args.inputs.mouse.inside_rect? args.state.post_body_button)~ +- Inside source: true +*** True Line Result + if (args.inputs.mouse.inside_rect? args.state.post_body_button) +** Processing line: ~ # =========== DATA TO SEND ==============~ +- Inside source: true +*** True Line Result + # =========== DATA TO SEND ============== +** Processing line: ~ json = "{ \"userId\": \"#{Time.now.to_i}\"}"~ +- Inside source: true +*** True Line Result + json = "{ \"userId\": \"#{Time.now.to_i}\"}" +** Processing line: ~ # ==================================~ +- Inside source: true +*** True Line Result + # ================================== +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.gtk.http_post_body "http://localhost:9001/testing",~ +- Inside source: true +*** True Line Result + args.gtk.http_post_body "http://localhost:9001/testing", +** Processing line: ~ json,~ +- Inside source: true +*** True Line Result + json, +** Processing line: ~ ["Content-Type: application/json", "Content-Length: #{json.length}"]~ +- Inside source: true +*** True Line Result + ["Content-Type: application/json", "Content-Length: #{json.length}"] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.gtk.notify! "http_post_body"~ +- Inside source: true +*** True Line Result + args.gtk.notify! "http_post_body" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # calc~ +- Inside source: true +*** True Line Result + # calc +** Processing line: ~ args.inputs.http_requests.each do |r|~ +- Inside source: true +*** True Line Result + args.inputs.http_requests.each do |r| +** Processing line: ~ puts "#{r}"~ +- Inside source: true +*** True Line Result + puts "#{r}" +** Processing line: ~ if r.uri == "/testing"~ +- Inside source: true +*** True Line Result + if r.uri == "/testing" +** Processing line: ~ puts r~ +- Inside source: true +*** True Line Result + puts r +** Processing line: ~ args.state.request_to_s = "#{r}"~ +- Inside source: true +*** True Line Result + args.state.request_to_s = "#{r}" +** Processing line: ~ args.state.request_body = r.raw_body~ +- Inside source: true +*** True Line Result + args.state.request_body = r.raw_body +** Processing line: ~ r.respond 200, "ok"~ +- Inside source: true +*** True Line Result + r.respond 200, "ok" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def draw_label args, row, col, header, text~ +- Inside source: true +*** True Line Result + def draw_label args, row, col, header, text +** Processing line: ~ label_pos = args.layout.rect(row: row, col: col, w: 0, h: 0)~ +- Inside source: true +*** True Line Result + label_pos = args.layout.rect(row: row, col: col, w: 0, h: 0) +** Processing line: ~ args.outputs.labels << "#{header}\n\n#{text}".wrapped_lines(80).map_with_index do |l, i|~ +- Inside source: true +*** True Line Result + args.outputs.labels << "#{header}\n\n#{text}".wrapped_lines(80).map_with_index do |l, i| +** Processing line: ~ { x: label_pos.x, y: label_pos.y - (i * 15), text: l, size_enum: -2 }~ +- Inside source: true +*** True Line Result + { x: label_pos.x, y: label_pos.y - (i * 15), text: l, size_enum: -2 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** C Extensions - Basics - main.rb~ - Header detected. *** True Line Result @@ -67344,10 +72147,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Breadth First Search tick is called -** Processing line: ~ $breadcrumbs ||= Breadcrumbs.new(args)~ +** Processing line: ~ $breadcrumbs ||= Breadcrumbs.new~ - Inside source: true *** True Line Result - $breadcrumbs ||= Breadcrumbs.new(args) + $breadcrumbs ||= Breadcrumbs.new ** Processing line: ~ $breadcrumbs.args = args~ - Inside source: true *** True Line Result @@ -69952,10 +74755,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Breadth First Search tick is called -** Processing line: ~ $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new(args)~ +** Processing line: ~ $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new~ - Inside source: true *** True Line Result - $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new(args) + $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new ** Processing line: ~ $early_exit_breadth_first_search.args = args~ - Inside source: true *** True Line Result @@ -73356,10 +78159,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Dijkstra tick method is called -** Processing line: ~ $movement_costs ||= Movement_Costs.new(args)~ +** Processing line: ~ $movement_costs ||= Movement_Costs.new~ - Inside source: true *** True Line Result - $movement_costs ||= Movement_Costs.new(args) + $movement_costs ||= Movement_Costs.new ** Processing line: ~ $movement_costs.args = args~ - Inside source: true *** True Line Result @@ -77304,10 +82107,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Breadth First Search tick is called -** Processing line: ~ $heuristic_with_walls ||= Heuristic_With_Walls.new(args)~ +** Processing line: ~ $heuristic_with_walls ||= Heuristic_With_Walls.new~ - Inside source: true *** True Line Result - $heuristic_with_walls ||= Heuristic_With_Walls.new(args) + $heuristic_with_walls ||= Heuristic_With_Walls.new ** Processing line: ~ $heuristic_with_walls.args = args~ - Inside source: true *** True Line Result @@ -81384,10 +86187,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Breadth First Search tick is called -** Processing line: ~ $heuristic ||= Heuristic.new(args)~ +** Processing line: ~ $heuristic ||= Heuristic.new~ - Inside source: true *** True Line Result - $heuristic ||= Heuristic.new(args) + $heuristic ||= Heuristic.new ** Processing line: ~ $heuristic.args = args~ - Inside source: true *** True Line Result @@ -85528,10 +90331,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Every tick, new args are passed, and the Breadth First Search tick is called -** Processing line: ~ $a_star_algorithm ||= A_Star_Algorithm.new(args)~ +** Processing line: ~ $a_star_algorithm ||= A_Star_Algorithm.new~ - Inside source: true *** True Line Result - $a_star_algorithm ||= A_Star_Algorithm.new(args) + $a_star_algorithm ||= A_Star_Algorithm.new ** Processing line: ~ $a_star_algorithm.args = args~ - Inside source: true *** True Line Result @@ -87688,6 +92491,1438 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** 3d - Yaw Pitch Roll - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** 3d - Yaw Pitch Roll - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_3d/03_yaw_pitch_roll/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_3d/03_yaw_pitch_roll/app/main.rb +** Processing line: ~ class Game~ +- Inside source: true +*** True Line Result + class Game +** Processing line: ~ attr_gtk~ +- Inside source: true +*** True Line Result + attr_gtk +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick~ +- Inside source: true +*** True Line Result + def tick +** Processing line: ~ defaults~ +- Inside source: true +*** True Line Result + defaults +** Processing line: ~ render~ +- Inside source: true +*** True Line Result + render +** Processing line: ~ input~ +- Inside source: true +*** True Line Result + input +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def matrix_mul m, v~ +- Inside source: true +*** True Line Result + def matrix_mul m, v +** Processing line: ~ (hmap x: ((m.x.x * v.x) + (m.x.y * v.y) + (m.x.z * v.z) + (m.x.w * v.w)),~ +- Inside source: true +*** True Line Result + (hmap x: ((m.x.x * v.x) + (m.x.y * v.y) + (m.x.z * v.z) + (m.x.w * v.w)), +** Processing line: ~ y: ((m.y.x * v.x) + (m.y.y * v.y) + (m.y.z * v.z) + (m.y.w * v.w)),~ +- Inside source: true +*** True Line Result + y: ((m.y.x * v.x) + (m.y.y * v.y) + (m.y.z * v.z) + (m.y.w * v.w)), +** Processing line: ~ z: ((m.z.x * v.x) + (m.z.y * v.y) + (m.z.z * v.z) + (m.z.w * v.w)),~ +- Inside source: true +*** True Line Result + z: ((m.z.x * v.x) + (m.z.y * v.y) + (m.z.z * v.z) + (m.z.w * v.w)), +** Processing line: ~ w: ((m.w.x * v.x) + (m.w.y * v.y) + (m.w.z * v.z) + (m.w.w * v.w)))~ +- Inside source: true +*** True Line Result + w: ((m.w.x * v.x) + (m.w.y * v.y) + (m.w.z * v.z) + (m.w.w * v.w))) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_ship~ +- Inside source: true +*** True Line Result + def player_ship +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ # engine back~ +- Inside source: true +*** True Line Result + # engine back +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -1, z: 1, w: 0 }, +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 1, z: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 1, z: 1, w: 0 }, +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 1, z: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 1, z: 1, w: 0 }, +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -1, z: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -1, z: 1, w: 0 }, +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -1, z: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # engine front~ +- Inside source: true +*** True Line Result + # engine front +** Processing line: ~ { x: -1, y: -1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -1, z: -1, w: 0 }, +** Processing line: ~ { x: -1, y: 1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 1, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, y: 1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 1, z: -1, w: 0 }, +** Processing line: ~ { x: 1, y: 1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 1, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: 1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 1, z: -1, w: 0 }, +** Processing line: ~ { x: 1, y: -1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -1, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: -1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -1, z: -1, w: 0 }, +** Processing line: ~ { x: -1, y: -1, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -1, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # engine left~ +- Inside source: true +*** True Line Result + # engine left +** Processing line: ~ { x: -1, z: -1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: -1, y: -1, w: 0 }, +** Processing line: ~ { x: -1, z: -1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: -1, y: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, z: -1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: -1, y: 1, w: 0 }, +** Processing line: ~ { x: -1, z: 1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: 1, y: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, z: 1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: 1, y: 1, w: 0 }, +** Processing line: ~ { x: -1, z: 1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: 1, y: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, z: 1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: 1, y: -1, w: 0 }, +** Processing line: ~ { x: -1, z: -1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, z: -1, y: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # engine right~ +- Inside source: true +*** True Line Result + # engine right +** Processing line: ~ { x: 1, z: -1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: -1, y: -1, w: 0 }, +** Processing line: ~ { x: 1, z: -1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: -1, y: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, z: -1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: -1, y: 1, w: 0 }, +** Processing line: ~ { x: 1, z: 1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: 1, y: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, z: 1, y: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: 1, y: 1, w: 0 }, +** Processing line: ~ { x: 1, z: 1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: 1, y: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, z: 1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: 1, y: -1, w: 0 }, +** Processing line: ~ { x: 1, z: -1, y: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, z: -1, y: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # top front of engine to front of ship~ +- Inside source: true +*** True Line Result + # top front of engine to front of ship +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 1, z: 1, w: 0 }, +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 0, y: -1, z: 9, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 0, y: -1, z: 9, w: 0 }, +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 1, z: 1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # bottom front of engine~ +- Inside source: true +*** True Line Result + # bottom front of engine +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -1, z: 1, w: 0 }, +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 0, y: -1, z: 9, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -1, z: 1, w: 0 }, +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 0, y: -1, z: 9, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # right wing~ +- Inside source: true +*** True Line Result + # right wing +** Processing line: ~ # front of wing~ +- Inside source: true +*** True Line Result + # front of wing +** Processing line: ~ { x: 1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 10, y: 0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 10, y: 0.10, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # back of wing~ +- Inside source: true +*** True Line Result + # back of wing +** Processing line: ~ { x: 1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 10, y: 0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 10, y: 0.10, z: -2, w: 0 }, +** Processing line: ~ { x: 8, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 8, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # front of wing~ +- Inside source: true +*** True Line Result + # front of wing +** Processing line: ~ { x: 1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 10, y: -0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 10, y: -0.10, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # back of wing~ +- Inside source: true +*** True Line Result + # back of wing +** Processing line: ~ { x: 1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 10, y: -0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 10, y: -0.10, z: -2, w: 0 }, +** Processing line: ~ { x: 8, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 8, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # left wing~ +- Inside source: true +*** True Line Result + # left wing +** Processing line: ~ # front of wing~ +- Inside source: true +*** True Line Result + # front of wing +** Processing line: ~ { x: -1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -10, y: 0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -10, y: 0.10, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # back of wing~ +- Inside source: true +*** True Line Result + # back of wing +** Processing line: ~ { x: -1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -10, y: 0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -10, y: 0.10, z: -2, w: 0 }, +** Processing line: ~ { x: -8, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -8, y: 0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # front of wing~ +- Inside source: true +*** True Line Result + # front of wing +** Processing line: ~ { x: -1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -10, y: -0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -10, y: -0.10, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # back of wing~ +- Inside source: true +*** True Line Result + # back of wing +** Processing line: ~ { x: -1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -9, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -10, y: -0.10, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -10, y: -0.10, z: -2, w: 0 }, +** Processing line: ~ { x: -8, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -8, y: -0.10, z: -1, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # left fin~ +- Inside source: true +*** True Line Result + # left fin +** Processing line: ~ # top~ +- Inside source: true +*** True Line Result + # top +** Processing line: ~ { x: -1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1.1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -1.1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1.1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -1.1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # bottom~ +- Inside source: true +*** True Line Result + # bottom +** Processing line: ~ { x: -1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1.1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: -1.1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: -1.1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: -1.1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: -1.1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # right fin~ +- Inside source: true +*** True Line Result + # right fin +** Processing line: ~ { x: 1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1.1, y: 0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: 0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 1.1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1.1, y: 0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: 0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 1.1, y: 3, z: -3, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: 3, z: -3, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # bottom~ +- Inside source: true +*** True Line Result + # bottom +** Processing line: ~ { x: 1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1.1, y: -0.10, z: 1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: -0.10, z: 1, w: 0 }, +** Processing line: ~ { x: 1.1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: -2, z: -2, w: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: 1.1, y: -0.10, z: -1, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: -0.10, z: -1, w: 0 }, +** Processing line: ~ { x: 1.1, y: -2, z: -2, w: 0 },~ +- Inside source: true +*** True Line Result + { x: 1.1, y: -2, z: -2, w: 0 }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults~ +- Inside source: true +*** True Line Result + def defaults +** Processing line: ~ state.points ||= player_ship~ +- Inside source: true +*** True Line Result + state.points ||= player_ship +** Processing line: ~ state.shifted_points ||= state.points.map { |point| point }~ +- Inside source: true +*** True Line Result + state.shifted_points ||= state.points.map { |point| point } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.scale ||= 1~ +- Inside source: true +*** True Line Result + state.scale ||= 1 +** Processing line: ~ state.angle_x ||= 0~ +- Inside source: true +*** True Line Result + state.angle_x ||= 0 +** Processing line: ~ state.angle_y ||= 0~ +- Inside source: true +*** True Line Result + state.angle_y ||= 0 +** Processing line: ~ state.angle_z ||= 0~ +- Inside source: true +*** True Line Result + state.angle_z ||= 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def matrix_new x0, y0, z0, w0, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3~ +- Inside source: true +*** True Line Result + def matrix_new x0, y0, z0, w0, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3 +** Processing line: ~ (hmap x: (hmap x: x0, y: y0, z: z0, w: w0),~ +- Inside source: true +*** True Line Result + (hmap x: (hmap x: x0, y: y0, z: z0, w: w0), +** Processing line: ~ y: (hmap x: x1, y: y1, z: z1, w: w1),~ +- Inside source: true +*** True Line Result + y: (hmap x: x1, y: y1, z: z1, w: w1), +** Processing line: ~ z: (hmap x: x2, y: y2, z: z2, w: w2),~ +- Inside source: true +*** True Line Result + z: (hmap x: x2, y: y2, z: z2, w: w2), +** Processing line: ~ w: (hmap x: x3, y: y3, z: z3, w: w3))~ +- Inside source: true +*** True Line Result + w: (hmap x: x3, y: y3, z: z3, w: w3)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def angle_z_matrix degrees~ +- Inside source: true +*** True Line Result + def angle_z_matrix degrees +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +- Inside source: true +*** True Line Result + cos_t = Math.cos degrees.to_radians +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +- Inside source: true +*** True Line Result + sin_t = Math.sin degrees.to_radians +** Processing line: ~ (matrix_new cos_t, -sin_t, 0, 0,~ +- Inside source: true +*** True Line Result + (matrix_new cos_t, -sin_t, 0, 0, +** Processing line: ~ sin_t, cos_t, 0, 0,~ +- Inside source: true +*** True Line Result + sin_t, cos_t, 0, 0, +** Processing line: ~ 0, 0, 1, 0,~ +- Inside source: true +*** True Line Result + 0, 0, 1, 0, +** Processing line: ~ 0, 0, 0, 1)~ +- Inside source: true +*** True Line Result + 0, 0, 0, 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def angle_y_matrix degrees~ +- Inside source: true +*** True Line Result + def angle_y_matrix degrees +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +- Inside source: true +*** True Line Result + cos_t = Math.cos degrees.to_radians +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +- Inside source: true +*** True Line Result + sin_t = Math.sin degrees.to_radians +** Processing line: ~ (matrix_new cos_t, 0, sin_t, 0,~ +- Inside source: true +*** True Line Result + (matrix_new cos_t, 0, sin_t, 0, +** Processing line: ~ 0, 1, 0, 0,~ +- Inside source: true +*** True Line Result + 0, 1, 0, 0, +** Processing line: ~ -sin_t, 0, cos_t, 0,~ +- Inside source: true +*** True Line Result + -sin_t, 0, cos_t, 0, +** Processing line: ~ 0, 0, 0, 1)~ +- Inside source: true +*** True Line Result + 0, 0, 0, 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def angle_x_matrix degrees~ +- Inside source: true +*** True Line Result + def angle_x_matrix degrees +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +- Inside source: true +*** True Line Result + cos_t = Math.cos degrees.to_radians +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +- Inside source: true +*** True Line Result + sin_t = Math.sin degrees.to_radians +** Processing line: ~ (matrix_new 1, 0, 0, 0,~ +- Inside source: true +*** True Line Result + (matrix_new 1, 0, 0, 0, +** Processing line: ~ 0, cos_t, -sin_t, 0,~ +- Inside source: true +*** True Line Result + 0, cos_t, -sin_t, 0, +** Processing line: ~ 0, sin_t, cos_t, 0,~ +- Inside source: true +*** True Line Result + 0, sin_t, cos_t, 0, +** Processing line: ~ 0, 0, 0, 1)~ +- Inside source: true +*** True Line Result + 0, 0, 0, 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def scale_matrix factor~ +- Inside source: true +*** True Line Result + def scale_matrix factor +** Processing line: ~ (matrix_new factor, 0, 0, 0,~ +- Inside source: true +*** True Line Result + (matrix_new factor, 0, 0, 0, +** Processing line: ~ 0, factor, 0, 0,~ +- Inside source: true +*** True Line Result + 0, factor, 0, 0, +** Processing line: ~ 0, 0, factor, 0,~ +- Inside source: true +*** True Line Result + 0, 0, factor, 0, +** Processing line: ~ 0, 0, 0, 1)~ +- Inside source: true +*** True Line Result + 0, 0, 0, 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input~ +- Inside source: true +*** True Line Result + def input +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.p)~ +- Inside source: true +*** True Line Result + if (inputs.keyboard.shift && inputs.keyboard.p) +** Processing line: ~ state.scale -= 0.1~ +- Inside source: true +*** True Line Result + state.scale -= 0.1 +** Processing line: ~ elsif inputs.keyboard.p~ +- Inside source: true +*** True Line Result + elsif inputs.keyboard.p +** Processing line: ~ state.scale += 0.1~ +- Inside source: true +*** True Line Result + state.scale += 0.1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if inputs.mouse.wheel~ +- Inside source: true +*** True Line Result + if inputs.mouse.wheel +** Processing line: ~ state.scale += inputs.mouse.wheel.y~ +- Inside source: true +*** True Line Result + state.scale += inputs.mouse.wheel.y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.scale = state.scale.clamp(0.1, 1000)~ +- Inside source: true +*** True Line Result + state.scale = state.scale.clamp(0.1, 1000) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.y) || inputs.keyboard.right~ +- Inside source: true +*** True Line Result + if (inputs.keyboard.shift && inputs.keyboard.y) || inputs.keyboard.right +** Processing line: ~ state.angle_y += 1~ +- Inside source: true +*** True Line Result + state.angle_y += 1 +** Processing line: ~ elsif (inputs.keyboard.y) || inputs.keyboard.left~ +- Inside source: true +*** True Line Result + elsif (inputs.keyboard.y) || inputs.keyboard.left +** Processing line: ~ state.angle_y -= 1~ +- Inside source: true +*** True Line Result + state.angle_y -= 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.x) || inputs.keyboard.down~ +- Inside source: true +*** True Line Result + if (inputs.keyboard.shift && inputs.keyboard.x) || inputs.keyboard.down +** Processing line: ~ state.angle_x -= 1~ +- Inside source: true +*** True Line Result + state.angle_x -= 1 +** Processing line: ~ elsif (inputs.keyboard.x || inputs.keyboard.up)~ +- Inside source: true +*** True Line Result + elsif (inputs.keyboard.x || inputs.keyboard.up) +** Processing line: ~ state.angle_x += 1~ +- Inside source: true +*** True Line Result + state.angle_x += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if inputs.keyboard.shift && inputs.keyboard.z~ +- Inside source: true +*** True Line Result + if inputs.keyboard.shift && inputs.keyboard.z +** Processing line: ~ state.angle_z += 1~ +- Inside source: true +*** True Line Result + state.angle_z += 1 +** Processing line: ~ elsif inputs.keyboard.z~ +- Inside source: true +*** True Line Result + elsif inputs.keyboard.z +** Processing line: ~ state.angle_z -= 1~ +- Inside source: true +*** True Line Result + state.angle_z -= 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if inputs.keyboard.zero~ +- Inside source: true +*** True Line Result + if inputs.keyboard.zero +** Processing line: ~ state.angle_x = 0~ +- Inside source: true +*** True Line Result + state.angle_x = 0 +** Processing line: ~ state.angle_y = 0~ +- Inside source: true +*** True Line Result + state.angle_y = 0 +** Processing line: ~ state.angle_z = 0~ +- Inside source: true +*** True Line Result + state.angle_z = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ angle_x = state.angle_x~ +- Inside source: true +*** True Line Result + angle_x = state.angle_x +** Processing line: ~ angle_y = state.angle_y~ +- Inside source: true +*** True Line Result + angle_y = state.angle_y +** Processing line: ~ angle_z = state.angle_z~ +- Inside source: true +*** True Line Result + angle_z = state.angle_z +** Processing line: ~ scale = state.scale~ +- Inside source: true +*** True Line Result + scale = state.scale +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ s_matrix = scale_matrix state.scale~ +- Inside source: true +*** True Line Result + s_matrix = scale_matrix state.scale +** Processing line: ~ x_matrix = angle_z_matrix angle_z~ +- Inside source: true +*** True Line Result + x_matrix = angle_z_matrix angle_z +** Processing line: ~ y_matrix = angle_y_matrix angle_y~ +- Inside source: true +*** True Line Result + y_matrix = angle_y_matrix angle_y +** Processing line: ~ z_matrix = angle_x_matrix angle_x~ +- Inside source: true +*** True Line Result + z_matrix = angle_x_matrix angle_x +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.shifted_points = state.points.map do |point|~ +- Inside source: true +*** True Line Result + state.shifted_points = state.points.map do |point| +** Processing line: ~ (matrix_mul s_matrix,~ +- Inside source: true +*** True Line Result + (matrix_mul s_matrix, +** Processing line: ~ (matrix_mul z_matrix,~ +- Inside source: true +*** True Line Result + (matrix_mul z_matrix, +** Processing line: ~ (matrix_mul x_matrix,~ +- Inside source: true +*** True Line Result + (matrix_mul x_matrix, +** Processing line: ~ (matrix_mul y_matrix, point)))).merge(original: point)~ +- Inside source: true +*** True Line Result + (matrix_mul y_matrix, point)))).merge(original: point) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def thick_line line~ +- Inside source: true +*** True Line Result + def thick_line line +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ line.merge(y: line.y - 1, y2: line.y2 - 1, r: 0, g: 0, b: 0),~ +- Inside source: true +*** True Line Result + line.merge(y: line.y - 1, y2: line.y2 - 1, r: 0, g: 0, b: 0), +** Processing line: ~ line.merge(x: line.x - 1, x2: line.x2 - 1, r: 0, g: 0, b: 0),~ +- Inside source: true +*** True Line Result + line.merge(x: line.x - 1, x2: line.x2 - 1, r: 0, g: 0, b: 0), +** Processing line: ~ line.merge(x: line.x - 0, x2: line.x2 - 0, r: 0, g: 0, b: 0),~ +- Inside source: true +*** True Line Result + line.merge(x: line.x - 0, x2: line.x2 - 0, r: 0, g: 0, b: 0), +** Processing line: ~ line.merge(y: line.y + 1, y2: line.y2 + 1, r: 0, g: 0, b: 0),~ +- Inside source: true +*** True Line Result + line.merge(y: line.y + 1, y2: line.y2 + 1, r: 0, g: 0, b: 0), +** Processing line: ~ line.merge(x: line.x + 1, x2: line.x2 + 1, r: 0, g: 0, b: 0)~ +- Inside source: true +*** True Line Result + line.merge(x: line.x + 1, x2: line.x2 + 1, r: 0, g: 0, b: 0) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render~ +- Inside source: true +*** True Line Result + def render +** Processing line: ~ outputs.lines << state.shifted_points.each_slice(2).map do |(p1, p2)|~ +- Inside source: true +*** True Line Result + outputs.lines << state.shifted_points.each_slice(2).map do |(p1, p2)| +** Processing line: ~ perc = 0~ +- Inside source: true +*** True Line Result + perc = 0 +** Processing line: ~ thick_line({ x: p1.x.*(10) + 640, y: p1.y.*(10) + 320,~ +- Inside source: true +*** True Line Result + thick_line({ x: p1.x.*(10) + 640, y: p1.y.*(10) + 320, +** Processing line: ~ x2: p2.x.*(10) + 640, y2: p2.y.*(10) + 320,~ +- Inside source: true +*** True Line Result + x2: p2.x.*(10) + 640, y2: p2.y.*(10) + 320, +** Processing line: ~ r: 255 * perc,~ +- Inside source: true +*** True Line Result + r: 255 * perc, +** Processing line: ~ g: 255 * perc,~ +- Inside source: true +*** True Line Result + g: 255 * perc, +** Processing line: ~ b: 255 * perc })~ +- Inside source: true +*** True Line Result + b: 255 * perc }) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << [ 10, 700, "angle_x: #{state.angle_x.to_sf}", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [ 10, 700, "angle_x: #{state.angle_x.to_sf}", 0] +** Processing line: ~ outputs.labels << [ 10, 670, "x, shift+x", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [ 10, 670, "x, shift+x", 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << [210, 700, "angle_y: #{state.angle_y.to_sf}", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [210, 700, "angle_y: #{state.angle_y.to_sf}", 0] +** Processing line: ~ outputs.labels << [210, 670, "y, shift+y", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [210, 670, "y, shift+y", 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << [410, 700, "angle_z: #{state.angle_z.to_sf}", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [410, 700, "angle_z: #{state.angle_z.to_sf}", 0] +** Processing line: ~ outputs.labels << [410, 670, "z, shift+z", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [410, 670, "z, shift+z", 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << [610, 700, "scale: #{state.scale.to_sf}", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [610, 700, "scale: #{state.scale.to_sf}", 0] +** Processing line: ~ outputs.labels << [610, 670, "p, shift+p", 0]~ +- Inside source: true +*** True Line Result + outputs.labels << [610, 670, "p, shift+p", 0] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $game = Game.new~ +- Inside source: true +*** True Line Result + $game = Game.new +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ $game.args = args~ +- Inside source: true +*** True Line Result + $game.args = args +** Processing line: ~ $game.tick~ +- Inside source: true +*** True Line Result + $game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def set_angles x, y, z~ +- Inside source: true +*** True Line Result + def set_angles x, y, z +** Processing line: ~ $game.state.angle_x = x~ +- Inside source: true +*** True Line Result + $game.state.angle_x = x +** Processing line: ~ $game.state.angle_y = y~ +- Inside source: true +*** True Line Result + $game.state.angle_y = y +** Processing line: ~ $game.state.angle_z = z~ +- Inside source: true +*** True Line Result + $game.state.angle_z = z +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Arcade - Bullet Hell - main.rb~ - Header detected. *** True Line Result @@ -90176,18 +96411,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def render_score -** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ +** Processing line: ~ outputs.primitives << { x: 10, y: 710, text: "HI SCORE: #{state.hi_score}", **large_white_typeset }~ - Inside source: true *** True Line Result - outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label -** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ + outputs.primitives << { x: 10, y: 710, text: "HI SCORE: #{state.hi_score}", **large_white_typeset } +** Processing line: ~ outputs.primitives << { x: 10, y: 680, text: "SCORE: #{state.score}", **large_white_typeset }~ - Inside source: true *** True Line Result - outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label -** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ + outputs.primitives << { x: 10, y: 680, text: "SCORE: #{state.score}", **large_white_typeset } +** Processing line: ~ outputs.primitives << { x: 10, y: 650, text: "DIFFICULTY: #{state.difficulty.upcase}", **large_white_typeset }~ - Inside source: true *** True Line Result - outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + outputs.primitives << { x: 10, y: 650, text: "DIFFICULTY: #{state.difficulty.upcase}", **large_white_typeset } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90212,54 +96447,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << { x: 640, y: 700, text: "Flappy Dragon", size_enum: 50, alignment_enum: 1, **white }~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ + outputs.labels << { x: 640, y: 700, text: "Flappy Dragon", size_enum: 50, alignment_enum: 1, **white } +** Processing line: ~ outputs.labels << { x: 640, y: 500, text: "Instructions: Press Spacebar to flap. Don't die.", size_enum: 4, alignment_enum: 1, **white }~ - Inside source: true *** True Line Result - outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ + outputs.labels << { x: 640, y: 500, text: "Instructions: Press Spacebar to flap. Don't die.", size_enum: 4, alignment_enum: 1, **white } +** Processing line: ~ outputs.labels << { x: 430, y: 430, text: "[Tab] Change difficulty", size_enum: 4, alignment_enum: 0, **white }~ - Inside source: true *** True Line Result - outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ + outputs.labels << { x: 430, y: 430, text: "[Tab] Change difficulty", size_enum: 4, alignment_enum: 0, **white } +** Processing line: ~ outputs.labels << { x: 430, y: 400, text: "[Enter] Start at New Difficulty ", size_enum: 4, alignment_enum: 0, **white }~ - Inside source: true *** True Line Result - outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ + outputs.labels << { x: 430, y: 400, text: "[Enter] Start at New Difficulty ", size_enum: 4, alignment_enum: 0, **white } +** Processing line: ~ outputs.labels << { x: 430, y: 370, text: "[Escape] Cancel/Resume ", size_enum: 4, alignment_enum: 0, **white }~ - Inside source: true *** True Line Result - outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ + outputs.labels << { x: 430, y: 370, text: "[Escape] Cancel/Resume ", size_enum: 4, alignment_enum: 0, **white } +** Processing line: ~ outputs.labels << { x: 640, y: 300, text: "(mouse, touch, and game controllers work, too!) ", size_enum: 4, alignment_enum: 1, **white }~ - Inside source: true *** True Line Result - outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ + outputs.labels << { x: 640, y: 300, text: "(mouse, touch, and game controllers work, too!) ", size_enum: 4, alignment_enum: 1, **white } +** Processing line: ~ outputs.labels << { x: 640, y: 200, text: "Difficulty: #{state.new_difficulty.capitalize}", size_enum: 4, alignment_enum: 1, **white }~ - Inside source: true *** True Line Result - outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + outputs.labels << { x: 640, y: 200, text: "Difficulty: #{state.new_difficulty.capitalize}", size_enum: 4, alignment_enum: 1, **white } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ +** Processing line: ~ outputs.labels << { x: 10, y: 100, text: "Code: @amirrajan", **white }~ - Inside source: true *** True Line Result - outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ + outputs.labels << { x: 10, y: 100, text: "Code: @amirrajan", **white } +** Processing line: ~ outputs.labels << { x: 10, y: 80, text: "Art: @mobypixel", **white }~ - Inside source: true *** True Line Result - outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ + outputs.labels << { x: 10, y: 80, text: "Art: @mobypixel", **white } +** Processing line: ~ outputs.labels << { x: 10, y: 60, text: "Music: @mobypixel", **white }~ - Inside source: true *** True Line Result - outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ + outputs.labels << { x: 10, y: 60, text: "Music: @mobypixel", **white } +** Processing line: ~ outputs.labels << { x: 10, y: 40, text: "Engine: DragonRuby GTK", **white }~ - Inside source: true *** True Line Result - outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + outputs.labels << { x: 10, y: 40, text: "Engine: DragonRuby GTK", **white } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90272,10 +96507,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def render_overlay -** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ +** Processing line: ~ overlay_rect = grid.rect.scale_rect(1.1, 0, 0)~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + overlay_rect = grid.rect.scale_rect(1.1, 0, 0) +** Processing line: ~ outputs.primitives << { x: overlay_rect.x,~ +- Inside source: true +*** True Line Result + outputs.primitives << { x: overlay_rect.x, +** Processing line: ~ y: overlay_rect.y,~ +- Inside source: true +*** True Line Result + y: overlay_rect.y, +** Processing line: ~ w: overlay_rect.w,~ +- Inside source: true +*** True Line Result + w: overlay_rect.w, +** Processing line: ~ h: overlay_rect.h,~ +- Inside source: true +*** True Line Result + h: overlay_rect.h, +** Processing line: ~ r: 0, g: 0, b: 0, a: 230 }.solid!~ +- Inside source: true +*** True Line Result + r: 0, g: 0, b: 0, a: 230 }.solid! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90324,22 +96579,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless state.scene == :game -** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ +** Processing line: ~ outputs.labels << { x: 638, y: 358, text: score_text, size_enum: 20, alignment_enum: 1 }~ - Inside source: true *** True Line Result - outputs.labels << [638, 358, score_text, 20, 1] -** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ + outputs.labels << { x: 638, y: 358, text: score_text, size_enum: 20, alignment_enum: 1 } +** Processing line: ~ outputs.labels << { x: 635, y: 360, text: score_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ + outputs.labels << { x: 635, y: 360, text: score_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } +** Processing line: ~ outputs.labels << { x: 638, y: 428, text: countdown_text, size_enum: 20, alignment_enum: 1 }~ - Inside source: true *** True Line Result - outputs.labels << [638, 428, countdown_text, 20, 1] -** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ + outputs.labels << { x: 638, y: 428, text: countdown_text, size_enum: 20, alignment_enum: 1 } +** Processing line: ~ outputs.labels << { x: 635, y: 430, text: countdown_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + outputs.labels << { x: 635, y: 430, text: countdown_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90352,10 +96607,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def render_background -** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ +** Processing line: ~ outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: 'sprites/background.png' }~ - Inside source: true *** True Line Result - outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: 'sprites/background.png' } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -90400,6 +96655,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def scrolling_background at, path, rate, y = 0~ +- Inside source: true +*** True Line Result + def scrolling_background at, path, rate, y = 0 +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ { x: 0 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path },~ +- Inside source: true +*** True Line Result + { x: 0 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path }, +** Processing line: ~ { x: 1440 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path }~ +- Inside source: true +*** True Line Result + { x: 1440 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path } +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def render_walls~ - Inside source: true *** True Line Result @@ -90412,14 +96695,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result w.sprites = [ -** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ +** Processing line: ~ { x: w.x, y: w.bottom_height - 720, w: 100, h: 720, path: 'sprites/wall.png', angle: 180 },~ - Inside source: true *** True Line Result - [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], -** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ + { x: w.x, y: w.bottom_height - 720, w: 100, h: 720, path: 'sprites/wall.png', angle: 180 }, +** Processing line: ~ { x: w.x, y: w.top_y, w: 100, h: 720, path: 'sprites/wallbottom.png', angle: 0 }~ - Inside source: true *** True Line Result - [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] + { x: w.x, y: w.top_y, w: 100, h: 720, path: 'sprites/wallbottom.png', angle: 0 } ** Processing line: ~ ]~ - Inside source: true *** True Line Result @@ -90452,14 +96735,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ render_debug_hitbox false~ -- Inside source: true -*** True Line Result - render_debug_hitbox false -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ if state.show_death == false || !state.death_at~ - Inside source: true *** True Line Result @@ -90472,10 +96747,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 }~ - Inside source: true *** True Line Result - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } ** Processing line: ~ else~ - Inside source: true *** True Line Result @@ -90484,10 +96759,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result sprite_name = "sprites/dragon_die.png" -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 }~ - Inside source: true *** True Line Result - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 } ** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ - Inside source: true *** True Line Result @@ -90524,38 +96799,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_debug_hitbox show~ -- Inside source: true -*** True Line Result - def render_debug_hitbox show -** Processing line: ~ return unless show~ -- Inside source: true -*** True Line Result - return unless show -** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ -- Inside source: true -*** True Line Result - outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite -** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ -- Inside source: true -*** True Line Result - outputs.borders << state.walls.flat_map do |w| -** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ -- Inside source: true -*** True Line Result - w.sprites.map { |s| [s.rect, 255, 0, 0] } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def render_flash~ - Inside source: true *** True Line Result @@ -90568,18 +96811,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ outputs.primitives << [grid.rect,~ +** Processing line: ~ outputs.primitives << { **grid.rect.to_hash,~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect, -** Processing line: ~ white,~ + outputs.primitives << { **grid.rect.to_hash, +** Processing line: ~ **white,~ - Inside source: true *** True Line Result - white, -** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ + **white, +** Processing line: ~ a: 255 * state.flash_at.ease(20, :flip) }.solid!~ - Inside source: true *** True Line Result - 255 * state.flash_at.ease(20, :flip)].solid + a: 255 * state.flash_at.ease(20, :flip) }.solid! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -91056,42 +97299,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def scrolling_background at, path, rate, y = 0~ -- Inside source: true -*** True Line Result - def scrolling_background at, path, rate, y = 0 -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ -- Inside source: true -*** True Line Result - [ 0 - at.*(rate) % 1440, y, 1440, 720, path], -** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ -- Inside source: true -*** True Line Result - [1440 - at.*(rate) % 1440, y, 1440, 720, path] -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def white~ - Inside source: true *** True Line Result def white -** Processing line: ~ [255, 255, 255]~ +** Processing line: ~ { r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - [255, 255, 255] + { r: 255, g: 255, b: 255 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91104,10 +97319,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def large_white_typeset -** Processing line: ~ [5, 0, 255, 255, 255]~ +** Processing line: ~ { size_enum: 5, alignment_enum: 0, r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - [5, 0, 255, 255, 255] + { size_enum: 5, alignment_enum: 0, r: 255, g: 255, b: 255 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91140,18 +97355,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result state.dragon_sprite -** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ +** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ - Inside source: true *** True Line Result - .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) -** Processing line: ~ .rect_shift_right(10)~ + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) +** Processing line: ~ .rect_shift_right(10)~ - Inside source: true *** True Line Result - .rect_shift_right(10) -** Processing line: ~ .rect_shift_up(state.dy * 2)~ + .rect_shift_right(10) +** Processing line: ~ .rect_shift_up(state.dy * 2)~ - Inside source: true *** True Line Result - .rect_shift_up(state.dy * 2) + .rect_shift_up(state.dy * 2) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91184,10 +97399,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result .any? do |s| -** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ +** Processing line: ~ s && s.intersect_rect?(dragon_collision_box)~ - Inside source: true *** True Line Result - s.intersect_rect?(dragon_collision_box) + s && s.intersect_rect?(dragon_collision_box) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96416,6 +102631,514 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Crafting - Farming Game Starting Point - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Crafting - Farming Game Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_crafting/farming_game_starting_point/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_crafting/farming_game_starting_point/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.tile_size = 80~ +- Inside source: true +*** True Line Result + args.state.tile_size = 80 +** Processing line: ~ args.state.player_speed = 4~ +- Inside source: true +*** True Line Result + args.state.player_speed = 4 +** Processing line: ~ args.state.player ||= tile(args, 7, 3, 0, 128, 180)~ +- Inside source: true +*** True Line Result + args.state.player ||= tile(args, 7, 3, 0, 128, 180) +** Processing line: ~ generate_map args~ +- Inside source: true +*** True Line Result + generate_map args +** Processing line: ~ #press j to plant a green onion~ +- Inside source: true +*** True Line Result + #press j to plant a green onion +** Processing line: ~ if args.inputs.keyboard.j~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.j +** Processing line: ~ #change this part you can change what you want to plant~ +- Inside source: true +*** True Line Result + #change this part you can change what you want to plant +** Processing line: ~ args.state.walls << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y)/args.state.tile_size), 255, 255, 255)~ +- Inside source: true +*** True Line Result + args.state.walls << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y)/args.state.tile_size), 255, 255, 255) +** Processing line: ~ args.state.plants << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y+80)/args.state.tile_size), 0, 160, 0)~ +- Inside source: true +*** True Line Result + args.state.plants << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y+80)/args.state.tile_size), 0, 160, 0) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ # Adds walls, background, and player to args.outputs.solids so they appear on screen~ +- Inside source: true +*** True Line Result + # Adds walls, background, and player to args.outputs.solids so they appear on screen +** Processing line: ~ args.outputs.solids << [0,0,1280,720, 237,189,101]~ +- Inside source: true +*** True Line Result + args.outputs.solids << [0,0,1280,720, 237,189,101] +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] +** Processing line: ~ args.outputs.solids << args.state.walls~ +- Inside source: true +*** True Line Result + args.outputs.solids << args.state.walls +** Processing line: ~ args.outputs.solids << args.state.player~ +- Inside source: true +*** True Line Result + args.outputs.solids << args.state.player +** Processing line: ~ args.outputs.solids << args.state.plants~ +- Inside source: true +*** True Line Result + args.outputs.solids << args.state.plants +** Processing line: ~ args.outputs.labels << [320, 640, "press J to plant", 3, 1, 255, 0, 0, 200]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [320, 640, "press J to plant", 3, 1, 255, 0, 0, 200] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed~ +- Inside source: true +*** True Line Result + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed +** Processing line: ~ move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed~ +- Inside source: true +*** True Line Result + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed +** Processing line: ~ move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed~ +- Inside source: true +*** True Line Result + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed +** Processing line: ~ move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed~ +- Inside source: true +*** True Line Result + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Sets position, size, and color of the tile~ +- Inside source: true +*** True Line Result + # Sets position, size, and color of the tile +** Processing line: ~ def tile args, x, y, *color~ +- Inside source: true +*** True Line Result + def tile args, x, y, *color +** Processing line: ~ [x * args.state.tile_size, # sets definition for array using method parameters~ +- Inside source: true +*** True Line Result + [x * args.state.tile_size, # sets definition for array using method parameters +** Processing line: ~ y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values~ +- Inside source: true +*** True Line Result + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values +** Processing line: ~ args.state.tile_size,~ +- Inside source: true +*** True Line Result + args.state.tile_size, +** Processing line: ~ args.state.tile_size,~ +- Inside source: true +*** True Line Result + args.state.tile_size, +** Processing line: ~ *color]~ +- Inside source: true +*** True Line Result + *color] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach)~ +- Inside source: true +*** True Line Result + # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) +** Processing line: ~ def generate_map args~ +- Inside source: true +*** True Line Result + def generate_map args +** Processing line: ~ return if args.state.area~ +- Inside source: true +*** True Line Result + return if args.state.area +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Creates the area of the map. There are 9 rows running horizontally across the screen~ +- Inside source: true +*** True Line Result + # Creates the area of the map. There are 9 rows running horizontally across the screen +** Processing line: ~ # and 16 columns running vertically on the screen. Any spot with a "1" is not~ +- Inside source: true +*** True Line Result + # and 16 columns running vertically on the screen. Any spot with a "1" is not +** Processing line: ~ # open for the player to move into (and is green), and any spot with a "0" is available~ +- Inside source: true +*** True Line Result + # open for the player to move into (and is green), and any spot with a "0" is available +** Processing line: ~ # for the player to move in.~ +- Inside source: true +*** True Line Result + # for the player to move in. +** Processing line: ~ args.state.area = [~ +- Inside source: true +*** True Line Result + args.state.area = [ +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,], +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ +- Inside source: true +*** True Line Result + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],~ +- Inside source: true +*** True Line Result + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], +** Processing line: ~ ].reverse # reverses the order of the area collection~ +- Inside source: true +*** True Line Result + ].reverse # reverses the order of the area collection +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # By reversing the order, the way that the area appears above is how it appears~ +- Inside source: true +*** True Line Result + # By reversing the order, the way that the area appears above is how it appears +** Processing line: ~ # on the screen in the game. If we did not reverse, the map would appear inverted.~ +- Inside source: true +*** True Line Result + # on the screen in the game. If we did not reverse, the map would appear inverted. +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #The wall starts off with no tiles.~ +- Inside source: true +*** True Line Result + #The wall starts off with no tiles. +** Processing line: ~ args.state.walls = []~ +- Inside source: true +*** True Line Result + args.state.walls = [] +** Processing line: ~ args.state.plants = []~ +- Inside source: true +*** True Line Result + args.state.plants = [] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # If v is 1, a green tile is added to args.state.walls.~ +- Inside source: true +*** True Line Result + # If v is 1, a green tile is added to args.state.walls. +** Processing line: ~ # If v is 2, a black tile is created as the goal.~ +- Inside source: true +*** True Line Result + # If v is 2, a black tile is created as the goal. +** Processing line: ~ args.state.area.map_2d do |y, x, v|~ +- Inside source: true +*** True Line Result + args.state.area.map_2d do |y, x, v| +** Processing line: ~ if v == 1~ +- Inside source: true +*** True Line Result + if v == 1 +** Processing line: ~ args.state.walls << tile(args, x, y, 255, 160, 156) # green tile~ +- Inside source: true +*** True Line Result + args.state.walls << tile(args, x, y, 255, 160, 156) # green tile +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Allows the player to move their box around the screen~ +- Inside source: true +*** True Line Result + # Allows the player to move their box around the screen +** Processing line: ~ def move_player args, *vector~ +- Inside source: true +*** True Line Result + def move_player args, *vector +** Processing line: ~ box = args.state.player.shift_rect(vector) # box is able to move at an angle~ +- Inside source: true +*** True Line Result + box = args.state.player.shift_rect(vector) # box is able to move at an angle +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # If the player's box hits a wall, it is not able to move further in that direction~ +- Inside source: true +*** True Line Result + # If the player's box hits a wall, it is not able to move further in that direction +** Processing line: ~ return if args.state.walls~ +- Inside source: true +*** True Line Result + return if args.state.walls +** Processing line: ~ .any_intersect_rect?(box)~ +- Inside source: true +*** True Line Result + .any_intersect_rect?(box) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Player's box is able to move at angles (not just the four general directions) fast~ +- Inside source: true +*** True Line Result + # Player's box is able to move at angles (not just the four general directions) fast +** Processing line: ~ args.state.player =~ +- Inside source: true +*** True Line Result + args.state.player = +** Processing line: ~ args.state.player~ +- Inside source: true +*** True Line Result + args.state.player +** Processing line: ~ .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then~ +- Inside source: true +*** True Line Result + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then +** Processing line: ~ vector.y * args.state.player_speed) # the box will move extremely slow~ +- Inside source: true +*** True Line Result + vector.y * args.state.player_speed) # the box will move extremely slow +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Crafting - Farming Game Starting Point - tests.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Crafting - Farming Game Starting Point - tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_crafting/farming_game_starting_point/app/tests.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_crafting/farming_game_starting_point/app/tests.rb +** Processing line: ~ # For advanced users:~ +- Inside source: true +*** True Line Result + # For advanced users: +** Processing line: ~ # You can put some quick verification tests here, any method~ +- Inside source: true +*** True Line Result + # You can put some quick verification tests here, any method +** Processing line: ~ # that starts with the `test_` will be run when you save this file.~ +- Inside source: true +*** True Line Result + # that starts with the `test_` will be run when you save this file. +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Here is an example test and game~ +- Inside source: true +*** True Line Result + # Here is an example test and game +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick~ +- Inside source: true +*** True Line Result + # To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class MySuperHappyFunGame~ +- Inside source: true +*** True Line Result + class MySuperHappyFunGame +** Processing line: ~ attr_gtk~ +- Inside source: true +*** True Line Result + attr_gtk +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick~ +- Inside source: true +*** True Line Result + def tick +** Processing line: ~ outputs.solids << [100, 100, 300, 300]~ +- Inside source: true +*** True Line Result + outputs.solids << [100, 100, 300, 300] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_universe args, assert~ +- Inside source: true +*** True Line Result + def test_universe args, assert +** Processing line: ~ game = MySuperHappyFunGame.new~ +- Inside source: true +*** True Line Result + game = MySuperHappyFunGame.new +** Processing line: ~ game.args = args~ +- Inside source: true +*** True Line Result + game.args = args +** Processing line: ~ game.tick~ +- Inside source: true +*** True Line Result + game.tick +** Processing line: ~ assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick"~ +- Inside source: true +*** True Line Result + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" +** Processing line: ~ assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending"~ +- Inside source: true +*** True Line Result + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" +** Processing line: ~ puts "test_universe completed successfully"~ +- Inside source: true +*** True Line Result + puts "test_universe completed successfully" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ puts "running tests"~ +- Inside source: true +*** True Line Result + puts "running tests" +** Processing line: ~ $gtk.reset 100~ +- Inside source: true +*** True Line Result + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ +- Inside source: true +*** True Line Result + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ +- Inside source: true +*** True Line Result + $gtk.tests.start +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Dev Tools - Add Buttons To Console - main.rb~ - Header detected. *** True Line Result @@ -97104,18 +103827,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result text: "#{i + 1}", r: 180, g: 180, b: 180, -** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ +** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label!~ - Inside source: true *** True Line Result - size_enum: -4, alignment_enum: 1 }.label + size_enum: -4, alignment_enum: 1 }.label! ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border!~ - Inside source: true *** True Line Result - selection_border = b.merge(r: 40, g: 40, b: 40).border + selection_border = b.merge(r: 40, g: 40, b: 40).border! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -97124,10 +103847,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if i == state.animation_frames_selected_index -** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border!~ - Inside source: true *** True Line Result - selection_border = b.merge(r: 40, g: 230, b: 200).border + selection_border = b.merge(r: 40, g: 230, b: 200).border! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -100076,6 +106799,2102 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Dungeon Crawl - Classics Jam - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Dungeon Crawl - Classics Jam - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_dungeon_crawl/classics_jam/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_dungeon_crawl/classics_jam/app/main.rb +** Processing line: ~ class Game~ +- Inside source: true +*** True Line Result + class Game +** Processing line: ~ attr_gtk~ +- Inside source: true +*** True Line Result + attr_gtk +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick~ +- Inside source: true +*** True Line Result + def tick +** Processing line: ~ defaults~ +- Inside source: true +*** True Line Result + defaults +** Processing line: ~ render~ +- Inside source: true +*** True Line Result + render +** Processing line: ~ input~ +- Inside source: true +*** True Line Result + input +** Processing line: ~ calc~ +- Inside source: true +*** True Line Result + calc +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def defaults~ +- Inside source: true +*** True Line Result + def defaults +** Processing line: ~ player.x ||= 640~ +- Inside source: true +*** True Line Result + player.x ||= 640 +** Processing line: ~ player.y ||= 360~ +- Inside source: true +*** True Line Result + player.y ||= 360 +** Processing line: ~ player.w ||= 16~ +- Inside source: true +*** True Line Result + player.w ||= 16 +** Processing line: ~ player.h ||= 16~ +- Inside source: true +*** True Line Result + player.h ||= 16 +** Processing line: ~ player.attacked_at ||= -1~ +- Inside source: true +*** True Line Result + player.attacked_at ||= -1 +** Processing line: ~ player.angle ||= 0~ +- Inside source: true +*** True Line Result + player.angle ||= 0 +** Processing line: ~ player.future_player ||= future_player_position 0, 0~ +- Inside source: true +*** True Line Result + player.future_player ||= future_player_position 0, 0 +** Processing line: ~ player.projectiles ||= []~ +- Inside source: true +*** True Line Result + player.projectiles ||= [] +** Processing line: ~ player.damage ||= 0~ +- Inside source: true +*** True Line Result + player.damage ||= 0 +** Processing line: ~ state.level ||= create_level level_one_template~ +- Inside source: true +*** True Line Result + state.level ||= create_level level_one_template +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render~ +- Inside source: true +*** True Line Result + def render +** Processing line: ~ outputs.sprites << level.walls.map do |w|~ +- Inside source: true +*** True Line Result + outputs.sprites << level.walls.map do |w| +** Processing line: ~ w.merge(path: 'sprites/square/gray.png')~ +- Inside source: true +*** True Line Result + w.merge(path: 'sprites/square/gray.png') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.sprites << level.spawn_locations.map do |s|~ +- Inside source: true +*** True Line Result + outputs.sprites << level.spawn_locations.map do |s| +** Processing line: ~ s.merge(path: 'sprites/square/blue.png')~ +- Inside source: true +*** True Line Result + s.merge(path: 'sprites/square/blue.png') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.sprites << player.projectiles.map do |p|~ +- Inside source: true +*** True Line Result + outputs.sprites << player.projectiles.map do |p| +** Processing line: ~ p.merge(path: 'sprites/square/blue.png')~ +- Inside source: true +*** True Line Result + p.merge(path: 'sprites/square/blue.png') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.sprites << level.enemies.map do |e|~ +- Inside source: true +*** True Line Result + outputs.sprites << level.enemies.map do |e| +** Processing line: ~ e.merge(path: 'sprites/square/red.png')~ +- Inside source: true +*** True Line Result + e.merge(path: 'sprites/square/red.png') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.sprites << player.merge(path: 'sprites/circle/green.png', angle: player.angle)~ +- Inside source: true +*** True Line Result + outputs.sprites << player.merge(path: 'sprites/circle/green.png', angle: player.angle) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << { x: 30, y: 30.from_top, text: "damage: #{player.damage || 0}" }~ +- Inside source: true +*** True Line Result + outputs.labels << { x: 30, y: 30.from_top, text: "damage: #{player.damage || 0}" } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input~ +- Inside source: true +*** True Line Result + def input +** Processing line: ~ player.angle = inputs.directional_angle || player.angle~ +- Inside source: true +*** True Line Result + player.angle = inputs.directional_angle || player.angle +** Processing line: ~ if inputs.controller_one.key_down.a || inputs.keyboard.key_down.space~ +- Inside source: true +*** True Line Result + if inputs.controller_one.key_down.a || inputs.keyboard.key_down.space +** Processing line: ~ player.attacked_at = state.tick_count~ +- Inside source: true +*** True Line Result + player.attacked_at = state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc~ +- Inside source: true +*** True Line Result + def calc +** Processing line: ~ calc_player~ +- Inside source: true +*** True Line Result + calc_player +** Processing line: ~ calc_projectiles~ +- Inside source: true +*** True Line Result + calc_projectiles +** Processing line: ~ calc_enemies~ +- Inside source: true +*** True Line Result + calc_enemies +** Processing line: ~ calc_spawn_locations~ +- Inside source: true +*** True Line Result + calc_spawn_locations +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_player~ +- Inside source: true +*** True Line Result + def calc_player +** Processing line: ~ if player.attacked_at == state.tick_count~ +- Inside source: true +*** True Line Result + if player.attacked_at == state.tick_count +** Processing line: ~ player.projectiles << { at: state.tick_count,~ +- Inside source: true +*** True Line Result + player.projectiles << { at: state.tick_count, +** Processing line: ~ x: player.x,~ +- Inside source: true +*** True Line Result + x: player.x, +** Processing line: ~ y: player.y,~ +- Inside source: true +*** True Line Result + y: player.y, +** Processing line: ~ angle: player.angle,~ +- Inside source: true +*** True Line Result + angle: player.angle, +** Processing line: ~ w: 4,~ +- Inside source: true +*** True Line Result + w: 4, +** Processing line: ~ h: 4 }.center_inside_rect(player)~ +- Inside source: true +*** True Line Result + h: 4 }.center_inside_rect(player) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if player.attacked_at.elapsed_time > 5~ +- Inside source: true +*** True Line Result + if player.attacked_at.elapsed_time > 5 +** Processing line: ~ future_player = future_player_position inputs.left_right * 2, inputs.up_down * 2~ +- Inside source: true +*** True Line Result + future_player = future_player_position inputs.left_right * 2, inputs.up_down * 2 +** Processing line: ~ future_player_collision = future_collision player, future_player, level.walls~ +- Inside source: true +*** True Line Result + future_player_collision = future_collision player, future_player, level.walls +** Processing line: ~ player.x = future_player_collision.x if !future_player_collision.dx_collision~ +- Inside source: true +*** True Line Result + player.x = future_player_collision.x if !future_player_collision.dx_collision +** Processing line: ~ player.y = future_player_collision.y if !future_player_collision.dy_collision~ +- Inside source: true +*** True Line Result + player.y = future_player_collision.y if !future_player_collision.dy_collision +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_projectile_collisions entities~ +- Inside source: true +*** True Line Result + def calc_projectile_collisions entities +** Processing line: ~ entities.each do |e|~ +- Inside source: true +*** True Line Result + entities.each do |e| +** Processing line: ~ e.damage ||= 0~ +- Inside source: true +*** True Line Result + e.damage ||= 0 +** Processing line: ~ player.projectiles.each do |p|~ +- Inside source: true +*** True Line Result + player.projectiles.each do |p| +** Processing line: ~ if !p.collided && (p.intersect_rect? e)~ +- Inside source: true +*** True Line Result + if !p.collided && (p.intersect_rect? e) +** Processing line: ~ p.collided = true~ +- Inside source: true +*** True Line Result + p.collided = true +** Processing line: ~ e.damage += 1~ +- Inside source: true +*** True Line Result + e.damage += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_projectiles~ +- Inside source: true +*** True Line Result + def calc_projectiles +** Processing line: ~ player.projectiles.map! do |p|~ +- Inside source: true +*** True Line Result + player.projectiles.map! do |p| +** Processing line: ~ dx, dy = p.angle.vector 10~ +- Inside source: true +*** True Line Result + dx, dy = p.angle.vector 10 +** Processing line: ~ p.merge(x: p.x + dx, y: p.y + dy)~ +- Inside source: true +*** True Line Result + p.merge(x: p.x + dx, y: p.y + dy) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ calc_projectile_collisions level.walls + level.enemies + level.spawn_locations~ +- Inside source: true +*** True Line Result + calc_projectile_collisions level.walls + level.enemies + level.spawn_locations +** Processing line: ~ player.projectiles.reject! { |p| p.at.elapsed_time > 10000 }~ +- Inside source: true +*** True Line Result + player.projectiles.reject! { |p| p.at.elapsed_time > 10000 } +** Processing line: ~ player.projectiles.reject! { |p| p.collided }~ +- Inside source: true +*** True Line Result + player.projectiles.reject! { |p| p.collided } +** Processing line: ~ level.enemies.reject! { |e| e.damage > e.hp }~ +- Inside source: true +*** True Line Result + level.enemies.reject! { |e| e.damage > e.hp } +** Processing line: ~ level.spawn_locations.reject! { |s| s.damage > s.hp }~ +- Inside source: true +*** True Line Result + level.spawn_locations.reject! { |s| s.damage > s.hp } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_enemies~ +- Inside source: true +*** True Line Result + def calc_enemies +** Processing line: ~ level.enemies.map! do |e|~ +- Inside source: true +*** True Line Result + level.enemies.map! do |e| +** Processing line: ~ dx = 0~ +- Inside source: true +*** True Line Result + dx = 0 +** Processing line: ~ dx = 1 if e.x < player.x~ +- Inside source: true +*** True Line Result + dx = 1 if e.x < player.x +** Processing line: ~ dx = -1 if e.x > player.x~ +- Inside source: true +*** True Line Result + dx = -1 if e.x > player.x +** Processing line: ~ dy = 0~ +- Inside source: true +*** True Line Result + dy = 0 +** Processing line: ~ dy = 1 if e.y < player.y~ +- Inside source: true +*** True Line Result + dy = 1 if e.y < player.y +** Processing line: ~ dy = -1 if e.y > player.y~ +- Inside source: true +*** True Line Result + dy = -1 if e.y > player.y +** Processing line: ~ future_e = future_entity_position dx, dy, e~ +- Inside source: true +*** True Line Result + future_e = future_entity_position dx, dy, e +** Processing line: ~ future_e_collision = future_collision e, future_e, level.enemies + level.walls~ +- Inside source: true +*** True Line Result + future_e_collision = future_collision e, future_e, level.enemies + level.walls +** Processing line: ~ e.next_x = e.x~ +- Inside source: true +*** True Line Result + e.next_x = e.x +** Processing line: ~ e.next_y = e.y~ +- Inside source: true +*** True Line Result + e.next_y = e.y +** Processing line: ~ e.next_x = future_e_collision.x if !future_e_collision.dx_collision~ +- Inside source: true +*** True Line Result + e.next_x = future_e_collision.x if !future_e_collision.dx_collision +** Processing line: ~ e.next_y = future_e_collision.y if !future_e_collision.dy_collision~ +- Inside source: true +*** True Line Result + e.next_y = future_e_collision.y if !future_e_collision.dy_collision +** Processing line: ~ e~ +- Inside source: true +*** True Line Result + e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ level.enemies.map! do |e|~ +- Inside source: true +*** True Line Result + level.enemies.map! do |e| +** Processing line: ~ e.x = e.next_x~ +- Inside source: true +*** True Line Result + e.x = e.next_x +** Processing line: ~ e.y = e.next_y~ +- Inside source: true +*** True Line Result + e.y = e.next_y +** Processing line: ~ e~ +- Inside source: true +*** True Line Result + e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ level.enemies.each do |e|~ +- Inside source: true +*** True Line Result + level.enemies.each do |e| +** Processing line: ~ player.damage += 1 if e.intersect_rect? player~ +- Inside source: true +*** True Line Result + player.damage += 1 if e.intersect_rect? player +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_spawn_locations~ +- Inside source: true +*** True Line Result + def calc_spawn_locations +** Processing line: ~ level.spawn_locations.map! do |s|~ +- Inside source: true +*** True Line Result + level.spawn_locations.map! do |s| +** Processing line: ~ s.merge(countdown: s.countdown - 1)~ +- Inside source: true +*** True Line Result + s.merge(countdown: s.countdown - 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ level.spawn_locations~ +- Inside source: true +*** True Line Result + level.spawn_locations +** Processing line: ~ .find_all { |s| s.countdown.neg? }~ +- Inside source: true +*** True Line Result + .find_all { |s| s.countdown.neg? } +** Processing line: ~ .each do |s|~ +- Inside source: true +*** True Line Result + .each do |s| +** Processing line: ~ s.countdown = s.rate~ +- Inside source: true +*** True Line Result + s.countdown = s.rate +** Processing line: ~ s.merge(countdown: s.rate)~ +- Inside source: true +*** True Line Result + s.merge(countdown: s.rate) +** Processing line: ~ new_enemy = create_enemy s~ +- Inside source: true +*** True Line Result + new_enemy = create_enemy s +** Processing line: ~ if !(level.enemies.find { |e| e.intersect_rect? new_enemy })~ +- Inside source: true +*** True Line Result + if !(level.enemies.find { |e| e.intersect_rect? new_enemy }) +** Processing line: ~ level.enemies << new_enemy~ +- Inside source: true +*** True Line Result + level.enemies << new_enemy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def create_enemy spawn_location~ +- Inside source: true +*** True Line Result + def create_enemy spawn_location +** Processing line: ~ to_cell(spawn_location.ordinal_x, spawn_location.ordinal_y).merge hp: 2~ +- Inside source: true +*** True Line Result + to_cell(spawn_location.ordinal_x, spawn_location.ordinal_y).merge hp: 2 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def create_level level_template~ +- Inside source: true +*** True Line Result + def create_level level_template +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ walls: level_template.walls.map { |w| to_cell(w.ordinal_x, w.ordinal_y).merge(w) },~ +- Inside source: true +*** True Line Result + walls: level_template.walls.map { |w| to_cell(w.ordinal_x, w.ordinal_y).merge(w) }, +** Processing line: ~ enemies: [],~ +- Inside source: true +*** True Line Result + enemies: [], +** Processing line: ~ spawn_locations: level_template.spawn_locations.map { |s| to_cell(s.ordinal_x, s.ordinal_y).merge(s) }~ +- Inside source: true +*** True Line Result + spawn_locations: level_template.spawn_locations.map { |s| to_cell(s.ordinal_x, s.ordinal_y).merge(s) } +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def level_one_template~ +- Inside source: true +*** True Line Result + def level_one_template +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ walls: [{ ordinal_x: 25, ordinal_y: 20},~ +- Inside source: true +*** True Line Result + walls: [{ ordinal_x: 25, ordinal_y: 20}, +** Processing line: ~ { ordinal_x: 25, ordinal_y: 21},~ +- Inside source: true +*** True Line Result + { ordinal_x: 25, ordinal_y: 21}, +** Processing line: ~ { ordinal_x: 25, ordinal_y: 22},~ +- Inside source: true +*** True Line Result + { ordinal_x: 25, ordinal_y: 22}, +** Processing line: ~ { ordinal_x: 25, ordinal_y: 23}],~ +- Inside source: true +*** True Line Result + { ordinal_x: 25, ordinal_y: 23}], +** Processing line: ~ spawn_locations: [{ ordinal_x: 10, ordinal_y: 10, rate: 120, countdown: 0, hp: 5 }]~ +- Inside source: true +*** True Line Result + spawn_locations: [{ ordinal_x: 10, ordinal_y: 10, rate: 120, countdown: 0, hp: 5 }] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player~ +- Inside source: true +*** True Line Result + def player +** Processing line: ~ state.player ||= {}~ +- Inside source: true +*** True Line Result + state.player ||= {} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def level~ +- Inside source: true +*** True Line Result + def level +** Processing line: ~ state.level ||= {}~ +- Inside source: true +*** True Line Result + state.level ||= {} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def future_collision entity, future_entity, others~ +- Inside source: true +*** True Line Result + def future_collision entity, future_entity, others +** Processing line: ~ dx_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dx) }~ +- Inside source: true +*** True Line Result + dx_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dx) } +** Processing line: ~ dy_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dy) }~ +- Inside source: true +*** True Line Result + dy_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dy) } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ dx_collision: dx_collision,~ +- Inside source: true +*** True Line Result + dx_collision: dx_collision, +** Processing line: ~ x: future_entity.dx.x,~ +- Inside source: true +*** True Line Result + x: future_entity.dx.x, +** Processing line: ~ dy_collision: dy_collision,~ +- Inside source: true +*** True Line Result + dy_collision: dy_collision, +** Processing line: ~ y: future_entity.dy.y~ +- Inside source: true +*** True Line Result + y: future_entity.dy.y +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def future_entity_position dx, dy, entity~ +- Inside source: true +*** True Line Result + def future_entity_position dx, dy, entity +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ dx: entity.merge(x: entity.x + dx),~ +- Inside source: true +*** True Line Result + dx: entity.merge(x: entity.x + dx), +** Processing line: ~ dy: entity.merge(y: entity.y + dy),~ +- Inside source: true +*** True Line Result + dy: entity.merge(y: entity.y + dy), +** Processing line: ~ both: entity.merge(x: entity.x + dx, y: entity.y + dy)~ +- Inside source: true +*** True Line Result + both: entity.merge(x: entity.x + dx, y: entity.y + dy) +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def future_player_position dx, dy~ +- Inside source: true +*** True Line Result + def future_player_position dx, dy +** Processing line: ~ future_entity_position dx, dy, player~ +- Inside source: true +*** True Line Result + future_entity_position dx, dy, player +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_cell ordinal_x, ordinal_y~ +- Inside source: true +*** True Line Result + def to_cell ordinal_x, ordinal_y +** Processing line: ~ { x: ordinal_x * 16, y: ordinal_y * 16, w: 16, h: 16 }~ +- Inside source: true +*** True Line Result + { x: ordinal_x * 16, y: ordinal_y * 16, w: 16, h: 16 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ $game ||= Game.new~ +- Inside source: true +*** True Line Result + $game ||= Game.new +** Processing line: ~ $game.args = args~ +- Inside source: true +*** True Line Result + $game.args = args +** Processing line: ~ $game.tick~ +- Inside source: true +*** True Line Result + $game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~ $game = nil~ +- Inside source: true +*** True Line Result + $game = nil +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Fighting - Special Move Inputs - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Fighting - Special Move Inputs - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_fighting/01_special_move_inputs/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_fighting/01_special_move_inputs/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ #tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ +- Inside source: true +*** True Line Result + #tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." +** Processing line: ~ defaults args~ +- Inside source: true +*** True Line Result + defaults args +** Processing line: ~ render args~ +- Inside source: true +*** True Line Result + render args +** Processing line: ~ input args~ +- Inside source: true +*** True Line Result + input args +** Processing line: ~ calc args~ +- Inside source: true +*** True Line Result + calc args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # sets default values and creates empty collections~ +- Inside source: true +*** True Line Result + # sets default values and creates empty collections +** Processing line: ~ # initialization only happens in the first frame~ +- Inside source: true +*** True Line Result + # initialization only happens in the first frame +** Processing line: ~ def defaults args~ +- Inside source: true +*** True Line Result + def defaults args +** Processing line: ~ fiddle args~ +- Inside source: true +*** True Line Result + fiddle args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.tick_count = args.state.tick_count~ +- Inside source: true +*** True Line Result + args.state.tick_count = args.state.tick_count +** Processing line: ~ args.state.bridge_top = 128~ +- Inside source: true +*** True Line Result + args.state.bridge_top = 128 +** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ +- Inside source: true +*** True Line Result + args.state.player.x ||= 0 # initializes player's properties +** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ +- Inside source: true +*** True Line Result + args.state.player.y ||= args.state.bridge_top +** Processing line: ~ args.state.player.w ||= 64~ +- Inside source: true +*** True Line Result + args.state.player.w ||= 64 +** Processing line: ~ args.state.player.h ||= 64~ +- Inside source: true +*** True Line Result + args.state.player.h ||= 64 +** Processing line: ~ args.state.player.dy ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.dy ||= 0 +** Processing line: ~ args.state.player.dx ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.dx ||= 0 +** Processing line: ~ args.state.player.r ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.r ||= 0 +** Processing line: ~ args.state.game_over_at ||= 0~ +- Inside source: true +*** True Line Result + args.state.game_over_at ||= 0 +** Processing line: ~ args.state.animation_time ||=0~ +- Inside source: true +*** True Line Result + args.state.animation_time ||=0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.timeleft ||=0~ +- Inside source: true +*** True Line Result + args.state.timeleft ||=0 +** Processing line: ~ args.state.timeright ||=0~ +- Inside source: true +*** True Line Result + args.state.timeright ||=0 +** Processing line: ~ args.state.lastpush ||=0~ +- Inside source: true +*** True Line Result + args.state.lastpush ||=0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.inputlist ||= ["j","k","l"]~ +- Inside source: true +*** True Line Result + args.state.inputlist ||= ["j","k","l"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # sets enemy, player, hammer values~ +- Inside source: true +*** True Line Result + # sets enemy, player, hammer values +** Processing line: ~ def fiddle args~ +- Inside source: true +*** True Line Result + def fiddle args +** Processing line: ~ args.state.gravity = -0.5~ +- Inside source: true +*** True Line Result + args.state.gravity = -0.5 +** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ +- Inside source: true +*** True Line Result + args.state.player_jump_power = 10 # sets player values +** Processing line: ~ args.state.player_jump_power_duration = 5~ +- Inside source: true +*** True Line Result + args.state.player_jump_power_duration = 5 +** Processing line: ~ args.state.player_max_run_speed = 20~ +- Inside source: true +*** True Line Result + args.state.player_max_run_speed = 20 +** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ +- Inside source: true +*** True Line Result + args.state.player_speed_slowdown_rate = 0.9 +** Processing line: ~ args.state.player_acceleration = 0.9~ +- Inside source: true +*** True Line Result + args.state.player_acceleration = 0.9 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # outputs objects onto the screen~ +- Inside source: true +*** True Line Result + # outputs objects onto the screen +** Processing line: ~ def render args~ +- Inside source: true +*** True Line Result + def render args +** Processing line: ~ if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01)~ +- Inside source: true +*** True Line Result + if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01) +** Processing line: ~ args.state.player.dx = 0~ +- Inside source: true +*** True Line Result + args.state.player.dx = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #move list~ +- Inside source: true +*** True Line Result + #move list +** Processing line: ~ (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3,~ +- Inside source: true +*** True Line Result + (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3, +** Processing line: ~ merge: { vertical_alignment_enum: 0, size_enum: -2 },~ +- Inside source: true +*** True Line Result + merge: { vertical_alignment_enum: 0, size_enum: -2 }, +** Processing line: ~ group: [~ +- Inside source: true +*** True Line Result + group: [ +** Processing line: ~ { text: "move: WASD" },~ +- Inside source: true +*** True Line Result + { text: "move: WASD" }, +** Processing line: ~ { text: "jump: Space" },~ +- Inside source: true +*** True Line Result + { text: "jump: Space" }, +** Processing line: ~ { text: "attack forwards: J (while on ground" },~ +- Inside source: true +*** True Line Result + { text: "attack forwards: J (while on ground" }, +** Processing line: ~ { text: "attack upwards: K (while on groud)" },~ +- Inside source: true +*** True Line Result + { text: "attack upwards: K (while on groud)" }, +** Processing line: ~ { text: "attack backwards: J (while on ground and holding A)" },~ +- Inside source: true +*** True Line Result + { text: "attack backwards: J (while on ground and holding A)" }, +** Processing line: ~ { text: "attack downwards: K (while in air)" },~ +- Inside source: true +*** True Line Result + { text: "attack downwards: K (while in air)" }, +** Processing line: ~ { text: "dash attack: J, K in quick succession." },~ +- Inside source: true +*** True Line Result + { text: "dash attack: J, K in quick succession." }, +** Processing line: ~ { text: "shield: hold J, K at the same time." },~ +- Inside source: true +*** True Line Result + { text: "shield: hold J, K at the same time." }, +** Processing line: ~ { text: "dash backwards: A, A in quick succession." },~ +- Inside source: true +*** True Line Result + { text: "dash backwards: A, A in quick succession." }, +** Processing line: ~ ]).into args.outputs.labels~ +- Inside source: true +*** True Line Result + ]).into args.outputs.labels +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # registered moves~ +- Inside source: true +*** True Line Result + # registered moves +** Processing line: ~ args.outputs.labels << { x: 0.to_layout_col,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: 0.to_layout_col, +** Processing line: ~ y: 0.to_layout_row,~ +- Inside source: true +*** True Line Result + y: 0.to_layout_row, +** Processing line: ~ text: "input history",~ +- Inside source: true +*** True Line Result + text: "input history", +** Processing line: ~ size_enum: -2,~ +- Inside source: true +*** True Line Result + size_enum: -2, +** Processing line: ~ vertical_alignment_enum: 0 }~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 0 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ (args.state.inputlist.take(5)).map do |s|~ +- Inside source: true +*** True Line Result + (args.state.inputlist.take(5)).map do |s| +** Processing line: ~ { text: s, size_enum: -2, vertical_alignment_enum: 0 }~ +- Inside source: true +*** True Line Result + { text: s, size_enum: -2, vertical_alignment_enum: 0 } +** Processing line: ~ end.yield_self do |group|~ +- Inside source: true +*** True Line Result + end.yield_self do |group| +** Processing line: ~ (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels~ +- Inside source: true +*** True Line Result + (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #sprites~ +- Inside source: true +*** True Line Result + #sprites +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +- Inside source: true +*** True Line Result + player = [args.state.player.x, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/square/white.png",~ +- Inside source: true +*** True Line Result + "sprites/square/white.png", +** Processing line: ~ args.state.player.r]~ +- Inside source: true +*** True Line Result + args.state.player.r] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ playershield = [args.state.player.x - 20, args.state.player.y - 10,~ +- Inside source: true +*** True Line Result + playershield = [args.state.player.x - 20, args.state.player.y - 10, +** Processing line: ~ args.state.player.w + 20, args.state.player.h + 20,~ +- Inside source: true +*** True Line Result + args.state.player.w + 20, args.state.player.h + 20, +** Processing line: ~ "sprites/square/blue.png",~ +- Inside source: true +*** True Line Result + "sprites/square/blue.png", +** Processing line: ~ args.state.player.r,~ +- Inside source: true +*** True Line Result + args.state.player.r, +** Processing line: ~ 0]~ +- Inside source: true +*** True Line Result + 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +- Inside source: true +*** True Line Result + playerjab = [args.state.player.x + 32, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png",~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", +** Processing line: ~ args.state.player.r,~ +- Inside source: true +*** True Line Result + args.state.player.r, +** Processing line: ~ 0]~ +- Inside source: true +*** True Line Result + 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +- Inside source: true +*** True Line Result + playerupper = [args.state.player.x, args.state.player.y + 32, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png",~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", +** Processing line: ~ args.state.player.r+90,~ +- Inside source: true +*** True Line Result + args.state.player.r+90, +** Processing line: ~ 0]~ +- Inside source: true +*** True Line Result + 0] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if ((args.state.tick_count - args.state.lastpush) <= 15)~ +- Inside source: true +*** True Line Result + if ((args.state.tick_count - args.state.lastpush) <= 15) +** Processing line: ~ if (args.state.inputlist[0] == "<<")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "<<") +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +- Inside source: true +*** True Line Result + player = [args.state.player.x, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/square/yellow.png", args.state.player.r]~ +- Inside source: true +*** True Line Result + "sprites/square/yellow.png", args.state.player.r] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "shield")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "shield") +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +- Inside source: true +*** True Line Result + player = [args.state.player.x, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/square/indigo.png", args.state.player.r]~ +- Inside source: true +*** True Line Result + "sprites/square/indigo.png", args.state.player.r] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ playershield = [args.state.player.x - 10, args.state.player.y - 10,~ +- Inside source: true +*** True Line Result + playershield = [args.state.player.x - 10, args.state.player.y - 10, +** Processing line: ~ args.state.player.w + 20, args.state.player.h + 20,~ +- Inside source: true +*** True Line Result + args.state.player.w + 20, args.state.player.h + 20, +** Processing line: ~ "sprites/square/blue.png", args.state.player.r, 50]~ +- Inside source: true +*** True Line Result + "sprites/square/blue.png", args.state.player.r, 50] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "back-attack")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "back-attack") +** Processing line: ~ playerjab = [args.state.player.x - 20, args.state.player.y,~ +- Inside source: true +*** True Line Result + playerjab = [args.state.player.x - 20, args.state.player.y, +** Processing line: ~ args.state.player.w - 10, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w - 10, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", args.state.player.r, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "forward-attack")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "forward-attack") +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +- Inside source: true +*** True Line Result + playerjab = [args.state.player.x + 32, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", args.state.player.r, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "up-attack")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "up-attack") +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +- Inside source: true +*** True Line Result + playerupper = [args.state.player.x, args.state.player.y + 32, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r + 90, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "dair")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "dair") +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y - 32,~ +- Inside source: true +*** True Line Result + playerupper = [args.state.player.x, args.state.player.y - 32, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r + 90, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/indigo.png", args.state.player.r + 90, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (args.state.inputlist[0] == "dash-attack")~ +- Inside source: true +*** True Line Result + if (args.state.inputlist[0] == "dash-attack") +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +- Inside source: true +*** True Line Result + playerupper = [args.state.player.x, args.state.player.y + 32, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/violet.png", args.state.player.r + 90, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/violet.png", args.state.player.r + 90, 255] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +- Inside source: true +*** True Line Result + playerjab = [args.state.player.x + 32, args.state.player.y, +** Processing line: ~ args.state.player.w, args.state.player.h,~ +- Inside source: true +*** True Line Result + args.state.player.w, args.state.player.h, +** Processing line: ~ "sprites/isometric/violet.png", args.state.player.r, 255]~ +- Inside source: true +*** True Line Result + "sprites/isometric/violet.png", args.state.player.r, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.sprites << playerjab~ +- Inside source: true +*** True Line Result + args.outputs.sprites << playerjab +** Processing line: ~ args.outputs.sprites << playerupper~ +- Inside source: true +*** True Line Result + args.outputs.sprites << playerupper +** Processing line: ~ args.outputs.sprites << player~ +- Inside source: true +*** True Line Result + args.outputs.sprites << player +** Processing line: ~ args.outputs.sprites << playershield~ +- Inside source: true +*** True Line Result + args.outputs.sprites << playershield +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ +- Inside source: true +*** True Line Result + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge +** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ +- Inside source: true +*** True Line Result + [i * 64, args.state.bridge_top - 64, 64, 64] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Performs calculations to move objects on the screen~ +- Inside source: true +*** True Line Result + # Performs calculations to move objects on the screen +** Processing line: ~ def calc args~ +- Inside source: true +*** True Line Result + def calc args +** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ +- Inside source: true +*** True Line Result + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. +** Processing line: ~ args.state.player.x += args.state.player.dx~ +- Inside source: true +*** True Line Result + args.state.player.x += args.state.player.dx +** Processing line: ~ args.state.player.y += args.state.player.dy~ +- Inside source: true +*** True Line Result + args.state.player.y += args.state.player.dy +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ +- Inside source: true +*** True Line Result + # Since acceleration is the change in velocity, the change in y (dy) increases every frame +** Processing line: ~ args.state.player.dy += args.state.gravity~ +- Inside source: true +*** True Line Result + args.state.player.dy += args.state.gravity +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # player's y position is either current y position or y position of top of~ +- Inside source: true +*** True Line Result + # player's y position is either current y position or y position of top of +** Processing line: ~ # bridge, whichever has a greater value~ +- Inside source: true +*** True Line Result + # bridge, whichever has a greater value +** Processing line: ~ # ensures that the player never goes below the bridge~ +- Inside source: true +*** True Line Result + # ensures that the player never goes below the bridge +** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ +- Inside source: true +*** True Line Result + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ +- Inside source: true +*** True Line Result + # player's x position is either the current x position or 0, whichever has a greater value +** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ +- Inside source: true +*** True Line Result + # ensures that the player doesn't go too far left (out of the screen's scope) +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ +- Inside source: true +*** True Line Result + args.state.player.x = args.state.player.x.greater(0) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # player is not falling if it is located on the top of the bridge~ +- Inside source: true +*** True Line Result + # player is not falling if it is located on the top of the bridge +** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ +- Inside source: true +*** True Line Result + args.state.player.falling = false if args.state.player.y == args.state.bridge_top +** Processing line: ~ #args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ +- Inside source: true +*** True Line Result + #args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ +- Inside source: true +*** True Line Result + # Resets the player by changing its properties back to the values they had at initialization +** Processing line: ~ def reset_player args~ +- Inside source: true +*** True Line Result + def reset_player args +** Processing line: ~ args.state.player.x = 0~ +- Inside source: true +*** True Line Result + args.state.player.x = 0 +** Processing line: ~ args.state.player.y = args.state.bridge_top~ +- Inside source: true +*** True Line Result + args.state.player.y = args.state.bridge_top +** Processing line: ~ args.state.player.dy = 0~ +- Inside source: true +*** True Line Result + args.state.player.dy = 0 +** Processing line: ~ args.state.player.dx = 0~ +- Inside source: true +*** True Line Result + args.state.player.dx = 0 +** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ +- Inside source: true +*** True Line Result + args.state.enemy.hammers.clear # empties hammer collection +** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ +- Inside source: true +*** True Line Result + args.state.enemy.hammer_queue.clear # empties hammer_queue +** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ +- Inside source: true +*** True Line Result + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Processes input from the user to move the player~ +- Inside source: true +*** True Line Result + # Processes input from the user to move the player +** Processing line: ~ def input args~ +- Inside source: true +*** True Line Result + def input args +** Processing line: ~ if args.state.inputlist.length > 5~ +- Inside source: true +*** True Line Result + if args.state.inputlist.length > 5 +** Processing line: ~ args.state.inputlist.pop~ +- Inside source: true +*** True Line Result + args.state.inputlist.pop +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ should_process_special_move = (args.inputs.keyboard.key_down.j) ||~ +- Inside source: true +*** True Line Result + should_process_special_move = (args.inputs.keyboard.key_down.j) || +** Processing line: ~ (args.inputs.keyboard.key_down.k) ||~ +- Inside source: true +*** True Line Result + (args.inputs.keyboard.key_down.k) || +** Processing line: ~ (args.inputs.keyboard.key_down.a) ||~ +- Inside source: true +*** True Line Result + (args.inputs.keyboard.key_down.a) || +** Processing line: ~ (args.inputs.keyboard.key_down.d) ||~ +- Inside source: true +*** True Line Result + (args.inputs.keyboard.key_down.d) || +** Processing line: ~ (args.inputs.controller_one.key_down.y) ||~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.y) || +** Processing line: ~ (args.inputs.controller_one.key_down.x) ||~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.x) || +** Processing line: ~ (args.inputs.controller_one.key_down.left) ||~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.left) || +** Processing line: ~ (args.inputs.controller_one.key_down.right)~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.right) +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (should_process_special_move)~ +- Inside source: true +*** True Line Result + if (should_process_special_move) +** Processing line: ~ if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||~ +- Inside source: true +*** True Line Result + if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) || +** Processing line: ~ (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y) +** Processing line: ~ args.state.inputlist.unshift("shield")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("shield") +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&~ +- Inside source: true +*** True Line Result + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && +** Processing line: ~ (args.state.inputlist[0] == "forward-attack") && ((args.state.tick_count - args.state.lastpush) <= 15)~ +- Inside source: true +*** True Line Result + (args.state.inputlist[0] == "forward-attack") && ((args.state.tick_count - args.state.lastpush) <= 15) +** Processing line: ~ args.state.inputlist.unshift("dash-attack")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("dash-attack") +** Processing line: ~ args.state.player.dx = 20~ +- Inside source: true +*** True Line Result + args.state.player.dx = 20 +** Processing line: ~ elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||~ +- Inside source: true +*** True Line Result + elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) || +** Processing line: ~ (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)~ +- Inside source: true +*** True Line Result + (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left) +** Processing line: ~ args.state.inputlist.unshift("back-attack")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("back-attack") +** Processing line: ~ elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)~ +- Inside source: true +*** True Line Result + elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j) +** Processing line: ~ args.state.inputlist.unshift("forward-attack")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("forward-attack") +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&~ +- Inside source: true +*** True Line Result + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) && +** Processing line: ~ (args.state.player.y > 128)~ +- Inside source: true +*** True Line Result + (args.state.player.y > 128) +** Processing line: ~ args.state.inputlist.unshift("dair")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("dair") +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)~ +- Inside source: true +*** True Line Result + elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) +** Processing line: ~ args.state.inputlist.unshift("up-attack")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("up-attack") +** Processing line: ~ elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&~ +- Inside source: true +*** True Line Result + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) && +** Processing line: ~ (args.state.inputlist[0] == "<") &&~ +- Inside source: true +*** True Line Result + (args.state.inputlist[0] == "<") && +** Processing line: ~ ((args.state.tick_count - args.state.lastpush) <= 10)~ +- Inside source: true +*** True Line Result + ((args.state.tick_count - args.state.lastpush) <= 10) +** Processing line: ~ args.state.inputlist.unshift("<<")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("<<") +** Processing line: ~ args.state.player.dx = -15~ +- Inside source: true +*** True Line Result + args.state.player.dx = -15 +** Processing line: ~ elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)~ +- Inside source: true +*** True Line Result + elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) +** Processing line: ~ args.state.inputlist.unshift("<")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift("<") +** Processing line: ~ args.state.timeleft = args.state.tick_count~ +- Inside source: true +*** True Line Result + args.state.timeleft = args.state.tick_count +** Processing line: ~ elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)~ +- Inside source: true +*** True Line Result + elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d) +** Processing line: ~ args.state.inputlist.unshift(">")~ +- Inside source: true +*** True Line Result + args.state.inputlist.unshift(">") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.lastpush = args.state.tick_count~ +- Inside source: true +*** True Line Result + args.state.lastpush = args.state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar +** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ +- Inside source: true +*** True Line Result + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ +- Inside source: true +*** True Line Result + # if the time that has passed since the jump is less than the player's jump duration and +** Processing line: ~ # the player is not falling~ +- Inside source: true +*** True Line Result + # the player is not falling +** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ +- Inside source: true +*** True Line Result + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling +** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ +- Inside source: true +*** True Line Result + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ +- Inside source: true +*** True Line Result + # if the space bar is in the "up" state (or not being pressed down) +** Processing line: ~ if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2 +** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ +- Inside source: true +*** True Line Result + args.state.player.jumped_at = nil # jumped_at is empty +** Processing line: ~ args.state.player.falling = true # the player is falling~ +- Inside source: true +*** True Line Result + args.state.player.falling = true # the player is falling +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.left # if left key is pressed~ +- Inside source: true +*** True Line Result + if args.inputs.left # if left key is pressed +** Processing line: ~ if args.state.player.dx < -5~ +- Inside source: true +*** True Line Result + if args.state.player.dx < -5 +** Processing line: ~ args.state.player.dx = args.state.player.dx~ +- Inside source: true +*** True Line Result + args.state.player.dx = args.state.player.dx +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.state.player.dx = -5~ +- Inside source: true +*** True Line Result + args.state.player.dx = -5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ elsif args.inputs.right # if right key is pressed~ +- Inside source: true +*** True Line Result + elsif args.inputs.right # if right key is pressed +** Processing line: ~ if args.state.player.dx > 5~ +- Inside source: true +*** True Line Result + if args.state.player.dx > 5 +** Processing line: ~ args.state.player.dx = args.state.player.dx~ +- Inside source: true +*** True Line Result + args.state.player.dx = args.state.player.dx +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.state.player.dx = 5~ +- Inside source: true +*** True Line Result + args.state.player.dx = 5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ +- Inside source: true +*** True Line Result + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)~ +- Inside source: true +*** True Line Result + if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10) +** Processing line: ~ args.state.player.dx *= 0.95~ +- Inside source: true +*** True Line Result + args.state.player.dx *= 0.95 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick_instructions args, text, y = 715~ +- Inside source: true +*** True Line Result + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ +- Inside source: true +*** True Line Result + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.space || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +- Inside source: true +*** True Line Result + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Lowrez - Nokia 3310 - main.rb~ - Header detected. *** True Line Result @@ -102520,10 +111339,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result r: 255, g: 255, b: 255 -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -102560,10 +111379,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result r: 255, g: 255, b: 255 -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -103572,10 +112391,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 100 -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ - Inside source: true *** True Line Result - }.line + }.line! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -103624,10 +112443,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 100 -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ - Inside source: true *** True Line Result - }.line + }.line! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -106640,10 +115459,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 80 -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ - Inside source: true *** True Line Result - }.line + }.line! ** Processing line: ~~ - Inside source: true *** True Line Result @@ -106684,10 +115503,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result a: 80 -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ - Inside source: true *** True Line Result - }.line + }.line! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -106792,10 +115611,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -1.5 -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -106828,10 +115647,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result alignment_enum: 1 -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -106856,42 +115675,366 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~*** Platformer - Clepto Frog - main.rb~ +** Processing line: ~*** Mario - Jumping - main.rb~ - Header detected. *** True Line Result *** True Line Result -*** Platformer - Clepto Frog - main.rb +*** Mario - Jumping - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/main.rb~ +** Processing line: ~ # ./samples/99_genre_mario/01_jumping/app/main.rb~ - Inside source: true *** True Line Result - # ./samples/99_genre_platformer/clepto_frog/app/main.rb -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ + # ./samples/99_genre_mario/01_jumping/app/main.rb +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ defaults args~ +- Inside source: true +*** True Line Result + defaults args +** Processing line: ~ render args~ +- Inside source: true +*** True Line Result + render args +** Processing line: ~ input args~ - Inside source: true *** True Line Result - MAP_FILE_PATH = 'app/map.txt' + input args +** Processing line: ~ calc args~ +- Inside source: true +*** True Line Result + calc args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ require 'app/map.rb'~ +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - require 'app/map.rb' + def defaults args +** Processing line: ~ args.state.player.x ||= args.grid.w.half~ +- Inside source: true +*** True Line Result + args.state.player.x ||= args.grid.w.half +** Processing line: ~ args.state.player.y ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.y ||= 0 +** Processing line: ~ args.state.player.size ||= 100~ +- Inside source: true +*** True Line Result + args.state.player.size ||= 100 +** Processing line: ~ args.state.player.dy ||= 0~ +- Inside source: true +*** True Line Result + args.state.player.dy ||= 0 +** Processing line: ~ args.state.player.action ||= :jumping~ +- Inside source: true +*** True Line Result + args.state.player.action ||= :jumping +** Processing line: ~ args.state.jump.power = 20~ +- Inside source: true +*** True Line Result + args.state.jump.power = 20 +** Processing line: ~ args.state.jump.increase_frames = 10~ +- Inside source: true +*** True Line Result + args.state.jump.increase_frames = 10 +** Processing line: ~ args.state.jump.increase_power = 1~ +- Inside source: true +*** True Line Result + args.state.jump.increase_power = 1 +** Processing line: ~ args.state.gravity = -1~ +- Inside source: true +*** True Line Result + args.state.gravity = -1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class CleptoFrog~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - class CleptoFrog + def render args +** Processing line: ~ args.outputs.sprites << {~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { +** Processing line: ~ x: args.state.player.x -~ +- Inside source: true +*** True Line Result + x: args.state.player.x - +** Processing line: ~ args.state.player.size.half,~ +- Inside source: true +*** True Line Result + args.state.player.size.half, +** Processing line: ~ y: args.state.player.y,~ +- Inside source: true +*** True Line Result + y: args.state.player.y, +** Processing line: ~ w: args.state.player.size,~ +- Inside source: true +*** True Line Result + w: args.state.player.size, +** Processing line: ~ h: args.state.player.size,~ +- Inside source: true +*** True Line Result + h: args.state.player.size, +** Processing line: ~ path: 'sprites/square/red.png'~ +- Inside source: true +*** True Line Result + path: 'sprites/square/red.png' +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input args~ +- Inside source: true +*** True Line Result + def input args +** Processing line: ~ if args.inputs.keyboard.key_down.space~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.space +** Processing line: ~ if args.state.player.action == :standing~ +- Inside source: true +*** True Line Result + if args.state.player.action == :standing +** Processing line: ~ args.state.player.action = :jumping~ +- Inside source: true +*** True Line Result + args.state.player.action = :jumping +** Processing line: ~ args.state.player.dy = args.state.jump.power~ +- Inside source: true +*** True Line Result + args.state.player.dy = args.state.jump.power +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # record when the action took place~ +- Inside source: true +*** True Line Result + # record when the action took place +** Processing line: ~ current_frame = args.state.tick_count~ +- Inside source: true +*** True Line Result + current_frame = args.state.tick_count +** Processing line: ~ args.state.player.action_at = current_frame~ +- Inside source: true +*** True Line Result + args.state.player.action_at = current_frame +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # if the space bar is being held~ +- Inside source: true +*** True Line Result + # if the space bar is being held +** Processing line: ~ if args.inputs.keyboard.key_held.space~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_held.space +** Processing line: ~ # is the player jumping~ +- Inside source: true +*** True Line Result + # is the player jumping +** Processing line: ~ is_jumping = args.state.player.action == :jumping~ +- Inside source: true +*** True Line Result + is_jumping = args.state.player.action == :jumping +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # when was the jump performed~ +- Inside source: true +*** True Line Result + # when was the jump performed +** Processing line: ~ time_of_jump = args.state.player.action_at~ +- Inside source: true +*** True Line Result + time_of_jump = args.state.player.action_at +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # how much time has passed since the jump~ +- Inside source: true +*** True Line Result + # how much time has passed since the jump +** Processing line: ~ jump_elapsed_time = time_of_jump.elapsed_time~ +- Inside source: true +*** True Line Result + jump_elapsed_time = time_of_jump.elapsed_time +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # how much time is allowed for increasing power~ +- Inside source: true +*** True Line Result + # how much time is allowed for increasing power +** Processing line: ~ time_allowed = args.state.jump.increase_frames~ +- Inside source: true +*** True Line Result + time_allowed = args.state.jump.increase_frames +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # if the player is jumping~ +- Inside source: true +*** True Line Result + # if the player is jumping +** Processing line: ~ # and the elapsed time is less than~ +- Inside source: true +*** True Line Result + # and the elapsed time is less than +** Processing line: ~ # the allowed time~ +- Inside source: true +*** True Line Result + # the allowed time +** Processing line: ~ if is_jumping && jump_elapsed_time < time_allowed~ +- Inside source: true +*** True Line Result + if is_jumping && jump_elapsed_time < time_allowed +** Processing line: ~ # increase the dy by the increase power~ +- Inside source: true +*** True Line Result + # increase the dy by the increase power +** Processing line: ~ power_to_add = args.state.jump.increase_power~ +- Inside source: true +*** True Line Result + power_to_add = args.state.jump.increase_power +** Processing line: ~ args.state.player.dy += power_to_add~ +- Inside source: true +*** True Line Result + args.state.player.dy += power_to_add +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc args~ +- Inside source: true +*** True Line Result + def calc args +** Processing line: ~ if args.state.player.action == :jumping~ +- Inside source: true +*** True Line Result + if args.state.player.action == :jumping +** Processing line: ~ args.state.player.y += args.state.player.dy~ +- Inside source: true +*** True Line Result + args.state.player.y += args.state.player.dy +** Processing line: ~ args.state.player.dy += args.state.gravity~ +- Inside source: true +*** True Line Result + args.state.player.dy += args.state.gravity +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.player.y < 0~ +- Inside source: true +*** True Line Result + if args.state.player.y < 0 +** Processing line: ~ args.state.player.y = 0~ +- Inside source: true +*** True Line Result + args.state.player.y = 0 +** Processing line: ~ args.state.player.action = :standing~ +- Inside source: true +*** True Line Result + args.state.player.action = :standing +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Mario - Jumping And Collisions - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Mario - Jumping And Collisions - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_mario/02_jumping_and_collisions/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_mario/02_jumping_and_collisions/app/main.rb +** Processing line: ~ class Game~ +- Inside source: true +*** True Line Result + class Game ** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result @@ -106900,78 +116043,466 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_ending~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - def render_ending -** Processing line: ~ state.game_over_at ||= state.tick_count~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - state.game_over_at ||= state.tick_count + defaults +** Processing line: ~ render~ +- Inside source: true +*** True Line Result + render +** Processing line: ~ input~ +- Inside source: true +*** True Line Result + input +** Processing line: ~ calc~ +- Inside source: true +*** True Line Result + calc +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Clepto Frog", 4, 1] + def defaults +** Processing line: ~ return if state.tick_count != 0~ +- Inside source: true +*** True Line Result + return if state.tick_count != 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ +** Processing line: ~ player.x = 64~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 120) -** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ + player.x = 64 +** Processing line: ~ player.y = 800~ - Inside source: true *** True Line Result - outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ + player.y = 800 +** Processing line: ~ player.size = 50~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] + player.size = 50 +** Processing line: ~ player.dx = 0~ +- Inside source: true +*** True Line Result + player.dx = 0 +** Processing line: ~ player.dy = 0~ +- Inside source: true +*** True Line Result + player.dy = 0 +** Processing line: ~ player.action = :falling~ +- Inside source: true +*** True Line Result + player.action = :falling +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ player.max_speed = 20~ +- Inside source: true +*** True Line Result + player.max_speed = 20 +** Processing line: ~ player.jump_power = 15~ +- Inside source: true +*** True Line Result + player.jump_power = 15 +** Processing line: ~ player.jump_air_time = 15~ +- Inside source: true +*** True Line Result + player.jump_air_time = 15 +** Processing line: ~ player.jump_increase_power = 1~ +- Inside source: true +*** True Line Result + player.jump_increase_power = 1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ state.gravity = -1~ +- Inside source: true +*** True Line Result + state.gravity = -1 +** Processing line: ~ state.drag = 0.001~ +- Inside source: true +*** True Line Result + state.drag = 0.001 +** Processing line: ~ state.tile_size = 64~ +- Inside source: true +*** True Line Result + state.tile_size = 64 +** Processing line: ~ state.tiles ||= [~ +- Inside source: true +*** True Line Result + state.tiles ||= [ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 0, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 1, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 2, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 3, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 4, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 5, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 6, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 7, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 8, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 9, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 10, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 10, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 11, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 11, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 12, ordinal_y: 0 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 12, ordinal_y: 0 }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { ordinal_x: 9, ordinal_y: 3 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 9, ordinal_y: 3 }, +** Processing line: ~ { ordinal_x: 10, ordinal_y: 3 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 10, ordinal_y: 3 }, +** Processing line: ~ { ordinal_x: 11, ordinal_y: 3 },~ +- Inside source: true +*** True Line Result + { ordinal_x: 11, ordinal_y: 3 }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ tiles.each do |t|~ +- Inside source: true +*** True Line Result + tiles.each do |t| +** Processing line: ~ t.rect = { x: t.ordinal_x * 64,~ +- Inside source: true +*** True Line Result + t.rect = { x: t.ordinal_x * 64, +** Processing line: ~ y: t.ordinal_y * 64,~ +- Inside source: true +*** True Line Result + y: t.ordinal_y * 64, +** Processing line: ~ w: 64,~ +- Inside source: true +*** True Line Result + w: 64, +** Processing line: ~ h: 64 }~ +- Inside source: true +*** True Line Result + h: 64 } ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 240) -** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ + def render +** Processing line: ~ render_player~ - Inside source: true *** True Line Result - outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ + render_player +** Processing line: ~ render_tiles~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)] + render_tiles +** Processing line: ~ # render_grid~ +- Inside source: true +*** True Line Result + # render_grid +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input~ +- Inside source: true +*** True Line Result + def input +** Processing line: ~ input_jump~ +- Inside source: true +*** True Line Result + input_jump +** Processing line: ~ input_move~ +- Inside source: true +*** True Line Result + input_move +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc~ +- Inside source: true +*** True Line Result + def calc +** Processing line: ~ calc_player_rect~ +- Inside source: true +*** True Line Result + calc_player_rect +** Processing line: ~ calc_left~ +- Inside source: true +*** True Line Result + calc_left +** Processing line: ~ calc_right~ +- Inside source: true +*** True Line Result + calc_right +** Processing line: ~ calc_below~ +- Inside source: true +*** True Line Result + calc_below +** Processing line: ~ calc_above~ +- Inside source: true +*** True Line Result + calc_above +** Processing line: ~ calc_player_dy~ +- Inside source: true +*** True Line Result + calc_player_dy +** Processing line: ~ calc_player_dx~ +- Inside source: true +*** True Line Result + calc_player_dx +** Processing line: ~ calc_game_over~ +- Inside source: true +*** True Line Result + calc_game_over +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_player~ +- Inside source: true +*** True Line Result + def render_player +** Processing line: ~ outputs.sprites << {~ +- Inside source: true +*** True Line Result + outputs.sprites << { +** Processing line: ~ x: player.x,~ +- Inside source: true +*** True Line Result + x: player.x, +** Processing line: ~ y: player.y,~ +- Inside source: true +*** True Line Result + y: player.y, +** Processing line: ~ w: player.size,~ +- Inside source: true +*** True Line Result + w: player.size, +** Processing line: ~ h: player.size,~ +- Inside source: true +*** True Line Result + h: player.size, +** Processing line: ~ path: 'sprites/square/red.png'~ +- Inside source: true +*** True Line Result + path: 'sprites/square/red.png' +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_tiles~ +- Inside source: true +*** True Line Result + def render_tiles +** Processing line: ~ outputs.sprites << state.tiles.map do |t|~ +- Inside source: true +*** True Line Result + outputs.sprites << state.tiles.map do |t| +** Processing line: ~ t.merge path: 'sprites/square/white.png',~ +- Inside source: true +*** True Line Result + t.merge path: 'sprites/square/white.png', +** Processing line: ~ x: t.ordinal_x * 64,~ +- Inside source: true +*** True Line Result + x: t.ordinal_x * 64, +** Processing line: ~ y: t.ordinal_y * 64,~ +- Inside source: true +*** True Line Result + y: t.ordinal_y * 64, +** Processing line: ~ w: 64,~ +- Inside source: true +*** True Line Result + w: 64, +** Processing line: ~ h: 64~ +- Inside source: true +*** True Line Result + h: 64 ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ +** Processing line: ~ def render_grid~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 360) -** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ + def render_grid +** Processing line: ~ if state.tick_count == 0~ - Inside source: true *** True Line Result - outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ + if state.tick_count == 0 +** Processing line: ~ outputs[:grid].background_color = [0, 0, 0, 0]~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)] + outputs[:grid].background_color = [0, 0, 0, 0] +** Processing line: ~ outputs[:grid].borders << available_brick_locations~ +- Inside source: true +*** True Line Result + outputs[:grid].borders << available_brick_locations +** Processing line: ~ outputs[:grid].labels << available_brick_locations.map do |b|~ +- Inside source: true +*** True Line Result + outputs[:grid].labels << available_brick_locations.map do |b| +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ b.merge(text: "#{b.ordinal_x},#{b.ordinal_y}",~ +- Inside source: true +*** True Line Result + b.merge(text: "#{b.ordinal_x},#{b.ordinal_y}", +** Processing line: ~ x: b.x + 2,~ +- Inside source: true +*** True Line Result + x: b.x + 2, +** Processing line: ~ y: b.y + 2,~ +- Inside source: true +*** True Line Result + y: b.y + 2, +** Processing line: ~ size_enum: -3,~ +- Inside source: true +*** True Line Result + size_enum: -3, +** Processing line: ~ vertical_alignment_enum: 0,~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 0, +** Processing line: ~ blendmode_enum: 0),~ +- Inside source: true +*** True Line Result + blendmode_enum: 0), +** Processing line: ~ b.merge(text: "#{b.x},#{b.y}",~ +- Inside source: true +*** True Line Result + b.merge(text: "#{b.x},#{b.y}", +** Processing line: ~ x: b.x + 2,~ +- Inside source: true +*** True Line Result + x: b.x + 2, +** Processing line: ~ y: b.y + 2 + 20,~ +- Inside source: true +*** True Line Result + y: b.y + 2 + 20, +** Processing line: ~ size_enum: -3,~ +- Inside source: true +*** True Line Result + size_enum: -3, +** Processing line: ~ vertical_alignment_enum: 0,~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 0, +** Processing line: ~ blendmode_enum: 0)~ +- Inside source: true +*** True Line Result + blendmode_enum: 0) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -106980,38 +116511,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ +** Processing line: ~ outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :grid }~ - Inside source: true *** True Line Result - outputs.sprites << [640 - 50, 360 - 50, 100, 100, -** Processing line: ~ "sprites/square-green.png"]~ + outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :grid } +** Processing line: ~ end~ - Inside source: true *** True Line Result - "sprites/square-green.png"] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ +** Processing line: ~ def input_jump~ - Inside source: true *** True Line Result - outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1] -** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ + def input_jump +** Processing line: ~ if inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1] + if inputs.keyboard.key_down.space +** Processing line: ~ player_jump~ +- Inside source: true +*** True Line Result + player_jump +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ +** Processing line: ~ if inputs.keyboard.key_held.space~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 550) -** Processing line: ~ restart_game~ + if inputs.keyboard.key_held.space +** Processing line: ~ player_jump_increase_air_time~ - Inside source: true *** True Line Result - restart_game + player_jump_increase_air_time ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -107024,58 +116563,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def restart_game~ +** Processing line: ~ def input_move~ - Inside source: true *** True Line Result - def restart_game -** Processing line: ~ state.world = nil~ + def input_move +** Processing line: ~ if player.dx.abs < 20~ - Inside source: true *** True Line Result - state.world = nil -** Processing line: ~ state.x = nil~ + if player.dx.abs < 20 +** Processing line: ~ if inputs.keyboard.left~ - Inside source: true *** True Line Result - state.x = nil -** Processing line: ~ state.y = nil~ + if inputs.keyboard.left +** Processing line: ~ player.dx -= 2~ - Inside source: true *** True Line Result - state.y = nil -** Processing line: ~ state.dx = nil~ + player.dx -= 2 +** Processing line: ~ elsif inputs.keyboard.right~ - Inside source: true *** True Line Result - state.dx = nil -** Processing line: ~ state.dy = nil~ + elsif inputs.keyboard.right +** Processing line: ~ player.dx += 2~ - Inside source: true *** True Line Result - state.dy = nil -** Processing line: ~ state.stuff_score = 0~ + player.dx += 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.stuff_score = 0 -** Processing line: ~ state.stuff_time = 0~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.stuff_time = 0 -** Processing line: ~ state.intro_tick_count = nil~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.intro_tick_count = nil -** Processing line: ~ defaults~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ state.game_start_at = state.tick_count~ + +** Processing line: ~ def calc_game_over~ - Inside source: true *** True Line Result - state.game_start_at = state.tick_count -** Processing line: ~ state.scene = :game~ + def calc_game_over +** Processing line: ~ if player.y < -64~ - Inside source: true *** True Line Result - state.scene = :game -** Processing line: ~ state.game_over_at = nil~ + if player.y < -64 +** Processing line: ~ player.x = 64~ - Inside source: true *** True Line Result - state.game_over_at = nil + player.x = 64 +** Processing line: ~ player.y = 800~ +- Inside source: true +*** True Line Result + player.y = 800 +** Processing line: ~ player.dx = 0~ +- Inside source: true +*** True Line Result + player.dx = 0 +** Processing line: ~ player.dy = 0~ +- Inside source: true +*** True Line Result + player.dy = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -107084,66 +116639,610 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_intro~ +** Processing line: ~ def calc_player_rect~ - Inside source: true *** True Line Result - def render_intro -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ + def calc_player_rect +** Processing line: ~ player.rect = player_current_rect~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Clepto Frog", 4, 1] -** Processing line: ~ if state.tick_count >= 120~ + player.rect = player_current_rect +** Processing line: ~ player.next_rect = player_next_rect~ +- Inside source: true +*** True Line Result + player.next_rect = player_next_rect +** Processing line: ~ player.prev_rect = player_prev_rect~ +- Inside source: true +*** True Line Result + player.prev_rect = player_prev_rect +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_player_dx~ +- Inside source: true +*** True Line Result + def calc_player_dx +** Processing line: ~ player.dx = player_next_dx~ +- Inside source: true +*** True Line Result + player.dx = player_next_dx +** Processing line: ~ player.x += player.dx~ +- Inside source: true +*** True Line Result + player.x += player.dx +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_player_dy~ - Inside source: true *** True Line Result - if state.tick_count >= 120 -** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ + def calc_player_dy +** Processing line: ~ player.y += player.dy~ +- Inside source: true +*** True Line Result + player.y += player.dy +** Processing line: ~ player.dy = player_next_dy~ +- Inside source: true +*** True Line Result + player.dy = player_next_dy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ + +** Processing line: ~ def calc_below~ +- Inside source: true +*** True Line Result + def calc_below +** Processing line: ~ return unless player.dy < 0~ +- Inside source: true +*** True Line Result + return unless player.dy < 0 +** Processing line: ~ tiles_below = tiles_find { |t| t.rect.top <= player.prev_rect.y }~ +- Inside source: true +*** True Line Result + tiles_below = tiles_find { |t| t.rect.top <= player.prev_rect.y } +** Processing line: ~ collision = tiles_find_colliding tiles_below, (player.rect.merge y: player.next_rect.y)~ +- Inside source: true +*** True Line Result + collision = tiles_find_colliding tiles_below, (player.rect.merge y: player.next_rect.y) +** Processing line: ~ if collision~ +- Inside source: true +*** True Line Result + if collision +** Processing line: ~ player.y = collision.rect.y + state.tile_size~ +- Inside source: true +*** True Line Result + player.y = collision.rect.y + state.tile_size +** Processing line: ~ player.dy = 0~ +- Inside source: true +*** True Line Result + player.dy = 0 +** Processing line: ~ player.action = :standing~ +- Inside source: true +*** True Line Result + player.action = :standing +** Processing line: ~ else~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 120.ease(60)] + else +** Processing line: ~ player.action = :falling~ +- Inside source: true +*** True Line Result + player.action = :falling ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_left~ +- Inside source: true +*** True Line Result + def calc_left +** Processing line: ~ return unless player.dx < 0 && player_next_dx < 0~ +- Inside source: true +*** True Line Result + return unless player.dx < 0 && player_next_dx < 0 +** Processing line: ~ tiles_left = tiles_find { |t| t.rect.right <= player.prev_rect.left }~ +- Inside source: true +*** True Line Result + tiles_left = tiles_find { |t| t.rect.right <= player.prev_rect.left } +** Processing line: ~ collision = tiles_find_colliding tiles_left, (player.rect.merge x: player.next_rect.x)~ +- Inside source: true +*** True Line Result + collision = tiles_find_colliding tiles_left, (player.rect.merge x: player.next_rect.x) +** Processing line: ~ return unless collision~ +- Inside source: true +*** True Line Result + return unless collision +** Processing line: ~ player.x = collision.rect.right~ +- Inside source: true +*** True Line Result + player.x = collision.rect.right +** Processing line: ~ player.dx = 0~ +- Inside source: true +*** True Line Result + player.dx = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_right~ +- Inside source: true +*** True Line Result + def calc_right +** Processing line: ~ return unless player.dx > 0 && player_next_dx > 0~ +- Inside source: true +*** True Line Result + return unless player.dx > 0 && player_next_dx > 0 +** Processing line: ~ tiles_right = tiles_find { |t| t.rect.left >= player.prev_rect.right }~ +- Inside source: true +*** True Line Result + tiles_right = tiles_find { |t| t.rect.left >= player.prev_rect.right } +** Processing line: ~ collision = tiles_find_colliding tiles_right, (player.rect.merge x: player.next_rect.x)~ +- Inside source: true +*** True Line Result + collision = tiles_find_colliding tiles_right, (player.rect.merge x: player.next_rect.x) +** Processing line: ~ return unless collision~ +- Inside source: true +*** True Line Result + return unless collision +** Processing line: ~ player.x = collision.rect.left - player.rect.w~ +- Inside source: true +*** True Line Result + player.x = collision.rect.left - player.rect.w +** Processing line: ~ player.dx = 0~ +- Inside source: true +*** True Line Result + player.dx = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_above~ +- Inside source: true +*** True Line Result + def calc_above +** Processing line: ~ return unless player.dy > 0~ +- Inside source: true +*** True Line Result + return unless player.dy > 0 +** Processing line: ~ tiles_above = tiles_find { |t| t.rect.y >= player.prev_rect.y }~ +- Inside source: true +*** True Line Result + tiles_above = tiles_find { |t| t.rect.y >= player.prev_rect.y } +** Processing line: ~ collision = tiles_find_colliding tiles_above, (player.rect.merge y: player.next_rect.y)~ +- Inside source: true +*** True Line Result + collision = tiles_find_colliding tiles_above, (player.rect.merge y: player.next_rect.y) +** Processing line: ~ return unless collision~ +- Inside source: true +*** True Line Result + return unless collision +** Processing line: ~ player.dy = 0~ +- Inside source: true +*** True Line Result + player.dy = 0 +** Processing line: ~ player.y = collision.rect.bottom - player.rect.h~ +- Inside source: true +*** True Line Result + player.y = collision.rect.bottom - player.rect.h +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= 240~ +** Processing line: ~ def player_current_rect~ - Inside source: true *** True Line Result - if state.tick_count >= 240 -** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ + def player_current_rect +** Processing line: ~ { x: player.x, y: player.y, w: player.size, h: player.size }~ - Inside source: true *** True Line Result - outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ + { x: player.x, y: player.y, w: player.size, h: player.size } +** Processing line: ~ end~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 240.ease(60)] + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def available_brick_locations~ +- Inside source: true +*** True Line Result + def available_brick_locations +** Processing line: ~ (0..19).to_a~ +- Inside source: true +*** True Line Result + (0..19).to_a +** Processing line: ~ .product(0..11)~ +- Inside source: true +*** True Line Result + .product(0..11) +** Processing line: ~ .map do |(ordinal_x, ordinal_y)|~ +- Inside source: true +*** True Line Result + .map do |(ordinal_x, ordinal_y)| +** Processing line: ~ { ordinal_x: ordinal_x,~ +- Inside source: true +*** True Line Result + { ordinal_x: ordinal_x, +** Processing line: ~ ordinal_y: ordinal_y,~ +- Inside source: true +*** True Line Result + ordinal_y: ordinal_y, +** Processing line: ~ x: ordinal_x * 64,~ +- Inside source: true +*** True Line Result + x: ordinal_x * 64, +** Processing line: ~ y: ordinal_y * 64,~ +- Inside source: true +*** True Line Result + y: ordinal_y * 64, +** Processing line: ~ w: 64,~ +- Inside source: true +*** True Line Result + w: 64, +** Processing line: ~ h: 64 }~ +- Inside source: true +*** True Line Result + h: 64 } ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player~ +- Inside source: true +*** True Line Result + def player +** Processing line: ~ state.player ||= args.state.new_entity :player~ +- Inside source: true +*** True Line Result + state.player ||= args.state.new_entity :player +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_next_dy~ +- Inside source: true +*** True Line Result + def player_next_dy +** Processing line: ~ player.dy + state.gravity + state.drag ** 2 * -1~ +- Inside source: true +*** True Line Result + player.dy + state.gravity + state.drag ** 2 * -1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_next_dx~ +- Inside source: true +*** True Line Result + def player_next_dx +** Processing line: ~ player.dx * 0.8~ +- Inside source: true +*** True Line Result + player.dx * 0.8 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_next_rect~ +- Inside source: true +*** True Line Result + def player_next_rect +** Processing line: ~ player.rect.merge x: player.x + player_next_dx,~ +- Inside source: true +*** True Line Result + player.rect.merge x: player.x + player_next_dx, +** Processing line: ~ y: player.y + player_next_dy~ +- Inside source: true +*** True Line Result + y: player.y + player_next_dy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_prev_rect~ +- Inside source: true +*** True Line Result + def player_prev_rect +** Processing line: ~ player.rect.merge x: player.x - player.dx,~ +- Inside source: true +*** True Line Result + player.rect.merge x: player.x - player.dx, +** Processing line: ~ y: player.y - player.dy~ +- Inside source: true +*** True Line Result + y: player.y - player.dy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_jump~ +- Inside source: true +*** True Line Result + def player_jump +** Processing line: ~ return if player.action != :standing~ +- Inside source: true +*** True Line Result + return if player.action != :standing +** Processing line: ~ player.action = :jumping~ +- Inside source: true +*** True Line Result + player.action = :jumping +** Processing line: ~ player.dy = state.player.jump_power~ +- Inside source: true +*** True Line Result + player.dy = state.player.jump_power +** Processing line: ~ current_frame = state.tick_count~ +- Inside source: true +*** True Line Result + current_frame = state.tick_count +** Processing line: ~ player.action_at = current_frame~ +- Inside source: true +*** True Line Result + player.action_at = current_frame +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def player_jump_increase_air_time~ +- Inside source: true +*** True Line Result + def player_jump_increase_air_time +** Processing line: ~ return if player.action != :jumping~ +- Inside source: true +*** True Line Result + return if player.action != :jumping +** Processing line: ~ return if player.action_at.elapsed_time >= player.jump_air_time~ +- Inside source: true +*** True Line Result + return if player.action_at.elapsed_time >= player.jump_air_time +** Processing line: ~ player.dy += player.jump_increase_power~ +- Inside source: true +*** True Line Result + player.dy += player.jump_increase_power +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tiles~ +- Inside source: true +*** True Line Result + def tiles +** Processing line: ~ state.tiles~ +- Inside source: true +*** True Line Result + state.tiles +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tiles_find_colliding tiles, target~ +- Inside source: true +*** True Line Result + def tiles_find_colliding tiles, target +** Processing line: ~ tiles.find { |t| t.rect.intersect_rect? target }~ +- Inside source: true +*** True Line Result + tiles.find { |t| t.rect.intersect_rect? target } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tiles_find &block~ +- Inside source: true +*** True Line Result + def tiles_find &block +** Processing line: ~ tiles.find_all(&block)~ +- Inside source: true +*** True Line Result + tiles.find_all(&block) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ $game ||= Game.new~ +- Inside source: true +*** True Line Result + $game ||= Game.new +** Processing line: ~ $game.args = args~ +- Inside source: true +*** True Line Result + $game.args = args +** Processing line: ~ $game.tick~ +- Inside source: true +*** True Line Result + $game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= 360~ +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - if state.tick_count >= 360 -** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ + $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << [640, 540, "\"Uh...\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Platformer - Clepto Frog - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Platformer - Clepto Frog - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_platformer/clepto_frog/app/main.rb +** Processing line: ~ MAP_FILE_PATH = 'map.txt'~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 360.ease(60)] + MAP_FILE_PATH = 'map.txt' +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ require 'app/map.rb'~ +- Inside source: true +*** True Line Result + require 'app/map.rb' +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class CleptoFrog~ +- Inside source: true +*** True Line Result + class CleptoFrog +** Processing line: ~ attr_gtk~ +- Inside source: true +*** True Line Result + attr_gtk +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_ending~ +- Inside source: true +*** True Line Result + def render_ending +** Processing line: ~ state.game_over_at ||= state.tick_count~ +- Inside source: true +*** True Line Result + state.game_over_at ||= state.tick_count +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 700, "Clepto Frog", 4, 1] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ +- Inside source: true +*** True Line Result + if state.tick_count >= (state.game_over_at + 120) +** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ +- Inside source: true +*** True Line Result + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -107152,18 +117251,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= 480~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ - Inside source: true *** True Line Result - if state.tick_count >= 480 -** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ + if state.tick_count >= (state.game_over_at + 240) +** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ - Inside source: true *** True Line Result - outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ + outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 480.ease(60)] + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -107172,18 +117271,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count >= 600~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ - Inside source: true *** True Line Result - if state.tick_count >= 600 -** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ + if state.tick_count >= (state.game_over_at + 360) +** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ - Inside source: true *** True Line Result - outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ + outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 600.ease(60)] + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -107204,10 +117303,110 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if state.tick_count == 800~ +** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1] +** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ +- Inside source: true +*** True Line Result + if state.tick_count >= (state.game_over_at + 550) +** Processing line: ~ restart_game~ +- Inside source: true +*** True Line Result + restart_game +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def restart_game~ - Inside source: true *** True Line Result - if state.tick_count == 800 + def restart_game +** Processing line: ~ state.world = nil~ +- Inside source: true +*** True Line Result + state.world = nil +** Processing line: ~ state.x = nil~ +- Inside source: true +*** True Line Result + state.x = nil +** Processing line: ~ state.y = nil~ +- Inside source: true +*** True Line Result + state.y = nil +** Processing line: ~ state.dx = nil~ +- Inside source: true +*** True Line Result + state.dx = nil +** Processing line: ~ state.dy = nil~ +- Inside source: true +*** True Line Result + state.dy = nil +** Processing line: ~ state.stuff_score = 0~ +- Inside source: true +*** True Line Result + state.stuff_score = 0 +** Processing line: ~ state.stuff_time = 0~ +- Inside source: true +*** True Line Result + state.stuff_time = 0 +** Processing line: ~ state.intro_tick_count = nil~ +- Inside source: true +*** True Line Result + state.intro_tick_count = nil +** Processing line: ~ defaults~ +- Inside source: true +*** True Line Result + defaults +** Processing line: ~ state.game_start_at = state.tick_count~ +- Inside source: true +*** True Line Result + state.game_start_at = state.tick_count +** Processing line: ~ state.scene = :game~ +- Inside source: true +*** True Line Result + state.scene = :game +** Processing line: ~ state.game_over_at = nil~ +- Inside source: true +*** True Line Result + state.game_over_at = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_intro~ +- Inside source: true +*** True Line Result + def render_intro +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 700, "Clepto Frog", 4, 1] +** Processing line: ~ if state.tick_count == 120~ +- Inside source: true +*** True Line Result + if state.tick_count == 120 ** Processing line: ~ state.scene = :game~ - Inside source: true *** True Line Result @@ -107236,10 +117435,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result defaults -** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ +** Processing line: ~ if state.scene == :intro && state.tick_count <= 120~ - Inside source: true *** True Line Result - if state.scene == :intro && state.tick_count <= 800 + if state.scene == :intro && state.tick_count <= 120 ** Processing line: ~ render_intro~ - Inside source: true *** True Line Result @@ -107648,18 +117847,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # SHOW HIDE COLLISIONS -** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ +** Processing line: ~ outputs.sprites << state.world.map do |rect|~ - Inside source: true *** True Line Result - outputs.sprites << state.world.map do |x, y, w, h| -** Processing line: ~ x = vx(x)~ + outputs.sprites << state.world.map do |rect| +** Processing line: ~ x = vx(rect.x)~ - Inside source: true *** True Line Result - x = vx(x) -** Processing line: ~ y = vy(y)~ + x = vx(rect.x) +** Processing line: ~ y = vy(rect.y)~ - Inside source: true *** True Line Result - y = vy(y) + y = vy(rect.y) ** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ - Inside source: true *** True Line Result @@ -107676,14 +117875,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result y: y, -** Processing line: ~ w: vw(w || state.tile_size),~ +** Processing line: ~ w: vw(rect.w || state.tile_size),~ - Inside source: true *** True Line Result - w: vw(w || state.tile_size), -** Processing line: ~ h: vh(h || state.tile_size),~ + w: vw(rect.w || state.tile_size), +** Processing line: ~ h: vh(rect.h || state.tile_size),~ - Inside source: true *** True Line Result - h: vh(h || state.tile_size), + h: vh(rect.h || state.tile_size), ** Processing line: ~ path: 'sprites/square-gray.png',~ - Inside source: true *** True Line Result @@ -107772,14 +117971,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # Creates sprite following mouse to help indicate which sprite you have selected -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 32 * state.camera_scale,~ +- Inside source: true +*** True Line Result + outputs.primitives << [inputs.mouse.position.x - 32 * state.camera_scale, +** Processing line: ~ inputs.mouse.position.y - 32 * state.camera_scale,~ +- Inside source: true +*** True Line Result + inputs.mouse.position.y - 32 * state.camera_scale, +** Processing line: ~ state.tile_size * state.camera_scale,~ - Inside source: true *** True Line Result - outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, -** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ + state.tile_size * state.camera_scale, +** Processing line: ~ state.tile_size * state.camera_scale, 'sprites/square-indigo.png', 0, 100].sprite~ - Inside source: true *** True Line Result - state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite + state.tile_size * state.camera_scale, 'sprites/square-indigo.png', 0, 100].sprite ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -108100,6 +118307,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ if inputs.mouse.click~ +- Inside source: true +*** True Line Result + if inputs.mouse.click +** Processing line: ~ state.id_seed += 1~ +- Inside source: true +*** True Line Result + state.id_seed += 1 +** Processing line: ~ id = state.id_seed~ +- Inside source: true +*** True Line Result + id = state.id_seed +** Processing line: ~ x = state.camera_x + (inputs.mouse.click.x.fdiv(state.camera_scale) - 32)~ +- Inside source: true +*** True Line Result + x = state.camera_x + (inputs.mouse.click.x.fdiv(state.camera_scale) - 32) +** Processing line: ~ y = state.camera_y + (inputs.mouse.click.y.fdiv(state.camera_scale) - 32)~ +- Inside source: true +*** True Line Result + y = state.camera_y + (inputs.mouse.click.y.fdiv(state.camera_scale) - 32) +** Processing line: ~ x = ((x + 2).idiv 4) * 4~ +- Inside source: true +*** True Line Result + x = ((x + 2).idiv 4) * 4 +** Processing line: ~ y = ((y + 2).idiv 4) * 4~ +- Inside source: true +*** True Line Result + y = ((y + 2).idiv 4) * 4 +** Processing line: ~ w = 64~ +- Inside source: true +*** True Line Result + w = 64 +** Processing line: ~ h = 64~ +- Inside source: true +*** True Line Result + h = 64 +** Processing line: ~ candidate_rect = { id: id, x: x, y: y, w: w, h: h }~ +- Inside source: true +*** True Line Result + candidate_rect = { id: id, x: x, y: y, w: w, h: h } +** Processing line: ~ scaled_candidate_rect = { x: x + 30, y: y + 30, w: w - 60, h: h - 60 }~ +- Inside source: true +*** True Line Result + scaled_candidate_rect = { x: x + 30, y: y + 30, w: w - 60, h: h - 60 } +** Processing line: ~ to_remove = state.world.find { |r| r.intersect_rect? scaled_candidate_rect }~ +- Inside source: true +*** True Line Result + to_remove = state.world.find { |r| r.intersect_rect? scaled_candidate_rect } +** Processing line: ~ if to_remove && args.inputs.keyboard.x~ +- Inside source: true +*** True Line Result + if to_remove && args.inputs.keyboard.x +** Processing line: ~ state.world.reject! { |r| r.id == to_remove.id }~ +- Inside source: true +*** True Line Result + state.world.reject! { |r| r.id == to_remove.id } +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ state.world << candidate_rect~ +- Inside source: true +*** True Line Result + state.world << candidate_rect +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ export_map~ +- Inside source: true +*** True Line Result + export_map +** Processing line: ~ state.world_lookup = {}~ +- Inside source: true +*** True Line Result + state.world_lookup = {} +** Processing line: ~ state.world_collision_rects = nil~ +- Inside source: true +*** True Line Result + state.world_collision_rects = nil +** Processing line: ~ calc_world_lookup~ +- Inside source: true +*** True Line Result + calc_world_lookup +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ if input_up?~ - Inside source: true *** True Line Result @@ -108184,30 +118483,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result process_inputs_god_mode -** Processing line: ~ elsif state.scene == :intro~ -- Inside source: true -*** True Line Result - elsif state.scene == :intro -** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ -- Inside source: true -*** True Line Result - if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space -** Processing line: ~ if Kernel.tick_count < 600~ -- Inside source: true -*** True Line Result - if Kernel.tick_count < 600 -** Processing line: ~ Kernel.tick_count = 600~ -- Inside source: true -*** True Line Result - Kernel.tick_count = 600 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -108596,50 +118871,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def add_floors~ -- Inside source: true -*** True Line Result - def add_floors -** Processing line: ~ # floors~ -- Inside source: true -*** True Line Result - # floors -** Processing line: ~ state.world += [~ -- Inside source: true -*** True Line Result - state.world += [ -** Processing line: ~ [0, 0, 10000, 40],~ -- Inside source: true -*** True Line Result - [0, 0, 10000, 40], -** Processing line: ~ [0, 1670, 3250, 60],~ -- Inside source: true -*** True Line Result - [0, 1670, 3250, 60], -** Processing line: ~ [6691, 1653, 3290, 60],~ -- Inside source: true -*** True Line Result - [6691, 1653, 3290, 60], -** Processing line: ~ [1521, 3792, 7370, 60],~ -- Inside source: true -*** True Line Result - [1521, 3792, 7370, 60], -** Processing line: ~ [0, 5137, 3290, 60]~ -- Inside source: true -*** True Line Result - [0, 5137, 3290, 60] -** Processing line: ~ ]~ -- Inside source: true -*** True Line Result - ] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def attempt_load_world_from_file~ - Inside source: true *** True Line Result @@ -108668,86 +118899,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if $collisions -** Processing line: ~ $collisions.map do |x, y, w, h|~ -- Inside source: true -*** True Line Result - $collisions.map do |x, y, w, h| -** Processing line: ~ state.world << [x, y, w, h]~ -- Inside source: true -*** True Line Result - state.world << [x, y, w, h] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ add_floors~ -- Inside source: true -*** True Line Result - add_floors -** Processing line: ~ # elsif exported_world~ -- Inside source: true -*** True Line Result - # elsif exported_world -** Processing line: ~ # exported_world.each_line.map do |l|~ -- Inside source: true -*** True Line Result - # exported_world.each_line.map do |l| -** Processing line: ~ # tokens = l.strip.split(',')~ -- Inside source: true -*** True Line Result - # tokens = l.strip.split(',') -** Processing line: ~ # x = tokens[0].to_i~ -- Inside source: true -*** True Line Result - # x = tokens[0].to_i -** Processing line: ~ # y = tokens[1].to_i~ -- Inside source: true -*** True Line Result - # y = tokens[1].to_i -** Processing line: ~ # type = tokens[2].to_i~ +** Processing line: ~ state.id_seed ||= 0~ - Inside source: true *** True Line Result - # type = tokens[2].to_i -** Processing line: ~ # if type == 1~ + state.id_seed ||= 0 +** Processing line: ~ $collisions.each do |x, y, w, h|~ - Inside source: true *** True Line Result - # if type == 1 -** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ + $collisions.each do |x, y, w, h| +** Processing line: ~ state.id_seed += 1~ - Inside source: true *** True Line Result - # state.world << [x, y, state.tile_size, state.tile_size] -** Processing line: ~ # elsif type == 2~ + state.id_seed += 1 +** Processing line: ~ state.world << { id: state.id_seed, x: x, y: y, w: w, h: h }~ - Inside source: true *** True Line Result - # elsif type == 2 -** Processing line: ~ # w, h, path = tokens[3..-1]~ -- Inside source: true -*** True Line Result - # w, h, path = tokens[3..-1] -** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ -- Inside source: true -*** True Line Result - # state.objects << [x, y, w.to_i, h.to_i, path] -** Processing line: ~ # end~ -- Inside source: true -*** True Line Result - # end -** Processing line: ~ # end~ -- Inside source: true -*** True Line Result - # end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # add_floors~ + state.world << { id: state.id_seed, x: x, y: y, w: w, h: h } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # add_floors + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -108828,14 +118999,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result state.world_lookup = {} -** Processing line: ~ state.world.each do |x, y, w, h|~ +** Processing line: ~ state.world.each do |rect|~ - Inside source: true *** True Line Result - state.world.each do |x, y, w, h| -** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ + state.world.each do |rect| +** Processing line: ~ state.world_lookup[rect.id] = rect~ - Inside source: true *** True Line Result - state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true + state.world_lookup[rect.id] = rect ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -108860,42 +119031,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result .keys -** Processing line: ~ .map do |x, y, w, h|~ +** Processing line: ~ .map do |key|~ +- Inside source: true +*** True Line Result + .map do |key| +** Processing line: ~ rect = state.world_lookup[key]~ - Inside source: true *** True Line Result - .map do |x, y, w, h| + rect = state.world_lookup[key] ** Processing line: ~ s = state.tile_size~ - Inside source: true *** True Line Result s = state.tile_size -** Processing line: ~ w ||= s~ +** Processing line: ~ rect.w ||= s~ - Inside source: true *** True Line Result - w ||= s -** Processing line: ~ h ||= s~ + rect.w ||= s +** Processing line: ~ rect.h ||= s~ - Inside source: true *** True Line Result - h ||= s + rect.h ||= s ** Processing line: ~ {~ - Inside source: true *** True Line Result { -** Processing line: ~ args: [x, y, w, h],~ +** Processing line: ~ args: rect,~ - Inside source: true *** True Line Result - args: [x, y, w, h], -** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ + args: rect, +** Processing line: ~ left_right: { x: rect.x, y: rect.y + 4, w: rect.w, h: rect.h - 6 },~ - Inside source: true *** True Line Result - left_right: [x, y + 4, w, h - 6], -** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ + left_right: { x: rect.x, y: rect.y + 4, w: rect.w, h: rect.h - 6 }, +** Processing line: ~ top: { x: rect.x + 4, y: rect.y + 6, w: rect.w - 8, h: rect.h - 6 },~ - Inside source: true *** True Line Result - top: [x + 4, y + 6, w - 8, h - 6], -** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ + top: { x: rect.x + 4, y: rect.y + 6, w: rect.w - 8, h: rect.h - 6 }, +** Processing line: ~ bottom: { x: rect.x + 1, y: rect.y - 1, w: rect.w - 2, h: rect.h - 8 },~ - Inside source: true *** True Line Result - bottom: [x + 1, y - 1, w - 2, h - 8], + bottom: { x: rect.x + 1, y: rect.y - 1, w: rect.w - 2, h: rect.h - 8 }, ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -109116,10 +119291,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result p = state.tongue_angle.vector(state.tongue_length) -** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ +** Processing line: ~ { x: start_of_tongue.x + p.x, y: start_of_tongue.y + p.y }~ - Inside source: true *** True Line Result - [start_of_tongue.x + p.x, start_of_tongue.y + p.y] + { x: start_of_tongue.x + p.x, y: start_of_tongue.y + p.y } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -109132,14 +119307,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def calc_shooting +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ calc_shooting_increment~ +- Inside source: true +*** True Line Result + calc_shooting_increment +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_shooting_increment~ +- Inside source: true +*** True Line Result + def calc_shooting_increment ** Processing line: ~ return unless state.action == :shooting~ - Inside source: true *** True Line Result return unless state.action == :shooting -** Processing line: ~ state.tongue_length += 30~ +** Processing line: ~ state.tongue_length += 5~ - Inside source: true *** True Line Result - state.tongue_length += 30 + state.tongue_length += 5 ** Processing line: ~ potential_anchor = end_of_tongue~ - Inside source: true *** True Line Result @@ -109212,18 +119423,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ +** Processing line: ~ anchor_rect = { x: potential_anchor.x - 5, y: potential_anchor.y - 5, w: 10, h: 10 }~ - Inside source: true *** True Line Result - anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] + anchor_rect = { x: potential_anchor.x - 5, y: potential_anchor.y - 5, w: 10, h: 10 } ** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ - Inside source: true *** True Line Result collision = state.world_collision_rects.find_all do |v| -** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ +** Processing line: ~ v[:args].intersect_rect?(anchor_rect)~ - Inside source: true *** True Line Result - [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) + v[:args].intersect_rect?(anchor_rect) ** Processing line: ~ end.first~ - Inside source: true *** True Line Result @@ -109604,10 +119815,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless left_side_collisions -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ +** Processing line: ~ state.x = left_side_collisions[:left_right].right + 1~ - Inside source: true *** True Line Result - state.x = left_side_collisions[:left_right].right + state.x = left_side_collisions[:left_right].right + 1 ** Processing line: ~ state.dx = state.dy.abs * 0.8~ - Inside source: true *** True Line Result @@ -109664,10 +119875,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless right_side_collisions -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size - 1~ - Inside source: true *** True Line Result - state.x = right_side_collisions[:left_right].left - state.tile_size + state.x = right_side_collisions[:left_right].left - state.tile_size - 1 ** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ - Inside source: true *** True Line Result @@ -109728,10 +119939,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result return unless ceil_collisions -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size - 1~ - Inside source: true *** True Line Result - state.y = ceil_collisions[:bottom].y - state.tile_size + state.y = ceil_collisions[:bottom].y - state.tile_size - 1 ** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ - Inside source: true *** True Line Result @@ -109780,34 +119991,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def export_map -** Processing line: ~ export_string = state.world.map do |x, y|~ +** Processing line: ~ export_string = "$collisions = [\n"~ - Inside source: true *** True Line Result - export_string = state.world.map do |x, y| -** Processing line: ~ "#{x},#{y},1"~ + export_string = "$collisions = [\n" +** Processing line: ~ export_string += state.world.map do |rect|~ - Inside source: true *** True Line Result - "#{x},#{y},1" -** Processing line: ~ end~ + export_string += state.world.map do |rect| +** Processing line: ~ "[#{rect.x},#{rect.y},#{rect.w},#{rect.h}],"~ - Inside source: true *** True Line Result - end + "[#{rect.x},#{rect.y},#{rect.w},#{rect.h}]," +** Processing line: ~ end.join "\n"~ +- Inside source: true +*** True Line Result + end.join "\n" +** Processing line: ~ export_string += "\n]\n\n"~ +- Inside source: true +*** True Line Result + export_string += "\n]\n\n" +** Processing line: ~ export_string += "$mugs = [\n"~ +- Inside source: true +*** True Line Result + export_string += "$mugs = [\n" ** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ - Inside source: true *** True Line Result export_string += state.objects.map do |x, y, w, h, path| -** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ +** Processing line: ~ "[#{x},#{y},#{w},#{h},'#{path}'],"~ - Inside source: true *** True Line Result - "#{x},#{y},2,#{w},#{h},#{path}" -** Processing line: ~ end~ + "[#{x},#{y},#{w},#{h},'#{path}']," +** Processing line: ~ end.join "\n"~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ + end.join "\n" +** Processing line: ~ export_string += "\n]\n\n"~ +- Inside source: true +*** True Line Result + export_string += "\n]\n\n" +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string)~ - Inside source: true *** True Line Result - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) + gtk.write_file(MAP_FILE_PATH, export_string) ** Processing line: ~ state.map_saved_at = state.tick_count~ - Inside source: true *** True Line Result @@ -114320,6 +124547,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result [39, 5217, 64, 64], +** Processing line: ~ [0, 0, 10000, 40],~ +- Inside source: true +*** True Line Result + [0, 0, 10000, 40], +** Processing line: ~ [0, 1670, 3250, 60],~ +- Inside source: true +*** True Line Result + [0, 1670, 3250, 60], +** Processing line: ~ [6691, 1653, 3290, 60],~ +- Inside source: true +*** True Line Result + [6691, 1653, 3290, 60], +** Processing line: ~ [1521, 3792, 7370, 60],~ +- Inside source: true +*** True Line Result + [1521, 3792, 7370, 60], +** Processing line: ~ [0, 5137, 3290, 60]~ +- Inside source: true +*** True Line Result + [0, 5137, 3290, 60] ** Processing line: ~ ]~ - Inside source: true *** True Line Result @@ -117760,6 +128007,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def load_lines file +** Processing line: ~ return unless state.snaps~ +- Inside source: true +*** True Line Result + return unless state.snaps ** Processing line: ~ data = gtk.read_file(file) || ""~ - Inside source: true *** True Line Result @@ -117992,10 +128243,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result results[:trajectory] = trajectory(results) -** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ +** Processing line: ~ results[:impacts] = terrain.find_all { |t| t && (line_near_rect? results[:rect], t) }.map do |t|~ - Inside source: true *** True Line Result - results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| + results[:impacts] = terrain.find_all { |t| t && (line_near_rect? results[:rect], t) }.map do |t| ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -118004,10 +128255,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result terrain: t, -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000),~ - Inside source: true *** True Line Result - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), ** Processing line: ~ type: :terrain~ - Inside source: true *** True Line Result @@ -118036,10 +128287,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result terrain: t, -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000),~ - Inside source: true *** True Line Result - point: geometry.line_intersect(results[:trajectory], t), + point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000), ** Processing line: ~ type: :lava~ - Inside source: true *** True Line Result @@ -118048,10 +128299,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result } -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ +** Processing line: ~ end.reject { |t| !t || (!point_within_line? t[:point], t[:terrain]) }~ - Inside source: true *** True Line Result - end.reject { |t| !point_within_line? t[:point], t[:terrain] } + end.reject { |t| !t || (!point_within_line? t[:point], t[:terrain]) } ** Processing line: ~~ - Inside source: true *** True Line Result @@ -118100,6 +128351,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def calc_terrains_to_monitor +** Processing line: ~ return unless circle.impacts~ +- Inside source: true +*** True Line Result + return unless circle.impacts ** Processing line: ~ circle.impact = nil~ - Inside source: true *** True Line Result @@ -140392,6 +150647,590 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Rpg Topdown - Topdown Casino - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Rpg Topdown - Topdown Casino - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_topdown/topdown_casino/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_rpg_topdown/topdown_casino/app/main.rb +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def coinflip~ +- Inside source: true +*** True Line Result + def coinflip +** Processing line: ~ rand < 0.5~ +- Inside source: true +*** True Line Result + rand < 0.5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class Game~ +- Inside source: true +*** True Line Result + class Game +** Processing line: ~ attr_accessor :args~ +- Inside source: true +*** True Line Result + attr_accessor :args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def text_font~ +- Inside source: true +*** True Line Result + def text_font +** Processing line: ~ return nil #"rpg.ttf"~ +- Inside source: true +*** True Line Result + return nil #"rpg.ttf" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def text_color~ +- Inside source: true +*** True Line Result + def text_color +** Processing line: ~ [ 255, 255, 255, 255 ]~ +- Inside source: true +*** True Line Result + [ 255, 255, 255, 255 ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def set_gem_values~ +- Inside source: true +*** True Line Result + def set_gem_values +** Processing line: ~ @args.state.gem0 = ((coinflip) ? 100 : 20)~ +- Inside source: true +*** True Line Result + @args.state.gem0 = ((coinflip) ? 100 : 20) +** Processing line: ~ @args.state.gem1 = ((coinflip) ? -10 : -50)~ +- Inside source: true +*** True Line Result + @args.state.gem1 = ((coinflip) ? -10 : -50) +** Processing line: ~ @args.state.gem2 = ((coinflip) ? -10 : -30)~ +- Inside source: true +*** True Line Result + @args.state.gem2 = ((coinflip) ? -10 : -30) +** Processing line: ~ if coinflip~ +- Inside source: true +*** True Line Result + if coinflip +** Processing line: ~ tmp = @args.state.gem0~ +- Inside source: true +*** True Line Result + tmp = @args.state.gem0 +** Processing line: ~ @args.state.gem0 = @args.state.gem1~ +- Inside source: true +*** True Line Result + @args.state.gem0 = @args.state.gem1 +** Processing line: ~ @args.state.gem1 = tmp~ +- Inside source: true +*** True Line Result + @args.state.gem1 = tmp +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ if coinflip~ +- Inside source: true +*** True Line Result + if coinflip +** Processing line: ~ tmp = @args.state.gem1~ +- Inside source: true +*** True Line Result + tmp = @args.state.gem1 +** Processing line: ~ @args.state.gem1 = @args.state.gem2~ +- Inside source: true +*** True Line Result + @args.state.gem1 = @args.state.gem2 +** Processing line: ~ @args.state.gem2 = tmp~ +- Inside source: true +*** True Line Result + @args.state.gem2 = tmp +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ if coinflip~ +- Inside source: true +*** True Line Result + if coinflip +** Processing line: ~ tmp = @args.state.gem0~ +- Inside source: true +*** True Line Result + tmp = @args.state.gem0 +** Processing line: ~ @args.state.gem0 = @args.state.gem2~ +- Inside source: true +*** True Line Result + @args.state.gem0 = @args.state.gem2 +** Processing line: ~ @args.state.gem2 = tmp~ +- Inside source: true +*** True Line Result + @args.state.gem2 = tmp +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize args~ +- Inside source: true +*** True Line Result + def initialize args +** Processing line: ~ @args = args~ +- Inside source: true +*** True Line Result + @args = args +** Processing line: ~ @args.state.animticks = 0~ +- Inside source: true +*** True Line Result + @args.state.animticks = 0 +** Processing line: ~ @args.state.score = 0~ +- Inside source: true +*** True Line Result + @args.state.score = 0 +** Processing line: ~ @args.state.gem_chosen = false~ +- Inside source: true +*** True Line Result + @args.state.gem_chosen = false +** Processing line: ~ @args.state.round_finished = false~ +- Inside source: true +*** True Line Result + @args.state.round_finished = false +** Processing line: ~ @args.state.gem0_x = 197~ +- Inside source: true +*** True Line Result + @args.state.gem0_x = 197 +** Processing line: ~ @args.state.gem0_y = 720-274~ +- Inside source: true +*** True Line Result + @args.state.gem0_y = 720-274 +** Processing line: ~ @args.state.gem1_x = 623~ +- Inside source: true +*** True Line Result + @args.state.gem1_x = 623 +** Processing line: ~ @args.state.gem1_y = 720-274~ +- Inside source: true +*** True Line Result + @args.state.gem1_y = 720-274 +** Processing line: ~ @args.state.gem2_x = 1049~ +- Inside source: true +*** True Line Result + @args.state.gem2_x = 1049 +** Processing line: ~ @args.state.gem2_y = 720-274~ +- Inside source: true +*** True Line Result + @args.state.gem2_y = 720-274 +** Processing line: ~ @args.state.hero_sprite = "sprites/herodown100.png"~ +- Inside source: true +*** True Line Result + @args.state.hero_sprite = "sprites/herodown100.png" +** Processing line: ~ @args.state.hero_x = 608~ +- Inside source: true +*** True Line Result + @args.state.hero_x = 608 +** Processing line: ~ @args.state.hero_y = 720-656~ +- Inside source: true +*** True Line Result + @args.state.hero_y = 720-656 +** Processing line: ~ set_gem_values~ +- Inside source: true +*** True Line Result + set_gem_values +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_gem_value x, y, gem~ +- Inside source: true +*** True Line Result + def render_gem_value x, y, gem +** Processing line: ~ if @args.state.gem_chosen~ +- Inside source: true +*** True Line Result + if @args.state.gem_chosen +** Processing line: ~ @args.outputs.labels << [ x, y + 96, gem.to_s, 1, 1, *text_color, text_font ]~ +- Inside source: true +*** True Line Result + @args.outputs.labels << [ x, y + 96, gem.to_s, 1, 1, *text_color, text_font ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render~ +- Inside source: true +*** True Line Result + def render +** Processing line: ~ gemsprite = ((@args.state.animticks % 400) < 200) ? 'sprites/gem200.png' : 'sprites/gem400.png'~ +- Inside source: true +*** True Line Result + gemsprite = ((@args.state.animticks % 400) < 200) ? 'sprites/gem200.png' : 'sprites/gem400.png' +** Processing line: ~ @args.outputs.background_color = [ 0, 0, 0, 255 ]~ +- Inside source: true +*** True Line Result + @args.outputs.background_color = [ 0, 0, 0, 255 ] +** Processing line: ~ @args.outputs.sprites << [608, 720-150, 64, 64, 'sprites/oldman.png']~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [608, 720-150, 64, 64, 'sprites/oldman.png'] +** Processing line: ~ @args.outputs.sprites << [300, 720-150, 64, 64, 'sprites/fire.png']~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [300, 720-150, 64, 64, 'sprites/fire.png'] +** Processing line: ~ @args.outputs.sprites << [900, 720-150, 64, 64, 'sprites/fire.png']~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [900, 720-150, 64, 64, 'sprites/fire.png'] +** Processing line: ~ @args.outputs.sprites << [@args.state.gem0_x, @args.state.gem0_y, 32, 64, gemsprite]~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [@args.state.gem0_x, @args.state.gem0_y, 32, 64, gemsprite] +** Processing line: ~ @args.outputs.sprites << [@args.state.gem1_x, @args.state.gem1_y, 32, 64, gemsprite]~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [@args.state.gem1_x, @args.state.gem1_y, 32, 64, gemsprite] +** Processing line: ~ @args.outputs.sprites << [@args.state.gem2_x, @args.state.gem2_y, 32, 64, gemsprite]~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [@args.state.gem2_x, @args.state.gem2_y, 32, 64, gemsprite] +** Processing line: ~ @args.outputs.sprites << [@args.state.hero_x, @args.state.hero_y, 64, 64, @args.state.hero_sprite]~ +- Inside source: true +*** True Line Result + @args.outputs.sprites << [@args.state.hero_x, @args.state.hero_y, 64, 64, @args.state.hero_sprite] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @args.outputs.labels << [ 630, 720-30, "IT'S A SECRET TO EVERYONE.", 1, 1, *text_color, text_font ]~ +- Inside source: true +*** True Line Result + @args.outputs.labels << [ 630, 720-30, "IT'S A SECRET TO EVERYONE.", 1, 1, *text_color, text_font ] +** Processing line: ~ @args.outputs.labels << [ 50, 720-85, @args.state.score.to_s, 1, 1, *text_color, text_font ]~ +- Inside source: true +*** True Line Result + @args.outputs.labels << [ 50, 720-85, @args.state.score.to_s, 1, 1, *text_color, text_font ] +** Processing line: ~ render_gem_value @args.state.gem0_x, @args.state.gem0_y, @args.state.gem0~ +- Inside source: true +*** True Line Result + render_gem_value @args.state.gem0_x, @args.state.gem0_y, @args.state.gem0 +** Processing line: ~ render_gem_value @args.state.gem1_x, @args.state.gem1_y, @args.state.gem1~ +- Inside source: true +*** True Line Result + render_gem_value @args.state.gem1_x, @args.state.gem1_y, @args.state.gem1 +** Processing line: ~ render_gem_value @args.state.gem2_x, @args.state.gem2_y, @args.state.gem2~ +- Inside source: true +*** True Line Result + render_gem_value @args.state.gem2_x, @args.state.gem2_y, @args.state.gem2 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc~ +- Inside source: true +*** True Line Result + def calc +** Processing line: ~ @args.state.animticks += 16~ +- Inside source: true +*** True Line Result + @args.state.animticks += 16 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return unless @args.state.gem_chosen~ +- Inside source: true +*** True Line Result + return unless @args.state.gem_chosen +** Processing line: ~ @args.state.round_finished_debounce ||= 60 * 3~ +- Inside source: true +*** True Line Result + @args.state.round_finished_debounce ||= 60 * 3 +** Processing line: ~ @args.state.round_finished_debounce -= 1~ +- Inside source: true +*** True Line Result + @args.state.round_finished_debounce -= 1 +** Processing line: ~ return if @args.state.round_finished_debounce > 0~ +- Inside source: true +*** True Line Result + return if @args.state.round_finished_debounce > 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @args.state.gem_chosen = false~ +- Inside source: true +*** True Line Result + @args.state.gem_chosen = false +** Processing line: ~ @args.state.hero.sprite[0] = 'sprites/herodown100.png'~ +- Inside source: true +*** True Line Result + @args.state.hero.sprite[0] = 'sprites/herodown100.png' +** Processing line: ~ @args.state.hero.sprite[1] = 608~ +- Inside source: true +*** True Line Result + @args.state.hero.sprite[1] = 608 +** Processing line: ~ @args.state.hero.sprite[2] = 656~ +- Inside source: true +*** True Line Result + @args.state.hero.sprite[2] = 656 +** Processing line: ~ @args.state.round_finished_debounce = nil~ +- Inside source: true +*** True Line Result + @args.state.round_finished_debounce = nil +** Processing line: ~ set_gem_values~ +- Inside source: true +*** True Line Result + set_gem_values +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def walk xdir, ydir, anim~ +- Inside source: true +*** True Line Result + def walk xdir, ydir, anim +** Processing line: ~ @args.state.hero_sprite = "sprites/#{anim}#{(((@args.state.animticks % 200) < 100) ? '100' : '200')}.png"~ +- Inside source: true +*** True Line Result + @args.state.hero_sprite = "sprites/#{anim}#{(((@args.state.animticks % 200) < 100) ? '100' : '200')}.png" +** Processing line: ~ @args.state.hero_x += 5 * xdir~ +- Inside source: true +*** True Line Result + @args.state.hero_x += 5 * xdir +** Processing line: ~ @args.state.hero_y += 5 * ydir~ +- Inside source: true +*** True Line Result + @args.state.hero_y += 5 * ydir +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def check_gem_touching gem_x, gem_y, gem~ +- Inside source: true +*** True Line Result + def check_gem_touching gem_x, gem_y, gem +** Processing line: ~ return if @args.state.gem_chosen~ +- Inside source: true +*** True Line Result + return if @args.state.gem_chosen +** Processing line: ~ herorect = [ @args.state.hero_x, @args.state.hero_y, 64, 64 ]~ +- Inside source: true +*** True Line Result + herorect = [ @args.state.hero_x, @args.state.hero_y, 64, 64 ] +** Processing line: ~ return if !herorect.intersect_rect?([gem_x, gem_y, 32, 64])~ +- Inside source: true +*** True Line Result + return if !herorect.intersect_rect?([gem_x, gem_y, 32, 64]) +** Processing line: ~ @args.state.gem_chosen = true~ +- Inside source: true +*** True Line Result + @args.state.gem_chosen = true +** Processing line: ~ @args.state.score += gem~ +- Inside source: true +*** True Line Result + @args.state.score += gem +** Processing line: ~ @args.outputs.sounds << ((gem < 0) ? 'sounds/lose.wav' : 'sounds/win.wav')~ +- Inside source: true +*** True Line Result + @args.outputs.sounds << ((gem < 0) ? 'sounds/lose.wav' : 'sounds/win.wav') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def input~ +- Inside source: true +*** True Line Result + def input +** Processing line: ~ if @args.inputs.keyboard.key_held.left~ +- Inside source: true +*** True Line Result + if @args.inputs.keyboard.key_held.left +** Processing line: ~ walk(-1.0, 0.0, 'heroleft')~ +- Inside source: true +*** True Line Result + walk(-1.0, 0.0, 'heroleft') +** Processing line: ~ elsif @args.inputs.keyboard.key_held.right~ +- Inside source: true +*** True Line Result + elsif @args.inputs.keyboard.key_held.right +** Processing line: ~ walk(1.0, 0.0, 'heroright')~ +- Inside source: true +*** True Line Result + walk(1.0, 0.0, 'heroright') +** Processing line: ~ elsif @args.inputs.keyboard.key_held.up~ +- Inside source: true +*** True Line Result + elsif @args.inputs.keyboard.key_held.up +** Processing line: ~ walk(0.0, 1.0, 'heroup')~ +- Inside source: true +*** True Line Result + walk(0.0, 1.0, 'heroup') +** Processing line: ~ elsif @args.inputs.keyboard.key_held.down~ +- Inside source: true +*** True Line Result + elsif @args.inputs.keyboard.key_held.down +** Processing line: ~ walk(0.0, -1.0, 'herodown')~ +- Inside source: true +*** True Line Result + walk(0.0, -1.0, 'herodown') +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ check_gem_touching(@args.state.gem0_x, @args.state.gem0_y, @args.state.gem0)~ +- Inside source: true +*** True Line Result + check_gem_touching(@args.state.gem0_x, @args.state.gem0_y, @args.state.gem0) +** Processing line: ~ check_gem_touching(@args.state.gem1_x, @args.state.gem1_y, @args.state.gem1)~ +- Inside source: true +*** True Line Result + check_gem_touching(@args.state.gem1_x, @args.state.gem1_y, @args.state.gem1) +** Processing line: ~ check_gem_touching(@args.state.gem2_x, @args.state.gem2_y, @args.state.gem2)~ +- Inside source: true +*** True Line Result + check_gem_touching(@args.state.gem2_x, @args.state.gem2_y, @args.state.gem2) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick~ +- Inside source: true +*** True Line Result + def tick +** Processing line: ~ input~ +- Inside source: true +*** True Line Result + input +** Processing line: ~ calc~ +- Inside source: true +*** True Line Result + calc +** Processing line: ~ render~ +- Inside source: true +*** True Line Result + render +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.game ||= Game.new args~ +- Inside source: true +*** True Line Result + args.state.game ||= Game.new args +** Processing line: ~ args.state.game.args = args~ +- Inside source: true +*** True Line Result + args.state.game.args = args +** Processing line: ~ args.state.game.tick~ +- Inside source: true +*** True Line Result + args.state.game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** Rpg Topdown - Topdown Starting Point - main.rb~ - Header detected. *** True Line Result @@ -140852,6 +151691,746 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** Teenytiny - Teenytiny Starting Point - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Teenytiny - Teenytiny Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_teenytiny/teenytiny_starting_point/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_teenytiny/teenytiny_starting_point/app/main.rb +** Processing line: ~ # full documenation is at http://docs.dragonruby.org~ +- Inside source: true +*** True Line Result + # full documenation is at http://docs.dragonruby.org +** Processing line: ~ # be sure to come to the discord if you hit any snags: http://discord.dragonruby.org~ +- Inside source: true +*** True Line Result + # be sure to come to the discord if you hit any snags: http://discord.dragonruby.org +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # initialize default variables~ +- Inside source: true +*** True Line Result + # initialize default variables +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ruby has an operator called ||= which means "only initialize this if it's nil"~ +- Inside source: true +*** True Line Result + # ruby has an operator called ||= which means "only initialize this if it's nil" +** Processing line: ~ args.state.count_down ||= 20 * 60 # set the count down to 20 seconds~ +- Inside source: true +*** True Line Result + args.state.count_down ||= 20 * 60 # set the count down to 20 seconds +** Processing line: ~ # set the initial position of the target~ +- Inside source: true +*** True Line Result + # set the initial position of the target +** Processing line: ~ args.state.target ||= { x: args.grid.w.half,~ +- Inside source: true +*** True Line Result + args.state.target ||= { x: args.grid.w.half, +** Processing line: ~ y: args.grid.h.half,~ +- Inside source: true +*** True Line Result + y: args.grid.h.half, +** Processing line: ~ w: 20,~ +- Inside source: true +*** True Line Result + w: 20, +** Processing line: ~ h: 20 }~ +- Inside source: true +*** True Line Result + h: 20 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # set the initial position of the player~ +- Inside source: true +*** True Line Result + # set the initial position of the player +** Processing line: ~ args.state.player ||= { x: 50,~ +- Inside source: true +*** True Line Result + args.state.player ||= { x: 50, +** Processing line: ~ y: 50,~ +- Inside source: true +*** True Line Result + y: 50, +** Processing line: ~ w: 20,~ +- Inside source: true +*** True Line Result + w: 20, +** Processing line: ~ h: 20 }~ +- Inside source: true +*** True Line Result + h: 20 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # set the player movement speed~ +- Inside source: true +*** True Line Result + # set the player movement speed +** Processing line: ~ args.state.player_speed ||= 5~ +- Inside source: true +*** True Line Result + args.state.player_speed ||= 5 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # set the score~ +- Inside source: true +*** True Line Result + # set the score +** Processing line: ~ args.state.score ||= 0~ +- Inside source: true +*** True Line Result + args.state.score ||= 0 +** Processing line: ~ args.state.teleports ||= 3~ +- Inside source: true +*** True Line Result + args.state.teleports ||= 3 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # set the instructions~ +- Inside source: true +*** True Line Result + # set the instructions +** Processing line: ~ args.state.instructions ||= "Get to the red goal! Use arrow keys to move. Spacebar to teleport (use them carefully)!"~ +- Inside source: true +*** True Line Result + args.state.instructions ||= "Get to the red goal! Use arrow keys to move. Spacebar to teleport (use them carefully)!" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # render the game~ +- Inside source: true +*** True Line Result + # render the game +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half, y: args.grid.h - 10,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: args.grid.w.half, y: args.grid.h - 10, +** Processing line: ~ text: args.state.instructions,~ +- Inside source: true +*** True Line Result + text: args.state.instructions, +** Processing line: ~ alignment_enum: 1 }~ +- Inside source: true +*** True Line Result + alignment_enum: 1 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # check if it's game over. if so, then render game over~ +- Inside source: true +*** True Line Result + # check if it's game over. if so, then render game over +** Processing line: ~ # otherwise render the current time left~ +- Inside source: true +*** True Line Result + # otherwise render the current time left +** Processing line: ~ if game_over? args~ +- Inside source: true +*** True Line Result + if game_over? args +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: args.grid.w.half, +** Processing line: ~ y: args.grid.h - 40,~ +- Inside source: true +*** True Line Result + y: args.grid.h - 40, +** Processing line: ~ text: "game over! (press r to start over)",~ +- Inside source: true +*** True Line Result + text: "game over! (press r to start over)", +** Processing line: ~ alignment_enum: 1 }~ +- Inside source: true +*** True Line Result + alignment_enum: 1 } +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: args.grid.w.half, +** Processing line: ~ y: args.grid.h - 40,~ +- Inside source: true +*** True Line Result + y: args.grid.h - 40, +** Processing line: ~ text: "time left: #{(args.state.count_down.idiv 60) + 1}",~ +- Inside source: true +*** True Line Result + text: "time left: #{(args.state.count_down.idiv 60) + 1}", +** Processing line: ~ alignment_enum: 1 }~ +- Inside source: true +*** True Line Result + alignment_enum: 1 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render the score~ +- Inside source: true +*** True Line Result + # render the score +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: args.grid.w.half, +** Processing line: ~ y: args.grid.h - 70,~ +- Inside source: true +*** True Line Result + y: args.grid.h - 70, +** Processing line: ~ text: "score: #{args.state.score}",~ +- Inside source: true +*** True Line Result + text: "score: #{args.state.score}", +** Processing line: ~ alignment_enum: 1 }~ +- Inside source: true +*** True Line Result + alignment_enum: 1 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render the player with teleport count~ +- Inside source: true +*** True Line Result + # render the player with teleport count +** Processing line: ~ args.outputs.sprites << { x: args.state.player.x,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: args.state.player.x, +** Processing line: ~ y: args.state.player.y,~ +- Inside source: true +*** True Line Result + y: args.state.player.y, +** Processing line: ~ w: args.state.player.w,~ +- Inside source: true +*** True Line Result + w: args.state.player.w, +** Processing line: ~ h: args.state.player.h,~ +- Inside source: true +*** True Line Result + h: args.state.player.h, +** Processing line: ~ path: 'sprites/square-green.png' }~ +- Inside source: true +*** True Line Result + path: 'sprites/square-green.png' } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.labels << { x: args.state.player.x + 10,~ +- Inside source: true +*** True Line Result + args.outputs.labels << { x: args.state.player.x + 10, +** Processing line: ~ y: args.state.player.y + 40,~ +- Inside source: true +*** True Line Result + y: args.state.player.y + 40, +** Processing line: ~ text: "teleports: #{args.state.teleports}",~ +- Inside source: true +*** True Line Result + text: "teleports: #{args.state.teleports}", +** Processing line: ~ alignment_enum: 1, size_enum: -2 }~ +- Inside source: true +*** True Line Result + alignment_enum: 1, size_enum: -2 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render the target~ +- Inside source: true +*** True Line Result + # render the target +** Processing line: ~ args.outputs.sprites << { x: args.state.target.x,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: args.state.target.x, +** Processing line: ~ y: args.state.target.y,~ +- Inside source: true +*** True Line Result + y: args.state.target.y, +** Processing line: ~ w: args.state.target.w,~ +- Inside source: true +*** True Line Result + w: args.state.target.w, +** Processing line: ~ h: args.state.target.h,~ +- Inside source: true +*** True Line Result + h: args.state.target.h, +** Processing line: ~ path: 'sprites/square-red.png' }~ +- Inside source: true +*** True Line Result + path: 'sprites/square-red.png' } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # run simulation~ +- Inside source: true +*** True Line Result + # run simulation +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # count down calculation~ +- Inside source: true +*** True Line Result + # count down calculation +** Processing line: ~ args.state.count_down -= 1~ +- Inside source: true +*** True Line Result + args.state.count_down -= 1 +** Processing line: ~ args.state.count_down = -1 if args.state.count_down < -1~ +- Inside source: true +*** True Line Result + args.state.count_down = -1 if args.state.count_down < -1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # process player input~ +- Inside source: true +*** True Line Result + # process player input +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # if it isn't game over let them move~ +- Inside source: true +*** True Line Result + # if it isn't game over let them move +** Processing line: ~ if !game_over? args~ +- Inside source: true +*** True Line Result + if !game_over? args +** Processing line: ~ dir_y = 0~ +- Inside source: true +*** True Line Result + dir_y = 0 +** Processing line: ~ dir_x = 0~ +- Inside source: true +*** True Line Result + dir_x = 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # determine the change horizontally~ +- Inside source: true +*** True Line Result + # determine the change horizontally +** Processing line: ~ if args.inputs.keyboard.up~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.up +** Processing line: ~ dir_y += args.state.player_speed~ +- Inside source: true +*** True Line Result + dir_y += args.state.player_speed +** Processing line: ~ elsif args.inputs.keyboard.down~ +- Inside source: true +*** True Line Result + elsif args.inputs.keyboard.down +** Processing line: ~ dir_y -= args.state.player_speed~ +- Inside source: true +*** True Line Result + dir_y -= args.state.player_speed +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # determine the change vertically~ +- Inside source: true +*** True Line Result + # determine the change vertically +** Processing line: ~ if args.inputs.keyboard.left~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.left +** Processing line: ~ dir_x -= args.state.player_speed~ +- Inside source: true +*** True Line Result + dir_x -= args.state.player_speed +** Processing line: ~ elsif args.inputs.keyboard.right~ +- Inside source: true +*** True Line Result + elsif args.inputs.keyboard.right +** Processing line: ~ dir_x += args.state.player_speed~ +- Inside source: true +*** True Line Result + dir_x += args.state.player_speed +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # determine if teleport can be used~ +- Inside source: true +*** True Line Result + # determine if teleport can be used +** Processing line: ~ if args.inputs.keyboard.key_down.space && args.state.teleports > 0~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.space && args.state.teleports > 0 +** Processing line: ~ args.state.teleports -= 1~ +- Inside source: true +*** True Line Result + args.state.teleports -= 1 +** Processing line: ~ dir_x *= 20~ +- Inside source: true +*** True Line Result + dir_x *= 20 +** Processing line: ~ dir_y *= 20~ +- Inside source: true +*** True Line Result + dir_y *= 20 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # apply change to player~ +- Inside source: true +*** True Line Result + # apply change to player +** Processing line: ~ args.state.player.x += dir_x~ +- Inside source: true +*** True Line Result + args.state.player.x += dir_x +** Processing line: ~ args.state.player.y += dir_y~ +- Inside source: true +*** True Line Result + args.state.player.y += dir_y +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ # if r is pressed, reset the game~ +- Inside source: true +*** True Line Result + # if r is pressed, reset the game +** Processing line: ~ if args.inputs.keyboard.key_down.r~ +- Inside source: true +*** True Line Result + if args.inputs.keyboard.key_down.r +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~ # determine score~ +- Inside source: true +*** True Line Result + # determine score +** Processing line: ~ # ====================================================~ +- Inside source: true +*** True Line Result + # ==================================================== +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # calculate new score if the player is at goal~ +- Inside source: true +*** True Line Result + # calculate new score if the player is at goal +** Processing line: ~ if !game_over? args~ +- Inside source: true +*** True Line Result + if !game_over? args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # if the player is at the goal, then move the goal~ +- Inside source: true +*** True Line Result + # if the player is at the goal, then move the goal +** Processing line: ~ if args.state.player.intersect_rect? args.state.target~ +- Inside source: true +*** True Line Result + if args.state.player.intersect_rect? args.state.target +** Processing line: ~ # increment the goal~ +- Inside source: true +*** True Line Result + # increment the goal +** Processing line: ~ args.state.score += 1~ +- Inside source: true +*** True Line Result + args.state.score += 1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # move the goal to a random location~ +- Inside source: true +*** True Line Result + # move the goal to a random location +** Processing line: ~ args.state.target = { x: (rand args.grid.w), y: (rand args.grid.h), w: 20, h: 20 }~ +- Inside source: true +*** True Line Result + args.state.target = { x: (rand args.grid.w), y: (rand args.grid.h), w: 20, h: 20 } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # make sure the goal is inside the view area~ +- Inside source: true +*** True Line Result + # make sure the goal is inside the view area +** Processing line: ~ if args.state.target.x < 0~ +- Inside source: true +*** True Line Result + if args.state.target.x < 0 +** Processing line: ~ args.state.target.x += 20~ +- Inside source: true +*** True Line Result + args.state.target.x += 20 +** Processing line: ~ elsif args.state.target.x > 1280~ +- Inside source: true +*** True Line Result + elsif args.state.target.x > 1280 +** Processing line: ~ args.state.target.x -= 20~ +- Inside source: true +*** True Line Result + args.state.target.x -= 20 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # make sure the goal is inside the view area~ +- Inside source: true +*** True Line Result + # make sure the goal is inside the view area +** Processing line: ~ if args.state.target.y < 0~ +- Inside source: true +*** True Line Result + if args.state.target.y < 0 +** Processing line: ~ args.state.target.y += 20~ +- Inside source: true +*** True Line Result + args.state.target.y += 20 +** Processing line: ~ elsif args.state.target.y > 720~ +- Inside source: true +*** True Line Result + elsif args.state.target.y > 720 +** Processing line: ~ args.state.target.y -= 20~ +- Inside source: true +*** True Line Result + args.state.target.y -= 20 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def game_over? args~ +- Inside source: true +*** True Line Result + def game_over? args +** Processing line: ~ args.state.count_down < 0~ +- Inside source: true +*** True Line Result + args.state.count_down < 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Teenytiny - Teenytiny Starting Point - license.txt~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Teenytiny - Teenytiny Starting Point - license.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_teenytiny/teenytiny_starting_point/license.txt~ +- Inside source: true +*** True Line Result + # ./samples/99_genre_teenytiny/teenytiny_starting_point/license.txt +** Processing line: ~ Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + Copyright 2019 DragonRuby LLC +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ MIT License~ +- Inside source: true +*** True Line Result + MIT License +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:~ +- Inside source: true +*** True Line Result + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.~ +- Inside source: true +*** True Line Result + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.~ +- Inside source: true +*** True Line Result + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~** OSS~ - Header detected. *** True Line Result @@ -140859,22 +152438,22 @@ Follows is a source code listing for all files that have been open sourced. This *** True Line Result ** OSS ** Processing line: ~Follows is a source code listing for all files that have been open sourced. This code can be found online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ -** Processing line: ~*** args.rb~ +** Processing line: ~*** api.rb~ - Header detected. *** True Line Result Follows is a source code listing for all files that have been open sourced. This code can be found online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]]. *** True Line Result -*** args.rb +*** api.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # ./dragon/args.rb~ +** Processing line: ~ # ./dragon/api.rb~ - Inside source: true *** True Line Result - # ./dragon/args.rb + # ./dragon/api.rb ** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result @@ -140887,10 +152466,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # args.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # api.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # args.rb has been released under MIT (*only this file*). + # api.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -140899,238 +152478,2658 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result module GTK -** Processing line: ~ # This class is the one you'll interact with the most. It's~ +** Processing line: ~ class Api~ - Inside source: true *** True Line Result - # This class is the one you'll interact with the most. It's -** Processing line: ~ # constructed by the DragonRuby Runtime and is provided to you on~ + class Api +** Processing line: ~ def initialize~ - Inside source: true *** True Line Result - # constructed by the DragonRuby Runtime and is provided to you on -** Processing line: ~ # each tick.~ + def initialize +** Processing line: ~ end~ - Inside source: true *** True Line Result - # each tick. -** Processing line: ~ class Args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - class Args -** Processing line: ~ include ArgsDeprecated~ + +** Processing line: ~ def get_api_autocomplete args, req~ - Inside source: true *** True Line Result - include ArgsDeprecated -** Processing line: ~ include Serialize~ + def get_api_autocomplete args, req +** Processing line: ~ html = <<-S~ - Inside source: true *** True Line Result - include Serialize + html = <<-S +** Processing line: ~ <html>~ +- Inside source: true +*** True Line Result + <html> +** Processing line: ~ <head>~ +- Inside source: true +*** True Line Result + <head> +** Processing line: ~ <meta charset="UTF-8"/>~ +- Inside source: true +*** True Line Result + <meta charset="UTF-8"/> +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +- Inside source: true +*** True Line Result + <title>DragonRuby Game Toolkit Documentation</title> +** Processing line: ~ <style>~ +- Inside source: true +*** True Line Result + <style> +** Processing line: ~ pre {~ +- Inside source: true +*** True Line Result + pre { +** Processing line: ~ border: solid 1px silver;~ +- Inside source: true +*** True Line Result + border: solid 1px silver; +** Processing line: ~ padding: 10px;~ +- Inside source: true +*** True Line Result + padding: 10px; +** Processing line: ~ font-size: 14px;~ +- Inside source: true +*** True Line Result + font-size: 14px; +** Processing line: ~ white-space: pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: pre-wrap; +** Processing line: ~ white-space: -moz-pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -moz-pre-wrap; +** Processing line: ~ white-space: -pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -pre-wrap; +** Processing line: ~ white-space: -o-pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -o-pre-wrap; +** Processing line: ~ word-wrap: break-word;~ +- Inside source: true +*** True Line Result + word-wrap: break-word; +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </style>~ +- Inside source: true +*** True Line Result + </style> +** Processing line: ~ </head>~ +- Inside source: true +*** True Line Result + </head> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ <script>~ +- Inside source: true +*** True Line Result + <script> +** Processing line: ~ async function submitForm() {~ +- Inside source: true +*** True Line Result + async function submitForm() { +** Processing line: ~ const result = await fetch("/dragon/autocomplete/", {~ +- Inside source: true +*** True Line Result + const result = await fetch("/dragon/autocomplete/", { +** Processing line: ~ method: 'POST',~ +- Inside source: true +*** True Line Result + method: 'POST', +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +- Inside source: true +*** True Line Result + headers: { 'Content-Type': 'application/json' }, +** Processing line: ~ body: JSON.stringify({ index: document.getElementById("index").value,~ +- Inside source: true +*** True Line Result + body: JSON.stringify({ index: document.getElementById("index").value, +** Processing line: ~ text: document.getElementById("text").value }),~ +- Inside source: true +*** True Line Result + text: document.getElementById("text").value }), +** Processing line: ~ });~ +- Inside source: true +*** True Line Result + }); +** Processing line: ~ document.getElementById("autocomplete-results").innerHTML = await result.text();~ +- Inside source: true +*** True Line Result + document.getElementById("autocomplete-results").innerHTML = await result.text(); +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </script>~ +- Inside source: true +*** True Line Result + </script> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <div>index</div>~ +- Inside source: true +*** True Line Result + <div>index</div> +** Processing line: ~ <input name="index" id="index" type="text" value="27" />~ +- Inside source: true +*** True Line Result + <input name="index" id="index" type="text" value="27" /> +** Processing line: ~ <div>code</div>~ +- Inside source: true +*** True Line Result + <div>code</div> +** Processing line: ~ <textarea name="text" id="text" rows="30" cols="80">def tick args~ +- Inside source: true +*** True Line Result + <textarea name="text" id="text" rows="30" cols="80">def tick args +** Processing line: ~ args.state.~ +- Inside source: true +*** True Line Result + args.state. +** Processing line: ~ end</textarea>~ +- Inside source: true +*** True Line Result + end</textarea> +** Processing line: ~ <br/>~ +- Inside source: true +*** True Line Result + <br/> +** Processing line: ~ <input type="button" value="Get Suggestions" onclick="submitForm();" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Get Suggestions" onclick="submitForm();" /> +** Processing line: ~ <span id="success-notification"></span>~ +- Inside source: true +*** True Line Result + <span id="success-notification"></span> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <pre id="autocomplete-results">~ +- Inside source: true +*** True Line Result + <pre id="autocomplete-results"> +** Processing line: ~ </pre>~ +- Inside source: true +*** True Line Result + </pre> ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains information related to input devices and input events.~ +** Processing line: ~ #{links}~ - Inside source: true *** True Line Result - # Contains information related to input devices and input events. -** Processing line: ~ #~ + #{links} +** Processing line: ~ </body>~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Inputs]~ + </body> +** Processing line: ~ </html>~ - Inside source: true *** True Line Result - # @return [Inputs] -** Processing line: ~ attr_accessor :inputs~ + </html> +** Processing line: ~ S~ - Inside source: true *** True Line Result - attr_accessor :inputs + S ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains the means to interact with output devices such as the screen.~ +** Processing line: ~ req.respond 200,~ - Inside source: true *** True Line Result - # Contains the means to interact with output devices such as the screen. -** Processing line: ~ #~ + req.respond 200, +** Processing line: ~ html,~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Outputs]~ + html, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ - Inside source: true *** True Line Result - # @return [Outputs] -** Processing line: ~ attr_accessor :outputs~ + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :outputs + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains the means to interact with the audio mixer.~ +** Processing line: ~ def post_api_autocomplete args, req~ - Inside source: true *** True Line Result - # Contains the means to interact with the audio mixer. -** Processing line: ~ #~ + def post_api_autocomplete args, req +** Processing line: ~ json = ($gtk.parse_json req.body)~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Hash]~ + json = ($gtk.parse_json req.body) +** Processing line: ~ index = json["index"].to_i~ - Inside source: true *** True Line Result - # @return [Hash] -** Processing line: ~ attr_accessor :audio~ + index = json["index"].to_i +** Processing line: ~ text = json["text"]~ - Inside source: true *** True Line Result - attr_accessor :audio + text = json["text"] +** Processing line: ~ suggestions = args.gtk.suggest_autocompletion index: index, text: text~ +- Inside source: true +*** True Line Result + suggestions = args.gtk.suggest_autocompletion index: index, text: text +** Processing line: ~ list_as_string = suggestions.join("\n")~ +- Inside source: true +*** True Line Result + list_as_string = suggestions.join("\n") +** Processing line: ~ req.respond 200, list_as_string, { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + req.respond 200, list_as_string, { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains display size information to assist in positioning things on the screen.~ +** Processing line: ~ define_method :links do~ - Inside source: true *** True Line Result - # Contains display size information to assist in positioning things on the screen. -** Processing line: ~ #~ + define_method :links do +** Processing line: ~ <<-S~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Grid]~ + <<-S +** Processing line: ~ <ul>~ - Inside source: true *** True Line Result - # @return [Grid] -** Processing line: ~ attr_accessor :grid~ + <ul> +** Processing line: ~ <li><a href="/">Home</a></li>~ - Inside source: true *** True Line Result - attr_accessor :grid + <li><a href="/">Home</a></li> +** Processing line: ~ <li><a href="/docs.html">Docs</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/docs.html">Docs</a></li> +** Processing line: ~ <li><a href="/dragon/control_panel/">Control Panel</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/dragon/control_panel/">Control Panel</a></li> +** Processing line: ~ <li><a href="/dragon/eval/">Console</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/dragon/eval/">Console</a></li> +** Processing line: ~ <li><a href="/dragon/log/">Logs</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/dragon/log/">Logs</a></li> +** Processing line: ~ <li><a href="/dragon/puts/">Puts</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/dragon/puts/">Puts</a></li> +** Processing line: ~ <li><a href="/dragon/code/">Code</a></li>~ +- Inside source: true +*** True Line Result + <li><a href="/dragon/code/">Code</a></li> +** Processing line: ~ </ul>~ +- Inside source: true +*** True Line Result + </ul> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Provides access to game play recording facilities within Game Toolkit.~ +** Processing line: ~ def get_index args, req~ - Inside source: true *** True Line Result - # Provides access to game play recording facilities within Game Toolkit. -** Processing line: ~ #~ + def get_index args, req +** Processing line: ~ req.respond 200, <<-S, { 'Content-Type' => 'text/html' }~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Recording]~ + req.respond 200, <<-S, { 'Content-Type' => 'text/html' } +** Processing line: ~ <html>~ - Inside source: true *** True Line Result - # @return [Recording] -** Processing line: ~ attr_accessor :recording~ + <html> +** Processing line: ~ <head>~ - Inside source: true *** True Line Result - attr_accessor :recording + <head> +** Processing line: ~ <meta charset="UTF-8"/>~ +- Inside source: true +*** True Line Result + <meta charset="UTF-8"/> +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +- Inside source: true +*** True Line Result + <title>DragonRuby Game Toolkit Documentation</title> +** Processing line: ~ </head>~ +- Inside source: true +*** True Line Result + </head> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ #{links}~ +- Inside source: true +*** True Line Result + #{links} +** Processing line: ~ </body>~ +- Inside source: true +*** True Line Result + </body> +** Processing line: ~ </html>~ +- Inside source: true +*** True Line Result + </html> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Gives you access to geometry related functions.~ +** Processing line: ~ def source_code_links args~ - Inside source: true *** True Line Result - # Gives you access to geometry related functions. -** Processing line: ~ #~ + def source_code_links args +** Processing line: ~ links = args.gtk.reload_list_history.keys.map do |f|~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Geometry]~ + links = args.gtk.reload_list_history.keys.map do |f| +** Processing line: ~ "<li><a href=\"/dragon/code/edit/?file=#{f}\">#{f}</a></li>"~ - Inside source: true *** True Line Result - # @return [Geometry] -** Processing line: ~ attr_accessor :geometry~ + "<li><a href=\"/dragon/code/edit/?file=#{f}\">#{f}</a></li>" +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :geometry + end +** Processing line: ~ <<-S~ +- Inside source: true +*** True Line Result + <<-S +** Processing line: ~ <ul>~ +- Inside source: true +*** True Line Result + <ul> +** Processing line: ~ #{links.join("\n")}~ +- Inside source: true +*** True Line Result + #{links.join("\n")} +** Processing line: ~ </ul>~ +- Inside source: true +*** True Line Result + </ul> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :fn~ +** Processing line: ~ def get_api_code args, req~ - Inside source: true *** True Line Result - attr_accessor :fn + def get_api_code args, req +** Processing line: ~ view = <<-S~ +- Inside source: true +*** True Line Result + view = <<-S +** Processing line: ~ <html>~ +- Inside source: true +*** True Line Result + <html> +** Processing line: ~ <head>~ +- Inside source: true +*** True Line Result + <head> +** Processing line: ~ <meta charset="UTF-8"/>~ +- Inside source: true +*** True Line Result + <meta charset="UTF-8"/> +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +- Inside source: true +*** True Line Result + <title>DragonRuby Game Toolkit Documentation</title> +** Processing line: ~ </head>~ +- Inside source: true +*** True Line Result + </head> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ #{source_code_links args}~ +- Inside source: true +*** True Line Result + #{source_code_links args} ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This is where you'll put state associated with your video game.~ +** Processing line: ~ #{links}~ - Inside source: true *** True Line Result - # This is where you'll put state associated with your video game. -** Processing line: ~ #~ + #{links} +** Processing line: ~ </body>~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [OpenEntity]~ + </body> +** Processing line: ~ </html>~ - Inside source: true *** True Line Result - # @return [OpenEntity] -** Processing line: ~ attr_accessor :state~ + </html> +** Processing line: ~ S~ - Inside source: true *** True Line Result - attr_accessor :state + S +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ view,~ +- Inside source: true +*** True Line Result + view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Gives you access to the top level DragonRuby runtime.~ +** Processing line: ~ def code_edit_view args, file~ - Inside source: true *** True Line Result - # Gives you access to the top level DragonRuby runtime. -** Processing line: ~ #~ + def code_edit_view args, file +** Processing line: ~ view = <<-S~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Runtime]~ + view = <<-S +** Processing line: ~ <html>~ - Inside source: true *** True Line Result - # @return [Runtime] -** Processing line: ~ attr_accessor :runtime~ + <html> +** Processing line: ~ <head>~ - Inside source: true *** True Line Result - attr_accessor :runtime -** Processing line: ~ alias_method :gtk, :runtime~ + <head> +** Processing line: ~ <meta charset="UTF-8"/>~ - Inside source: true *** True Line Result - alias_method :gtk, :runtime + <meta charset="UTF-8"/> +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +- Inside source: true +*** True Line Result + <title>DragonRuby Game Toolkit Documentation</title> +** Processing line: ~ </head>~ +- Inside source: true +*** True Line Result + </head> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ <script>~ +- Inside source: true +*** True Line Result + <script> +** Processing line: ~ async function submitForm() {~ +- Inside source: true +*** True Line Result + async function submitForm() { +** Processing line: ~ const result = await fetch("/dragon/code/update/?file=#{file}", {~ +- Inside source: true +*** True Line Result + const result = await fetch("/dragon/code/update/?file=#{file}", { +** Processing line: ~ method: 'POST',~ +- Inside source: true +*** True Line Result + method: 'POST', +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +- Inside source: true +*** True Line Result + headers: { 'Content-Type': 'application/json' }, +** Processing line: ~ body: JSON.stringify({ code: document.getElementById("code").value }),~ +- Inside source: true +*** True Line Result + body: JSON.stringify({ code: document.getElementById("code").value }), +** Processing line: ~ });~ +- Inside source: true +*** True Line Result + }); +** Processing line: ~ document.getElementById("success-notification").innerHTML = "update successful";~ +- Inside source: true +*** True Line Result + document.getElementById("success-notification").innerHTML = "update successful"; +** Processing line: ~ setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000);~ +- Inside source: true +*** True Line Result + setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000); +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </script>~ +- Inside source: true +*** True Line Result + </script> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <div><code>#{file}:</code></div>~ +- Inside source: true +*** True Line Result + <div><code>#{file}:</code></div> +** Processing line: ~ <textarea name="code" id="code" rows="30" cols="80">#{args.gtk.read_file file}</textarea>~ +- Inside source: true +*** True Line Result + <textarea name="code" id="code" rows="30" cols="80">#{args.gtk.read_file file}</textarea> +** Processing line: ~ <br/>~ +- Inside source: true +*** True Line Result + <br/> +** Processing line: ~ <input type="button" value="Update" onclick="submitForm();" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Update" onclick="submitForm();" /> +** Processing line: ~ <span id="success-notification"></span>~ +- Inside source: true +*** True Line Result + <span id="success-notification"></span> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ #{source_code_links args}~ +- Inside source: true +*** True Line Result + #{source_code_links args} ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :passes~ +** Processing line: ~ #{links}~ - Inside source: true *** True Line Result - attr_accessor :passes + #{links} +** Processing line: ~ </body>~ +- Inside source: true +*** True Line Result + </body> +** Processing line: ~ </html>~ +- Inside source: true +*** True Line Result + </html> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :wizards~ +** Processing line: ~ def get_api_code_edit args, req~ - Inside source: true *** True Line Result - attr_accessor :wizards + def get_api_code_edit args, req +** Processing line: ~ file = req.uri.split('?').last.gsub("file=", "")~ +- Inside source: true +*** True Line Result + file = req.uri.split('?').last.gsub("file=", "") +** Processing line: ~ view = code_edit_view args, file~ +- Inside source: true +*** True Line Result + view = code_edit_view args, file +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ view,~ +- Inside source: true +*** True Line Result + view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :layout~ +** Processing line: ~ def post_api_code_update args, req~ - Inside source: true *** True Line Result - attr_accessor :layout + def post_api_code_update args, req +** Processing line: ~ file = req.uri.split('?').last.gsub("file=", "")~ +- Inside source: true +*** True Line Result + file = req.uri.split('?').last.gsub("file=", "") +** Processing line: ~ code = ($gtk.parse_json req.body)["code"]~ +- Inside source: true +*** True Line Result + code = ($gtk.parse_json req.body)["code"] +** Processing line: ~ args.gtk.write_file file, code~ +- Inside source: true +*** True Line Result + args.gtk.write_file file, code +** Processing line: ~ view = code_edit_view args, file~ +- Inside source: true +*** True Line Result + view = code_edit_view args, file +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ view,~ +- Inside source: true +*** True Line Result + view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :easing~ +** Processing line: ~ def get_api_boot args, req~ - Inside source: true *** True Line Result - attr_accessor :easing + def get_api_boot args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("tmp/src_backup/boot.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("tmp/src_backup/boot.txt"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_trace args, req~ +- Inside source: true +*** True Line Result + def get_api_trace args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("logs/trace.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("logs/trace.txt"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_log args, req~ +- Inside source: true +*** True Line Result + def get_api_log args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("logs/log.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("logs/log.txt"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_log args, req~ +- Inside source: true +*** True Line Result + def post_api_log args, req +** Processing line: ~ Log.log req.body~ +- Inside source: true +*** True Line Result + Log.log req.body +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ "ok",~ +- Inside source: true +*** True Line Result + "ok", +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_puts args, req~ +- Inside source: true +*** True Line Result + def get_api_puts args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("logs/puts.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("logs/puts.txt"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_changes args, req~ +- Inside source: true +*** True Line Result + def get_api_changes args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("tmp/src_backup/src_backup_changes.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("tmp/src_backup/src_backup_changes.txt"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_favicon_ico args, req~ +- Inside source: true +*** True Line Result + def get_favicon_ico args, req +** Processing line: ~ @favicon ||= args.gtk.read_file('docs/favicon.ico')~ +- Inside source: true +*** True Line Result + @favicon ||= args.gtk.read_file('docs/favicon.ico') +** Processing line: ~ req.respond 200, @favicon, { "Content-Type" => 'image/x-icon' }~ +- Inside source: true +*** True Line Result + req.respond 200, @favicon, { "Content-Type" => 'image/x-icon' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup args, req~ +- Inside source: true +*** True Line Result + def get_src_backup args, req +** Processing line: ~ file_name = req.uri.gsub("/dragon/", "")~ +- Inside source: true +*** True Line Result + file_name = req.uri.gsub("/dragon/", "") +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("tmp/src_backup/#{file_name}"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("tmp/src_backup/#{file_name}"), +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_not_found args, req~ +- Inside source: true +*** True Line Result + def get_not_found args, req +** Processing line: ~ puts("METHOD: #{req.method}");~ +- Inside source: true +*** True Line Result + puts("METHOD: #{req.method}"); +** Processing line: ~ puts("URI: #{req.uri}");~ +- Inside source: true +*** True Line Result + puts("URI: #{req.uri}"); +** Processing line: ~ puts("HEADERS:");~ +- Inside source: true +*** True Line Result + puts("HEADERS:"); +** Processing line: ~ req.headers.each { |k,v| puts(" #{k}: #{v}") }~ +- Inside source: true +*** True Line Result + req.headers.each { |k,v| puts(" #{k}: #{v}") } +** Processing line: ~ req.respond 404, "not found: #{req.uri}", { }~ +- Inside source: true +*** True Line Result + req.respond 404, "not found: #{req.uri}", { } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_docs_html args, req~ +- Inside source: true +*** True Line Result + def get_docs_html args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("docs/docs.html"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("docs/docs.html"), +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_docs_css args, req~ +- Inside source: true +*** True Line Result + def get_docs_css args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("docs/docs.css"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("docs/docs.css"), +** Processing line: ~ { 'Content-Type' => 'text/css' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/css' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_docs_search_gif args, req~ +- Inside source: true +*** True Line Result + def get_docs_search_gif args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("docs/docs_search.gif"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("docs/docs_search.gif"), +** Processing line: ~ { 'Content-Type' => 'image/gif' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'image/gif' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup_index_html args, req~ +- Inside source: true +*** True Line Result + def get_src_backup_index_html args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_index.html"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("/tmp/src_backup/src_backup_index.html"), +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup_index_txt args, req~ +- Inside source: true +*** True Line Result + def get_src_backup_index_txt args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_index.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("/tmp/src_backup/src_backup_index.txt"), +** Processing line: ~ { 'Content-Type' => 'text/txt' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/txt' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup_css args, req~ +- Inside source: true +*** True Line Result + def get_src_backup_css args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup.css"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("/tmp/src_backup/src_backup.css"), +** Processing line: ~ { 'Content-Type' => 'text/css' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/css' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup_changes_html args, req~ +- Inside source: true +*** True Line Result + def get_src_backup_changes_html args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_changes.html"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("/tmp/src_backup/src_backup_changes.html"), +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_src_backup_changes_txt args, req~ +- Inside source: true +*** True Line Result + def get_src_backup_changes_txt args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_changes.txt"),~ +- Inside source: true +*** True Line Result + args.gtk.read_file("/tmp/src_backup/src_backup_changes.txt"), +** Processing line: ~ { 'Content-Type' => 'text/txt' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/txt' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_eval args, req~ +- Inside source: true +*** True Line Result + def get_api_eval args, req +** Processing line: ~ eval_view = <<-S~ +- Inside source: true +*** True Line Result + eval_view = <<-S +** Processing line: ~ <html lang="en">~ +- Inside source: true +*** True Line Result + <html lang="en"> +** Processing line: ~ <head><title>Eval</title></head>~ +- Inside source: true +*** True Line Result + <head><title>Eval</title></head> +** Processing line: ~ <style>~ +- Inside source: true +*** True Line Result + <style> +** Processing line: ~ pre {~ +- Inside source: true +*** True Line Result + pre { +** Processing line: ~ border: solid 1px silver;~ +- Inside source: true +*** True Line Result + border: solid 1px silver; +** Processing line: ~ padding: 10px;~ +- Inside source: true +*** True Line Result + padding: 10px; +** Processing line: ~ font-size: 14px;~ +- Inside source: true +*** True Line Result + font-size: 14px; +** Processing line: ~ white-space: pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: pre-wrap; +** Processing line: ~ white-space: -moz-pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -moz-pre-wrap; +** Processing line: ~ white-space: -pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -pre-wrap; +** Processing line: ~ white-space: -o-pre-wrap;~ +- Inside source: true +*** True Line Result + white-space: -o-pre-wrap; +** Processing line: ~ word-wrap: break-word;~ +- Inside source: true +*** True Line Result + word-wrap: break-word; +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </style>~ +- Inside source: true +*** True Line Result + </style> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ <script>~ +- Inside source: true +*** True Line Result + <script> +** Processing line: ~ async function submitForm() {~ +- Inside source: true +*** True Line Result + async function submitForm() { +** Processing line: ~ const result = await fetch("/dragon/eval/", {~ +- Inside source: true +*** True Line Result + const result = await fetch("/dragon/eval/", { +** Processing line: ~ method: 'POST',~ +- Inside source: true +*** True Line Result + method: 'POST', +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +- Inside source: true +*** True Line Result + headers: { 'Content-Type': 'application/json' }, +** Processing line: ~ body: JSON.stringify({ code: document.getElementById("code").value }),~ +- Inside source: true +*** True Line Result + body: JSON.stringify({ code: document.getElementById("code").value }), +** Processing line: ~ });~ +- Inside source: true +*** True Line Result + }); +** Processing line: ~ document.getElementById("eval-result").innerHTML = await result.text();~ +- Inside source: true +*** True Line Result + document.getElementById("eval-result").innerHTML = await result.text(); +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </script>~ +- Inside source: true +*** True Line Result + </script> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <textarea name="code" id="code" rows="10" cols="80"># write your code here and set $result.\n$result = $gtk.args.state</textarea>~ +- Inside source: true +*** True Line Result + <textarea name="code" id="code" rows="10" cols="80"># write your code here and set $result.\n$result = $gtk.args.state</textarea> +** Processing line: ~ <br/>~ +- Inside source: true +*** True Line Result + <br/> +** Processing line: ~ <input type="button" onclick="submitForm();" value="submit" />~ +- Inside source: true +*** True Line Result + <input type="button" onclick="submitForm();" value="submit" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <pre>curl -H "Content-Type: application/json" --data '{ "code": "$result = $args.state" }' -X POST http://localhost:9001/dragon/eval/</pre>~ +- Inside source: true +*** True Line Result + <pre>curl -H "Content-Type: application/json" --data '{ "code": "$result = $args.state" }' -X POST http://localhost:9001/dragon/eval/</pre> +** Processing line: ~ <div>Eval Result:</div>~ +- Inside source: true +*** True Line Result + <div>Eval Result:</div> +** Processing line: ~ <pre id="eval-result"></pre>~ +- Inside source: true +*** True Line Result + <pre id="eval-result"></pre> +** Processing line: ~ #{links}~ +- Inside source: true +*** True Line Result + #{links} +** Processing line: ~ </body>~ +- Inside source: true +*** True Line Result + </body> +** Processing line: ~ </html>~ +- Inside source: true +*** True Line Result + </html> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ eval_view,~ +- Inside source: true +*** True Line Result + eval_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_eval args, req~ +- Inside source: true +*** True Line Result + def post_api_eval args, req +** Processing line: ~ if json? req~ +- Inside source: true +*** True Line Result + if json? req +** Processing line: ~ code = ($gtk.parse_json req.body)["code"]~ +- Inside source: true +*** True Line Result + code = ($gtk.parse_json req.body)["code"] +** Processing line: ~ code = code.gsub("$result", "$eval_result")~ +- Inside source: true +*** True Line Result + code = code.gsub("$result", "$eval_result") +** Processing line: ~ Object.new.instance_eval do~ +- Inside source: true +*** True Line Result + Object.new.instance_eval do +** Processing line: ~ begin~ +- Inside source: true +*** True Line Result + begin +** Processing line: ~ Kernel.eval code~ +- Inside source: true +*** True Line Result + Kernel.eval code +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ $eval_result = e~ +- Inside source: true +*** True Line Result + $eval_result = e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ "#{$eval_result || $eval_results || "nil"}",~ +- Inside source: true +*** True Line Result + "#{$eval_result || $eval_results || "nil"}", +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $eval_result = nil~ +- Inside source: true +*** True Line Result + $eval_result = nil +** Processing line: ~ $eval_results = nil~ +- Inside source: true +*** True Line Result + $eval_results = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def api_css_string~ +- Inside source: true +*** True Line Result + def api_css_string ** Processing line: ~~ - Inside source: true *** True Line Result +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_console args, req~ +- Inside source: true +*** True Line Result + def get_api_console args, req +** Processing line: ~ html = console_view "# write your code here and set $result.\n$result = $gtk.args.state"~ +- Inside source: true +*** True Line Result + html = console_view "# write your code here and set $result.\n$result = $gtk.args.state" +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ html,~ +- Inside source: true +*** True Line Result + html, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def control_panel_view~ +- Inside source: true +*** True Line Result + def control_panel_view +** Processing line: ~ <<-S~ +- Inside source: true +*** True Line Result + <<-S +** Processing line: ~ <html lang="en">~ +- Inside source: true +*** True Line Result + <html lang="en"> +** Processing line: ~ <head><title>console</title></head>~ +- Inside source: true +*** True Line Result + <head><title>console</title></head> +** Processing line: ~ <body>~ +- Inside source: true +*** True Line Result + <body> +** Processing line: ~ <script>~ +- Inside source: true +*** True Line Result + <script> +** Processing line: ~ async function submitForm(url) {~ +- Inside source: true +*** True Line Result + async function submitForm(url) { +** Processing line: ~ const result = await fetch(url, {~ +- Inside source: true +*** True Line Result + const result = await fetch(url, { +** Processing line: ~ method: 'POST',~ +- Inside source: true +*** True Line Result + method: 'POST', +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +- Inside source: true +*** True Line Result + headers: { 'Content-Type': 'application/json' }, +** Processing line: ~ body: JSON.stringify({}),~ +- Inside source: true +*** True Line Result + body: JSON.stringify({}), +** Processing line: ~ });~ +- Inside source: true +*** True Line Result + }); +** Processing line: ~ document.getElementById("success-notification").innerHTML = "successful";~ +- Inside source: true +*** True Line Result + document.getElementById("success-notification").innerHTML = "successful"; +** Processing line: ~ setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000);~ +- Inside source: true +*** True Line Result + setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000); +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ </script>~ +- Inside source: true +*** True Line Result + </script> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <input type="button" value="Show Console" onclick="submitForm('/dragon/show_console/')" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Show Console" onclick="submitForm('/dragon/show_console/')" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <input type="button" value="Reset Game" onclick="submitForm('/dragon/reset/');" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Reset Game" onclick="submitForm('/dragon/reset/');" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <input type="button" value="Record Gameplay" onclick="submitForm('/dragon/record/');" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Record Gameplay" onclick="submitForm('/dragon/record/');" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <input type="button" value="Stop Recording" onclick="submitForm('/dragon/record_stop/');" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Stop Recording" onclick="submitForm('/dragon/record_stop/');" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <form>~ +- Inside source: true +*** True Line Result + <form> +** Processing line: ~ <input type="button" value="Replay Recording" onclick="submitForm('/dragon/replay/');" />~ +- Inside source: true +*** True Line Result + <input type="button" value="Replay Recording" onclick="submitForm('/dragon/replay/');" /> +** Processing line: ~ </form>~ +- Inside source: true +*** True Line Result + </form> +** Processing line: ~ <div id="success-notification"></div>~ +- Inside source: true +*** True Line Result + <div id="success-notification"></div> +** Processing line: ~ #{links}~ +- Inside source: true +*** True Line Result + #{links} +** Processing line: ~ </body>~ +- Inside source: true +*** True Line Result + </body> +** Processing line: ~ </html>~ +- Inside source: true +*** True Line Result + </html> +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_api_control_panel args, req~ +- Inside source: true +*** True Line Result + def get_api_control_panel args, req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def json? req~ +- Inside source: true +*** True Line Result + def json? req +** Processing line: ~ req.headers.find { |k, v| k == "Content-Type" && (v.include? "application/json") }~ +- Inside source: true +*** True Line Result + req.headers.find { |k, v| k == "Content-Type" && (v.include? "application/json") } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_reset args, req~ +- Inside source: true +*** True Line Result + def post_api_reset args, req +** Processing line: ~ $gtk.reset if json? req~ +- Inside source: true +*** True Line Result + $gtk.reset if json? req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_record args, req~ +- Inside source: true +*** True Line Result + def post_api_record args, req +** Processing line: ~ $recording.start 100 if json? req~ +- Inside source: true +*** True Line Result + $recording.start 100 if json? req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_record_stop args, req~ +- Inside source: true +*** True Line Result + def post_api_record_stop args, req +** Processing line: ~ $recording.stop 'replay.txt' if json? req~ +- Inside source: true +*** True Line Result + $recording.stop 'replay.txt' if json? req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_replay args, req~ +- Inside source: true +*** True Line Result + def post_api_replay args, req +** Processing line: ~ $replay.start 'replay.txt' if json? req~ +- Inside source: true +*** True Line Result + $replay.start 'replay.txt' if json? req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def post_api_show_console args, req~ +- Inside source: true +*** True Line Result + def post_api_show_console args, req +** Processing line: ~ $gtk.console.show if json? req~ +- Inside source: true +*** True Line Result + $gtk.console.show if json? req +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ control_panel_view,~ +- Inside source: true +*** True Line Result + control_panel_view, +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/html' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.inputs.http_requests.each do |req|~ +- Inside source: true +*** True Line Result + args.inputs.http_requests.each do |req| +** Processing line: ~ match_candidate = { method: req.method.downcase.to_sym,~ +- Inside source: true +*** True Line Result + match_candidate = { method: req.method.downcase.to_sym, +** Processing line: ~ uri: req.uri,~ +- Inside source: true +*** True Line Result + uri: req.uri, +** Processing line: ~ uri_without_query_string: (req.uri.split '?').first,~ +- Inside source: true +*** True Line Result + uri_without_query_string: (req.uri.split '?').first, +** Processing line: ~ query_string: (req.uri.split '?').last,~ +- Inside source: true +*** True Line Result + query_string: (req.uri.split '?').last, +** Processing line: ~ has_query_string: !!(req.uri.split '?').last,~ +- Inside source: true +*** True Line Result + has_query_string: !!(req.uri.split '?').last, +** Processing line: ~ has_api_prefix: (req.uri.start_with? "/dragon"),~ +- Inside source: true +*** True Line Result + has_api_prefix: (req.uri.start_with? "/dragon"), +** Processing line: ~ end_with_rb: (req.uri.end_with? ".rb"),~ +- Inside source: true +*** True Line Result + end_with_rb: (req.uri.end_with? ".rb"), +** Processing line: ~ has_file_extension: file_extensions.find { |f| req.uri.include? f },~ +- Inside source: true +*** True Line Result + has_file_extension: file_extensions.find { |f| req.uri.include? f }, +** Processing line: ~ has_trailing_slash: (req.uri.split('?').first.end_with? "/") }~ +- Inside source: true +*** True Line Result + has_trailing_slash: (req.uri.split('?').first.end_with? "/") } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !match_candidate[:has_file_extension]~ +- Inside source: true +*** True Line Result + if !match_candidate[:has_file_extension] +** Processing line: ~ if !match_candidate[:has_trailing_slash]~ +- Inside source: true +*** True Line Result + if !match_candidate[:has_trailing_slash] +** Processing line: ~ match_candidate[:uri] = match_candidate[:uri_without_query_string] + "/"~ +- Inside source: true +*** True Line Result + match_candidate[:uri] = match_candidate[:uri_without_query_string] + "/" +** Processing line: ~ if match_candidate[:query_string]~ +- Inside source: true +*** True Line Result + if match_candidate[:query_string] +** Processing line: ~ match_candidate[:uri] += "?#{match_candidate[:query_string]}"~ +- Inside source: true +*** True Line Result + match_candidate[:uri] += "?#{match_candidate[:query_string]}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ context = { args: args, req: req, match_candidate: match_candidate }~ +- Inside source: true +*** True Line Result + context = { args: args, req: req, match_candidate: match_candidate } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ process! context: context, routes: routes~ +- Inside source: true +*** True Line Result + process! context: context, routes: routes +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def url_decode args, string~ +- Inside source: true +*** True Line Result + def url_decode args, string +** Processing line: ~ args.fn.gsub string,~ +- Inside source: true +*** True Line Result + args.fn.gsub string, +** Processing line: ~ '+', " ",~ +- Inside source: true +*** True Line Result + '+', " ", +** Processing line: ~ '%27', "'",~ +- Inside source: true +*** True Line Result + '%27', "'", +** Processing line: ~ '%22', '"',~ +- Inside source: true +*** True Line Result + '%22', '"', +** Processing line: ~ '%0D%0A', "\n",~ +- Inside source: true +*** True Line Result + '%0D%0A', "\n", +** Processing line: ~ '%3D', "=",~ +- Inside source: true +*** True Line Result + '%3D', "=", +** Processing line: ~ '%3B', ";",~ +- Inside source: true +*** True Line Result + '%3B', ";", +** Processing line: ~ '%7C', "|",~ +- Inside source: true +*** True Line Result + '%7C', "|", +** Processing line: ~ '%28', "(",~ +- Inside source: true +*** True Line Result + '%28', "(", +** Processing line: ~ '%29', ")",~ +- Inside source: true +*** True Line Result + '%29', ")", +** Processing line: ~ '%7B', "{",~ +- Inside source: true +*** True Line Result + '%7B', "{", +** Processing line: ~ '%7D', "}",~ +- Inside source: true +*** True Line Result + '%7D', "}", +** Processing line: ~ '%2C', ",",~ +- Inside source: true +*** True Line Result + '%2C', ",", +** Processing line: ~ '%3A', ":",~ +- Inside source: true +*** True Line Result + '%3A', ":", +** Processing line: ~ '%5B', "[",~ +- Inside source: true +*** True Line Result + '%5B', "[", +** Processing line: ~ '%5D', "]",~ +- Inside source: true +*** True Line Result + '%5D', "]", +** Processing line: ~ '%23', "#",~ +- Inside source: true +*** True Line Result + '%23', "#", +** Processing line: ~ '%21', "!",~ +- Inside source: true +*** True Line Result + '%21', "!", +** Processing line: ~ '%3C', "<",~ +- Inside source: true +*** True Line Result + '%3C', "<", +** Processing line: ~ '%3E', ">",~ +- Inside source: true +*** True Line Result + '%3E', ">", +** Processing line: ~ '%2B', "+",~ +- Inside source: true +*** True Line Result + '%2B', "+", +** Processing line: ~ '%2F', "/",~ +- Inside source: true +*** True Line Result + '%2F', "/", +** Processing line: ~ '%40', "@",~ +- Inside source: true +*** True Line Result + '%40', "@", +** Processing line: ~ '%3F', "?",~ +- Inside source: true +*** True Line Result + '%3F', "?", +** Processing line: ~ '%26', "&",~ +- Inside source: true +*** True Line Result + '%26', "&", +** Processing line: ~ '%24', "$",~ +- Inside source: true +*** True Line Result + '%24', "$", +** Processing line: ~ '%5C', "\\",~ +- Inside source: true +*** True Line Result + '%5C', "\\", +** Processing line: ~ '%60', "`",~ +- Inside source: true +*** True Line Result + '%60', "`", +** Processing line: ~ '%7E', "~",~ +- Inside source: true +*** True Line Result + '%7E', "~", +** Processing line: ~ '%C2%B2', "²",~ +- Inside source: true +*** True Line Result + '%C2%B2', "²", +** Processing line: ~ '%5E', "^",~ +- Inside source: true +*** True Line Result + '%5E', "^", +** Processing line: ~ '%C2%BA', "º",~ +- Inside source: true +*** True Line Result + '%C2%BA', "º", +** Processing line: ~ '%C2%A7', "§",~ +- Inside source: true +*** True Line Result + '%C2%A7', "§", +** Processing line: ~ '%20', " ",~ +- Inside source: true +*** True Line Result + '%20', " ", +** Processing line: ~ '%0A', "\n",~ +- Inside source: true +*** True Line Result + '%0A', "\n", +** Processing line: ~ '%25', "%",~ +- Inside source: true +*** True Line Result + '%25', "%", +** Processing line: ~ '%2A', "*"~ +- Inside source: true +*** True Line Result + '%2A', "*" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def file_extensions~ +- Inside source: true +*** True Line Result + def file_extensions +** Processing line: ~ [".html", ".css", ".gif", ".txt", ".ico", ".rb"]~ +- Inside source: true +*** True Line Result + [".html", ".css", ".gif", ".txt", ".ico", ".rb"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def routes~ +- Inside source: true +*** True Line Result + def routes +** Processing line: ~ [{ match_criteria: { method: :get, uri: "/" },~ +- Inside source: true +*** True Line Result + [{ match_criteria: { method: :get, uri: "/" }, +** Processing line: ~ handler: :get_index },~ +- Inside source: true +*** True Line Result + handler: :get_index }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/" }, +** Processing line: ~ handler: :get_index },~ +- Inside source: true +*** True Line Result + handler: :get_index }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/boot/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/boot/" }, +** Processing line: ~ handler: :get_api_boot },~ +- Inside source: true +*** True Line Result + handler: :get_api_boot }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/trace/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/trace/" }, +** Processing line: ~ handler: :get_api_trace },~ +- Inside source: true +*** True Line Result + handler: :get_api_trace }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/puts/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/puts/" }, +** Processing line: ~ handler: :get_api_puts },~ +- Inside source: true +*** True Line Result + handler: :get_api_puts }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/log/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/log/" }, +** Processing line: ~ handler: :get_api_log },~ +- Inside source: true +*** True Line Result + handler: :get_api_log }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/log/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/log/" }, +** Processing line: ~ handler: :post_api_log },~ +- Inside source: true +*** True Line Result + handler: :post_api_log }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/changes/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/changes/" }, +** Processing line: ~ handler: :get_api_changes },~ +- Inside source: true +*** True Line Result + handler: :get_api_changes }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/eval/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/eval/" }, +** Processing line: ~ handler: :get_api_eval },~ +- Inside source: true +*** True Line Result + handler: :get_api_eval }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/eval/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/eval/" }, +** Processing line: ~ handler: :post_api_eval },~ +- Inside source: true +*** True Line Result + handler: :post_api_eval }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/console/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/console/" }, +** Processing line: ~ handler: :get_api_console },~ +- Inside source: true +*** True Line Result + handler: :get_api_console }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/console/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/console/" }, +** Processing line: ~ handler: :post_api_console },~ +- Inside source: true +*** True Line Result + handler: :post_api_console }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/control_panel/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/control_panel/" }, +** Processing line: ~ handler: :get_api_control_panel },~ +- Inside source: true +*** True Line Result + handler: :get_api_control_panel }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/reset/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/reset/" }, +** Processing line: ~ handler: :post_api_reset },~ +- Inside source: true +*** True Line Result + handler: :post_api_reset }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/record/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/record/" }, +** Processing line: ~ handler: :post_api_record },~ +- Inside source: true +*** True Line Result + handler: :post_api_record }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/record_stop/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/record_stop/" }, +** Processing line: ~ handler: :post_api_record_stop },~ +- Inside source: true +*** True Line Result + handler: :post_api_record_stop }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/replay/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/replay/" }, +** Processing line: ~ handler: :post_api_replay },~ +- Inside source: true +*** True Line Result + handler: :post_api_replay }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/show_console/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/show_console/" }, +** Processing line: ~ handler: :post_api_show_console },~ +- Inside source: true +*** True Line Result + handler: :post_api_show_console }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/code/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/code/" }, +** Processing line: ~ handler: :get_api_code },~ +- Inside source: true +*** True Line Result + handler: :get_api_code }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/autocomplete/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/dragon/autocomplete/" }, +** Processing line: ~ handler: :get_api_autocomplete },~ +- Inside source: true +*** True Line Result + handler: :get_api_autocomplete }, +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/autocomplete/" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri: "/dragon/autocomplete/" }, +** Processing line: ~ handler: :post_api_autocomplete },~ +- Inside source: true +*** True Line Result + handler: :post_api_autocomplete }, +** Processing line: ~ { match_criteria: { method: :get, uri_without_query_string: "/dragon/code/edit/", has_query_string: true },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri_without_query_string: "/dragon/code/edit/", has_query_string: true }, +** Processing line: ~ handler: :get_api_code_edit },~ +- Inside source: true +*** True Line Result + handler: :get_api_code_edit }, +** Processing line: ~ { match_criteria: { method: :post, uri_without_query_string: "/dragon/code/update/", has_query_string: true },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :post, uri_without_query_string: "/dragon/code/update/", has_query_string: true }, +** Processing line: ~ handler: :post_api_code_update },~ +- Inside source: true +*** True Line Result + handler: :post_api_code_update }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/docs.html" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/docs.html" }, +** Processing line: ~ handler: :get_docs_html },~ +- Inside source: true +*** True Line Result + handler: :get_docs_html }, +** Processing line: ~ { match_criteria: { method: :get, uri_without_query_string: "/docs.css" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri_without_query_string: "/docs.css" }, +** Processing line: ~ handler: :get_docs_css },~ +- Inside source: true +*** True Line Result + handler: :get_docs_css }, +** Processing line: ~ { match_criteria: { method: :get, uri: "/docs_search.gif" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/docs_search.gif" }, +** Processing line: ~ handler: :get_docs_search_gif },~ +- Inside source: true +*** True Line Result + handler: :get_docs_search_gif }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_index.html" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/src_backup_index.html" }, +** Processing line: ~ handler: :get_src_backup_index_html },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup_index_html }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_index.txt" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/src_backup_index.txt" }, +** Processing line: ~ handler: :get_src_backup_index_txt },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup_index_txt }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_changes.html" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/src_backup_changes.html" }, +** Processing line: ~ handler: :get_src_backup_changes_html },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup_changes_html }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_changes.txt" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/src_backup_changes.txt" }, +** Processing line: ~ handler: :get_src_backup_changes_txt },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup_changes_txt }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup.css" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/src_backup.css" }, +** Processing line: ~ handler: :get_src_backup_css },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup_css }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, uri: "/favicon.ico" },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, uri: "/favicon.ico" }, +** Processing line: ~ handler: :get_favicon_ico },~ +- Inside source: true +*** True Line Result + handler: :get_favicon_ico }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, end_with_rb: true },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, end_with_rb: true }, +** Processing line: ~ handler: :get_src_backup },~ +- Inside source: true +*** True Line Result + handler: :get_src_backup }, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { match_criteria: { method: :get, end_with_rb: true },~ +- Inside source: true +*** True Line Result + { match_criteria: { method: :get, end_with_rb: true }, +** Processing line: ~ handler: :get_src_backup }~ +- Inside source: true +*** True Line Result + handler: :get_src_backup } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def process! opts~ +- Inside source: true +*** True Line Result + def process! opts +** Processing line: ~ routes = opts[:routes]~ +- Inside source: true +*** True Line Result + routes = opts[:routes] +** Processing line: ~ context = opts[:context]~ +- Inside source: true +*** True Line Result + context = opts[:context] +** Processing line: ~ routes.each do |route|~ +- Inside source: true +*** True Line Result + routes.each do |route| +** Processing line: ~ match_found = (process_single! route: route, context: context)~ +- Inside source: true +*** True Line Result + match_found = (process_single! route: route, context: context) +** Processing line: ~ return if match_found~ +- Inside source: true +*** True Line Result + return if match_found +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def process_single! opts~ +- Inside source: true +*** True Line Result + def process_single! opts +** Processing line: ~ match_criteria = opts[:route][:match_criteria]~ +- Inside source: true +*** True Line Result + match_criteria = opts[:route][:match_criteria] +** Processing line: ~ m = opts[:route][:handler]~ +- Inside source: true +*** True Line Result + m = opts[:route][:handler] +** Processing line: ~ args = opts[:context][:args]~ +- Inside source: true +*** True Line Result + args = opts[:context][:args] +** Processing line: ~ req = opts[:context][:req]~ +- Inside source: true +*** True Line Result + req = opts[:context][:req] +** Processing line: ~ match_candidate = opts[:context][:match_candidate]~ +- Inside source: true +*** True Line Result + match_candidate = opts[:context][:match_candidate] +** Processing line: ~ match_criteria.each do |k, v|~ +- Inside source: true +*** True Line Result + match_criteria.each do |k, v| +** Processing line: ~ return false if match_candidate[k] != v~ +- Inside source: true +*** True Line Result + return false if match_candidate[k] != v +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ begin~ +- Inside source: true +*** True Line Result + begin +** Processing line: ~ send m, args, req~ +- Inside source: true +*** True Line Result + send m, args, req +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ req.respond 200,~ +- Inside source: true +*** True Line Result + req.respond 200, +** Processing line: ~ "#{e}\n#{e.__backtrace_to_org__}",~ +- Inside source: true +*** True Line Result + "#{e}\n#{e.__backtrace_to_org__}", +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +- Inside source: true +*** True Line Result + { 'Content-Type' => 'text/plain' } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ return true~ +- Inside source: true +*** True Line Result + return true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** args.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** args.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/args.rb~ +- Inside source: true +*** True Line Result + # ./dragon/args.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # args.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # args.rb has been released under MIT (*only this file*). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ # This class is the one you'll interact with the most. It's~ +- Inside source: true +*** True Line Result + # This class is the one you'll interact with the most. It's +** Processing line: ~ # constructed by the DragonRuby Runtime and is provided to you on~ +- Inside source: true +*** True Line Result + # constructed by the DragonRuby Runtime and is provided to you on +** Processing line: ~ # each tick.~ +- Inside source: true +*** True Line Result + # each tick. +** Processing line: ~ class Args~ +- Inside source: true +*** True Line Result + class Args +** Processing line: ~ include ArgsDeprecated~ +- Inside source: true +*** True Line Result + include ArgsDeprecated +** Processing line: ~ include Serialize~ +- Inside source: true +*** True Line Result + include Serialize +** Processing line: ~ attr_accessor :cvars~ +- Inside source: true +*** True Line Result + attr_accessor :cvars +** Processing line: ~ attr_accessor :inputs~ +- Inside source: true +*** True Line Result + attr_accessor :inputs +** Processing line: ~ attr_accessor :outputs~ +- Inside source: true +*** True Line Result + attr_accessor :outputs +** Processing line: ~ attr_accessor :audio~ +- Inside source: true +*** True Line Result + attr_accessor :audio +** Processing line: ~ attr_accessor :grid~ +- Inside source: true +*** True Line Result + attr_accessor :grid +** Processing line: ~ attr_accessor :recording~ +- Inside source: true +*** True Line Result + attr_accessor :recording +** Processing line: ~ attr_accessor :geometry~ +- Inside source: true +*** True Line Result + attr_accessor :geometry +** Processing line: ~ attr_accessor :fn~ +- Inside source: true +*** True Line Result + attr_accessor :fn +** Processing line: ~ attr_accessor :state~ +- Inside source: true +*** True Line Result + attr_accessor :state +** Processing line: ~ attr_accessor :temp_state~ +- Inside source: true +*** True Line Result + attr_accessor :temp_state +** Processing line: ~ attr_accessor :runtime~ +- Inside source: true +*** True Line Result + attr_accessor :runtime +** Processing line: ~ alias_method :gtk, :runtime~ +- Inside source: true +*** True Line Result + alias_method :gtk, :runtime +** Processing line: ~ attr_accessor :passes~ +- Inside source: true +*** True Line Result + attr_accessor :passes +** Processing line: ~ attr_accessor :wizards~ +- Inside source: true +*** True Line Result + attr_accessor :wizards +** Processing line: ~ attr_accessor :layout~ +- Inside source: true +*** True Line Result + attr_accessor :layout +** Processing line: ~ attr_accessor :easing~ +- Inside source: true +*** True Line Result + attr_accessor :easing ** Processing line: ~ attr_accessor :string~ - Inside source: true *** True Line Result @@ -141151,6 +155150,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @outputs = Outputs.new args: self +** Processing line: ~ @cvars = {}~ +- Inside source: true +*** True Line Result + @cvars = {} ** Processing line: ~ @audio = {}~ - Inside source: true *** True Line Result @@ -141163,6 +155166,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @state = OpenEntity.new +** Processing line: ~ @temp_state = OpenEntity.new~ +- Inside source: true +*** True Line Result + @temp_state = OpenEntity.new ** Processing line: ~ @state.tick_count = -1~ - Inside source: true *** True Line Result @@ -141279,26 +155286,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result { -** Processing line: ~ state: state.as_hash,~ +** Processing line: ~ state: state.as_hash,~ +- Inside source: true +*** True Line Result + state: state.as_hash, +** Processing line: ~ temp_state: temp_state.as_hash,~ - Inside source: true *** True Line Result - state: state.as_hash, -** Processing line: ~ inputs: inputs.serialize,~ + temp_state: temp_state.as_hash, +** Processing line: ~ inputs: inputs.serialize,~ - Inside source: true *** True Line Result - inputs: inputs.serialize, -** Processing line: ~ passes: passes.serialize,~ + inputs: inputs.serialize, +** Processing line: ~ passes: passes.serialize,~ - Inside source: true *** True Line Result - passes: passes.serialize, -** Processing line: ~ outputs: outputs.serialize,~ + passes: passes.serialize, +** Processing line: ~ outputs: outputs.serialize,~ - Inside source: true *** True Line Result - outputs: outputs.serialize, -** Processing line: ~ grid: grid.serialize~ + outputs: outputs.serialize, +** Processing line: ~ grid: grid.serialize~ - Inside source: true *** True Line Result - grid: grid.serialize + grid: grid.serialize ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -141823,6 +155834,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def method_missing name, *args, &block~ +- Inside source: true +*** True Line Result + def method_missing name, *args, &block +** Processing line: ~ if (args.length <= 1) && (@state.as_hash.key? name)~ +- Inside source: true +*** True Line Result + if (args.length <= 1) && (@state.as_hash.key? name) +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR - :#{name} method missing on ~#{self.class.name}~.~ +- Inside source: true +*** True Line Result + * ERROR - :#{name} method missing on ~#{self.class.name}~. +** Processing line: ~ The method~ +- Inside source: true +*** True Line Result + The method +** Processing line: ~ :#{name}~ +- Inside source: true +*** True Line Result + :#{name} +** Processing line: ~ with args~ +- Inside source: true +*** True Line Result + with args +** Processing line: ~ #{args}~ +- Inside source: true +*** True Line Result + #{args} +** Processing line: ~ doesn't exist on #{inspect}.~ +- Inside source: true +*** True Line Result + doesn't exist on #{inspect}. +** Processing line: ~ ** POSSIBLE SOLUTION - ~args.state.#{name}~ exists.~ +- Inside source: true +*** True Line Result + ** POSSIBLE SOLUTION - ~args.state.#{name}~ exists. +** Processing line: ~ Did you forget ~.state~ before ~.#{name}~?~ +- Inside source: true +*** True Line Result + Did you forget ~.state~ before ~.#{name}~? +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -141963,10 +156042,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def custom_assertion actual, expected, message = nil -** Processing line: ~ # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ +** Processing line: ~ # this tells Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ - Inside source: true *** True Line Result - # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). + # this tells Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). ** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result @@ -141975,10 +156054,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # perform your custom logic here and rais an exception to denote a failure.~ +** Processing line: ~ # perform your custom logic here and raise an exception to denote a failure.~ - Inside source: true *** True Line Result - # perform your custom logic here and rais an exception to denote a failure. + # perform your custom logic here and raise an exception to denote a failure. ** Processing line: ~~ - Inside source: true *** True Line Result @@ -142015,10 +156094,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result =begin -** Processing line: ~ Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ +** Processing line: ~ Use this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ - Inside source: true *** True Line Result - Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). + Use this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). ** Processing line: ~ =end~ - Inside source: true *** True Line Result @@ -142043,10 +156122,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result =begin -** Processing line: ~ Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user.~ +** Processing line: ~ Assert if a value is a truthy value. All assert methods take an optional final parameter that is the message to display to the user.~ - Inside source: true *** True Line Result - Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. + Assert if a value is a truthy value. All assert methods take an optional final parameter that is the message to display to the user. ** Processing line: ~~ - Inside source: true *** True Line Result @@ -142259,10 +156338,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip -** Processing line: ~ message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}.\n#{message}"~ +** Processing line: ~ message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}\n#{message}"~ - Inside source: true *** True Line Result - message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}\n#{message}" ** Processing line: ~ raise message~ - Inside source: true *** True Line Result @@ -142299,10 +156378,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip -** Processing line: ~ message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}.\n#{message}"~ +** Processing line: ~ message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}\n#{message}"~ - Inside source: true *** True Line Result - message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}.\n#{message}" + message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}\n#{message}" ** Processing line: ~ raise message~ - Inside source: true *** True Line Result @@ -142523,6 +156602,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def temp_state~ +- Inside source: true +*** True Line Result + def temp_state +** Processing line: ~ args.temp_state~ +- Inside source: true +*** True Line Result + args.temp_state +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def inputs~ - Inside source: true *** True Line Result @@ -142631,6 +156726,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_entity entity_type, init_hash = nil, &block~ +- Inside source: true +*** True Line Result + def new_entity entity_type, init_hash = nil, &block +** Processing line: ~ args.state.new_entity entity_type, init_hash, &block~ +- Inside source: true +*** True Line Result + args.state.new_entity entity_type, init_hash, &block +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def new_entity_strict entity_type, init_hash = nil, &block~ +- Inside source: true +*** True Line Result + def new_entity_strict entity_type, init_hash = nil, &block +** Processing line: ~ args.state.new_entity_strict entity_type, init_hash, &block~ +- Inside source: true +*** True Line Result + args.state.new_entity_strict entity_type, init_hash, &block +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -142663,6 +156790,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/attr_sprite.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -142819,10 +156950,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, -** Processing line: ~ :source_x, :source_y, :source_w, :source_h~ +** Processing line: ~ :source_x, :source_y, :source_w, :source_h, :blendmode_enum~ - Inside source: true *** True Line Result - :source_x, :source_y, :source_w, :source_h + :source_x, :source_y, :source_w, :source_h, :blendmode_enum ** Processing line: ~~ - Inside source: true *** True Line Result @@ -142919,6 +157050,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/console.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -142963,26 +157098,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :show_reason, :log, :logo, :background_color,~ +** Processing line: ~ attr_accessor :show_reason, :log, :logo,~ - Inside source: true *** True Line Result - attr_accessor :show_reason, :log, :logo, :background_color, -** Processing line: ~ :text_color, :animation_duration,~ + attr_accessor :show_reason, :log, :logo, +** Processing line: ~ :animation_duration,~ - Inside source: true *** True Line Result - :text_color, :animation_duration, + :animation_duration, ** Processing line: ~ :max_log_lines, :max_history, :log,~ - Inside source: true *** True Line Result :max_log_lines, :max_history, :log, -** Processing line: ~ :last_command_errored, :last_command, :error_color, :shown_at,~ +** Processing line: ~ :last_command_errored, :last_command, :shown_at,~ - Inside source: true *** True Line Result - :last_command_errored, :last_command, :error_color, :shown_at, -** Processing line: ~ :header_color, :archived_log, :last_log_lines, :last_log_lines_count,~ + :last_command_errored, :last_command, :shown_at, +** Processing line: ~ :archived_log, :last_log_lines, :last_log_lines_count,~ - Inside source: true *** True Line Result - :header_color, :archived_log, :last_log_lines, :last_log_lines_count, + :archived_log, :last_log_lines, :last_log_lines_count, ** Processing line: ~ :suppress_left_arrow_behavior, :command_set_at,~ - Inside source: true *** True Line Result @@ -142991,10 +157126,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :toast_ids, :bottom, -** Processing line: ~ :font_style, :menu~ +** Processing line: ~ :font_style, :menu,~ +- Inside source: true +*** True Line Result + :font_style, :menu, +** Processing line: ~ :background_color, :spam_color, :text_color, :warn_color,~ - Inside source: true *** True Line Result - :font_style, :menu + :background_color, :spam_color, :text_color, :warn_color, +** Processing line: ~ :error_color, :header_color, :code_color, :comment_color,~ +- Inside source: true +*** True Line Result + :error_color, :header_color, :code_color, :comment_color, +** Processing line: ~ :debug_color, :unfiltered_color~ +- Inside source: true +*** True Line Result + :debug_color, :unfiltered_color ** Processing line: ~~ - Inside source: true *** True Line Result @@ -143003,10 +157150,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def initialize -** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1)~ +** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1)~ - Inside source: true *** True Line Result - @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) + @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1) ** Processing line: ~ @menu = Menu.new self~ - Inside source: true *** True Line Result @@ -143063,26 +157210,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @logo = 'console-logo.png' -** Processing line: ~ @history_fname = 'console_history.txt'~ +** Processing line: ~ @history_fname = 'logs/console_history.txt'~ - Inside source: true *** True Line Result - @history_fname = 'console_history.txt' + @history_fname = 'logs/console_history.txt' ** Processing line: ~ @background_color = Color.new [0, 0, 0, 224]~ - Inside source: true *** True Line Result @background_color = Color.new [0, 0, 0, 224] -** Processing line: ~ @text_color = Color.new [255, 255, 255]~ +** Processing line: ~ @header_color = Color.new [100, 200, 220]~ - Inside source: true *** True Line Result - @text_color = Color.new [255, 255, 255] -** Processing line: ~ @error_color = Color.new [200, 50, 50]~ + @header_color = Color.new [100, 200, 220] +** Processing line: ~ @code_color = Color.new [210, 168, 255]~ - Inside source: true *** True Line Result - @error_color = Color.new [200, 50, 50] -** Processing line: ~ @header_color = Color.new [100, 200, 220]~ + @code_color = Color.new [210, 168, 255] +** Processing line: ~ @comment_color = Color.new [0, 200, 100]~ - Inside source: true *** True Line Result - @header_color = Color.new [100, 200, 220] + @comment_color = Color.new [0, 200, 100] ** Processing line: ~ @animation_duration = 1.seconds~ - Inside source: true *** True Line Result @@ -143091,6 +157238,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @shown_at = -1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # these are the colors for text at various log levels.~ +- Inside source: true +*** True Line Result + # these are the colors for text at various log levels. +** Processing line: ~ @spam_color = Color.new [160, 160, 160]~ +- Inside source: true +*** True Line Result + @spam_color = Color.new [160, 160, 160] +** Processing line: ~ @debug_color = Color.new [0, 255, 0]~ +- Inside source: true +*** True Line Result + @debug_color = Color.new [0, 255, 0] +** Processing line: ~ @text_color = Color.new [255, 255, 255]~ +- Inside source: true +*** True Line Result + @text_color = Color.new [255, 255, 255] +** Processing line: ~ @warn_color = Color.new [255, 255, 0]~ +- Inside source: true +*** True Line Result + @warn_color = Color.new [255, 255, 0] +** Processing line: ~ @error_color = Color.new [200, 50, 50]~ +- Inside source: true +*** True Line Result + @error_color = Color.new [200, 50, 50] +** Processing line: ~ @unfiltered_color = Color.new [0, 255, 255]~ +- Inside source: true +*** True Line Result + @unfiltered_color = Color.new [0, 255, 255] +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ load_history~ - Inside source: true *** True Line Result @@ -143351,10 +157534,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def add_text obj~ +** Processing line: ~ def add_text obj, loglevel=-1~ +- Inside source: true +*** True Line Result + def add_text obj, loglevel=-1 +** Processing line: ~ # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic"~ +- Inside source: true +*** True Line Result + # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic" +** Processing line: ~ loglevel = -1 if loglevel < 0~ +- Inside source: true +*** True Line Result + loglevel = -1 if loglevel < 0 +** Processing line: ~ loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down)~ +- Inside source: true +*** True Line Result + loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down) +** Processing line: ~ loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well~ +- Inside source: true +*** True Line Result + loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well +** Processing line: ~ colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil~ - Inside source: true *** True Line Result - def add_text obj + colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ @last_log_lines_count ||= 1~ - Inside source: true *** True Line Result @@ -143387,14 +157594,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result str.each_line do |s| -** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ +** Processing line: ~ if colorstr.nil?~ +- Inside source: true +*** True Line Result + if colorstr.nil? +** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ +- Inside source: true +*** True Line Result + s.wrapped_lines(self.console_text_width).each do |l| +** Processing line: ~ log_lines << l~ +- Inside source: true +*** True Line Result + log_lines << l +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - s.wrapped_lines(self.console_text_width).each do |l| -** Processing line: ~ log_lines << l~ + else +** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ - Inside source: true *** True Line Result - log_lines << l + s.wrapped_lines(self.console_text_width).each do |l| +** Processing line: ~ log_lines << "#{colorstr}#{l}"~ +- Inside source: true +*** True Line Result + log_lines << "#{colorstr}#{l}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -143407,10 +157638,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if log_lines == @last_log_lines~ +** Processing line: ~ if log_lines == @last_log_lines && log_lines.length != 0~ - Inside source: true *** True Line Result - if log_lines == @last_log_lines + if log_lines == @last_log_lines && log_lines.length != 0 ** Processing line: ~ @last_log_lines_count += 1~ - Inside source: true *** True Line Result @@ -144179,6 +158410,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result $gtk.request_quit +** Processing line: ~ elsif cmd.start_with? ':'~ +- Inside source: true +*** True Line Result + elsif cmd.start_with? ':' +** Processing line: ~ send ((cmd.gsub '-', '_').gsub ':', '')~ +- Inside source: true +*** True Line Result + send ((cmd.gsub '-', '_').gsub ':', '') ** Processing line: ~ else~ - Inside source: true *** True Line Result @@ -144211,6 +158450,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result elsif $results == :console_silent_eval +** Processing line: ~ # do nothing since the console is silent~ +- Inside source: true +*** True Line Result + # do nothing since the console is silent ** Processing line: ~ else~ - Inside source: true *** True Line Result @@ -144235,10 +158478,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result try_search_docs e -** Processing line: ~ puts "* EXCEPTION: #{e}"~ +** Processing line: ~ # if an exception is thrown and the bactrace includes something helpful, then show it~ +- Inside source: true +*** True Line Result + # if an exception is thrown and the bactrace includes something helpful, then show it +** Processing line: ~ if (e.backtrace || []).first && (e.backtrace.first.include? "(eval)")~ +- Inside source: true +*** True Line Result + if (e.backtrace || []).first && (e.backtrace.first.include? "(eval)") +** Processing line: ~ puts "* EXCEPTION: #{e}"~ +- Inside source: true +*** True Line Result + puts "* EXCEPTION: #{e}" +** Processing line: ~ else~ - Inside source: true *** True Line Result - puts "* EXCEPTION: #{e}" + else +** Processing line: ~ puts "* EXCEPTION: #{e}\n#{e.__backtrace_to_org__}"~ +- Inside source: true +*** True Line Result + puts "* EXCEPTION: #{e}\n#{e.__backtrace_to_org__}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -144475,22 +158738,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0~ +** Processing line: ~ if args.inputs.mouse.wheel~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.wheel +** Processing line: ~ if args.inputs.mouse.wheel.y > 0~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.wheel.y > 0 +** Processing line: ~ @inertia = 1~ - Inside source: true *** True Line Result - if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 -** Processing line: ~ @inertia = 1~ + @inertia = 1 +** Processing line: ~ elsif args.inputs.mouse.wheel.y < 0~ - Inside source: true *** True Line Result - @inertia = 1 -** Processing line: ~ elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0~ + elsif args.inputs.mouse.wheel.y < 0 +** Processing line: ~ @inertia = -1~ - Inside source: true *** True Line Result - elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 -** Processing line: ~ @inertia = -1~ + @inertia = -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - @inertia = -1 + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -144523,34 +158794,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if @inertia != 0~ -- Inside source: true -*** True Line Result - if @inertia != 0 -** Processing line: ~ @inertia = (@inertia * 0.7)~ -- Inside source: true -*** True Line Result - @inertia = (@inertia * 0.7) -** Processing line: ~ if @inertia > 0~ +** Processing line: ~ @inertia = (@inertia * 0.7)~ - Inside source: true *** True Line Result - if @inertia > 0 -** Processing line: ~ @log_offset -= 1~ + @inertia = (@inertia * 0.7) +** Processing line: ~ if @inertia > 0~ - Inside source: true *** True Line Result - @log_offset -= 1 -** Processing line: ~ elsif @inertia < 0~ + if @inertia > 0 +** Processing line: ~ @log_offset += 1~ - Inside source: true *** True Line Result - elsif @inertia < 0 -** Processing line: ~ @log_offset += 1~ + @log_offset += 1 +** Processing line: ~ elsif @inertia < 0~ - Inside source: true *** True Line Result - @log_offset += 1 -** Processing line: ~ end~ + elsif @inertia < 0 +** Processing line: ~ @log_offset -= 1~ - Inside source: true *** True Line Result - end + @log_offset -= 1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -144619,6 +158882,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result toggle +** Processing line: ~ args.inputs.keyboard.clear if !@visible~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.clear if !@visible ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -144663,10 +158930,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if args.inputs.keyboard.key_down.enter -** Processing line: ~ eval_the_set_command~ +** Processing line: ~ if slide_progress > 0.5~ +- Inside source: true +*** True Line Result + if slide_progress > 0.5 +** Processing line: ~ # in the event of an exception, the console window pops up~ +- Inside source: true +*** True Line Result + # in the event of an exception, the console window pops up +** Processing line: ~ # and is pre-filled with $gtk.reset.~ +- Inside source: true +*** True Line Result + # and is pre-filled with $gtk.reset. +** Processing line: ~ # there is an annoying scenario where the exception could be thrown~ +- Inside source: true +*** True Line Result + # there is an annoying scenario where the exception could be thrown +** Processing line: ~ # by pressing enter (while playing the game). if you press enter again~ +- Inside source: true +*** True Line Result + # by pressing enter (while playing the game). if you press enter again +** Processing line: ~ # quickly, then the game is reset which closes the console.~ +- Inside source: true +*** True Line Result + # quickly, then the game is reset which closes the console. +** Processing line: ~ # so enter in the console is only evaluated if the slide_progress~ - Inside source: true *** True Line Result - eval_the_set_command + # so enter in the console is only evaluated if the slide_progress +** Processing line: ~ # is atleast half way down the page.~ +- Inside source: true +*** True Line Result + # is atleast half way down the page. +** Processing line: ~ eval_the_set_command~ +- Inside source: true +*** True Line Result + eval_the_set_command +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ elsif args.inputs.keyboard.key_down.v~ - Inside source: true *** True Line Result @@ -144971,10 +159274,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result color = color.mult_alpha(0.5) if archived -** Processing line: ~~ +** Processing line: ~ str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color~ - Inside source: true *** True Line Result - + str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color ** Processing line: ~ args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color)~ - Inside source: true *** True Line Result @@ -145143,6 +159446,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result render_log_offset args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.reserved << { x: 10.from_right, y: @bottom + 10,~ +- Inside source: true +*** True Line Result + args.outputs.reserved << { x: 10.from_right, y: @bottom + 10, +** Processing line: ~ text: "Press CTRL+g or ESCAPE to clear the prompt.",~ +- Inside source: true +*** True Line Result + text: "Press CTRL+g or ESCAPE to clear the prompt.", +** Processing line: ~ vertical_alignment_enum: 0,~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 0, +** Processing line: ~ alignment_enum: 2, r: 80, g: 80, b: 80 }.label!~ +- Inside source: true +*** True Line Result + alignment_enum: 2, r: 80, g: 80, b: 80 }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -145231,10 +159554,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def include_subdued_markers? text -** Processing line: ~ include_any_words? text, subdued_markers~ +** Processing line: ~ (text.start_with? "* INFO: ") && (include_any_words? text, subdued_markers)~ - Inside source: true *** True Line Result - include_any_words? text, subdued_markers + (text.start_with? "* INFO: ") && (include_any_words? text, subdued_markers) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -145815,14 +160138,118 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def color_for_log_entry(log_entry)~ +** Processing line: ~ def code? log_entry~ - Inside source: true *** True Line Result - def color_for_log_entry(log_entry) -** Processing line: ~ if include_row_marker? log_entry~ + def code? log_entry +** Processing line: ~ (just_symbol? log_entry) || (codeblock_marker? log_entry)~ +- Inside source: true +*** True Line Result + (just_symbol? log_entry) || (codeblock_marker? log_entry) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def just_symbol? log_entry~ +- Inside source: true +*** True Line Result + def just_symbol? log_entry +** Processing line: ~ scrubbed = log_entry.gsub("*", "").strip~ - Inside source: true *** True Line Result - if include_row_marker? log_entry + scrubbed = log_entry.gsub("*", "").strip +** Processing line: ~ (scrubbed.start_with? ":") && (!scrubbed.include? " ") && (!scrubbed.include? "=>")~ +- Inside source: true +*** True Line Result + (scrubbed.start_with? ":") && (!scrubbed.include? " ") && (!scrubbed.include? "=>") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def code_comment? log_entry~ +- Inside source: true +*** True Line Result + def code_comment? log_entry +** Processing line: ~ return true if log_entry.strip.start_with?("# ")~ +- Inside source: true +*** True Line Result + return true if log_entry.strip.start_with?("# ") +** Processing line: ~ return false~ +- Inside source: true +*** True Line Result + return false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def codeblock_marker? log_entry~ +- Inside source: true +*** True Line Result + def codeblock_marker? log_entry +** Processing line: ~ return true if log_entry.strip.start_with?("#+begin_src")~ +- Inside source: true +*** True Line Result + return true if log_entry.strip.start_with?("#+begin_src") +** Processing line: ~ return true if log_entry.strip.start_with?("#+end_src")~ +- Inside source: true +*** True Line Result + return true if log_entry.strip.start_with?("#+end_src") +** Processing line: ~ return false~ +- Inside source: true +*** True Line Result + return false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def color_for_plain_text log_entry~ +- Inside source: true +*** True Line Result + def color_for_plain_text log_entry +** Processing line: ~ log_entry = log_entry[4..-1] if log_entry.start_with? "!c!"~ +- Inside source: true +*** True Line Result + log_entry = log_entry[4..-1] if log_entry.start_with? "!c!" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if code? log_entry~ +- Inside source: true +*** True Line Result + if code? log_entry +** Processing line: ~ @code_color~ +- Inside source: true +*** True Line Result + @code_color +** Processing line: ~ elsif code_comment? log_entry~ +- Inside source: true +*** True Line Result + elsif code_comment? log_entry +** Processing line: ~ @comment_color~ +- Inside source: true +*** True Line Result + @comment_color +** Processing line: ~ elsif include_row_marker? log_entry~ +- Inside source: true +*** True Line Result + elsif include_row_marker? log_entry ** Processing line: ~ @text_color~ - Inside source: true *** True Line Result @@ -145879,6 +160306,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def color_for_log_entry(log_entry)~ +- Inside source: true +*** True Line Result + def color_for_log_entry(log_entry) +** Processing line: ~ if log_entry.start_with?('!c!') # loglevel color specified.~ +- Inside source: true +*** True Line Result + if log_entry.start_with?('!c!') # loglevel color specified. +** Processing line: ~ return case log_entry[3..3].to_i~ +- Inside source: true +*** True Line Result + return case log_entry[3..3].to_i +** Processing line: ~ when 0 # spam~ +- Inside source: true +*** True Line Result + when 0 # spam +** Processing line: ~ @spam_color~ +- Inside source: true +*** True Line Result + @spam_color +** Processing line: ~ when 1 # debug~ +- Inside source: true +*** True Line Result + when 1 # debug +** Processing line: ~ @debug_color~ +- Inside source: true +*** True Line Result + @debug_color +** Processing line: ~ #when 2 # info (caught by the `else` block.)~ +- Inside source: true +*** True Line Result + #when 2 # info (caught by the `else` block.) +** Processing line: ~ # @text_color~ +- Inside source: true +*** True Line Result + # @text_color +** Processing line: ~ when 3 # warn~ +- Inside source: true +*** True Line Result + when 3 # warn +** Processing line: ~ @warn_color~ +- Inside source: true +*** True Line Result + @warn_color +** Processing line: ~ when 4 # error~ +- Inside source: true +*** True Line Result + when 4 # error +** Processing line: ~ @error_color~ +- Inside source: true +*** True Line Result + @error_color +** Processing line: ~ when 5 # unfiltered~ +- Inside source: true +*** True Line Result + when 5 # unfiltered +** Processing line: ~ @unfiltered_color~ +- Inside source: true +*** True Line Result + @unfiltered_color +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ color_for_plain_text log_entry~ +- Inside source: true +*** True Line Result + color_for_plain_text log_entry +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return color_for_plain_text log_entry~ +- Inside source: true +*** True Line Result + return color_for_plain_text log_entry +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def prompt~ - Inside source: true *** True Line Result @@ -146027,6 +160546,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/console_color.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -146123,6 +160646,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ "GTK::Console::Color #{to_h}"~ +- Inside source: true +*** True Line Result + "GTK::Console::Color #{to_h}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def to_h~ - Inside source: true *** True Line Result @@ -146175,6 +160714,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/console_font_style.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -146315,10 +160858,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result **color.to_h, -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ - Inside source: true *** True Line Result - }.label + }.label! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -146363,6 +160906,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/console_menu.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -146575,10 +161122,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @console.scroll_to_bottom -** Processing line: ~ $wizards.itch.start~ +** Processing line: ~ $wizards.itch.restart~ - Inside source: true *** True Line Result - $wizards.itch.start + $wizards.itch.restart ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -146675,6 +161222,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), +** Processing line: ~ *custom_buttons~ +- Inside source: true +*** True Line Result + *custom_buttons ** Processing line: ~ ]~ - Inside source: true *** True Line Result @@ -146907,14 +161458,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result primitives = [] -** Processing line: ~ primitives << entity[:rect].merge(a: 164).solid~ +** Processing line: ~ primitives << entity[:rect].solid!(a: 164)~ - Inside source: true *** True Line Result - primitives << entity[:rect].merge(a: 164).solid -** Processing line: ~ primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border~ + primitives << entity[:rect].solid!(a: 164) +** Processing line: ~ primitives << entity[:rect].border!(r: 255, g: 255, b: 255)~ - Inside source: true *** True Line Result - primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border + primitives << entity[:rect].border!(r: 255, g: 255, b: 255) ** Processing line: ~ primitives << text.wrapped_lines(5)~ - Inside source: true *** True Line Result @@ -147027,6 +161578,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/console_prompt.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -147663,10 +162218,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result items.each_slice(columns).each_with_index do |cells, i| -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ pretty_print_row_separator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns ** Processing line: ~ pretty_print_row cells, string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result @@ -147679,10 +162234,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ pretty_print_row_separator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row_separator string_width, cell_width, column_width, columns ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -147731,10 +162286,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # remove seperators between empty values~ +** Processing line: ~ # remove separators between empty values~ - Inside source: true *** True Line Result - # remove seperators between empty values + # remove separators between empty values ** Processing line: ~ formated_row = formated_row.gsub(" | ", " ")~ - Inside source: true *** True Line Result @@ -147755,10 +162310,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ def pretty_print_row_separator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - def pretty_print_row_seperator string_width, cell_width, column_width, columns + def pretty_print_row_separator string_width, cell_width, column_width, columns ** Processing line: ~ # this is a joint: +--------~ - Inside source: true *** True Line Result @@ -147771,10 +162326,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # multiple joints create a row seperator: +----+----+~ +** Processing line: ~ # multiple joints create a row separator: +----+----+~ - Inside source: true *** True Line Result - # multiple joints create a row seperator: +----+----+ + # multiple joints create a row separator: +----+----+ ** Processing line: ~ puts (column_joint * columns) + "+"~ - Inside source: true *** True Line Result @@ -147807,10 +162362,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result x2: x + @cursor_position_px + 0.5, -** Processing line: ~ y2: y + @font_style.letter_size.y + 5)~ +** Processing line: ~ y2: y + @font_style.letter_size.y + 4)~ - Inside source: true *** True Line Result - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) ** Processing line: ~~ - Inside source: true *** True Line Result @@ -147827,10 +162382,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result x2: x + @cursor_position_px + 1, -** Processing line: ~ y2: y + @font_style.letter_size.y + 5)~ +** Processing line: ~ y2: y + @font_style.letter_size.y + 4)~ - Inside source: true *** True Line Result - y2: y + @font_style.letter_size.y + 5) + y2: y + @font_style.letter_size.y + 4) ** Processing line: ~~ - Inside source: true *** True Line Result @@ -150351,10 +164906,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :l3, :r3, -** Processing line: ~ :start, :select,~ +** Processing line: ~ :start, :select, :home,~ - Inside source: true *** True Line Result - :start, :select, + :start, :select, :home, ** Processing line: ~ :directional_up, :directional_down, :directional_left, :directional_right~ - Inside source: true *** True Line Result @@ -150383,6 +164938,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def back~ +- Inside source: true +*** True Line Result + def back +** Processing line: ~ @select~ +- Inside source: true +*** True Line Result + @select +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def back= value~ +- Inside source: true +*** True Line Result + def back= value +** Processing line: ~ @select = value~ +- Inside source: true +*** True Line Result + @select = value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def guide~ +- Inside source: true +*** True Line Result + def guide +** Processing line: ~ @home~ +- Inside source: true +*** True Line Result + @home +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def guide= value~ +- Inside source: true +*** True Line Result + def guide= value +** Processing line: ~ @home = value~ +- Inside source: true +*** True Line Result + @home = value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # Activate a key.~ - Inside source: true *** True Line Result @@ -150579,10 +165198,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result * ERROR -** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy:~ +** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy:~ - Inside source: true *** True Line Result - The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy: + The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy: ** Processing line: ~~ - Inside source: true *** True Line Result @@ -150807,6 +165426,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def directional_angle~ +- Inside source: true +*** True Line Result + def directional_angle +** Processing line: ~ return nil unless directional_vector~ +- Inside source: true +*** True Line Result + return nil unless directional_vector +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Math.atan2(up_down, left_right).to_degrees~ +- Inside source: true +*** True Line Result + Math.atan2(up_down, left_right).to_degrees +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def method_missing m, *args~ - Inside source: true *** True Line Result @@ -150959,14 +165602,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result start_tick + duration, -** Processing line: ~ (initial_value *definitions),~ +** Processing line: ~ initial_value(*definitions),~ - Inside source: true *** True Line Result - (initial_value *definitions), -** Processing line: ~ (final_value *definitions),~ + initial_value(*definitions), +** Processing line: ~ final_value(*definitions),~ - Inside source: true *** True Line Result - (final_value *definitions), + final_value(*definitions), ** Processing line: ~ *definitions~ - Inside source: true *** True Line Result @@ -151747,6 +166390,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result module Geometry +** Processing line: ~ def self.rotate_point point, angle, around = nil~ +- Inside source: true +*** True Line Result + def self.rotate_point point, angle, around = nil +** Processing line: ~ s = Math.sin angle.to_radians~ +- Inside source: true +*** True Line Result + s = Math.sin angle.to_radians +** Processing line: ~ c = Math.cos angle.to_radians~ +- Inside source: true +*** True Line Result + c = Math.cos angle.to_radians +** Processing line: ~ px = point.x~ +- Inside source: true +*** True Line Result + px = point.x +** Processing line: ~ py = point.y~ +- Inside source: true +*** True Line Result + py = point.y +** Processing line: ~ cx = 0~ +- Inside source: true +*** True Line Result + cx = 0 +** Processing line: ~ cy = 0~ +- Inside source: true +*** True Line Result + cy = 0 +** Processing line: ~ if around~ +- Inside source: true +*** True Line Result + if around +** Processing line: ~ cx = around.x~ +- Inside source: true +*** True Line Result + cx = around.x +** Processing line: ~ cy = around.y~ +- Inside source: true +*** True Line Result + cy = around.y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ point.merge(x: ((px - cx) * c - (py - cy) * s) + cx,~ +- Inside source: true +*** True Line Result + point.merge(x: ((px - cx) * c - (py - cy) * s) + cx, +** Processing line: ~ y: ((px - cx) * s + (py - cy) * c) + cy)~ +- Inside source: true +*** True Line Result + y: ((px - cx) * s + (py - cy) * c) + cy) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # Returns f(t) for a cubic Bezier curve.~ - Inside source: true *** True Line Result @@ -152071,10 +166778,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result * ERROR: -** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}.\n#{e}.~ - Inside source: true *** True Line Result - center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect for self #{self} and other_rect #{other_rect}.\n#{e}. ** Processing line: ~ S~ - Inside source: true *** True Line Result @@ -152139,10 +166846,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result * ERROR: -** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}.\n#{e}.~ - Inside source: true *** True Line Result - center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect_x for self #{self} and other_rect #{other_rect}.\n#{e}. ** Processing line: ~ S~ - Inside source: true *** True Line Result @@ -152207,10 +166914,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result * ERROR: -** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}.\n#{e}.~ - Inside source: true *** True Line Result - center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. + center_inside_rect_y for self #{self} and other_rect #{other_rect}.\n#{e}. ** Processing line: ~ S~ - Inside source: true *** True Line Result @@ -152243,10 +166950,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its retangle.~ +** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its rectangle.~ - Inside source: true *** True Line Result - # Returns a primitive that is anchored/repositioned based off its retangle. + # Returns a primitive that is anchored/repositioned based off its rectangle. ** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result @@ -152415,14 +167122,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # @gtk -** Processing line: ~ def self.line_y_intercept line~ +** Processing line: ~ def self.line_y_intercept line, replace_infinity: nil~ +- Inside source: true +*** True Line Result + def self.line_y_intercept line, replace_infinity: nil +** Processing line: ~ line.y - line_slope(line, replace_infinity: replace_infinity) * line.x~ +- Inside source: true +*** True Line Result + line.y - line_slope(line, replace_infinity: replace_infinity) * line.x +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR: ~Geometry::line_y_intercept~~ +- Inside source: true +*** True Line Result + * ERROR: ~Geometry::line_y_intercept~ +** Processing line: ~ The following exception was thrown for line: #{line}~ +- Inside source: true +*** True Line Result + The following exception was thrown for line: #{line} +** Processing line: ~ #{e}~ +- Inside source: true +*** True Line Result + #{e} +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.~ - Inside source: true *** True Line Result - def self.line_y_intercept line -** Processing line: ~ line.y - line_slope(line) * line.x~ + Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. +** Processing line: ~ S~ - Inside source: true *** True Line Result - line.y - line_slope(line) * line.x + S ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -152723,26 +167462,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # @gtk -** Processing line: ~ def self.line_intersect line_one, line_two~ +** Processing line: ~ def self.line_intersect line_one, line_two, replace_infinity: nil~ - Inside source: true *** True Line Result - def self.line_intersect line_one, line_two -** Processing line: ~ m1 = line_slope(line_one)~ + def self.line_intersect line_one, line_two, replace_infinity: nil +** Processing line: ~ m1 = line_slope(line_one, replace_infinity: replace_infinity)~ - Inside source: true *** True Line Result - m1 = line_slope(line_one) -** Processing line: ~ m2 = line_slope(line_two)~ + m1 = line_slope(line_one, replace_infinity: replace_infinity) +** Processing line: ~ m2 = line_slope(line_two, replace_infinity: replace_infinity)~ - Inside source: true *** True Line Result - m2 = line_slope(line_two) -** Processing line: ~ b1 = line_y_intercept(line_one)~ + m2 = line_slope(line_two, replace_infinity: replace_infinity) +** Processing line: ~ b1 = line_y_intercept(line_one, replace_infinity: replace_infinity)~ - Inside source: true *** True Line Result - b1 = line_y_intercept(line_one) -** Processing line: ~ b2 = line_y_intercept(line_two)~ + b1 = line_y_intercept(line_one, replace_infinity: replace_infinity) +** Processing line: ~ b2 = line_y_intercept(line_two, replace_infinity: replace_infinity)~ - Inside source: true *** True Line Result - b2 = line_y_intercept(line_two) + b2 = line_y_intercept(line_two, replace_infinity: replace_infinity) ** Processing line: ~ x = (b1 - b2) / (m2 - m1)~ - Inside source: true *** True Line Result @@ -152755,6 +167494,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result [x, y] +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR: ~Geometry::line_intersect~~ +- Inside source: true +*** True Line Result + * ERROR: ~Geometry::line_intersect~ +** Processing line: ~ The following exception was thrown for line_one: #{line_one}, line_two: #{line_two}~ +- Inside source: true +*** True Line Result + The following exception was thrown for line_one: #{line_one}, line_two: #{line_two} +** Processing line: ~ #{e}~ +- Inside source: true +*** True Line Result + #{e} +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.~ +- Inside source: true +*** True Line Result + Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -152787,22 +167558,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 -** Processing line: ~ return false if rect_one.right - tolerance < rect_two.left + tolerance~ +** Processing line: ~ return false if ((rect_one.x + rect_one.w) - tolerance) < (rect_two.x + tolerance)~ - Inside source: true *** True Line Result - return false if rect_one.right - tolerance < rect_two.left + tolerance -** Processing line: ~ return false if rect_one.left + tolerance > rect_two.right - tolerance~ + return false if ((rect_one.x + rect_one.w) - tolerance) < (rect_two.x + tolerance) +** Processing line: ~ return false if (rect_one.x + tolerance) > ((rect_two.x + rect_two.w) - tolerance)~ - Inside source: true *** True Line Result - return false if rect_one.left + tolerance > rect_two.right - tolerance -** Processing line: ~ return false if rect_one.top - tolerance < rect_two.bottom + tolerance~ + return false if (rect_one.x + tolerance) > ((rect_two.x + rect_two.w) - tolerance) +** Processing line: ~ return false if ((rect_one.y + rect_one.h) - tolerance) < (rect_two.y + tolerance)~ - Inside source: true *** True Line Result - return false if rect_one.top - tolerance < rect_two.bottom + tolerance -** Processing line: ~ return false if rect_one.bottom + tolerance > rect_two.top - tolerance~ + return false if ((rect_one.y + rect_one.h) - tolerance) < (rect_two.y + tolerance) +** Processing line: ~ return false if (rect_one.y + tolerance) > ((rect_two.y + rect_two.h) - tolerance)~ - Inside source: true *** True Line Result - return false if rect_one.bottom + tolerance > rect_two.top - tolerance + return false if (rect_one.y + tolerance) > ((rect_two.y + rect_two.h) - tolerance) ** Processing line: ~ return true~ - Inside source: true *** True Line Result @@ -152911,6 +167682,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result #{context_help} +** Processing line: ~ \n#{e}~ +- Inside source: true +*** True Line Result + \n#{e} ** Processing line: ~ S~ - Inside source: true *** True Line Result @@ -152951,10 +167726,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}."~ +** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -152979,10 +167754,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}."~ +** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}." + raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153015,10 +167790,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}."~ +** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153043,10 +167818,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}."~ +** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}." + raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153071,10 +167846,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}"~ +** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}" + raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153091,30 +167866,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def self.inside_rect? inner_rect, outer_rect, tolerance = 0.0 +** Processing line: ~ return nil if !inner_rect~ +- Inside source: true +*** True Line Result + return nil if !inner_rect +** Processing line: ~ return nil if !outer_rect~ +- Inside source: true +*** True Line Result + return nil if !outer_rect +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ inner_rect.x + tolerance >= outer_rect.x - tolerance &&~ - Inside source: true *** True Line Result inner_rect.x + tolerance >= outer_rect.x - tolerance && -** Processing line: ~ inner_rect.right - tolerance <= outer_rect.right + tolerance &&~ +** Processing line: ~ (inner_rect.x + inner_rect.w) - tolerance <= (outer_rect.x + outer_rect.w) + tolerance &&~ - Inside source: true *** True Line Result - inner_rect.right - tolerance <= outer_rect.right + tolerance && + (inner_rect.x + inner_rect.w) - tolerance <= (outer_rect.x + outer_rect.w) + tolerance && ** Processing line: ~ inner_rect.y + tolerance >= outer_rect.y - tolerance &&~ - Inside source: true *** True Line Result inner_rect.y + tolerance >= outer_rect.y - tolerance && -** Processing line: ~ inner_rect.top - tolerance <= outer_rect.top + tolerance~ +** Processing line: ~ (inner_rect.y + inner_rect.h) - tolerance <= (outer_rect.y + outer_rect.h) + tolerance~ - Inside source: true *** True Line Result - inner_rect.top - tolerance <= outer_rect.top + tolerance + (inner_rect.y + inner_rect.h) - tolerance <= (outer_rect.y + outer_rect.h) + tolerance ** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}."~ +** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}." + raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153251,10 +168038,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}."~ +** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}." + raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -153307,10 +168094,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result rescue Exception => e -** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]."~ +** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)].\n#{e}"~ - Inside source: true *** True Line Result - raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]." + raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)].\n#{e}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.rect_to_line rect~ +- Inside source: true +*** True Line Result + def self.rect_to_line rect +** Processing line: ~ l = rect.to_hash.line~ +- Inside source: true +*** True Line Result + l = rect.to_hash.line +** Processing line: ~ l.merge(x2: l.x + l.w - 1,~ +- Inside source: true +*** True Line Result + l.merge(x2: l.x + l.w - 1, +** Processing line: ~ y2: l.y + l.h)~ +- Inside source: true +*** True Line Result + y2: l.y + l.h) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.rect_center_point rect~ +- Inside source: true +*** True Line Result + def self.rect_center_point rect +** Processing line: ~ { x: rect.x + rect.w.half, y: rect.y + rect.h.half }~ +- Inside source: true +*** True Line Result + { x: rect.x + rect.w.half, y: rect.y + rect.h.half } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def rect_center_point~ +- Inside source: true +*** True Line Result + def rect_center_point +** Processing line: ~ Geometry.rect_center_point self~ +- Inside source: true +*** True Line Result + Geometry.rect_center_point self ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -154099,6 +168942,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def x~ +- Inside source: true +*** True Line Result + def x +** Processing line: ~ 0~ +- Inside source: true +*** True Line Result + 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def y~ +- Inside source: true +*** True Line Result + def y +** Processing line: ~ 0~ +- Inside source: true +*** True Line Result + 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -154907,6 +169782,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def self.method_to_key_hash~ +- Inside source: true +*** True Line Result + def self.method_to_key_hash +** Processing line: ~ return @method_to_key_hash if @method_to_key_hash~ +- Inside source: true +*** True Line Result + return @method_to_key_hash if @method_to_key_hash +** Processing line: ~ @method_to_key_hash = {}~ +- Inside source: true +*** True Line Result + @method_to_key_hash = {} +** Processing line: ~ string_representation_overrides ||= {~ +- Inside source: true +*** True Line Result + string_representation_overrides ||= { +** Processing line: ~ backspace: '\b'~ +- Inside source: true +*** True Line Result + backspace: '\b' +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ char_to_method_hash.each do |k, v|~ +- Inside source: true +*** True Line Result + char_to_method_hash.each do |k, v| +** Processing line: ~ v.each do |vi|~ +- Inside source: true +*** True Line Result + v.each do |vi| +** Processing line: ~ t = { char_or_raw_key: k }~ +- Inside source: true +*** True Line Result + t = { char_or_raw_key: k } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if k.is_a? Numeric~ +- Inside source: true +*** True Line Result + if k.is_a? Numeric +** Processing line: ~ t[:raw_key] = k~ +- Inside source: true +*** True Line Result + t[:raw_key] = k +** Processing line: ~ t[:string_representation] = "raw_key == #{k}"~ +- Inside source: true +*** True Line Result + t[:string_representation] = "raw_key == #{k}" +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ t[:char] = k~ +- Inside source: true +*** True Line Result + t[:char] = k +** Processing line: ~ t[:string_representation] = "\"#{k.strip}\""~ +- Inside source: true +*** True Line Result + t[:string_representation] = "\"#{k.strip}\"" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @method_to_key_hash[vi] = t~ +- Inside source: true +*** True Line Result + @method_to_key_hash[vi] = t +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ @method_to_key_hash~ +- Inside source: true +*** True Line Result + @method_to_key_hash +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def self.char_to_method char, int = nil~ - Inside source: true *** True Line Result @@ -155299,10 +170270,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result collection.each do |m| -** Processing line: ~ self.instance_variable_set("@#{m.to_s}".to_sym, value)~ +** Processing line: ~ m_to_s = m.to_s~ +- Inside source: true +*** True Line Result + m_to_s = m.to_s +** Processing line: ~ self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0~ - Inside source: true *** True Line Result - self.instance_variable_set("@#{m.to_s}".to_sym, value) + self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0 ** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result @@ -155363,46 +170338,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def method_missing m, *args -** Processing line: ~ begin~ +** Processing line: ~ if KeyboardKeys.method_to_key_hash[m.without_ending_bang]~ - Inside source: true *** True Line Result - begin -** Processing line: ~ define_singleton_method(m) do~ + if KeyboardKeys.method_to_key_hash[m.without_ending_bang] +** Processing line: ~ begin~ - Inside source: true *** True Line Result - define_singleton_method(m) do -** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ + begin +** Processing line: ~ define_singleton_method(m) do~ - Inside source: true *** True Line Result - r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) -** Processing line: ~ clear_key m~ + define_singleton_method(m) do +** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ - Inside source: true *** True Line Result - clear_key m -** Processing line: ~ return r~ + r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) +** Processing line: ~ clear_key m~ - Inside source: true *** True Line Result - return r -** Processing line: ~ end~ + clear_key m +** Processing line: ~ return r~ - Inside source: true *** True Line Result - end + return r +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return self.send m~ +** Processing line: ~ return self.send m~ - Inside source: true *** True Line Result - return self.send m -** Processing line: ~ rescue Exception => e~ + return self.send m +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ log_important "#{e}"~ + rescue Exception => e +** Processing line: ~ log_important "#{e}"~ - Inside source: true *** True Line Result - log_important "#{e}" + log_important "#{e}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -155411,6 +170394,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ did_you_mean = KeyboardKeys.method_to_key_hash.find_all do |k, v|~ +- Inside source: true +*** True Line Result + did_you_mean = KeyboardKeys.method_to_key_hash.find_all do |k, v| +** Processing line: ~ k.to_s[0..1] == m.to_s[0..1]~ +- Inside source: true +*** True Line Result + k.to_s[0..1] == m.to_s[0..1] +** Processing line: ~ end.map {|k, v| ":#{k} (#{v[:string_representation]})" }~ +- Inside source: true +*** True Line Result + end.map {|k, v| ":#{k} (#{v[:string_representation]})" } +** Processing line: ~ did_you_mean_string = ""~ +- Inside source: true +*** True Line Result + did_you_mean_string = "" +** Processing line: ~ did_you_mean_string = ". Did you mean #{did_you_mean.join ", "}?"~ +- Inside source: true +*** True Line Result + did_you_mean_string = ". Did you mean #{did_you_mean.join ", "}?" +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ raise <<-S~ - Inside source: true *** True Line Result @@ -155419,22 +170426,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result * ERROR: -** Processing line: ~ There is no member on the keyboard called #{m}. Here is a to_s representation of what's available:~ +** Processing line: ~ #{KeyboardKeys.method_to_key_hash.map { |k, v| "** :#{k} #{v.string_representation}" }.join("\n")}~ - Inside source: true *** True Line Result - There is no member on the keyboard called #{m}. Here is a to_s representation of what's available: + #{KeyboardKeys.method_to_key_hash.map { |k, v| "** :#{k} #{v.string_representation}" }.join("\n")} ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")}~ +** Processing line: ~ There is no key on the keyboard called :#{m}#{did_you_mean_string}.~ - Inside source: true *** True Line Result - #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")} -** Processing line: ~~ + There is no key on the keyboard called :#{m}#{did_you_mean_string}. +** Processing line: ~ Full list of available keys =:points_up:=.~ - Inside source: true *** True Line Result - + Full list of available keys =:points_up:=. ** Processing line: ~ S~ - Inside source: true *** True Line Result @@ -156967,6 +171974,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def directional_angle~ +- Inside source: true +*** True Line Result + def directional_angle +** Processing line: ~ keyboard.directional_angle || (controller_one && controller_one.directional_angle)~ +- Inside source: true +*** True Line Result + keyboard.directional_angle || (controller_one && controller_one.directional_angle) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # Returns a signal indicating right (`1`), left (`-1`), or neither ('0').~ - Inside source: true *** True Line Result @@ -157255,6 +172278,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/ios_wizard.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -157271,42 +172298,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ class WizardException < Exception~ +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński~ - Inside source: true *** True Line Result - class WizardException < Exception -** Processing line: ~ attr_accessor :console_primitives~ -- Inside source: true -*** True Line Result - attr_accessor :console_primitives + # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize *console_primitives~ +** Processing line: ~ class IOSWizard < Wizard~ - Inside source: true *** True Line Result - def initialize *console_primitives -** Processing line: ~ @console_primitives = console_primitives~ -- Inside source: true -*** True Line Result - @console_primitives = console_primitives -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ class IOSWizard~ -- Inside source: true -*** True Line Result - class IOSWizard + class IOSWizard < Wizard ** Processing line: ~ def initialize~ - Inside source: true *** True Line Result @@ -157355,10 +172358,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def steps_development_build~ +** Processing line: ~ def prerequisite_steps~ - Inside source: true *** True Line Result - def steps_development_build + def prerequisite_steps ** Processing line: ~ [~ - Inside source: true *** True Line Result @@ -157375,14 +172378,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :check_for_certs, -** Processing line: ~ :check_for_device,~ +** Processing line: ~ ]~ - Inside source: true *** True Line Result - :check_for_device, -** Processing line: ~ :check_for_dev_profile,~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - :check_for_dev_profile, + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def app_metadata_retrieval_steps~ +- Inside source: true +*** True Line Result + def app_metadata_retrieval_steps +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ ** Processing line: ~ :determine_team_identifier,~ - Inside source: true *** True Line Result @@ -157395,18 +172410,78 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :determine_app_id, -** Processing line: ~ :blow_away_temp,~ +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - :blow_away_temp, + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def steps_development_build~ +- Inside source: true +*** True Line Result + def steps_development_build +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ *prerequisite_steps,~ +- Inside source: true +*** True Line Result + *prerequisite_steps, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :check_for_device,~ +- Inside source: true +*** True Line Result + :check_for_device, +** Processing line: ~ :check_for_dev_profile,~ +- Inside source: true +*** True Line Result + :check_for_dev_profile, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ *app_metadata_retrieval_steps,~ +- Inside source: true +*** True Line Result + *app_metadata_retrieval_steps, +** Processing line: ~ :determine_devcert,~ +- Inside source: true +*** True Line Result + :determine_devcert, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :clear_tmp_directory,~ +- Inside source: true +*** True Line Result + :clear_tmp_directory, ** Processing line: ~ :stage_app,~ - Inside source: true *** True Line Result :stage_app, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :development_write_info_plist,~ - Inside source: true *** True Line Result :development_write_info_plist, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :write_entitlements_plist,~ - Inside source: true *** True Line Result @@ -157415,14 +172490,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :compile_icons, -** Processing line: ~ :create_payload_directory,~ +** Processing line: ~ :clear_payload_directory,~ - Inside source: true *** True Line Result - :create_payload_directory, + :clear_payload_directory, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :create_payload_directory_dev,~ +- Inside source: true +*** True Line Result + :create_payload_directory_dev, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :create_payload,~ +- Inside source: true +*** True Line Result + :create_payload, ** Processing line: ~ :code_sign_payload,~ - Inside source: true *** True Line Result :code_sign_payload, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :create_ipa,~ - Inside source: true *** True Line Result @@ -157451,46 +172546,58 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result [ -** Processing line: ~ :check_for_xcode,~ +** Processing line: ~ *prerequisite_steps,~ - Inside source: true *** True Line Result - :check_for_xcode, -** Processing line: ~ :check_for_brew,~ -- Inside source: true -*** True Line Result - :check_for_brew, -** Processing line: ~ :check_for_certs,~ + *prerequisite_steps, +** Processing line: ~~ - Inside source: true *** True Line Result - :check_for_certs, + ** Processing line: ~ :check_for_distribution_profile,~ - Inside source: true *** True Line Result :check_for_distribution_profile, -** Processing line: ~ :determine_team_identifier,~ +** Processing line: ~ :determine_app_version,~ - Inside source: true *** True Line Result - :determine_team_identifier, -** Processing line: ~ :determine_app_name,~ + :determine_app_version, +** Processing line: ~~ - Inside source: true *** True Line Result - :determine_app_name, -** Processing line: ~ :determine_app_id,~ + +** Processing line: ~ *app_metadata_retrieval_steps,~ - Inside source: true *** True Line Result - :determine_app_id, -** Processing line: ~ :blow_away_temp,~ + *app_metadata_retrieval_steps, +** Processing line: ~ :determine_prodcert,~ +- Inside source: true +*** True Line Result + :determine_prodcert, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :clear_tmp_directory,~ - Inside source: true *** True Line Result - :blow_away_temp, + :clear_tmp_directory, ** Processing line: ~ :stage_app,~ - Inside source: true *** True Line Result :stage_app, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :production_write_info_plist,~ - Inside source: true *** True Line Result :production_write_info_plist, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :write_entitlements_plist,~ - Inside source: true *** True Line Result @@ -157499,14 +172606,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result :compile_icons, -** Processing line: ~ :create_payload_directory,~ +** Processing line: ~ :clear_payload_directory,~ +- Inside source: true +*** True Line Result + :clear_payload_directory, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :create_payload_directory_prod,~ +- Inside source: true +*** True Line Result + :create_payload_directory_prod, +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ :create_payload,~ - Inside source: true *** True Line Result - :create_payload_directory, + :create_payload, ** Processing line: ~ :code_sign_payload,~ - Inside source: true *** True Line Result :code_sign_payload, +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :create_ipa,~ - Inside source: true *** True Line Result @@ -157647,6 +172774,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @certificate_name = nil +** Processing line: ~ @app_version = opts[:version]~ +- Inside source: true +*** True Line Result + @app_version = opts[:version] +** Processing line: ~ @app_version = "1.0" if @opts[:env] == :dev && !@app_version~ +- Inside source: true +*** True Line Result + @app_version = "1.0" if @opts[:env] == :dev && !@app_version ** Processing line: ~ init_wizard_status~ - Inside source: true *** True Line Result @@ -157731,6 +172866,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log_error e.to_s +** Processing line: ~ log e.__backtrace_to_org__~ +- Inside source: true +*** True Line Result + log e.__backtrace_to_org__ ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -157739,6 +172878,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ init_wizard_status~ +- Inside source: true +*** True Line Result + init_wizard_status ** Processing line: ~ $console.set_command "$wizards.ios.start env: :#{@opts[:env]}"~ - Inside source: true *** True Line Result @@ -158163,18 +173306,242 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def ios_metadata_template~ +- Inside source: true +*** True Line Result + def ios_metadata_template +** Processing line: ~ <<-S~ +- Inside source: true +*** True Line Result + <<-S +** Processing line: ~ # ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps.~ +- Inside source: true +*** True Line Result + # ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps. +** Processing line: ~ # Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase~ +- Inside source: true +*** True Line Result + # Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # teamid needs to be set to your assigned Team Id which can be found at https://developer.apple.com/account/#/membership/~ +- Inside source: true +*** True Line Result + # teamid needs to be set to your assigned Team Id which can be found at https://developer.apple.com/account/#/membership/ +** Processing line: ~ teamid=~ +- Inside source: true +*** True Line Result + teamid= +** Processing line: ~ # appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list~ +- Inside source: true +*** True Line Result + # appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list +** Processing line: ~ appid=~ +- Inside source: true +*** True Line Result + appid= +** Processing line: ~ # appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters.~ +- Inside source: true +*** True Line Result + # appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters. +** Processing line: ~ appname=~ +- Inside source: true +*** True Line Result + appname= +** Processing line: ~ # devcert is the certificate to use for development/deploying to your local device~ +- Inside source: true +*** True Line Result + # devcert is the certificate to use for development/deploying to your local device +** Processing line: ~ devcert=~ +- Inside source: true +*** True Line Result + devcert= +** Processing line: ~ # prodcert is the certificate to use for distribution to the app store~ +- Inside source: true +*** True Line Result + # prodcert is the certificate to use for distribution to the app store +** Processing line: ~ prodcert=~ +- Inside source: true +*** True Line Result + prodcert= +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def ios_metadata~ +- Inside source: true +*** True Line Result + def ios_metadata +** Processing line: ~ contents = $gtk.read_file 'metadata/ios_metadata.txt'~ +- Inside source: true +*** True Line Result + contents = $gtk.read_file 'metadata/ios_metadata.txt' +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !contents~ +- Inside source: true +*** True Line Result + if !contents +** Processing line: ~ $gtk.write_file 'metadata/ios_metadata.txt', ios_metadata_template~ +- Inside source: true +*** True Line Result + $gtk.write_file 'metadata/ios_metadata.txt', ios_metadata_template +** Processing line: ~ contents = $gtk.read_file 'metadata/ios_metadata.txt'~ +- Inside source: true +*** True Line Result + contents = $gtk.read_file 'metadata/ios_metadata.txt' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ kvps = contents.each_line~ +- Inside source: true +*** True Line Result + kvps = contents.each_line +** Processing line: ~ .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") }~ +- Inside source: true +*** True Line Result + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } +** Processing line: ~ .map do |l|~ +- Inside source: true +*** True Line Result + .map do |l| +** Processing line: ~ key, value = l.split("=")~ +- Inside source: true +*** True Line Result + key, value = l.split("=") +** Processing line: ~ [key.strip.to_sym, value.strip]~ +- Inside source: true +*** True Line Result + [key.strip.to_sym, value.strip] +** Processing line: ~ end.flatten~ +- Inside source: true +*** True Line Result + end.flatten +** Processing line: ~ Hash[*kvps]~ +- Inside source: true +*** True Line Result + Hash[*kvps] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def game_metadata~ +- Inside source: true +*** True Line Result + def game_metadata +** Processing line: ~ contents = $gtk.read_file 'metadata/game_metadata.txt'~ +- Inside source: true +*** True Line Result + contents = $gtk.read_file 'metadata/game_metadata.txt' +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ kvps = contents.each_line~ +- Inside source: true +*** True Line Result + kvps = contents.each_line +** Processing line: ~ .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") }~ +- Inside source: true +*** True Line Result + .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") } +** Processing line: ~ .map do |l|~ +- Inside source: true +*** True Line Result + .map do |l| +** Processing line: ~ key, value = l.split("=")~ +- Inside source: true +*** True Line Result + key, value = l.split("=") +** Processing line: ~ [key.strip.to_sym, value.strip]~ +- Inside source: true +*** True Line Result + [key.strip.to_sym, value.strip] +** Processing line: ~ end.flatten~ +- Inside source: true +*** True Line Result + end.flatten +** Processing line: ~ Hash[*kvps]~ +- Inside source: true +*** True Line Result + Hash[*kvps] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def raise_ios_metadata_required~ +- Inside source: true +*** True Line Result + def raise_ios_metadata_required +** Processing line: ~ raise WizardException.new(~ +- Inside source: true +*** True Line Result + raise WizardException.new( +** Processing line: ~ "* mygame/metadata/ios_metadata.txt needs to be filled out.",~ +- Inside source: true +*** True Line Result + "* mygame/metadata/ios_metadata.txt needs to be filled out.", +** Processing line: ~ "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.",~ +- Inside source: true +*** True Line Result + "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.", +** Processing line: ~ "Instructions for where the values should come from are within metadata/ios_metadata.txt."~ +- Inside source: true +*** True Line Result + "Instructions for where the values should come from are within metadata/ios_metadata.txt." +** Processing line: ~ )~ +- Inside source: true +*** True Line Result + ) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def determine_team_identifier~ - Inside source: true *** True Line Result def determine_team_identifier -** Processing line: ~ @team_name = (team_identifier_from_provisioning_profile @opts[:env])~ +** Processing line: ~ @team_id = (ios_metadata.teamid || "")~ - Inside source: true *** True Line Result - @team_name = (team_identifier_from_provisioning_profile @opts[:env]) -** Processing line: ~ log_info "Team Identifer is: #{@team_name}"~ + @team_id = (ios_metadata.teamid || "") +** Processing line: ~ raise_ios_metadata_required if @team_id.strip.length == 0~ - Inside source: true *** True Line Result - log_info "Team Identifer is: #{@team_name}" + raise_ios_metadata_required if @team_id.strip.length == 0 +** Processing line: ~ log_info "Team Identifer is: #{@team_id}"~ +- Inside source: true +*** True Line Result + log_info "Team Identifer is: #{@team_id}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -158187,10 +173554,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def determine_app_name -** Processing line: ~ @app_name = (provisioning_profile_xml @opts[:env])[:children].first[:children].first[:children][1][:children].first[:data]~ +** Processing line: ~ @app_name = (ios_metadata.appname || "")~ +- Inside source: true +*** True Line Result + @app_name = (ios_metadata.appname || "") +** Processing line: ~ raise_ios_metadata_required if @app_name.strip.length == 0~ - Inside source: true *** True Line Result - @app_name = (provisioning_profile_xml @opts[:env])[:children].first[:children].first[:children][1][:children].first[:data] + raise_ios_metadata_required if @app_name.strip.length == 0 ** Processing line: ~ log_info "App name is: #{@app_name}."~ - Inside source: true *** True Line Result @@ -158283,54 +173654,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def app_id_from_provisioning_profile environment~ -- Inside source: true -*** True Line Result - def app_id_from_provisioning_profile environment -** Processing line: ~ application_identifier_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data]~ -- Inside source: true -*** True Line Result - application_identifier_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] -** Processing line: ~ (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i|~ -- Inside source: true -*** True Line Result - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| -** Processing line: ~ if node[:children] && node[:children][0] && node[:children][0][:data] == "application-identifier"~ -- Inside source: true -*** True Line Result - if node[:children] && node[:children][0] && node[:children][0][:data] == "application-identifier" -** Processing line: ~ application_identifier_index = i~ -- Inside source: true -*** True Line Result - application_identifier_index = i -** Processing line: ~ break~ -- Inside source: true -*** True Line Result - break -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ +** Processing line: ~ def determine_app_id~ - Inside source: true *** True Line Result - -** Processing line: ~ app_id_with_team_identifier = (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][application_identifier_index + 1][:children].first[:data]~ + def determine_app_id +** Processing line: ~ @app_id = ios_metadata.appid~ - Inside source: true *** True Line Result - app_id_with_team_identifier = (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][application_identifier_index + 1][:children].first[:data] -** Processing line: ~ team_identifer = team_identifier_from_provisioning_profile environment~ + @app_id = ios_metadata.appid +** Processing line: ~ raise_ios_metadata_required if @app_id.strip.length == 0~ - Inside source: true *** True Line Result - team_identifer = team_identifier_from_provisioning_profile environment -** Processing line: ~ app_id_with_team_identifier.gsub "#{team_identifer}.", ""~ + raise_ios_metadata_required if @app_id.strip.length == 0 +** Processing line: ~ log_info "App Identifier is set to: #{@app_id}"~ - Inside source: true *** True Line Result - app_id_with_team_identifier.gsub "#{team_identifer}.", "" + log_info "App Identifier is set to: #{@app_id}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -158339,50 +173678,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def team_identifier_from_provisioning_profile environment~ +** Processing line: ~ def determine_devcert~ - Inside source: true *** True Line Result - def team_identifier_from_provisioning_profile environment -** Processing line: ~ team_identifer_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data]~ + def determine_devcert +** Processing line: ~ @certificate_name = ios_metadata.devcert~ - Inside source: true *** True Line Result - team_identifer_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data] -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i|~ -- Inside source: true -*** True Line Result - (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i| -** Processing line: ~ if node[:children] && node[:children][0] && node[:children][0][:data] == "com.apple.developer.team-identifier"~ -- Inside source: true -*** True Line Result - if node[:children] && node[:children][0] && node[:children][0][:data] == "com.apple.developer.team-identifier" -** Processing line: ~ team_identifer_index = i~ -- Inside source: true -*** True Line Result - team_identifer_index = i -** Processing line: ~ break~ -- Inside source: true -*** True Line Result - break -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ + @certificate_name = ios_metadata.devcert +** Processing line: ~ raise_ios_metadata_required if @certificate_name.strip.length == 0~ - Inside source: true *** True Line Result - -** Processing line: ~ (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][team_identifer_index + 1][:children].first[:data]~ + raise_ios_metadata_required if @certificate_name.strip.length == 0 +** Processing line: ~ log_info "Dev Certificate is set to: #{@certificate_name}"~ - Inside source: true *** True Line Result - (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][team_identifer_index + 1][:children].first[:data] + log_info "Dev Certificate is set to: #{@certificate_name}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -158391,22 +173702,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def determine_app_id~ +** Processing line: ~ def determine_prodcert~ - Inside source: true *** True Line Result - def determine_app_id -** Processing line: ~ @app_id = app_id_from_provisioning_profile @opts[:env]~ + def determine_prodcert +** Processing line: ~ @certificate_name = ios_metadata.prodcert~ - Inside source: true *** True Line Result - @app_id = app_id_from_provisioning_profile @opts[:env] -** Processing line: ~~ + @certificate_name = ios_metadata.prodcert +** Processing line: ~ raise_ios_metadata_required if @certificate_name.strip.length == 0~ - Inside source: true *** True Line Result - -** Processing line: ~ log_info "App Identifier is set to : #{@app_id}"~ + raise_ios_metadata_required if @certificate_name.strip.length == 0 +** Processing line: ~ log_info "Production (Distribution) Certificate is set to: #{@certificate_name}"~ - Inside source: true *** True Line Result - log_info "App Identifier is set to : #{@app_id}" + log_info "Production (Distribution) Certificate is set to: #{@certificate_name}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -158475,10 +173786,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def blow_away_temp~ +** Processing line: ~ def clear_tmp_directory~ - Inside source: true *** True Line Result - def blow_away_temp + def clear_tmp_directory ** Processing line: ~ sh "rm -rf #{tmp_directory}"~ - Inside source: true *** True Line Result @@ -158491,30 +173802,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def stage_app~ -- Inside source: true -*** True Line Result - def stage_app -** Processing line: ~ log_info "Staging."~ -- Inside source: true -*** True Line Result - log_info "Staging." -** Processing line: ~ sh "mkdir -p #{tmp_directory}"~ -- Inside source: true -*** True Line Result - sh "mkdir -p #{tmp_directory}" -** Processing line: ~ sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""~ -- Inside source: true -*** True Line Result - sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def set_app_id id~ - Inside source: true *** True Line Result @@ -158635,118 +173922,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if !cli_app_exist?(security_cli_app)~ -- Inside source: true -*** True Line Result - if !cli_app_exist?(security_cli_app) -** Processing line: ~ raise WizardException.new(~ -- Inside source: true -*** True Line Result - raise WizardException.new( -** Processing line: ~ "* It doesn't look like you have #{security_cli_app}.",~ -- Inside source: true -*** True Line Result - "* It doesn't look like you have #{security_cli_app}.", -** Processing line: ~ "** 1. Open Disk Utility and run First Aid.",~ -- Inside source: true -*** True Line Result - "** 1. Open Disk Utility and run First Aid.", -** Processing line: ~ { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") },~ -- Inside source: true -*** True Line Result - { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") }, -** Processing line: ~ )~ -- Inside source: true -*** True Line Result - ) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if valid_certs.length == 0~ -- Inside source: true -*** True Line Result - if valid_certs.length == 0 -** Processing line: ~ raise WizardException.new(~ -- Inside source: true -*** True Line Result - raise WizardException.new( -** Processing line: ~ "* It doesn't look like you have any valid certs installed.",~ -- Inside source: true -*** True Line Result - "* It doesn't look like you have any valid certs installed.", -** Processing line: ~ "** 1. Open Xcode.",~ -- Inside source: true -*** True Line Result - "** 1. Open Xcode.", -** Processing line: ~ "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.",~ -- Inside source: true -*** True Line Result - "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.", -** Processing line: ~ { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") },~ -- Inside source: true -*** True Line Result - { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") }, -** Processing line: ~ "** 3. After loggin in, select Manage Certificates...",~ -- Inside source: true -*** True Line Result - "** 3. After loggin in, select Manage Certificates...", -** Processing line: ~ { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") },~ -- Inside source: true -*** True Line Result - { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") }, -** Processing line: ~ "** 4. Add a certificate for Apple Development.",~ -- Inside source: true -*** True Line Result - "** 4. Add a certificate for Apple Development.", -** Processing line: ~ { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") },~ -- Inside source: true -*** True Line Result - { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") }, -** Processing line: ~ )~ -- Inside source: true -*** True Line Result - ) -** Processing line: ~ raise "You do not have any Apple development certs on this computer."~ -- Inside source: true -*** True Line Result - raise "You do not have any Apple development certs on this computer." -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ if @production_build~ - Inside source: true *** True Line Result if @production_build -** Processing line: ~ @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name]~ +** Processing line: ~ @certificate_name = ios_metadata[:prodcert]~ - Inside source: true *** True Line Result - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name] + @certificate_name = ios_metadata[:prodcert] ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name]~ +** Processing line: ~ @certificate_name = ios_metadata[:devcert]~ - Inside source: true *** True Line Result - @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name] + @certificate_name = ios_metadata[:devcert] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ log_info "I will be using Certificate: '#{@certificate_name}'."~ +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ log_info "I will be using certificate: '#{@certificate_name}'."~ - Inside source: true *** True Line Result - log_info "I will be using Certificate: '#{@certificate_name}'." + log_info "I will be using certificate: '#{@certificate_name}'." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -158803,78 +174006,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def valid_certs~ -- Inside source: true -*** True Line Result - def valid_certs -** Processing line: ~ certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l|~ -- Inside source: true -*** True Line Result - certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l| -** Processing line: ~ if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution"))~ -- Inside source: true -*** True Line Result - if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution")) -** Processing line: ~ l.strip~ -- Inside source: true -*** True Line Result - l.strip -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ nil~ -- Inside source: true -*** True Line Result - nil -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end.reject_nil.map do |l|~ -- Inside source: true -*** True Line Result - end.reject_nil.map do |l| -** Processing line: ~ number, id, name = l.split(' ', 3)~ -- Inside source: true -*** True Line Result - number, id, name = l.split(' ', 3) -** Processing line: ~ name = name.gsub("\"", "") if name~ -- Inside source: true -*** True Line Result - name = name.gsub("\"", "") if name -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ number: 1,~ -- Inside source: true -*** True Line Result - number: 1, -** Processing line: ~ id: id,~ -- Inside source: true -*** True Line Result - id: id, -** Processing line: ~ name: name~ -- Inside source: true -*** True Line Result - name: name -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def connected_devices~ - Inside source: true *** True Line Result @@ -159039,10 +174170,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_name}.#{@app_id}").strip~ +** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip~ - Inside source: true *** True Line Result - $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_name}.#{@app_id}").strip + $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip +** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.txt", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip~ +- Inside source: true +*** True Line Result + $gtk.write_file_root "tmp/ios/Entitlements.txt", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip ** Processing line: ~~ - Inside source: true *** True Line Result @@ -159191,10 +174326,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleInfoDictionaryVersion</key> -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>6.0</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundlePackageType</key>~ - Inside source: true *** True Line Result @@ -159207,10 +174342,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleShortVersionString</key> -** Processing line: ~ <string>5.6</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.6</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleSignature</key>~ - Inside source: true *** True Line Result @@ -159223,10 +174358,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleVersion</key> -** Processing line: ~ <string>5.6</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.6</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleIcons</key>~ - Inside source: true *** True Line Result @@ -159819,10 +174954,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleInfoDictionaryVersion</key> -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>6.0</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleName</key>~ - Inside source: true *** True Line Result @@ -159843,10 +174978,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleShortVersionString</key> -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.2</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleSignature</key>~ - Inside source: true *** True Line Result @@ -159875,10 +175010,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleVersion</key> -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.2</string> + <string>:app_version</string> ** Processing line: ~ <key>DTCompiler</key>~ - Inside source: true *** True Line Result @@ -160219,6 +175354,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip +** Processing line: ~ $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip~ +- Inside source: true +*** True Line Result + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip ** Processing line: ~~ - Inside source: true *** True Line Result @@ -160431,10 +175570,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleInfoDictionaryVersion</key> -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>6.0</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleName</key>~ - Inside source: true *** True Line Result @@ -160455,10 +175594,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleShortVersionString</key> -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.2</string> + <string>:app_version</string> ** Processing line: ~ <key>CFBundleSignature</key>~ - Inside source: true *** True Line Result @@ -160487,10 +175626,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result <key>CFBundleVersion</key> -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ - Inside source: true *** True Line Result - <string>5.2</string> + <string>:app_version</string> ** Processing line: ~ <key>DTCompiler</key>~ - Inside source: true *** True Line Result @@ -160823,6 +175962,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result info_plist_string.gsub!(":app_id", @app_id) +** Processing line: ~ info_plist_string.gsub!(":app_version", @app_version)~ +- Inside source: true +*** True Line Result + info_plist_string.gsub!(":app_version", @app_version) ** Processing line: ~~ - Inside source: true *** True Line Result @@ -160831,6 +175974,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip +** Processing line: ~ $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip~ +- Inside source: true +*** True Line Result + $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip ** Processing line: ~~ - Inside source: true *** True Line Result @@ -160915,14 +176062,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def write_ip_address~ +** Processing line: ~ def embed_mobileprovision~ - Inside source: true *** True Line Result - def write_ip_address -** Processing line: ~ $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip~ + def embed_mobileprovision +** Processing line: ~ sh %Q[cp #{@provisioning_profile_path} "#{app_path}/embedded.mobileprovision"]~ - Inside source: true *** True Line Result - $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip + sh %Q[cp #{@provisioning_profile_path} "#{app_path}/embedded.mobileprovision"] +** Processing line: ~ sh %Q[/usr/bin/plutil -convert binary1 "#{app_path}/Info.plist"]~ +- Inside source: true +*** True Line Result + sh %Q[/usr/bin/plutil -convert binary1 "#{app_path}/Info.plist"] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -160931,78 +176082,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def create_payload_directory~ +** Processing line: ~ def clear_payload_directory~ - Inside source: true *** True Line Result - def create_payload_directory -** Processing line: ~ sh "cp #{@provisioning_profile_path} \"#{app_path}/embedded.mobileprovision\""~ + def clear_payload_directory +** Processing line: ~ sh %Q[rm "#{@app_name}".ipa]~ - Inside source: true *** True Line Result - sh "cp #{@provisioning_profile_path} \"#{app_path}/embedded.mobileprovision\"" -** Processing line: ~ sh "/usr/bin/plutil -convert binary1 \"#{app_path}/Info.plist\""~ + sh %Q[rm "#{@app_name}".ipa] +** Processing line: ~ sh %Q[rm -rf "#{app_path}/app"]~ - Inside source: true *** True Line Result - sh "/usr/bin/plutil -convert binary1 \"#{app_path}/Info.plist\"" -** Processing line: ~ write_ip_address~ + sh %Q[rm -rf "#{app_path}/app"] +** Processing line: ~ sh %Q[rm -rf "#{app_path}/sounds"]~ - Inside source: true *** True Line Result - write_ip_address -** Processing line: ~ sh "rm \"#{@app_name}\".ipa"~ + sh %Q[rm -rf "#{app_path}/sounds"] +** Processing line: ~ sh %Q[rm -rf "#{app_path}/sprites"]~ - Inside source: true *** True Line Result - sh "rm \"#{@app_name}\".ipa" -** Processing line: ~ sh "rm -rf \"#{app_path}/app\""~ + sh %Q[rm -rf "#{app_path}/sprites"] +** Processing line: ~ sh %Q[rm -rf "#{app_path}/data"]~ - Inside source: true *** True Line Result - sh "rm -rf \"#{app_path}/app\"" -** Processing line: ~ sh "rm -rf \"#{app_path}/sounds\""~ + sh %Q[rm -rf "#{app_path}/data"] +** Processing line: ~ sh %Q[rm -rf "#{app_path}/fonts"]~ - Inside source: true *** True Line Result - sh "rm -rf \"#{app_path}/sounds\"" -** Processing line: ~ sh "rm -rf \"#{app_path}/sprites\""~ + sh %Q[rm -rf "#{app_path}/fonts"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - sh "rm -rf \"#{app_path}/sprites\"" -** Processing line: ~ sh "rm -rf \"#{app_path}/data\""~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - sh "rm -rf \"#{app_path}/data\"" -** Processing line: ~ sh "rm -rf \"#{app_path}/fonts\""~ + +** Processing line: ~ def stage_app~ - Inside source: true *** True Line Result - sh "rm -rf \"#{app_path}/fonts\"" -** Processing line: ~ sh "cp -r \"#{root_folder}/app/\" \"#{app_path}/app/\""~ + def stage_app +** Processing line: ~ log_info "Staging."~ - Inside source: true *** True Line Result - sh "cp -r \"#{root_folder}/app/\" \"#{app_path}/app/\"" -** Processing line: ~ sh "cp -r \"#{root_folder}/sounds/\" \"#{app_path}/sounds/\""~ + log_info "Staging." +** Processing line: ~ sh "mkdir -p #{tmp_directory}"~ - Inside source: true *** True Line Result - sh "cp -r \"#{root_folder}/sounds/\" \"#{app_path}/sounds/\"" -** Processing line: ~ sh "cp -r \"#{root_folder}/sprites/\" \"#{app_path}/sprites/\""~ + sh "mkdir -p #{tmp_directory}" +** Processing line: ~ sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""~ - Inside source: true *** True Line Result - sh "cp -r \"#{root_folder}/sprites/\" \"#{app_path}/sprites/\"" -** Processing line: ~ sh "cp -r \"#{root_folder}/data/\" \"#{app_path}/data/\""~ + sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\"" +** Processing line: ~ sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"]~ - Inside source: true *** True Line Result - sh "cp -r \"#{root_folder}/data/\" \"#{app_path}/data/\"" -** Processing line: ~ sh "cp -r \"#{root_folder}/fonts/\" \"#{app_path}/fonts/\""~ + sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"] +** Processing line: ~ sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"]~ - Inside source: true *** True Line Result - sh "cp -r \"#{root_folder}/fonts/\" \"#{app_path}/fonts/\"" -** Processing line: ~ sh "mkdir -p #{tmp_directory}/ipa_root/Payload"~ + sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"] +** Processing line: ~ sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"]~ - Inside source: true *** True Line Result - sh "mkdir -p #{tmp_directory}/ipa_root/Payload" -** Processing line: ~ sh "cp -r \"#{app_path}\" \"#{tmp_directory}/ipa_root/Payload\""~ + sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"] +** Processing line: ~ sh %Q[cp -r "#{root_folder}/data/" "#{app_path}/data/"]~ - Inside source: true *** True Line Result - sh "cp -r \"#{app_path}\" \"#{tmp_directory}/ipa_root/Payload\"" -** Processing line: ~ sh "chmod -R 755 \"#{tmp_directory}/ipa_root/Payload\""~ + sh %Q[cp -r "#{root_folder}/data/" "#{app_path}/data/"] +** Processing line: ~ sh %Q[cp -r "#{root_folder}/fonts/" "#{app_path}/fonts/"]~ - Inside source: true *** True Line Result - sh "chmod -R 755 \"#{tmp_directory}/ipa_root/Payload\"" + sh %Q[cp -r "#{root_folder}/fonts/" "#{app_path}/fonts/"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def create_payload~ +- Inside source: true +*** True Line Result + def create_payload +** Processing line: ~ sh %Q[mkdir -p #{tmp_directory}/ipa_root/Payload]~ +- Inside source: true +*** True Line Result + sh %Q[mkdir -p #{tmp_directory}/ipa_root/Payload] +** Processing line: ~ sh %Q[cp -r "#{app_path}" "#{tmp_directory}/ipa_root/Payload"]~ +- Inside source: true +*** True Line Result + sh %Q[cp -r "#{app_path}" "#{tmp_directory}/ipa_root/Payload"] +** Processing line: ~ sh %Q[chmod -R 755 "#{tmp_directory}/ipa_root/Payload"]~ +- Inside source: true +*** True Line Result + sh %Q[chmod -R 755 "#{tmp_directory}/ipa_root/Payload"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def create_payload_directory_dev~ +- Inside source: true +*** True Line Result + def create_payload_directory_dev +** Processing line: ~ # write dev machine's ip address for hotloading~ +- Inside source: true +*** True Line Result + # write dev machine's ip address for hotloading +** Processing line: ~ $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip~ +- Inside source: true +*** True Line Result + $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ embed_mobileprovision~ +- Inside source: true +*** True Line Result + embed_mobileprovision +** Processing line: ~ clear_payload_directory~ +- Inside source: true +*** True Line Result + clear_payload_directory +** Processing line: ~ stage_app~ +- Inside source: true +*** True Line Result + stage_app +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def create_payload_directory_prod~ +- Inside source: true +*** True Line Result + def create_payload_directory_prod +** Processing line: ~ # production builds does not hotload ip address~ +- Inside source: true +*** True Line Result + # production builds does not hotload ip address +** Processing line: ~ sh %Q[rm "#{root_folder}/app/server_ip_address.txt"]~ +- Inside source: true +*** True Line Result + sh %Q[rm "#{root_folder}/app/server_ip_address.txt"] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ embed_mobileprovision~ +- Inside source: true +*** True Line Result + embed_mobileprovision +** Processing line: ~ stage_app~ +- Inside source: true +*** True Line Result + stage_app +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # production build marker~ +- Inside source: true +*** True Line Result + # production build marker +** Processing line: ~ sh %Q[mkdir -p "#{app_path}/metadata/"]~ +- Inside source: true +*** True Line Result + sh %Q[mkdir -p "#{app_path}/metadata/"] +** Processing line: ~ sh %Q[touch metadata/DRAGONRUBY_PRODUCTION_BUILD]~ +- Inside source: true +*** True Line Result + sh %Q[touch metadata/DRAGONRUBY_PRODUCTION_BUILD] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -161131,22 +176390,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def print_publish_help -** Processing line: ~ log_info "Go to https://appstoreconnect.apple.com/apps and create an App if you haven't already done so."~ +** Processing line: ~ has_transporter = (sh "ls /Applications/Transporter.app").include? "Contents"~ +- Inside source: true +*** True Line Result + has_transporter = (sh "ls /Applications/Transporter.app").include? "Contents" +** Processing line: ~ if !has_transporter~ +- Inside source: true +*** True Line Result + if !has_transporter +** Processing line: ~ $gtk.openurl "https://apps.apple.com/us/app/transporter/id1450874784?mt=12"~ +- Inside source: true +*** True Line Result + $gtk.openurl "https://apps.apple.com/us/app/transporter/id1450874784?mt=12" +** Processing line: ~ $console.set_command "$wizards.ios.start env: :#{@opts[:env]}, version: \"#{@opts[:version]}\""~ +- Inside source: true +*** True Line Result + $console.set_command "$wizards.ios.start env: :#{@opts[:env]}, version: \"#{@opts[:version]}\"" +** Processing line: ~ raise WizardException.new(~ +- Inside source: true +*** True Line Result + raise WizardException.new( +** Processing line: ~ "* To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12."~ +- Inside source: true +*** True Line Result + "* To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." +** Processing line: ~ )~ +- Inside source: true +*** True Line Result + ) +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ sh "mkdir ./tmp/ios/intermediary_artifacts"~ +- Inside source: true +*** True Line Result + sh "mkdir ./tmp/ios/intermediary_artifacts" +** Processing line: ~ sh "mv \"#{tmp_directory}/#{@app_name}.app\" #{tmp_directory}/intermediary_artifacts/"~ +- Inside source: true +*** True Line Result + sh "mv \"#{tmp_directory}/#{@app_name}.app\" #{tmp_directory}/intermediary_artifacts/" +** Processing line: ~ sh "mv \"#{tmp_directory}/do_zip.sh\" #{tmp_directory}/intermediary_artifacts"~ - Inside source: true *** True Line Result - log_info "Go to https://appstoreconnect.apple.com/apps and create an App if you haven't already done so." -** Processing line: ~ log_info "Go to https://appleid.apple.com and create a 'Application Specific Password'."~ + sh "mv \"#{tmp_directory}/do_zip.sh\" #{tmp_directory}/intermediary_artifacts" +** Processing line: ~ sh "mv \"#{tmp_directory}/Entitlements.plist\" #{tmp_directory}/intermediary_artifacts"~ - Inside source: true *** True Line Result - log_info "Go to https://appleid.apple.com and create a 'Application Specific Password'." -** Processing line: ~ log_info "To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12."~ + sh "mv \"#{tmp_directory}/Entitlements.plist\" #{tmp_directory}/intermediary_artifacts" +** Processing line: ~ sh "mv \"#{tmp_directory}/ipa_root\" #{tmp_directory}/intermediary_artifacts/"~ - Inside source: true *** True Line Result - log_info "To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12." -** Processing line: ~ log_info "Your app is located at ./tmp/ios/#{@app_name}.ipa"~ + sh "mv \"#{tmp_directory}/ipa_root\" #{tmp_directory}/intermediary_artifacts/" +** Processing line: ~ sh "open /Applications/Transporter.app"~ - Inside source: true *** True Line Result - log_info "Your app is located at ./tmp/ios/#{@app_name}.ipa" + sh "open /Applications/Transporter.app" +** Processing line: ~ sh "open ./tmp/ios/"~ +- Inside source: true +*** True Line Result + sh "open ./tmp/ios/" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -161227,78 +176534,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~*** itch_wizard.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -*** itch_wizard.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # ./dragon/itch_wizard.rb~ +** Processing line: ~ def set_version version~ - Inside source: true *** True Line Result - # ./dragon/itch_wizard.rb -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + def set_version version +** Processing line: ~ @app_version = version~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + @app_version = version +** Processing line: ~ start env: @opts[:env], version: version~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # itch_wizard.rb has been released under MIT (*only this file*).~ + start env: @opts[:env], version: version +** Processing line: ~ end~ - Inside source: true *** True Line Result - # itch_wizard.rb has been released under MIT (*only this file*). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class ItchWizard~ +** Processing line: ~ def app_version~ - Inside source: true *** True Line Result - class ItchWizard -** Processing line: ~ def steps~ + def app_version +** Processing line: ~ log_info "Attempting to retrieve App Version from metadata/ios_metadata.txt."~ - Inside source: true *** True Line Result - def steps -** Processing line: ~ [~ + log_info "Attempting to retrieve App Version from metadata/ios_metadata.txt." +** Processing line: ~ ios_version_number = (ios_metadata.version || "").strip~ - Inside source: true *** True Line Result - [ -** Processing line: ~ :check_metadata,~ + ios_version_number = (ios_metadata.version || "").strip +** Processing line: ~ if ios_version_number.length == 0~ - Inside source: true *** True Line Result - :check_metadata, -** Processing line: ~ :deploy~ + if ios_version_number.length == 0 +** Processing line: ~ log_info "Not found. Attempting to retrieve App Version from metadata/game_metadata.txt."~ - Inside source: true *** True Line Result - :deploy -** Processing line: ~ ]~ + log_info "Not found. Attempting to retrieve App Version from metadata/game_metadata.txt." +** Processing line: ~ ios_version_number = (game_metadata.version || "").strip~ - Inside source: true *** True Line Result - ] + ios_version_number = (game_metadata.version || "").strip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ ios_version_number~ +- Inside source: true +*** True Line Result + ios_version_number ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -161307,94 +176598,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def metadata_file_path~ +** Processing line: ~ def determine_app_version~ - Inside source: true *** True Line Result - def metadata_file_path -** Processing line: ~ "metadata/game_metadata.txt"~ + def determine_app_version +** Processing line: ~ @app_version = app_version~ - Inside source: true *** True Line Result - "metadata/game_metadata.txt" + @app_version = app_version +** Processing line: ~ return if @app_version~ +- Inside source: true +*** True Line Result + return if @app_version ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def get_metadata~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def get_metadata -** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - metadata = $gtk.read_file metadata_file_path +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if !metadata~ -- Inside source: true +** Processing line: ~*** itch_wizard.rb~ +- Header detected. *** True Line Result - if !metadata -** Processing line: ~ write_blank_metadata~ -- Inside source: true + *** True Line Result - write_blank_metadata -** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ -- Inside source: true +*** itch_wizard.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - metadata = $gtk.read_file metadata_file_path -** Processing line: ~ end~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/itch_wizard.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./dragon/itch_wizard.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - -** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a -** Processing line: ~~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - -** Processing line: ~ {~ + # MIT License +** Processing line: ~ # itch_wizard.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - { -** Processing line: ~ dev_id: dev_id.strip,~ + # itch_wizard.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - dev_id: dev_id.strip, -** Processing line: ~ dev_title: dev_title.strip,~ + +** Processing line: ~ class ItchWizard < Wizard~ - Inside source: true *** True Line Result - dev_title: dev_title.strip, -** Processing line: ~ game_id: game_id.strip,~ + class ItchWizard < Wizard +** Processing line: ~ def steps~ - Inside source: true *** True Line Result - game_id: game_id.strip, -** Processing line: ~ game_title: game_title.strip,~ + def steps +** Processing line: ~ [~ - Inside source: true *** True Line Result - game_title: game_title.strip, -** Processing line: ~ version: version.strip,~ + [ +** Processing line: ~ :check_metadata,~ - Inside source: true *** True Line Result - version: version.strip, -** Processing line: ~ icon: icon.strip~ + :check_metadata, +** Processing line: ~ :deploy,~ - Inside source: true *** True Line Result - icon: icon.strip -** Processing line: ~ }~ + :deploy, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - } + ] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -161471,10 +176766,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if metadata_text.each_line.to_a.length != 6~ +** Processing line: ~ if metadata_text.strip.each_line.to_a.length < 6~ - Inside source: true *** True Line Result - if metadata_text.each_line.to_a.length != 6 + if metadata_text.strip.each_line.to_a.length < 6 ** Processing line: ~ write_blank_metadata~ - Inside source: true *** True Line Result @@ -161519,10 +176814,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide your username for Itch." -** Processing line: ~ $console.set_command "$wizards.itch.set_dev_id \"your-itch-username\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_dev_id \"#{metadata[:dev_id]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_dev_id \"your-itch-username\"" + $console.set_command "$wizards.itch.set_dev_id \"#{metadata[:dev_id]}\"" ** Processing line: ~ return :need_dev_id~ - Inside source: true *** True Line Result @@ -161543,10 +176838,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide developer's/company's name that you want displayed." -** Processing line: ~ $console.set_command "$wizards.itch.set_dev_title \"Your Name\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_dev_title \"#{metadata[:dev_title]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_dev_title \"Your Name\"" + $console.set_command "$wizards.itch.set_dev_title \"#{metadata[:dev_title]}\"" ** Processing line: ~ return :need_dev_title~ - Inside source: true *** True Line Result @@ -161567,10 +176862,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide the id for you game. This is the id you specified when you set up a new game page on Itch." -** Processing line: ~ $console.set_command "$wizards.itch.set_game_id \"your-game-id\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_game_id \"#{metadata[:game_id]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_game_id \"your-game-id\"" + $console.set_command "$wizards.itch.set_game_id \"#{metadata[:game_id]}\"" ** Processing line: ~ return :need_game_id~ - Inside source: true *** True Line Result @@ -161591,10 +176886,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide the display name for your game. (This can include spaces)" -** Processing line: ~ $console.set_command "$wizards.itch.set_game_title \"Your Game\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_game_title \"#{metadata[:game_title]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_game_title \"Your Game\"" + $console.set_command "$wizards.itch.set_game_title \"#{metadata[:game_title]}\"" ** Processing line: ~ return :need_game_title~ - Inside source: true *** True Line Result @@ -161615,10 +176910,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide the version for your game." -** Processing line: ~ $console.set_command "$wizards.itch.set_version \"1.0\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_version \"#{metadata[:version]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_version \"1.0\"" + $console.set_command "$wizards.itch.set_version \"#{metadata[:version]}\"" ** Processing line: ~ return :need_version~ - Inside source: true *** True Line Result @@ -161639,10 +176934,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "* PROMPT: Please provide icon path for your game." -** Processing line: ~ $console.set_command "$wizards.itch.set_icon \"icon.png\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_icon \"#{metadata[:icon]}\""~ - Inside source: true *** True Line Result - $console.set_command "$wizards.itch.set_icon \"icon.png\"" + $console.set_command "$wizards.itch.set_icon \"#{metadata[:icon]}\"" ** Processing line: ~ return :need_icon~ - Inside source: true *** True Line Result @@ -161655,6 +176950,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ puts "here!! success!!!"~ +- Inside source: true +*** True Line Result + puts "here!! success!!!" +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ return :success~ - Inside source: true *** True Line Result @@ -161675,10 +176978,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @dev_id = value -** Processing line: ~ write_metadata~ -- Inside source: true -*** True Line Result - write_metadata ** Processing line: ~ start~ - Inside source: true *** True Line Result @@ -161699,10 +176998,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @dev_title = value -** Processing line: ~ write_metadata~ -- Inside source: true -*** True Line Result - write_metadata ** Processing line: ~ start~ - Inside source: true *** True Line Result @@ -161723,10 +177018,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @game_id = value -** Processing line: ~ write_metadata~ -- Inside source: true -*** True Line Result - write_metadata ** Processing line: ~ start~ - Inside source: true *** True Line Result @@ -161747,10 +177038,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @game_title = value -** Processing line: ~ write_metadata~ -- Inside source: true -*** True Line Result - write_metadata ** Processing line: ~ start~ - Inside source: true *** True Line Result @@ -161771,10 +177058,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @version = value -** Processing line: ~ write_metadata~ -- Inside source: true -*** True Line Result - write_metadata ** Processing line: ~ start~ - Inside source: true *** True Line Result @@ -161943,10 +177226,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result if @icon -** Processing line: ~ text += "icon=metadata/#{@icon}\n"~ +** Processing line: ~ text += "icon=#{@icon}\n"~ - Inside source: true *** True Line Result - text += "icon=metadata/#{@icon}\n" + text += "icon=#{@icon}\n" ** Processing line: ~ else~ - Inside source: true *** True Line Result @@ -162015,10 +177298,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log_info "* Running dragonruby-publish: #{package_command}" -** Processing line: ~ results = $gtk.exec package_command~ +** Processing line: ~ $gtk.openurl "http://itch.io/dashboard" if $gtk.platform == "Mac OS X"~ +- Inside source: true +*** True Line Result + $gtk.openurl "http://itch.io/dashboard" if $gtk.platform == "Mac OS X" +** Processing line: ~ if $gtk.platform? :mac~ +- Inside source: true +*** True Line Result + if $gtk.platform? :mac +** Processing line: ~ $gtk.exec "rm -rf ./builds"~ - Inside source: true *** True Line Result - results = $gtk.exec package_command + $gtk.exec "rm -rf ./builds" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ results = $gtk.exec "#{package_command} --only-package"~ +- Inside source: true +*** True Line Result + results = $gtk.exec "#{package_command} --only-package" +** Processing line: ~ puts File.expand_path("./builds")~ +- Inside source: true +*** True Line Result + puts File.expand_path("./builds") +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ log "#+begin_src"~ - Inside source: true *** True Line Result @@ -162031,6 +177338,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "#+end_src" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if $gtk.platform? :mac~ +- Inside source: true +*** True Line Result + if $gtk.platform? :mac +** Processing line: ~ $gtk.exec "open ./builds/"~ +- Inside source: true +*** True Line Result + $gtk.exec "open ./builds/" +** Processing line: ~ elsif $gtk.platform? :windows~ +- Inside source: true +*** True Line Result + elsif $gtk.platform? :windows +** Processing line: ~ $gtk.exec "powershell \"ii .\""~ +- Inside source: true +*** True Line Result + $gtk.exec "powershell \"ii .\"" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $gtk.openurl "https://itch.io/dashboard"~ +- Inside source: true +*** True Line Result + $gtk.openurl "https://itch.io/dashboard" +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ :success~ - Inside source: true *** True Line Result @@ -162071,10 +177414,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log_info "Running Itch Wizard Step: ~$wizards.itch.#{m}~" -** Processing line: ~ result = (send m) || :success if @wizard_status[m][:result] != :success~ +** Processing line: ~ result = (send m) || :success~ - Inside source: true *** True Line Result - result = (send m) || :success if @wizard_status[m][:result] != :success + result = (send m) || :success ** Processing line: ~ @wizard_status[m][:result] = result~ - Inside source: true *** True Line Result @@ -162359,6 +177702,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/layout.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -163471,6 +178818,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def row_max_index~ +- Inside source: true +*** True Line Result + def row_max_index +** Processing line: ~ row_count - 1~ +- Inside source: true +*** True Line Result + row_count - 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def col_count~ - Inside source: true *** True Line Result @@ -163487,6 +178850,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def col_max_index~ +- Inside source: true +*** True Line Result + def col_max_index +** Processing line: ~ col_count - 1~ +- Inside source: true +*** True Line Result + col_count - 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def gutter_height~ - Inside source: true *** True Line Result @@ -163575,34 +178954,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result { -** Processing line: ~ row: nil,~ +** Processing line: ~ row: nil,~ +- Inside source: true +*** True Line Result + row: nil, +** Processing line: ~ col: nil,~ +- Inside source: true +*** True Line Result + col: nil, +** Processing line: ~ h: 1,~ - Inside source: true *** True Line Result - row: nil, -** Processing line: ~ col: nil,~ + h: 1, +** Processing line: ~ w: 1,~ - Inside source: true *** True Line Result - col: nil, -** Processing line: ~ h: 1,~ + w: 1, +** Processing line: ~ dx: 0,~ - Inside source: true *** True Line Result - h: 1, -** Processing line: ~ w: 1,~ + dx: 0, +** Processing line: ~ dx_ratio: 1,~ - Inside source: true *** True Line Result - w: 1, -** Processing line: ~ dx: 0,~ + dx_ratio: 1, +** Processing line: ~ dy: 0,~ - Inside source: true *** True Line Result - dx: 0, -** Processing line: ~ dy: 0,~ + dy: 0, +** Processing line: ~ dy_ratio: 1,~ - Inside source: true *** True Line Result - dy: 0, -** Processing line: ~ rect: :control_rect~ + dy_ratio: 1, +** Processing line: ~ dh_ratio: 1,~ - Inside source: true *** True Line Result - rect: :control_rect + dh_ratio: 1, +** Processing line: ~ dw_ratio: 1,~ +- Inside source: true +*** True Line Result + dw_ratio: 1, +** Processing line: ~ merge: nil,~ +- Inside source: true +*** True Line Result + merge: nil, +** Processing line: ~ rect: :control_rect~ +- Inside source: true +*** True Line Result + rect: :control_rect ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -163615,14 +179014,418 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def rect opts~ +** Processing line: ~ def row n~ - Inside source: true *** True Line Result - def rect opts + def row n +** Processing line: ~ (rect row: n, col: 0, w: 0, h: 0).x~ +- Inside source: true +*** True Line Result + (rect row: n, col: 0, w: 0, h: 0).x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def row_from_bottom n~ +- Inside source: true +*** True Line Result + def row_from_bottom n +** Processing line: ~ (rect row: row_count - n, col: 0, w: 0, h: 0).x~ +- Inside source: true +*** True Line Result + (rect row: row_count - n, col: 0, w: 0, h: 0).x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def col n~ +- Inside source: true +*** True Line Result + def col n +** Processing line: ~ (rect row: 0, col: n, w: 0, h: 0).y~ +- Inside source: true +*** True Line Result + (rect row: 0, col: n, w: 0, h: 0).y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def col_from_right n~ +- Inside source: true +*** True Line Result + def col_from_right n +** Processing line: ~ (rect row: 0, col: col_max_index - n, w: 0, h: 0).y~ +- Inside source: true +*** True Line Result + (rect row: 0, col: col_max_index - n, w: 0, h: 0).y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def w n~ +- Inside source: true +*** True Line Result + def w n +** Processing line: ~ (rect row: 0, col: 0, w: n, h: 1).w~ +- Inside source: true +*** True Line Result + (rect row: 0, col: 0, w: n, h: 1).w +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def h n~ +- Inside source: true +*** True Line Result + def h n +** Processing line: ~ (rect row: 0, col: 0, w: 1, h: n).h~ +- Inside source: true +*** True Line Result + (rect row: 0, col: 0, w: 1, h: n).h +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def rect_group opts~ +- Inside source: true +*** True Line Result + def rect_group opts +** Processing line: ~ group = opts.group~ +- Inside source: true +*** True Line Result + group = opts.group +** Processing line: ~ r = opts.row || 0~ +- Inside source: true +*** True Line Result + r = opts.row || 0 +** Processing line: ~ r = row_max_index - opts.row_from_bottom if opts.row_from_bottom~ +- Inside source: true +*** True Line Result + r = row_max_index - opts.row_from_bottom if opts.row_from_bottom +** Processing line: ~ c = opts.col || 0~ +- Inside source: true +*** True Line Result + c = opts.col || 0 +** Processing line: ~ c = col_max_index - opts.col_from_right if opts.col_from_right~ +- Inside source: true +*** True Line Result + c = col_max_index - opts.col_from_right if opts.col_from_right +** Processing line: ~ drow = opts.drow || 0~ +- Inside source: true +*** True Line Result + drow = opts.drow || 0 +** Processing line: ~ dcol = opts.dcol || 0~ +- Inside source: true +*** True Line Result + dcol = opts.dcol || 0 +** Processing line: ~ w = opts.w || 0~ +- Inside source: true +*** True Line Result + w = opts.w || 0 +** Processing line: ~ h = opts.h || 0~ +- Inside source: true +*** True Line Result + h = opts.h || 0 +** Processing line: ~ merge = opts[:merge]~ +- Inside source: true +*** True Line Result + merge = opts[:merge] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ running_row = r~ +- Inside source: true +*** True Line Result + running_row = r +** Processing line: ~ running_col = c~ +- Inside source: true +*** True Line Result + running_col = c +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ running_col = calc_col_offset(opts.col_offset) if opts.col_offset~ +- Inside source: true +*** True Line Result + running_col = calc_col_offset(opts.col_offset) if opts.col_offset +** Processing line: ~ running_row = calc_row_offset(opts.row_offset) if opts.row_offset~ +- Inside source: true +*** True Line Result + running_row = calc_row_offset(opts.row_offset) if opts.row_offset +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ group.map do |i|~ +- Inside source: true +*** True Line Result + group.map do |i| +** Processing line: ~ group_layout_opts = i.layout || {}~ +- Inside source: true +*** True Line Result + group_layout_opts = i.layout || {} +** Processing line: ~ group_layout_opts = group_layout_opts.merge row: running_row,~ +- Inside source: true +*** True Line Result + group_layout_opts = group_layout_opts.merge row: running_row, +** Processing line: ~ col: running_col,~ +- Inside source: true +*** True Line Result + col: running_col, +** Processing line: ~ merge: merge,~ +- Inside source: true +*** True Line Result + merge: merge, +** Processing line: ~ w: w, h: h~ +- Inside source: true +*** True Line Result + w: w, h: h +** Processing line: ~ result = (rect group_layout_opts).merge i~ +- Inside source: true +*** True Line Result + result = (rect group_layout_opts).merge i +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if (i.is_a? Hash) && (i.primitive_marker == :label)~ +- Inside source: true +*** True Line Result + if (i.is_a? Hash) && (i.primitive_marker == :label) +** Processing line: ~ if i.alignment_enum == 1~ +- Inside source: true +*** True Line Result + if i.alignment_enum == 1 +** Processing line: ~ result.x += result.w.half~ +- Inside source: true +*** True Line Result + result.x += result.w.half +** Processing line: ~ elsif i.alignment_enum == 2~ +- Inside source: true +*** True Line Result + elsif i.alignment_enum == 2 +** Processing line: ~ result.x += result.w~ +- Inside source: true +*** True Line Result + result.x += result.w +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ running_row += drow~ +- Inside source: true +*** True Line Result + running_row += drow +** Processing line: ~ running_col += dcol~ +- Inside source: true +*** True Line Result + running_col += dcol +** Processing line: ~ result~ +- Inside source: true +*** True Line Result + result +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_row_offset opts = {}~ +- Inside source: true +*** True Line Result + def calc_row_offset opts = {} +** Processing line: ~ count = opts[:count] || opts[:length] || 0~ +- Inside source: true +*** True Line Result + count = opts[:count] || opts[:length] || 0 +** Processing line: ~ h = opts.h || 1~ +- Inside source: true +*** True Line Result + h = opts.h || 1 +** Processing line: ~ (row_count - (count * h)) / 2.0~ +- Inside source: true +*** True Line Result + (row_count - (count * h)) / 2.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def calc_col_offset opts = {}~ +- Inside source: true +*** True Line Result + def calc_col_offset opts = {} +** Processing line: ~ count = opts[:count] || opts[:length] || 0~ +- Inside source: true +*** True Line Result + count = opts[:count] || opts[:length] || 0 +** Processing line: ~ w = opts.w || 1~ +- Inside source: true +*** True Line Result + w = opts.w || 1 +** Processing line: ~ (col_count - (count * w)) / 2.0~ +- Inside source: true +*** True Line Result + (col_count - (count * w)) / 2.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def point opts = {}~ +- Inside source: true +*** True Line Result + def point opts = {} +** Processing line: ~ opts.w = 1~ +- Inside source: true +*** True Line Result + opts.w = 1 +** Processing line: ~ opts.h = 1~ +- Inside source: true +*** True Line Result + opts.h = 1 +** Processing line: ~ opts.row ||= 0~ +- Inside source: true +*** True Line Result + opts.row ||= 0 +** Processing line: ~ opts.col ||= 0~ +- Inside source: true +*** True Line Result + opts.col ||= 0 +** Processing line: ~ r = rect opts~ +- Inside source: true +*** True Line Result + r = rect opts +** Processing line: ~ r.x += r.w * opts.col_anchor if opts.col_anchor~ +- Inside source: true +*** True Line Result + r.x += r.w * opts.col_anchor if opts.col_anchor +** Processing line: ~ r.y += r.h * opts.row_anchor if opts.row_anchor~ +- Inside source: true +*** True Line Result + r.y += r.h * opts.row_anchor if opts.row_anchor +** Processing line: ~ r~ +- Inside source: true +*** True Line Result + r +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def rect *all_opts~ +- Inside source: true +*** True Line Result + def rect *all_opts +** Processing line: ~ if all_opts.length == 1~ +- Inside source: true +*** True Line Result + if all_opts.length == 1 +** Processing line: ~ opts = all_opts.first~ +- Inside source: true +*** True Line Result + opts = all_opts.first +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ opts = {}~ +- Inside source: true +*** True Line Result + opts = {} +** Processing line: ~ all_opts.each do |o|~ +- Inside source: true +*** True Line Result + all_opts.each do |o| +** Processing line: ~ opts.merge! o~ +- Inside source: true +*** True Line Result + opts.merge! o +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ opts.row = row_max_index - opts.row_from_bottom if opts.row_from_bottom~ +- Inside source: true +*** True Line Result + opts.row = row_max_index - opts.row_from_bottom if opts.row_from_bottom +** Processing line: ~ opts.col = col_max_index - opts.col_from_right if opts.col_from_right~ +- Inside source: true +*** True Line Result + opts.col = col_max_index - opts.col_from_right if opts.col_from_right ** Processing line: ~ opts = rect_defaults.merge opts~ - Inside source: true *** True Line Result opts = rect_defaults.merge opts +** Processing line: ~ opts.row ||= 0~ +- Inside source: true +*** True Line Result + opts.row ||= 0 +** Processing line: ~ opts.col ||= 0~ +- Inside source: true +*** True Line Result + opts.col ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ result = send opts[:rect]~ - Inside source: true *** True Line Result @@ -163651,10 +179454,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result w: col.w, -** Processing line: ~ h: row.h~ +** Processing line: ~ h: row.h,~ - Inside source: true *** True Line Result - h: row.h + h: row.h, +** Processing line: ~ center_x: col.center_x,~ +- Inside source: true +*** True Line Result + center_x: col.center_x, +** Processing line: ~ center_y: row.center_y~ +- Inside source: true +*** True Line Result + center_y: row.center_y ** Processing line: ~ elsif opts[:row] && !opts[:col]~ - Inside source: true *** True Line Result @@ -163803,22 +179614,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ result[:x] += opts[:dx] if opts[:dx]~ +** Processing line: ~ result[:x] += opts[:dx] if opts[:dx]~ +- Inside source: true +*** True Line Result + result[:x] += opts[:dx] if opts[:dx] +** Processing line: ~ result[:x] *= opts[:dx_ratio] if opts[:dx_ratio]~ - Inside source: true *** True Line Result - result[:x] += opts[:dx] if opts[:dx] -** Processing line: ~ result[:y] += opts[:dy] if opts[:dy]~ + result[:x] *= opts[:dx_ratio] if opts[:dx_ratio] +** Processing line: ~ result[:y] += opts[:dy] if opts[:dy]~ - Inside source: true *** True Line Result - result[:y] += opts[:dy] if opts[:dy] -** Processing line: ~ result[:w] += opts[:dw] if opts[:dw]~ + result[:y] += opts[:dy] if opts[:dy] +** Processing line: ~ result[:y] *= opts[:dy_ratio] if opts[:dy_ratio]~ - Inside source: true *** True Line Result - result[:w] += opts[:dw] if opts[:dw] -** Processing line: ~ result[:h] += opts[:dh] if opts[:dh]~ + result[:y] *= opts[:dy_ratio] if opts[:dy_ratio] +** Processing line: ~ result[:w] += opts[:dw] if opts[:dw]~ - Inside source: true *** True Line Result - result[:h] += opts[:dh] if opts[:dh] + result[:w] += opts[:dw] if opts[:dw] +** Processing line: ~ result[:w] *= opts[:dw_ratio] if opts[:dw_ratio]~ +- Inside source: true +*** True Line Result + result[:w] *= opts[:dw_ratio] if opts[:dw_ratio] +** Processing line: ~ result[:h] += opts[:dh] if opts[:dh]~ +- Inside source: true +*** True Line Result + result[:h] += opts[:dh] if opts[:dh] +** Processing line: ~ result[:h] *= opts[:dh_ratio] if opts[:dh_ratio]~ +- Inside source: true +*** True Line Result + result[:h] *= opts[:dh_ratio] if opts[:dh_ratio] +** Processing line: ~ result.merge! opts[:merge] if opts[:merge]~ +- Inside source: true +*** True Line Result + result.merge! opts[:merge] if opts[:merge] ** Processing line: ~ result[:row] = opts[:row]~ - Inside source: true *** True Line Result @@ -163831,6 +179662,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ result[:h] = result[:h].clamp 0~ +- Inside source: true +*** True Line Result + result[:h] = result[:h].clamp 0 +** Processing line: ~ result[:w] = result[:w].clamp 0~ +- Inside source: true +*** True Line Result + result[:w] = result[:w].clamp 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ if $gtk.args.grid.name == :center~ - Inside source: true *** True Line Result @@ -163967,10 +179810,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ result = control_rect.merge y: row_y, h: row_h~ +** Processing line: ~ result = control_rect.merge y: row_y, h: row_h, center_y: (row_y + row_h.half)~ - Inside source: true *** True Line Result - result = control_rect.merge y: row_y, h: row_h + result = control_rect.merge y: row_y, h: row_h, center_y: (row_y + row_h.half) ** Processing line: ~ @rect_cache[:row][index][h] = result~ - Inside source: true *** True Line Result @@ -164059,10 +179902,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ result = control_rect.merge x: col_x, w: col_w~ +** Processing line: ~ result = control_rect.merge x: col_x, w: col_w, center_x: (col_x + col_w.half)~ - Inside source: true *** True Line Result - result = control_rect.merge x: col_x, w: col_w + result = control_rect.merge x: col_x, w: col_w, center_x: (col_x + col_w.half) ** Processing line: ~ @rect_cache[:col][index][w] = result~ - Inside source: true *** True Line Result @@ -164263,6 +180106,86 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def debug_primitives opts = {}~ +- Inside source: true +*** True Line Result + def debug_primitives opts = {} +** Processing line: ~ @primitives ||= col_count.map_with_index do |col|~ +- Inside source: true +*** True Line Result + @primitives ||= col_count.map_with_index do |col| +** Processing line: ~ row_count.map_with_index do |row|~ +- Inside source: true +*** True Line Result + row_count.map_with_index do |row| +** Processing line: ~ cell = rect row: row, col: col~ +- Inside source: true +*** True Line Result + cell = rect row: row, col: col +** Processing line: ~ center = Geometry.rect_center_point cell~ +- Inside source: true +*** True Line Result + center = Geometry.rect_center_point cell +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ cell.merge(opts).border,~ +- Inside source: true +*** True Line Result + cell.merge(opts).border, +** Processing line: ~ cell.merge(opts)~ +- Inside source: true +*** True Line Result + cell.merge(opts) +** Processing line: ~ .label!(x: center.x,~ +- Inside source: true +*** True Line Result + .label!(x: center.x, +** Processing line: ~ y: center.y,~ +- Inside source: true +*** True Line Result + y: center.y, +** Processing line: ~ text: "#{row},#{col}",~ +- Inside source: true +*** True Line Result + text: "#{row},#{col}", +** Processing line: ~ size_enum: -3,~ +- Inside source: true +*** True Line Result + size_enum: -3, +** Processing line: ~ vertical_alignment_enum: 1,~ +- Inside source: true +*** True Line Result + vertical_alignment_enum: 1, +** Processing line: ~ alignment_enum: 1)~ +- Inside source: true +*** True Line Result + alignment_enum: 1) +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ @primitives~ +- Inside source: true +*** True Line Result + @primitives +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def serialize~ - Inside source: true *** True Line Result @@ -164315,6 +180238,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def reset~ +- Inside source: true +*** True Line Result + def reset +** Processing line: ~ @primitives = nil~ +- Inside source: true +*** True Line Result + @primitives = nil +** Processing line: ~ @rect_cache ||= {}~ +- Inside source: true +*** True Line Result + @rect_cache ||= {} +** Processing line: ~ @rect_cache.clear~ +- Inside source: true +*** True Line Result + @rect_cache.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -164875,6 +180826,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def self.reset~ +- Inside source: true +*** True Line Result + def self.reset +** Processing line: ~ @once = {}~ +- Inside source: true +*** True Line Result + @once = {} +** Processing line: ~ nil~ +- Inside source: true +*** True Line Result + nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def self.puts_once *ids, message~ - Inside source: true *** True Line Result @@ -165419,6 +181390,206 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** metadata.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** metadata.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/metadata.rb~ +- Inside source: true +*** True Line Result + # ./dragon/metadata.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2021 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2021 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # metadata.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # metadata.rb has been released under MIT (*only this file*). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński~ +- Inside source: true +*** True Line Result + # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module Metadata~ +- Inside source: true +*** True Line Result + module Metadata +** Processing line: ~ def metadata_file_path~ +- Inside source: true +*** True Line Result + def metadata_file_path +** Processing line: ~ "metadata/game_metadata.txt"~ +- Inside source: true +*** True Line Result + "metadata/game_metadata.txt" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_metadata~ +- Inside source: true +*** True Line Result + def get_metadata +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +- Inside source: true +*** True Line Result + metadata = $gtk.read_file metadata_file_path +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !metadata~ +- Inside source: true +*** True Line Result + if !metadata +** Processing line: ~ write_blank_metadata~ +- Inside source: true +*** True Line Result + write_blank_metadata +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +- Inside source: true +*** True Line Result + metadata = $gtk.read_file metadata_file_path +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ +- Inside source: true +*** True Line Result + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ dev_id: dev_id.strip,~ +- Inside source: true +*** True Line Result + dev_id: dev_id.strip, +** Processing line: ~ dev_title: dev_title.strip,~ +- Inside source: true +*** True Line Result + dev_title: dev_title.strip, +** Processing line: ~ game_id: game_id.strip,~ +- Inside source: true +*** True Line Result + game_id: game_id.strip, +** Processing line: ~ game_title: game_title.strip,~ +- Inside source: true +*** True Line Result + game_title: game_title.strip, +** Processing line: ~ version: version.strip,~ +- Inside source: true +*** True Line Result + version: version.strip, +** Processing line: ~ icon: icon.strip~ +- Inside source: true +*** True Line Result + icon: icon.strip +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def write_blank_metadata~ +- Inside source: true +*** True Line Result + def write_blank_metadata +** Processing line: ~ $gtk.write_file metadata_file_path, <<-S.strip~ +- Inside source: true +*** True Line Result + $gtk.write_file metadata_file_path, <<-S.strip +** Processing line: ~ #devid=myname~ +- Inside source: true +*** True Line Result + #devid=myname +** Processing line: ~ #devtitle=My Name~ +- Inside source: true +*** True Line Result + #devtitle=My Name +** Processing line: ~ #gameid=mygame~ +- Inside source: true +*** True Line Result + #gameid=mygame +** Processing line: ~ #gametitle=My Game~ +- Inside source: true +*** True Line Result + #gametitle=My Game +** Processing line: ~ #version=0.1~ +- Inside source: true +*** True Line Result + #version=0.1 +** Processing line: ~ #icon=metadata/icon.png~ +- Inside source: true +*** True Line Result + #icon=metadata/icon.png +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** numeric.rb~ - Header detected. *** True Line Result @@ -165495,6 +181666,122 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def to_layout_row opts = {}~ +- Inside source: true +*** True Line Result + def to_layout_row opts = {} +** Processing line: ~ $layout.rect(row: self,~ +- Inside source: true +*** True Line Result + $layout.rect(row: self, +** Processing line: ~ col: opts.col || 0,~ +- Inside source: true +*** True Line Result + col: opts.col || 0, +** Processing line: ~ w: opts.w || 0,~ +- Inside source: true +*** True Line Result + w: opts.w || 0, +** Processing line: ~ h: opts.h || 0).y~ +- Inside source: true +*** True Line Result + h: opts.h || 0).y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_layout_col opts = {}~ +- Inside source: true +*** True Line Result + def to_layout_col opts = {} +** Processing line: ~ $layout.rect(row: 0,~ +- Inside source: true +*** True Line Result + $layout.rect(row: 0, +** Processing line: ~ col: self,~ +- Inside source: true +*** True Line Result + col: self, +** Processing line: ~ w: opts.w || 0,~ +- Inside source: true +*** True Line Result + w: opts.w || 0, +** Processing line: ~ h: opts.h || 0).x~ +- Inside source: true +*** True Line Result + h: opts.h || 0).x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_layout_w~ +- Inside source: true +*** True Line Result + def to_layout_w +** Processing line: ~ $layout.rect(row: 0, col: 0, w: self, h: 1).w~ +- Inside source: true +*** True Line Result + $layout.rect(row: 0, col: 0, w: self, h: 1).w +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_layout_h~ +- Inside source: true +*** True Line Result + def to_layout_h +** Processing line: ~ $layout.rect(row: 0, col: 0, w: 1, h: self).h~ +- Inside source: true +*** True Line Result + $layout.rect(row: 0, col: 0, w: 1, h: self).h +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_layout_row_from_bottom opts = {}~ +- Inside source: true +*** True Line Result + def to_layout_row_from_bottom opts = {} +** Processing line: ~ ($layout.row_max_index - self).to_layout_row opts~ +- Inside source: true +*** True Line Result + ($layout.row_max_index - self).to_layout_row opts +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_layout_col_from_right opts = {}~ +- Inside source: true +*** True Line Result + def to_layout_col_from_right opts = {} +** Processing line: ~ ($layout.col_max_index - self).to_layout_col opts~ +- Inside source: true +*** True Line Result + ($layout.col_max_index - self).to_layout_col opts +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -165555,6 +181842,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def third~ +- Inside source: true +*** True Line Result + def third +** Processing line: ~ self / 3.0~ +- Inside source: true +*** True Line Result + self / 3.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def quarter~ +- Inside source: true +*** True Line Result + def quarter +** Processing line: ~ self / 4.0~ +- Inside source: true +*** True Line Result + self / 4.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def to_byte~ - Inside source: true *** True Line Result @@ -165571,6 +181890,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def clamp *opts~ +- Inside source: true +*** True Line Result + def clamp *opts +** Processing line: ~ min = (opts.at 0)~ +- Inside source: true +*** True Line Result + min = (opts.at 0) +** Processing line: ~ max = (opts.at 1)~ +- Inside source: true +*** True Line Result + max = (opts.at 1) +** Processing line: ~ return min if min && self < min~ +- Inside source: true +*** True Line Result + return min if min && self < min +** Processing line: ~ return max if max && self > max~ +- Inside source: true +*** True Line Result + return max if max && self > max +** Processing line: ~ return self~ +- Inside source: true +*** True Line Result + return self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def clamp_wrap min, max~ - Inside source: true *** True Line Result @@ -166467,10 +182818,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Converts a number representing an angle in radians to degress.~ +** Processing line: ~ # Converts a number representing an angle in radians to degrees.~ - Inside source: true *** True Line Result - # Converts a number representing an angle in radians to degress. + # Converts a number representing an angle in radians to degrees. ** Processing line: ~ #~ - Inside source: true *** True Line Result @@ -166535,10 +182886,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns a normal vector for a number that represents an angle in degrees.~ - Inside source: true *** True Line Result - # Returns a normal vector for a number that represents an angle in degress. + # Returns a normal vector for a number that represents an angle in degrees. ** Processing line: ~ #~ - Inside source: true *** True Line Result @@ -166563,10 +182914,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degrees.~ - Inside source: true *** True Line Result - # Returns the y component of a normal vector for a number that represents an angle in degress. + # Returns the y component of a normal vector for a number that represents an angle in degrees. ** Processing line: ~ #~ - Inside source: true *** True Line Result @@ -166591,10 +182942,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degrees.~ - Inside source: true *** True Line Result - # Returns the x component of a normal vector for a number that represents an angle in degress. + # Returns the x component of a normal vector for a number that represents an angle in degrees. ** Processing line: ~ #~ - Inside source: true *** True Line Result @@ -166699,6 +183050,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def multiply n~ +- Inside source: true +*** True Line Result + def multiply n +** Processing line: ~ self * n~ +- Inside source: true +*** True Line Result + self * n +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def fmult n~ +- Inside source: true +*** True Line Result + def fmult n +** Processing line: ~ self * n.to_f~ +- Inside source: true +*** True Line Result + self * n.to_f +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def imult n~ +- Inside source: true +*** True Line Result + def imult n +** Processing line: ~ (self * n).to_i~ +- Inside source: true +*** True Line Result + (self * n).to_i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def mult n~ - Inside source: true *** True Line Result @@ -167103,110 +183502,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def >= other~ -- Inside source: true -*** True Line Result - def >= other -** Processing line: ~ return false if !other~ -- Inside source: true -*** True Line Result - return false if !other -** Processing line: ~ return gte other~ -- Inside source: true -*** True Line Result - return gte other -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def > other~ -- Inside source: true -*** True Line Result - def > other -** Processing line: ~ return false if !other~ -- Inside source: true -*** True Line Result - return false if !other -** Processing line: ~ return gt other~ -- Inside source: true -*** True Line Result - return gt other -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def <= other~ -- Inside source: true -*** True Line Result - def <= other -** Processing line: ~ return false if !other~ -- Inside source: true -*** True Line Result - return false if !other -** Processing line: ~ return lte other~ -- Inside source: true -*** True Line Result - return lte other -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def < other~ -- Inside source: true -*** True Line Result - def < other -** Processing line: ~ return false if !other~ -- Inside source: true -*** True Line Result - return false if !other -** Processing line: ~ return gt other~ -- Inside source: true -*** True Line Result - return gt other -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def == other~ -- Inside source: true -*** True Line Result - def == other -** Processing line: ~ return true if __original_eq_eq__ other~ -- Inside source: true -*** True Line Result - return true if __original_eq_eq__ other -** Processing line: ~ return __original_eq_eq__ other.entity_id if other.is_a? OpenEntity~ -- Inside source: true -*** True Line Result - return __original_eq_eq__ other.entity_id if other.is_a? OpenEntity -** Processing line: ~ return false~ -- Inside source: true -*** True Line Result - return false -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result @@ -167547,118 +183842,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def - other~ -- Inside source: true -*** True Line Result - def - other -** Processing line: ~ return nil unless other~ -- Inside source: true -*** True Line Result - return nil unless other -** Processing line: ~ super~ -- Inside source: true -*** True Line Result - super -** Processing line: ~ rescue Exception => e~ -- Inside source: true -*** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ -- Inside source: true -*** True Line Result - __raise_arithmetic_exception__ other, :-, e -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def + other~ -- Inside source: true -*** True Line Result - def + other -** Processing line: ~ return nil unless other~ -- Inside source: true -*** True Line Result - return nil unless other -** Processing line: ~ super~ -- Inside source: true -*** True Line Result - super -** Processing line: ~ rescue Exception => e~ -- Inside source: true -*** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ -- Inside source: true -*** True Line Result - __raise_arithmetic_exception__ other, :+, e -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def * other~ -- Inside source: true -*** True Line Result - def * other -** Processing line: ~ return nil unless other~ -- Inside source: true -*** True Line Result - return nil unless other -** Processing line: ~ super~ -- Inside source: true -*** True Line Result - super -** Processing line: ~ rescue Exception => e~ -- Inside source: true -*** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ -- Inside source: true -*** True Line Result - __raise_arithmetic_exception__ other, :*, e -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def / other~ -- Inside source: true -*** True Line Result - def / other -** Processing line: ~ return nil unless other~ -- Inside source: true -*** True Line Result - return nil unless other -** Processing line: ~ super~ -- Inside source: true -*** True Line Result - super -** Processing line: ~ rescue Exception => e~ -- Inside source: true -*** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ -- Inside source: true -*** True Line Result - __raise_arithmetic_exception__ other, :/, e -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ def serialize~ - Inside source: true *** True Line Result @@ -167759,6 +183942,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def mid? l, r~ +- Inside source: true +*** True Line Result + def mid? l, r +** Processing line: ~ (between? l, r) || (between? r, l)~ +- Inside source: true +*** True Line Result + (between? l, r) || (between? r, l) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167859,26 +184058,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def + other~ +** Processing line: ~ # Returns `-1` if the number is less than `0`. `+1` if the number~ - Inside source: true *** True Line Result - def + other -** Processing line: ~ return nil unless other~ + # Returns `-1` if the number is less than `0`. `+1` if the number +** Processing line: ~ # is greater than `0`. Returns `0` if the number is equal to `0`.~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + # is greater than `0`. Returns `0` if the number is equal to `0`. +** Processing line: ~ #~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ + # @gtk +** Processing line: ~ def sign~ +- Inside source: true +*** True Line Result + def sign +** Processing line: ~ return -1 if self < 0~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :+, e + return -1 if self < 0 +** Processing line: ~ return 1 if self > 0~ +- Inside source: true +*** True Line Result + return 1 if self > 0 +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167887,26 +184098,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def * other~ +** Processing line: ~ # Returns `true` if number is greater than `0`.~ - Inside source: true *** True Line Result - def * other -** Processing line: ~ return nil unless other~ + # Returns `true` if number is greater than `0`. +** Processing line: ~ #~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + # @gtk +** Processing line: ~ def pos?~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ + def pos? +** Processing line: ~ sign > 0~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :*, e + sign > 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167915,26 +184126,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def / other~ +** Processing line: ~ # Returns `true` if number is less than `0`.~ - Inside source: true *** True Line Result - def / other -** Processing line: ~ return nil unless other~ + # Returns `true` if number is less than `0`. +** Processing line: ~ #~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + # @gtk +** Processing line: ~ def neg?~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ + def neg? +** Processing line: ~ sign < 0~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :/, e + sign < 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167943,26 +184154,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def - other~ +** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ - Inside source: true *** True Line Result - def - other -** Processing line: ~ return nil unless other~ + # Returns the cosine of a represented in degrees (NOT radians). +** Processing line: ~ #~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + # @gtk +** Processing line: ~ def cos~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ + def cos +** Processing line: ~ Math.cos(self.to_radians)~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :-, e + Math.cos(self.to_radians) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167971,22 +184182,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def == other~ +** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +- Inside source: true +*** True Line Result + # Returns the cosine of a represented in degrees (NOT radians). +** Processing line: ~ #~ - Inside source: true *** True Line Result - def == other -** Processing line: ~ return true if __original_eq_eq__ other~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - return true if __original_eq_eq__ other -** Processing line: ~ return __original_eq_eq__ other.entity_id if other.is_a? GTK::OpenEntity~ + # @gtk +** Processing line: ~ def sin~ - Inside source: true *** True Line Result - return __original_eq_eq__ other.entity_id if other.is_a? GTK::OpenEntity -** Processing line: ~ return false~ + def sin +** Processing line: ~ Math.sin(self.to_radians)~ - Inside source: true *** True Line Result - return false + Math.sin(self.to_radians) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -167995,18 +184210,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns `-1` if the number is less than `0`. `+1` if the number~ +** Processing line: ~ def to_sf~ - Inside source: true *** True Line Result - # Returns `-1` if the number is less than `0`. `+1` if the number -** Processing line: ~ # is greater than `0`. Returns `0` if the number is equal to `0`.~ + def to_sf +** Processing line: ~ "%.2f" % self~ - Inside source: true *** True Line Result - # is greater than `0`. Returns `0` if the number is equal to `0`. -** Processing line: ~ #~ + "%.2f" % self +** Processing line: ~ end~ - Inside source: true *** True Line Result - # + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def ifloor int~ +- Inside source: true +*** True Line Result + def ifloor int +** Processing line: ~ (self.idiv int.to_i) * int.to_i~ +- Inside source: true +*** True Line Result + (self.idiv int.to_i) * int.to_i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class Float~ +- Inside source: true +*** True Line Result + class Float +** Processing line: ~ include ValueType~ +- Inside source: true +*** True Line Result + include ValueType +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :__original_add__, :+ unless Float.instance_methods.include? :__original_add__~ +- Inside source: true +*** True Line Result + alias_method :__original_add__, :+ unless Float.instance_methods.include? :__original_add__ +** Processing line: ~ alias_method :__original_subtract__, :- unless Float.instance_methods.include? :__original_subtract__~ +- Inside source: true +*** True Line Result + alias_method :__original_subtract__, :- unless Float.instance_methods.include? :__original_subtract__ +** Processing line: ~ alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__~ +- Inside source: true +*** True Line Result + alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__ +** Processing line: ~ alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__~ +- Inside source: true +*** True Line Result + alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__ +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result @@ -168035,26 +184322,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns `true` if number is greater than `0`.~ +** Processing line: ~ def replace_infinity scalar~ - Inside source: true *** True Line Result - # Returns `true` if number is greater than `0`. -** Processing line: ~ #~ + def replace_infinity scalar +** Processing line: ~ return self if !scalar~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + return self if !scalar +** Processing line: ~ return self unless self.infinite?~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def pos?~ + return self unless self.infinite? +** Processing line: ~ return -scalar if self < 0~ - Inside source: true *** True Line Result - def pos? -** Processing line: ~ sign > 0~ + return -scalar if self < 0 +** Processing line: ~ return scalar if self > 0~ - Inside source: true *** True Line Result - sign > 0 + return scalar if self > 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -168063,82 +184350,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns `true` if number is less than `0`.~ +** Processing line: ~ def to_sf~ - Inside source: true *** True Line Result - # Returns `true` if number is less than `0`. -** Processing line: ~ #~ + def to_sf +** Processing line: ~ "%.2f" % self~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + "%.2f" % self +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def neg?~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def neg? -** Processing line: ~ sign < 0~ + +** Processing line: ~ def ifloor int~ - Inside source: true *** True Line Result - sign < 0 + def ifloor int +** Processing line: ~ (self.idiv int.to_i) * int.to_i~ +- Inside source: true +*** True Line Result + (self.idiv int.to_i) * int.to_i ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +** Processing line: ~ class Integer~ - Inside source: true *** True Line Result - # Returns the cosine of a represented in degrees (NOT radians). -** Processing line: ~ #~ + class Integer +** Processing line: ~ alias_method :__original_round__, :round unless Integer.instance_methods.include? :__original_round__~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + alias_method :__original_round__, :round unless Integer.instance_methods.include? :__original_round__ +** Processing line: ~ alias_method :__original_add__, :+ unless Integer.instance_methods.include? :__original_add__~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def cos~ + alias_method :__original_add__, :+ unless Integer.instance_methods.include? :__original_add__ +** Processing line: ~ alias_method :__original_subtract__, :- unless Integer.instance_methods.include? :__original_subtract__~ - Inside source: true *** True Line Result - def cos -** Processing line: ~ Math.cos(self.to_radians)~ + alias_method :__original_subtract__, :- unless Integer.instance_methods.include? :__original_subtract__ +** Processing line: ~ alias_method :__original_multiply__, :* unless Integer.instance_methods.include? :__original_multiply__~ - Inside source: true *** True Line Result - Math.cos(self.to_radians) -** Processing line: ~ end~ + alias_method :__original_multiply__, :* unless Integer.instance_methods.include? :__original_multiply__ +** Processing line: ~ alias_method :__original_divide__, :- unless Integer.instance_methods.include? :__original_divide__~ - Inside source: true *** True Line Result - end + alias_method :__original_divide__, :- unless Integer.instance_methods.include? :__original_divide__ ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +** Processing line: ~ def round *args~ - Inside source: true *** True Line Result - # Returns the cosine of a represented in degrees (NOT radians). -** Processing line: ~ #~ + def round *args +** Processing line: ~ __original_round__~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + __original_round__ +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def sin~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def sin -** Processing line: ~ Math.sin(self.to_radians)~ + +** Processing line: ~ def nan?~ - Inside source: true *** True Line Result - Math.sin(self.to_radians) + def nan? +** Processing line: ~ false~ +- Inside source: true +*** True Line Result + false ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -168147,346 +184446,1082 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def to_sf~ +** Processing line: ~ def center other~ - Inside source: true *** True Line Result - def to_sf -** Processing line: ~ "%.2f" % self~ + def center other +** Processing line: ~ (self - other).abs.fdiv(2)~ - Inside source: true *** True Line Result - "%.2f" % self + (self - other).abs.fdiv(2) ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def ifloor int~ +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** recording.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** recording.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/recording.rb~ - Inside source: true *** True Line Result - def ifloor int -** Processing line: ~ (self.idiv int.to_i) * int.to_i~ + # ./dragon/recording.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - (self.idiv int.to_i) * int.to_i + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # recording.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # recording.rb has been released under MIT (*only this file*). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ # FIXME: Gross~ +- Inside source: true +*** True Line Result + # FIXME: Gross +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class Replay~ +- Inside source: true +*** True Line Result + class Replay +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.start file_name = nil~ +- Inside source: true +*** True Line Result + def self.start file_name = nil +** Processing line: ~ $recording.start_replay file_name~ +- Inside source: true +*** True Line Result + $recording.start_replay file_name +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.stop~ +- Inside source: true +*** True Line Result + def self.stop +** Processing line: ~ $recording.stop_replay~ +- Inside source: true +*** True Line Result + $recording.stop_replay +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class Recording~ +- Inside source: true +*** True Line Result + class Recording +** Processing line: ~ def initialize runtime~ +- Inside source: true +*** True Line Result + def initialize runtime +** Processing line: ~ @runtime = runtime~ +- Inside source: true +*** True Line Result + @runtime = runtime +** Processing line: ~ @tick_count = 0~ +- Inside source: true +*** True Line Result + @tick_count = 0 +** Processing line: ~ @global_input_order = 1~ +- Inside source: true +*** True Line Result + @global_input_order = 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class Float~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - class Float -** Processing line: ~ include ValueType~ + def tick +** Processing line: ~ @tick_count += 1~ - Inside source: true *** True Line Result - include ValueType + @tick_count += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ alias_method :__original_add__, :+ unless Float.instance_methods.include? :__original_add__~ +** Processing line: ~ def start_recording seed_number = nil~ - Inside source: true *** True Line Result - alias_method :__original_add__, :+ unless Float.instance_methods.include? :__original_add__ -** Processing line: ~ alias_method :__original_subtract__, :- unless Float.instance_methods.include? :__original_subtract__~ + def start_recording seed_number = nil +** Processing line: ~ if !seed_number~ - Inside source: true *** True Line Result - alias_method :__original_subtract__, :- unless Float.instance_methods.include? :__original_subtract__ -** Processing line: ~ alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__~ + if !seed_number +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__ -** Processing line: ~ alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__~ + log <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__ + * ERROR: +** Processing line: ~ To start recording, you must provide an integer value to~ +- Inside source: true +*** True Line Result + To start recording, you must provide an integer value to +** Processing line: ~ seed random number generation.~ +- Inside source: true +*** True Line Result + seed random number generation. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ $console.set_command "$recording.start SEED_NUMBER"~ +- Inside source: true +*** True Line Result + $console.set_command "$recording.start SEED_NUMBER" +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def - other~ +** Processing line: ~ if @is_recording~ +- Inside source: true +*** True Line Result + if @is_recording +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - def - other -** Processing line: ~ return nil unless other~ + log <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + * ERROR: +** Processing line: ~ You are already recording, first cancel (or stop) the current recording.~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + You are already recording, first cancel (or stop) the current recording. +** Processing line: ~ S~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ + S +** Processing line: ~ $console.set_command "$recording.cancel"~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :-, e -** Processing line: ~ end~ + $console.set_command "$recording.cancel" +** Processing line: ~ return~ - Inside source: true *** True Line Result - end + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def + other~ +** Processing line: ~ if @is_replaying~ - Inside source: true *** True Line Result - def + other -** Processing line: ~ return nil unless other~ + if @is_replaying +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + log <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + * ERROR: +** Processing line: ~ You are currently replaying a recording, first stop the replay.~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ + You are currently replaying a recording, first stop the replay. +** Processing line: ~ S~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :+, e -** Processing line: ~ end~ + S +** Processing line: ~ return~ - Inside source: true *** True Line Result - end + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def * other~ +** Processing line: ~ log_info <<-S~ - Inside source: true *** True Line Result - def * other -** Processing line: ~ return nil unless other~ + log_info <<-S +** Processing line: ~ Recording has begun with RNG seed value set to #{seed_number}.~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + Recording has begun with RNG seed value set to #{seed_number}. +** Processing line: ~ To stop recording use stop_recording(filename).~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + To stop recording use stop_recording(filename). +** Processing line: ~ The recording will stop without saving a file if a filename is nil.~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ + The recording will stop without saving a file if a filename is nil. +** Processing line: ~ S~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :*, e -** Processing line: ~ end~ + S +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ $console.set_command "$recording.stop 'replay.txt'"~ +- Inside source: true +*** True Line Result + $console.set_command "$recording.stop 'replay.txt'" +** Processing line: ~ @runtime.__reset__~ +- Inside source: true +*** True Line Result + @runtime.__reset__ +** Processing line: ~ @seed_number = seed_number~ +- Inside source: true +*** True Line Result + @seed_number = seed_number +** Processing line: ~ @runtime.set_rng seed_number~ +- Inside source: true +*** True Line Result + @runtime.set_rng seed_number ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def / other~ +** Processing line: ~ @tick_count = 0~ - Inside source: true *** True Line Result - def / other -** Processing line: ~ return nil unless other~ + @tick_count = 0 +** Processing line: ~ @global_input_order = 1~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ super~ + @global_input_order = 1 +** Processing line: ~ @is_recording = true~ - Inside source: true *** True Line Result - super -** Processing line: ~ rescue Exception => e~ + @is_recording = true +** Processing line: ~ @input_history = []~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ + @input_history = [] +** Processing line: ~ @runtime.notify! "Recording started. When completed, open the console to save it using $recording.stop FILE_NAME (or cancel).", 300~ - Inside source: true *** True Line Result - __raise_arithmetic_exception__ other, :/, e -** Processing line: ~ end~ + @runtime.notify! "Recording started. When completed, open the console to save it using $recording.stop FILE_NAME (or cancel).", 300 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ self~ + # @gtk +** Processing line: ~ def start seed_number = nil~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + def start seed_number = nil +** Processing line: ~ start_recording seed_number~ - Inside source: true *** True Line Result - end + start_recording seed_number +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def is_replaying?~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def sign~ + def is_replaying? +** Processing line: ~ @is_replaying~ - Inside source: true *** True Line Result - def sign -** Processing line: ~ return -1 if self < 0~ + @is_replaying +** Processing line: ~ end~ - Inside source: true *** True Line Result - return -1 if self < 0 -** Processing line: ~ return 1 if self > 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return 1 if self > 0 -** Processing line: ~ return 0~ + +** Processing line: ~ def is_recording?~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + def is_recording? +** Processing line: ~ @is_recording~ - Inside source: true *** True Line Result - end + @is_recording +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def replace_infinity scalar~ +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - def replace_infinity scalar -** Processing line: ~ return self if !scalar~ + # @gtk +** Processing line: ~ def stop file_name = nil~ - Inside source: true *** True Line Result - return self if !scalar -** Processing line: ~ return self unless self.infinite?~ + def stop file_name = nil +** Processing line: ~ stop_recording file_name~ - Inside source: true *** True Line Result - return self unless self.infinite? -** Processing line: ~ return -scalar if self < 0~ + stop_recording file_name +** Processing line: ~ end~ - Inside source: true *** True Line Result - return -scalar if self < 0 -** Processing line: ~ return scalar if self > 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return scalar if self > 0 -** Processing line: ~ end~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - end + # @gtk +** Processing line: ~ def cancel~ +- Inside source: true +*** True Line Result + def cancel +** Processing line: ~ stop_recording_core~ +- Inside source: true +*** True Line Result + stop_recording_core +** Processing line: ~ @runtime.notify! "Recording cancelled."~ +- Inside source: true +*** True Line Result + @runtime.notify! "Recording cancelled." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_sf~ +** Processing line: ~ def stop_recording file_name = nil~ - Inside source: true *** True Line Result - def to_sf -** Processing line: ~ "%.2f" % self~ + def stop_recording file_name = nil +** Processing line: ~ if !file_name~ - Inside source: true *** True Line Result - "%.2f" % self -** Processing line: ~ end~ + if !file_name +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - end + log <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ To please specify a file name when calling:~ +- Inside source: true +*** True Line Result + To please specify a file name when calling: +** Processing line: ~ $recording.stop FILE_NAME~ +- Inside source: true +*** True Line Result + $recording.stop FILE_NAME ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def ifloor int~ +** Processing line: ~ If you do NOT want to save the recording, call:~ - Inside source: true *** True Line Result - def ifloor int -** Processing line: ~ (self.idiv int.to_i) * int.to_i~ + If you do NOT want to save the recording, call: +** Processing line: ~ $recording.cancel~ - Inside source: true *** True Line Result - (self.idiv int.to_i) * int.to_i -** Processing line: ~ end~ + $recording.cancel +** Processing line: ~ S~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + S +** Processing line: ~ $console.set_command "$recording.stop 'replay.txt'"~ - Inside source: true *** True Line Result - end + $console.set_command "$recording.stop 'replay.txt'" +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class Integer~ +** Processing line: ~ if !@is_recording~ - Inside source: true *** True Line Result - class Integer -** Processing line: ~ alias_method :__original_round__, :round unless Integer.instance_methods.include? :__original_round__~ + if !@is_recording +** Processing line: ~ log_info "You are not currently recording. Use start_recording(seed_number) to start recording."~ - Inside source: true *** True Line Result - alias_method :__original_round__, :round unless Integer.instance_methods.include? :__original_round__ -** Processing line: ~ alias_method :__original_add__, :+ unless Integer.instance_methods.include? :__original_add__~ + log_info "You are not currently recording. Use start_recording(seed_number) to start recording." +** Processing line: ~ $console.set_command "$recording.start"~ - Inside source: true *** True Line Result - alias_method :__original_add__, :+ unless Integer.instance_methods.include? :__original_add__ -** Processing line: ~ alias_method :__original_subtract__, :- unless Integer.instance_methods.include? :__original_subtract__~ + $console.set_command "$recording.start" +** Processing line: ~ return~ - Inside source: true *** True Line Result - alias_method :__original_subtract__, :- unless Integer.instance_methods.include? :__original_subtract__ -** Processing line: ~ alias_method :__original_multiply__, :* unless Integer.instance_methods.include? :__original_multiply__~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - alias_method :__original_multiply__, :* unless Integer.instance_methods.include? :__original_multiply__ -** Processing line: ~ alias_method :__original_divide__, :- unless Integer.instance_methods.include? :__original_divide__~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - alias_method :__original_divide__, :- unless Integer.instance_methods.include? :__original_divide__ + +** Processing line: ~ if file_name~ +- Inside source: true +*** True Line Result + if file_name +** Processing line: ~ text = "replay_version 2.0\n"~ +- Inside source: true +*** True Line Result + text = "replay_version 2.0\n" +** Processing line: ~ text << "stopped_at #{@tick_count}\n"~ +- Inside source: true +*** True Line Result + text << "stopped_at #{@tick_count}\n" +** Processing line: ~ text << "seed #{@seed_number}\n"~ +- Inside source: true +*** True Line Result + text << "seed #{@seed_number}\n" +** Processing line: ~ text << "recorded_at #{Time.now.to_s}\n"~ +- Inside source: true +*** True Line Result + text << "recorded_at #{Time.now.to_s}\n" +** Processing line: ~ @input_history.each do |items|~ +- Inside source: true +*** True Line Result + @input_history.each do |items| +** Processing line: ~ text << "#{items}\n"~ +- Inside source: true +*** True Line Result + text << "#{items}\n" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ @runtime.write_file file_name, text~ +- Inside source: true +*** True Line Result + @runtime.write_file file_name, text +** Processing line: ~ @runtime.write_file 'last_replay.txt', text~ +- Inside source: true +*** True Line Result + @runtime.write_file 'last_replay.txt', text +** Processing line: ~ log_info "The recording has been saved successfully at #{file_name}. You can use start_replay(\"#{file_name}\") to replay the recording."~ +- Inside source: true +*** True Line Result + log_info "The recording has been saved successfully at #{file_name}. You can use start_replay(\"#{file_name}\") to replay the recording." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def round *args~ +** Processing line: ~ $console.set_command "$replay.start '#{file_name}'"~ - Inside source: true *** True Line Result - def round *args -** Processing line: ~ __original_round__~ + $console.set_command "$replay.start '#{file_name}'" +** Processing line: ~ stop_recording_core~ - Inside source: true *** True Line Result - __original_round__ -** Processing line: ~ end~ + stop_recording_core +** Processing line: ~ @runtime.notify! "Recording saved to #{file_name}. To replay it: $replay.start \"#{file_name}\"."~ - Inside source: true *** True Line Result - end + @runtime.notify! "Recording saved to #{file_name}. To replay it: $replay.start \"#{file_name}\"." +** Processing line: ~ log_info "You can run the replay later on startup using: ./dragonruby mygame --replay #{@replay_file_name}"~ +- Inside source: true +*** True Line Result + log_info "You can run the replay later on startup using: ./dragonruby mygame --replay #{@replay_file_name}" +** Processing line: ~ nil~ +- Inside source: true +*** True Line Result + nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def nan?~ +** Processing line: ~ def stop_recording_core~ - Inside source: true *** True Line Result - def nan? -** Processing line: ~ false~ + def stop_recording_core +** Processing line: ~ @is_recording = false~ - Inside source: true *** True Line Result - false + @is_recording = false +** Processing line: ~ @input_history = nil~ +- Inside source: true +*** True Line Result + @input_history = nil +** Processing line: ~ @last_history = nil~ +- Inside source: true +*** True Line Result + @last_history = nil +** Processing line: ~ @runtime.__reset__~ +- Inside source: true +*** True Line Result + @runtime.__reset__ +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def start_replay file_name = nil~ +- Inside source: true +*** True Line Result + def start_replay file_name = nil +** Processing line: ~ if !file_name~ +- Inside source: true +*** True Line Result + if !file_name +** Processing line: ~ log <<-S~ +- Inside source: true +*** True Line Result + log <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ Please provide a file name to $recording.start.~ +- Inside source: true +*** True Line Result + Please provide a file name to $recording.start. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ $console.set_command "$replay.start 'replay.txt'"~ +- Inside source: true +*** True Line Result + $console.set_command "$replay.start 'replay.txt'" +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ text = @runtime.read_file file_name~ +- Inside source: true +*** True Line Result + text = @runtime.read_file file_name +** Processing line: ~ return false unless text~ +- Inside source: true +*** True Line Result + return false unless text +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if text.each_line.first.strip != "replay_version 2.0"~ +- Inside source: true +*** True Line Result + if text.each_line.first.strip != "replay_version 2.0" +** Processing line: ~ raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)."~ +- Inside source: true +*** True Line Result + raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @replay_file_name = file_name~ +- Inside source: true +*** True Line Result + @replay_file_name = file_name +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $replay_data = { input_history: { } }~ +- Inside source: true +*** True Line Result + $replay_data = { input_history: { } } +** Processing line: ~ text.each_line do |l|~ +- Inside source: true +*** True Line Result + text.each_line do |l| +** Processing line: ~ if l.strip.length == 0~ +- Inside source: true +*** True Line Result + if l.strip.length == 0 +** Processing line: ~ next~ +- Inside source: true +*** True Line Result + next +** Processing line: ~ elsif l.start_with? 'replay_version'~ +- Inside source: true +*** True Line Result + elsif l.start_with? 'replay_version' +** Processing line: ~ next~ +- Inside source: true +*** True Line Result + next +** Processing line: ~ elsif l.start_with? 'seed'~ +- Inside source: true +*** True Line Result + elsif l.start_with? 'seed' +** Processing line: ~ $replay_data[:seed] = l.split(' ').last.to_i~ +- Inside source: true +*** True Line Result + $replay_data[:seed] = l.split(' ').last.to_i +** Processing line: ~ elsif l.start_with? 'stopped_at'~ +- Inside source: true +*** True Line Result + elsif l.start_with? 'stopped_at' +** Processing line: ~ $replay_data[:stopped_at] = l.split(' ').last.to_i~ +- Inside source: true +*** True Line Result + $replay_data[:stopped_at] = l.split(' ').last.to_i +** Processing line: ~ elsif l.start_with? 'recorded_at'~ +- Inside source: true +*** True Line Result + elsif l.start_with? 'recorded_at' +** Processing line: ~ $replay_data[:recorded_at] = l.split(' ')[1..-1].join(' ')~ +- Inside source: true +*** True Line Result + $replay_data[:recorded_at] = l.split(' ')[1..-1].join(' ') +** Processing line: ~ elsif l.start_with? '['~ +- Inside source: true +*** True Line Result + elsif l.start_with? '[' +** Processing line: ~ name, value_1, value_2, value_count, id, tick_count = l.strip.gsub('[', '').gsub(']', '').split(',')~ +- Inside source: true +*** True Line Result + name, value_1, value_2, value_count, id, tick_count = l.strip.gsub('[', '').gsub(']', '').split(',') +** Processing line: ~ $replay_data[:input_history][tick_count.to_i] ||= []~ +- Inside source: true +*** True Line Result + $replay_data[:input_history][tick_count.to_i] ||= [] +** Processing line: ~ $replay_data[:input_history][tick_count.to_i] << {~ +- Inside source: true +*** True Line Result + $replay_data[:input_history][tick_count.to_i] << { +** Processing line: ~ id: id.to_i,~ +- Inside source: true +*** True Line Result + id: id.to_i, +** Processing line: ~ name: name.gsub(':', '').to_sym,~ +- Inside source: true +*** True Line Result + name: name.gsub(':', '').to_sym, +** Processing line: ~ value_1: value_1.to_f,~ +- Inside source: true +*** True Line Result + value_1: value_1.to_f, +** Processing line: ~ value_2: value_2.to_f,~ +- Inside source: true +*** True Line Result + value_2: value_2.to_f, +** Processing line: ~ value_count: value_count.to_i~ +- Inside source: true +*** True Line Result + value_count: value_count.to_i +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ raise "Replay data seems corrupt. I don't know how to parse #{l}."~ +- Inside source: true +*** True Line Result + raise "Replay data seems corrupt. I don't know how to parse #{l}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $replay_data[:input_history].keys.each do |key|~ +- Inside source: true +*** True Line Result + $replay_data[:input_history].keys.each do |key| +** Processing line: ~ $replay_data[:input_history][key] = $replay_data[:input_history][key].sort_by {|input| input[:id]}~ +- Inside source: true +*** True Line Result + $replay_data[:input_history][key] = $replay_data[:input_history][key].sort_by {|input| input[:id]} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @runtime.__reset__~ +- Inside source: true +*** True Line Result + @runtime.__reset__ +** Processing line: ~ @runtime.set_rng $replay_data[:seed]~ +- Inside source: true +*** True Line Result + @runtime.set_rng $replay_data[:seed] +** Processing line: ~ @tick_count = 0~ +- Inside source: true +*** True Line Result + @tick_count = 0 +** Processing line: ~ @is_replaying = true~ +- Inside source: true +*** True Line Result + @is_replaying = true +** Processing line: ~ log_info "Replay has been started."~ +- Inside source: true +*** True Line Result + log_info "Replay has been started." +** Processing line: ~ @runtime.notify! "Replay started [#{@replay_file_name}]."~ +- Inside source: true +*** True Line Result + @runtime.notify! "Replay started [#{@replay_file_name}]." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def stop_replay notification_message = "Replay has been stopped."~ +- Inside source: true +*** True Line Result + def stop_replay notification_message = "Replay has been stopped." +** Processing line: ~ if !is_replaying?~ +- Inside source: true +*** True Line Result + if !is_replaying? +** Processing line: ~ log <<-S~ +- Inside source: true +*** True Line Result + log <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ No replay is currently running. Call $replay.start FILE_NAME to start a replay.~ +- Inside source: true +*** True Line Result + No replay is currently running. Call $replay.start FILE_NAME to start a replay. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ $console.set_command "$replay.start 'replay.txt'"~ +- Inside source: true +*** True Line Result + $console.set_command "$replay.start 'replay.txt'" +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ log_info notification_message~ +- Inside source: true +*** True Line Result + log_info notification_message +** Processing line: ~ @is_replaying = false~ +- Inside source: true +*** True Line Result + @is_replaying = false +** Processing line: ~ $replay_data = nil~ +- Inside source: true +*** True Line Result + $replay_data = nil +** Processing line: ~ @tick_count = 0~ +- Inside source: true +*** True Line Result + @tick_count = 0 +** Processing line: ~ @global_input_order = 1~ +- Inside source: true +*** True Line Result + @global_input_order = 1 +** Processing line: ~ $console.set_command_silent "$replay.start '#{@replay_file_name}'"~ +- Inside source: true +*** True Line Result + $console.set_command_silent "$replay.start '#{@replay_file_name}'" +** Processing line: ~ @runtime.__reset__~ +- Inside source: true +*** True Line Result + @runtime.__reset__ +** Processing line: ~ @runtime.notify! notification_message~ +- Inside source: true +*** True Line Result + @runtime.notify! notification_message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def record_input_history name, value_1, value_2, value_count, clear_cache = false~ +- Inside source: true +*** True Line Result + def record_input_history name, value_1, value_2, value_count, clear_cache = false +** Processing line: ~ return if @is_replaying~ +- Inside source: true +*** True Line Result + return if @is_replaying +** Processing line: ~ return unless @is_recording~ +- Inside source: true +*** True Line Result + return unless @is_recording +** Processing line: ~ @input_history << [name, value_1, value_2, value_count, @global_input_order, @tick_count]~ +- Inside source: true +*** True Line Result + @input_history << [name, value_1, value_2, value_count, @global_input_order, @tick_count] +** Processing line: ~ @global_input_order += 1~ +- Inside source: true +*** True Line Result + @global_input_order += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def stage_replay_values~ +- Inside source: true +*** True Line Result + def stage_replay_values +** Processing line: ~ return unless @is_replaying~ +- Inside source: true +*** True Line Result + return unless @is_replaying +** Processing line: ~ return unless $replay_data~ +- Inside source: true +*** True Line Result + return unless $replay_data +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if $replay_data[:stopped_at] <= @tick_count~ +- Inside source: true +*** True Line Result + if $replay_data[:stopped_at] <= @tick_count +** Processing line: ~ stop_replay "Replay completed [#{@replay_file_name}]. To rerun, bring up the Console and press enter."~ +- Inside source: true +*** True Line Result + stop_replay "Replay completed [#{@replay_file_name}]. To rerun, bring up the Console and press enter." +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ inputs_this_tick = $replay_data[:input_history][@tick_count]~ +- Inside source: true +*** True Line Result + inputs_this_tick = $replay_data[:input_history][@tick_count] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if @tick_count.zmod? 60~ +- Inside source: true +*** True Line Result + if @tick_count.zmod? 60 +** Processing line: ~ log_info "Replay ends in #{($replay_data[:stopped_at] - @tick_count).idiv 60} second(s)."~ +- Inside source: true +*** True Line Result + log_info "Replay ends in #{($replay_data[:stopped_at] - @tick_count).idiv 60} second(s)." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return unless inputs_this_tick~ +- Inside source: true +*** True Line Result + return unless inputs_this_tick +** Processing line: ~ inputs_this_tick.each do |v|~ +- Inside source: true +*** True Line Result + inputs_this_tick.each do |v| +** Processing line: ~ args = []~ +- Inside source: true +*** True Line Result + args = [] +** Processing line: ~ args << v[:value_1] if v[:value_count] >= 1~ +- Inside source: true +*** True Line Result + args << v[:value_1] if v[:value_count] >= 1 +** Processing line: ~ args << v[:value_2] if v[:value_count] >= 2~ +- Inside source: true +*** True Line Result + args << v[:value_2] if v[:value_count] >= 2 +** Processing line: ~ args << :replay~ +- Inside source: true +*** True Line Result + args << :replay +** Processing line: ~ $gtk.send v[:name], *args~ +- Inside source: true +*** True Line Result + $gtk.send v[:name], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -168719,10 +185754,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @local_state.hotload_client ||= @local_state.new_entity(:hotload_client, -** Processing line: ~ notes: "This enitity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.",~ +** Processing line: ~ notes: "This entity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.",~ - Inside source: true *** True Line Result - notes: "This enitity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", + notes: "This entity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.", ** Processing line: ~ changes: { },~ - Inside source: true *** True Line Result @@ -169323,6 +186358,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/runtime/autocomplete.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -169427,10 +186466,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result token = (word.split " ")[-1] -** Processing line: ~ dots = (token.split ".")~ +** Processing line: ~ dots = (token.split ".").flat_map { |s| s.split "[" }.flat_map { |s| s.split "]" }.flat_map { |s| s.split "(" }.flat_map { |s| s.split ")" }~ - Inside source: true *** True Line Result - dots = (token.split ".") + dots = (token.split ".").flat_map { |s| s.split "[" }.flat_map { |s| s.split "]" }.flat_map { |s| s.split "(" }.flat_map { |s| s.split ")" } ** Processing line: ~ dot = dots[-1]~ - Inside source: true *** True Line Result @@ -169511,6 +186550,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result keys = keys.map { |k| k.to_s } +** Processing line: ~ keys = keys.reject { |k| k.include? '"' }~ +- Inside source: true +*** True Line Result + keys = keys.reject { |k| k.include? '"' } +** Processing line: ~ .reject { |k| k.start_with? "'" }~ +- Inside source: true +*** True Line Result + .reject { |k| k.start_with? "'" } +** Processing line: ~ .reject { |k| k.include? "," }~ +- Inside source: true +*** True Line Result + .reject { |k| k.include? "," } +** Processing line: ~ .reject { |k| k.start_with? "#" }~ +- Inside source: true +*** True Line Result + .reject { |k| k.start_with? "#" } ** Processing line: ~ others = ["def", "end"] +~ - Inside source: true *** True Line Result @@ -169739,6 +186794,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ if dot[0].upcase == dot[0] && (Object.const_defined? dot.to_sym)~ +- Inside source: true +*** True Line Result + if dot[0].upcase == dot[0] && (Object.const_defined? dot.to_sym) +** Processing line: ~ return (Object.const_get dot.to_sym).autocomplete_methods~ +- Inside source: true +*** True Line Result + return (Object.const_get dot.to_sym).autocomplete_methods +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ start_collecting = false~ - Inside source: true *** True Line Result @@ -169799,10 +186870,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ return autocomplete_filter_methods target.as_hash.keys~ +** Processing line: ~ if target.respond_to? :as_hash~ +- Inside source: true +*** True Line Result + if target.respond_to? :as_hash +** Processing line: ~ return autocomplete_filter_methods target.as_hash.keys~ - Inside source: true *** True Line Result - return autocomplete_filter_methods target.as_hash.keys + return autocomplete_filter_methods target.as_hash.keys +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ return autocomplete_filter_methods target.autocomplete_methods~ +- Inside source: true +*** True Line Result + return autocomplete_filter_methods target.autocomplete_methods +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -169815,6 +186902,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ text = text.each_line.reject { |l| l.strip.start_with? "#" }.join "\n"~ +- Inside source: true +*** True Line Result + text = text.each_line.reject { |l| l.strip.start_with? "#" }.join "\n" +** Processing line: ~ text = text.each_line.map { |l| l.split("#").first }.join "\n"~ +- Inside source: true +*** True Line Result + text = text.each_line.map { |l| l.split("#").first }.join "\n" ** Processing line: ~ text.gsub!("[", " ")~ - Inside source: true *** True Line Result @@ -169879,22 +186974,26 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~*** runtime/draw.rb~ +** Processing line: ~*** runtime/benchmark.rb~ - Header detected. *** True Line Result *** True Line Result -*** runtime/draw.rb +*** runtime/benchmark.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # ./dragon/runtime/draw.rb~ +** Processing line: ~ # ./dragon/runtime/benchmark.rb~ - Inside source: true *** True Line Result - # ./dragon/runtime/draw.rb + # ./dragon/runtime/benchmark.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -169903,10 +187002,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # draw.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # benchmark.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # draw.rb has been released under MIT (*only this file*). + # benchmark.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -169919,66 +187018,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result class Runtime -** Processing line: ~ module Draw~ +** Processing line: ~ module Benchmark~ - Inside source: true *** True Line Result - module Draw -** Processing line: ~ def primitives pass~ + module Benchmark +** Processing line: ~ def benchmark_single iterations, name, proc~ - Inside source: true *** True Line Result - def primitives pass -** Processing line: ~ if $top_level.respond_to? :primitives_override~ + def benchmark_single iterations, name, proc +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - if $top_level.respond_to? :primitives_override -** Processing line: ~ return $top_level.tick_render @args, pass~ + log <<-S +** Processing line: ~ ** Invoking :#{name}...~ - Inside source: true *** True Line Result - return $top_level.tick_render @args, pass -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # Don't change this draw order unless you understand~ -- Inside source: true -*** True Line Result - # Don't change this draw order unless you understand -** Processing line: ~ # the implications.~ -- Inside source: true -*** True Line Result - # the implications. -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # pass.solids.each { |s| draw_solid s }~ -- Inside source: true -*** True Line Result - # pass.solids.each { |s| draw_solid s } -** Processing line: ~ # while loops are faster than each with block~ + ** Invoking :#{name}... +** Processing line: ~ S~ - Inside source: true *** True Line Result - # while loops are faster than each with block + S ** Processing line: ~ idx = 0~ - Inside source: true *** True Line Result idx = 0 -** Processing line: ~ length = pass.solids.length~ +** Processing line: ~ r = nil~ +- Inside source: true +*** True Line Result + r = nil +** Processing line: ~ time_start = Time.now~ - Inside source: true *** True Line Result - length = pass.solids.length -** Processing line: ~ while idx < pass.solids.length~ + time_start = Time.now +** Processing line: ~ while idx < iterations~ - Inside source: true *** True Line Result - while idx < pass.solids.length -** Processing line: ~ draw_solid (pass.solids.at idx) # accessing an array using .value instead of [] is faster~ + while idx < iterations +** Processing line: ~ r = proc.call~ - Inside source: true *** True Line Result - draw_solid (pass.solids.at idx) # accessing an array using .value instead of [] is faster + r = proc.call ** Processing line: ~ idx += 1~ - Inside source: true *** True Line Result @@ -169987,162 +187066,182 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end +** Processing line: ~ result = (Time.now - time_start).round 3~ +- Inside source: true +*** True Line Result + result = (Time.now - time_start).round 3 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_solids.each { |s| draw_solid s }~ +** Processing line: ~ { name: name,~ - Inside source: true *** True Line Result - # pass.static_solids.each { |s| draw_solid s } -** Processing line: ~ idx = 0~ + { name: name, +** Processing line: ~ time: result,~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_solids.length~ + time: result, +** Processing line: ~ time_ms: (result * 1000).to_i }~ - Inside source: true *** True Line Result - length = pass.static_solids.length -** Processing line: ~ while idx < length~ + time_ms: (result * 1000).to_i } +** Processing line: ~ end~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_solid (pass.static_solids.at idx)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - draw_solid (pass.static_solids.at idx) -** Processing line: ~ idx += 1~ + +** Processing line: ~ def benchmark opts = {}~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + def benchmark opts = {} +** Processing line: ~ iterations = opts.iterations~ - Inside source: true *** True Line Result - end + iterations = opts.iterations ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.sprites.each { |s| draw_sprite s }~ +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - # pass.sprites.each { |s| draw_sprite s } -** Processing line: ~ idx = 0~ + log <<-S +** Processing line: ~ * BENCHMARK: Started~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.sprites.length~ + * BENCHMARK: Started +** Processing line: ~ ** Caller: #{(caller || []).first}~ - Inside source: true *** True Line Result - length = pass.sprites.length -** Processing line: ~ while idx < length~ + ** Caller: #{(caller || []).first} +** Processing line: ~ ** Iterations: #{iterations}~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_sprite (pass.sprites.at idx)~ + ** Iterations: #{iterations} +** Processing line: ~ S~ - Inside source: true *** True Line Result - draw_sprite (pass.sprites.at idx) -** Processing line: ~ idx += 1~ + S +** Processing line: ~ procs = opts.find_all { |k, v| v.respond_to? :call }~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + procs = opts.find_all { |k, v| v.respond_to? :call } +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ times = procs.map do |(name, proc)|~ +- Inside source: true +*** True Line Result + times = procs.map do |(name, proc)| +** Processing line: ~ benchmark_single iterations, name, proc~ +- Inside source: true +*** True Line Result + benchmark_single iterations, name, proc +** Processing line: ~ end.sort_by { |r| r.time }~ +- Inside source: true +*** True Line Result + end.sort_by { |r| r.time } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_sprites.each { |s| draw_sprite s }~ +** Processing line: ~ first_place = times.first~ - Inside source: true *** True Line Result - # pass.static_sprites.each { |s| draw_sprite s } -** Processing line: ~ idx = 0~ + first_place = times.first +** Processing line: ~ second_place = times.second || first_place~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_sprites.length~ + second_place = times.second || first_place +** Processing line: ~~ - Inside source: true *** True Line Result - length = pass.static_sprites.length -** Processing line: ~ while idx < length~ + +** Processing line: ~ times = times.map do |candidate|~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_sprite (pass.static_sprites.at idx)~ + times = times.map do |candidate| +** Processing line: ~ average_time = first_place.time~ - Inside source: true *** True Line Result - draw_sprite (pass.static_sprites.at idx) -** Processing line: ~ idx += 1~ + average_time = first_place.time +** Processing line: ~ .add(candidate.time)~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + .add(candidate.time) +** Processing line: ~ .abs~ - Inside source: true *** True Line Result - end + .abs +** Processing line: ~ .fdiv(2)~ +- Inside source: true +*** True Line Result + .fdiv(2) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.primitives.each { |p| draw_primitive p }~ +** Processing line: ~ difference_percentage = 0~ - Inside source: true *** True Line Result - # pass.primitives.each { |p| draw_primitive p } -** Processing line: ~ idx = 0~ + difference_percentage = 0 +** Processing line: ~ if average_time == 0~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.primitives.length~ + if average_time == 0 +** Processing line: ~ difference_percentage = 0~ - Inside source: true *** True Line Result - length = pass.primitives.length -** Processing line: ~ while idx < length~ + difference_percentage = 0 +** Processing line: ~ else~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.primitives.at idx)~ + else +** Processing line: ~ difference_percentage = first_place.time~ - Inside source: true *** True Line Result - draw_primitive (pass.primitives.at idx) -** Processing line: ~ idx += 1~ + difference_percentage = first_place.time +** Processing line: ~ .subtract(candidate.time)~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + .subtract(candidate.time) +** Processing line: ~ .abs~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .abs +** Processing line: ~ .fdiv(average_time)~ - Inside source: true *** True Line Result - -** Processing line: ~ # pass.static_primitives.each { |p| draw_primitive p }~ + .fdiv(average_time) +** Processing line: ~ .imult(100)~ - Inside source: true *** True Line Result - # pass.static_primitives.each { |p| draw_primitive p } -** Processing line: ~ idx = 0~ + .imult(100) +** Processing line: ~ end~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_primitives.length~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - length = pass.static_primitives.length -** Processing line: ~ while idx < length~ + +** Processing line: ~ difference_time = ((first_place.time - candidate.time) * 1000).round~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.static_primitives.at idx)~ + difference_time = ((first_place.time - candidate.time) * 1000).round +** Processing line: ~ candidate.merge(difference_percentage: difference_percentage,~ - Inside source: true *** True Line Result - draw_primitive (pass.static_primitives.at idx) -** Processing line: ~ idx += 1~ + candidate.merge(difference_percentage: difference_percentage, +** Processing line: ~ difference_time: difference_time)~ - Inside source: true *** True Line Result - idx += 1 + difference_time: difference_time) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170151,30 +187250,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # pass.labels.each { |l| draw_label l }~ +** Processing line: ~ too_small_to_measure = false~ - Inside source: true *** True Line Result - # pass.labels.each { |l| draw_label l } -** Processing line: ~ idx = 0~ + too_small_to_measure = false +** Processing line: ~ if (first_place.time + second_place.time) == 0~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.labels.length~ + if (first_place.time + second_place.time) == 0 +** Processing line: ~ too_small_to_measure = true~ - Inside source: true *** True Line Result - length = pass.labels.length -** Processing line: ~ while idx < length~ + too_small_to_measure = true +** Processing line: ~ difference_percentage = 0~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_label (pass.labels.at idx)~ + difference_percentage = 0 +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - draw_label (pass.labels.at idx) -** Processing line: ~ idx += 1~ + log <<-S +** Processing line: ~ * BENCHMARK: Average time for experiments were too small. Increase the number of iterations.~ - Inside source: true *** True Line Result - idx += 1 + * BENCHMARK: Average time for experiments were too small. Increase the number of iterations. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ difference_percentage = (((first_place.time - second_place.time).abs.fdiv((first_place.time + second_place.time).abs.fdiv(2))) * 100).round~ +- Inside source: true +*** True Line Result + difference_percentage = (((first_place.time - second_place.time).abs.fdiv((first_place.time + second_place.time).abs.fdiv(2))) * 100).round ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170183,126 +187294,118 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_labels.each { |l| draw_label l }~ +** Processing line: ~ difference_time = first_place.time.-(second_place.time).*(1000).abs.round~ - Inside source: true *** True Line Result - # pass.static_labels.each { |l| draw_label l } -** Processing line: ~ idx = 0~ + difference_time = first_place.time.-(second_place.time).*(1000).abs.round +** Processing line: ~~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_labels.length~ + +** Processing line: ~ r = {~ - Inside source: true *** True Line Result - length = pass.static_labels.length -** Processing line: ~ while idx < length~ + r = { +** Processing line: ~ iterations: iterations,~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_label (pass.static_labels.at idx)~ + iterations: iterations, +** Processing line: ~ first_place: first_place,~ - Inside source: true *** True Line Result - draw_label (pass.static_labels.at idx) -** Processing line: ~ idx += 1~ + first_place: first_place, +** Processing line: ~ second_place: second_place,~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + second_place: second_place, +** Processing line: ~ difference_time: difference_time,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + difference_time: difference_time, +** Processing line: ~ difference_percentage: difference_percentage,~ - Inside source: true *** True Line Result - -** Processing line: ~ # pass.lines.each { |l| draw_line l }~ -- Inside source: true -*** True Line Result - # pass.lines.each { |l| draw_line l } -** Processing line: ~ idx = 0~ + difference_percentage: difference_percentage, +** Processing line: ~ times: times,~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.lines.length~ + times: times, +** Processing line: ~ too_small_to_measure: too_small_to_measure~ - Inside source: true *** True Line Result - length = pass.lines.length -** Processing line: ~ while idx < length~ + too_small_to_measure: too_small_to_measure +** Processing line: ~ }~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_line (pass.lines.at idx)~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - draw_line (pass.lines.at idx) -** Processing line: ~ idx += 1~ + +** Processing line: ~ log_message = []~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + log_message = [] +** Processing line: ~ only_one_result = first_place.name == second_place.name~ - Inside source: true *** True Line Result - end + only_one_result = first_place.name == second_place.name ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_lines.each { |l| draw_line l }~ +** Processing line: ~ if only_one_result~ - Inside source: true *** True Line Result - # pass.static_lines.each { |l| draw_line l } -** Processing line: ~ idx = 0~ + if only_one_result +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_lines.length~ + log <<-S +** Processing line: ~ * BENCHMARK: #{r.first_place.name} completed in #{r.first_place.time_ms}ms."~ - Inside source: true *** True Line Result - length = pass.static_lines.length -** Processing line: ~ while idx < pass.static_lines.length~ + * BENCHMARK: #{r.first_place.name} completed in #{r.first_place.time_ms}ms." +** Processing line: ~ S~ - Inside source: true *** True Line Result - while idx < pass.static_lines.length -** Processing line: ~ draw_line (pass.static_lines.at idx)~ + S +** Processing line: ~ else~ - Inside source: true *** True Line Result - draw_line (pass.static_lines.at idx) -** Processing line: ~ idx += 1~ + else +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + log <<-S +** Processing line: ~ * BENCHMARK: #{r.message}~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + * BENCHMARK: #{r.message} +** Processing line: ~ ** Fastest: #{r.first_place.name.inspect}~ - Inside source: true *** True Line Result - -** Processing line: ~ # pass.borders.each { |b| draw_border b }~ -- Inside source: true -*** True Line Result - # pass.borders.each { |b| draw_border b } -** Processing line: ~ idx = 0~ + ** Fastest: #{r.first_place.name.inspect} +** Processing line: ~ ** Second: #{r.second_place.name.inspect}~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.borders.length~ + ** Second: #{r.second_place.name.inspect} +** Processing line: ~ ** Margin: #{r.difference_percentage}% (#{r.difference_time.abs}ms) #{r.first_place.time_ms}ms vs #{r.second_place.time_ms}ms.~ - Inside source: true *** True Line Result - length = pass.borders.length -** Processing line: ~ while idx < length~ + ** Margin: #{r.difference_percentage}% (#{r.difference_time.abs}ms) #{r.first_place.time_ms}ms vs #{r.second_place.time_ms}ms. +** Processing line: ~ ** Times:~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_border (pass.borders.at idx)~ + ** Times: +** Processing line: ~ #{r.times.map { |t| "*** #{t.name}: #{t.time_ms}ms (#{t.difference_percentage}% #{t.difference_time.abs}ms)." }.join("\n")}~ - Inside source: true *** True Line Result - draw_border (pass.borders.at idx) -** Processing line: ~ idx += 1~ + #{r.times.map { |t| "*** #{t.name}: #{t.time_ms}ms (#{t.difference_percentage}% #{t.difference_time.abs}ms)." }.join("\n")} +** Processing line: ~ S~ - Inside source: true *** True Line Result - idx += 1 + S ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170311,102 +187414,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_borders.each { |b| draw_border b }~ +** Processing line: ~ r~ - Inside source: true *** True Line Result - # pass.static_borders.each { |b| draw_border b } -** Processing line: ~ idx = 0~ + r +** Processing line: ~ end~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_borders.length~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - length = pass.static_borders.length -** Processing line: ~ while idx < length~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_border (pass.static_borders.at idx)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - draw_border (pass.static_borders.at idx) -** Processing line: ~ idx += 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if !$gtk.production~ -- Inside source: true +** Processing line: ~*** runtime/draw.rb~ +- Header detected. *** True Line Result - if !$gtk.production -** Processing line: ~ # pass.debug.each { |r| draw_primitive r }~ -- Inside source: true + *** True Line Result - # pass.debug.each { |r| draw_primitive r } -** Processing line: ~ idx = 0~ -- Inside source: true +*** runtime/draw.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + *** True Line Result - idx = 0 -** Processing line: ~ length = pass.debug.length~ +#+begin_src ruby +** Processing line: ~ # ./dragon/runtime/draw.rb~ - Inside source: true *** True Line Result - length = pass.debug.length -** Processing line: ~ while idx < length~ + # ./dragon/runtime/draw.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.debug.at idx)~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - draw_primitive (pass.debug.at idx) -** Processing line: ~ idx += 1~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # draw.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # draw.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # pass.static_debug.each { |r| draw_primitive r }~ -- Inside source: true -*** True Line Result - # pass.static_debug.each { |r| draw_primitive r } -** Processing line: ~ idx = 0~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_debug.length~ + module GTK +** Processing line: ~ class Runtime~ - Inside source: true *** True Line Result - length = pass.static_debug.length -** Processing line: ~ while idx < length~ + class Runtime +** Processing line: ~ module Draw~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.static_debug.at idx)~ + module Draw +** Processing line: ~ def primitives pass~ - Inside source: true *** True Line Result - draw_primitive (pass.static_debug.at idx) -** Processing line: ~ idx += 1~ + def primitives pass +** Processing line: ~ if $top_level.respond_to? :primitives_override~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + if $top_level.respond_to? :primitives_override +** Processing line: ~ return $top_level.tick_render @args, pass~ - Inside source: true *** True Line Result - end + return $top_level.tick_render @args, pass ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170415,66 +187514,86 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # pass.reserved.each { |r| draw_primitive r }~ +** Processing line: ~ fn.each_send pass.solids, self, :draw_solid~ - Inside source: true *** True Line Result - # pass.reserved.each { |r| draw_primitive r } -** Processing line: ~ idx = 0~ + fn.each_send pass.solids, self, :draw_solid +** Processing line: ~ fn.each_send pass.static_solids, self, :draw_solid~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.reserved.length~ + fn.each_send pass.static_solids, self, :draw_solid +** Processing line: ~ fn.each_send pass.sprites, self, :draw_sprite~ - Inside source: true *** True Line Result - length = pass.reserved.length -** Processing line: ~ while idx < length~ + fn.each_send pass.sprites, self, :draw_sprite +** Processing line: ~ fn.each_send pass.static_sprites, self, :draw_sprite~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.reserved.at idx)~ + fn.each_send pass.static_sprites, self, :draw_sprite +** Processing line: ~ fn.each_send pass.primitives, self, :draw_primitive~ - Inside source: true *** True Line Result - draw_primitive (pass.reserved.at idx) -** Processing line: ~ idx += 1~ + fn.each_send pass.primitives, self, :draw_primitive +** Processing line: ~ fn.each_send pass.static_primitives, self, :draw_primitive~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ end~ + fn.each_send pass.static_primitives, self, :draw_primitive +** Processing line: ~ fn.each_send pass.labels, self, :draw_label~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + fn.each_send pass.labels, self, :draw_label +** Processing line: ~ fn.each_send pass.static_labels, self, :draw_label~ - Inside source: true *** True Line Result - -** Processing line: ~ # pass.static_reserved.each { |r| draw_primitive r }~ + fn.each_send pass.static_labels, self, :draw_label +** Processing line: ~ fn.each_send pass.lines, self, :draw_line~ - Inside source: true *** True Line Result - # pass.static_reserved.each { |r| draw_primitive r } -** Processing line: ~ idx = 0~ + fn.each_send pass.lines, self, :draw_line +** Processing line: ~ fn.each_send pass.static_lines, self, :draw_line~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ length = pass.static_reserved.length~ + fn.each_send pass.static_lines, self, :draw_line +** Processing line: ~ fn.each_send pass.borders, self, :draw_border~ - Inside source: true *** True Line Result - length = pass.static_reserved.length -** Processing line: ~ while idx < length~ + fn.each_send pass.borders, self, :draw_border +** Processing line: ~ fn.each_send pass.static_borders, self, :draw_border~ - Inside source: true *** True Line Result - while idx < length -** Processing line: ~ draw_primitive (pass.static_reserved.at idx)~ + fn.each_send pass.static_borders, self, :draw_border +** Processing line: ~~ - Inside source: true *** True Line Result - draw_primitive (pass.static_reserved.at idx) -** Processing line: ~ idx += 1~ + +** Processing line: ~ if !self.production~ - Inside source: true *** True Line Result - idx += 1 + if !self.production +** Processing line: ~ fn.each_send pass.debug, self, :draw_primitive~ +- Inside source: true +*** True Line Result + fn.each_send pass.debug, self, :draw_primitive +** Processing line: ~ fn.each_send pass.static_debug, self, :draw_primitive~ +- Inside source: true +*** True Line Result + fn.each_send pass.static_debug, self, :draw_primitive ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ fn.each_send pass.reserved, self, :draw_primitive~ +- Inside source: true +*** True Line Result + fn.each_send pass.reserved, self, :draw_primitive +** Processing line: ~ fn.each_send pass.static_reserved, self, :draw_primitive~ +- Inside source: true +*** True Line Result + fn.each_send pass.static_reserved, self, :draw_primitive ** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result @@ -170515,10 +187634,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_solid s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ - Inside source: true *** True Line Result - @ffi_draw.draw_solid s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity +** Processing line: ~ @ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h,~ +- Inside source: true +*** True Line Result + @ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h, +** Processing line: ~ s.r, s.g, s.b, s.a,~ +- Inside source: true +*** True Line Result + s.r, s.g, s.b, s.a, +** Processing line: ~ (s.blendmode_enum || 1)~ +- Inside source: true +*** True Line Result + (s.blendmode_enum || 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170559,14 +187690,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_sprite_3 s.x, s.y, s.w, s.h,~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ - Inside source: true *** True Line Result - @ffi_draw.draw_sprite_3 s.x, s.y, s.w, s.h, -** Processing line: ~ s.path.s_or_default,~ + s = s.as_hash if s.is_a? OpenEntity +** Processing line: ~ @ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h,~ - Inside source: true *** True Line Result - s.path.s_or_default, + @ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h, +** Processing line: ~ (s.path || '').to_s,~ +- Inside source: true +*** True Line Result + (s.path || '').to_s, ** Processing line: ~ s.angle,~ - Inside source: true *** True Line Result @@ -170587,10 +187722,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result s.angle_anchor_x, s.angle_anchor_y, -** Processing line: ~ s.source_x, s.source_y, s.source_w, s.source_h~ +** Processing line: ~ s.source_x, s.source_y, s.source_w, s.source_h,~ +- Inside source: true +*** True Line Result + s.source_x, s.source_y, s.source_w, s.source_h, +** Processing line: ~ (s.blendmode_enum || 1)~ - Inside source: true *** True Line Result - s.source_x, s.source_y, s.source_w, s.source_h + (s.blendmode_enum || 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170631,10 +187770,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_screenshot s.path.s_or_default,~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ +- Inside source: true +*** True Line Result + s = s.as_hash if s.is_a? OpenEntity +** Processing line: ~ @ffi_draw.draw_screenshot (s.path || '').to_s,~ - Inside source: true *** True Line Result - @ffi_draw.draw_screenshot s.path.s_or_default, + @ffi_draw.draw_screenshot (s.path || '').to_s, ** Processing line: ~ s.x, s.y, s.w, s.h,~ - Inside source: true *** True Line Result @@ -170703,22 +187846,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_label l.x, l.y, l.text.s_or_default,~ +** Processing line: ~ l = l.as_hash if l.is_a? OpenEntity~ - Inside source: true *** True Line Result - @ffi_draw.draw_label l.x, l.y, l.text.s_or_default, -** Processing line: ~ l.size_enum, l.alignment_enum,~ + l = l.as_hash if l.is_a? OpenEntity +** Processing line: ~ @ffi_draw.draw_label_3 l.x, l.y,~ - Inside source: true *** True Line Result - l.size_enum, l.alignment_enum, -** Processing line: ~ l.r, l.g, l.b, l.a,~ + @ffi_draw.draw_label_3 l.x, l.y, +** Processing line: ~ (l.text || '').to_s,~ - Inside source: true *** True Line Result - l.r, l.g, l.b, l.a, -** Processing line: ~ l.font.s_or_default(nil)~ + (l.text || '').to_s, +** Processing line: ~ l.size_enum, l.alignment_enum,~ - Inside source: true *** True Line Result - l.font.s_or_default(nil) + l.size_enum, l.alignment_enum, +** Processing line: ~ l.r, l.g, l.b, l.a,~ +- Inside source: true +*** True Line Result + l.r, l.g, l.b, l.a, +** Processing line: ~ l.font,~ +- Inside source: true +*** True Line Result + l.font, +** Processing line: ~ (l.vertical_alignment_enum || 2),~ +- Inside source: true +*** True Line Result + (l.vertical_alignment_enum || 2), +** Processing line: ~ (l.blendmode_enum || 1)~ +- Inside source: true +*** True Line Result + (l.blendmode_enum || 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170759,10 +187918,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_line l.x, l.y, l.x2, l.y2, l.r, l.g, l.b, l.a~ +** Processing line: ~ l = l.as_hash if l.is_a? OpenEntity~ +- Inside source: true +*** True Line Result + l = l.as_hash if l.is_a? OpenEntity +** Processing line: ~ if l.x2~ +- Inside source: true +*** True Line Result + if l.x2 +** Processing line: ~ @ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2,~ +- Inside source: true +*** True Line Result + @ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2, +** Processing line: ~ l.r, l.g, l.b, l.a,~ +- Inside source: true +*** True Line Result + l.r, l.g, l.b, l.a, +** Processing line: ~ (l.blendmode_enum || 1)~ +- Inside source: true +*** True Line Result + (l.blendmode_enum || 1) +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ w = l.w || 0~ +- Inside source: true +*** True Line Result + w = l.w || 0 +** Processing line: ~ w = 1 if w == 0~ +- Inside source: true +*** True Line Result + w = 1 if w == 0 +** Processing line: ~ h = l.h || 0~ +- Inside source: true +*** True Line Result + h = l.h || 0 +** Processing line: ~ h = 1 if h == 0~ +- Inside source: true +*** True Line Result + h = 1 if h == 0 +** Processing line: ~ @ffi_draw.draw_line_2 l.x, l.y,~ +- Inside source: true +*** True Line Result + @ffi_draw.draw_line_2 l.x, l.y, +** Processing line: ~ l.x + w - 1,~ +- Inside source: true +*** True Line Result + l.x + w - 1, +** Processing line: ~ l.y + h - 1,~ +- Inside source: true +*** True Line Result + l.y + h - 1, +** Processing line: ~ l.r, l.g, l.b, l.a,~ +- Inside source: true +*** True Line Result + l.r, l.g, l.b, l.a, +** Processing line: ~ (l.blendmode_enum || 1)~ - Inside source: true *** True Line Result - @ffi_draw.draw_line l.x, l.y, l.x2, l.y2, l.r, l.g, l.b, l.a + (l.blendmode_enum || 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170803,10 +188022,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result else -** Processing line: ~ @ffi_draw.draw_border s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ - Inside source: true *** True Line Result - @ffi_draw.draw_border s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a + s = s.as_hash if s.is_a? OpenEntity +** Processing line: ~ @ffi_draw.draw_border_2 s.x, s.y, s.w, s.h,~ +- Inside source: true +*** True Line Result + @ffi_draw.draw_border_2 s.x, s.y, s.w, s.h, +** Processing line: ~ s.r, s.g, s.b, s.a,~ +- Inside source: true +*** True Line Result + s.r, s.g, s.b, s.a, +** Processing line: ~ (s.blendmode_enum || 1)~ +- Inside source: true +*** True Line Result + (s.blendmode_enum || 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170883,10 +188114,6 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -170927,6 +188154,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/runtime/framerate.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -171067,34 +188298,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @last_framerate = current_framerate -** Processing line: ~ if [email protected]?~ -- Inside source: true -*** True Line Result - if [email protected]? -** Processing line: ~ if !@framerate_important_notification_happened~ -- Inside source: true -*** True Line Result - if !@framerate_important_notification_happened -** Processing line: ~ log_important framerate_warning_message~ +** Processing line: ~ if [email protected]? && [email protected]_replaying?~ - Inside source: true *** True Line Result - log_important framerate_warning_message -** Processing line: ~ else~ + if [email protected]? && [email protected]_replaying? +** Processing line: ~ log framerate_warning_message~ - Inside source: true *** True Line Result - else -** Processing line: ~ log framerate_warning_message~ -- Inside source: true -*** True Line Result - log framerate_warning_message -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ @framerate_important_notification_happened = true~ -- Inside source: true -*** True Line Result - @framerate_important_notification_happened = true + log framerate_warning_message ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -171287,6 +188498,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/runtime/framerate_diagnostics.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -171755,10 +188970,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result [ -** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid,~ +** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid!,~ - Inside source: true *** True Line Result - { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid, + { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid!, ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -171791,10 +189006,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -2 -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ - Inside source: true *** True Line Result - }.label, + }.label!, ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -171827,10 +189042,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -2 -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ - Inside source: true *** True Line Result - }.label, + }.label!, ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -171863,10 +189078,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -2 -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ - Inside source: true *** True Line Result - }.label, + }.label!, ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -171899,10 +189114,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -2 -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ - Inside source: true *** True Line Result - }.label, + }.label!, ** Processing line: ~ {~ - Inside source: true *** True Line Result @@ -171935,10 +189150,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result size_enum: -2 -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ - Inside source: true *** True Line Result - }.label, + }.label!, ** Processing line: ~ ]~ - Inside source: true *** True Line Result @@ -172039,10 +189254,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result @mailbox_if_needed = 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # schema for file_mtimes~ +- Inside source: true +*** True Line Result + # schema for file_mtimes +** Processing line: ~ # { FILE_PATH: { current: (Time as Fixnum),~ +- Inside source: true +*** True Line Result + # { FILE_PATH: { current: (Time as Fixnum), +** Processing line: ~ # last: (Time as Fixnum) },~ +- Inside source: true +*** True Line Result + # last: (Time as Fixnum) }, +** Processing line: ~ # FILE_PATH: { current: (Time as Fixnum),~ +- Inside source: true +*** True Line Result + # FILE_PATH: { current: (Time as Fixnum), +** Processing line: ~ # last: (Time as Fixnum) } }~ +- Inside source: true +*** True Line Result + # last: (Time as Fixnum) } } ** Processing line: ~ @file_mtimes = { }~ - Inside source: true *** True Line Result @file_mtimes = { } +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ @suppress_mailbox = true~ - Inside source: true *** True Line Result @@ -172191,6 +189434,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result 'dragon/numeric.rb', +** Processing line: ~ 'dragon/hash_deprecated.rb',~ +- Inside source: true +*** True Line Result + 'dragon/hash_deprecated.rb', ** Processing line: ~ 'dragon/hash.rb',~ - Inside source: true *** True Line Result @@ -172319,6 +189566,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result 'dragon/hotload_client.rb', +** Processing line: ~ 'dragon/wizards.rb',~ +- Inside source: true +*** True Line Result + 'dragon/wizards.rb', ** Processing line: ~ 'dragon/ios_wizard.rb',~ - Inside source: true *** True Line Result @@ -172391,22 +189642,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def init_mtimes file -** Processing line: ~ current_key = "current_#{file}".to_sym~ -- Inside source: true -*** True Line Result - current_key = "current_#{file}".to_sym -** Processing line: ~ last_key = "last_#{file}".to_sym~ -- Inside source: true -*** True Line Result - last_key = "last_#{file}".to_sym -** Processing line: ~ @file_mtimes[current_key] ||= @ffi_file.mtime(file)~ +** Processing line: ~ @file_mtimes[file] ||= { current: @ffi_file.mtime(file),~ - Inside source: true *** True Line Result - @file_mtimes[current_key] ||= @ffi_file.mtime(file) -** Processing line: ~ @file_mtimes[last_key] ||= @ffi_file.mtime(file)~ + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), +** Processing line: ~ last: @ffi_file.mtime(file) }~ - Inside source: true *** True Line Result - @file_mtimes[last_key] ||= @ffi_file.mtime(file) + last: @ffi_file.mtime(file) } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -172531,6 +189774,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def hotload_if_needed +** Processing line: ~ return if Kernel.tick_count < 0~ +- Inside source: true +*** True Line Result + return if Kernel.tick_count < 0 ** Processing line: ~ hotload_source_files~ - Inside source: true *** True Line Result @@ -172551,14 +189798,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def on_load_succeeded file -** Processing line: ~ @rcb_sender.files_reloaded << file~ +** Processing line: ~ self.files_reloaded << file~ - Inside source: true *** True Line Result - @rcb_sender.files_reloaded << file -** Processing line: ~ @rcb_sender.reloaded_files << file~ + self.files_reloaded << file +** Processing line: ~ self.reloaded_files << file~ - Inside source: true *** True Line Result - @rcb_sender.reloaded_files << file + self.reloaded_files << file ** Processing line: ~ Trace.untrace_classes!~ - Inside source: true *** True Line Result @@ -172571,42 +189818,82 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def reload_if_needed file, force = false~ +** Processing line: ~ def reset_all_mtimes~ - Inside source: true *** True Line Result - def reload_if_needed file, force = false -** Processing line: ~ current_key = "current_#{file}".to_sym~ + def reset_all_mtimes +** Processing line: ~ @file_mtimes.each do |file, _|~ +- Inside source: true +*** True Line Result + @file_mtimes.each do |file, _| +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ +- Inside source: true +*** True Line Result + @file_mtimes[file].current = @ffi_file.mtime(file) +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ +- Inside source: true +*** True Line Result + @file_mtimes[file].last = @file_mtimes[file].current +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ - Inside source: true *** True Line Result - current_key = "current_#{file}".to_sym -** Processing line: ~ last_key = "last_#{file}".to_sym~ + +** Processing line: ~ files_to_reload.each do |file, _|~ +- Inside source: true +*** True Line Result + files_to_reload.each do |file, _| +** Processing line: ~ @file_mtimes[file] ||= {}~ +- Inside source: true +*** True Line Result + @file_mtimes[file] ||= {} +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ +- Inside source: true +*** True Line Result + @file_mtimes[file].current = @ffi_file.mtime(file) +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ +- Inside source: true +*** True Line Result + @file_mtimes[file].last = @file_mtimes[file].current +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ - Inside source: true *** True Line Result - last_key = "last_#{file}".to_sym -** Processing line: ~ @file_mtimes[current_key] ||= nil~ + +** Processing line: ~ def reload_if_needed file, force = false~ - Inside source: true *** True Line Result - @file_mtimes[current_key] ||= nil -** Processing line: ~ @file_mtimes[last_key] ||= nil~ + def reload_if_needed file, force = false +** Processing line: ~ @file_mtimes[file] ||= { current: @ffi_file.mtime(file), last: @ffi_file.mtime(file) }~ - Inside source: true *** True Line Result - @file_mtimes[last_key] ||= nil -** Processing line: ~ @file_mtimes[current_key] = @ffi_file.mtime(file)~ + @file_mtimes[file] ||= { current: @ffi_file.mtime(file), last: @ffi_file.mtime(file) } +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ - Inside source: true *** True Line Result - @file_mtimes[current_key] = @ffi_file.mtime(file) -** Processing line: ~ return if !force && @file_mtimes[last_key] == @file_mtimes[current_key]~ + @file_mtimes[file].current = @ffi_file.mtime(file) +** Processing line: ~ return if !force && @file_mtimes[file].current == @file_mtimes[file].last~ - Inside source: true *** True Line Result - return if !force && @file_mtimes[last_key] == @file_mtimes[current_key] + return if !force && @file_mtimes[file].current == @file_mtimes[file].last ** Processing line: ~ on_load_succeeded file if reload_ruby_file file~ - Inside source: true *** True Line Result on_load_succeeded file if reload_ruby_file file -** Processing line: ~ @file_mtimes[last_key] = @file_mtimes[current_key]~ +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ - Inside source: true *** True Line Result - @file_mtimes[last_key] = @file_mtimes[current_key] + @file_mtimes[file].last = @file_mtimes[file].current ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -172775,6 +190062,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def char_byte~ +- Inside source: true +*** True Line Result + def char_byte +** Processing line: ~ return nil if self.length == 0~ +- Inside source: true +*** True Line Result + return nil if self.length == 0 +** Processing line: ~ c = self.each_char.first.bytes~ +- Inside source: true +*** True Line Result + c = self.each_char.first.bytes +** Processing line: ~ c = c.first if c.is_a? Enumerable~ +- Inside source: true +*** True Line Result + c = c.first if c.is_a? Enumerable +** Processing line: ~ c~ +- Inside source: true +*** True Line Result + c +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def insert_character_at index, char~ +- Inside source: true +*** True Line Result + def insert_character_at index, char +** Processing line: ~ t = each_char.to_a~ +- Inside source: true +*** True Line Result + t = each_char.to_a +** Processing line: ~ t = (t.insert index, char)~ +- Inside source: true +*** True Line Result + t = (t.insert index, char) +** Processing line: ~ t.join~ +- Inside source: true +*** True Line Result + t.join +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def excluding_character_at index~ +- Inside source: true +*** True Line Result + def excluding_character_at index +** Processing line: ~ t = each_char.to_a~ +- Inside source: true +*** True Line Result + t = each_char.to_a +** Processing line: ~ t.delete_at index~ +- Inside source: true +*** True Line Result + t.delete_at index +** Processing line: ~ t.join~ +- Inside source: true +*** True Line Result + t.join +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def excluding_last_character~ +- Inside source: true +*** True Line Result + def excluding_last_character +** Processing line: ~ return "" if self.length <= 1~ +- Inside source: true +*** True Line Result + return "" if self.length <= 1 +** Processing line: ~ return excluding_character_at(self.length - 1)~ +- Inside source: true +*** True Line Result + return excluding_character_at(self.length - 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def end_with_bang?~ - Inside source: true *** True Line Result @@ -173647,10 +191030,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result log "**** Test name: :#{h[:m]}" -** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}"~ +** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}\n#{h[:e].__backtrace_to_org__}"~ - Inside source: true *** True Line Result - log "#{h[:e].to_s.gsub("* ERROR:", "").strip}" + log "#{h[:e].to_s.gsub("* ERROR:", "").strip}\n#{h[:e].__backtrace_to_org__}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -174443,6 +191826,442 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result +** Processing line: ~*** tweetcart.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +*** tweetcart.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/tweetcart.rb~ +- Inside source: true +*** True Line Result + # ./dragon/tweetcart.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # tweetcart.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # tweetcart.rb has been released under MIT (*only this file*). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def $top_level.TICK &block~ +- Inside source: true +*** True Line Result + def $top_level.TICK &block +** Processing line: ~ $top_level.define_method(:tick) do |args|~ +- Inside source: true +*** True Line Result + $top_level.define_method(:tick) do |args| +** Processing line: ~ args.outputs[:scene].w = 160~ +- Inside source: true +*** True Line Result + args.outputs[:scene].w = 160 +** Processing line: ~ args.outputs[:scene].h = 90~ +- Inside source: true +*** True Line Result + args.outputs[:scene].h = 90 +** Processing line: ~ args.outputs[:scene].background_color = [0, 0, 0, 0]~ +- Inside source: true +*** True Line Result + args.outputs[:scene].background_color = [0, 0, 0, 0] +** Processing line: ~ block.call args~ +- Inside source: true +*** True Line Result + block.call args +** Processing line: ~ args.outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :scene }~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :scene } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def $top_level.bg! *rgb~ +- Inside source: true +*** True Line Result + def $top_level.bg! *rgb +** Processing line: ~ r,g,b = rgb~ +- Inside source: true +*** True Line Result + r,g,b = rgb +** Processing line: ~ r ||= 255~ +- Inside source: true +*** True Line Result + r ||= 255 +** Processing line: ~ g ||= r~ +- Inside source: true +*** True Line Result + g ||= r +** Processing line: ~ b ||= g~ +- Inside source: true +*** True Line Result + b ||= g +** Processing line: ~ $args.outputs.background_color = [r, g, b]~ +- Inside source: true +*** True Line Result + $args.outputs.background_color = [r, g, b] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def $top_level.slds~ +- Inside source: true +*** True Line Result + def $top_level.slds +** Processing line: ~ $args.outputs[:scene].sprites~ +- Inside source: true +*** True Line Result + $args.outputs[:scene].sprites +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def $top_level.slds! *os~ +- Inside source: true +*** True Line Result + def $top_level.slds! *os +** Processing line: ~ if (os.first.is_a? Numeric)~ +- Inside source: true +*** True Line Result + if (os.first.is_a? Numeric) +** Processing line: ~ sld!(*os)~ +- Inside source: true +*** True Line Result + sld!(*os) +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ os.each { |o| sld!(*o) }~ +- Inside source: true +*** True Line Result + os.each { |o| sld!(*o) } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def $top_level.sld! *params~ +- Inside source: true +*** True Line Result + def $top_level.sld! *params +** Processing line: ~ x, y, w, h, r, g, b, a = nil~ +- Inside source: true +*** True Line Result + x, y, w, h, r, g, b, a = nil +** Processing line: ~ if params.length == 2~ +- Inside source: true +*** True Line Result + if params.length == 2 +** Processing line: ~ x, y = params~ +- Inside source: true +*** True Line Result + x, y = params +** Processing line: ~ elsif params.length == 3 && (params.last.is_a? Array)~ +- Inside source: true +*** True Line Result + elsif params.length == 3 && (params.last.is_a? Array) +** Processing line: ~ x = params[0]~ +- Inside source: true +*** True Line Result + x = params[0] +** Processing line: ~ y = params[1]~ +- Inside source: true +*** True Line Result + y = params[1] +** Processing line: ~ r, g, b, a = params[2]~ +- Inside source: true +*** True Line Result + r, g, b, a = params[2] +** Processing line: ~ r ||= 255~ +- Inside source: true +*** True Line Result + r ||= 255 +** Processing line: ~ g ||= r~ +- Inside source: true +*** True Line Result + g ||= r +** Processing line: ~ b ||= g~ +- Inside source: true +*** True Line Result + b ||= g +** Processing line: ~ a ||= 255~ +- Inside source: true +*** True Line Result + a ||= 255 +** Processing line: ~ elsif params.length == 4~ +- Inside source: true +*** True Line Result + elsif params.length == 4 +** Processing line: ~ x, y, w, h = params~ +- Inside source: true +*** True Line Result + x, y, w, h = params +** Processing line: ~ elsif params.length == 5 && (params.last.is_a? Array)~ +- Inside source: true +*** True Line Result + elsif params.length == 5 && (params.last.is_a? Array) +** Processing line: ~ x = params[0]~ +- Inside source: true +*** True Line Result + x = params[0] +** Processing line: ~ y = params[1]~ +- Inside source: true +*** True Line Result + y = params[1] +** Processing line: ~ w = params[2]~ +- Inside source: true +*** True Line Result + w = params[2] +** Processing line: ~ h = params[3]~ +- Inside source: true +*** True Line Result + h = params[3] +** Processing line: ~ r,g,b,a = params[4]~ +- Inside source: true +*** True Line Result + r,g,b,a = params[4] +** Processing line: ~ r ||= 255~ +- Inside source: true +*** True Line Result + r ||= 255 +** Processing line: ~ g ||= r~ +- Inside source: true +*** True Line Result + g ||= r +** Processing line: ~ b ||= g~ +- Inside source: true +*** True Line Result + b ||= g +** Processing line: ~ a ||= 255~ +- Inside source: true +*** True Line Result + a ||= 255 +** Processing line: ~ elsif params.length >= 7~ +- Inside source: true +*** True Line Result + elsif params.length >= 7 +** Processing line: ~ x, y, w, h, r, g, b = params~ +- Inside source: true +*** True Line Result + x, y, w, h, r, g, b = params +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ raise "I don't know how to render #{params} with reasonable defaults."~ +- Inside source: true +*** True Line Result + raise "I don't know how to render #{params} with reasonable defaults." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ w ||= 1~ +- Inside source: true +*** True Line Result + w ||= 1 +** Processing line: ~ h ||= 1~ +- Inside source: true +*** True Line Result + h ||= 1 +** Processing line: ~ r ||= 255~ +- Inside source: true +*** True Line Result + r ||= 255 +** Processing line: ~ g ||= 255~ +- Inside source: true +*** True Line Result + g ||= 255 +** Processing line: ~ b ||= 255~ +- Inside source: true +*** True Line Result + b ||= 255 +** Processing line: ~ a ||= 255~ +- Inside source: true +*** True Line Result + a ||= 255 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ slds << { x: x, y: y,~ +- Inside source: true +*** True Line Result + slds << { x: x, y: y, +** Processing line: ~ w: w, h: h,~ +- Inside source: true +*** True Line Result + w: w, h: h, +** Processing line: ~ r: r, g: g, b: b, a: a,~ +- Inside source: true +*** True Line Result + r: r, g: g, b: b, a: a, +** Processing line: ~ path: :pixel }~ +- Inside source: true +*** True Line Result + path: :pixel } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ =begin~ +- Inside source: true +*** True Line Result + =begin +** Processing line: ~ wht = [255] * 3~ +- Inside source: true +*** True Line Result + wht = [255] * 3 +** Processing line: ~ red = [255, 0, 0]~ +- Inside source: true +*** True Line Result + red = [255, 0, 0] +** Processing line: ~ blu = [0, 130, 255]~ +- Inside source: true +*** True Line Result + blu = [0, 130, 255] +** Processing line: ~ purp = [150, 80, 255]~ +- Inside source: true +*** True Line Result + purp = [150, 80, 255] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ TICK {~ +- Inside source: true +*** True Line Result + TICK { +** Processing line: ~ bg! 0~ +- Inside source: true +*** True Line Result + bg! 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ slds << [0, 0, 3, 3, 0, 255, 0, 255]~ +- Inside source: true +*** True Line Result + slds << [0, 0, 3, 3, 0, 255, 0, 255] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sld! 10, 10~ +- Inside source: true +*** True Line Result + sld! 10, 10 +** Processing line: ~ sld! 20, 20, 3, 2~ +- Inside source: true +*** True Line Result + sld! 20, 20, 3, 2 +** Processing line: ~ sld! 30, 30, 2, 2, red~ +- Inside source: true +*** True Line Result + sld! 30, 30, 2, 2, red +** Processing line: ~ sld! 35, 35, blu~ +- Inside source: true +*** True Line Result + sld! 35, 35, blu +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ slds! 40, 40~ +- Inside source: true +*** True Line Result + slds! 40, 40 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ slds! [50, 50],~ +- Inside source: true +*** True Line Result + slds! [50, 50], +** Processing line: ~ [60, 60, purp],~ +- Inside source: true +*** True Line Result + [60, 60, purp], +** Processing line: ~ [70, 70, 10, 10, wht],~ +- Inside source: true +*** True Line Result + [70, 70, 10, 10, wht], +** Processing line: ~ [80, 80, 4, 4, 255, 0, 255]~ +- Inside source: true +*** True Line Result + [80, 80, 4, 4, 255, 0, 255] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ =end~ +- Inside source: true +*** True Line Result + =end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~*** wizards.rb~ - Header detected. *** True Line Result @@ -174459,6 +192278,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # ./dragon/wizards.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -174475,6 +192298,142 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ class Wizard~ +- Inside source: true +*** True Line Result + class Wizard +** Processing line: ~ def metadata_file_path~ +- Inside source: true +*** True Line Result + def metadata_file_path +** Processing line: ~ "metadata/game_metadata.txt"~ +- Inside source: true +*** True Line Result + "metadata/game_metadata.txt" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def get_metadata~ +- Inside source: true +*** True Line Result + def get_metadata +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +- Inside source: true +*** True Line Result + metadata = $gtk.read_file metadata_file_path +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !metadata~ +- Inside source: true +*** True Line Result + if !metadata +** Processing line: ~ write_blank_metadata~ +- Inside source: true +*** True Line Result + write_blank_metadata +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +- Inside source: true +*** True Line Result + metadata = $gtk.read_file metadata_file_path +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ +- Inside source: true +*** True Line Result + dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ dev_id: dev_id.strip.gsub("#", "").gsub("devid=", ""),~ +- Inside source: true +*** True Line Result + dev_id: dev_id.strip.gsub("#", "").gsub("devid=", ""), +** Processing line: ~ dev_title: dev_title.strip.gsub("#", "").gsub("devtitle=", ""),~ +- Inside source: true +*** True Line Result + dev_title: dev_title.strip.gsub("#", "").gsub("devtitle=", ""), +** Processing line: ~ game_id: game_id.strip.gsub("#", "").gsub("gameid=", ""),~ +- Inside source: true +*** True Line Result + game_id: game_id.strip.gsub("#", "").gsub("gameid=", ""), +** Processing line: ~ game_title: game_title.strip.gsub("#", "").gsub("gametitle=", ""),~ +- Inside source: true +*** True Line Result + game_title: game_title.strip.gsub("#", "").gsub("gametitle=", ""), +** Processing line: ~ version: version.strip.gsub("#", "").gsub("version=", ""),~ +- Inside source: true +*** True Line Result + version: version.strip.gsub("#", "").gsub("version=", ""), +** Processing line: ~ icon: icon.strip.gsub("#", "").gsub("icon=", "")~ +- Inside source: true +*** True Line Result + icon: icon.strip.gsub("#", "").gsub("icon=", "") +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class WizardException < Exception~ +- Inside source: true +*** True Line Result + class WizardException < Exception +** Processing line: ~ attr_accessor :console_primitives~ +- Inside source: true +*** True Line Result + attr_accessor :console_primitives +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize *console_primitives~ +- Inside source: true +*** True Line Result + def initialize *console_primitives +** Processing line: ~ @console_primitives = console_primitives~ +- Inside source: true +*** True Line Result + @console_primitives = console_primitives +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ module GTK~ - Inside source: true *** True Line Result @@ -174554,14 +192513,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ -** Processing line: ~[[docs_search.gif]]~ -- P detected. -- Determining if line is a header. -- Line does not appear to be a header. -- Formatting line: ~[[docs_search.gif]]~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. ** Processing line: ~~ ** Processing line: ~* Hello World~ - H1 detected. @@ -174644,22 +192595,36 @@ Follows is a source code listing for all files that have been open sourced. This - BLOCKQUOTE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* Watch Some Intro Videos~ +** Processing line: ~* Intro Videos~ - H1 detected. - Determining if line is a header. - Line contains ~* ~... gsub-ing empty string -- Formatting line: ~Watch Some Intro Videos~ +- Formatting line: ~Intro Videos~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +** Processing line: ~Here are some videos to help you get the lay of the land.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +- Formatting line: ~Here are some videos to help you get the lay of the land.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ +** Processing line: ~** Quick Api Tour~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Quick Api Tour~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Quick Api Tour~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ - OL start detected. - LI detected. @@ -174669,7 +192634,23 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. -** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +** Processing line: ~~ +** Processing line: ~** If You Are Completely New to Ruby and Programming~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~If You Are Completely New to Ruby and Programming~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~If You Are Completely New to Ruby and Programming~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~1. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- OL start detected. - LI detected. - Determining if line is a header. - Line does not appear to be a header. @@ -174677,7 +192658,7 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. -** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +** Processing line: ~2. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. @@ -174685,19 +192666,51 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. -** Processing line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ -- OL end detected. -- P detected. +** Processing line: ~3. You may also want to try this free course provided at [[http://dragonruby.school]].~ +- LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ +- Formatting line: ~ You may also want to try this free course provided at [[http://dragonruby.school]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~~ +** Processing line: ~** If You Have Game Dev Experience~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~If You Have Game Dev Experience~ - Line's tilde count is: 0 - Line contains link marker: false -** Processing line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ -- P detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~If You Have Game Dev Experience~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~1. Building Tetris - Part 1: [[https://youtu.be/xZMwRSbC4rY]]~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Building Tetris - Part 1: [[https://youtu.be/xZMwRSbC4rY]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~2. Building Tetris - Part 2: [[https://youtu.be/C3LLzDUDgz4]]~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Building Tetris - Part 2: [[https://youtu.be/C3LLzDUDgz4]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~3. Low Res Game Jam Tutorial: [[https://youtu.be/pCI90ukKCME]]~ +- LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ +- Formatting line: ~ Low Res Game Jam Tutorial: [[https://youtu.be/pCI90ukKCME]]~ - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. @@ -175483,11 +193496,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. -** Processing line: ~To deploy to Android, you need to have an Android emulator/device, and a environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like:~ +** Processing line: ~To deploy to Android, you need to have an Android emulator/device, and an environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like:~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~To deploy to Android, you need to have an Android emulator/device, and a environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like:~ +- Formatting line: ~To deploy to Android, you need to have an Android emulator/device, and an environment that is able to run Android SDK. ~dragonruby-publish~ will create an APK for you. From there, you can sign the APK and install it to your device. The signing and installation procedure varies from OS to OS. Here's an example of what the command might look like:~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -175510,11 +193523,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +** Processing line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principles.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +- Formatting line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principles.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ @@ -175579,11 +193592,11 @@ Follows is a source code listing for all files that have been open sourced. This - Formatting line: ~There is a programming idiom in software called "The Pit of Success". The term normalizes upfront pain as a necessity/requirement in the hopes that the investment will yield dividends "when you become successful" or "when the code becomes more complicated". This approach to development is strongly discouraged by us. It leads to over-architected and unnecessary code; creates barriers to rapid prototyping and shipping a game; and overwhelms beginners who are new to the engine or programming in general.~ - Line's tilde count is: 0 - Line contains link marker: false -** Processing line: ~DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and string entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create).~ +** Processing line: ~DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs that take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and strict entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create).~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and string entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create).~ +- Formatting line: ~DragonRuby's philosophy is to provide multiple options across the "make it fast" vs "make it right" spectrum, with incremental/intuitive transitions between the options provided. A concrete example of this philosophy would be render primitives: the spectrum of options allows renderable constructs that take the form of tuples/arrays (easy to pickup, simple, and fast to code/prototype with), hashes (a little more work, but gives you the ability to add additional properties), open and strict entities (more work than hashes, but yields cleaner apis), and finally - if you really need full power/flexibility in rendering - classes (which take the most amount of code and programming knowledge to create).~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ @@ -175953,11 +193966,11 @@ Follows is a source code listing for all files that have been open sourced. This - Formatting line: ~The elevator pitch is:~ - Line's tilde count is: 0 - Line contains link marker: false -** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Stadia.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +- Formatting line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Stadia.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ @@ -176171,11 +194184,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +** Processing line: ~- All ~puts~ statements will also be saved to ~logs/puts.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +- Formatting line: ~All ~puts~ statements will also be saved to ~logs/puts.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. @@ -176252,11 +194265,11 @@ Follows is a source code listing for all files that have been open sourced. This - Formatting line: ~ DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).~ - Line's tilde count is: 0 - Line contains link marker: false -** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recording by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~ Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +- Formatting line: ~ Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recording by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. @@ -176319,11 +194332,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. -** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Everyone chases the new and shiny.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +- Formatting line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Everyone chases the new and shiny.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ @@ -176558,13 +194571,14 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +** Processing line: ~You can try our web-based sandbox environment at [[http://fiddle.dragonruby.org]]. But it won't do the runtime justice. Or just come to our Discord Channel at [[http://discord.dragonruby.org]] and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +- Formatting line: ~You can try our web-based sandbox environment at [[http://fiddle.dragonruby.org]]. But it won't do the runtime justice. Or just come to our Discord Channel at [[http://discord.dragonruby.org]] and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ - Line's tilde count is: 0 -- Line contains link marker: false +- Line contains link marker: true +- LINK detected. ** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ - P detected. - Determining if line is a header. @@ -176843,12 +194857,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ flip_vertically: false,~ ** Processing line: ~ flip_horizontally: false,~ ** Processing line: ~ angle_anchor_x: 0.5,~ -** Processing line: ~ angle_anchor_y: 1.0~ +** Processing line: ~ angle_anchor_y: 1.0,~ +** Processing line: ~ blendmode_enum: 1~ ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ +** Processing line: ~The ~blendmode_enum~ value can be set to ~0~ (no blending), ~1~ (alpha blending), ~2~ (additive blending), ~3~ (modulo blending), ~4~ (multiply blending).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The ~blendmode_enum~ value can be set to ~0~ (no blending), ~1~ (alpha blending), ~2~ (additive blending), ~3~ (modulo blending), ~4~ (multiply blending).~ +- Line's tilde count is: 12 +- Line contains link marker: false +- CODE detected. ** Processing line: ~You can represent a sprite as an ~object~:~ - P detected. - Determining if line is a header. @@ -176866,7 +194889,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ :source_x, :source_y, :source_w, :source_h,~ ** Processing line: ~ :tile_x, :tile_y, :tile_w, :tile_h,~ ** Processing line: ~ :flip_horizontally, :flip_vertically,~ -** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ +** Processing line: ~ :angle_anchor_x, :angle_anchor_y, :blendmode_enum~ ** Processing line: ~~ ** Processing line: ~ def primitive_marker~ ** Processing line: ~ :sprite~ @@ -177044,16 +195067,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE start detected. ** Processing line: ~ def tick args~ ** Processing line: ~ args.outputs.labels << {~ -** Processing line: ~ x: 200,~ -** Processing line: ~ y: 550,~ -** Processing line: ~ text: "dragonruby",~ -** Processing line: ~ size_enum: 2,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 155,~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: "fonts/manaspc.ttf",~ +** Processing line: ~ x: 200,~ +** Processing line: ~ y: 550,~ +** Processing line: ~ text: "dragonruby",~ +** Processing line: ~ size_enum: 2,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 155,~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: "fonts/manaspc.ttf",~ +** Processing line: ~ vertical_alignment_enum: 0, # 0 is bottom, 1 is middle, 2 is top~ ** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ ** Processing line: ~ game_data_one: "Something",~ ** Processing line: ~ game_data_two: {~ @@ -177109,6 +195133,41 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~** Rendering Labels With New Line Characters And Wrapping~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering Labels With New Line Characters And Wrapping~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering Labels With New Line Characters And Wrapping~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~You can use a strategy like the following to create multiple labels from a String.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can use a strategy like the following to create multiple labels from a String.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elitteger dolor velit, ultricies vitae libero vel, aliquam imperdiet enim."~ +** Processing line: ~ max_character_length = 30~ +** Processing line: ~ long_strings_split = args.string.wrapped_lines long_string, max_character_length~ +** Processing line: ~ args.outputs.labels << long_strings_split.map_with_index do |s, i|~ +** Processing line: ~ { x: 10, y: 600 - (i * 20), text: s }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~** How To Play A Sound~ - H2 detected. - Determining if line is a header. @@ -177792,11 +195851,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. -** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.up~ and ~args.inputs.down~.~ +** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.down~ and ~args.inputs.up~.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.up~ and ~args.inputs.down~.~ +- Formatting line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.down~ and ~args.inputs.up~.~ - Line's tilde count is: 10 - Line contains link marker: false - CODE detected. @@ -178053,12 +196112,44 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. -** Processing line: ~Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred. ***** ~.x~ Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis. ***** ~.y~ Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis.~ +** Processing line: ~Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred. ***** ~.x~ Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis. ***** ~.y~ Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis.~ -- Line's tilde count is: 10 +- Formatting line: ~Represents the mouse wheel. Returns ~nil~ if no mouse wheel actions occurred.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~***** ~.x~~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~***** ~.x~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns the negative or positive number if the mouse wheel has changed in the ~x~ axis.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~***** ~.y~~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~***** ~.y~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns the negative or positive number if the mouse wheel has changed in the ~y~ axis.~ +- Line's tilde count is: 2 - Line contains link marker: false - CODE detected. ** Processing line: ~**** ~.click~ OR ~.down~, ~.previous_click~, ~.up~~ @@ -178104,18 +196195,20 @@ Follows is a source code listing for all files that have been open sourced. This - Formatting line: ~Represents controllers connected to the usb ports.~ - Line's tilde count is: 0 - Line contains link marker: false -** Processing line: ~**** ~.up~ +** Processing line: ~**** ~.up~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.up~ -- Line's tilde count is: 1 +- Formatting line: ~~.up~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.up~ -- Line's tilde count is: 1 +- Formatting line: ~~.up~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~true~ if ~up~ is pressed or held on the directional or left analog.~ - P detected. - Determining if line is a header. @@ -178124,18 +196217,20 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.down~ +** Processing line: ~**** ~.down~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.down~ -- Line's tilde count is: 1 +- Formatting line: ~~.down~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.down~ -- Line's tilde count is: 1 +- Formatting line: ~~.down~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~true~ if ~down~ is pressed or held on the directional or left analog.~ - P detected. - Determining if line is a header. @@ -178144,18 +196239,20 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.left~ +** Processing line: ~**** ~.left~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.left~ -- Line's tilde count is: 1 +- Formatting line: ~~.left~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.left~ -- Line's tilde count is: 1 +- Formatting line: ~~.left~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~true~ if ~left~ is pressed or held on the directional or left analog.~ - P detected. - Determining if line is a header. @@ -178164,18 +196261,20 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.right~ +** Processing line: ~**** ~.right~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.right~ -- Line's tilde count is: 1 +- Formatting line: ~~.right~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.right~ -- Line's tilde count is: 1 +- Formatting line: ~~.right~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~true~ if ~right~ is pressed or held on the directional or left analog.~ - P detected. - Determining if line is a header. @@ -178184,18 +196283,20 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.left_right~ +** Processing line: ~**** ~.left_right~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.left_right~ -- Line's tilde count is: 1 +- Formatting line: ~~.left_right~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.left_right~ -- Line's tilde count is: 1 +- Formatting line: ~~.left_right~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~-1~ (left), ~0~ (neutral), or ~+1~ (right) depending on results of ~args.inputs.controller_(one|two).left~ and ~args.inputs.controller_(one|two).right~.~ - P detected. - Determining if line is a header. @@ -178204,18 +196305,20 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 10 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.up_down~ +** Processing line: ~**** ~.up_down~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.up_down~ -- Line's tilde count is: 1 +- Formatting line: ~~.up_down~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.up_down~ -- Line's tilde count is: 1 +- Formatting line: ~~.up_down~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~Returns ~-1~ (down), ~0~ (neutral), or ~+1~ (up) depending on results of ~args.inputs.controller_(one|two).up~ and ~args.inputs.controller_(one|two).down~.~ - P detected. - Determining if line is a header. @@ -178312,17 +196415,17 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.directional_up)~~ +** Processing line: ~**** ~.directional_up~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_up)~~ +- Formatting line: ~~.directional_up~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_up)~~ +- Formatting line: ~~.directional_up~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -178334,17 +196437,17 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.directional_down)~~ +** Processing line: ~**** ~.directional_down~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_down)~~ +- Formatting line: ~~.directional_down~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_down)~~ +- Formatting line: ~~.directional_down~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -178356,17 +196459,17 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.directional_left)~~ +** Processing line: ~**** ~.directional_left~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_left)~~ +- Formatting line: ~~.directional_left~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_left)~~ +- Formatting line: ~~.directional_left~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -178378,17 +196481,17 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 4 - Line contains link marker: false - CODE detected. -** Processing line: ~**** ~.directional_right)~~ +** Processing line: ~**** ~.directional_right~~ - H4 detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_right)~~ +- Formatting line: ~~.directional_right~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. - Determining if line is a header. - Line contains ~**** ~... gsub-ing empty string -- Formatting line: ~~.directional_right)~~ +- Formatting line: ~~.directional_right~~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -179780,6 +197883,48 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. +** Processing line: ~Here are some general notes with regards to the arguments these geometric functions accept.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here are some general notes with regards to the arguments these geometric functions accept.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~1. ~Rectangles~ can be represented as an ~Array~ with four (or more) values ~[x, y, w, h]~, as a ~Hash~ ~{ x:, y:, w:, h: }~ or an object that responds to ~x~, ~y~, ~w~, and ~h~.~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~Rectangles~ can be represented as an ~Array~ with four (or more) values ~[x, y, w, h]~, as a ~Hash~ ~{ x:, y:, w:, h: }~ or an object that responds to ~x~, ~y~, ~w~, and ~h~.~ +- Line's tilde count is: 18 +- Line contains link marker: false +- CODE detected. +** Processing line: ~2. ~Points~ can be represent as an ~Array~ with two (or more) values ~[x, y]~, as a ~Hash~ ~{ x:, y:}~ or an object that responds to ~x~, and ~y~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~Points~ can be represent as an ~Array~ with two (or more) values ~[x, y]~, as a ~Hash~ ~{ x:, y:}~ or an object that responds to ~x~, and ~y~.~ +- Line's tilde count is: 14 +- Line contains link marker: false +- CODE detected. +** Processing line: ~3. ~Lines~ can be represented as an ~Array~ with four (or more) values ~[x, y, x2, y2]~, as a ~Hash~ ~{ x:, y:, x2:, y2: }~ or an object that responds to ~x~, ~y~, ~x2~, and ~y2~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~Lines~ can be represented as an ~Array~ with four (or more) values ~[x, y, x2, y2]~, as a ~Hash~ ~{ x:, y:, x2:, y2: }~ or an object that responds to ~x~, ~y~, ~x2~, and ~y2~.~ +- Line's tilde count is: 18 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. ~Angles~ are represented as degrees (not radians).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~Angles~ are represented as degrees (not radians).~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ ** Processing line: ~*** ~.inside_rect? rect_1, rect_2~~ - H3 detected. - Determining if line is a header. @@ -181214,6 +199359,28 @@ Follows is a source code listing for all files that have been open sourced. This - Formatting line: ~Hides the mouse cursor.~ - Line's tilde count is: 0 - Line contains link marker: false +** Processing line: ~*** ~.set_cursor path, dx, dy~~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~~.set_cursor path, dx, dy~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~~.set_cursor path, dx, dy~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Sets the system cursor to a sprite ~path~ with an offset of ~dx~ and ~dy~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Sets the system cursor to a sprite ~path~ with an offset of ~dx~ and ~dy~.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. ** Processing line: ~*** ~.cursor_shown?~~ - H3 detected. - Determining if line is a header. @@ -181392,6 +199559,50 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Runtime#benchmark~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Runtime#benchmark~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~You can use this function to compare the relative performance of methods.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can use this function to compare the relative performance of methods.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # press r to run benchmark~ +** Processing line: ~ if args.inputs.keyboard.key_down.r~ +** Processing line: ~ args.gtk.console.show~ +** Processing line: ~ args.gtk.benchmark iterations: 1000, # number of iterations~ +** Processing line: ~ # label for experiment~ +** Processing line: ~ using_numeric_map: -> () {~ +** Processing line: ~ # experiment body~ +** Processing line: ~ v = 100.map do |i|~ +** Processing line: ~ i * 100~ +** Processing line: ~ end~ +** Processing line: ~ },~ +** Processing line: ~ # label for experiment~ +** Processing line: ~ using_numeric_times: -> () {~ +** Processing line: ~ # experiment body~ +** Processing line: ~ v = []~ +** Processing line: ~ 100.times do |i|~ +** Processing line: ~ v << i * 100~ +** Processing line: ~ end~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~* DOCS: ~Array~~ - H1 detected. - Determining if line is a header. @@ -182066,11 +200277,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +** Processing line: ~The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- Formatting line: ~The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. @@ -182144,11 +200355,11 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ - P detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ - Line's tilde count is: 2 - Line contains link marker: false - CODE detected. @@ -182252,6 +200463,205 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Outputs#sprites~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Outputs#sprites~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Add primitives to this collection to render a sprite to the screen.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Add primitives to this collection to render a sprite to the screen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Rendering a sprite using an Array~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Creates a sprite of a white circle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Creates a sprite of a white circle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT PATH~ +** Processing line: ~ args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a sprite using an Array with colors and alpha~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The value for the color and alpha is a number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Creates a green circle sprite with an opacity of 50%.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Creates a green circle sprite with an opacity of 50%.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT PATH ANGLE ALPHA RED GREEN BLUE~ +** Processing line: ~ args.outputs.sprites << [100, 100, 160, 90, "sprites/circle/white.png", 0, 128, 0, 255, 0]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a sprite using a Hash~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a sprite using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~If you want a more readable invocation. You can use the following hash to create a sprite. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you want a more readable invocation. You can use the following hash to create a sprite. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ path: "sprites/circle/white.png",~ +** Processing line: ~ angle: 0,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ r: 0,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 0~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a solid using a Class~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Here is an example:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here is an example:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ +** Processing line: ~ class Sprite~ +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b~ +** Processing line: ~~ +** Processing line: ~ def primitive_marker~ +** Processing line: ~ :sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Inherit from type~ +** Processing line: ~ class Circle < Sprite~ +** Processing line: ~ # constructor~ +** Processing line: ~ def initialize x, y, size, path~ +** Processing line: ~ self.x = x~ +** Processing line: ~ self.y = y~ +** Processing line: ~ self.w = size~ +** Processing line: ~ self.h = size~ +** Processing line: ~ self.path = path~ +** Processing line: ~ end~ +** Processing line: ~ def serlialize~ +** Processing line: ~ {x:self.x, y:self.y, w:self.w, h:self.h, path:self.path}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inspect~ +** Processing line: ~ serlialize.to_s~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_s~ +** Processing line: ~ serlialize.to_s~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ # render circle sprite~ +** Processing line: ~ args.outputs.sprites << Circle.new(10, 10, 32,"sprites/circle/white.png")~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~* DOCS: ~GTK::Outputs#screenshots~~ - H1 detected. - Determining if line is a header. @@ -182515,51 +200925,51 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~w~: Width of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~h~: Height of the point that always returns ~0~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~left~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~right~: This value is the same as ~x~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~top~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. -** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - LI detected. - Determining if line is a header. - Line does not appear to be a header. -- Formatting line: ~~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Formatting line: ~~bottom~: This value is the same as ~y~ (included so that it can seamlessly work with ~GTK::Geometry~ functions).~ - Line's tilde count is: 6 - Line contains link marker: false - CODE detected. @@ -184489,7 +202899,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 0,~ ** Processing line: ~ b: 200,~ ** Processing line: ~ a: 255,~ -** Processing line: ~ font: "manaspc.ttf" }.label~ +** Processing line: ~ font: "manaspc.ttf" }.label!~ ** Processing line: ~~ ** Processing line: ~ # Primitives can hold anything, and can be given a label in the following forms~ ** Processing line: ~ args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label~ @@ -184503,7 +202913,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 0,~ ** Processing line: ~ b: 200,~ ** Processing line: ~ a: 255,~ -** Processing line: ~ font: "manaspc.ttf" }.label~ +** Processing line: ~ font: "manaspc.ttf" }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -184802,801 +203212,6 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~*** Rendering Basics - Audio Mixer - main.rb~ -- H3 detected. -- Determining if line is a header. -- Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Rendering Basics - Audio Mixer - main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Determining if line is a header. -- Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Rendering Basics - Audio Mixer - main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # ./samples/01_rendering_basics/06_audio_mixer/app/main.rb~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~~ -** Processing line: ~ $boxsize = 30~ -** Processing line: ~~ -** Processing line: ~ def render_sources args~ -** Processing line: ~ mouse_in_panel = (args.state.selected != 0) && args.inputs.mouse.position.inside_rect?([900, 450, 340, 250])~ -** Processing line: ~ mouse_new_down = (args.state.mouse_held == 1)~ -** Processing line: ~~ -** Processing line: ~ if (mouse_new_down && !mouse_in_panel)~ -** Processing line: ~ args.state.selected = 0 # will reset below if we hit something.~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.audio.keys.each { |k|~ -** Processing line: ~ s = args.audio[k]~ -** Processing line: ~~ -** Processing line: ~ if (mouse_new_down) && !mouse_in_panel && args.inputs.mouse.position.inside_rect?([s[:screenx], s[:screeny], $boxsize, $boxsize])~ -** Processing line: ~ args.state.selected = k~ -** Processing line: ~ args.state.dragging_source = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ isselected = (k == args.state.selected)~ -** Processing line: ~~ -** Processing line: ~ if isselected && args.state.dragging_source~ -** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ -** Processing line: ~ # actual screen position so it doesn't scale weirdly vs your mouse.~ -** Processing line: ~ s[:screenx] = args.inputs.mouse.x - ($boxsize / 2)~ -** Processing line: ~ s[:screeny] = args.inputs.mouse.y - ($boxsize / 2)~ -** Processing line: ~~ -** Processing line: ~ s[:screeny] = 50 if s[:screeny] < 50~ -** Processing line: ~ s[:screeny] = (719 - $boxsize) if s[:screeny] > (719 - $boxsize)~ -** Processing line: ~ s[:screenx] = 0 if s[:screenx] < 0~ -** Processing line: ~ s[:screenx] = (1279 - $boxsize) if s[:screenx] > (1279 - $boxsize)~ -** Processing line: ~~ -** Processing line: ~ s[:x] = ((s[:screenx] / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ -** Processing line: ~ s[:y] = ((s[:screeny] / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ]~ -** Processing line: ~ args.outputs.primitives << [s[:screenx], s[:screeny], $boxsize, $boxsize, *color].solid~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_panel args~ -** Processing line: ~ s = args.audio[args.state.selected]~ -** Processing line: ~ return if s.nil?~ -** Processing line: ~ mouse_down = (args.state.mouse_held > 0)~ -** Processing line: ~~ -** Processing line: ~ args.outputs.primitives << [900, 450, 340, 250, 127, 127, 200, 255].solid~ -** Processing line: ~ args.outputs.primitives << [1075, 690, "Source ##{args.state.selected}", 3, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.primitives << [910, 660, 1230, 660, 255, 255, 255].line~ -** Processing line: ~ args.outputs.primitives << [910, 650, "screen: (#{s[:screenx].to_i}, #{s[:screeny].to_i})", 0, 0, 255, 255, 255].label~ -** Processing line: ~ args.outputs.primitives << [910, 625, "position: (#{s[:x].round(5).to_s[0..6]}, #{s[:y].round(5).to_s[0..6]})", 0, 0, 255, 255, 255].label~ -** Processing line: ~~ -** Processing line: ~ slider = [1022, 586, 200, 7]~ -** Processing line: ~ if mouse_down && args.inputs.mouse.position.inside_rect?(slider)~ -** Processing line: ~ s[:pitch] = ((args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)) * 2.0~ -** Processing line: ~ end~ -** Processing line: ~ slidercolor = (s[:pitch] / 2.0) * 255~ -** Processing line: ~ args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid~ -** Processing line: ~ args.outputs.primitives << [910, 600, "pitch: #{s[:pitch].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label~ -** Processing line: ~~ -** Processing line: ~ slider = [1022, 561, 200, 7]~ -** Processing line: ~ if mouse_down && args.inputs.mouse.position.inside_rect?(slider)~ -** Processing line: ~ s[:gain] = (args.inputs.mouse.x - slider[0]).to_f / (slider[2]-1.0)~ -** Processing line: ~ end~ -** Processing line: ~ slidercolor = s[:gain] * 255~ -** Processing line: ~ args.outputs.primitives << [*slider, slidercolor, slidercolor, slidercolor, 255].solid~ -** Processing line: ~ args.outputs.primitives << [910, 575, "gain: #{s[:gain].round(3).to_s[0..2]}", 0, 0, 255, 255, 255].label~ -** Processing line: ~~ -** Processing line: ~ checkbox = [1022, 533, 10, 12]~ -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox)~ -** Processing line: ~ s[:looping] = !s[:looping]~ -** Processing line: ~ end~ -** Processing line: ~ checkboxcolor = s[:looping] ? 255 : 0~ -** Processing line: ~ args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid~ -** Processing line: ~ args.outputs.primitives << [910, 550, "looping:", 0, 0, 255, 255, 255].label~ -** Processing line: ~~ -** Processing line: ~ checkbox = [1022, 508, 10, 12]~ -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(checkbox)~ -** Processing line: ~ s[:paused] = !s[:paused]~ -** Processing line: ~ end~ -** Processing line: ~ checkboxcolor = s[:paused] ? 255 : 0~ -** Processing line: ~ args.outputs.primitives << [*checkbox, checkboxcolor, checkboxcolor, checkboxcolor, 255].solid~ -** Processing line: ~ args.outputs.primitives << [910, 525, "paused:", 0, 0, 255, 255, 255].label~ -** Processing line: ~~ -** Processing line: ~ button = [910, 460, 320, 20]~ -** Processing line: ~ if (args.state.mouse_held == 1) && args.inputs.mouse.position.inside_rect?(button)~ -** Processing line: ~ args.audio.delete(args.state.selected)~ -** Processing line: ~ args.state.selected = 0~ -** Processing line: ~ end~ -** Processing line: ~ args.outputs.primitives << [*button, 255, 0, 0, 255].solid~ -** Processing line: ~ args.outputs.primitives << [button[0] + (button[2] / 2), button[1]+20, "DELETE SOURCE", 0, 1, 255, 255, 0].label~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def spawn_new_sound args, num~ -** Processing line: ~ input = nil~ -** Processing line: ~ input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}"~ -** Processing line: ~~ -** Processing line: ~ # Spawn randomly in an area that won't be covered by UI.~ -** Processing line: ~ screenx = (rand * 600.0) + 200.0~ -** Processing line: ~ screeny = (rand * 400.0) + 100.0~ -** Processing line: ~~ -** Processing line: ~ args.state.next_sound_index += 1~ -** Processing line: ~~ -** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ -** Processing line: ~ # actual screen position in here for convenience.~ -** Processing line: ~ args.audio[args.state.next_sound_index] = {~ -** Processing line: ~ input: input,~ -** Processing line: ~ screenx: screenx,~ -** Processing line: ~ screeny: screeny,~ -** Processing line: ~ x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ -** Processing line: ~ y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ -** Processing line: ~ z: 0.0,~ -** Processing line: ~ gain: 1.0,~ -** Processing line: ~ pitch: 1.0,~ -** Processing line: ~ looping: true,~ -** Processing line: ~ paused: false~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ args.state.selected = args.state.next_sound_index~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_launcher args~ -** Processing line: ~ total = 6~ -** Processing line: ~ x = (1280 - (total * $boxsize * 3)) / 2~ -** Processing line: ~ y = 10~ -** Processing line: ~ args.outputs.primitives << [0, 0, 1280, ((y*2) + $boxsize), 127, 127, 127, 255].solid~ -** Processing line: ~ for i in 1..total~ -** Processing line: ~ args.outputs.primitives << [x, y, $boxsize, $boxsize, 255, 255, 255, 255].solid~ -** Processing line: ~ args.outputs.primitives << [x+8, y+28, i.to_s, 3, 0, 0, 0, 255, 255].label~ -** Processing line: ~ if args.inputs.mouse.click && args.inputs.mouse.click.point.inside_rect?([x, y, $boxsize, $boxsize])~ -** Processing line: ~ spawn_new_sound args, i~ -** Processing line: ~ end~ -** Processing line: ~ x = x + ($boxsize * 3)~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_ui args~ -** Processing line: ~ render_launcher args~ -** Processing line: ~ render_panel args~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.mouse_held ||= 0~ -** Processing line: ~ args.state.dragging_source ||= false~ -** Processing line: ~ args.state.selected ||= 0~ -** Processing line: ~ args.state.next_sound_index ||= 0~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.up~ -** Processing line: ~ args.state.mouse_held = 0~ -** Processing line: ~ args.state.dragging_source = false~ -** Processing line: ~ elsif args.inputs.mouse.down || (args.state.mouse_held > 0)~ -** Processing line: ~ args.state.mouse_held += 1~ -** Processing line: ~ else~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.background_color = [ 0, 0, 0, 255 ]~ -** Processing line: ~ render_sources args~ -** Processing line: ~ render_ui args~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~*** Rendering Basics - Sound Synthesis - main.rb~ -- H3 detected. -- Determining if line is a header. -- Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Rendering Basics - Sound Synthesis - main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Determining if line is a header. -- Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Rendering Basics - Sound Synthesis - main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # ./samples/01_rendering_basics/07_sound_synthesis/app/main.rb~ -** Processing line: ~ begin # region: top level tick methods~ -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ input args~ -** Processing line: ~ process_audio_queue args~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.state.sine_waves ||= {}~ -** Processing line: ~ args.state.square_waves ||= {}~ -** Processing line: ~ args.state.saw_tooth_waves ||= {}~ -** Processing line: ~ args.state.triangle_waves ||= {}~ -** Processing line: ~ args.state.audio_queue ||= []~ -** Processing line: ~ args.state.buttons ||= [~ -** Processing line: ~ (frequency_buttons args),~ -** Processing line: ~ (sine_wave_note_buttons args),~ -** Processing line: ~ (bell_buttons args),~ -** Processing line: ~ (square_wave_note_buttons args),~ -** Processing line: ~ (saw_tooth_wave_note_buttons args),~ -** Processing line: ~ (triangle_wave_note_buttons args),~ -** Processing line: ~ ].flatten~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ args.outputs.borders << args.state.buttons.map { |b| b[:border] }~ -** Processing line: ~ args.outputs.labels << args.state.buttons.map { |b| b[:label] }~ -** Processing line: ~ args.outputs.labels << args.layout~ -** Processing line: ~ .rect(row: 0, col: 11.5)~ -** Processing line: ~ .yield_self { |r| r.merge y: r.y + r.h }~ -** Processing line: ~ .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~ def input args~ -** Processing line: ~ args.state.buttons.each do |b|~ -** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect])~ -** Processing line: ~ parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", "~ -** Processing line: ~ args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}"~ -** Processing line: ~ send b[:method_to_call], args, b~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half }))~ -** Processing line: ~ args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan'~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def process_audio_queue args~ -** Processing line: ~ to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count }~ -** Processing line: ~ args.state.audio_queue -= to_queue~ -** Processing line: ~ to_queue.each { |a| args.audio[a[:id]] = a }~ -** Processing line: ~~ -** Processing line: ~ args.audio.find_all { |k, v| v[:decay_rate] }~ -** Processing line: ~ .each { |k, v| v[:gain] -= v[:decay_rate] }~ -** Processing line: ~~ -** Processing line: ~ sounds_to_stop = args.audio~ -** Processing line: ~ .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] }~ -** Processing line: ~ .map { |k, v| k }~ -** Processing line: ~~ -** Processing line: ~ sounds_to_stop.each { |k| args.audio.delete k }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: button definitions, ui layout, callback functions~ -** Processing line: ~ def button args, opts~ -** Processing line: ~ button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1))~ -** Processing line: ~~ -** Processing line: ~ button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0~ -** Processing line: ~~ -** Processing line: ~ label_offset_x = 5~ -** Processing line: ~ label_offset_y = 30~ -** Processing line: ~~ -** Processing line: ~ button_def[:label] = button_def[:rect].merge text: opts[:text],~ -** Processing line: ~ size_enum: -2.5,~ -** Processing line: ~ x: button_def[:rect].x + label_offset_x,~ -** Processing line: ~ y: button_def[:rect].y + label_offset_y~ -** Processing line: ~~ -** Processing line: ~ button_def~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def play_sine_wave args, sender~ -** Processing line: ~ queue_sine_wave args,~ -** Processing line: ~ frequency: sender[:frequency],~ -** Processing line: ~ duration: 1.seconds,~ -** Processing line: ~ fade_out: true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def play_note args, sender~ -** Processing line: ~ method_to_call = :queue_sine_wave~ -** Processing line: ~ method_to_call = :queue_square_wave if sender[:type] == :square~ -** Processing line: ~ method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth~ -** Processing line: ~ method_to_call = :queue_triangle_wave if sender[:type] == :triangle~ -** Processing line: ~ method_to_call = :queue_bell if sender[:type] == :bell~ -** Processing line: ~~ -** Processing line: ~ send method_to_call, args,~ -** Processing line: ~ frequency: (frequency_for note: sender[:note], octave: sender[:octave]),~ -** Processing line: ~ duration: 1.seconds,~ -** Processing line: ~ fade_out: true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def frequency_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.0, col: 0, text: "300hz",~ -** Processing line: ~ frequency: 300,~ -** Processing line: ~ method_to_call: :play_sine_wave),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.0, col: 0, text: "400hz",~ -** Processing line: ~ frequency: 400,~ -** Processing line: ~ method_to_call: :play_sine_wave),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.0, col: 0, text: "500hz",~ -** Processing line: ~ frequency: 500,~ -** Processing line: ~ method_to_call: :play_sine_wave),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sine_wave_note_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 1.5, col: 2, text: "Sine C4",~ -** Processing line: ~ note: :c, octave: 4, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 2.5, col: 2, text: "Sine D4",~ -** Processing line: ~ note: :d, octave: 4, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 3.5, col: 2, text: "Sine E4",~ -** Processing line: ~ note: :e, octave: 4, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.5, col: 2, text: "Sine F4",~ -** Processing line: ~ note: :f, octave: 4, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.5, col: 2, text: "Sine G4",~ -** Processing line: ~ note: :g, octave: 4, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.5, col: 2, text: "Sine A5",~ -** Processing line: ~ note: :a, octave: 5, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 7.5, col: 2, text: "Sine B5",~ -** Processing line: ~ note: :b, octave: 5, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 8.5, col: 2, text: "Sine C5",~ -** Processing line: ~ note: :c, octave: 5, type: :sine, method_to_call: :play_note),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def square_wave_note_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 1.5, col: 6, text: "Square C4",~ -** Processing line: ~ note: :c, octave: 4, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 2.5, col: 6, text: "Square D4",~ -** Processing line: ~ note: :d, octave: 4, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 3.5, col: 6, text: "Square E4",~ -** Processing line: ~ note: :e, octave: 4, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.5, col: 6, text: "Square F4",~ -** Processing line: ~ note: :f, octave: 4, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.5, col: 6, text: "Square G4",~ -** Processing line: ~ note: :g, octave: 4, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.5, col: 6, text: "Square A5",~ -** Processing line: ~ note: :a, octave: 5, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 7.5, col: 6, text: "Square B5",~ -** Processing line: ~ note: :b, octave: 5, type: :square, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 8.5, col: 6, text: "Square C5",~ -** Processing line: ~ note: :c, octave: 5, type: :square, method_to_call: :play_note),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ def saw_tooth_wave_note_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 1.5, col: 8, text: "Saw C4",~ -** Processing line: ~ note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 2.5, col: 8, text: "Saw D4",~ -** Processing line: ~ note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 3.5, col: 8, text: "Saw E4",~ -** Processing line: ~ note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.5, col: 8, text: "Saw F4",~ -** Processing line: ~ note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.5, col: 8, text: "Saw G4",~ -** Processing line: ~ note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.5, col: 8, text: "Saw A5",~ -** Processing line: ~ note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 7.5, col: 8, text: "Saw B5",~ -** Processing line: ~ note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 8.5, col: 8, text: "Saw C5",~ -** Processing line: ~ note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def triangle_wave_note_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 1.5, col: 10, text: "Triangle C4",~ -** Processing line: ~ note: :c, octave: 4, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 2.5, col: 10, text: "Triangle D4",~ -** Processing line: ~ note: :d, octave: 4, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 3.5, col: 10, text: "Triangle E4",~ -** Processing line: ~ note: :e, octave: 4, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.5, col: 10, text: "Triangle F4",~ -** Processing line: ~ note: :f, octave: 4, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.5, col: 10, text: "Triangle G4",~ -** Processing line: ~ note: :g, octave: 4, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.5, col: 10, text: "Triangle A5",~ -** Processing line: ~ note: :a, octave: 5, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 7.5, col: 10, text: "Triangle B5",~ -** Processing line: ~ note: :b, octave: 5, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 8.5, col: 10, text: "Triangle C5",~ -** Processing line: ~ note: :c, octave: 5, type: :triangle, method_to_call: :play_note),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bell_buttons args~ -** Processing line: ~ [~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 1.5, col: 4, text: "Bell C4",~ -** Processing line: ~ note: :c, octave: 4, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 2.5, col: 4, text: "Bell D4",~ -** Processing line: ~ note: :d, octave: 4, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 3.5, col: 4, text: "Bell E4",~ -** Processing line: ~ note: :e, octave: 4, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 4.5, col: 4, text: "Bell F4",~ -** Processing line: ~ note: :f, octave: 4, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 5.5, col: 4, text: "Bell G4",~ -** Processing line: ~ note: :g, octave: 4, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 6.5, col: 4, text: "Bell A5",~ -** Processing line: ~ note: :a, octave: 5, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 7.5, col: 4, text: "Bell B5",~ -** Processing line: ~ note: :b, octave: 5, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ (button args,~ -** Processing line: ~ row: 8.5, col: 4, text: "Bell C5",~ -** Processing line: ~ note: :c, octave: 5, type: :bell, method_to_call: :play_note),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: wave generation~ -** Processing line: ~ begin # sine wave~ -** Processing line: ~ def defaults_sine_wave_for~ -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sine_wave_for opts = {}~ -** Processing line: ~ opts = defaults_sine_wave_for.merge opts~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = opts[:sample_rate]~ -** Processing line: ~ period_size = (sample_rate.fdiv frequency).ceil~ -** Processing line: ~ period_size.map_with_index do |i|~ -** Processing line: ~ Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i)~ -** Processing line: ~ end.to_a~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_queue_sine_wave~ -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_sine_wave args, opts = {}~ -** Processing line: ~ opts = defaults_queue_sine_wave.merge opts~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = 48000~ -** Processing line: ~~ -** Processing line: ~ sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~ args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~~ -** Processing line: ~ proc = lambda do~ -** Processing line: ~ generate_audio_data args.state.sine_waves[frequency], sample_rate~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ audio_state = new_audio_state args, opts~ -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: sine_wave~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: square wave~ -** Processing line: ~ def defaults_square_wave_for~ -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def square_wave_for opts = {}~ -** Processing line: ~ opts = defaults_square_wave_for.merge opts~ -** Processing line: ~ sine_wave = sine_wave_for opts~ -** Processing line: ~ sine_wave.map do |v|~ -** Processing line: ~ if v >= 0~ -** Processing line: ~ 1.0~ -** Processing line: ~ else~ -** Processing line: ~ -1.0~ -** Processing line: ~ end~ -** Processing line: ~ end.to_a~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_queue_square_wave~ -** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_square_wave args, opts = {}~ -** Processing line: ~ opts = defaults_queue_square_wave.merge opts~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = 48000~ -** Processing line: ~~ -** Processing line: ~ square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~ args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~~ -** Processing line: ~ proc = lambda do~ -** Processing line: ~ generate_audio_data args.state.square_waves[frequency], sample_rate~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ audio_state = new_audio_state args, opts~ -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: square_wave~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: saw tooth wave~ -** Processing line: ~ def defaults_saw_tooth_wave_for~ -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def saw_tooth_wave_for opts = {}~ -** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ -** Processing line: ~ sine_wave = sine_wave_for opts~ -** Processing line: ~ period_size = sine_wave.length~ -** Processing line: ~ sine_wave.map_with_index do |v, i|~ -** Processing line: ~ (((i % period_size).fdiv period_size) * 2) - 1~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_queue_saw_tooth_wave~ -** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_saw_tooth_wave args, opts = {}~ -** Processing line: ~ opts = defaults_queue_saw_tooth_wave.merge opts~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = 48000~ -** Processing line: ~~ -** Processing line: ~ saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~ args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~~ -** Processing line: ~ proc = lambda do~ -** Processing line: ~ generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ audio_state = new_audio_state args, opts~ -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: saw_tooth_wave~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: triangle wave~ -** Processing line: ~ def defaults_triangle_wave_for~ -** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def triangle_wave_for opts = {}~ -** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ -** Processing line: ~ sine_wave = sine_wave_for opts~ -** Processing line: ~ period_size = sine_wave.length~ -** Processing line: ~ sine_wave.map_with_index do |v, i|~ -** Processing line: ~ ratio = (i.fdiv period_size)~ -** Processing line: ~ if ratio <= 0.5~ -** Processing line: ~ (ratio * 4) - 1~ -** Processing line: ~ else~ -** Processing line: ~ ratio -= 0.5~ -** Processing line: ~ 1 - (ratio * 4)~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_queue_triangle_wave~ -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_triangle_wave args, opts = {}~ -** Processing line: ~ opts = defaults_queue_triangle_wave.merge opts~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = 48000~ -** Processing line: ~~ -** Processing line: ~ triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~ args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate~ -** Processing line: ~~ -** Processing line: ~ proc = lambda do~ -** Processing line: ~ generate_audio_data args.state.triangle_waves[frequency], sample_rate~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ audio_state = new_audio_state args, opts~ -** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ -** Processing line: ~ queue_audio args, audio_state: audio_state, wave: triangle_wave~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: bell~ -** Processing line: ~ def defaults_queue_bell~ -** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_bell args, opts = {}~ -** Processing line: ~ (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bell_harmonics~ -** Processing line: ~ [~ -** Processing line: ~ { frequency_ratio: 0.5, duration_ratio: 1.00 },~ -** Processing line: ~ { frequency_ratio: 1.0, duration_ratio: 0.80 },~ -** Processing line: ~ { frequency_ratio: 2.0, duration_ratio: 0.60 },~ -** Processing line: ~ { frequency_ratio: 3.0, duration_ratio: 0.40 },~ -** Processing line: ~ { frequency_ratio: 4.2, duration_ratio: 0.25 },~ -** Processing line: ~ { frequency_ratio: 5.4, duration_ratio: 0.20 },~ -** Processing line: ~ { frequency_ratio: 6.8, duration_ratio: 0.15 }~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_bell_to_sine_waves~ -** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bell_to_sine_waves opts = {}~ -** Processing line: ~ opts = defaults_bell_to_sine_waves.merge opts~ -** Processing line: ~ bell_harmonics.map do |b|~ -** Processing line: ~ {~ -** Processing line: ~ frequency: opts[:frequency] * b[:frequency_ratio],~ -** Processing line: ~ duration: opts[:duration] * b[:duration_ratio],~ -** Processing line: ~ queue_in: opts[:queue_in],~ -** Processing line: ~ gain: (1.fdiv bell_harmonics.length),~ -** Processing line: ~ fade_out: true~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # audio entity construction~ -** Processing line: ~ def generate_audio_data sine_wave, sample_rate~ -** Processing line: ~ sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil~ -** Processing line: ~ copy_count = (sample_size.fdiv sine_wave.length).ceil~ -** Processing line: ~ sine_wave * copy_count~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults_new_audio_state~ -** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def new_audio_state args, opts = {}~ -** Processing line: ~ opts = defaults_new_audio_state.merge opts~ -** Processing line: ~ decay_rate = 0~ -** Processing line: ~ decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out]~ -** Processing line: ~ frequency = opts[:frequency]~ -** Processing line: ~ sample_rate = 48000~ -** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ id: (new_id! args),~ -** Processing line: ~ frequency: frequency,~ -** Processing line: ~ sample_rate: 48000,~ -** Processing line: ~ stop_at: args.tick_count + opts[:queue_in] + opts[:duration],~ -** Processing line: ~ gain: opts[:gain].to_f,~ -** Processing line: ~ queue_at: args.state.tick_count + opts[:queue_in],~ -** Processing line: ~ decay_rate: decay_rate,~ -** Processing line: ~ pitch: 1.0,~ -** Processing line: ~ looping: true,~ -** Processing line: ~ paused: false~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def queue_audio args, opts = {}~ -** Processing line: ~ graph_wave args, opts[:wave], opts[:audio_state][:frequency]~ -** Processing line: ~ args.state.audio_queue << opts[:audio_state]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def new_id! args~ -** Processing line: ~ args.state.audio_id ||= 0~ -** Processing line: ~ args.state.audio_id += 1~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def graph_wave args, wave, frequency~ -** Processing line: ~ if args.state.tick_count != args.state.graphed_at~ -** Processing line: ~ args.outputs.static_lines.clear~ -** Processing line: ~ args.outputs.static_sprites.clear~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ wave = wave~ -** Processing line: ~~ -** Processing line: ~ r, g, b = frequency.to_i % 85,~ -** Processing line: ~ frequency.to_i % 170,~ -** Processing line: ~ frequency.to_i % 255~ -** Processing line: ~~ -** Processing line: ~ starting_rect = args.layout.rect(row: 5, col: 13)~ -** Processing line: ~ x_scale = 10~ -** Processing line: ~ y_scale = 100~ -** Processing line: ~ max_points = 25~ -** Processing line: ~~ -** Processing line: ~ points = wave~ -** Processing line: ~ if wave.length > max_points~ -** Processing line: ~ resolution = wave.length.idiv max_points~ -** Processing line: ~ points = wave.find_all.with_index { |y, i| (i % resolution == 0) }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.static_lines << points.map_with_index do |y, x|~ -** Processing line: ~ next_y = points[x + 1]~ -** Processing line: ~~ -** Processing line: ~ if next_y~ -** Processing line: ~ {~ -** Processing line: ~ x: starting_rect.x + (x * x_scale),~ -** Processing line: ~ y: starting_rect.y + starting_rect.h.half + y_scale * y,~ -** Processing line: ~ x2: starting_rect.x + ((x + 1) * x_scale),~ -** Processing line: ~ y2: starting_rect.y + starting_rect.h.half + y_scale * next_y,~ -** Processing line: ~ r: r,~ -** Processing line: ~ g: g,~ -** Processing line: ~ b: b~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.static_sprites << points.map_with_index do |y, x|~ -** Processing line: ~ {~ -** Processing line: ~ x: (starting_rect.x + (x * x_scale)) - 2,~ -** Processing line: ~ y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2,~ -** Processing line: ~ w: 4,~ -** Processing line: ~ h: 4,~ -** Processing line: ~ path: 'sprites/square-white.png',~ -** Processing line: ~ r: r,~ -** Processing line: ~ g: g,~ -** Processing line: ~ b: b~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.state.graphed_at = args.state.tick_count~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ begin # region: musical note mapping~ -** Processing line: ~ def defaults_frequency_for~ -** Processing line: ~ { note: :a, octave: 5, sharp: false, flat: false }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def frequency_for opts = {}~ -** Processing line: ~ opts = defaults_frequency_for.merge opts~ -** Processing line: ~ octave_offset_multiplier = opts[:octave] - 5~ -** Processing line: ~ note = note_frequencies_octave_5[opts[:note]]~ -** Processing line: ~ if octave_offset_multiplier < 0~ -** Processing line: ~ note = note * 1 / (octave_offset_multiplier.abs + 1)~ -** Processing line: ~ elsif octave_offset_multiplier > 0~ -** Processing line: ~ note = note * (octave_offset_multiplier.abs + 1) / 1~ -** Processing line: ~ end~ -** Processing line: ~ note~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def note_frequencies_octave_5~ -** Processing line: ~ {~ -** Processing line: ~ a: 440.0,~ -** Processing line: ~ a_sharp: 466.16, b_flat: 466.16,~ -** Processing line: ~ b: 493.88,~ -** Processing line: ~ c: 523.25,~ -** Processing line: ~ c_sharp: 554.37, d_flat: 587.33,~ -** Processing line: ~ d: 587.33,~ -** Processing line: ~ d_sharp: 622.25, e_flat: 659.25,~ -** Processing line: ~ e: 659.25,~ -** Processing line: ~ f: 698.25,~ -** Processing line: ~ f_sharp: 739.99, g_flat: 739.99,~ -** Processing line: ~ g: 783.99,~ -** Processing line: ~ g_sharp: 830.61, a_flat: 830.61~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ ** Processing line: ~*** Input Basics - Keyboard - main.rb~ - H3 detected. - Determining if line is a header. @@ -185640,9 +203255,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def tick args~ ** Processing line: ~ tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360~ ** Processing line: ~ # Notice how small_font accounts for all the remaining parameters~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 0), text: "Current game time: #{args.state.tick_count}", size_enum: -1 }~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 2), text: "Keyboard input: args.inputs.keyboard.key_up.h", size_enum: -1 }~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 3), text: "Press \"h\" on the keyboard.", size_enum: -1 }~ ** Processing line: ~~ ** Processing line: ~ # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key~ ** Processing line: ~ if args.inputs.keyboard.key_up.h~ @@ -185653,27 +203268,19 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state.h_pressed_at ||= false~ ** Processing line: ~~ ** Processing line: ~ if args.state.h_pressed_at~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" was pressed at time: #{args.state.h_pressed_at}", size_enum: -1 }~ ** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 460, y: row_to_px(args, 4), text: "\"h\" has never been pressed.", size_enum: -1 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ tick_help_text args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ # This method provides some values for the construction of labels~ -** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ -** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ -** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ def row_to_px args, row_number, y_offset = 20~ ** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ ** Processing line: ~ # Row 0 starts 5 units below the top of the grid~ ** Processing line: ~ # Each row afterward is 20 units lower~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ args.grid.top - 5 - (y_offset * row_number)~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Don't worry about understanding the code within this method just yet.~ @@ -185703,17 +203310,17 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: "This is the api for the keys you've pressed:", size_enum: -1, r: 180 }~ ** Processing line: ~~ ** Processing line: ~ if !args.state.help_available~ ** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font]~ ** Processing line: ~ return~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ -** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ -** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ -** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ +** Processing line: ~ args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: "args.inputs.keyboard", size_enum: -2 }~ +** Processing line: ~ args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_down", size_enum: -2 }~ +** Processing line: ~ args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_held", size_enum: -2 }~ +** Processing line: ~ args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: "args.inputs.keyboard.key_up", size_enum: -2 }~ ** Processing line: ~~ ** Processing line: ~ fill_history args, :key_value_history, :down_or_held, nil~ ** Processing line: ~ fill_history args, :key_down_value_history, :down, :key_down~ @@ -185759,12 +203366,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ idx += 2~ ** Processing line: ~ [~ -** Processing line: ~ [x, row_to_px(args, idx - 2),~ -** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ -** Processing line: ~ small_font],~ -** Processing line: ~ [x, row_to_px(args, idx - 1),~ -** Processing line: ~ " was #{v}",~ -** Processing line: ~ small_font]~ +** Processing line: ~ { x: x, y: row_to_px(args, idx + 0, 16), text: " .#{k} is #{current_value || "nil"}", size_enum: -2 },~ +** Processing line: ~ { x: x, y: row_to_px(args, idx + 1, 16), text: " was #{v}", size_enum: -2 }~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -185779,11 +203382,64 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text,~ +** Processing line: ~ size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)",~ +** Processing line: ~ size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Input Basics - Moving A Sprite - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Input Basics - Moving A Sprite - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Input Basics - Moving A Sprite - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/02_input_basics/01_moving_a_sprite/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # create a player and set default values~ +** Processing line: ~ # for the player's x, y, w (width), and h (height)~ +** Processing line: ~ args.state.player.x ||= 100~ +** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ args.state.player.w ||= 50~ +** Processing line: ~ args.state.player.h ||= 50~ +** Processing line: ~~ +** Processing line: ~ # render the player to the screen~ +** Processing line: ~ args.outputs.sprites << { x: args.state.player.x,~ +** Processing line: ~ y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.w,~ +** Processing line: ~ h: args.state.player.h,~ +** Processing line: ~ path: 'sprites/square/green.png' }~ +** Processing line: ~~ +** Processing line: ~ # move the player around using the keyboard~ +** Processing line: ~ if args.inputs.up~ +** Processing line: ~ args.state.player.y += 10~ +** Processing line: ~ elsif args.inputs.down~ +** Processing line: ~ args.state.player.y -= 10~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.left~ +** Processing line: ~ args.state.player.x -= 10~ +** Processing line: ~ elsif args.inputs.right~ +** Processing line: ~ args.state.player.x += 10~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ @@ -185838,7 +203494,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # Use args.inputs.mouse.click.created_at~ ** Processing line: ~~ ** Processing line: ~ # To see how many frames its been since the click occurred~ -** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ +** Processing line: ~ # Use args.inputs.mouse.click.created_at_elapsed~ ** Processing line: ~~ ** Processing line: ~ # Saving the click in args.state can be quite useful~ ** Processing line: ~~ @@ -185867,11 +203523,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # This method effectively combines the row_to_px and small_font methods~ ** Processing line: ~ # It changes the given row value to a DragonRuby pixel value~ ** Processing line: ~ # and adds the customization parameters~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, alignment_enum: -2 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def row_to_px args, row_number~ @@ -185887,9 +203539,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -185956,7 +203608,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->")~ ** Processing line: ~~ -** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ +** Processing line: ~ box = { x: 785, y: 370, w: 50, h: 50, r: 0, g: 0, b: 170 }~ ** Processing line: ~ args.outputs.borders << box~ ** Processing line: ~~ ** Processing line: ~ # Saves the most recent click into args.state~ @@ -185978,11 +203630,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def small_label args, x, row, message~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, size_enum: -2 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def row_to_px args, row_number~ @@ -185998,9 +203646,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << { x: 0, y: y - 50, w: 1280, h: 60 }.solid!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y, text: text, size_enum: 1, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ +** Processing line: ~ args.outputs.debug << { x: 640, y: y - 25, text: "(click to dismiss instructions)", size_enum: -2, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -186067,9 +203715,15 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # They are stored in game so that they do not get reset every tick~ ** Processing line: ~ if args.inputs.mouse.click~ ** Processing line: ~ if !args.state.box_collision_one~ -** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ +** Processing line: ~ args.state.box_collision_one = { x: args.inputs.mouse.click.point.x - 25,~ +** Processing line: ~ y: args.inputs.mouse.click.point.y - 25,~ +** Processing line: ~ w: 125, h: 125,~ +** Processing line: ~ r: 180, g: 0, b: 0, a: 180 }~ ** Processing line: ~ elsif !args.state.box_collision_two~ -** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ +** Processing line: ~ args.state.box_collision_two = { x: args.inputs.mouse.click.point.x - 25,~ +** Processing line: ~ y: args.inputs.mouse.click.point.y - 25,~ +** Processing line: ~ w: 125, h: 125,~ +** Processing line: ~ r: 0, g: 0, b: 180, a: 180 }~ ** Processing line: ~ else~ ** Processing line: ~ args.state.box_collision_one = nil~ ** Processing line: ~ args.state.box_collision_two = nil~ @@ -186096,15 +203750,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def small_label args, x, row, message~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ { x: x, y: row_to_px(args, row), text: message, size_enum: -2 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def row_to_px args, row_number~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ args.grid.top - 5 - (20 * row_number)~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -186185,57 +203835,51 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def process_inputs~ ** Processing line: ~ state.buttons = []~ ** Processing line: ~~ -** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ -** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ -** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ -** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ -** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ -** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ -** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ -** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ -** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ -** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ -** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ -** Processing line: ~ inputs.controller_one.key_held.l3,~ -** Processing line: ~ "L3"]~ -** Processing line: ~~ -** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ -** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ -** Processing line: ~ inputs.controller_one.key_held.r3,~ -** Processing line: ~ "R3"]~ +** Processing line: ~ state.buttons << { x: 100, y: 500, active: inputs.controller_one.key_held.l1, text: "L1"}~ +** Processing line: ~ state.buttons << { x: 100, y: 600, active: inputs.controller_one.key_held.l2, text: "L2"}~ +** Processing line: ~ state.buttons << { x: 1100, y: 500, active: inputs.controller_one.key_held.r1, text: "R1"}~ +** Processing line: ~ state.buttons << { x: 1100, y: 600, active: inputs.controller_one.key_held.r2, text: "R2"}~ +** Processing line: ~ state.buttons << { x: 540, y: 450, active: inputs.controller_one.key_held.select, text: "Select"}~ +** Processing line: ~ state.buttons << { x: 660, y: 450, active: inputs.controller_one.key_held.start, text: "Start"}~ +** Processing line: ~ state.buttons << { x: 200, y: 300, active: inputs.controller_one.key_held.left, text: "Left"}~ +** Processing line: ~ state.buttons << { x: 300, y: 400, active: inputs.controller_one.key_held.up, text: "Up"}~ +** Processing line: ~ state.buttons << { x: 400, y: 300, active: inputs.controller_one.key_held.right, text: "Right"}~ +** Processing line: ~ state.buttons << { x: 300, y: 200, active: inputs.controller_one.key_held.down, text: "Down"}~ +** Processing line: ~ state.buttons << { x: 800, y: 300, active: inputs.controller_one.key_held.x, text: "X"}~ +** Processing line: ~ state.buttons << { x: 900, y: 400, active: inputs.controller_one.key_held.y, text: "Y"}~ +** Processing line: ~ state.buttons << { x: 1000, y: 300, active: inputs.controller_one.key_held.a, text: "A"}~ +** Processing line: ~ state.buttons << { x: 900, y: 200, active: inputs.controller_one.key_held.b, text: "B"}~ +** Processing line: ~ state.buttons << { x: 450 + inputs.controller_one.left_analog_x_perc * 100,~ +** Processing line: ~ y: 100 + inputs.controller_one.left_analog_y_perc * 100,~ +** Processing line: ~ active: inputs.controller_one.key_held.l3,~ +** Processing line: ~ text: "L3" }~ +** Processing line: ~ state.buttons << { x: 750 + inputs.controller_one.right_analog_x_perc * 100,~ +** Processing line: ~ y: 100 + inputs.controller_one.right_analog_y_perc * 100,~ +** Processing line: ~ active: inputs.controller_one.key_held.r3,~ +** Processing line: ~ text: "R3" }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Gives each button a square shape.~ ** Processing line: ~ # If the button is being pressed or held (which means it is considered active),~ ** Processing line: ~ # the square is filled in. Otherwise, the button simply has a border.~ ** Processing line: ~ def render~ -** Processing line: ~ state.buttons.each do |x, y, active, text|~ -** Processing line: ~ rect = [x, y, 75, 75]~ +** Processing line: ~ state.buttons.each do |b|~ +** Processing line: ~ rect = { x: b.x, y: b.y, w: 75, h: 75 }~ ** Processing line: ~~ -** Processing line: ~ if active # if button is pressed~ +** Processing line: ~ if b.active # if button is pressed~ ** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ ** Processing line: ~ else~ ** Processing line: ~ outputs.borders << rect # otherwise, output as border~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Outputs the text of each button using labels.~ -** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ +** Processing line: ~ outputs.labels << { x: b.x, y: b.y + 95, text: b.text } # add 95 to place label above button~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ +** Processing line: ~ outputs.labels << { x: 10, y: 60, text: "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)" }~ +** Processing line: ~ outputs.labels << { x: 10, y: 30, text: "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)" }~ +** Processing line: ~ outputs.labels << { x: 900, y: 60, text: "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)" }~ +** Processing line: ~ outputs.labels << { x: 900, y: 30, text: "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)" }~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -186301,10 +203945,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # the next new touch will be finger_one again, but until then, new touches~ ** Processing line: ~ # don't fill in earlier slots.~ ** Processing line: ~ if !args.inputs.finger_one.nil?~ -** Processing line: ~ args.outputs.primitives << [640, 650, "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).", 5, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.primitives << { x: 640, y: 650, text: "Finger #1 is touching at (#{args.inputs.finger_one.x}, #{args.inputs.finger_one.y}).",~ +** Processing line: ~ size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ ** Processing line: ~ end~ ** Processing line: ~ if !args.inputs.finger_two.nil?~ -** Processing line: ~ args.outputs.primitives << [640, 600, "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).", 5, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.primitives << { x: 640, y: 600, text: "Finger #2 is touching at (#{args.inputs.finger_two.x}, #{args.inputs.finger_two.y}).",~ +** Processing line: ~ size_enum: 5, alignment_enum: 1, r: 255, g: 255, b: 255 }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Here's the more flexible interface: this will report as many simultaneous~ @@ -186325,12 +203971,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ r = (color & 0xFF0000) >> 16~ ** Processing line: ~ g = (color & 0x00FF00) >> 8~ ** Processing line: ~ b = (color & 0x0000FF)~ -** Processing line: ~ args.outputs.primitives << [v.x - (size / 2), v.y + (size / 2), size, size, r, g, b, 255].solid~ -** Processing line: ~ args.outputs.primitives << [v.x, v.y + size, k.to_s, 0, 1, 0, 0, 0].label~ +** Processing line: ~ args.outputs.primitives << { x: v.x - (size / 2), y: v.y + (size / 2), w: size, h: size, r: r, g: g, b: b, a: 255 }.solid!~ +** Processing line: ~ args.outputs.primitives << { x: v.x, y: v.y + size, text: k.to_s, alignment_enum: 1 }.label!~ ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ @@ -186384,6 +204029,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # in this tick "entry point": `looping_animation`, and the~ ** Processing line: ~ # second method is `one_time_animation`.~ ** Processing line: ~ def tick args~ +** Processing line: ~ # uncomment the line below to see animation play out in slow motion~ +** Processing line: ~ # args.gtk.slowmo! 6~ ** Processing line: ~ looping_animation args~ ** Processing line: ~ one_time_animation args~ ** Processing line: ~ end~ @@ -186416,22 +204063,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ does_sprite_loop~ ** Processing line: ~~ ** Processing line: ~ # Now that we have `sprite_index, we can present the correct file.~ -** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 100, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" }~ ** Processing line: ~~ ** Processing line: ~ # Try changing the numbers below to see how the animation changes:~ -** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 200, w: 100, h: 100, path: "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png" }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # This function shows how to animate a sprite that executes~ ** Processing line: ~ # only once when the "f" key is pressed.~ ** Processing line: ~ def one_time_animation args~ ** Processing line: ~ # This is just a label the shows instructions within the game.~ -** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ +** Processing line: ~ args.outputs.labels << { x: 220, y: 350, text: "(press f to animate)" }~ ** Processing line: ~~ ** Processing line: ~ # If "f" is pressed on the keyboard...~ ** Processing line: ~ if args.inputs.keyboard.key_down.f~ ** Processing line: ~ # Print the frame that "f" was pressed on.~ -** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ +** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.state.tick_count}"~ ** Processing line: ~~ ** Processing line: ~ # And MOST IMPORTANTLY set the point it time to start the animation,~ ** Processing line: ~ # equal to "now" which is represented as args.state.tick_count.~ @@ -186464,7 +204111,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ sprite_index ||= 0~ ** Processing line: ~~ ** Processing line: ~ # Present the sprite.~ -** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~ args.outputs.sprites << { x: 100, y: 300, w: 100, h: 100, path: "sprites/dragon_fly_#{sprite_index}.png" }~ ** Processing line: ~~ ** Processing line: ~ tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time."~ ** Processing line: ~ end~ @@ -188592,9 +206239,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ mouse_overlay = mouse_overlay.merge r: 255 if state.delete_mode~ ** Processing line: ~~ ** Processing line: ~ if state.mouse_held~ -** Processing line: ~ outputs.primitives << mouse_overlay.border~ +** Processing line: ~ outputs.primitives << mouse_overlay.border!~ ** Processing line: ~ else~ -** Processing line: ~ outputs.primitives << mouse_overlay.solid~ +** Processing line: ~ outputs.primitives << mouse_overlay.solid!~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -188658,7 +206305,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def calc_below~ ** Processing line: ~ return unless player.dy <= 0~ -** Processing line: ~ tiles_below = find_tiles { |t| t.rect.top <= player.y }~ +** Processing line: ~ tiles_below = find_tiles { |t| t.rect.top <= player.prev_rect.y }~ ** Processing line: ~ collision = find_colliding_tile tiles_below, (player.rect.merge y: player.next_rect.y)~ ** Processing line: ~ return unless collision~ ** Processing line: ~ if collision.neighbors.b == :none && player.jumped_down_at.elapsed_time < 10~ @@ -188689,7 +206336,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def calc_above~ ** Processing line: ~ return unless player.dy > 0~ -** Processing line: ~ tiles_above = find_tiles { |t| t.rect.y >= player.y }~ +** Processing line: ~ tiles_above = find_tiles { |t| t.rect.y >= player.prev_rect.y }~ ** Processing line: ~ collision = find_colliding_tile tiles_above, (player.rect.merge y: player.next_rect.y)~ ** Processing line: ~ return unless collision~ ** Processing line: ~ return if collision.neighbors.t == :none~ @@ -188698,17 +206345,17 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def calc_player_dx~ -** Processing line: ~ player.y += player.dy~ -** Processing line: ~ player.dy += state.gravity~ -** Processing line: ~ player.dy += player.dy * state.drag ** 2 * -1~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_player_dy~ ** Processing line: ~ player.dx = player.dx.clamp(-5, 5)~ ** Processing line: ~ player.dx *= 0.9~ ** Processing line: ~ player.x += player.dx~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def calc_player_dy~ +** Processing line: ~ player.y += player.dy~ +** Processing line: ~ player.dy += state.gravity~ +** Processing line: ~ player.dy += player.dy * state.drag ** 2 * -1~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def reset_player~ ** Processing line: ~ player.x = 100~ ** Processing line: ~ player.y = 720~ @@ -188867,8 +206514,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ input~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values~ -** Processing line: ~ def defaults~ +** Processing line: ~ def init_game~ ** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ ** Processing line: ~ new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil),~ ** Processing line: ~ new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher~ @@ -188891,6 +206537,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too)~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Sets default values~ +** Processing line: ~ def defaults~ +** Processing line: ~ init_game~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ # Outputs objects onto the screen~ ** Processing line: ~ def render~ ** Processing line: ~ outputs.solids << s.platforms.map do |p| # outputs platforms onto screen~ @@ -188978,7 +206629,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ rect: nil)~ ** Processing line: ~ end~ ** Processing line: ~ else~ +** Processing line: ~ # game over~ ** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ +** Processing line: ~ init_game~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -191994,12 +209647,23 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # Starts the game with player x's turn and creates an array (to_a) for space combinations.~ ** Processing line: ~ # Calls methods necessary for the game to run properly.~ ** Processing line: ~ def tick~ -** Processing line: ~ state.current_turn ||= :x~ -** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ +** Processing line: ~ init_new_game~ ** Processing line: ~ render_board~ ** Processing line: ~ input_board~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def init_new_game~ +** Processing line: ~ state.current_turn ||= :x~ +** Processing line: ~ state.space_combinations ||= [-1, 0, 1].product([-1, 0, 1]).to_a~ +** Processing line: ~~ +** Processing line: ~ state.spaces ||= {}~ +** Processing line: ~~ +** Processing line: ~ state.space_combinations.each do |x, y|~ +** Processing line: ~ state.spaces[x] ||= {}~ +** Processing line: ~ state.spaces[x][y] ||= state.new_entity(:space)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ ** Processing line: ~ def render_board~ ** Processing line: ~ square_size = 80~ @@ -192075,6 +209739,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def input_restart_game~ ** Processing line: ~ return unless state.game_over~ ** Processing line: ~ gtk.reset~ +** Processing line: ~ init_new_game~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Checks if x or o won the game.~ @@ -192406,7 +210071,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def calc_kill_zombie~ ** Processing line: ~~ ** Processing line: ~ # Find all zombies that intersect with the player. They are considered killed.~ -** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ +** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite && (z.sprite.intersect_rect? state.player_sprite) }~ ** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ ** Processing line: ~ state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies~ ** Processing line: ~~ @@ -193281,6 +210946,1201 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Audio - Audio Mixer - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Audio Mixer - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Audio Mixer - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_audio/01_audio_mixer/app/main.rb~ +** Processing line: ~ # these are the properties that you can sent on args.audio~ +** Processing line: ~ def spawn_new_sound args, name, path~ +** Processing line: ~ # Spawn randomly in an area that won't be covered by UI.~ +** Processing line: ~ screenx = (rand * 600.0) + 200.0~ +** Processing line: ~ screeny = (rand * 400.0) + 100.0~ +** Processing line: ~~ +** Processing line: ~ id = new_sound_id! args~ +** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ +** Processing line: ~ # actual screen position in here for convenience.~ +** Processing line: ~ args.audio[id] = {~ +** Processing line: ~ name: name,~ +** Processing line: ~ input: path,~ +** Processing line: ~ screenx: screenx,~ +** Processing line: ~ screeny: screeny,~ +** Processing line: ~ x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ +** Processing line: ~ y: ((screeny / 719.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range~ +** Processing line: ~ z: 0.0,~ +** Processing line: ~ gain: 1.0,~ +** Processing line: ~ pitch: 1.0,~ +** Processing line: ~ looping: true,~ +** Processing line: ~ paused: false~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ args.state.selected = id~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # these are values you can change on the ~args.audio~ data structure~ +** Processing line: ~ def input_panel args~ +** Processing line: ~ return unless args.state.panel~ +** Processing line: ~ return if args.state.dragging~ +** Processing line: ~~ +** Processing line: ~ audio_entry = args.audio[args.state.selected]~ +** Processing line: ~ results = args.state.panel~ +** Processing line: ~~ +** Processing line: ~ if args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.pitch_slider_rect.rect)~ +** Processing line: ~ audio_entry.pitch = 2.0 * ((args.inputs.mouse.x - results.pitch_slider_rect.x).to_f / (results.pitch_slider_rect.w - 1.0))~ +** Processing line: ~ elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.playtime_slider_rect.rect)~ +** Processing line: ~ audio_entry.playtime = audio_entry.length_ * ((args.inputs.mouse.x - results.playtime_slider_rect.x).to_f / (results.playtime_slider_rect.w - 1.0))~ +** Processing line: ~ elsif args.state.mouse_state == :held && args.inputs.mouse.position.inside_rect?(results.gain_slider_rect.rect)~ +** Processing line: ~ audio_entry.gain = (args.inputs.mouse.x - results.gain_slider_rect.x).to_f / (results.gain_slider_rect.w - 1.0)~ +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.looping_checkbox_rect.rect)~ +** Processing line: ~ audio_entry.looping = !audio_entry.looping~ +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.paused_checkbox_rect.rect)~ +** Processing line: ~ audio_entry.paused = !audio_entry.paused~ +** Processing line: ~ elsif args.inputs.mouse.click && args.inputs.mouse.position.inside_rect?(results.delete_button_rect.rect)~ +** Processing line: ~ args.audio.delete args.state.selected~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_sources args~ +** Processing line: ~ args.outputs.primitives << args.audio.keys.map do |k|~ +** Processing line: ~ s = args.audio[k]~ +** Processing line: ~~ +** Processing line: ~ isselected = (k == args.state.selected)~ +** Processing line: ~~ +** Processing line: ~ color = isselected ? [ 0, 255, 0, 255 ] : [ 0, 0, 255, 255 ]~ +** Processing line: ~ [~ +** Processing line: ~ [s.screenx, s.screeny, args.state.boxsize, args.state.boxsize, *color].solid,~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ x: s.screenx + args.state.boxsize.half,~ +** Processing line: ~ y: s.screeny,~ +** Processing line: ~ text: s.name,~ +** Processing line: ~ r: 255,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ alignment_enum: 1~ +** Processing line: ~ }.label!~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def playtime_str t~ +** Processing line: ~ return "" unless t~ +** Processing line: ~ minutes = (t / 60.0).floor~ +** Processing line: ~ seconds = t - (minutes * 60.0).to_f~ +** Processing line: ~ return minutes.to_s + ':' + seconds.floor.to_s + ((seconds - seconds.floor).to_s + "000")[1..3]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def label_with_drop_shadow x, y, text~ +** Processing line: ~ [~ +** Processing line: ~ { x: x + 1, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!,~ +** Processing line: ~ { x: x + 2, y: y + 0, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 0, g: 0, b: 0 }.label!,~ +** Processing line: ~ { x: x + 0, y: y + 1, text: text, vertical_alignment_enum: 1, alignment_enum: 1, r: 200, g: 200, b: 200 }.label!~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def check_box opts = {}~ +** Processing line: ~ checkbox_template = opts.args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +** Processing line: ~ final_rect = checkbox_template.center_inside_rect_y(opts.args.layout.rect(row: opts.row, col: opts.col))~ +** Processing line: ~ color = { r: 0, g: 0, b: 0 }~ +** Processing line: ~ color = { r: 255, g: 255, b: 255 } if opts.checked~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ rect: final_rect,~ +** Processing line: ~ primitives: [~ +** Processing line: ~ (final_rect.to_solid color)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def progress_bar opts = {}~ +** Processing line: ~ outer_rect = opts.args.layout.rect(row: opts.row, col: opts.col, w: 5, h: 1)~ +** Processing line: ~ color = opts.percentage * 255~ +** Processing line: ~ baseline_progress_bar = opts.args~ +** Processing line: ~ .layout~ +** Processing line: ~ .rect(w: 5, h: 0.5)~ +** Processing line: ~~ +** Processing line: ~ final_rect = baseline_progress_bar.center_inside_rect(outer_rect)~ +** Processing line: ~ center = final_rect.rect_center_point~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ rect: final_rect,~ +** Processing line: ~ primitives: [~ +** Processing line: ~ final_rect.merge(r: color, g: color, b: color, a: 128).solid!,~ +** Processing line: ~ label_with_drop_shadow(center.x, center.y, opts.text)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def panel_primitives args, audio_entry~ +** Processing line: ~ results = { primitives: [] }~ +** Processing line: ~~ +** Processing line: ~ return results unless audio_entry~ +** Processing line: ~~ +** Processing line: ~ # this uses DRGTK's layout apis to layout the controls~ +** Processing line: ~ # imagine the screen is split into equal cells (24 cells across, 12 cells up and down)~ +** Processing line: ~ # args.layout.rect returns a hash which we merge values with to create primitives~ +** Processing line: ~ # using args.layout.rect removes the need for pixel pushing~ +** Processing line: ~~ +** Processing line: ~ # args.outputs.debug << args.layout.debug_primitives(r: 255, g: 255, b: 255)~ +** Processing line: ~~ +** Processing line: ~ white_color = { r: 255, g: 255, b: 255 }~ +** Processing line: ~ label_style = white_color.merge(vertical_alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ # panel background~ +** Processing line: ~ results.primitives << args.layout.rect(row: 0, col: 0, w: 7, h: 6, include_col_gutter: true, include_row_gutter: true)~ +** Processing line: ~ .border!(r: 255, g: 255, b: 255)~ +** Processing line: ~~ +** Processing line: ~ # title~ +** Processing line: ~ results.primitives << args.layout.point(row: 0, col: 3.5, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "Source #{args.state.selected} (#{args.audio[args.state.selected].name})",~ +** Processing line: ~ size_enum: 3,~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ # seperator line~ +** Processing line: ~ results.primitives << args.layout.rect(row: 1, col: 0, w: 7, h: 0)~ +** Processing line: ~ .line!(white_color)~ +** Processing line: ~~ +** Processing line: ~ # screen location~ +** Processing line: ~ results.primitives << args.layout.point(row: 1.0, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "screen:")~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 1.0, col: 2, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "(#{audio_entry.screenx.to_i}, #{audio_entry.screeny.to_i})")~ +** Processing line: ~~ +** Processing line: ~ # position~ +** Processing line: ~ results.primitives << args.layout.point(row: 1.5, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "position:")~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 1.5, col: 2, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "(#{audio_entry[:x].round(5).to_s[0..6]}, #{audio_entry[:y].round(5).to_s[0..6]})")~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 2.0, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "pitch:")~ +** Processing line: ~~ +** Processing line: ~ results.pitch_slider_rect = progress_bar(row: 2.0, col: 2,~ +** Processing line: ~ percentage: audio_entry.pitch / 2.0,~ +** Processing line: ~ text: "#{audio_entry.pitch.to_sf}",~ +** Processing line: ~ args: args)~ +** Processing line: ~~ +** Processing line: ~ results.primitives << results.pitch_slider_rect.primitives~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 2.5, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "playtime:")~ +** Processing line: ~~ +** Processing line: ~ results.playtime_slider_rect = progress_bar(args: args,~ +** Processing line: ~ row: 2.5,~ +** Processing line: ~ col: 2,~ +** Processing line: ~ percentage: (audio_entry.playtime || 1) / (audio_entry.length_ || 1),~ +** Processing line: ~ text: "#{playtime_str(audio_entry.playtime)} / #{playtime_str(audio_entry.length_)}")~ +** Processing line: ~~ +** Processing line: ~ results.primitives << results.playtime_slider_rect.primitives~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 3.0, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "gain:")~ +** Processing line: ~~ +** Processing line: ~ results.gain_slider_rect = progress_bar(args: args,~ +** Processing line: ~ row: 3.0,~ +** Processing line: ~ col: 2,~ +** Processing line: ~ percentage: audio_entry.gain,~ +** Processing line: ~ text: "#{audio_entry.gain.to_sf}")~ +** Processing line: ~~ +** Processing line: ~ results.primitives << results.gain_slider_rect.primitives~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 3.5, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "looping:")~ +** Processing line: ~~ +** Processing line: ~ checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +** Processing line: ~~ +** Processing line: ~ results.looping_checkbox_rect = check_box(args: args, row: 3.5, col: 2, checked: audio_entry.looping)~ +** Processing line: ~ results.primitives << results.looping_checkbox_rect.primitives~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 4.0, col: 0, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "paused:")~ +** Processing line: ~~ +** Processing line: ~ checkbox_template = args.layout.rect(w: 0.5, h: 0.5, col: 2)~ +** Processing line: ~~ +** Processing line: ~ results.paused_checkbox_rect = check_box(args: args, row: 4.0, col: 2, checked: !audio_entry.paused)~ +** Processing line: ~ results.primitives << results.paused_checkbox_rect.primitives~ +** Processing line: ~~ +** Processing line: ~ results.delete_button_rect = { rect: args.layout.rect(row: 5, col: 0, w: 7, h: 1) }~ +** Processing line: ~~ +** Processing line: ~ results.primitives << results.delete_button_rect.to_solid(r: 180)~ +** Processing line: ~~ +** Processing line: ~ results.primitives << args.layout.point(row: 5, col: 3.5, row_anchor: 0.5)~ +** Processing line: ~ .merge(label_style)~ +** Processing line: ~ .merge(text: "DELETE", alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ return results~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_panel args~ +** Processing line: ~ args.state.panel = nil~ +** Processing line: ~ audio_entry = args.audio[args.state.selected]~ +** Processing line: ~ return unless audio_entry~ +** Processing line: ~~ +** Processing line: ~ mouse_down = (args.state.mouse_held >= 0)~ +** Processing line: ~ args.state.panel = panel_primitives args, audio_entry~ +** Processing line: ~ args.outputs.primitives << args.state.panel.primitives~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_sound_id! args~ +** Processing line: ~ args.state.sound_id ||= 0~ +** Processing line: ~ args.state.sound_id += 1~ +** Processing line: ~ args.state.sound_id~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_launcher args~ +** Processing line: ~ args.outputs.primitives << args.state.spawn_sound_buttons.map(&:primitives)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_ui args~ +** Processing line: ~ render_launcher args~ +** Processing line: ~ render_panel args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ input args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input args~ +** Processing line: ~ if !args.audio[args.state.selected]~ +** Processing line: ~ args.state.selected = nil~ +** Processing line: ~ args.state.dragging = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # spawn button and node interaction~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ spawn_sound_button = args.state.spawn_sound_buttons.find { |b| args.inputs.mouse.inside_rect? b.rect }~ +** Processing line: ~~ +** Processing line: ~ audio_click_key, audio_click_value = args.audio.find do |k, v|~ +** Processing line: ~ args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if spawn_sound_button~ +** Processing line: ~ args.state.selected = nil~ +** Processing line: ~ spawn_new_sound args, spawn_sound_button.name, spawn_sound_button.path~ +** Processing line: ~ elsif audio_click_key~ +** Processing line: ~ args.state.selected = audio_click_key~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.mouse_state == :held && args.state.selected~ +** Processing line: ~ v = args.audio[args.state.selected]~ +** Processing line: ~ if args.inputs.mouse.inside_rect? [v.screenx, v.screeny, args.state.boxsize, args.state.boxsize]~ +** Processing line: ~ args.state.dragging = args.state.selected~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.dragging~ +** Processing line: ~ s = args.audio[args.state.selected]~ +** Processing line: ~ # you can hang anything on the audio hashes you want, so we store the~ +** Processing line: ~ # actual screen position so it doesn't scale weirdly vs your mouse.~ +** Processing line: ~ s.screenx = args.inputs.mouse.x - (args.state.boxsize / 2)~ +** Processing line: ~ s.screeny = args.inputs.mouse.y - (args.state.boxsize / 2)~ +** Processing line: ~~ +** Processing line: ~ s.screeny = 50 if s.screeny < 50~ +** Processing line: ~ s.screeny = (719 - args.state.boxsize) if s.screeny > (719 - args.state.boxsize)~ +** Processing line: ~ s.screenx = 0 if s.screenx < 0~ +** Processing line: ~ s.screenx = (1279 - args.state.boxsize) if s.screenx > (1279 - args.state.boxsize)~ +** Processing line: ~~ +** Processing line: ~ s.x = ((s.screenx / 1279.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ +** Processing line: ~ s.y = ((s.screeny / 719.0) * 2.0) - 1.0 # scale to -1.0 - 1.0 range~ +** Processing line: ~ end~ +** Processing line: ~ elsif args.state.mouse_state == :released~ +** Processing line: ~ args.state.dragging = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ input_panel args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.state.mouse_state ||= :released~ +** Processing line: ~ args.state.dragging_source ||= false~ +** Processing line: ~ args.state.selected ||= 0~ +** Processing line: ~ args.state.next_sound_index ||= 0~ +** Processing line: ~ args.state.boxsize ||= 30~ +** Processing line: ~ args.state.sound_files ||= [~ +** Processing line: ~ { name: :tada, path: "sounds/tada.wav" },~ +** Processing line: ~ { name: :splash, path: "sounds/splash.wav" },~ +** Processing line: ~ { name: :drum, path: "sounds/drum.mp3" },~ +** Processing line: ~ { name: :spring, path: "sounds/spring.wav" },~ +** Processing line: ~ { name: :music, path: "sounds/music.ogg" }~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # generate buttons based off the sound collection above~ +** Processing line: ~ args.state.spawn_sound_buttons ||= begin~ +** Processing line: ~ # create a group of buttons~ +** Processing line: ~ # column centered (using col_offset to calculate the column offset)~ +** Processing line: ~ # where each item is 2 columns apart~ +** Processing line: ~ rects = args.layout.rect_group row: 11,~ +** Processing line: ~ col_offset: {~ +** Processing line: ~ count: args.state.sound_files.length,~ +** Processing line: ~ w: 2~ +** Processing line: ~ },~ +** Processing line: ~ dcol: 2,~ +** Processing line: ~ w: 2,~ +** Processing line: ~ h: 1,~ +** Processing line: ~ group: args.state.sound_files~ +** Processing line: ~~ +** Processing line: ~ # now that you have the rects~ +** Processing line: ~ # construct the metadata for the buttons~ +** Processing line: ~ rects.map do |rect|~ +** Processing line: ~ {~ +** Processing line: ~ rect: rect,~ +** Processing line: ~ name: rect.name,~ +** Processing line: ~ path: rect.path,~ +** Processing line: ~ primitives: [~ +** Processing line: ~ rect.to_border(r: 255, g: 255, b: 255),~ +** Processing line: ~ rect.to_label(x: rect.center_x,~ +** Processing line: ~ y: rect.center_y,~ +** Processing line: ~ text: "#{rect.name}",~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ vertical_alignment_enum: 1,~ +** Processing line: ~ r: 255, g: 255, b: 255)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.mouse.up~ +** Processing line: ~ args.state.mouse_state = :released~ +** Processing line: ~ args.state.dragging_source = false~ +** Processing line: ~ elsif args.inputs.mouse.down~ +** Processing line: ~ args.state.mouse_state = :held~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.background_color = [ 0, 0, 0, 255 ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render args~ +** Processing line: ~ render_ui args~ +** Processing line: ~ render_sources args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Advanced Audio - Audio Mixer - server_ip_address.txt~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Audio Mixer - server_ip_address.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Audio Mixer - server_ip_address.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_audio/01_audio_mixer/app/server_ip_address.txt~ +** Processing line: ~ 192.168.1.65~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Advanced Audio - Sound Synthesis - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Sound Synthesis - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Audio - Sound Synthesis - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_audio/02_sound_synthesis/app/main.rb~ +** Processing line: ~ begin # region: top level tick methods~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ input args~ +** Processing line: ~ process_audio_queue args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.state.sine_waves ||= {}~ +** Processing line: ~ args.state.square_waves ||= {}~ +** Processing line: ~ args.state.saw_tooth_waves ||= {}~ +** Processing line: ~ args.state.triangle_waves ||= {}~ +** Processing line: ~ args.state.audio_queue ||= []~ +** Processing line: ~ args.state.buttons ||= [~ +** Processing line: ~ (frequency_buttons args),~ +** Processing line: ~ (sine_wave_note_buttons args),~ +** Processing line: ~ (bell_buttons args),~ +** Processing line: ~ (square_wave_note_buttons args),~ +** Processing line: ~ (saw_tooth_wave_note_buttons args),~ +** Processing line: ~ (triangle_wave_note_buttons args),~ +** Processing line: ~ ].flatten~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render args~ +** Processing line: ~ args.outputs.borders << args.state.buttons.map { |b| b[:border] }~ +** Processing line: ~ args.outputs.labels << args.state.buttons.map { |b| b[:label] }~ +** Processing line: ~ args.outputs.labels << args.layout~ +** Processing line: ~ .rect(row: 0, col: 11.5)~ +** Processing line: ~ .yield_self { |r| r.merge y: r.y + r.h }~ +** Processing line: ~ .merge(text: "This is a Pro only feature. Click here to watch the YouTube video if you are on the Standard License.",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ def input args~ +** Processing line: ~ args.state.buttons.each do |b|~ +** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? b[:rect])~ +** Processing line: ~ parameter_string = (b.slice :frequency, :note, :octave).map { |k, v| "#{k}: #{v}" }.join ", "~ +** Processing line: ~ args.gtk.notify! "#{b[:method_to_call]} #{parameter_string}"~ +** Processing line: ~ send b[:method_to_call], args, b~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.mouse.click && (args.inputs.mouse.click.inside_rect? (args.layout.rect(row: 0).yield_self { |r| r.merge y: r.y + r.h.half, h: r.h.half }))~ +** Processing line: ~ args.gtk.openurl 'https://www.youtube.com/watch?v=zEzovM5jT-k&ab_channel=AmirRajan'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_audio_queue args~ +** Processing line: ~ to_queue = args.state.audio_queue.find_all { |v| v[:queue_at] <= args.tick_count }~ +** Processing line: ~ args.state.audio_queue -= to_queue~ +** Processing line: ~ to_queue.each { |a| args.audio[a[:id]] = a }~ +** Processing line: ~~ +** Processing line: ~ args.audio.find_all { |k, v| v[:decay_rate] }~ +** Processing line: ~ .each { |k, v| v[:gain] -= v[:decay_rate] }~ +** Processing line: ~~ +** Processing line: ~ sounds_to_stop = args.audio~ +** Processing line: ~ .find_all { |k, v| v[:stop_at] && args.state.tick_count >= v[:stop_at] }~ +** Processing line: ~ .map { |k, v| k }~ +** Processing line: ~~ +** Processing line: ~ sounds_to_stop.each { |k| args.audio.delete k }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: button definitions, ui layout, callback functions~ +** Processing line: ~ def button args, opts~ +** Processing line: ~ button_def = opts.merge rect: (args.layout.rect (opts.merge w: 2, h: 1))~ +** Processing line: ~~ +** Processing line: ~ button_def[:border] = button_def[:rect].merge r: 0, g: 0, b: 0~ +** Processing line: ~~ +** Processing line: ~ label_offset_x = 5~ +** Processing line: ~ label_offset_y = 30~ +** Processing line: ~~ +** Processing line: ~ button_def[:label] = button_def[:rect].merge text: opts[:text],~ +** Processing line: ~ size_enum: -2.5,~ +** Processing line: ~ x: button_def[:rect].x + label_offset_x,~ +** Processing line: ~ y: button_def[:rect].y + label_offset_y~ +** Processing line: ~~ +** Processing line: ~ button_def~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def play_sine_wave args, sender~ +** Processing line: ~ queue_sine_wave args,~ +** Processing line: ~ frequency: sender[:frequency],~ +** Processing line: ~ duration: 1.seconds,~ +** Processing line: ~ fade_out: true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def play_note args, sender~ +** Processing line: ~ method_to_call = :queue_sine_wave~ +** Processing line: ~ method_to_call = :queue_square_wave if sender[:type] == :square~ +** Processing line: ~ method_to_call = :queue_saw_tooth_wave if sender[:type] == :saw_tooth~ +** Processing line: ~ method_to_call = :queue_triangle_wave if sender[:type] == :triangle~ +** Processing line: ~ method_to_call = :queue_bell if sender[:type] == :bell~ +** Processing line: ~~ +** Processing line: ~ send method_to_call, args,~ +** Processing line: ~ frequency: (frequency_for note: sender[:note], octave: sender[:octave]),~ +** Processing line: ~ duration: 1.seconds,~ +** Processing line: ~ fade_out: true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def frequency_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.0, col: 0, text: "300hz",~ +** Processing line: ~ frequency: 300,~ +** Processing line: ~ method_to_call: :play_sine_wave),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.0, col: 0, text: "400hz",~ +** Processing line: ~ frequency: 400,~ +** Processing line: ~ method_to_call: :play_sine_wave),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.0, col: 0, text: "500hz",~ +** Processing line: ~ frequency: 500,~ +** Processing line: ~ method_to_call: :play_sine_wave),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def sine_wave_note_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 1.5, col: 2, text: "Sine C4",~ +** Processing line: ~ note: :c, octave: 4, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 2.5, col: 2, text: "Sine D4",~ +** Processing line: ~ note: :d, octave: 4, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 3.5, col: 2, text: "Sine E4",~ +** Processing line: ~ note: :e, octave: 4, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.5, col: 2, text: "Sine F4",~ +** Processing line: ~ note: :f, octave: 4, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.5, col: 2, text: "Sine G4",~ +** Processing line: ~ note: :g, octave: 4, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.5, col: 2, text: "Sine A5",~ +** Processing line: ~ note: :a, octave: 5, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 7.5, col: 2, text: "Sine B5",~ +** Processing line: ~ note: :b, octave: 5, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 8.5, col: 2, text: "Sine C5",~ +** Processing line: ~ note: :c, octave: 5, type: :sine, method_to_call: :play_note),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def square_wave_note_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 1.5, col: 6, text: "Square C4",~ +** Processing line: ~ note: :c, octave: 4, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 2.5, col: 6, text: "Square D4",~ +** Processing line: ~ note: :d, octave: 4, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 3.5, col: 6, text: "Square E4",~ +** Processing line: ~ note: :e, octave: 4, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.5, col: 6, text: "Square F4",~ +** Processing line: ~ note: :f, octave: 4, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.5, col: 6, text: "Square G4",~ +** Processing line: ~ note: :g, octave: 4, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.5, col: 6, text: "Square A5",~ +** Processing line: ~ note: :a, octave: 5, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 7.5, col: 6, text: "Square B5",~ +** Processing line: ~ note: :b, octave: 5, type: :square, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 8.5, col: 6, text: "Square C5",~ +** Processing line: ~ note: :c, octave: 5, type: :square, method_to_call: :play_note),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ def saw_tooth_wave_note_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 1.5, col: 8, text: "Saw C4",~ +** Processing line: ~ note: :c, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 2.5, col: 8, text: "Saw D4",~ +** Processing line: ~ note: :d, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 3.5, col: 8, text: "Saw E4",~ +** Processing line: ~ note: :e, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.5, col: 8, text: "Saw F4",~ +** Processing line: ~ note: :f, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.5, col: 8, text: "Saw G4",~ +** Processing line: ~ note: :g, octave: 4, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.5, col: 8, text: "Saw A5",~ +** Processing line: ~ note: :a, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 7.5, col: 8, text: "Saw B5",~ +** Processing line: ~ note: :b, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 8.5, col: 8, text: "Saw C5",~ +** Processing line: ~ note: :c, octave: 5, type: :saw_tooth, method_to_call: :play_note),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def triangle_wave_note_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 1.5, col: 10, text: "Triangle C4",~ +** Processing line: ~ note: :c, octave: 4, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 2.5, col: 10, text: "Triangle D4",~ +** Processing line: ~ note: :d, octave: 4, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 3.5, col: 10, text: "Triangle E4",~ +** Processing line: ~ note: :e, octave: 4, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.5, col: 10, text: "Triangle F4",~ +** Processing line: ~ note: :f, octave: 4, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.5, col: 10, text: "Triangle G4",~ +** Processing line: ~ note: :g, octave: 4, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.5, col: 10, text: "Triangle A5",~ +** Processing line: ~ note: :a, octave: 5, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 7.5, col: 10, text: "Triangle B5",~ +** Processing line: ~ note: :b, octave: 5, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 8.5, col: 10, text: "Triangle C5",~ +** Processing line: ~ note: :c, octave: 5, type: :triangle, method_to_call: :play_note),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def bell_buttons args~ +** Processing line: ~ [~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 1.5, col: 4, text: "Bell C4",~ +** Processing line: ~ note: :c, octave: 4, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 2.5, col: 4, text: "Bell D4",~ +** Processing line: ~ note: :d, octave: 4, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 3.5, col: 4, text: "Bell E4",~ +** Processing line: ~ note: :e, octave: 4, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 4.5, col: 4, text: "Bell F4",~ +** Processing line: ~ note: :f, octave: 4, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 5.5, col: 4, text: "Bell G4",~ +** Processing line: ~ note: :g, octave: 4, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 6.5, col: 4, text: "Bell A5",~ +** Processing line: ~ note: :a, octave: 5, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 7.5, col: 4, text: "Bell B5",~ +** Processing line: ~ note: :b, octave: 5, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ (button args,~ +** Processing line: ~ row: 8.5, col: 4, text: "Bell C5",~ +** Processing line: ~ note: :c, octave: 5, type: :bell, method_to_call: :play_note),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: wave generation~ +** Processing line: ~ begin # sine wave~ +** Processing line: ~ def defaults_sine_wave_for~ +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def sine_wave_for opts = {}~ +** Processing line: ~ opts = defaults_sine_wave_for.merge opts~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = opts[:sample_rate]~ +** Processing line: ~ period_size = (sample_rate.fdiv frequency).ceil~ +** Processing line: ~ period_size.map_with_index do |i|~ +** Processing line: ~ Math::sin((2.0 * Math::PI) / (sample_rate.to_f / frequency.to_f) * i)~ +** Processing line: ~ end.to_a~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_queue_sine_wave~ +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_sine_wave args, opts = {}~ +** Processing line: ~ opts = defaults_queue_sine_wave.merge opts~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = 48000~ +** Processing line: ~~ +** Processing line: ~ sine_wave = sine_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~ args.state.sine_waves[frequency] ||= sine_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~~ +** Processing line: ~ proc = lambda do~ +** Processing line: ~ generate_audio_data args.state.sine_waves[frequency], sample_rate~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ audio_state = new_audio_state args, opts~ +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: sine_wave~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: square wave~ +** Processing line: ~ def defaults_square_wave_for~ +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def square_wave_for opts = {}~ +** Processing line: ~ opts = defaults_square_wave_for.merge opts~ +** Processing line: ~ sine_wave = sine_wave_for opts~ +** Processing line: ~ sine_wave.map do |v|~ +** Processing line: ~ if v >= 0~ +** Processing line: ~ 1.0~ +** Processing line: ~ else~ +** Processing line: ~ -1.0~ +** Processing line: ~ end~ +** Processing line: ~ end.to_a~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_queue_square_wave~ +** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_square_wave args, opts = {}~ +** Processing line: ~ opts = defaults_queue_square_wave.merge opts~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = 48000~ +** Processing line: ~~ +** Processing line: ~ square_wave = square_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~ args.state.square_waves[frequency] ||= square_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~~ +** Processing line: ~ proc = lambda do~ +** Processing line: ~ generate_audio_data args.state.square_waves[frequency], sample_rate~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ audio_state = new_audio_state args, opts~ +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: square_wave~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: saw tooth wave~ +** Processing line: ~ def defaults_saw_tooth_wave_for~ +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def saw_tooth_wave_for opts = {}~ +** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ +** Processing line: ~ sine_wave = sine_wave_for opts~ +** Processing line: ~ period_size = sine_wave.length~ +** Processing line: ~ sine_wave.map_with_index do |v, i|~ +** Processing line: ~ (((i % period_size).fdiv period_size) * 2) - 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_queue_saw_tooth_wave~ +** Processing line: ~ { frequency: 440, duration: 60, gain: 0.3, fade_out: false, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_saw_tooth_wave args, opts = {}~ +** Processing line: ~ opts = defaults_queue_saw_tooth_wave.merge opts~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = 48000~ +** Processing line: ~~ +** Processing line: ~ saw_tooth_wave = saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~ args.state.saw_tooth_waves[frequency] ||= saw_tooth_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~~ +** Processing line: ~ proc = lambda do~ +** Processing line: ~ generate_audio_data args.state.saw_tooth_waves[frequency], sample_rate~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ audio_state = new_audio_state args, opts~ +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: saw_tooth_wave~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: triangle wave~ +** Processing line: ~ def defaults_triangle_wave_for~ +** Processing line: ~ { frequency: 440, sample_rate: 48000 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def triangle_wave_for opts = {}~ +** Processing line: ~ opts = defaults_saw_tooth_wave_for.merge opts~ +** Processing line: ~ sine_wave = sine_wave_for opts~ +** Processing line: ~ period_size = sine_wave.length~ +** Processing line: ~ sine_wave.map_with_index do |v, i|~ +** Processing line: ~ ratio = (i.fdiv period_size)~ +** Processing line: ~ if ratio <= 0.5~ +** Processing line: ~ (ratio * 4) - 1~ +** Processing line: ~ else~ +** Processing line: ~ ratio -= 0.5~ +** Processing line: ~ 1 - (ratio * 4)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_queue_triangle_wave~ +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_triangle_wave args, opts = {}~ +** Processing line: ~ opts = defaults_queue_triangle_wave.merge opts~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = 48000~ +** Processing line: ~~ +** Processing line: ~ triangle_wave = triangle_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~ args.state.triangle_waves[frequency] ||= triangle_wave_for frequency: frequency, sample_rate: sample_rate~ +** Processing line: ~~ +** Processing line: ~ proc = lambda do~ +** Processing line: ~ generate_audio_data args.state.triangle_waves[frequency], sample_rate~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ audio_state = new_audio_state args, opts~ +** Processing line: ~ audio_state[:input] = [1, sample_rate, proc]~ +** Processing line: ~ queue_audio args, audio_state: audio_state, wave: triangle_wave~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: bell~ +** Processing line: ~ def defaults_queue_bell~ +** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_bell args, opts = {}~ +** Processing line: ~ (bell_to_sine_waves (defaults_queue_bell.merge opts)).each { |b| queue_sine_wave args, b }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def bell_harmonics~ +** Processing line: ~ [~ +** Processing line: ~ { frequency_ratio: 0.5, duration_ratio: 1.00 },~ +** Processing line: ~ { frequency_ratio: 1.0, duration_ratio: 0.80 },~ +** Processing line: ~ { frequency_ratio: 2.0, duration_ratio: 0.60 },~ +** Processing line: ~ { frequency_ratio: 3.0, duration_ratio: 0.40 },~ +** Processing line: ~ { frequency_ratio: 4.2, duration_ratio: 0.25 },~ +** Processing line: ~ { frequency_ratio: 5.4, duration_ratio: 0.20 },~ +** Processing line: ~ { frequency_ratio: 6.8, duration_ratio: 0.15 }~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_bell_to_sine_waves~ +** Processing line: ~ { frequency: 440, duration: 1.seconds, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def bell_to_sine_waves opts = {}~ +** Processing line: ~ opts = defaults_bell_to_sine_waves.merge opts~ +** Processing line: ~ bell_harmonics.map do |b|~ +** Processing line: ~ {~ +** Processing line: ~ frequency: opts[:frequency] * b[:frequency_ratio],~ +** Processing line: ~ duration: opts[:duration] * b[:duration_ratio],~ +** Processing line: ~ queue_in: opts[:queue_in],~ +** Processing line: ~ gain: (1.fdiv bell_harmonics.length),~ +** Processing line: ~ fade_out: true~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # audio entity construction~ +** Processing line: ~ def generate_audio_data sine_wave, sample_rate~ +** Processing line: ~ sample_size = (sample_rate.fdiv (1000.fdiv 60)).ceil~ +** Processing line: ~ copy_count = (sample_size.fdiv sine_wave.length).ceil~ +** Processing line: ~ sine_wave * copy_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_new_audio_state~ +** Processing line: ~ { frequency: 440, duration: 60, gain: 1.0, fade_out: false, queue_in: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_audio_state args, opts = {}~ +** Processing line: ~ opts = defaults_new_audio_state.merge opts~ +** Processing line: ~ decay_rate = 0~ +** Processing line: ~ decay_rate = 1.fdiv(opts[:duration]) * opts[:gain] if opts[:fade_out]~ +** Processing line: ~ frequency = opts[:frequency]~ +** Processing line: ~ sample_rate = 48000~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ id: (new_id! args),~ +** Processing line: ~ frequency: frequency,~ +** Processing line: ~ sample_rate: 48000,~ +** Processing line: ~ stop_at: args.tick_count + opts[:queue_in] + opts[:duration],~ +** Processing line: ~ gain: opts[:gain].to_f,~ +** Processing line: ~ queue_at: args.state.tick_count + opts[:queue_in],~ +** Processing line: ~ decay_rate: decay_rate,~ +** Processing line: ~ pitch: 1.0,~ +** Processing line: ~ looping: true,~ +** Processing line: ~ paused: false~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_audio args, opts = {}~ +** Processing line: ~ graph_wave args, opts[:wave], opts[:audio_state][:frequency]~ +** Processing line: ~ args.state.audio_queue << opts[:audio_state]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_id! args~ +** Processing line: ~ args.state.audio_id ||= 0~ +** Processing line: ~ args.state.audio_id += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def graph_wave args, wave, frequency~ +** Processing line: ~ if args.state.tick_count != args.state.graphed_at~ +** Processing line: ~ args.outputs.static_lines.clear~ +** Processing line: ~ args.outputs.static_sprites.clear~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ wave = wave~ +** Processing line: ~~ +** Processing line: ~ r, g, b = frequency.to_i % 85,~ +** Processing line: ~ frequency.to_i % 170,~ +** Processing line: ~ frequency.to_i % 255~ +** Processing line: ~~ +** Processing line: ~ starting_rect = args.layout.rect(row: 5, col: 13)~ +** Processing line: ~ x_scale = 10~ +** Processing line: ~ y_scale = 100~ +** Processing line: ~ max_points = 25~ +** Processing line: ~~ +** Processing line: ~ points = wave~ +** Processing line: ~ if wave.length > max_points~ +** Processing line: ~ resolution = wave.length.idiv max_points~ +** Processing line: ~ points = wave.find_all.with_index { |y, i| (i % resolution == 0) }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.static_lines << points.map_with_index do |y, x|~ +** Processing line: ~ next_y = points[x + 1]~ +** Processing line: ~~ +** Processing line: ~ if next_y~ +** Processing line: ~ {~ +** Processing line: ~ x: starting_rect.x + (x * x_scale),~ +** Processing line: ~ y: starting_rect.y + starting_rect.h.half + y_scale * y,~ +** Processing line: ~ x2: starting_rect.x + ((x + 1) * x_scale),~ +** Processing line: ~ y2: starting_rect.y + starting_rect.h.half + y_scale * next_y,~ +** Processing line: ~ r: r,~ +** Processing line: ~ g: g,~ +** Processing line: ~ b: b~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.static_sprites << points.map_with_index do |y, x|~ +** Processing line: ~ {~ +** Processing line: ~ x: (starting_rect.x + (x * x_scale)) - 2,~ +** Processing line: ~ y: (starting_rect.y + starting_rect.h.half + y_scale * y) - 2,~ +** Processing line: ~ w: 4,~ +** Processing line: ~ h: 4,~ +** Processing line: ~ path: 'sprites/square-white.png',~ +** Processing line: ~ r: r,~ +** Processing line: ~ g: g,~ +** Processing line: ~ b: b~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.graphed_at = args.state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin # region: musical note mapping~ +** Processing line: ~ def defaults_frequency_for~ +** Processing line: ~ { note: :a, octave: 5, sharp: false, flat: false }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def frequency_for opts = {}~ +** Processing line: ~ opts = defaults_frequency_for.merge opts~ +** Processing line: ~ octave_offset_multiplier = opts[:octave] - 5~ +** Processing line: ~ note = note_frequencies_octave_5[opts[:note]]~ +** Processing line: ~ if octave_offset_multiplier < 0~ +** Processing line: ~ note = note * 1 / (octave_offset_multiplier.abs + 1)~ +** Processing line: ~ elsif octave_offset_multiplier > 0~ +** Processing line: ~ note = note * (octave_offset_multiplier.abs + 1) / 1~ +** Processing line: ~ end~ +** Processing line: ~ note~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def note_frequencies_octave_5~ +** Processing line: ~ {~ +** Processing line: ~ a: 440.0,~ +** Processing line: ~ a_sharp: 466.16, b_flat: 466.16,~ +** Processing line: ~ b: 493.88,~ +** Processing line: ~ c: 523.25,~ +** Processing line: ~ c_sharp: 554.37, d_flat: 587.33,~ +** Processing line: ~ d: 587.33,~ +** Processing line: ~ d_sharp: 622.25, e_flat: 659.25,~ +** Processing line: ~ e: 659.25,~ +** Processing line: ~ f: 698.25,~ +** Processing line: ~ f_sharp: 739.99, g_flat: 739.99,~ +** Processing line: ~ g: 783.99,~ +** Processing line: ~ g_sharp: 830.61, a_flat: 830.61~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Advanced Rendering - Labels With Wrapped Text - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Labels With Wrapped Text - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Labels With Wrapped Text - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/00_labels_with_wrapped_text/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # defaults~ +** Processing line: ~ args.state.scroll_location ||= 0~ +** Processing line: ~ args.state.textbox.messages ||= []~ +** Processing line: ~ args.state.textbox.scroll ||= 0~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0, 255]~ +** Processing line: ~ render_messages args~ +** Processing line: ~ render_instructions args~ +** Processing line: ~~ +** Processing line: ~ # inputs~ +** Processing line: ~ if args.inputs.keyboard.key_down.one~ +** Processing line: ~ queue_message args, "Hello there neighbour! my name is mark, how is your day today?"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.key_down.two~ +** Processing line: ~ queue_message args, "I'm doing great sir, actually I'm having a picnic today"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.key_down.three~ +** Processing line: ~ queue_message args, "Well that sounds wonderful!"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.key_down.home~ +** Processing line: ~ args.state.scroll_location = 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.key_down.delete~ +** Processing line: ~ clear_message_queue args~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_message args, msg~ +** Processing line: ~ args.state.textbox.messages.concat msg.wrapped_lines 50~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def clear_message_queue args~ +** Processing line: ~ args.state.textbox.messages = nil~ +** Processing line: ~ args.state.textbox.scroll = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_messages args~ +** Processing line: ~ args.outputs[:textbox].w = 400~ +** Processing line: ~ args.outputs[:textbox].h = 720~ +** Processing line: ~~ +** Processing line: ~ args.outputs.primitives << args.state.textbox.messages.each_with_index.map do |s, idx|~ +** Processing line: ~ {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20,~ +** Processing line: ~ text: s,~ +** Processing line: ~ size_enum: -3,~ +** Processing line: ~ alignment_enum: 0,~ +** Processing line: ~ r: 255, g:255, b: 255, a: 255~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs[:textbox].labels << args.state.textbox.messages.each_with_index.map do |s, idx|~ +** Processing line: ~ {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 20 * (args.state.textbox.messages.size - idx) + args.state.textbox.scroll * 20,~ +** Processing line: ~ text: s,~ +** Processing line: ~ size_enum: -3,~ +** Processing line: ~ alignment_enum: 0,~ +** Processing line: ~ r: 255, g:255, b: 255, a: 255~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs[:textbox].borders << [0, 0, args.outputs[:textbox].w, 720]~ +** Processing line: ~~ +** Processing line: ~ args.state.textbox.scroll += args.inputs.mouse.wheel.y unless args.inputs.mouse.wheel.nil?~ +** Processing line: ~~ +** Processing line: ~ if args.state.scroll_location > 0~ +** Processing line: ~ args.state.textbox.scroll = 0~ +** Processing line: ~ args.state.scroll_location = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << [900, 0, args.outputs[:textbox].w, 720, :textbox]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_instructions args~ +** Processing line: ~ args.outputs.labels << [30,~ +** Processing line: ~ 30.from_top,~ +** Processing line: ~ "press 1, 2, 3 to display messages, MOUSE WHEEL to scroll, HOME to go to top, BACKSPACE to delete.",~ +** Processing line: ~ 0, 255, 255]~ +** Processing line: ~~ +** Processing line: ~ args.outputs.primitives << [0, 55.from_top, 1280, 30, :pixel, 0, 255, 0, 0, 0].sprite~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Advanced Rendering - Rotating Label - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Rotating Label - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Rotating Label - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/00_rotating_label/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # set the render target width and height to match the label~ +** Processing line: ~ args.outputs[:scene].w = 220~ +** Processing line: ~ args.outputs[:scene].h = 30~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # make the background transparent~ +** Processing line: ~ args.outputs[:scene].background_color = [255, 255, 255, 0]~ +** Processing line: ~~ +** Processing line: ~ # set the blendmode of the label to 0 (no blending)~ +** Processing line: ~ # center it inside of the scene~ +** Processing line: ~ # set the vertical_alignment_enum to 1 (center)~ +** Processing line: ~ args.outputs[:scene].labels << { x: 0,~ +** Processing line: ~ y: 15,~ +** Processing line: ~ text: "label in render target",~ +** Processing line: ~ blendmode_enum: 0,~ +** Processing line: ~ vertical_alignment_enum: 1 }~ +** Processing line: ~~ +** Processing line: ~ # add a border to the render target~ +** Processing line: ~ args.outputs[:scene].borders << { x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: args.outputs[:scene].w,~ +** Processing line: ~ h: args.outputs[:scene].h }~ +** Processing line: ~~ +** Processing line: ~ # add the rendertarget to the main output as a sprite~ +** Processing line: ~ args.outputs.sprites << { x: 640 - args.outputs[:scene].w.half,~ +** Processing line: ~ y: 360 - args.outputs[:scene].h.half,~ +** Processing line: ~ w: args.outputs[:scene].w,~ +** Processing line: ~ h: args.outputs[:scene].h,~ +** Processing line: ~ angle: args.state.tick_count,~ +** Processing line: ~ path: :scene }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Advanced Rendering - Simple Render Targets - main.rb~ - H3 detected. - Determining if line is a header. @@ -194306,7 +213166,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ flip_horizontally: false,~ ** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ ** Processing line: ~ angle_anchor_y: 0.5~ -** Processing line: ~ }.sprite~ +** Processing line: ~ }.sprite!~ ** Processing line: ~~ ** Processing line: ~ # Outputs label as primitive using a hash~ ** Processing line: ~ args.outputs.primitives << {~ @@ -194320,7 +213180,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ b: 50,~ ** Processing line: ~ a: 255, # transparency~ ** Processing line: ~ font: "fonts/manaspc.ttf" # font style~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ ** Processing line: ~~ ** Processing line: ~ # Outputs solid as primitive using a hash~ ** Processing line: ~ args.outputs.primitives << {~ @@ -194332,7 +213192,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 50,~ ** Processing line: ~ b: 50,~ ** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.solid~ +** Processing line: ~ }.solid!~ ** Processing line: ~~ ** Processing line: ~ # Outputs border as primitive using a hash~ ** Processing line: ~ # Same parameters as solid~ @@ -194345,7 +213205,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 50,~ ** Processing line: ~ b: 50,~ ** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.border~ +** Processing line: ~ }.border!~ ** Processing line: ~~ ** Processing line: ~ # Outputs line as primitive using a hash~ ** Processing line: ~ args.outputs.primitives << {~ @@ -194357,7 +213217,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 50,~ ** Processing line: ~ b: 50,~ ** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -194426,6 +213286,120 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Rendering - Simple Camera - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Simple Camera - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Simple Camera - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/07_simple_camera/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # variables you can play around with~ +** Processing line: ~ args.state.world.w ||= 1280~ +** Processing line: ~ args.state.world.h ||= 720~ +** Processing line: ~~ +** Processing line: ~ args.state.player.x ||= 0~ +** Processing line: ~ args.state.player.y ||= 0~ +** Processing line: ~ args.state.player.size ||= 32~ +** Processing line: ~~ +** Processing line: ~ args.state.enemy.x ||= 700~ +** Processing line: ~ args.state.enemy.y ||= 700~ +** Processing line: ~ args.state.enemy.size ||= 16~ +** Processing line: ~~ +** Processing line: ~ args.state.camera.x ||= 640~ +** Processing line: ~ args.state.camera.y ||= 300~ +** Processing line: ~ args.state.camera.scale ||= 1.0~ +** Processing line: ~ args.state.camera.show_empty_space ||= :yes~ +** Processing line: ~~ +** Processing line: ~ # instructions~ +** Processing line: ~ args.outputs.primitives << { x: 0, y: 80.from_top, w: 360, h: 80, r: 0, g: 0, b: 0, a: 128 }.solid!~ +** Processing line: ~ args.outputs.primitives << { x: 10, y: 10.from_top, text: "arrow keys to move around", r: 255, g: 255, b: 255}.label!~ +** Processing line: ~ args.outputs.primitives << { x: 10, y: 30.from_top, text: "+/- to change zoom of camera", r: 255, g: 255, b: 255}.label!~ +** Processing line: ~ args.outputs.primitives << { x: 10, y: 50.from_top, text: "tab to change camera edge behavior", r: 255, g: 255, b: 255}.label!~ +** Processing line: ~~ +** Processing line: ~ # render scene~ +** Processing line: ~ args.outputs[:scene].w = args.state.world.w~ +** Processing line: ~ args.outputs[:scene].h = args.state.world.h~ +** Processing line: ~~ +** Processing line: ~ args.outputs[:scene].solids << { x: 0, y: 0, w: args.state.world.w, h: args.state.world.h, r: 20, g: 60, b: 80 }~ +** Processing line: ~ args.outputs[:scene].solids << { x: args.state.player.x, y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.size, h: args.state.player.size, r: 80, g: 155, b: 80 }~ +** Processing line: ~ args.outputs[:scene].solids << { x: args.state.enemy.x, y: args.state.enemy.y,~ +** Processing line: ~ w: args.state.enemy.size, h: args.state.enemy.size, r: 155, g: 80, b: 80 }~ +** Processing line: ~~ +** Processing line: ~ # render camera~ +** Processing line: ~ scene_position = calc_scene_position args~ +** Processing line: ~ args.outputs.sprites << { x: scene_position.x,~ +** Processing line: ~ y: scene_position.y,~ +** Processing line: ~ w: scene_position.w,~ +** Processing line: ~ h: scene_position.h,~ +** Processing line: ~ path: :scene }~ +** Processing line: ~~ +** Processing line: ~ # move player~ +** Processing line: ~ if args.inputs.directional_angle~ +** Processing line: ~ args.state.player.x += args.inputs.directional_angle.vector_x * 5~ +** Processing line: ~ args.state.player.y += args.inputs.directional_angle.vector_y * 5~ +** Processing line: ~ args.state.player.x = args.state.player.x.clamp(0, args.state.world.w - args.state.player.size)~ +** Processing line: ~ args.state.player.y = args.state.player.y.clamp(0, args.state.world.h - args.state.player.size)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # +/- to zoom in and out~ +** Processing line: ~ if args.inputs.keyboard.plus && args.state.tick_count.zmod?(3)~ +** Processing line: ~ args.state.camera.scale += 0.05~ +** Processing line: ~ elsif args.inputs.keyboard.hyphen && args.state.tick_count.zmod?(3)~ +** Processing line: ~ args.state.camera.scale -= 0.05~ +** Processing line: ~ elsif args.inputs.keyboard.key_down.tab~ +** Processing line: ~ if args.state.camera.show_empty_space == :yes~ +** Processing line: ~ args.state.camera.show_empty_space = :no~ +** Processing line: ~ else~ +** Processing line: ~ args.state.camera.show_empty_space = :yes~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.camera.scale = args.state.camera.scale.greater(0.1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_scene_position args~ +** Processing line: ~ result = { x: args.state.camera.x - (args.state.player.x * args.state.camera.scale),~ +** Processing line: ~ y: args.state.camera.y - (args.state.player.y * args.state.camera.scale),~ +** Processing line: ~ w: args.state.world.w * args.state.camera.scale,~ +** Processing line: ~ h: args.state.world.h * args.state.camera.scale,~ +** Processing line: ~ scale: args.state.camera.scale }~ +** Processing line: ~~ +** Processing line: ~ return result if args.state.camera.show_empty_space == :yes~ +** Processing line: ~~ +** Processing line: ~ if result.w < args.grid.w~ +** Processing line: ~ result.merge!(x: (args.grid.w - result.w).half)~ +** Processing line: ~ elsif (args.state.player.x * result.scale) < args.grid.w.half~ +** Processing line: ~ result.merge!(x: 10)~ +** Processing line: ~ elsif (result.x + result.w) < args.grid.w~ +** Processing line: ~ result.merge!(x: - result.w + (args.grid.w - 10))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if result.h < args.grid.h~ +** Processing line: ~ result.merge!(y: (args.grid.h - result.h).half)~ +** Processing line: ~ elsif (result.y) > 10~ +** Processing line: ~ result.merge!(y: 10)~ +** Processing line: ~ elsif (result.y + result.h) < args.grid.h~ +** Processing line: ~ result.merge!(y: - result.h + (args.grid.h - 10))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ result~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Advanced Rendering - Splitscreen Camera - main.rb~ - H3 detected. - Determining if line is a header. @@ -194441,7 +213415,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/07_advanced_rendering/07_splitscreen_camera/app/main.rb~ +** Processing line: ~ # ./samples/07_advanced_rendering/08_splitscreen_camera/app/main.rb~ ** Processing line: ~ class CameraMovement~ ** Processing line: ~ attr_accessor :state, :inputs, :outputs, :grid~ ** Processing line: ~~ @@ -194538,6 +213512,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ default_camera(0,0,1280,720)~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~ def new_room~ ** Processing line: ~ default_floor_tile(0,0,1024,1024,'sprites/rooms/camera_room.png')~ ** Processing line: ~ end~ @@ -194857,7 +213832,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/07_advanced_rendering/08_z_targeting_camera/app/main.rb~ +** Processing line: ~ # ./samples/07_advanced_rendering/09_z_targeting_camera/app/main.rb~ ** Processing line: ~ class Game~ ** Processing line: ~ attr_gtk~ ** Processing line: ~~ @@ -194969,6 +213944,144 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Rendering - Blend Modes - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Blend Modes - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Blend Modes - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/10_blend_modes/app/main.rb~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~ def draw_blendmode args, mode~ +** Processing line: ~ w = 160~ +** Processing line: ~ h = w~ +** Processing line: ~ args.state.x += (1280-w) / (args.state.blendmodes.length + 1)~ +** Processing line: ~ x = args.state.x~ +** Processing line: ~ y = (720 - h) / 2~ +** Processing line: ~ s = 'sprites/blue-feathered.png'~ +** Processing line: ~ args.outputs.sprites << { blendmode_enum: mode.value, x: x, y: y, w: w, h: h, path: s }~ +** Processing line: ~ args.outputs.labels << [x + (w/2), y, mode.name.to_s, 1, 1, 255, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~~ +** Processing line: ~ # Different blend modes do different things, depending on what they~ +** Processing line: ~ # blend against (in this case, the pixels of the background color).~ +** Processing line: ~ args.state.bg_element ||= 1~ +** Processing line: ~ args.state.bg_color ||= 255~ +** Processing line: ~ args.state.bg_color_direction ||= 1~ +** Processing line: ~ bg_r = (args.state.bg_element == 1) ? args.state.bg_color : 0~ +** Processing line: ~ bg_g = (args.state.bg_element == 2) ? args.state.bg_color : 0~ +** Processing line: ~ bg_b = (args.state.bg_element == 3) ? args.state.bg_color : 0~ +** Processing line: ~ args.state.bg_color += args.state.bg_color_direction~ +** Processing line: ~ if (args.state.bg_color_direction > 0) && (args.state.bg_color >= 255)~ +** Processing line: ~ args.state.bg_color_direction = -1~ +** Processing line: ~ args.state.bg_color = 255~ +** Processing line: ~ elsif (args.state.bg_color_direction < 0) && (args.state.bg_color <= 0)~ +** Processing line: ~ args.state.bg_color_direction = 1~ +** Processing line: ~ args.state.bg_color = 0~ +** Processing line: ~ args.state.bg_element += 1~ +** Processing line: ~ if args.state.bg_element >= 4~ +** Processing line: ~ args.state.bg_element = 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.background_color = [ bg_r, bg_g, bg_b, 255 ]~ +** Processing line: ~~ +** Processing line: ~ args.state.blendmodes ||= [~ +** Processing line: ~ { name: :none, value: 0 },~ +** Processing line: ~ { name: :blend, value: 1 },~ +** Processing line: ~ { name: :add, value: 2 },~ +** Processing line: ~ { name: :mod, value: 3 },~ +** Processing line: ~ { name: :mul, value: 4 }~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ args.state.x = 0 # reset this, draw_blendmode will increment it.~ +** Processing line: ~ args.state.blendmodes.each { |blendmode| draw_blendmode args, blendmode }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Advanced Rendering - Render Target Noclear - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Target Noclear - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Target Noclear - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/11_render_target_noclear/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.x ||= 500~ +** Processing line: ~ args.state.y ||= 350~ +** Processing line: ~ args.state.xinc ||= 7~ +** Processing line: ~ args.state.yinc ||= 7~ +** Processing line: ~ args.state.bgcolor ||= 1~ +** Processing line: ~ args.state.bginc ||= 1~ +** Processing line: ~~ +** Processing line: ~ # clear the render target on the first tick, and then never again. Draw~ +** Processing line: ~ # another box to it every tick, accumulating over time.~ +** Processing line: ~ clear_target = (args.state.tick_count == 0) || (args.inputs.keyboard.key_down.space)~ +** Processing line: ~ args.render_target(:accumulation).background_color = [ 0, 0, 0, 0 ];~ +** Processing line: ~ args.render_target(:accumulation).clear_before_render = clear_target~ +** Processing line: ~ args.render_target(:accumulation).solids << [args.state.x, args.state.y, 25, 25, 255, 0, 0, 255];~ +** Processing line: ~ args.state.x += args.state.xinc~ +** Processing line: ~ args.state.y += args.state.yinc~ +** Processing line: ~ args.state.bgcolor += args.state.bginc~ +** Processing line: ~~ +** Processing line: ~ # animation upkeep...change where we draw the next box and what color the~ +** Processing line: ~ # window background will be.~ +** Processing line: ~ if args.state.xinc > 0 && args.state.x >= 1280~ +** Processing line: ~ args.state.xinc = -7~ +** Processing line: ~ elsif args.state.xinc < 0 && args.state.x < 0~ +** Processing line: ~ args.state.xinc = 7~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.yinc > 0 && args.state.y >= 720~ +** Processing line: ~ args.state.yinc = -7~ +** Processing line: ~ elsif args.state.yinc < 0 && args.state.y < 0~ +** Processing line: ~ args.state.yinc = 7~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.bginc > 0 && args.state.bgcolor >= 255~ +** Processing line: ~ args.state.bginc = -1~ +** Processing line: ~ elsif args.state.bginc < 0 && args.state.bgcolor <= 0~ +** Processing line: ~ args.state.bginc = 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # clear the screen to a shade of blue and draw the render target, which~ +** Processing line: ~ # is not clearing every frame, on top of it. Note that you can NOT opt to~ +** Processing line: ~ # skip clearing the screen, only render targets. The screen clears every~ +** Processing line: ~ # frame; double-buffering would prevent correct updates between frames.~ +** Processing line: ~ args.outputs.background_color = [ 0, 0, args.state.bgcolor, 255 ]~ +** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, :accumulation ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Tweening Lerping Easing Functions - Easing Functions - main.rb~ - H3 detected. - Determining if line is a header. @@ -195534,7 +214647,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Sprites, Hashes"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195619,7 +214736,114 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Sprites, Open Entities"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Performance - Sprites As Struct - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Struct - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Struct - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/09_performance/03_sprites_as_struct/app/main.rb~ +** Processing line: ~ # create a Struct variant that allows for named parameters on construction.~ +** Processing line: ~ class NamedStruct < Struct~ +** Processing line: ~ def initialize **opts~ +** Processing line: ~ super(*members.map { |k| opts[k] })~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # create a Star NamedStruct~ +** Processing line: ~ Star = NamedStruct.new(:x, :y, :w, :h, :path, :s,~ +** Processing line: ~ :angle, :angle_anchor_x, :angle_anchor_y,~ +** Processing line: ~ :r, :g, :b, :a,~ +** Processing line: ~ :tile_x, :tile_y,~ +** Processing line: ~ :tile_w, :tile_h,~ +** Processing line: ~ :source_x, :source_y,~ +** Processing line: ~ :source_w, :source_h,~ +** Processing line: ~ :flip_horizontally, :flip_vertically,~ +** Processing line: ~ :blendmode_enum)~ +** Processing line: ~~ +** Processing line: ~ # Sprites represented as Structs. They require a little bit more code than Hashes,~ +** Processing line: ~ # but are the a little faster to render too.~ +** Processing line: ~ def random_x args~ +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def random_y args~ +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def random_speed~ +** Processing line: ~ 1 + (4.randomize :ratio)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_star args~ +** Processing line: ~ Star.new x: (random_x args),~ +** Processing line: ~ y: (random_y args),~ +** Processing line: ~ w: 4, h: 4,~ +** Processing line: ~ path: 'sprites/tiny-star.png',~ +** Processing line: ~ s: random_speed~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def move_star args, star~ +** Processing line: ~ star.x += star[:s]~ +** Processing line: ~ star.y += star[:s]~ +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ +** Processing line: ~ star.x = (random_x args)~ +** Processing line: ~ star.y = (random_y args)~ +** Processing line: ~ star[:s] = random_speed~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.star_count ||= 0~ +** Processing line: ~~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Sprites, Structs"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195662,7 +214886,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/04_sprites_as_strict_entities/app/main.rb~ ** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ ** Processing line: ~ # yields apis access similar to Entities, but all properties that can be set on the~ ** Processing line: ~ # entity must be predefined with a default value. Strict entities do not support the~ @@ -195708,7 +214932,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Sprites, Strict Entities"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195751,7 +214979,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/09_performance/04_sprites_as_classes/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/05_sprites_as_classes/app/main.rb~ ** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ ** Processing line: ~ # gives you full control of property declaration and method invocation.~ ** Processing line: ~ # They are more performant than OpenEntities and StrictEntities, but more code upfront.~ @@ -195780,6 +215008,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def tick args~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Sprites, Classes"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195822,7 +215055,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes/app/main.rb~ ** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ ** Processing line: ~ # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held~ ** Processing line: ~ # by reference. You get better performance, but you are mutating state of held objects~ @@ -195852,19 +215085,24 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def tick args~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Static Sprites, Classes"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # init~ ** Processing line: ~ if args.state.tick_count == 0~ ** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ +** Processing line: ~ args.outputs.static_sprites << args.state.stars~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # update~ ** Processing line: ~ args.state.stars.each(&:move)~ ** Processing line: ~~ ** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ ** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ ** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ @@ -195894,7 +215132,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/07_static_sprites_as_classes_with_custom_drawing/app/main.rb~ ** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ ** Processing line: ~ # is the fastest approach. This is comparable to what other game engines set as the default behavior.~ ** Processing line: ~ # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing~ @@ -195937,10 +215175,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ # path,~ ** Processing line: ~ # angle,~ ** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h,~ ** Processing line: ~ # flip_horizontally, flip_vertically,~ -** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ ** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ ** Processing line: ~ # source_x, source_y, source_w, source_h~ +** Processing line: ~~ +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_4 is:~ +** Processing line: ~ # x, y, w, h,~ +** Processing line: ~ # path,~ +** Processing line: ~ # angle,~ +** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h,~ +** Processing line: ~ # flip_horizontally, flip_vertically,~ +** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ +** Processing line: ~ # source_x, source_y, source_w, source_h,~ +** Processing line: ~ # blendmode_enum~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195948,6 +215197,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def tick args~ ** Processing line: ~ # sets console command when sample app initially opens~ ** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "========================================================="~ +** Processing line: ~ puts "* INFO: Static Sprites, Classes, Draw Override"~ +** Processing line: ~ puts "* INFO: Please specify the number of sprites to render."~ ** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -195987,7 +215241,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/09_performance/07_collision_limits/app/main.rb~ +** Processing line: ~ # ./samples/09_performance/08_collision_limits/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ ** Processing line: ~ Reminders:~ @@ -196048,6 +215302,46 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Debugging - Logging - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Logging - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Logging - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/00_logging/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.background_color = [255, 255, 255, 0]~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.gtk.log_spam "log level spam"~ +** Processing line: ~ args.gtk.log_debug "log level debug"~ +** Processing line: ~ args.gtk.log_info "log level info"~ +** Processing line: ~ args.gtk.log_warn "log level warn"~ +** Processing line: ~ args.gtk.log_error "log level error"~ +** Processing line: ~ args.gtk.log_unfiltered "log level unfiltered"~ +** Processing line: ~ puts "This is a puts call"~ +** Processing line: ~ args.gtk.console.show~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.tick_count == 60~ +** Processing line: ~ puts "This is a puts call on tick 60"~ +** Processing line: ~ elsif args.state.tick_count == 120~ +** Processing line: ~ puts "This is a puts call on tick 120"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Advanced Debugging - Trace Debugging - main.rb~ - H3 detected. - Determining if line is a header. @@ -196165,6 +215459,70 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Debugging - Unit Tests - benchmark_api_tests.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - benchmark_api_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - benchmark_api_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/benchmark_api_tests.rb~ +** Processing line: ~ def test_benchmark_api args, assert~ +** Processing line: ~ result = args.gtk.benchmark iterations: 100,~ +** Processing line: ~ only_one: -> () {~ +** Processing line: ~ r = 0~ +** Processing line: ~ (1..100).each do |i|~ +** Processing line: ~ r += 1~ +** Processing line: ~ end~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ assert.equal! result.first_place.name, :only_one~ +** Processing line: ~~ +** Processing line: ~ result = args.gtk.benchmark iterations: 100,~ +** Processing line: ~ iterations_100: -> () {~ +** Processing line: ~ r = 0~ +** Processing line: ~ (1..100).each do |i|~ +** Processing line: ~ r += 1~ +** Processing line: ~ end~ +** Processing line: ~ },~ +** Processing line: ~ iterations_50: -> () {~ +** Processing line: ~ r = 0~ +** Processing line: ~ (1..50).each do |i|~ +** Processing line: ~ r += 1~ +** Processing line: ~ end~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ assert.equal! result.first_place.name, :iterations_50~ +** Processing line: ~~ +** Processing line: ~ result = args.gtk.benchmark iterations: 1,~ +** Processing line: ~ iterations_100: -> () {~ +** Processing line: ~ r = 0~ +** Processing line: ~ (1..100).each do |i|~ +** Processing line: ~ r += 1~ +** Processing line: ~ end~ +** Processing line: ~ },~ +** Processing line: ~ iterations_50: -> () {~ +** Processing line: ~ r = 0~ +** Processing line: ~ (1..50).each do |i|~ +** Processing line: ~ r += 1~ +** Processing line: ~ end~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ assert.equal! result.too_small_to_measure, true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Advanced Debugging - Unit Tests - exception_raising_tests.rb~ - H3 detected. - Determining if line is a header. @@ -196805,6 +216163,157 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Advanced Debugging - Unit Tests - pretty_format_tests.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - pretty_format_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - pretty_format_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/pretty_format_tests.rb~ +** Processing line: ~ def H opts~ +** Processing line: ~ opts~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def A *opts~ +** Processing line: ~ opts~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def assert_format args, assert, hash, expected~ +** Processing line: ~ actual = args.fn.pretty_format hash~ +** Processing line: ~ assert.are_equal! actual, expected~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_pretty_print args, assert~ +** Processing line: ~ # =============================~ +** Processing line: ~ # hash with single value~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (H first_name: "John")~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ {:first_name "John"}~ +** Processing line: ~ S~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~~ +** Processing line: ~ # =============================~ +** Processing line: ~ # hash with two values~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (H first_name: "John", last_name: "Smith")~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ {:first_name "John"~ +** Processing line: ~ :last_name "Smith"}~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~~ +** Processing line: ~ # =============================~ +** Processing line: ~ # hash with inner hash~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (H first_name: "John",~ +** Processing line: ~ last_name: "Smith",~ +** Processing line: ~ middle_initial: "I",~ +** Processing line: ~ so: (H first_name: "Pocahontas",~ +** Processing line: ~ last_name: "Tsenacommacah"),~ +** Processing line: ~ friends: (A (H first_name: "Side", last_name: "Kick"),~ +** Processing line: ~ (H first_name: "Tim", last_name: "Wizard")))~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ {:first_name "John"~ +** Processing line: ~ :last_name "Smith"~ +** Processing line: ~ :middle_initial "I"~ +** Processing line: ~ :so {:first_name "Pocahontas"~ +** Processing line: ~ :last_name "Tsenacommacah"}~ +** Processing line: ~ :friends [{:first_name "Side"~ +** Processing line: ~ :last_name "Kick"}~ +** Processing line: ~ {:first_name "Tim"~ +** Processing line: ~ :last_name "Wizard"}]}~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~~ +** Processing line: ~ # =============================~ +** Processing line: ~ # array with one value~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (A 1)~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ [1]~ +** Processing line: ~ S~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~~ +** Processing line: ~ # =============================~ +** Processing line: ~ # array with multiple values~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (A 1, 2, 3)~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ [1~ +** Processing line: ~ 2~ +** Processing line: ~ 3]~ +** Processing line: ~ S~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~~ +** Processing line: ~ # =============================~ +** Processing line: ~ # array with multiple values hashes~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (A (H first_name: "Side", last_name: "Kick"),~ +** Processing line: ~ (H first_name: "Tim", last_name: "Wizard"))~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ [{:first_name "Side"~ +** Processing line: ~ :last_name "Kick"}~ +** Processing line: ~ {:first_name "Tim"~ +** Processing line: ~ :last_name "Wizard"}]~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_nested_nested args, assert~ +** Processing line: ~ # =============================~ +** Processing line: ~ # nested array in nested hash~ +** Processing line: ~ # =============================~ +** Processing line: ~ input = (H type: :root,~ +** Processing line: ~ text: "Root",~ +** Processing line: ~ children: (A (H level: 1,~ +** Processing line: ~ text: "Level 1",~ +** Processing line: ~ children: (A (H level: 2,~ +** Processing line: ~ text: "Level 2",~ +** Processing line: ~ children: [])))))~ +** Processing line: ~~ +** Processing line: ~ expected = <<-S~ +** Processing line: ~ {:type :root~ +** Processing line: ~ :text "Root"~ +** Processing line: ~ :children [{:level 1~ +** Processing line: ~ :text "Level 1"~ +** Processing line: ~ :children [{:level 2~ +** Processing line: ~ :text "Level 2"~ +** Processing line: ~ :children []}]}]}~ +** Processing line: ~~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ (assert_format args, assert, input, expected)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_scene args, assert~ +** Processing line: ~ script = <<-S~ +** Processing line: ~ * Scene 1~ +** Processing line: ~ ** Narrator~ +** Processing line: ~ They say happy endings don't exist.~ +** Processing line: ~ ** Narrator~ +** Processing line: ~ They say true love is a lie.~ +** Processing line: ~ S~ +** Processing line: ~ input = parse_org args, script~ +** Processing line: ~ puts (args.fn.pretty_format input)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Advanced Debugging - Unit Tests - require_tests.rb~ - H3 detected. - Determining if line is a header. @@ -196884,12 +216393,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ GTK::Entity.__reset_id__!~ ** Processing line: ~ args.state.player_one = "test"~ ** Processing line: ~ result = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ +** Processing line: ~ assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ ** Processing line: ~~ ** Processing line: ~ GTK::Entity.__reset_id__!~ ** Processing line: ~ args.gtk.write_file 'state.txt', ''~ ** Processing line: ~ result = args.gtk.serialize_state 'state.txt', args.state~ -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ +** Processing line: ~ assert.equal! result, "{:entity_id=>4, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>\"test\"}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def test_deserialize args, assert~ @@ -196938,7 +216447,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil)~ ** Processing line: ~~ ** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>9, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}'~ +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>7, :entity_keys_by_ref=>{}, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_keys_by_ref=>{}, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>2, :entity_name=>:player_strict, :entity_type=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :entity_keys_by_ref=>{:entity_type=>:entity_name, :global_created_at_elapsed=>:created_at}, :name=>"Ken", :blood_type=>nil}}'~ ** Processing line: ~~ ** Processing line: ~ GTK::Entity.__reset_id__!~ ** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ @@ -196996,6 +216505,18 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ assert.equal! deserialized_state.strict_entity.one, deserialized_state.strict_entity.two~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def test_serialization_excludes_thrash_count args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.state.player.name = "Ryu"~ +** Processing line: ~ # force a nil pun~ +** Processing line: ~ if args.state.player.age > 30~ +** Processing line: ~ end~ +** Processing line: ~ assert.equal! args.state.player.as_hash[:__thrash_count__][:>], 1~ +** Processing line: ~ result = args.gtk.serialize_state args.state~ +** Processing line: ~ assert.false! (result.include? "__thrash_count__"),~ +** Processing line: ~ "The __thrash_count__ key exists in state when it shouldn't have."~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ @@ -197202,11 +216723,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./samples/11_http/01_retrieve_images/app/main.rb~ +** Processing line: ~ $gtk.register_cvar 'app.warn_seconds', "seconds to wait before starting", :uint, 11~ +** Processing line: ~~ ** Processing line: ~ def tick args~ ** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ ** Processing line: ~~ ** Processing line: ~ # Show a warning at the start.~ -** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ +** Processing line: ~ args.state.warning_debounce ||= args.cvars['app.warn_seconds'].value * 60~ ** Processing line: ~ if args.state.warning_debounce > 0~ ** Processing line: ~ args.state.warning_debounce -= 1~ ** Processing line: ~ args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255]~ @@ -197260,24 +216783,25 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~*** Http - Web Server - main.rb~ +** Processing line: ~*** Http - In Game Web Server Http Get - main.rb~ - H3 detected. - Determining if line is a header. - Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Http - Web Server - main.rb~ +- Formatting line: ~Http - In Game Web Server Http Get - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false - Determining if line is a header. - Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~Http - Web Server - main.rb~ +- Formatting line: ~Http - In Game Web Server Http Get - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./samples/11_http/02_web_server/app/main.rb~ +** Processing line: ~ # ./samples/11_http/02_in_game_web_server_http_get/app/main.rb~ ** Processing line: ~ def tick args~ ** Processing line: ~ args.state.port ||= 3000~ +** Processing line: ~ args.state.reqnum ||= 0~ ** Processing line: ~ # by default the embedded webserver runs on port 9001 (the port number is over 9000) and is disabled in a production build~ ** Processing line: ~ # to enable the http server in a production build, you need to manually start~ ** Processing line: ~ # the server up:~ @@ -197308,6 +216832,99 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Http - In Game Web Server Http Post - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Http - In Game Web Server Http Post - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Http - In Game Web Server Http Post - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/11_http/03_in_game_web_server_http_post/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # defaults~ +** Processing line: ~ args.state.post_button = args.layout.rect(row: 0, col: 0, w: 5, h: 1).merge(text: "execute http_post")~ +** Processing line: ~ args.state.post_body_button = args.layout.rect(row: 1, col: 0, w: 5, h: 1).merge(text: "execute http_post_body")~ +** Processing line: ~ args.state.request_to_s ||= ""~ +** Processing line: ~ args.state.request_body ||= ""~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.state.post_button.yield_self do |b|~ +** Processing line: ~ args.outputs.borders << b~ +** Processing line: ~ args.outputs.labels << b.merge(text: b.text,~ +** Processing line: ~ y: b.y + 30,~ +** Processing line: ~ x: b.x + 10)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.post_body_button.yield_self do |b|~ +** Processing line: ~ args.outputs.borders << b~ +** Processing line: ~ args.outputs.labels << b.merge(text: b.text,~ +** Processing line: ~ y: b.y + 30,~ +** Processing line: ~ x: b.x + 10)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ draw_label args, 0, 6, "Request:", args.state.request_to_s~ +** Processing line: ~ draw_label args, 0, 14, "Request Body Unaltered:", args.state.request_body~ +** Processing line: ~~ +** Processing line: ~ # input~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ # ============= HTTP_POST =============~ +** Processing line: ~ if (args.inputs.mouse.inside_rect? args.state.post_button)~ +** Processing line: ~ # ========= DATA TO SEND ===========~ +** Processing line: ~ form_fields = { "userId" => "#{Time.now.to_i}" }~ +** Processing line: ~ # ==================================~ +** Processing line: ~~ +** Processing line: ~ args.gtk.http_post "http://localhost:9001/testing",~ +** Processing line: ~ form_fields,~ +** Processing line: ~ ["Content-Type: application/x-www-form-urlencoded"]~ +** Processing line: ~~ +** Processing line: ~ args.gtk.notify! "http_post"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ============= HTTP_POST_BODY =============~ +** Processing line: ~ if (args.inputs.mouse.inside_rect? args.state.post_body_button)~ +** Processing line: ~ # =========== DATA TO SEND ==============~ +** Processing line: ~ json = "{ \"userId\": \"#{Time.now.to_i}\"}"~ +** Processing line: ~ # ==================================~ +** Processing line: ~~ +** Processing line: ~ args.gtk.http_post_body "http://localhost:9001/testing",~ +** Processing line: ~ json,~ +** Processing line: ~ ["Content-Type: application/json", "Content-Length: #{json.length}"]~ +** Processing line: ~~ +** Processing line: ~ args.gtk.notify! "http_post_body"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # calc~ +** Processing line: ~ args.inputs.http_requests.each do |r|~ +** Processing line: ~ puts "#{r}"~ +** Processing line: ~ if r.uri == "/testing"~ +** Processing line: ~ puts r~ +** Processing line: ~ args.state.request_to_s = "#{r}"~ +** Processing line: ~ args.state.request_body = r.raw_body~ +** Processing line: ~ r.respond 200, "ok"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def draw_label args, row, col, header, text~ +** Processing line: ~ label_pos = args.layout.rect(row: row, col: col, w: 0, h: 0)~ +** Processing line: ~ args.outputs.labels << "#{header}\n\n#{text}".wrapped_lines(80).map_with_index do |l, i|~ +** Processing line: ~ { x: label_pos.x, y: label_pos.y - (i * 15), text: l, size_enum: -2 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** C Extensions - Basics - main.rb~ - H3 detected. - Determining if line is a header. @@ -199340,7 +218957,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Breadth First Search tick is called~ -** Processing line: ~ $breadcrumbs ||= Breadcrumbs.new(args)~ +** Processing line: ~ $breadcrumbs ||= Breadcrumbs.new~ ** Processing line: ~ $breadcrumbs.args = args~ ** Processing line: ~ $breadcrumbs.tick~ ** Processing line: ~ end~ @@ -200006,7 +219623,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Breadth First Search tick is called~ -** Processing line: ~ $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new(args)~ +** Processing line: ~ $early_exit_breadth_first_search ||= EarlyExitBreadthFirstSearch.new~ ** Processing line: ~ $early_exit_breadth_first_search.args = args~ ** Processing line: ~ $early_exit_breadth_first_search.tick~ ** Processing line: ~ end~ @@ -200871,7 +220488,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Dijkstra tick method is called~ -** Processing line: ~ $movement_costs ||= Movement_Costs.new(args)~ +** Processing line: ~ $movement_costs ||= Movement_Costs.new~ ** Processing line: ~ $movement_costs.args = args~ ** Processing line: ~ $movement_costs.tick~ ** Processing line: ~ end~ @@ -201872,7 +221489,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Breadth First Search tick is called~ -** Processing line: ~ $heuristic_with_walls ||= Heuristic_With_Walls.new(args)~ +** Processing line: ~ $heuristic_with_walls ||= Heuristic_With_Walls.new~ ** Processing line: ~ $heuristic_with_walls.args = args~ ** Processing line: ~ $heuristic_with_walls.tick~ ** Processing line: ~ end~ @@ -202906,7 +222523,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Breadth First Search tick is called~ -** Processing line: ~ $heuristic ||= Heuristic.new(args)~ +** Processing line: ~ $heuristic ||= Heuristic.new~ ** Processing line: ~ $heuristic.args = args~ ** Processing line: ~ $heuristic.tick~ ** Processing line: ~ end~ @@ -203956,7 +223573,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Every tick, new args are passed, and the Breadth First Search tick is called~ -** Processing line: ~ $a_star_algorithm ||= A_Star_Algorithm.new(args)~ +** Processing line: ~ $a_star_algorithm ||= A_Star_Algorithm.new~ ** Processing line: ~ $a_star_algorithm.args = args~ ** Processing line: ~ $a_star_algorithm.tick~ ** Processing line: ~ end~ @@ -204554,6 +224171,378 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** 3d - Yaw Pitch Roll - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~3d - Yaw Pitch Roll - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~3d - Yaw Pitch Roll - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_3d/03_yaw_pitch_roll/app/main.rb~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ input~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def matrix_mul m, v~ +** Processing line: ~ (hmap x: ((m.x.x * v.x) + (m.x.y * v.y) + (m.x.z * v.z) + (m.x.w * v.w)),~ +** Processing line: ~ y: ((m.y.x * v.x) + (m.y.y * v.y) + (m.y.z * v.z) + (m.y.w * v.w)),~ +** Processing line: ~ z: ((m.z.x * v.x) + (m.z.y * v.y) + (m.z.z * v.z) + (m.z.w * v.w)),~ +** Processing line: ~ w: ((m.w.x * v.x) + (m.w.y * v.y) + (m.w.z * v.z) + (m.w.w * v.w)))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_ship~ +** Processing line: ~ [~ +** Processing line: ~ # engine back~ +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # engine front~ +** Processing line: ~ { x: -1, y: -1, z: -1, w: 0 },~ +** Processing line: ~ { x: -1, y: 1, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, y: 1, z: -1, w: 0 },~ +** Processing line: ~ { x: 1, y: 1, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: 1, z: -1, w: 0 },~ +** Processing line: ~ { x: 1, y: -1, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: -1, z: -1, w: 0 },~ +** Processing line: ~ { x: -1, y: -1, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # engine left~ +** Processing line: ~ { x: -1, z: -1, y: -1, w: 0 },~ +** Processing line: ~ { x: -1, z: -1, y: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, z: -1, y: 1, w: 0 },~ +** Processing line: ~ { x: -1, z: 1, y: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, z: 1, y: 1, w: 0 },~ +** Processing line: ~ { x: -1, z: 1, y: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, z: 1, y: -1, w: 0 },~ +** Processing line: ~ { x: -1, z: -1, y: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # engine right~ +** Processing line: ~ { x: 1, z: -1, y: -1, w: 0 },~ +** Processing line: ~ { x: 1, z: -1, y: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, z: -1, y: 1, w: 0 },~ +** Processing line: ~ { x: 1, z: 1, y: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, z: 1, y: 1, w: 0 },~ +** Processing line: ~ { x: 1, z: 1, y: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, z: 1, y: -1, w: 0 },~ +** Processing line: ~ { x: 1, z: -1, y: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # top front of engine to front of ship~ +** Processing line: ~ { x: 1, y: 1, z: 1, w: 0 },~ +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +** Processing line: ~ { x: -1, y: 1, z: 1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # bottom front of engine~ +** Processing line: ~ { x: 1, y: -1, z: 1, w: 0 },~ +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, y: -1, z: 1, w: 0 },~ +** Processing line: ~ { x: 0, y: -1, z: 9, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # right wing~ +** Processing line: ~ # front of wing~ +** Processing line: ~ { x: 1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 10, y: 0.10, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # back of wing~ +** Processing line: ~ { x: 1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 10, y: 0.10, z: -2, w: 0 },~ +** Processing line: ~ { x: 8, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # front of wing~ +** Processing line: ~ { x: 1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 10, y: -0.10, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # back of wing~ +** Processing line: ~ { x: 1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 10, y: -0.10, z: -2, w: 0 },~ +** Processing line: ~ { x: 8, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # left wing~ +** Processing line: ~ # front of wing~ +** Processing line: ~ { x: -1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -10, y: 0.10, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # back of wing~ +** Processing line: ~ { x: -1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -9, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -10, y: 0.10, z: -2, w: 0 },~ +** Processing line: ~ { x: -8, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # front of wing~ +** Processing line: ~ { x: -1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -10, y: -0.10, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # back of wing~ +** Processing line: ~ { x: -1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -9, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -10, y: -0.10, z: -2, w: 0 },~ +** Processing line: ~ { x: -8, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # left fin~ +** Processing line: ~ # top~ +** Processing line: ~ { x: -1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1.1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -1.1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1.1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -1.1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # bottom~ +** Processing line: ~ { x: -1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1.1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: -1.1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: -1.1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: -1.1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # right fin~ +** Processing line: ~ { x: 1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1.1, y: 0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 1.1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1.1, y: 0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 1.1, y: 3, z: -3, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ # bottom~ +** Processing line: ~ { x: 1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1.1, y: -0.10, z: 1, w: 0 },~ +** Processing line: ~ { x: 1.1, y: -2, z: -2, w: 0 },~ +** Processing line: ~~ +** Processing line: ~ { x: 1.1, y: -0.10, z: -1, w: 0 },~ +** Processing line: ~ { x: 1.1, y: -2, z: -2, w: 0 },~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.points ||= player_ship~ +** Processing line: ~ state.shifted_points ||= state.points.map { |point| point }~ +** Processing line: ~~ +** Processing line: ~ state.scale ||= 1~ +** Processing line: ~ state.angle_x ||= 0~ +** Processing line: ~ state.angle_y ||= 0~ +** Processing line: ~ state.angle_z ||= 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def matrix_new x0, y0, z0, w0, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3~ +** Processing line: ~ (hmap x: (hmap x: x0, y: y0, z: z0, w: w0),~ +** Processing line: ~ y: (hmap x: x1, y: y1, z: z1, w: w1),~ +** Processing line: ~ z: (hmap x: x2, y: y2, z: z2, w: w2),~ +** Processing line: ~ w: (hmap x: x3, y: y3, z: z3, w: w3))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def angle_z_matrix degrees~ +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +** Processing line: ~ (matrix_new cos_t, -sin_t, 0, 0,~ +** Processing line: ~ sin_t, cos_t, 0, 0,~ +** Processing line: ~ 0, 0, 1, 0,~ +** Processing line: ~ 0, 0, 0, 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def angle_y_matrix degrees~ +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +** Processing line: ~ (matrix_new cos_t, 0, sin_t, 0,~ +** Processing line: ~ 0, 1, 0, 0,~ +** Processing line: ~ -sin_t, 0, cos_t, 0,~ +** Processing line: ~ 0, 0, 0, 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def angle_x_matrix degrees~ +** Processing line: ~ cos_t = Math.cos degrees.to_radians~ +** Processing line: ~ sin_t = Math.sin degrees.to_radians~ +** Processing line: ~ (matrix_new 1, 0, 0, 0,~ +** Processing line: ~ 0, cos_t, -sin_t, 0,~ +** Processing line: ~ 0, sin_t, cos_t, 0,~ +** Processing line: ~ 0, 0, 0, 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def scale_matrix factor~ +** Processing line: ~ (matrix_new factor, 0, 0, 0,~ +** Processing line: ~ 0, factor, 0, 0,~ +** Processing line: ~ 0, 0, factor, 0,~ +** Processing line: ~ 0, 0, 0, 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input~ +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.p)~ +** Processing line: ~ state.scale -= 0.1~ +** Processing line: ~ elsif inputs.keyboard.p~ +** Processing line: ~ state.scale += 0.1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.mouse.wheel~ +** Processing line: ~ state.scale += inputs.mouse.wheel.y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.scale = state.scale.clamp(0.1, 1000)~ +** Processing line: ~~ +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.y) || inputs.keyboard.right~ +** Processing line: ~ state.angle_y += 1~ +** Processing line: ~ elsif (inputs.keyboard.y) || inputs.keyboard.left~ +** Processing line: ~ state.angle_y -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (inputs.keyboard.shift && inputs.keyboard.x) || inputs.keyboard.down~ +** Processing line: ~ state.angle_x -= 1~ +** Processing line: ~ elsif (inputs.keyboard.x || inputs.keyboard.up)~ +** Processing line: ~ state.angle_x += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.shift && inputs.keyboard.z~ +** Processing line: ~ state.angle_z += 1~ +** Processing line: ~ elsif inputs.keyboard.z~ +** Processing line: ~ state.angle_z -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.zero~ +** Processing line: ~ state.angle_x = 0~ +** Processing line: ~ state.angle_y = 0~ +** Processing line: ~ state.angle_z = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ angle_x = state.angle_x~ +** Processing line: ~ angle_y = state.angle_y~ +** Processing line: ~ angle_z = state.angle_z~ +** Processing line: ~ scale = state.scale~ +** Processing line: ~~ +** Processing line: ~ s_matrix = scale_matrix state.scale~ +** Processing line: ~ x_matrix = angle_z_matrix angle_z~ +** Processing line: ~ y_matrix = angle_y_matrix angle_y~ +** Processing line: ~ z_matrix = angle_x_matrix angle_x~ +** Processing line: ~~ +** Processing line: ~ state.shifted_points = state.points.map do |point|~ +** Processing line: ~ (matrix_mul s_matrix,~ +** Processing line: ~ (matrix_mul z_matrix,~ +** Processing line: ~ (matrix_mul x_matrix,~ +** Processing line: ~ (matrix_mul y_matrix, point)))).merge(original: point)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def thick_line line~ +** Processing line: ~ [~ +** Processing line: ~ line.merge(y: line.y - 1, y2: line.y2 - 1, r: 0, g: 0, b: 0),~ +** Processing line: ~ line.merge(x: line.x - 1, x2: line.x2 - 1, r: 0, g: 0, b: 0),~ +** Processing line: ~ line.merge(x: line.x - 0, x2: line.x2 - 0, r: 0, g: 0, b: 0),~ +** Processing line: ~ line.merge(y: line.y + 1, y2: line.y2 + 1, r: 0, g: 0, b: 0),~ +** Processing line: ~ line.merge(x: line.x + 1, x2: line.x2 + 1, r: 0, g: 0, b: 0)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.lines << state.shifted_points.each_slice(2).map do |(p1, p2)|~ +** Processing line: ~ perc = 0~ +** Processing line: ~ thick_line({ x: p1.x.*(10) + 640, y: p1.y.*(10) + 320,~ +** Processing line: ~ x2: p2.x.*(10) + 640, y2: p2.y.*(10) + 320,~ +** Processing line: ~ r: 255 * perc,~ +** Processing line: ~ g: 255 * perc,~ +** Processing line: ~ b: 255 * perc })~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [ 10, 700, "angle_x: #{state.angle_x.to_sf}", 0]~ +** Processing line: ~ outputs.labels << [ 10, 670, "x, shift+x", 0]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [210, 700, "angle_y: #{state.angle_y.to_sf}", 0]~ +** Processing line: ~ outputs.labels << [210, 670, "y, shift+y", 0]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [410, 700, "angle_z: #{state.angle_z.to_sf}", 0]~ +** Processing line: ~ outputs.labels << [410, 670, "z, shift+z", 0]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [610, 700, "scale: #{state.scale.to_sf}", 0]~ +** Processing line: ~ outputs.labels << [610, 670, "p, shift+p", 0]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $game = Game.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_angles x, y, z~ +** Processing line: ~ $game.state.angle_x = x~ +** Processing line: ~ $game.state.angle_y = y~ +** Processing line: ~ $game.state.angle_z = z~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Arcade - Bullet Hell - main.rb~ - H3 detected. - Determining if line is a header. @@ -205230,31 +225219,36 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_score~ -** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ -** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ -** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ +** Processing line: ~ outputs.primitives << { x: 10, y: 710, text: "HI SCORE: #{state.hi_score}", **large_white_typeset }~ +** Processing line: ~ outputs.primitives << { x: 10, y: 680, text: "SCORE: #{state.score}", **large_white_typeset }~ +** Processing line: ~ outputs.primitives << { x: 10, y: 650, text: "DIFFICULTY: #{state.difficulty.upcase}", **large_white_typeset }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_menu~ ** Processing line: ~ return unless state.scene == :menu~ ** Processing line: ~ render_overlay~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << { x: 640, y: 700, text: "Flappy Dragon", size_enum: 50, alignment_enum: 1, **white }~ +** Processing line: ~ outputs.labels << { x: 640, y: 500, text: "Instructions: Press Spacebar to flap. Don't die.", size_enum: 4, alignment_enum: 1, **white }~ +** Processing line: ~ outputs.labels << { x: 430, y: 430, text: "[Tab] Change difficulty", size_enum: 4, alignment_enum: 0, **white }~ +** Processing line: ~ outputs.labels << { x: 430, y: 400, text: "[Enter] Start at New Difficulty ", size_enum: 4, alignment_enum: 0, **white }~ +** Processing line: ~ outputs.labels << { x: 430, y: 370, text: "[Escape] Cancel/Resume ", size_enum: 4, alignment_enum: 0, **white }~ +** Processing line: ~ outputs.labels << { x: 640, y: 300, text: "(mouse, touch, and game controllers work, too!) ", size_enum: 4, alignment_enum: 1, **white }~ +** Processing line: ~ outputs.labels << { x: 640, y: 200, text: "Difficulty: #{state.new_difficulty.capitalize}", size_enum: 4, alignment_enum: 1, **white }~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ +** Processing line: ~ outputs.labels << { x: 10, y: 100, text: "Code: @amirrajan", **white }~ +** Processing line: ~ outputs.labels << { x: 10, y: 80, text: "Art: @mobypixel", **white }~ +** Processing line: ~ outputs.labels << { x: 10, y: 60, text: "Music: @mobypixel", **white }~ +** Processing line: ~ outputs.labels << { x: 10, y: 40, text: "Engine: DragonRuby GTK", **white }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_overlay~ -** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ +** Processing line: ~ overlay_rect = grid.rect.scale_rect(1.1, 0, 0)~ +** Processing line: ~ outputs.primitives << { x: overlay_rect.x,~ +** Processing line: ~ y: overlay_rect.y,~ +** Processing line: ~ w: overlay_rect.w,~ +** Processing line: ~ h: overlay_rect.h,~ +** Processing line: ~ r: 0, g: 0, b: 0, a: 230 }.solid!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_game~ @@ -205267,14 +225261,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def render_game_over~ ** Processing line: ~ return unless state.scene == :game~ -** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ -** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ -** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << { x: 638, y: 358, text: score_text, size_enum: 20, alignment_enum: 1 }~ +** Processing line: ~ outputs.labels << { x: 635, y: 360, text: score_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 }~ +** Processing line: ~ outputs.labels << { x: 638, y: 428, text: countdown_text, size_enum: 20, alignment_enum: 1 }~ +** Processing line: ~ outputs.labels << { x: 635, y: 430, text: countdown_text, size_enum: 20, alignment_enum: 1, r: 255, g: 255, b: 255 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_background~ -** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ +** Processing line: ~ outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: 'sprites/background.png' }~ ** Processing line: ~~ ** Processing line: ~ scroll_point_at = state.tick_count~ ** Processing line: ~ scroll_point_at = state.scene_at if state.scene == :menu~ @@ -205286,11 +225280,18 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80)~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def scrolling_background at, path, rate, y = 0~ +** Processing line: ~ [~ +** Processing line: ~ { x: 0 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path },~ +** Processing line: ~ { x: 1440 - at.*(rate) % 1440, y: y, w: 1440, h: 720, path: path }~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def render_walls~ ** Processing line: ~ state.walls.each do |w|~ ** Processing line: ~ w.sprites = [~ -** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ -** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ +** Processing line: ~ { x: w.x, y: w.bottom_height - 720, w: 100, h: 720, path: 'sprites/wall.png', angle: 180 },~ +** Processing line: ~ { x: w.x, y: w.top_y, w: 100, h: 720, path: 'sprites/wallbottom.png', angle: 0 }~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~ outputs.sprites << state.walls.map(&:sprites)~ @@ -205299,15 +225300,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def render_dragon~ ** Processing line: ~ state.show_death = true if state.countdown == 3.seconds~ ** Processing line: ~~ -** Processing line: ~ render_debug_hitbox false~ -** Processing line: ~~ ** Processing line: ~ if state.show_death == false || !state.death_at~ ** Processing line: ~ animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at~ ** Processing line: ~ sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png"~ -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 }~ ** Processing line: ~ else~ ** Processing line: ~ sprite_name = "sprites/dragon_die.png"~ -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ state.dragon_sprite = { x: state.x, y: state.y, w: 100, h: 80, path: sprite_name, angle: state.dy * 1.2 }~ ** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ ** Processing line: ~ state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1~ ** Processing line: ~ state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction~ @@ -205317,20 +225316,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ outputs.sprites << state.dragon_sprite~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_debug_hitbox show~ -** Processing line: ~ return unless show~ -** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ -** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ -** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def render_flash~ ** Processing line: ~ return unless state.flash_at~ ** Processing line: ~~ -** Processing line: ~ outputs.primitives << [grid.rect,~ -** Processing line: ~ white,~ -** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ +** Processing line: ~ outputs.primitives << { **grid.rect.to_hash,~ +** Processing line: ~ **white,~ +** Processing line: ~ a: 255 * state.flash_at.ease(20, :flip) }.solid!~ ** Processing line: ~~ ** Processing line: ~ state.flash_at = 0 if state.flash_at.elapsed_time > 20~ ** Processing line: ~ end~ @@ -205450,19 +225441,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def scrolling_background at, path, rate, y = 0~ -** Processing line: ~ [~ -** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ -** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def white~ -** Processing line: ~ [255, 255, 255]~ +** Processing line: ~ { r: 255, g: 255, b: 255 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def large_white_typeset~ -** Processing line: ~ [5, 0, 255, 255, 255]~ +** Processing line: ~ { size_enum: 5, alignment_enum: 0, r: 255, g: 255, b: 255 }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def at_beginning?~ @@ -205471,9 +225455,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def dragon_collision_box~ ** Processing line: ~ state.dragon_sprite~ -** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ -** Processing line: ~ .rect_shift_right(10)~ -** Processing line: ~ .rect_shift_up(state.dy * 2)~ +** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ +** Processing line: ~ .rect_shift_right(10)~ +** Processing line: ~ .rect_shift_up(state.dy * 2)~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def game_over?~ @@ -205482,7 +225466,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ state.walls~ ** Processing line: ~ .flat_map { |w| w.sprites }~ ** Processing line: ~ .any? do |s|~ -** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ +** Processing line: ~ s && s.intersect_rect?(dragon_collision_box)~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -206876,6 +226860,161 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Crafting - Farming Game Starting Point - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Crafting - Farming Game Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Crafting - Farming Game Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_crafting/farming_game_starting_point/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.tile_size = 80~ +** Processing line: ~ args.state.player_speed = 4~ +** Processing line: ~ args.state.player ||= tile(args, 7, 3, 0, 128, 180)~ +** Processing line: ~ generate_map args~ +** Processing line: ~ #press j to plant a green onion~ +** Processing line: ~ if args.inputs.keyboard.j~ +** Processing line: ~ #change this part you can change what you want to plant~ +** Processing line: ~ args.state.walls << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y)/args.state.tile_size), 255, 255, 255)~ +** Processing line: ~ args.state.plants << tile(args, ((args.state.player.x+80)/args.state.tile_size), ((args.state.player.y+80)/args.state.tile_size), 0, 160, 0)~ +** Processing line: ~ end~ +** Processing line: ~ # Adds walls, background, and player to args.outputs.solids so they appear on screen~ +** Processing line: ~ args.outputs.solids << [0,0,1280,720, 237,189,101]~ +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ +** Processing line: ~ args.outputs.solids << args.state.walls~ +** Processing line: ~ args.outputs.solids << args.state.player~ +** Processing line: ~ args.outputs.solids << args.state.plants~ +** Processing line: ~ args.outputs.labels << [320, 640, "press J to plant", 3, 1, 255, 0, 0, 200]~ +** Processing line: ~~ +** Processing line: ~ move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed~ +** Processing line: ~ move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed~ +** Processing line: ~ move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed~ +** Processing line: ~ move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets position, size, and color of the tile~ +** Processing line: ~ def tile args, x, y, *color~ +** Processing line: ~ [x * args.state.tile_size, # sets definition for array using method parameters~ +** Processing line: ~ y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values~ +** Processing line: ~ args.state.tile_size,~ +** Processing line: ~ args.state.tile_size,~ +** Processing line: ~ *color]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach)~ +** Processing line: ~ def generate_map args~ +** Processing line: ~ return if args.state.area~ +** Processing line: ~~ +** Processing line: ~ # Creates the area of the map. There are 9 rows running horizontally across the screen~ +** Processing line: ~ # and 16 columns running vertically on the screen. Any spot with a "1" is not~ +** Processing line: ~ # open for the player to move into (and is green), and any spot with a "0" is available~ +** Processing line: ~ # for the player to move in.~ +** Processing line: ~ args.state.area = [~ +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,],~ +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],~ +** Processing line: ~ ].reverse # reverses the order of the area collection~ +** Processing line: ~~ +** Processing line: ~ # By reversing the order, the way that the area appears above is how it appears~ +** Processing line: ~ # on the screen in the game. If we did not reverse, the map would appear inverted.~ +** Processing line: ~~ +** Processing line: ~ #The wall starts off with no tiles.~ +** Processing line: ~ args.state.walls = []~ +** Processing line: ~ args.state.plants = []~ +** Processing line: ~~ +** Processing line: ~ # If v is 1, a green tile is added to args.state.walls.~ +** Processing line: ~ # If v is 2, a black tile is created as the goal.~ +** Processing line: ~ args.state.area.map_2d do |y, x, v|~ +** Processing line: ~ if v == 1~ +** Processing line: ~ args.state.walls << tile(args, x, y, 255, 160, 156) # green tile~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Allows the player to move their box around the screen~ +** Processing line: ~ def move_player args, *vector~ +** Processing line: ~ box = args.state.player.shift_rect(vector) # box is able to move at an angle~ +** Processing line: ~~ +** Processing line: ~ # If the player's box hits a wall, it is not able to move further in that direction~ +** Processing line: ~ return if args.state.walls~ +** Processing line: ~ .any_intersect_rect?(box)~ +** Processing line: ~~ +** Processing line: ~ # Player's box is able to move at angles (not just the four general directions) fast~ +** Processing line: ~ args.state.player =~ +** Processing line: ~ args.state.player~ +** Processing line: ~ .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then~ +** Processing line: ~ vector.y * args.state.player_speed) # the box will move extremely slow~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Crafting - Farming Game Starting Point - tests.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Crafting - Farming Game Starting Point - tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Crafting - Farming Game Starting Point - tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_crafting/farming_game_starting_point/app/tests.rb~ +** Processing line: ~ # For advanced users:~ +** Processing line: ~ # You can put some quick verification tests here, any method~ +** Processing line: ~ # that starts with the `test_` will be run when you save this file.~ +** Processing line: ~~ +** Processing line: ~ # Here is an example test and game~ +** Processing line: ~~ +** Processing line: ~ # To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick~ +** Processing line: ~~ +** Processing line: ~ class MySuperHappyFunGame~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ outputs.solids << [100, 100, 300, 300]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_universe args, assert~ +** Processing line: ~ game = MySuperHappyFunGame.new~ +** Processing line: ~ game.args = args~ +** Processing line: ~ game.tick~ +** Processing line: ~ assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick"~ +** Processing line: ~ assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending"~ +** Processing line: ~ puts "test_universe completed successfully"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ puts "running tests"~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Dev Tools - Add Buttons To Console - main.rb~ - H3 detected. - Determining if line is a header. @@ -207074,12 +227213,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ label = { x: b.x + state.buttons_frame_selection.size.half,~ ** Processing line: ~ y: b.y,~ ** Processing line: ~ text: "#{i + 1}", r: 180, g: 180, b: 180,~ -** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ +** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label!~ ** Processing line: ~~ -** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border!~ ** Processing line: ~~ ** Processing line: ~ if i == state.animation_frames_selected_index~ -** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ [selection_border, label]~ @@ -207833,6 +227972,558 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Dungeon Crawl - Classics Jam - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Dungeon Crawl - Classics Jam - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Dungeon Crawl - Classics Jam - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_dungeon_crawl/classics_jam/app/main.rb~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ input~ +** Processing line: ~ calc~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ player.x ||= 640~ +** Processing line: ~ player.y ||= 360~ +** Processing line: ~ player.w ||= 16~ +** Processing line: ~ player.h ||= 16~ +** Processing line: ~ player.attacked_at ||= -1~ +** Processing line: ~ player.angle ||= 0~ +** Processing line: ~ player.future_player ||= future_player_position 0, 0~ +** Processing line: ~ player.projectiles ||= []~ +** Processing line: ~ player.damage ||= 0~ +** Processing line: ~ state.level ||= create_level level_one_template~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.sprites << level.walls.map do |w|~ +** Processing line: ~ w.merge(path: 'sprites/square/gray.png')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << level.spawn_locations.map do |s|~ +** Processing line: ~ s.merge(path: 'sprites/square/blue.png')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << player.projectiles.map do |p|~ +** Processing line: ~ p.merge(path: 'sprites/square/blue.png')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << level.enemies.map do |e|~ +** Processing line: ~ e.merge(path: 'sprites/square/red.png')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << player.merge(path: 'sprites/circle/green.png', angle: player.angle)~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << { x: 30, y: 30.from_top, text: "damage: #{player.damage || 0}" }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input~ +** Processing line: ~ player.angle = inputs.directional_angle || player.angle~ +** Processing line: ~ if inputs.controller_one.key_down.a || inputs.keyboard.key_down.space~ +** Processing line: ~ player.attacked_at = state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_player~ +** Processing line: ~ calc_projectiles~ +** Processing line: ~ calc_enemies~ +** Processing line: ~ calc_spawn_locations~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_player~ +** Processing line: ~ if player.attacked_at == state.tick_count~ +** Processing line: ~ player.projectiles << { at: state.tick_count,~ +** Processing line: ~ x: player.x,~ +** Processing line: ~ y: player.y,~ +** Processing line: ~ angle: player.angle,~ +** Processing line: ~ w: 4,~ +** Processing line: ~ h: 4 }.center_inside_rect(player)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if player.attacked_at.elapsed_time > 5~ +** Processing line: ~ future_player = future_player_position inputs.left_right * 2, inputs.up_down * 2~ +** Processing line: ~ future_player_collision = future_collision player, future_player, level.walls~ +** Processing line: ~ player.x = future_player_collision.x if !future_player_collision.dx_collision~ +** Processing line: ~ player.y = future_player_collision.y if !future_player_collision.dy_collision~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_projectile_collisions entities~ +** Processing line: ~ entities.each do |e|~ +** Processing line: ~ e.damage ||= 0~ +** Processing line: ~ player.projectiles.each do |p|~ +** Processing line: ~ if !p.collided && (p.intersect_rect? e)~ +** Processing line: ~ p.collided = true~ +** Processing line: ~ e.damage += 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_projectiles~ +** Processing line: ~ player.projectiles.map! do |p|~ +** Processing line: ~ dx, dy = p.angle.vector 10~ +** Processing line: ~ p.merge(x: p.x + dx, y: p.y + dy)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ calc_projectile_collisions level.walls + level.enemies + level.spawn_locations~ +** Processing line: ~ player.projectiles.reject! { |p| p.at.elapsed_time > 10000 }~ +** Processing line: ~ player.projectiles.reject! { |p| p.collided }~ +** Processing line: ~ level.enemies.reject! { |e| e.damage > e.hp }~ +** Processing line: ~ level.spawn_locations.reject! { |s| s.damage > s.hp }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_enemies~ +** Processing line: ~ level.enemies.map! do |e|~ +** Processing line: ~ dx = 0~ +** Processing line: ~ dx = 1 if e.x < player.x~ +** Processing line: ~ dx = -1 if e.x > player.x~ +** Processing line: ~ dy = 0~ +** Processing line: ~ dy = 1 if e.y < player.y~ +** Processing line: ~ dy = -1 if e.y > player.y~ +** Processing line: ~ future_e = future_entity_position dx, dy, e~ +** Processing line: ~ future_e_collision = future_collision e, future_e, level.enemies + level.walls~ +** Processing line: ~ e.next_x = e.x~ +** Processing line: ~ e.next_y = e.y~ +** Processing line: ~ e.next_x = future_e_collision.x if !future_e_collision.dx_collision~ +** Processing line: ~ e.next_y = future_e_collision.y if !future_e_collision.dy_collision~ +** Processing line: ~ e~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ level.enemies.map! do |e|~ +** Processing line: ~ e.x = e.next_x~ +** Processing line: ~ e.y = e.next_y~ +** Processing line: ~ e~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ level.enemies.each do |e|~ +** Processing line: ~ player.damage += 1 if e.intersect_rect? player~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_spawn_locations~ +** Processing line: ~ level.spawn_locations.map! do |s|~ +** Processing line: ~ s.merge(countdown: s.countdown - 1)~ +** Processing line: ~ end~ +** Processing line: ~ level.spawn_locations~ +** Processing line: ~ .find_all { |s| s.countdown.neg? }~ +** Processing line: ~ .each do |s|~ +** Processing line: ~ s.countdown = s.rate~ +** Processing line: ~ s.merge(countdown: s.rate)~ +** Processing line: ~ new_enemy = create_enemy s~ +** Processing line: ~ if !(level.enemies.find { |e| e.intersect_rect? new_enemy })~ +** Processing line: ~ level.enemies << new_enemy~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def create_enemy spawn_location~ +** Processing line: ~ to_cell(spawn_location.ordinal_x, spawn_location.ordinal_y).merge hp: 2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def create_level level_template~ +** Processing line: ~ {~ +** Processing line: ~ walls: level_template.walls.map { |w| to_cell(w.ordinal_x, w.ordinal_y).merge(w) },~ +** Processing line: ~ enemies: [],~ +** Processing line: ~ spawn_locations: level_template.spawn_locations.map { |s| to_cell(s.ordinal_x, s.ordinal_y).merge(s) }~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def level_one_template~ +** Processing line: ~ {~ +** Processing line: ~ walls: [{ ordinal_x: 25, ordinal_y: 20},~ +** Processing line: ~ { ordinal_x: 25, ordinal_y: 21},~ +** Processing line: ~ { ordinal_x: 25, ordinal_y: 22},~ +** Processing line: ~ { ordinal_x: 25, ordinal_y: 23}],~ +** Processing line: ~ spawn_locations: [{ ordinal_x: 10, ordinal_y: 10, rate: 120, countdown: 0, hp: 5 }]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player~ +** Processing line: ~ state.player ||= {}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def level~ +** Processing line: ~ state.level ||= {}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def future_collision entity, future_entity, others~ +** Processing line: ~ dx_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dx) }~ +** Processing line: ~ dy_collision = others.find { |o| o != entity && (o.intersect_rect? future_entity.dy) }~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ dx_collision: dx_collision,~ +** Processing line: ~ x: future_entity.dx.x,~ +** Processing line: ~ dy_collision: dy_collision,~ +** Processing line: ~ y: future_entity.dy.y~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def future_entity_position dx, dy, entity~ +** Processing line: ~ {~ +** Processing line: ~ dx: entity.merge(x: entity.x + dx),~ +** Processing line: ~ dy: entity.merge(y: entity.y + dy),~ +** Processing line: ~ both: entity.merge(x: entity.x + dx, y: entity.y + dy)~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def future_player_position dx, dy~ +** Processing line: ~ future_entity_position dx, dy, player~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_cell ordinal_x, ordinal_y~ +** Processing line: ~ { x: ordinal_x * 16, y: ordinal_y * 16, w: 16, h: 16 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game ||= Game.new~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $game = nil~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Fighting - Special Move Inputs - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Fighting - Special Move Inputs - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Fighting - Special Move Inputs - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_fighting/01_special_move_inputs/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ #tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ input args~ +** Processing line: ~ calc args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # sets default values and creates empty collections~ +** Processing line: ~ # initialization only happens in the first frame~ +** Processing line: ~ def defaults args~ +** Processing line: ~ fiddle args~ +** Processing line: ~~ +** Processing line: ~ args.state.tick_count = args.state.tick_count~ +** Processing line: ~ args.state.bridge_top = 128~ +** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ +** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ +** Processing line: ~ args.state.player.w ||= 64~ +** Processing line: ~ args.state.player.h ||= 64~ +** Processing line: ~ args.state.player.dy ||= 0~ +** Processing line: ~ args.state.player.dx ||= 0~ +** Processing line: ~ args.state.player.r ||= 0~ +** Processing line: ~ args.state.game_over_at ||= 0~ +** Processing line: ~ args.state.animation_time ||=0~ +** Processing line: ~~ +** Processing line: ~ args.state.timeleft ||=0~ +** Processing line: ~ args.state.timeright ||=0~ +** Processing line: ~ args.state.lastpush ||=0~ +** Processing line: ~~ +** Processing line: ~ args.state.inputlist ||= ["j","k","l"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # sets enemy, player, hammer values~ +** Processing line: ~ def fiddle args~ +** Processing line: ~ args.state.gravity = -0.5~ +** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ +** Processing line: ~ args.state.player_jump_power_duration = 5~ +** Processing line: ~ args.state.player_max_run_speed = 20~ +** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ +** Processing line: ~ args.state.player_acceleration = 0.9~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # outputs objects onto the screen~ +** Processing line: ~ def render args~ +** Processing line: ~ if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01)~ +** Processing line: ~ args.state.player.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ #move list~ +** Processing line: ~ (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3,~ +** Processing line: ~ merge: { vertical_alignment_enum: 0, size_enum: -2 },~ +** Processing line: ~ group: [~ +** Processing line: ~ { text: "move: WASD" },~ +** Processing line: ~ { text: "jump: Space" },~ +** Processing line: ~ { text: "attack forwards: J (while on ground" },~ +** Processing line: ~ { text: "attack upwards: K (while on groud)" },~ +** Processing line: ~ { text: "attack backwards: J (while on ground and holding A)" },~ +** Processing line: ~ { text: "attack downwards: K (while in air)" },~ +** Processing line: ~ { text: "dash attack: J, K in quick succession." },~ +** Processing line: ~ { text: "shield: hold J, K at the same time." },~ +** Processing line: ~ { text: "dash backwards: A, A in quick succession." },~ +** Processing line: ~ ]).into args.outputs.labels~ +** Processing line: ~~ +** Processing line: ~ # registered moves~ +** Processing line: ~ args.outputs.labels << { x: 0.to_layout_col,~ +** Processing line: ~ y: 0.to_layout_row,~ +** Processing line: ~ text: "input history",~ +** Processing line: ~ size_enum: -2,~ +** Processing line: ~ vertical_alignment_enum: 0 }~ +** Processing line: ~~ +** Processing line: ~ (args.state.inputlist.take(5)).map do |s|~ +** Processing line: ~ { text: s, size_enum: -2, vertical_alignment_enum: 0 }~ +** Processing line: ~ end.yield_self do |group|~ +** Processing line: ~ (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ #sprites~ +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/square/white.png",~ +** Processing line: ~ args.state.player.r]~ +** Processing line: ~~ +** Processing line: ~ playershield = [args.state.player.x - 20, args.state.player.y - 10,~ +** Processing line: ~ args.state.player.w + 20, args.state.player.h + 20,~ +** Processing line: ~ "sprites/square/blue.png",~ +** Processing line: ~ args.state.player.r,~ +** Processing line: ~ 0]~ +** Processing line: ~~ +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png",~ +** Processing line: ~ args.state.player.r,~ +** Processing line: ~ 0]~ +** Processing line: ~~ +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png",~ +** Processing line: ~ args.state.player.r+90,~ +** Processing line: ~ 0]~ +** Processing line: ~~ +** Processing line: ~ if ((args.state.tick_count - args.state.lastpush) <= 15)~ +** Processing line: ~ if (args.state.inputlist[0] == "<<")~ +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/square/yellow.png", args.state.player.r]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "shield")~ +** Processing line: ~ player = [args.state.player.x, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/square/indigo.png", args.state.player.r]~ +** Processing line: ~~ +** Processing line: ~ playershield = [args.state.player.x - 10, args.state.player.y - 10,~ +** Processing line: ~ args.state.player.w + 20, args.state.player.h + 20,~ +** Processing line: ~ "sprites/square/blue.png", args.state.player.r, 50]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "back-attack")~ +** Processing line: ~ playerjab = [args.state.player.x - 20, args.state.player.y,~ +** Processing line: ~ args.state.player.w - 10, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "forward-attack")~ +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "up-attack")~ +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r + 90, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "dair")~ +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y - 32,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/indigo.png", args.state.player.r + 90, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (args.state.inputlist[0] == "dash-attack")~ +** Processing line: ~ playerupper = [args.state.player.x, args.state.player.y + 32,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/violet.png", args.state.player.r + 90, 255]~ +** Processing line: ~~ +** Processing line: ~ playerjab = [args.state.player.x + 32, args.state.player.y,~ +** Processing line: ~ args.state.player.w, args.state.player.h,~ +** Processing line: ~ "sprites/isometric/violet.png", args.state.player.r, 255]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << playerjab~ +** Processing line: ~ args.outputs.sprites << playerupper~ +** Processing line: ~ args.outputs.sprites << player~ +** Processing line: ~ args.outputs.sprites << playershield~ +** Processing line: ~~ +** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ +** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Performs calculations to move objects on the screen~ +** Processing line: ~ def calc args~ +** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ +** Processing line: ~ args.state.player.x += args.state.player.dx~ +** Processing line: ~ args.state.player.y += args.state.player.dy~ +** Processing line: ~~ +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ +** Processing line: ~ args.state.player.dy += args.state.gravity~ +** Processing line: ~~ +** Processing line: ~ # player's y position is either current y position or y position of top of~ +** Processing line: ~ # bridge, whichever has a greater value~ +** Processing line: ~ # ensures that the player never goes below the bridge~ +** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ +** Processing line: ~~ +** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ +** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ +** Processing line: ~~ +** Processing line: ~ # player is not falling if it is located on the top of the bridge~ +** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ +** Processing line: ~ #args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ +** Processing line: ~ def reset_player args~ +** Processing line: ~ args.state.player.x = 0~ +** Processing line: ~ args.state.player.y = args.state.bridge_top~ +** Processing line: ~ args.state.player.dy = 0~ +** Processing line: ~ args.state.player.dx = 0~ +** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ +** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ +** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Processes input from the user to move the player~ +** Processing line: ~ def input args~ +** Processing line: ~ if args.state.inputlist.length > 5~ +** Processing line: ~ args.state.inputlist.pop~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ should_process_special_move = (args.inputs.keyboard.key_down.j) ||~ +** Processing line: ~ (args.inputs.keyboard.key_down.k) ||~ +** Processing line: ~ (args.inputs.keyboard.key_down.a) ||~ +** Processing line: ~ (args.inputs.keyboard.key_down.d) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.y) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.x) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.left) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.right)~ +** Processing line: ~~ +** Processing line: ~ if (should_process_special_move)~ +** Processing line: ~ if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)~ +** Processing line: ~ args.state.inputlist.unshift("shield")~ +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&~ +** Processing line: ~ (args.state.inputlist[0] == "forward-attack") && ((args.state.tick_count - args.state.lastpush) <= 15)~ +** Processing line: ~ args.state.inputlist.unshift("dash-attack")~ +** Processing line: ~ args.state.player.dx = 20~ +** Processing line: ~ elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||~ +** Processing line: ~ (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)~ +** Processing line: ~ args.state.inputlist.unshift("back-attack")~ +** Processing line: ~ elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)~ +** Processing line: ~ args.state.inputlist.unshift("forward-attack")~ +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&~ +** Processing line: ~ (args.state.player.y > 128)~ +** Processing line: ~ args.state.inputlist.unshift("dair")~ +** Processing line: ~ elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)~ +** Processing line: ~ args.state.inputlist.unshift("up-attack")~ +** Processing line: ~ elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&~ +** Processing line: ~ (args.state.inputlist[0] == "<") &&~ +** Processing line: ~ ((args.state.tick_count - args.state.lastpush) <= 10)~ +** Processing line: ~ args.state.inputlist.unshift("<<")~ +** Processing line: ~ args.state.player.dx = -15~ +** Processing line: ~ elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)~ +** Processing line: ~ args.state.inputlist.unshift("<")~ +** Processing line: ~ args.state.timeleft = args.state.tick_count~ +** Processing line: ~ elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)~ +** Processing line: ~ args.state.inputlist.unshift(">")~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.lastpush = args.state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar~ +** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ +** Processing line: ~~ +** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ +** Processing line: ~ # the player is not falling~ +** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ +** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ +** Processing line: ~ if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2~ +** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ +** Processing line: ~ args.state.player.falling = true # the player is falling~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.left # if left key is pressed~ +** Processing line: ~ if args.state.player.dx < -5~ +** Processing line: ~ args.state.player.dx = args.state.player.dx~ +** Processing line: ~ else~ +** Processing line: ~ args.state.player.dx = -5~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ elsif args.inputs.right # if right key is pressed~ +** Processing line: ~ if args.state.player.dx > 5~ +** Processing line: ~ args.state.player.dx = args.state.player.dx~ +** Processing line: ~ else~ +** Processing line: ~ args.state.player.dx = 5~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)~ +** Processing line: ~ args.state.player.dx *= 0.95~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Lowrez - Nokia 3310 - main.rb~ - H3 detected. - Determining if line is a header. @@ -208456,7 +229147,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ text: text,~ ** Processing line: ~ size_enum: -1.5,~ ** Processing line: ~ r: 255, g: 255, b: 255~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ args.outputs.debug << {~ @@ -208466,7 +229157,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ size_enum: -0.5,~ ** Processing line: ~ alignment_enum: 1,~ ** Processing line: ~ r: 255, g: 255, b: 255~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def snake_demo args~ @@ -208733,7 +229424,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 240,~ ** Processing line: ~ b: 216,~ ** Processing line: ~ a: 100~ -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ (NOKIA_WIDTH + 1).map_with_index do |i|~ @@ -208746,7 +229437,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 240,~ ** Processing line: ~ b: 216,~ ** Processing line: ~ a: 100~ -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ @args.state.overlay_rendered = true~ @@ -209528,7 +230219,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 128,~ ** Processing line: ~ b: 128,~ ** Processing line: ~ a: 80~ -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ ** Processing line: ~~ ** Processing line: ~ args.outputs.static_debug << {~ ** Processing line: ~ x: LOWREZ_X_OFFSET + (i * 10),~ @@ -209539,7 +230230,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 128,~ ** Processing line: ~ b: 128,~ ** Processing line: ~ a: 80~ -** Processing line: ~ }.line~ +** Processing line: ~ }.line!~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -209566,7 +230257,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ y: 720 - (i * 20),~ ** Processing line: ~ text: text,~ ** Processing line: ~ size_enum: -1.5~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ args.outputs.debug << {~ @@ -209575,7 +230266,408 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",~ ** Processing line: ~ size_enum: -0.5,~ ** Processing line: ~ alignment_enum: 1~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Mario - Jumping - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Mario - Jumping - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Mario - Jumping - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_mario/01_jumping/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ input args~ +** Processing line: ~ calc args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.state.player.x ||= args.grid.w.half~ +** Processing line: ~ args.state.player.y ||= 0~ +** Processing line: ~ args.state.player.size ||= 100~ +** Processing line: ~ args.state.player.dy ||= 0~ +** Processing line: ~ args.state.player.action ||= :jumping~ +** Processing line: ~ args.state.jump.power = 20~ +** Processing line: ~ args.state.jump.increase_frames = 10~ +** Processing line: ~ args.state.jump.increase_power = 1~ +** Processing line: ~ args.state.gravity = -1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render args~ +** Processing line: ~ args.outputs.sprites << {~ +** Processing line: ~ x: args.state.player.x -~ +** Processing line: ~ args.state.player.size.half,~ +** Processing line: ~ y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.size,~ +** Processing line: ~ h: args.state.player.size,~ +** Processing line: ~ path: 'sprites/square/red.png'~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input args~ +** Processing line: ~ if args.inputs.keyboard.key_down.space~ +** Processing line: ~ if args.state.player.action == :standing~ +** Processing line: ~ args.state.player.action = :jumping~ +** Processing line: ~ args.state.player.dy = args.state.jump.power~ +** Processing line: ~~ +** Processing line: ~ # record when the action took place~ +** Processing line: ~ current_frame = args.state.tick_count~ +** Processing line: ~ args.state.player.action_at = current_frame~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if the space bar is being held~ +** Processing line: ~ if args.inputs.keyboard.key_held.space~ +** Processing line: ~ # is the player jumping~ +** Processing line: ~ is_jumping = args.state.player.action == :jumping~ +** Processing line: ~~ +** Processing line: ~ # when was the jump performed~ +** Processing line: ~ time_of_jump = args.state.player.action_at~ +** Processing line: ~~ +** Processing line: ~ # how much time has passed since the jump~ +** Processing line: ~ jump_elapsed_time = time_of_jump.elapsed_time~ +** Processing line: ~~ +** Processing line: ~ # how much time is allowed for increasing power~ +** Processing line: ~ time_allowed = args.state.jump.increase_frames~ +** Processing line: ~~ +** Processing line: ~ # if the player is jumping~ +** Processing line: ~ # and the elapsed time is less than~ +** Processing line: ~ # the allowed time~ +** Processing line: ~ if is_jumping && jump_elapsed_time < time_allowed~ +** Processing line: ~ # increase the dy by the increase power~ +** Processing line: ~ power_to_add = args.state.jump.increase_power~ +** Processing line: ~ args.state.player.dy += power_to_add~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc args~ +** Processing line: ~ if args.state.player.action == :jumping~ +** Processing line: ~ args.state.player.y += args.state.player.dy~ +** Processing line: ~ args.state.player.dy += args.state.gravity~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.player.y < 0~ +** Processing line: ~ args.state.player.y = 0~ +** Processing line: ~ args.state.player.action = :standing~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Mario - Jumping And Collisions - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Mario - Jumping And Collisions - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Mario - Jumping And Collisions - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_mario/02_jumping_and_collisions/app/main.rb~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ input~ +** Processing line: ~ calc~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ return if state.tick_count != 0~ +** Processing line: ~~ +** Processing line: ~ player.x = 64~ +** Processing line: ~ player.y = 800~ +** Processing line: ~ player.size = 50~ +** Processing line: ~ player.dx = 0~ +** Processing line: ~ player.dy = 0~ +** Processing line: ~ player.action = :falling~ +** Processing line: ~~ +** Processing line: ~ player.max_speed = 20~ +** Processing line: ~ player.jump_power = 15~ +** Processing line: ~ player.jump_air_time = 15~ +** Processing line: ~ player.jump_increase_power = 1~ +** Processing line: ~~ +** Processing line: ~ state.gravity = -1~ +** Processing line: ~ state.drag = 0.001~ +** Processing line: ~ state.tile_size = 64~ +** Processing line: ~ state.tiles ||= [~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 10, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 11, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 12, ordinal_y: 0 },~ +** Processing line: ~~ +** Processing line: ~ { ordinal_x: 9, ordinal_y: 3 },~ +** Processing line: ~ { ordinal_x: 10, ordinal_y: 3 },~ +** Processing line: ~ { ordinal_x: 11, ordinal_y: 3 },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ tiles.each do |t|~ +** Processing line: ~ t.rect = { x: t.ordinal_x * 64,~ +** Processing line: ~ y: t.ordinal_y * 64,~ +** Processing line: ~ w: 64,~ +** Processing line: ~ h: 64 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ render_player~ +** Processing line: ~ render_tiles~ +** Processing line: ~ # render_grid~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input~ +** Processing line: ~ input_jump~ +** Processing line: ~ input_move~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_player_rect~ +** Processing line: ~ calc_left~ +** Processing line: ~ calc_right~ +** Processing line: ~ calc_below~ +** Processing line: ~ calc_above~ +** Processing line: ~ calc_player_dy~ +** Processing line: ~ calc_player_dx~ +** Processing line: ~ calc_game_over~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_player~ +** Processing line: ~ outputs.sprites << {~ +** Processing line: ~ x: player.x,~ +** Processing line: ~ y: player.y,~ +** Processing line: ~ w: player.size,~ +** Processing line: ~ h: player.size,~ +** Processing line: ~ path: 'sprites/square/red.png'~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_tiles~ +** Processing line: ~ outputs.sprites << state.tiles.map do |t|~ +** Processing line: ~ t.merge path: 'sprites/square/white.png',~ +** Processing line: ~ x: t.ordinal_x * 64,~ +** Processing line: ~ y: t.ordinal_y * 64,~ +** Processing line: ~ w: 64,~ +** Processing line: ~ h: 64~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_grid~ +** Processing line: ~ if state.tick_count == 0~ +** Processing line: ~ outputs[:grid].background_color = [0, 0, 0, 0]~ +** Processing line: ~ outputs[:grid].borders << available_brick_locations~ +** Processing line: ~ outputs[:grid].labels << available_brick_locations.map do |b|~ +** Processing line: ~ [~ +** Processing line: ~ b.merge(text: "#{b.ordinal_x},#{b.ordinal_y}",~ +** Processing line: ~ x: b.x + 2,~ +** Processing line: ~ y: b.y + 2,~ +** Processing line: ~ size_enum: -3,~ +** Processing line: ~ vertical_alignment_enum: 0,~ +** Processing line: ~ blendmode_enum: 0),~ +** Processing line: ~ b.merge(text: "#{b.x},#{b.y}",~ +** Processing line: ~ x: b.x + 2,~ +** Processing line: ~ y: b.y + 2 + 20,~ +** Processing line: ~ size_enum: -3,~ +** Processing line: ~ vertical_alignment_enum: 0,~ +** Processing line: ~ blendmode_enum: 0)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :grid }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_jump~ +** Processing line: ~ if inputs.keyboard.key_down.space~ +** Processing line: ~ player_jump~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.key_held.space~ +** Processing line: ~ player_jump_increase_air_time~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_move~ +** Processing line: ~ if player.dx.abs < 20~ +** Processing line: ~ if inputs.keyboard.left~ +** Processing line: ~ player.dx -= 2~ +** Processing line: ~ elsif inputs.keyboard.right~ +** Processing line: ~ player.dx += 2~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_game_over~ +** Processing line: ~ if player.y < -64~ +** Processing line: ~ player.x = 64~ +** Processing line: ~ player.y = 800~ +** Processing line: ~ player.dx = 0~ +** Processing line: ~ player.dy = 0~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_player_rect~ +** Processing line: ~ player.rect = player_current_rect~ +** Processing line: ~ player.next_rect = player_next_rect~ +** Processing line: ~ player.prev_rect = player_prev_rect~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_player_dx~ +** Processing line: ~ player.dx = player_next_dx~ +** Processing line: ~ player.x += player.dx~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_player_dy~ +** Processing line: ~ player.y += player.dy~ +** Processing line: ~ player.dy = player_next_dy~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_below~ +** Processing line: ~ return unless player.dy < 0~ +** Processing line: ~ tiles_below = tiles_find { |t| t.rect.top <= player.prev_rect.y }~ +** Processing line: ~ collision = tiles_find_colliding tiles_below, (player.rect.merge y: player.next_rect.y)~ +** Processing line: ~ if collision~ +** Processing line: ~ player.y = collision.rect.y + state.tile_size~ +** Processing line: ~ player.dy = 0~ +** Processing line: ~ player.action = :standing~ +** Processing line: ~ else~ +** Processing line: ~ player.action = :falling~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_left~ +** Processing line: ~ return unless player.dx < 0 && player_next_dx < 0~ +** Processing line: ~ tiles_left = tiles_find { |t| t.rect.right <= player.prev_rect.left }~ +** Processing line: ~ collision = tiles_find_colliding tiles_left, (player.rect.merge x: player.next_rect.x)~ +** Processing line: ~ return unless collision~ +** Processing line: ~ player.x = collision.rect.right~ +** Processing line: ~ player.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_right~ +** Processing line: ~ return unless player.dx > 0 && player_next_dx > 0~ +** Processing line: ~ tiles_right = tiles_find { |t| t.rect.left >= player.prev_rect.right }~ +** Processing line: ~ collision = tiles_find_colliding tiles_right, (player.rect.merge x: player.next_rect.x)~ +** Processing line: ~ return unless collision~ +** Processing line: ~ player.x = collision.rect.left - player.rect.w~ +** Processing line: ~ player.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_above~ +** Processing line: ~ return unless player.dy > 0~ +** Processing line: ~ tiles_above = tiles_find { |t| t.rect.y >= player.prev_rect.y }~ +** Processing line: ~ collision = tiles_find_colliding tiles_above, (player.rect.merge y: player.next_rect.y)~ +** Processing line: ~ return unless collision~ +** Processing line: ~ player.dy = 0~ +** Processing line: ~ player.y = collision.rect.bottom - player.rect.h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_current_rect~ +** Processing line: ~ { x: player.x, y: player.y, w: player.size, h: player.size }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def available_brick_locations~ +** Processing line: ~ (0..19).to_a~ +** Processing line: ~ .product(0..11)~ +** Processing line: ~ .map do |(ordinal_x, ordinal_y)|~ +** Processing line: ~ { ordinal_x: ordinal_x,~ +** Processing line: ~ ordinal_y: ordinal_y,~ +** Processing line: ~ x: ordinal_x * 64,~ +** Processing line: ~ y: ordinal_y * 64,~ +** Processing line: ~ w: 64,~ +** Processing line: ~ h: 64 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player~ +** Processing line: ~ state.player ||= args.state.new_entity :player~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_next_dy~ +** Processing line: ~ player.dy + state.gravity + state.drag ** 2 * -1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_next_dx~ +** Processing line: ~ player.dx * 0.8~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_next_rect~ +** Processing line: ~ player.rect.merge x: player.x + player_next_dx,~ +** Processing line: ~ y: player.y + player_next_dy~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_prev_rect~ +** Processing line: ~ player.rect.merge x: player.x - player.dx,~ +** Processing line: ~ y: player.y - player.dy~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_jump~ +** Processing line: ~ return if player.action != :standing~ +** Processing line: ~ player.action = :jumping~ +** Processing line: ~ player.dy = state.player.jump_power~ +** Processing line: ~ current_frame = state.tick_count~ +** Processing line: ~ player.action_at = current_frame~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_jump_increase_air_time~ +** Processing line: ~ return if player.action != :jumping~ +** Processing line: ~ return if player.action_at.elapsed_time >= player.jump_air_time~ +** Processing line: ~ player.dy += player.jump_increase_power~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tiles~ +** Processing line: ~ state.tiles~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tiles_find_colliding tiles, target~ +** Processing line: ~ tiles.find { |t| t.rect.intersect_rect? target }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tiles_find &block~ +** Processing line: ~ tiles.find_all(&block)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game ||= Game.new~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ $gtk.reset~ @@ -209600,7 +230692,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/main.rb~ -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ +** Processing line: ~ MAP_FILE_PATH = 'map.txt'~ ** Processing line: ~~ ** Processing line: ~ require 'app/map.rb'~ ** Processing line: ~~ @@ -209655,35 +230747,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def render_intro~ ** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ -** Processing line: ~ if state.tick_count >= 120~ -** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 240~ -** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 360~ -** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 480~ -** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 600~ -** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ -** Processing line: ~ "sprites/square-green.png"]~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count == 800~ +** Processing line: ~ if state.tick_count == 120~ ** Processing line: ~ state.scene = :game~ ** Processing line: ~ state.game_start_at = state.tick_count~ ** Processing line: ~ end~ @@ -209691,7 +230755,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def tick~ ** Processing line: ~ defaults~ -** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ +** Processing line: ~ if state.scene == :intro && state.tick_count <= 120~ ** Processing line: ~ render_intro~ ** Processing line: ~ elsif state.scene == :ending~ ** Processing line: ~ render_ending~ @@ -209794,15 +230858,15 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ if state.god_mode~ ** Processing line: ~ # SHOW HIDE COLLISIONS~ -** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ -** Processing line: ~ x = vx(x)~ -** Processing line: ~ y = vy(y)~ +** Processing line: ~ outputs.sprites << state.world.map do |rect|~ +** Processing line: ~ x = vx(rect.x)~ +** Processing line: ~ y = vy(rect.y)~ ** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ ** Processing line: ~ {~ ** Processing line: ~ x: x,~ ** Processing line: ~ y: y,~ -** Processing line: ~ w: vw(w || state.tile_size),~ -** Processing line: ~ h: vh(h || state.tile_size),~ +** Processing line: ~ w: vw(rect.w || state.tile_size),~ +** Processing line: ~ h: vh(rect.h || state.tile_size),~ ** Processing line: ~ path: 'sprites/square-gray.png',~ ** Processing line: ~ a: 128~ ** Processing line: ~ }~ @@ -209825,8 +230889,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~~ ** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ -** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 32 * state.camera_scale,~ +** Processing line: ~ inputs.mouse.position.y - 32 * state.camera_scale,~ +** Processing line: ~ state.tile_size * state.camera_scale,~ +** Processing line: ~ state.tile_size * state.camera_scale, 'sprites/square-indigo.png', 0, 100].sprite~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ render_mini_map~ @@ -209907,6 +230973,29 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ set_camera_scale 1~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ if inputs.mouse.click~ +** Processing line: ~ state.id_seed += 1~ +** Processing line: ~ id = state.id_seed~ +** Processing line: ~ x = state.camera_x + (inputs.mouse.click.x.fdiv(state.camera_scale) - 32)~ +** Processing line: ~ y = state.camera_y + (inputs.mouse.click.y.fdiv(state.camera_scale) - 32)~ +** Processing line: ~ x = ((x + 2).idiv 4) * 4~ +** Processing line: ~ y = ((y + 2).idiv 4) * 4~ +** Processing line: ~ w = 64~ +** Processing line: ~ h = 64~ +** Processing line: ~ candidate_rect = { id: id, x: x, y: y, w: w, h: h }~ +** Processing line: ~ scaled_candidate_rect = { x: x + 30, y: y + 30, w: w - 60, h: h - 60 }~ +** Processing line: ~ to_remove = state.world.find { |r| r.intersect_rect? scaled_candidate_rect }~ +** Processing line: ~ if to_remove && args.inputs.keyboard.x~ +** Processing line: ~ state.world.reject! { |r| r.id == to_remove.id }~ +** Processing line: ~ else~ +** Processing line: ~ state.world << candidate_rect~ +** Processing line: ~ end~ +** Processing line: ~ export_map~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ state.world_collision_rects = nil~ +** Processing line: ~ calc_world_lookup~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ if input_up?~ ** Processing line: ~ state.y += 10~ ** Processing line: ~ state.dy = 0~ @@ -209928,12 +231017,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if state.scene == :game~ ** Processing line: ~ process_inputs_player_movement~ ** Processing line: ~ process_inputs_god_mode~ -** Processing line: ~ elsif state.scene == :intro~ -** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ -** Processing line: ~ if Kernel.tick_count < 600~ -** Processing line: ~ Kernel.tick_count = 600~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -210031,17 +231114,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def add_floors~ -** Processing line: ~ # floors~ -** Processing line: ~ state.world += [~ -** Processing line: ~ [0, 0, 10000, 40],~ -** Processing line: ~ [0, 1670, 3250, 60],~ -** Processing line: ~ [6691, 1653, 3290, 60],~ -** Processing line: ~ [1521, 3792, 7370, 60],~ -** Processing line: ~ [0, 5137, 3290, 60]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def attempt_load_world_from_file~ ** Processing line: ~ return if state.world~ ** Processing line: ~ # exported_world = gtk.read_file(MAP_FILE_PATH)~ @@ -210049,26 +231121,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ state.objects = []~ ** Processing line: ~~ ** Processing line: ~ if $collisions~ -** Processing line: ~ $collisions.map do |x, y, w, h|~ -** Processing line: ~ state.world << [x, y, w, h]~ +** Processing line: ~ state.id_seed ||= 0~ +** Processing line: ~ $collisions.each do |x, y, w, h|~ +** Processing line: ~ state.id_seed += 1~ +** Processing line: ~ state.world << { id: state.id_seed, x: x, y: y, w: w, h: h }~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ add_floors~ -** Processing line: ~ # elsif exported_world~ -** Processing line: ~ # exported_world.each_line.map do |l|~ -** Processing line: ~ # tokens = l.strip.split(',')~ -** Processing line: ~ # x = tokens[0].to_i~ -** Processing line: ~ # y = tokens[1].to_i~ -** Processing line: ~ # type = tokens[2].to_i~ -** Processing line: ~ # if type == 1~ -** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ -** Processing line: ~ # elsif type == 2~ -** Processing line: ~ # w, h, path = tokens[3..-1]~ -** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ -** Processing line: ~ # end~ -** Processing line: ~ # end~ -** Processing line: ~~ -** Processing line: ~ # add_floors~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if $mugs~ @@ -210089,23 +231146,24 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # Searches through the world and finds the cordinates that exist~ ** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ state.world.each do |x, y, w, h|~ -** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ +** Processing line: ~ state.world.each do |rect|~ +** Processing line: ~ state.world_lookup[rect.id] = rect~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Assigns collision rects for every sprite drawn~ ** Processing line: ~ state.world_collision_rects =~ ** Processing line: ~ state.world_lookup~ ** Processing line: ~ .keys~ -** Processing line: ~ .map do |x, y, w, h|~ +** Processing line: ~ .map do |key|~ +** Processing line: ~ rect = state.world_lookup[key]~ ** Processing line: ~ s = state.tile_size~ -** Processing line: ~ w ||= s~ -** Processing line: ~ h ||= s~ +** Processing line: ~ rect.w ||= s~ +** Processing line: ~ rect.h ||= s~ ** Processing line: ~ {~ -** Processing line: ~ args: [x, y, w, h],~ -** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ -** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ -** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ +** Processing line: ~ args: rect,~ +** Processing line: ~ left_right: { x: rect.x, y: rect.y + 4, w: rect.w, h: rect.h - 6 },~ +** Processing line: ~ top: { x: rect.x + 4, y: rect.y + 6, w: rect.w - 8, h: rect.h - 6 },~ +** Processing line: ~ bottom: { x: rect.x + 1, y: rect.y - 1, w: rect.w - 2, h: rect.h - 8 },~ ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -210161,12 +231219,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def end_of_tongue~ ** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ -** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ +** Processing line: ~ { x: start_of_tongue.x + p.x, y: start_of_tongue.y + p.y }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def calc_shooting~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ calc_shooting_increment~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_shooting_increment~ ** Processing line: ~ return unless state.action == :shooting~ -** Processing line: ~ state.tongue_length += 30~ +** Processing line: ~ state.tongue_length += 5~ ** Processing line: ~ potential_anchor = end_of_tongue~ ** Processing line: ~ if potential_anchor.x <= 0~ ** Processing line: ~ state.anchor_point = potential_anchor~ @@ -210185,9 +231252,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ state.action = :anchored~ ** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ ** Processing line: ~ else~ -** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ +** Processing line: ~ anchor_rect = { x: potential_anchor.x - 5, y: potential_anchor.y - 5, w: 10, h: 10 }~ ** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ -** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ +** Processing line: ~ v[:args].intersect_rect?(anchor_rect)~ ** Processing line: ~ end.first~ ** Processing line: ~ if collision~ ** Processing line: ~ state.anchor_point = potential_anchor~ @@ -210283,7 +231350,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ .first~ ** Processing line: ~~ ** Processing line: ~ return unless left_side_collisions~ -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ +** Processing line: ~ state.x = left_side_collisions[:left_right].right + 1~ ** Processing line: ~ state.dx = state.dy.abs * 0.8~ ** Processing line: ~ state.collision_on_x = true~ ** Processing line: ~ end~ @@ -210298,7 +231365,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ .first~ ** Processing line: ~~ ** Processing line: ~ return unless right_side_collisions~ -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size - 1~ ** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ ** Processing line: ~ state.collision_on_x = true~ ** Processing line: ~ end~ @@ -210314,7 +231381,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ .first~ ** Processing line: ~~ ** Processing line: ~ return unless ceil_collisions~ -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size - 1~ ** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ ** Processing line: ~ state.collision_on_y = true~ ** Processing line: ~ end~ @@ -210327,13 +231394,17 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def export_map~ -** Processing line: ~ export_string = state.world.map do |x, y|~ -** Processing line: ~ "#{x},#{y},1"~ -** Processing line: ~ end~ +** Processing line: ~ export_string = "$collisions = [\n"~ +** Processing line: ~ export_string += state.world.map do |rect|~ +** Processing line: ~ "[#{rect.x},#{rect.y},#{rect.w},#{rect.h}],"~ +** Processing line: ~ end.join "\n"~ +** Processing line: ~ export_string += "\n]\n\n"~ +** Processing line: ~ export_string += "$mugs = [\n"~ ** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ -** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ -** Processing line: ~ end~ -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ +** Processing line: ~ "[#{x},#{y},#{w},#{h},'#{path}'],"~ +** Processing line: ~ end.join "\n"~ +** Processing line: ~ export_string += "\n]\n\n"~ +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string)~ ** Processing line: ~ state.map_saved_at = state.tick_count~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -211476,6 +232547,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ [4459, 3997, 64, 64],~ ** Processing line: ~ [76, 5215, 64, 64],~ ** Processing line: ~ [39, 5217, 64, 64],~ +** Processing line: ~ [0, 0, 10000, 40],~ +** Processing line: ~ [0, 1670, 3250, 60],~ +** Processing line: ~ [6691, 1653, 3290, 60],~ +** Processing line: ~ [1521, 3792, 7370, 60],~ +** Processing line: ~ [0, 5137, 3290, 60]~ ** Processing line: ~ ]~ ** Processing line: ~~ ** Processing line: ~ $mugs = [~ @@ -212406,6 +233482,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def load_lines file~ +** Processing line: ~ return unless state.snaps~ ** Processing line: ~ data = gtk.read_file(file) || ""~ ** Processing line: ~ data.each_line~ ** Processing line: ~ .reject { |l| l.strip.length == 0 }~ @@ -212464,10 +233541,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ results[:point] = { x: x, y: y }~ ** Processing line: ~ results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }~ ** Processing line: ~ results[:trajectory] = trajectory(results)~ -** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ +** Processing line: ~ results[:impacts] = terrain.find_all { |t| t && (line_near_rect? results[:rect], t) }.map do |t|~ ** Processing line: ~ {~ ** Processing line: ~ terrain: t,~ -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000),~ ** Processing line: ~ type: :terrain~ ** Processing line: ~ }~ ** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ @@ -212475,10 +233552,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ ** Processing line: ~ {~ ** Processing line: ~ terrain: t,~ -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t, replace_infinity: 1000),~ ** Processing line: ~ type: :lava~ ** Processing line: ~ }~ -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ +** Processing line: ~ end.reject { |t| !t || (!point_within_line? t[:point], t[:terrain]) }~ ** Processing line: ~~ ** Processing line: ~ results~ ** Processing line: ~ end~ @@ -212491,6 +233568,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def calc_terrains_to_monitor~ +** Processing line: ~ return unless circle.impacts~ ** Processing line: ~ circle.impact = nil~ ** Processing line: ~ circle.impacts.each do |i|~ ** Processing line: ~ circle.terrains_to_monitor[i[:terrain]] ||= {~ @@ -218402,6 +239480,166 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Rpg Topdown - Topdown Casino - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Rpg Topdown - Topdown Casino - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Rpg Topdown - Topdown Casino - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_topdown/topdown_casino/app/main.rb~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~ def coinflip~ +** Processing line: ~ rand < 0.5~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_accessor :args~ +** Processing line: ~~ +** Processing line: ~ def text_font~ +** Processing line: ~ return nil #"rpg.ttf"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def text_color~ +** Processing line: ~ [ 255, 255, 255, 255 ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_gem_values~ +** Processing line: ~ @args.state.gem0 = ((coinflip) ? 100 : 20)~ +** Processing line: ~ @args.state.gem1 = ((coinflip) ? -10 : -50)~ +** Processing line: ~ @args.state.gem2 = ((coinflip) ? -10 : -30)~ +** Processing line: ~ if coinflip~ +** Processing line: ~ tmp = @args.state.gem0~ +** Processing line: ~ @args.state.gem0 = @args.state.gem1~ +** Processing line: ~ @args.state.gem1 = tmp~ +** Processing line: ~ end~ +** Processing line: ~ if coinflip~ +** Processing line: ~ tmp = @args.state.gem1~ +** Processing line: ~ @args.state.gem1 = @args.state.gem2~ +** Processing line: ~ @args.state.gem2 = tmp~ +** Processing line: ~ end~ +** Processing line: ~ if coinflip~ +** Processing line: ~ tmp = @args.state.gem0~ +** Processing line: ~ @args.state.gem0 = @args.state.gem2~ +** Processing line: ~ @args.state.gem2 = tmp~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def initialize args~ +** Processing line: ~ @args = args~ +** Processing line: ~ @args.state.animticks = 0~ +** Processing line: ~ @args.state.score = 0~ +** Processing line: ~ @args.state.gem_chosen = false~ +** Processing line: ~ @args.state.round_finished = false~ +** Processing line: ~ @args.state.gem0_x = 197~ +** Processing line: ~ @args.state.gem0_y = 720-274~ +** Processing line: ~ @args.state.gem1_x = 623~ +** Processing line: ~ @args.state.gem1_y = 720-274~ +** Processing line: ~ @args.state.gem2_x = 1049~ +** Processing line: ~ @args.state.gem2_y = 720-274~ +** Processing line: ~ @args.state.hero_sprite = "sprites/herodown100.png"~ +** Processing line: ~ @args.state.hero_x = 608~ +** Processing line: ~ @args.state.hero_y = 720-656~ +** Processing line: ~ set_gem_values~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_gem_value x, y, gem~ +** Processing line: ~ if @args.state.gem_chosen~ +** Processing line: ~ @args.outputs.labels << [ x, y + 96, gem.to_s, 1, 1, *text_color, text_font ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ gemsprite = ((@args.state.animticks % 400) < 200) ? 'sprites/gem200.png' : 'sprites/gem400.png'~ +** Processing line: ~ @args.outputs.background_color = [ 0, 0, 0, 255 ]~ +** Processing line: ~ @args.outputs.sprites << [608, 720-150, 64, 64, 'sprites/oldman.png']~ +** Processing line: ~ @args.outputs.sprites << [300, 720-150, 64, 64, 'sprites/fire.png']~ +** Processing line: ~ @args.outputs.sprites << [900, 720-150, 64, 64, 'sprites/fire.png']~ +** Processing line: ~ @args.outputs.sprites << [@args.state.gem0_x, @args.state.gem0_y, 32, 64, gemsprite]~ +** Processing line: ~ @args.outputs.sprites << [@args.state.gem1_x, @args.state.gem1_y, 32, 64, gemsprite]~ +** Processing line: ~ @args.outputs.sprites << [@args.state.gem2_x, @args.state.gem2_y, 32, 64, gemsprite]~ +** Processing line: ~ @args.outputs.sprites << [@args.state.hero_x, @args.state.hero_y, 64, 64, @args.state.hero_sprite]~ +** Processing line: ~~ +** Processing line: ~ @args.outputs.labels << [ 630, 720-30, "IT'S A SECRET TO EVERYONE.", 1, 1, *text_color, text_font ]~ +** Processing line: ~ @args.outputs.labels << [ 50, 720-85, @args.state.score.to_s, 1, 1, *text_color, text_font ]~ +** Processing line: ~ render_gem_value @args.state.gem0_x, @args.state.gem0_y, @args.state.gem0~ +** Processing line: ~ render_gem_value @args.state.gem1_x, @args.state.gem1_y, @args.state.gem1~ +** Processing line: ~ render_gem_value @args.state.gem2_x, @args.state.gem2_y, @args.state.gem2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ @args.state.animticks += 16~ +** Processing line: ~~ +** Processing line: ~ return unless @args.state.gem_chosen~ +** Processing line: ~ @args.state.round_finished_debounce ||= 60 * 3~ +** Processing line: ~ @args.state.round_finished_debounce -= 1~ +** Processing line: ~ return if @args.state.round_finished_debounce > 0~ +** Processing line: ~~ +** Processing line: ~ @args.state.gem_chosen = false~ +** Processing line: ~ @args.state.hero.sprite[0] = 'sprites/herodown100.png'~ +** Processing line: ~ @args.state.hero.sprite[1] = 608~ +** Processing line: ~ @args.state.hero.sprite[2] = 656~ +** Processing line: ~ @args.state.round_finished_debounce = nil~ +** Processing line: ~ set_gem_values~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def walk xdir, ydir, anim~ +** Processing line: ~ @args.state.hero_sprite = "sprites/#{anim}#{(((@args.state.animticks % 200) < 100) ? '100' : '200')}.png"~ +** Processing line: ~ @args.state.hero_x += 5 * xdir~ +** Processing line: ~ @args.state.hero_y += 5 * ydir~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def check_gem_touching gem_x, gem_y, gem~ +** Processing line: ~ return if @args.state.gem_chosen~ +** Processing line: ~ herorect = [ @args.state.hero_x, @args.state.hero_y, 64, 64 ]~ +** Processing line: ~ return if !herorect.intersect_rect?([gem_x, gem_y, 32, 64])~ +** Processing line: ~ @args.state.gem_chosen = true~ +** Processing line: ~ @args.state.score += gem~ +** Processing line: ~ @args.outputs.sounds << ((gem < 0) ? 'sounds/lose.wav' : 'sounds/win.wav')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input~ +** Processing line: ~ if @args.inputs.keyboard.key_held.left~ +** Processing line: ~ walk(-1.0, 0.0, 'heroleft')~ +** Processing line: ~ elsif @args.inputs.keyboard.key_held.right~ +** Processing line: ~ walk(1.0, 0.0, 'heroright')~ +** Processing line: ~ elsif @args.inputs.keyboard.key_held.up~ +** Processing line: ~ walk(0.0, 1.0, 'heroup')~ +** Processing line: ~ elsif @args.inputs.keyboard.key_held.down~ +** Processing line: ~ walk(0.0, -1.0, 'herodown')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ check_gem_touching(@args.state.gem0_x, @args.state.gem0_y, @args.state.gem0)~ +** Processing line: ~ check_gem_touching(@args.state.gem1_x, @args.state.gem1_y, @args.state.gem1)~ +** Processing line: ~ check_gem_touching(@args.state.gem2_x, @args.state.gem2_y, @args.state.gem2)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ input~ +** Processing line: ~ calc~ +** Processing line: ~ render~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.game ||= Game.new args~ +** Processing line: ~ args.state.game.args = args~ +** Processing line: ~ args.state.game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** Rpg Topdown - Topdown Starting Point - main.rb~ - H3 detected. - Determining if line is a header. @@ -218531,6 +239769,219 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** Teenytiny - Teenytiny Starting Point - main.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Teenytiny - Teenytiny Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Teenytiny - Teenytiny Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_teenytiny/teenytiny_starting_point/app/main.rb~ +** Processing line: ~ # full documenation is at http://docs.dragonruby.org~ +** Processing line: ~ # be sure to come to the discord if you hit any snags: http://discord.dragonruby.org~ +** Processing line: ~ def tick args~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # initialize default variables~ +** Processing line: ~ # ====================================================~ +** Processing line: ~~ +** Processing line: ~ # ruby has an operator called ||= which means "only initialize this if it's nil"~ +** Processing line: ~ args.state.count_down ||= 20 * 60 # set the count down to 20 seconds~ +** Processing line: ~ # set the initial position of the target~ +** Processing line: ~ args.state.target ||= { x: args.grid.w.half,~ +** Processing line: ~ y: args.grid.h.half,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20 }~ +** Processing line: ~~ +** Processing line: ~ # set the initial position of the player~ +** Processing line: ~ args.state.player ||= { x: 50,~ +** Processing line: ~ y: 50,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20 }~ +** Processing line: ~~ +** Processing line: ~ # set the player movement speed~ +** Processing line: ~ args.state.player_speed ||= 5~ +** Processing line: ~~ +** Processing line: ~ # set the score~ +** Processing line: ~ args.state.score ||= 0~ +** Processing line: ~ args.state.teleports ||= 3~ +** Processing line: ~~ +** Processing line: ~ # set the instructions~ +** Processing line: ~ args.state.instructions ||= "Get to the red goal! Use arrow keys to move. Spacebar to teleport (use them carefully)!"~ +** Processing line: ~~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # render the game~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half, y: args.grid.h - 10,~ +** Processing line: ~ text: args.state.instructions,~ +** Processing line: ~ alignment_enum: 1 }~ +** Processing line: ~~ +** Processing line: ~ # check if it's game over. if so, then render game over~ +** Processing line: ~ # otherwise render the current time left~ +** Processing line: ~ if game_over? args~ +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +** Processing line: ~ y: args.grid.h - 40,~ +** Processing line: ~ text: "game over! (press r to start over)",~ +** Processing line: ~ alignment_enum: 1 }~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +** Processing line: ~ y: args.grid.h - 40,~ +** Processing line: ~ text: "time left: #{(args.state.count_down.idiv 60) + 1}",~ +** Processing line: ~ alignment_enum: 1 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # render the score~ +** Processing line: ~ args.outputs.labels << { x: args.grid.w.half,~ +** Processing line: ~ y: args.grid.h - 70,~ +** Processing line: ~ text: "score: #{args.state.score}",~ +** Processing line: ~ alignment_enum: 1 }~ +** Processing line: ~~ +** Processing line: ~ # render the player with teleport count~ +** Processing line: ~ args.outputs.sprites << { x: args.state.player.x,~ +** Processing line: ~ y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.w,~ +** Processing line: ~ h: args.state.player.h,~ +** Processing line: ~ path: 'sprites/square-green.png' }~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << { x: args.state.player.x + 10,~ +** Processing line: ~ y: args.state.player.y + 40,~ +** Processing line: ~ text: "teleports: #{args.state.teleports}",~ +** Processing line: ~ alignment_enum: 1, size_enum: -2 }~ +** Processing line: ~~ +** Processing line: ~ # render the target~ +** Processing line: ~ args.outputs.sprites << { x: args.state.target.x,~ +** Processing line: ~ y: args.state.target.y,~ +** Processing line: ~ w: args.state.target.w,~ +** Processing line: ~ h: args.state.target.h,~ +** Processing line: ~ path: 'sprites/square-red.png' }~ +** Processing line: ~~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # run simulation~ +** Processing line: ~ # ====================================================~ +** Processing line: ~~ +** Processing line: ~ # count down calculation~ +** Processing line: ~ args.state.count_down -= 1~ +** Processing line: ~ args.state.count_down = -1 if args.state.count_down < -1~ +** Processing line: ~~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # process player input~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # if it isn't game over let them move~ +** Processing line: ~ if !game_over? args~ +** Processing line: ~ dir_y = 0~ +** Processing line: ~ dir_x = 0~ +** Processing line: ~~ +** Processing line: ~ # determine the change horizontally~ +** Processing line: ~ if args.inputs.keyboard.up~ +** Processing line: ~ dir_y += args.state.player_speed~ +** Processing line: ~ elsif args.inputs.keyboard.down~ +** Processing line: ~ dir_y -= args.state.player_speed~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # determine the change vertically~ +** Processing line: ~ if args.inputs.keyboard.left~ +** Processing line: ~ dir_x -= args.state.player_speed~ +** Processing line: ~ elsif args.inputs.keyboard.right~ +** Processing line: ~ dir_x += args.state.player_speed~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # determine if teleport can be used~ +** Processing line: ~ if args.inputs.keyboard.key_down.space && args.state.teleports > 0~ +** Processing line: ~ args.state.teleports -= 1~ +** Processing line: ~ dir_x *= 20~ +** Processing line: ~ dir_y *= 20~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # apply change to player~ +** Processing line: ~ args.state.player.x += dir_x~ +** Processing line: ~ args.state.player.y += dir_y~ +** Processing line: ~ else~ +** Processing line: ~ # if r is pressed, reset the game~ +** Processing line: ~ if args.inputs.keyboard.key_down.r~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ====================================================~ +** Processing line: ~ # determine score~ +** Processing line: ~ # ====================================================~ +** Processing line: ~~ +** Processing line: ~ # calculate new score if the player is at goal~ +** Processing line: ~ if !game_over? args~ +** Processing line: ~~ +** Processing line: ~ # if the player is at the goal, then move the goal~ +** Processing line: ~ if args.state.player.intersect_rect? args.state.target~ +** Processing line: ~ # increment the goal~ +** Processing line: ~ args.state.score += 1~ +** Processing line: ~~ +** Processing line: ~ # move the goal to a random location~ +** Processing line: ~ args.state.target = { x: (rand args.grid.w), y: (rand args.grid.h), w: 20, h: 20 }~ +** Processing line: ~~ +** Processing line: ~ # make sure the goal is inside the view area~ +** Processing line: ~ if args.state.target.x < 0~ +** Processing line: ~ args.state.target.x += 20~ +** Processing line: ~ elsif args.state.target.x > 1280~ +** Processing line: ~ args.state.target.x -= 20~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # make sure the goal is inside the view area~ +** Processing line: ~ if args.state.target.y < 0~ +** Processing line: ~ args.state.target.y += 20~ +** Processing line: ~ elsif args.state.target.y > 720~ +** Processing line: ~ args.state.target.y -= 20~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def game_over? args~ +** Processing line: ~ args.state.count_down < 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Teenytiny - Teenytiny Starting Point - license.txt~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Teenytiny - Teenytiny Starting Point - license.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Teenytiny - Teenytiny Starting Point - license.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_teenytiny/teenytiny_starting_point/license.txt~ +** Processing line: ~ Copyright 2019 DragonRuby LLC~ +** Processing line: ~~ +** Processing line: ~ MIT License~ +** Processing line: ~~ +** Processing line: ~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:~ +** Processing line: ~~ +** Processing line: ~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.~ +** Processing line: ~~ +** Processing line: ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~** OSS~ - H2 detected. - Determining if line is a header. @@ -218551,6 +240002,661 @@ Follows is a source code listing for all files that have been open sourced. This - Line's tilde count is: 0 - Line contains link marker: true - LINK detected. +** Processing line: ~*** api.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~api.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~api.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/api.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # api.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ module GTK~ +** Processing line: ~ class Api~ +** Processing line: ~ def initialize~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_autocomplete args, req~ +** Processing line: ~ html = <<-S~ +** Processing line: ~ <html>~ +** Processing line: ~ <head>~ +** Processing line: ~ <meta charset="UTF-8"/>~ +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +** Processing line: ~ <style>~ +** Processing line: ~ pre {~ +** Processing line: ~ border: solid 1px silver;~ +** Processing line: ~ padding: 10px;~ +** Processing line: ~ font-size: 14px;~ +** Processing line: ~ white-space: pre-wrap;~ +** Processing line: ~ white-space: -moz-pre-wrap;~ +** Processing line: ~ white-space: -pre-wrap;~ +** Processing line: ~ white-space: -o-pre-wrap;~ +** Processing line: ~ word-wrap: break-word;~ +** Processing line: ~ }~ +** Processing line: ~ </style>~ +** Processing line: ~ </head>~ +** Processing line: ~ <body>~ +** Processing line: ~ <script>~ +** Processing line: ~ async function submitForm() {~ +** Processing line: ~ const result = await fetch("/dragon/autocomplete/", {~ +** Processing line: ~ method: 'POST',~ +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +** Processing line: ~ body: JSON.stringify({ index: document.getElementById("index").value,~ +** Processing line: ~ text: document.getElementById("text").value }),~ +** Processing line: ~ });~ +** Processing line: ~ document.getElementById("autocomplete-results").innerHTML = await result.text();~ +** Processing line: ~ }~ +** Processing line: ~ </script>~ +** Processing line: ~ <form>~ +** Processing line: ~ <div>index</div>~ +** Processing line: ~ <input name="index" id="index" type="text" value="27" />~ +** Processing line: ~ <div>code</div>~ +** Processing line: ~ <textarea name="text" id="text" rows="30" cols="80">def tick args~ +** Processing line: ~ args.state.~ +** Processing line: ~ end</textarea>~ +** Processing line: ~ <br/>~ +** Processing line: ~ <input type="button" value="Get Suggestions" onclick="submitForm();" />~ +** Processing line: ~ <span id="success-notification"></span>~ +** Processing line: ~ </form>~ +** Processing line: ~ <pre id="autocomplete-results">~ +** Processing line: ~ </pre>~ +** Processing line: ~~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ html,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_autocomplete args, req~ +** Processing line: ~ json = ($gtk.parse_json req.body)~ +** Processing line: ~ index = json["index"].to_i~ +** Processing line: ~ text = json["text"]~ +** Processing line: ~ suggestions = args.gtk.suggest_autocompletion index: index, text: text~ +** Processing line: ~ list_as_string = suggestions.join("\n")~ +** Processing line: ~ req.respond 200, list_as_string, { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ define_method :links do~ +** Processing line: ~ <<-S~ +** Processing line: ~ <ul>~ +** Processing line: ~ <li><a href="/">Home</a></li>~ +** Processing line: ~ <li><a href="/docs.html">Docs</a></li>~ +** Processing line: ~ <li><a href="/dragon/control_panel/">Control Panel</a></li>~ +** Processing line: ~ <li><a href="/dragon/eval/">Console</a></li>~ +** Processing line: ~ <li><a href="/dragon/log/">Logs</a></li>~ +** Processing line: ~ <li><a href="/dragon/puts/">Puts</a></li>~ +** Processing line: ~ <li><a href="/dragon/code/">Code</a></li>~ +** Processing line: ~ </ul>~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_index args, req~ +** Processing line: ~ req.respond 200, <<-S, { 'Content-Type' => 'text/html' }~ +** Processing line: ~ <html>~ +** Processing line: ~ <head>~ +** Processing line: ~ <meta charset="UTF-8"/>~ +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +** Processing line: ~ </head>~ +** Processing line: ~ <body>~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def source_code_links args~ +** Processing line: ~ links = args.gtk.reload_list_history.keys.map do |f|~ +** Processing line: ~ "<li><a href=\"/dragon/code/edit/?file=#{f}\">#{f}</a></li>"~ +** Processing line: ~ end~ +** Processing line: ~ <<-S~ +** Processing line: ~ <ul>~ +** Processing line: ~ #{links.join("\n")}~ +** Processing line: ~ </ul>~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_code args, req~ +** Processing line: ~ view = <<-S~ +** Processing line: ~ <html>~ +** Processing line: ~ <head>~ +** Processing line: ~ <meta charset="UTF-8"/>~ +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +** Processing line: ~ </head>~ +** Processing line: ~ <body>~ +** Processing line: ~ #{source_code_links args}~ +** Processing line: ~~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def code_edit_view args, file~ +** Processing line: ~ view = <<-S~ +** Processing line: ~ <html>~ +** Processing line: ~ <head>~ +** Processing line: ~ <meta charset="UTF-8"/>~ +** Processing line: ~ <title>DragonRuby Game Toolkit Documentation</title>~ +** Processing line: ~ </head>~ +** Processing line: ~ <body>~ +** Processing line: ~ <script>~ +** Processing line: ~ async function submitForm() {~ +** Processing line: ~ const result = await fetch("/dragon/code/update/?file=#{file}", {~ +** Processing line: ~ method: 'POST',~ +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +** Processing line: ~ body: JSON.stringify({ code: document.getElementById("code").value }),~ +** Processing line: ~ });~ +** Processing line: ~ document.getElementById("success-notification").innerHTML = "update successful";~ +** Processing line: ~ setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000);~ +** Processing line: ~ }~ +** Processing line: ~ </script>~ +** Processing line: ~ <form>~ +** Processing line: ~ <div><code>#{file}:</code></div>~ +** Processing line: ~ <textarea name="code" id="code" rows="30" cols="80">#{args.gtk.read_file file}</textarea>~ +** Processing line: ~ <br/>~ +** Processing line: ~ <input type="button" value="Update" onclick="submitForm();" />~ +** Processing line: ~ <span id="success-notification"></span>~ +** Processing line: ~ </form>~ +** Processing line: ~ #{source_code_links args}~ +** Processing line: ~~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_code_edit args, req~ +** Processing line: ~ file = req.uri.split('?').last.gsub("file=", "")~ +** Processing line: ~ view = code_edit_view args, file~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_code_update args, req~ +** Processing line: ~ file = req.uri.split('?').last.gsub("file=", "")~ +** Processing line: ~ code = ($gtk.parse_json req.body)["code"]~ +** Processing line: ~ args.gtk.write_file file, code~ +** Processing line: ~ view = code_edit_view args, file~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_boot args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("tmp/src_backup/boot.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_trace args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("logs/trace.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_log args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("logs/log.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_log args, req~ +** Processing line: ~ Log.log req.body~ +** Processing line: ~~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ "ok",~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_puts args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("logs/puts.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_changes args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("tmp/src_backup/src_backup_changes.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_favicon_ico args, req~ +** Processing line: ~ @favicon ||= args.gtk.read_file('docs/favicon.ico')~ +** Processing line: ~ req.respond 200, @favicon, { "Content-Type" => 'image/x-icon' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup args, req~ +** Processing line: ~ file_name = req.uri.gsub("/dragon/", "")~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("tmp/src_backup/#{file_name}"),~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_not_found args, req~ +** Processing line: ~ puts("METHOD: #{req.method}");~ +** Processing line: ~ puts("URI: #{req.uri}");~ +** Processing line: ~ puts("HEADERS:");~ +** Processing line: ~ req.headers.each { |k,v| puts(" #{k}: #{v}") }~ +** Processing line: ~ req.respond 404, "not found: #{req.uri}", { }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_docs_html args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("docs/docs.html"),~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_docs_css args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("docs/docs.css"),~ +** Processing line: ~ { 'Content-Type' => 'text/css' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_docs_search_gif args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("docs/docs_search.gif"),~ +** Processing line: ~ { 'Content-Type' => 'image/gif' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup_index_html args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_index.html"),~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup_index_txt args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_index.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/txt' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup_css args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup.css"),~ +** Processing line: ~ { 'Content-Type' => 'text/css' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup_changes_html args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_changes.html"),~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_src_backup_changes_txt args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ args.gtk.read_file("/tmp/src_backup/src_backup_changes.txt"),~ +** Processing line: ~ { 'Content-Type' => 'text/txt' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_eval args, req~ +** Processing line: ~ eval_view = <<-S~ +** Processing line: ~ <html lang="en">~ +** Processing line: ~ <head><title>Eval</title></head>~ +** Processing line: ~ <style>~ +** Processing line: ~ pre {~ +** Processing line: ~ border: solid 1px silver;~ +** Processing line: ~ padding: 10px;~ +** Processing line: ~ font-size: 14px;~ +** Processing line: ~ white-space: pre-wrap;~ +** Processing line: ~ white-space: -moz-pre-wrap;~ +** Processing line: ~ white-space: -pre-wrap;~ +** Processing line: ~ white-space: -o-pre-wrap;~ +** Processing line: ~ word-wrap: break-word;~ +** Processing line: ~ }~ +** Processing line: ~ </style>~ +** Processing line: ~ <body>~ +** Processing line: ~ <script>~ +** Processing line: ~ async function submitForm() {~ +** Processing line: ~ const result = await fetch("/dragon/eval/", {~ +** Processing line: ~ method: 'POST',~ +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +** Processing line: ~ body: JSON.stringify({ code: document.getElementById("code").value }),~ +** Processing line: ~ });~ +** Processing line: ~ document.getElementById("eval-result").innerHTML = await result.text();~ +** Processing line: ~ }~ +** Processing line: ~ </script>~ +** Processing line: ~ <form>~ +** Processing line: ~ <textarea name="code" id="code" rows="10" cols="80"># write your code here and set $result.\n$result = $gtk.args.state</textarea>~ +** Processing line: ~ <br/>~ +** Processing line: ~ <input type="button" onclick="submitForm();" value="submit" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <pre>curl -H "Content-Type: application/json" --data '{ "code": "$result = $args.state" }' -X POST http://localhost:9001/dragon/eval/</pre>~ +** Processing line: ~ <div>Eval Result:</div>~ +** Processing line: ~ <pre id="eval-result"></pre>~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ eval_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_eval args, req~ +** Processing line: ~ if json? req~ +** Processing line: ~ code = ($gtk.parse_json req.body)["code"]~ +** Processing line: ~ code = code.gsub("$result", "$eval_result")~ +** Processing line: ~ Object.new.instance_eval do~ +** Processing line: ~ begin~ +** Processing line: ~ Kernel.eval code~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ $eval_result = e~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ "#{$eval_result || $eval_results || "nil"}",~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~~ +** Processing line: ~ $eval_result = nil~ +** Processing line: ~ $eval_results = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def api_css_string~ +** Processing line: ~~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_console args, req~ +** Processing line: ~ html = console_view "# write your code here and set $result.\n$result = $gtk.args.state"~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ html,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def control_panel_view~ +** Processing line: ~ <<-S~ +** Processing line: ~ <html lang="en">~ +** Processing line: ~ <head><title>console</title></head>~ +** Processing line: ~ <body>~ +** Processing line: ~ <script>~ +** Processing line: ~ async function submitForm(url) {~ +** Processing line: ~ const result = await fetch(url, {~ +** Processing line: ~ method: 'POST',~ +** Processing line: ~ headers: { 'Content-Type': 'application/json' },~ +** Processing line: ~ body: JSON.stringify({}),~ +** Processing line: ~ });~ +** Processing line: ~ document.getElementById("success-notification").innerHTML = "successful";~ +** Processing line: ~ setTimeout(function() { document.getElementById("success-notification").innerHTML = ""; }, 3000);~ +** Processing line: ~ }~ +** Processing line: ~ </script>~ +** Processing line: ~ <form>~ +** Processing line: ~ <input type="button" value="Show Console" onclick="submitForm('/dragon/show_console/')" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <form>~ +** Processing line: ~ <input type="button" value="Reset Game" onclick="submitForm('/dragon/reset/');" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <form>~ +** Processing line: ~ <input type="button" value="Record Gameplay" onclick="submitForm('/dragon/record/');" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <form>~ +** Processing line: ~ <input type="button" value="Stop Recording" onclick="submitForm('/dragon/record_stop/');" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <form>~ +** Processing line: ~ <input type="button" value="Replay Recording" onclick="submitForm('/dragon/replay/');" />~ +** Processing line: ~ </form>~ +** Processing line: ~ <div id="success-notification"></div>~ +** Processing line: ~ #{links}~ +** Processing line: ~ </body>~ +** Processing line: ~ </html>~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_api_control_panel args, req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def json? req~ +** Processing line: ~ req.headers.find { |k, v| k == "Content-Type" && (v.include? "application/json") }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_reset args, req~ +** Processing line: ~ $gtk.reset if json? req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_record args, req~ +** Processing line: ~ $recording.start 100 if json? req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_record_stop args, req~ +** Processing line: ~ $recording.stop 'replay.txt' if json? req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_replay args, req~ +** Processing line: ~ $replay.start 'replay.txt' if json? req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def post_api_show_console args, req~ +** Processing line: ~ $gtk.console.show if json? req~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ control_panel_view,~ +** Processing line: ~ { 'Content-Type' => 'text/html' }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.inputs.http_requests.each do |req|~ +** Processing line: ~ match_candidate = { method: req.method.downcase.to_sym,~ +** Processing line: ~ uri: req.uri,~ +** Processing line: ~ uri_without_query_string: (req.uri.split '?').first,~ +** Processing line: ~ query_string: (req.uri.split '?').last,~ +** Processing line: ~ has_query_string: !!(req.uri.split '?').last,~ +** Processing line: ~ has_api_prefix: (req.uri.start_with? "/dragon"),~ +** Processing line: ~ end_with_rb: (req.uri.end_with? ".rb"),~ +** Processing line: ~ has_file_extension: file_extensions.find { |f| req.uri.include? f },~ +** Processing line: ~ has_trailing_slash: (req.uri.split('?').first.end_with? "/") }~ +** Processing line: ~~ +** Processing line: ~ if !match_candidate[:has_file_extension]~ +** Processing line: ~ if !match_candidate[:has_trailing_slash]~ +** Processing line: ~ match_candidate[:uri] = match_candidate[:uri_without_query_string] + "/"~ +** Processing line: ~ if match_candidate[:query_string]~ +** Processing line: ~ match_candidate[:uri] += "?#{match_candidate[:query_string]}"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ context = { args: args, req: req, match_candidate: match_candidate }~ +** Processing line: ~~ +** Processing line: ~ process! context: context, routes: routes~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def url_decode args, string~ +** Processing line: ~ args.fn.gsub string,~ +** Processing line: ~ '+', " ",~ +** Processing line: ~ '%27', "'",~ +** Processing line: ~ '%22', '"',~ +** Processing line: ~ '%0D%0A', "\n",~ +** Processing line: ~ '%3D', "=",~ +** Processing line: ~ '%3B', ";",~ +** Processing line: ~ '%7C', "|",~ +** Processing line: ~ '%28', "(",~ +** Processing line: ~ '%29', ")",~ +** Processing line: ~ '%7B', "{",~ +** Processing line: ~ '%7D', "}",~ +** Processing line: ~ '%2C', ",",~ +** Processing line: ~ '%3A', ":",~ +** Processing line: ~ '%5B', "[",~ +** Processing line: ~ '%5D', "]",~ +** Processing line: ~ '%23', "#",~ +** Processing line: ~ '%21', "!",~ +** Processing line: ~ '%3C', "<",~ +** Processing line: ~ '%3E', ">",~ +** Processing line: ~ '%2B', "+",~ +** Processing line: ~ '%2F', "/",~ +** Processing line: ~ '%40', "@",~ +** Processing line: ~ '%3F', "?",~ +** Processing line: ~ '%26', "&",~ +** Processing line: ~ '%24', "$",~ +** Processing line: ~ '%5C', "\\",~ +** Processing line: ~ '%60', "`",~ +** Processing line: ~ '%7E', "~",~ +** Processing line: ~ '%C2%B2', "²",~ +** Processing line: ~ '%5E', "^",~ +** Processing line: ~ '%C2%BA', "º",~ +** Processing line: ~ '%C2%A7', "§",~ +** Processing line: ~ '%20', " ",~ +** Processing line: ~ '%0A', "\n",~ +** Processing line: ~ '%25', "%",~ +** Processing line: ~ '%2A', "*"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def file_extensions~ +** Processing line: ~ [".html", ".css", ".gif", ".txt", ".ico", ".rb"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def routes~ +** Processing line: ~ [{ match_criteria: { method: :get, uri: "/" },~ +** Processing line: ~ handler: :get_index },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/" },~ +** Processing line: ~ handler: :get_index },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/boot/" },~ +** Processing line: ~ handler: :get_api_boot },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/trace/" },~ +** Processing line: ~ handler: :get_api_trace },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/puts/" },~ +** Processing line: ~ handler: :get_api_puts },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/log/" },~ +** Processing line: ~ handler: :get_api_log },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/log/" },~ +** Processing line: ~ handler: :post_api_log },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/changes/" },~ +** Processing line: ~ handler: :get_api_changes },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/eval/" },~ +** Processing line: ~ handler: :get_api_eval },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/eval/" },~ +** Processing line: ~ handler: :post_api_eval },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/console/" },~ +** Processing line: ~ handler: :get_api_console },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/console/" },~ +** Processing line: ~ handler: :post_api_console },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/control_panel/" },~ +** Processing line: ~ handler: :get_api_control_panel },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/reset/" },~ +** Processing line: ~ handler: :post_api_reset },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/record/" },~ +** Processing line: ~ handler: :post_api_record },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/record_stop/" },~ +** Processing line: ~ handler: :post_api_record_stop },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/replay/" },~ +** Processing line: ~ handler: :post_api_replay },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/show_console/" },~ +** Processing line: ~ handler: :post_api_show_console },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/code/" },~ +** Processing line: ~ handler: :get_api_code },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/dragon/autocomplete/" },~ +** Processing line: ~ handler: :get_api_autocomplete },~ +** Processing line: ~ { match_criteria: { method: :post, uri: "/dragon/autocomplete/" },~ +** Processing line: ~ handler: :post_api_autocomplete },~ +** Processing line: ~ { match_criteria: { method: :get, uri_without_query_string: "/dragon/code/edit/", has_query_string: true },~ +** Processing line: ~ handler: :get_api_code_edit },~ +** Processing line: ~ { match_criteria: { method: :post, uri_without_query_string: "/dragon/code/update/", has_query_string: true },~ +** Processing line: ~ handler: :post_api_code_update },~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/docs.html" },~ +** Processing line: ~ handler: :get_docs_html },~ +** Processing line: ~ { match_criteria: { method: :get, uri_without_query_string: "/docs.css" },~ +** Processing line: ~ handler: :get_docs_css },~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/docs_search.gif" },~ +** Processing line: ~ handler: :get_docs_search_gif },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_index.html" },~ +** Processing line: ~ handler: :get_src_backup_index_html },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_index.txt" },~ +** Processing line: ~ handler: :get_src_backup_index_txt },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_changes.html" },~ +** Processing line: ~ handler: :get_src_backup_changes_html },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup_changes.txt" },~ +** Processing line: ~ handler: :get_src_backup_changes_txt },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/src_backup.css" },~ +** Processing line: ~ handler: :get_src_backup_css },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, uri: "/favicon.ico" },~ +** Processing line: ~ handler: :get_favicon_ico },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, end_with_rb: true },~ +** Processing line: ~ handler: :get_src_backup },~ +** Processing line: ~~ +** Processing line: ~ { match_criteria: { method: :get, end_with_rb: true },~ +** Processing line: ~ handler: :get_src_backup }~ +** Processing line: ~~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process! opts~ +** Processing line: ~ routes = opts[:routes]~ +** Processing line: ~ context = opts[:context]~ +** Processing line: ~ routes.each do |route|~ +** Processing line: ~ match_found = (process_single! route: route, context: context)~ +** Processing line: ~ return if match_found~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_single! opts~ +** Processing line: ~ match_criteria = opts[:route][:match_criteria]~ +** Processing line: ~ m = opts[:route][:handler]~ +** Processing line: ~ args = opts[:context][:args]~ +** Processing line: ~ req = opts[:context][:req]~ +** Processing line: ~ match_candidate = opts[:context][:match_candidate]~ +** Processing line: ~ match_criteria.each do |k, v|~ +** Processing line: ~ return false if match_candidate[k] != v~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin~ +** Processing line: ~ send m, args, req~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ req.respond 200,~ +** Processing line: ~ "#{e}\n#{e.__backtrace_to_org__}",~ +** Processing line: ~ { 'Content-Type' => 'text/plain' }~ +** Processing line: ~ end~ +** Processing line: ~ return true~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** args.rb~ - H3 detected. - Determining if line is a header. @@ -218579,66 +240685,32 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ class Args~ ** Processing line: ~ include ArgsDeprecated~ ** Processing line: ~ include Serialize~ -** Processing line: ~~ -** Processing line: ~ # Contains information related to input devices and input events.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Inputs]~ +** Processing line: ~ attr_accessor :cvars~ ** Processing line: ~ attr_accessor :inputs~ -** Processing line: ~~ -** Processing line: ~ # Contains the means to interact with output devices such as the screen.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Outputs]~ ** Processing line: ~ attr_accessor :outputs~ -** Processing line: ~~ -** Processing line: ~ # Contains the means to interact with the audio mixer.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Hash]~ ** Processing line: ~ attr_accessor :audio~ -** Processing line: ~~ -** Processing line: ~ # Contains display size information to assist in positioning things on the screen.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Grid]~ ** Processing line: ~ attr_accessor :grid~ -** Processing line: ~~ -** Processing line: ~ # Provides access to game play recording facilities within Game Toolkit.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Recording]~ ** Processing line: ~ attr_accessor :recording~ -** Processing line: ~~ -** Processing line: ~ # Gives you access to geometry related functions.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Geometry]~ ** Processing line: ~ attr_accessor :geometry~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :fn~ -** Processing line: ~~ -** Processing line: ~ # This is where you'll put state associated with your video game.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [OpenEntity]~ ** Processing line: ~ attr_accessor :state~ -** Processing line: ~~ -** Processing line: ~ # Gives you access to the top level DragonRuby runtime.~ -** Processing line: ~ #~ -** Processing line: ~ # @return [Runtime]~ +** Processing line: ~ attr_accessor :temp_state~ ** Processing line: ~ attr_accessor :runtime~ ** Processing line: ~ alias_method :gtk, :runtime~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :passes~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :wizards~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :layout~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :easing~ -** Processing line: ~~ ** Processing line: ~ attr_accessor :string~ ** Processing line: ~~ ** Processing line: ~ def initialize runtime, recording~ ** Processing line: ~ @inputs = Inputs.new~ ** Processing line: ~ @outputs = Outputs.new args: self~ +** Processing line: ~ @cvars = {}~ ** Processing line: ~ @audio = {}~ ** Processing line: ~ @passes = []~ ** Processing line: ~ @state = OpenEntity.new~ +** Processing line: ~ @temp_state = OpenEntity.new~ ** Processing line: ~ @state.tick_count = -1~ ** Processing line: ~ @runtime = runtime~ ** Processing line: ~ @recording = recording~ @@ -218668,11 +240740,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def serialize~ ** Processing line: ~ {~ -** Processing line: ~ state: state.as_hash,~ -** Processing line: ~ inputs: inputs.serialize,~ -** Processing line: ~ passes: passes.serialize,~ -** Processing line: ~ outputs: outputs.serialize,~ -** Processing line: ~ grid: grid.serialize~ +** Processing line: ~ state: state.as_hash,~ +** Processing line: ~ temp_state: temp_state.as_hash,~ +** Processing line: ~ inputs: inputs.serialize,~ +** Processing line: ~ passes: passes.serialize,~ +** Processing line: ~ outputs: outputs.serialize,~ +** Processing line: ~ grid: grid.serialize~ ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -218804,6 +240877,23 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def autocomplete_methods~ ** Processing line: ~ [:inputs, :outputs, :gtk, :state, :geometry, :audio, :grid, :layout, :fn]~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def method_missing name, *args, &block~ +** Processing line: ~ if (args.length <= 1) && (@state.as_hash.key? name)~ +** Processing line: ~ raise <<-S~ +** Processing line: ~ * ERROR - :#{name} method missing on ~#{self.class.name}~.~ +** Processing line: ~ The method~ +** Processing line: ~ :#{name}~ +** Processing line: ~ with args~ +** Processing line: ~ #{args}~ +** Processing line: ~ doesn't exist on #{inspect}.~ +** Processing line: ~ ** POSSIBLE SOLUTION - ~args.state.#{name}~ exists.~ +** Processing line: ~ Did you forget ~.state~ before ~.#{name}~?~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ super~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -218853,10 +240943,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ class Assert~ ** Processing line: ~ def custom_assertion actual, expected, message = nil~ -** Processing line: ~ # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ +** Processing line: ~ # this tells Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ ** Processing line: ~ @assertion_performed = true~ ** Processing line: ~~ -** Processing line: ~ # perform your custom logic here and rais an exception to denote a failure.~ +** Processing line: ~ # perform your custom logic here and raise an exception to denote a failure.~ ** Processing line: ~~ ** Processing line: ~ raise "Some Error. #{message}."~ ** Processing line: ~ end~ @@ -218866,14 +240956,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ attr :assertion_performed~ ** Processing line: ~~ ** Processing line: ~ =begin~ -** Processing line: ~ Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ +** Processing line: ~ Use this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ ** Processing line: ~ =end~ ** Processing line: ~ def ok!~ ** Processing line: ~ @assertion_performed = true~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ =begin~ -** Processing line: ~ Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user.~ +** Processing line: ~ Assert if a value is a truthy value. All assert methods take an optional final parameter that is the message to display to the user.~ ** Processing line: ~~ ** Processing line: ~ @example~ ** Processing line: ~~ @@ -218927,7 +241017,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @assertion_performed = true~ ** Processing line: ~ if actual != expected~ ** Processing line: ~ actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip~ -** Processing line: ~ message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}.\n#{message}"~ +** Processing line: ~ message = "actual:\n#{actual_string}\n\ndid not equal\n\nexpected:\n#{expected}\n#{message}"~ ** Processing line: ~ raise message~ ** Processing line: ~ end~ ** Processing line: ~ nil~ @@ -218937,7 +241027,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @assertion_performed = true~ ** Processing line: ~ if actual == expected~ ** Processing line: ~ actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip~ -** Processing line: ~ message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}.\n#{message}"~ +** Processing line: ~ message = "actual:\n#{actual_string}\n\nequaled\n\nexpected:\n#{expected}\n#{message}"~ ** Processing line: ~ raise message~ ** Processing line: ~ end~ ** Processing line: ~ nil~ @@ -219007,6 +241097,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.state~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def temp_state~ +** Processing line: ~ args.temp_state~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def inputs~ ** Processing line: ~ args.inputs~ ** Processing line: ~ end~ @@ -219034,6 +241128,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def layout~ ** Processing line: ~ args.layout~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_entity entity_type, init_hash = nil, &block~ +** Processing line: ~ args.state.new_entity entity_type, init_hash, &block~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_entity_strict entity_type, init_hash = nil, &block~ +** Processing line: ~ args.state.new_entity_strict entity_type, init_hash, &block~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -219056,6 +241158,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/attr_sprite.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # attr_sprite.rb has been released under MIT (*only this file*).~ @@ -219095,7 +241198,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x,~ ** Processing line: ~ :tile_y, :tile_w, :tile_h, :flip_horizontally,~ ** Processing line: ~ :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id,~ -** Processing line: ~ :source_x, :source_y, :source_w, :source_h~ +** Processing line: ~ :source_x, :source_y, :source_w, :source_h, :blendmode_enum~ ** Processing line: ~~ ** Processing line: ~ def primitive_marker~ ** Processing line: ~ :sprite~ @@ -219134,6 +241237,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/console.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console.rb has been released under MIT (*only this file*).~ @@ -219145,17 +241249,20 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ class Console~ ** Processing line: ~ include ConsoleDeprecated~ ** Processing line: ~~ -** Processing line: ~ attr_accessor :show_reason, :log, :logo, :background_color,~ -** Processing line: ~ :text_color, :animation_duration,~ +** Processing line: ~ attr_accessor :show_reason, :log, :logo,~ +** Processing line: ~ :animation_duration,~ ** Processing line: ~ :max_log_lines, :max_history, :log,~ -** Processing line: ~ :last_command_errored, :last_command, :error_color, :shown_at,~ -** Processing line: ~ :header_color, :archived_log, :last_log_lines, :last_log_lines_count,~ +** Processing line: ~ :last_command_errored, :last_command, :shown_at,~ +** Processing line: ~ :archived_log, :last_log_lines, :last_log_lines_count,~ ** Processing line: ~ :suppress_left_arrow_behavior, :command_set_at,~ ** Processing line: ~ :toast_ids, :bottom,~ -** Processing line: ~ :font_style, :menu~ +** Processing line: ~ :font_style, :menu,~ +** Processing line: ~ :background_color, :spam_color, :text_color, :warn_color,~ +** Processing line: ~ :error_color, :header_color, :code_color, :comment_color,~ +** Processing line: ~ :debug_color, :unfiltered_color~ ** Processing line: ~~ ** Processing line: ~ def initialize~ -** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1)~ +** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1)~ ** Processing line: ~ @menu = Menu.new self~ ** Processing line: ~ @disabled = false~ ** Processing line: ~ @log_offset = 0~ @@ -219170,13 +241277,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @command_history_index = -1~ ** Processing line: ~ @nonhistory_input = ''~ ** Processing line: ~ @logo = 'console-logo.png'~ -** Processing line: ~ @history_fname = 'console_history.txt'~ +** Processing line: ~ @history_fname = 'logs/console_history.txt'~ ** Processing line: ~ @background_color = Color.new [0, 0, 0, 224]~ -** Processing line: ~ @text_color = Color.new [255, 255, 255]~ -** Processing line: ~ @error_color = Color.new [200, 50, 50]~ ** Processing line: ~ @header_color = Color.new [100, 200, 220]~ +** Processing line: ~ @code_color = Color.new [210, 168, 255]~ +** Processing line: ~ @comment_color = Color.new [0, 200, 100]~ ** Processing line: ~ @animation_duration = 1.seconds~ ** Processing line: ~ @shown_at = -1~ +** Processing line: ~~ +** Processing line: ~ # these are the colors for text at various log levels.~ +** Processing line: ~ @spam_color = Color.new [160, 160, 160]~ +** Processing line: ~ @debug_color = Color.new [0, 255, 0]~ +** Processing line: ~ @text_color = Color.new [255, 255, 255]~ +** Processing line: ~ @warn_color = Color.new [255, 255, 0]~ +** Processing line: ~ @error_color = Color.new [200, 50, 50]~ +** Processing line: ~ @unfiltered_color = Color.new [0, 255, 255]~ +** Processing line: ~~ ** Processing line: ~ load_history~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -219242,7 +241358,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ nil~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def add_text obj~ +** Processing line: ~ def add_text obj, loglevel=-1~ +** Processing line: ~ # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic"~ +** Processing line: ~ loglevel = -1 if loglevel < 0~ +** Processing line: ~ loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down)~ +** Processing line: ~ loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well~ +** Processing line: ~ colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil~ +** Processing line: ~~ ** Processing line: ~ @last_log_lines_count ||= 1~ ** Processing line: ~ @log_invocation_count += 1~ ** Processing line: ~~ @@ -219251,12 +241373,18 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ log_lines = []~ ** Processing line: ~~ ** Processing line: ~ str.each_line do |s|~ -** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ -** Processing line: ~ log_lines << l~ +** Processing line: ~ if colorstr.nil?~ +** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ +** Processing line: ~ log_lines << l~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ +** Processing line: ~ log_lines << "#{colorstr}#{l}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if log_lines == @last_log_lines~ +** Processing line: ~ if log_lines == @last_log_lines && log_lines.length != 0~ ** Processing line: ~ @last_log_lines_count += 1~ ** Processing line: ~ new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})"~ ** Processing line: ~ if log_lines.length > 1~ @@ -219449,6 +241577,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa'~ ** Processing line: ~ $gtk.request_quit~ +** Processing line: ~ elsif cmd.start_with? ':'~ +** Processing line: ~ send ((cmd.gsub '-', '_').gsub ':', '')~ ** Processing line: ~ else~ ** Processing line: ~ puts "-> #{cmd}"~ ** Processing line: ~ begin~ @@ -219457,13 +241587,19 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if $results.nil?~ ** Processing line: ~ puts "=> nil"~ ** Processing line: ~ elsif $results == :console_silent_eval~ +** Processing line: ~ # do nothing since the console is silent~ ** Processing line: ~ else~ ** Processing line: ~ puts "=> #{$results}"~ ** Processing line: ~ end~ ** Processing line: ~ @last_command_errored = false~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ try_search_docs e~ -** Processing line: ~ puts "* EXCEPTION: #{e}"~ +** Processing line: ~ # if an exception is thrown and the bactrace includes something helpful, then show it~ +** Processing line: ~ if (e.backtrace || []).first && (e.backtrace.first.include? "(eval)")~ +** Processing line: ~ puts "* EXCEPTION: #{e}"~ +** Processing line: ~ else~ +** Processing line: ~ puts "* EXCEPTION: #{e}\n#{e.__backtrace_to_org__}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -219523,10 +241659,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def mouse_wheel_scroll args~ ** Processing line: ~ @inertia ||= 0~ ** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0~ -** Processing line: ~ @inertia = 1~ -** Processing line: ~ elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0~ -** Processing line: ~ @inertia = -1~ +** Processing line: ~ if args.inputs.mouse.wheel~ +** Processing line: ~ if args.inputs.mouse.wheel.y > 0~ +** Processing line: ~ @inertia = 1~ +** Processing line: ~ elsif args.inputs.mouse.wheel.y < 0~ +** Processing line: ~ @inertia = -1~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if args.inputs.mouse.click~ @@ -219535,13 +241673,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ return if @inertia == 0~ ** Processing line: ~~ -** Processing line: ~ if @inertia != 0~ -** Processing line: ~ @inertia = (@inertia * 0.7)~ -** Processing line: ~ if @inertia > 0~ -** Processing line: ~ @log_offset -= 1~ -** Processing line: ~ elsif @inertia < 0~ -** Processing line: ~ @log_offset += 1~ -** Processing line: ~ end~ +** Processing line: ~ @inertia = (@inertia * 0.7)~ +** Processing line: ~ if @inertia > 0~ +** Processing line: ~ @log_offset += 1~ +** Processing line: ~ elsif @inertia < 0~ +** Processing line: ~ @log_offset -= 1~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if @inertia.abs < 0.01~ @@ -219559,6 +241695,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if console_toggle_key_down? args~ ** Processing line: ~ args.inputs.text.clear~ ** Processing line: ~ toggle~ +** Processing line: ~ args.inputs.keyboard.clear if !@visible~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ return unless visible?~ @@ -219570,7 +241707,16 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @log_offset = 0 if @log_offset < 0~ ** Processing line: ~~ ** Processing line: ~ if args.inputs.keyboard.key_down.enter~ -** Processing line: ~ eval_the_set_command~ +** Processing line: ~ if slide_progress > 0.5~ +** Processing line: ~ # in the event of an exception, the console window pops up~ +** Processing line: ~ # and is pre-filled with $gtk.reset.~ +** Processing line: ~ # there is an annoying scenario where the exception could be thrown~ +** Processing line: ~ # by pressing enter (while playing the game). if you press enter again~ +** Processing line: ~ # quickly, then the game is reset which closes the console.~ +** Processing line: ~ # so enter in the console is only evaluated if the slide_progress~ +** Processing line: ~ # is atleast half way down the page.~ +** Processing line: ~ eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~ elsif args.inputs.keyboard.key_down.v~ ** Processing line: ~ if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta~ ** Processing line: ~ prompt << $gtk.ffi_misc.getclipboard~ @@ -219647,7 +241793,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def write_line(args, left, y, str, archived: false)~ ** Processing line: ~ color = color_for_log_entry(str)~ ** Processing line: ~ color = color.mult_alpha(0.5) if archived~ -** Processing line: ~~ +** Processing line: ~ str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color~ ** Processing line: ~ args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color)~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -219690,6 +241836,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ render_log_offset args~ +** Processing line: ~~ +** Processing line: ~ args.outputs.reserved << { x: 10.from_right, y: @bottom + 10,~ +** Processing line: ~ text: "Press CTRL+g or ESCAPE to clear the prompt.",~ +** Processing line: ~ vertical_alignment_enum: 0,~ +** Processing line: ~ alignment_enum: 2, r: 80, g: 80, b: 80 }.label!~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def render_log_offset args~ @@ -219712,7 +241863,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def include_subdued_markers? text~ -** Processing line: ~ include_any_words? text, subdued_markers~ +** Processing line: ~ (text.start_with? "* INFO: ") && (include_any_words? text, subdued_markers)~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def include_any_words? text, words~ @@ -219858,8 +242009,34 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ (log_entry.start_with? "**** ")~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def color_for_log_entry(log_entry)~ -** Processing line: ~ if include_row_marker? log_entry~ +** Processing line: ~ def code? log_entry~ +** Processing line: ~ (just_symbol? log_entry) || (codeblock_marker? log_entry)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def just_symbol? log_entry~ +** Processing line: ~ scrubbed = log_entry.gsub("*", "").strip~ +** Processing line: ~ (scrubbed.start_with? ":") && (!scrubbed.include? " ") && (!scrubbed.include? "=>")~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def code_comment? log_entry~ +** Processing line: ~ return true if log_entry.strip.start_with?("# ")~ +** Processing line: ~ return false~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def codeblock_marker? log_entry~ +** Processing line: ~ return true if log_entry.strip.start_with?("#+begin_src")~ +** Processing line: ~ return true if log_entry.strip.start_with?("#+end_src")~ +** Processing line: ~ return false~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def color_for_plain_text log_entry~ +** Processing line: ~ log_entry = log_entry[4..-1] if log_entry.start_with? "!c!"~ +** Processing line: ~~ +** Processing line: ~ if code? log_entry~ +** Processing line: ~ @code_color~ +** Processing line: ~ elsif code_comment? log_entry~ +** Processing line: ~ @comment_color~ +** Processing line: ~ elsif include_row_marker? log_entry~ ** Processing line: ~ @text_color~ ** Processing line: ~ elsif include_error_marker? log_entry~ ** Processing line: ~ @error_color~ @@ -219874,6 +242051,29 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def color_for_log_entry(log_entry)~ +** Processing line: ~ if log_entry.start_with?('!c!') # loglevel color specified.~ +** Processing line: ~ return case log_entry[3..3].to_i~ +** Processing line: ~ when 0 # spam~ +** Processing line: ~ @spam_color~ +** Processing line: ~ when 1 # debug~ +** Processing line: ~ @debug_color~ +** Processing line: ~ #when 2 # info (caught by the `else` block.)~ +** Processing line: ~ # @text_color~ +** Processing line: ~ when 3 # warn~ +** Processing line: ~ @warn_color~ +** Processing line: ~ when 4 # error~ +** Processing line: ~ @error_color~ +** Processing line: ~ when 5 # unfiltered~ +** Processing line: ~ @unfiltered_color~ +** Processing line: ~ else~ +** Processing line: ~ color_for_plain_text log_entry~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return color_for_plain_text log_entry~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def prompt~ ** Processing line: ~ @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width)~ ** Processing line: ~ end~ @@ -219925,6 +242125,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/console_color.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_color.rb has been released under MIT (*only this file*).~ @@ -219949,6 +242150,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @color~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def to_s~ +** Processing line: ~ "GTK::Console::Color #{to_h}"~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def to_h~ ** Processing line: ~ { r: @color[0], g: @color[1], b: @color[2], a: @color[3] }~ ** Processing line: ~ end~ @@ -219976,6 +242181,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/console_font_style.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_font_style.rb has been released under MIT (*only this file*).~ @@ -220011,7 +242217,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ size_enum: size_enum,~ ** Processing line: ~ alignment_enum: alignment_enum,~ ** Processing line: ~ **color.to_h,~ -** Processing line: ~ }.label~ +** Processing line: ~ }.label!~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -220037,6 +242243,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/console_menu.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_menu.rb has been released under MIT (*only this file*).~ @@ -220090,7 +242297,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def itch_wizard_clicked~ ** Processing line: ~ @console.scroll_to_bottom~ -** Processing line: ~ $wizards.itch.start~ +** Processing line: ~ $wizards.itch.restart~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def docs_clicked~ @@ -220115,6 +242322,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @buttons = [~ ** Processing line: ~ (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked),~ ** Processing line: ~ (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked),~ +** Processing line: ~ *custom_buttons~ ** Processing line: ~ ]~ ** Processing line: ~ elsif @menu_shown == :hidden~ ** Processing line: ~ @buttons = [~ @@ -220173,8 +242381,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ method: method~ ** Processing line: ~ }.let do |entity|~ ** Processing line: ~ primitives = []~ -** Processing line: ~ primitives << entity[:rect].merge(a: 164).solid~ -** Processing line: ~ primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border~ +** Processing line: ~ primitives << entity[:rect].solid!(a: 164)~ +** Processing line: ~ primitives << entity[:rect].border!(r: 255, g: 255, b: 255)~ ** Processing line: ~ primitives << text.wrapped_lines(5)~ ** Processing line: ~ .map_with_index do |l, i|~ ** Processing line: ~ [~ @@ -220217,6 +242425,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/console_prompt.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_prompt.rb has been released under MIT (*only this file*).~ @@ -220376,11 +242585,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # partition the original list of items into a string to be printed~ ** Processing line: ~ items.each_slice(columns).each_with_index do |cells, i|~ -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ pretty_print_row_separator string_width, cell_width, column_width, columns~ ** Processing line: ~ pretty_print_row cells, string_width, cell_width, column_width, columns~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ pretty_print_row_separator string_width, cell_width, column_width, columns~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -220393,17 +242602,17 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ "#{" " * (string_width.length - c.length) } #{c} |"~ ** Processing line: ~ end.join~ ** Processing line: ~~ -** Processing line: ~ # remove seperators between empty values~ +** Processing line: ~ # remove separators between empty values~ ** Processing line: ~ formated_row = formated_row.gsub(" | ", " ")~ ** Processing line: ~~ ** Processing line: ~ puts formated_row~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ def pretty_print_row_separator string_width, cell_width, column_width, columns~ ** Processing line: ~ # this is a joint: +--------~ ** Processing line: ~ column_joint = "+#{"-" * cell_width}"~ ** Processing line: ~~ -** Processing line: ~ # multiple joints create a row seperator: +----+----+~ +** Processing line: ~ # multiple joints create a row separator: +----+----+~ ** Processing line: ~ puts (column_joint * columns) + "+"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -220412,12 +242621,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 0.5,~ ** Processing line: ~ y: y + 5,~ ** Processing line: ~ x2: x + @cursor_position_px + 0.5,~ -** Processing line: ~ y2: y + @font_style.letter_size.y + 5)~ +** Processing line: ~ y2: y + @font_style.letter_size.y + 4)~ ** Processing line: ~~ ** Processing line: ~ args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 1,~ ** Processing line: ~ y: y + 5,~ ** Processing line: ~ x2: x + @cursor_position_px + 1,~ -** Processing line: ~ y2: y + @font_style.letter_size.y + 5)~ +** Processing line: ~ y2: y + @font_style.letter_size.y + 4)~ ** Processing line: ~~ ** Processing line: ~ # debugging rectangle for string~ ** Processing line: ~ # args.outputs.reserved << (@cursor_color.to_h.merge x: x,~ @@ -221090,7 +243299,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ :l1, :r1,~ ** Processing line: ~ :l2, :r2,~ ** Processing line: ~ :l3, :r3,~ -** Processing line: ~ :start, :select,~ +** Processing line: ~ :start, :select, :home,~ ** Processing line: ~ :directional_up, :directional_down, :directional_left, :directional_right~ ** Processing line: ~ ].freeze~ ** Processing line: ~~ @@ -221098,6 +243307,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ attr label~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def back~ +** Processing line: ~ @select~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def back= value~ +** Processing line: ~ @select = value~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def guide~ +** Processing line: ~ @home~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def guide= value~ +** Processing line: ~ @home = value~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ # Activate a key.~ ** Processing line: ~ #~ ** Processing line: ~ # @return [void]~ @@ -221161,7 +243386,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ error_message = <<-S~ ** Processing line: ~ * ERROR~ -** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy:~ +** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api hierarchy:~ ** Processing line: ~~ ** Processing line: ~ - (#{ directional_methods.join("|") })~ ** Processing line: ~ - key_held.(#{ directional_methods.join("|") })~ @@ -221218,6 +243443,12 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def directional_angle~ +** Processing line: ~ return nil unless directional_vector~ +** Processing line: ~~ +** Processing line: ~ Math.atan2(up_down, left_right).to_degrees~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def method_missing m, *args~ ** Processing line: ~ # combine the key with ctrl_~ ** Processing line: ~ if m.to_s.start_with?("ctrl_")~ @@ -221270,8 +243501,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ ease_extended start_tick,~ ** Processing line: ~ current_tick,~ ** Processing line: ~ start_tick + duration,~ -** Processing line: ~ (initial_value *definitions),~ -** Processing line: ~ (final_value *definitions),~ +** Processing line: ~ initial_value(*definitions),~ +** Processing line: ~ final_value(*definitions),~ ** Processing line: ~ *definitions~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -221495,6 +243726,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ module GTK~ ** Processing line: ~ module Geometry~ +** Processing line: ~ def self.rotate_point point, angle, around = nil~ +** Processing line: ~ s = Math.sin angle.to_radians~ +** Processing line: ~ c = Math.cos angle.to_radians~ +** Processing line: ~ px = point.x~ +** Processing line: ~ py = point.y~ +** Processing line: ~ cx = 0~ +** Processing line: ~ cy = 0~ +** Processing line: ~ if around~ +** Processing line: ~ cx = around.x~ +** Processing line: ~ cy = around.y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ point.merge(x: ((px - cx) * c - (py - cy) * s) + cx,~ +** Processing line: ~ y: ((px - cx) * s + (py - cy) * c) + cy)~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ # Returns f(t) for a cubic Bezier curve.~ ** Processing line: ~ def self.cubic_bezier t, a, b, c, d~ ** Processing line: ~ s = 1 - t~ @@ -221576,7 +243823,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise e, <<-S~ ** Processing line: ~ * ERROR:~ -** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}.\n#{e}.~ ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -221593,7 +243840,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise e, <<-S~ ** Processing line: ~ * ERROR:~ -** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}.\n#{e}.~ ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -221610,7 +243857,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise e, <<-S~ ** Processing line: ~ * ERROR:~ -** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ +** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}.\n#{e}.~ ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -221619,7 +243866,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its retangle.~ +** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its rectangle.~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def anchor_rect anchor_x, anchor_y~ ** Processing line: ~ current_w = self.w~ @@ -221662,8 +243909,16 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ -** Processing line: ~ def self.line_y_intercept line~ -** Processing line: ~ line.y - line_slope(line) * line.x~ +** Processing line: ~ def self.line_y_intercept line, replace_infinity: nil~ +** Processing line: ~ line.y - line_slope(line, replace_infinity: replace_infinity) * line.x~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ raise <<-S~ +** Processing line: ~ * ERROR: ~Geometry::line_y_intercept~~ +** Processing line: ~ The following exception was thrown for line: #{line}~ +** Processing line: ~ #{e}~ +** Processing line: ~~ +** Processing line: ~ Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.~ +** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ @@ -221739,14 +243994,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ -** Processing line: ~ def self.line_intersect line_one, line_two~ -** Processing line: ~ m1 = line_slope(line_one)~ -** Processing line: ~ m2 = line_slope(line_two)~ -** Processing line: ~ b1 = line_y_intercept(line_one)~ -** Processing line: ~ b2 = line_y_intercept(line_two)~ +** Processing line: ~ def self.line_intersect line_one, line_two, replace_infinity: nil~ +** Processing line: ~ m1 = line_slope(line_one, replace_infinity: replace_infinity)~ +** Processing line: ~ m2 = line_slope(line_two, replace_infinity: replace_infinity)~ +** Processing line: ~ b1 = line_y_intercept(line_one, replace_infinity: replace_infinity)~ +** Processing line: ~ b2 = line_y_intercept(line_two, replace_infinity: replace_infinity)~ ** Processing line: ~ x = (b1 - b2) / (m2 - m1)~ ** Processing line: ~ y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2))~ ** Processing line: ~ [x, y]~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ raise <<-S~ +** Processing line: ~ * ERROR: ~Geometry::line_intersect~~ +** Processing line: ~ The following exception was thrown for line_one: #{line_one}, line_two: #{line_two}~ +** Processing line: ~ #{e}~ +** Processing line: ~~ +** Processing line: ~ Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.~ +** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def self.contract_intersect_rect?~ @@ -221755,10 +244018,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def self.intersect_rect? rect_one, rect_two, tolerance = 0.1~ -** Processing line: ~ return false if rect_one.right - tolerance < rect_two.left + tolerance~ -** Processing line: ~ return false if rect_one.left + tolerance > rect_two.right - tolerance~ -** Processing line: ~ return false if rect_one.top - tolerance < rect_two.bottom + tolerance~ -** Processing line: ~ return false if rect_one.bottom + tolerance > rect_two.top - tolerance~ +** Processing line: ~ return false if ((rect_one.x + rect_one.w) - tolerance) < (rect_two.x + tolerance)~ +** Processing line: ~ return false if (rect_one.x + tolerance) > ((rect_two.x + rect_two.w) - tolerance)~ +** Processing line: ~ return false if ((rect_one.y + rect_one.h) - tolerance) < (rect_two.y + tolerance)~ +** Processing line: ~ return false if (rect_one.y + tolerance) > ((rect_two.y + rect_two.h) - tolerance)~ ** Processing line: ~ return true~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ context_help_rect_one = (rect_one.__help_contract_implementation contract_intersect_rect?)[:not_implemented_methods]~ @@ -221786,6 +244049,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ - rect_one: #{rect_one}~ ** Processing line: ~ - rect_two: #{rect_two}~ ** Processing line: ~ #{context_help}~ +** Processing line: ~ \n#{e}~ ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -221796,14 +244060,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ y = y.shift_down(size * anchor_y)~ ** Processing line: ~ [x, y, size, size]~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}."~ +** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def self.distance point_one, point_two~ ** Processing line: ~ Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2)~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}."~ +** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ @@ -221812,31 +244076,34 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ d_x = end_point.x - start_point.x~ ** Processing line: ~ Math::PI.+(Math.atan2(d_y, d_x)).to_degrees~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}."~ +** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def self.angle_to start_point, end_point~ ** Processing line: ~ angle_from end_point, start_point~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}."~ +** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def self.point_inside_circle? point, circle_center_point, radius~ ** Processing line: ~ (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}"~ +** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def self.inside_rect? inner_rect, outer_rect, tolerance = 0.0~ +** Processing line: ~ return nil if !inner_rect~ +** Processing line: ~ return nil if !outer_rect~ +** Processing line: ~~ ** Processing line: ~ inner_rect.x + tolerance >= outer_rect.x - tolerance &&~ -** Processing line: ~ inner_rect.right - tolerance <= outer_rect.right + tolerance &&~ +** Processing line: ~ (inner_rect.x + inner_rect.w) - tolerance <= (outer_rect.x + outer_rect.w) + tolerance &&~ ** Processing line: ~ inner_rect.y + tolerance >= outer_rect.y - tolerance &&~ -** Processing line: ~ inner_rect.top - tolerance <= outer_rect.top + tolerance~ +** Processing line: ~ (inner_rect.y + inner_rect.h) - tolerance <= (outer_rect.y + outer_rect.h) + tolerance~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}."~ +** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ @@ -221871,7 +244138,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ return rect~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}."~ +** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}.\n#{e}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # @gtk~ @@ -221885,7 +244152,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ anchor_x: anchor_x,~ ** Processing line: ~ anchor_y: anchor_y~ ** Processing line: ~ rescue Exception => e~ -** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]."~ +** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)].\n#{e}"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.rect_to_line rect~ +** Processing line: ~ l = rect.to_hash.line~ +** Processing line: ~ l.merge(x2: l.x + l.w - 1,~ +** Processing line: ~ y2: l.y + l.h)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.rect_center_point rect~ +** Processing line: ~ { x: rect.x + rect.w.half, y: rect.y + rect.h.half }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def rect_center_point~ +** Processing line: ~ Geometry.rect_center_point self~ ** Processing line: ~ end~ ** Processing line: ~ end # module Geometry~ ** Processing line: ~ end # module GTK~ @@ -222097,6 +244378,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def bottom_right~ ** Processing line: ~ [@right, @bottom].point~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def x~ +** Processing line: ~ 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def y~ +** Processing line: ~ 0~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -222313,6 +244602,30 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def self.method_to_key_hash~ +** Processing line: ~ return @method_to_key_hash if @method_to_key_hash~ +** Processing line: ~ @method_to_key_hash = {}~ +** Processing line: ~ string_representation_overrides ||= {~ +** Processing line: ~ backspace: '\b'~ +** Processing line: ~ }~ +** Processing line: ~ char_to_method_hash.each do |k, v|~ +** Processing line: ~ v.each do |vi|~ +** Processing line: ~ t = { char_or_raw_key: k }~ +** Processing line: ~~ +** Processing line: ~ if k.is_a? Numeric~ +** Processing line: ~ t[:raw_key] = k~ +** Processing line: ~ t[:string_representation] = "raw_key == #{k}"~ +** Processing line: ~ else~ +** Processing line: ~ t[:char] = k~ +** Processing line: ~ t[:string_representation] = "\"#{k.strip}\""~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ @method_to_key_hash[vi] = t~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ @method_to_key_hash~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def self.char_to_method char, int = nil~ ** Processing line: ~ methods = char_to_method_hash[char] || char_to_method_hash[int]~ ** Processing line: ~ methods ? methods.dup : [char.to_sym || int]~ @@ -222411,7 +244724,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ value = Kernel.tick_count if value~ ** Processing line: ~~ ** Processing line: ~ collection.each do |m|~ -** Processing line: ~ self.instance_variable_set("@#{m.to_s}".to_sym, value)~ +** Processing line: ~ m_to_s = m.to_s~ +** Processing line: ~ self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise e, <<-S~ ** Processing line: ~ * ERROR:~ @@ -222427,24 +244741,32 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def method_missing m, *args~ -** Processing line: ~ begin~ -** Processing line: ~ define_singleton_method(m) do~ -** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ -** Processing line: ~ clear_key m~ -** Processing line: ~ return r~ -** Processing line: ~ end~ +** Processing line: ~ if KeyboardKeys.method_to_key_hash[m.without_ending_bang]~ +** Processing line: ~ begin~ +** Processing line: ~ define_singleton_method(m) do~ +** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ +** Processing line: ~ clear_key m~ +** Processing line: ~ return r~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return self.send m~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ log_important "#{e}"~ +** Processing line: ~ return self.send m~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ log_important "#{e}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ did_you_mean = KeyboardKeys.method_to_key_hash.find_all do |k, v|~ +** Processing line: ~ k.to_s[0..1] == m.to_s[0..1]~ +** Processing line: ~ end.map {|k, v| ":#{k} (#{v[:string_representation]})" }~ +** Processing line: ~ did_you_mean_string = ""~ +** Processing line: ~ did_you_mean_string = ". Did you mean #{did_you_mean.join ", "}?"~ +** Processing line: ~~ ** Processing line: ~ raise <<-S~ ** Processing line: ~ * ERROR:~ -** Processing line: ~ There is no member on the keyboard called #{m}. Here is a to_s representation of what's available:~ -** Processing line: ~~ -** Processing line: ~ #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")}~ +** Processing line: ~ #{KeyboardKeys.method_to_key_hash.map { |k, v| "** :#{k} #{v.string_representation}" }.join("\n")}~ ** Processing line: ~~ +** Processing line: ~ There is no key on the keyboard called :#{m}#{did_you_mean_string}.~ +** Processing line: ~ Full list of available keys =:points_up:=.~ ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -222828,6 +245150,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ (controller_one && controller_one.directional_vector)~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def directional_angle~ +** Processing line: ~ keyboard.directional_angle || (controller_one && controller_one.directional_angle)~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ # Returns a signal indicating right (`1`), left (`-1`), or neither ('0').~ ** Processing line: ~ #~ ** Processing line: ~ # @return [Integer]~ @@ -222914,19 +245240,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/ios_wizard.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # ios_wizard.rb has been released under MIT (*only this file*).~ ** Processing line: ~~ -** Processing line: ~ class WizardException < Exception~ -** Processing line: ~ attr_accessor :console_primitives~ -** Processing line: ~~ -** Processing line: ~ def initialize *console_primitives~ -** Processing line: ~ @console_primitives = console_primitives~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński~ ** Processing line: ~~ -** Processing line: ~ class IOSWizard~ +** Processing line: ~ class IOSWizard < Wizard~ ** Processing line: ~ def initialize~ ** Processing line: ~ @doctor_executed_at = 0~ ** Processing line: ~ end~ @@ -222939,23 +245260,46 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @steps ||= []~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def steps_development_build~ +** Processing line: ~ def prerequisite_steps~ ** Processing line: ~ [~ ** Processing line: ~ :check_for_xcode,~ ** Processing line: ~ :check_for_brew,~ ** Processing line: ~ :check_for_certs,~ -** Processing line: ~ :check_for_device,~ -** Processing line: ~ :check_for_dev_profile,~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def app_metadata_retrieval_steps~ +** Processing line: ~ [~ ** Processing line: ~ :determine_team_identifier,~ ** Processing line: ~ :determine_app_name,~ ** Processing line: ~ :determine_app_id,~ -** Processing line: ~ :blow_away_temp,~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def steps_development_build~ +** Processing line: ~ [~ +** Processing line: ~ *prerequisite_steps,~ +** Processing line: ~~ +** Processing line: ~ :check_for_device,~ +** Processing line: ~ :check_for_dev_profile,~ +** Processing line: ~~ +** Processing line: ~ *app_metadata_retrieval_steps,~ +** Processing line: ~ :determine_devcert,~ +** Processing line: ~~ +** Processing line: ~ :clear_tmp_directory,~ ** Processing line: ~ :stage_app,~ +** Processing line: ~~ ** Processing line: ~ :development_write_info_plist,~ +** Processing line: ~~ ** Processing line: ~ :write_entitlements_plist,~ ** Processing line: ~ :compile_icons,~ -** Processing line: ~ :create_payload_directory,~ +** Processing line: ~ :clear_payload_directory,~ +** Processing line: ~~ +** Processing line: ~ :create_payload_directory_dev,~ +** Processing line: ~~ +** Processing line: ~ :create_payload,~ ** Processing line: ~ :code_sign_payload,~ +** Processing line: ~~ ** Processing line: ~ :create_ipa,~ ** Processing line: ~ :deploy~ ** Processing line: ~ ]~ @@ -222963,20 +245307,28 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def steps_production_build~ ** Processing line: ~ [~ -** Processing line: ~ :check_for_xcode,~ -** Processing line: ~ :check_for_brew,~ -** Processing line: ~ :check_for_certs,~ +** Processing line: ~ *prerequisite_steps,~ +** Processing line: ~~ ** Processing line: ~ :check_for_distribution_profile,~ -** Processing line: ~ :determine_team_identifier,~ -** Processing line: ~ :determine_app_name,~ -** Processing line: ~ :determine_app_id,~ -** Processing line: ~ :blow_away_temp,~ +** Processing line: ~ :determine_app_version,~ +** Processing line: ~~ +** Processing line: ~ *app_metadata_retrieval_steps,~ +** Processing line: ~ :determine_prodcert,~ +** Processing line: ~~ +** Processing line: ~ :clear_tmp_directory,~ ** Processing line: ~ :stage_app,~ +** Processing line: ~~ ** Processing line: ~ :production_write_info_plist,~ +** Processing line: ~~ ** Processing line: ~ :write_entitlements_plist,~ ** Processing line: ~ :compile_icons,~ -** Processing line: ~ :create_payload_directory,~ +** Processing line: ~ :clear_payload_directory,~ +** Processing line: ~~ +** Processing line: ~ :create_payload_directory_prod,~ +** Processing line: ~~ +** Processing line: ~ :create_payload,~ ** Processing line: ~ :code_sign_payload,~ +** Processing line: ~~ ** Processing line: ~ :create_ipa,~ ** Processing line: ~ :print_publish_help~ ** Processing line: ~ ]~ @@ -223012,6 +245364,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @steps = steps_development_build~ ** Processing line: ~ @steps = steps_production_build if @production_build~ ** Processing line: ~ @certificate_name = nil~ +** Processing line: ~ @app_version = opts[:version]~ +** Processing line: ~ @app_version = "1.0" if @opts[:env] == :dev && !@app_version~ ** Processing line: ~ init_wizard_status~ ** Processing line: ~ log_info "Starting iOS Wizard so we can deploy to your device."~ ** Processing line: ~ @start_at = Kernel.global_tick_count~ @@ -223033,8 +245387,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ log "=" * $console.console_text_width~ ** Processing line: ~ else~ ** Processing line: ~ log_error e.to_s~ +** Processing line: ~ log e.__backtrace_to_org__~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ init_wizard_status~ ** Processing line: ~ $console.set_command "$wizards.ios.start env: :#{@opts[:env]}"~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -223141,13 +245497,70 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ return "profiles/development.mobileprovision"~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def ios_metadata_template~ +** Processing line: ~ <<-S~ +** Processing line: ~ # ios_metadata.txt is used by the Pro version of DragonRuby Game Toolkit to create iOS apps.~ +** Processing line: ~ # Information about the Pro version can be found at: http://dragonruby.org/toolkit/game#purchase~ +** Processing line: ~~ +** Processing line: ~ # teamid needs to be set to your assigned Team Id which can be found at https://developer.apple.com/account/#/membership/~ +** Processing line: ~ teamid=~ +** Processing line: ~ # appid needs to be set to your application identifier which can be found at https://developer.apple.com/account/resources/identifiers/list~ +** Processing line: ~ appid=~ +** Processing line: ~ # appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters.~ +** Processing line: ~ appname=~ +** Processing line: ~ # devcert is the certificate to use for development/deploying to your local device~ +** Processing line: ~ devcert=~ +** Processing line: ~ # prodcert is the certificate to use for distribution to the app store~ +** Processing line: ~ prodcert=~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def ios_metadata~ +** Processing line: ~ contents = $gtk.read_file 'metadata/ios_metadata.txt'~ +** Processing line: ~~ +** Processing line: ~ if !contents~ +** Processing line: ~ $gtk.write_file 'metadata/ios_metadata.txt', ios_metadata_template~ +** Processing line: ~ contents = $gtk.read_file 'metadata/ios_metadata.txt'~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ kvps = contents.each_line~ +** Processing line: ~ .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") }~ +** Processing line: ~ .map do |l|~ +** Processing line: ~ key, value = l.split("=")~ +** Processing line: ~ [key.strip.to_sym, value.strip]~ +** Processing line: ~ end.flatten~ +** Processing line: ~ Hash[*kvps]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def game_metadata~ +** Processing line: ~ contents = $gtk.read_file 'metadata/game_metadata.txt'~ +** Processing line: ~~ +** Processing line: ~ kvps = contents.each_line~ +** Processing line: ~ .reject { |l| l.strip.length == 0 || (l.strip.start_with? "#") }~ +** Processing line: ~ .map do |l|~ +** Processing line: ~ key, value = l.split("=")~ +** Processing line: ~ [key.strip.to_sym, value.strip]~ +** Processing line: ~ end.flatten~ +** Processing line: ~ Hash[*kvps]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def raise_ios_metadata_required~ +** Processing line: ~ raise WizardException.new(~ +** Processing line: ~ "* mygame/metadata/ios_metadata.txt needs to be filled out.",~ +** Processing line: ~ "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.",~ +** Processing line: ~ "Instructions for where the values should come from are within metadata/ios_metadata.txt."~ +** Processing line: ~ )~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def determine_team_identifier~ -** Processing line: ~ @team_name = (team_identifier_from_provisioning_profile @opts[:env])~ -** Processing line: ~ log_info "Team Identifer is: #{@team_name}"~ +** Processing line: ~ @team_id = (ios_metadata.teamid || "")~ +** Processing line: ~ raise_ios_metadata_required if @team_id.strip.length == 0~ +** Processing line: ~ log_info "Team Identifer is: #{@team_id}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def determine_app_name~ -** Processing line: ~ @app_name = (provisioning_profile_xml @opts[:env])[:children].first[:children].first[:children][1][:children].first[:data]~ +** Processing line: ~ @app_name = (ios_metadata.appname || "")~ +** Processing line: ~ raise_ios_metadata_required if @app_name.strip.length == 0~ ** Processing line: ~ log_info "App name is: #{@app_name}."~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -223171,37 +245584,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ $gtk.parse_xml scrubbed~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def app_id_from_provisioning_profile environment~ -** Processing line: ~ application_identifier_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data]~ -** Processing line: ~ (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i|~ -** Processing line: ~ if node[:children] && node[:children][0] && node[:children][0][:data] == "application-identifier"~ -** Processing line: ~ application_identifier_index = i~ -** Processing line: ~ break~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ app_id_with_team_identifier = (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][application_identifier_index + 1][:children].first[:data]~ -** Processing line: ~ team_identifer = team_identifier_from_provisioning_profile environment~ -** Processing line: ~ app_id_with_team_identifier.gsub "#{team_identifer}.", ""~ +** Processing line: ~ def determine_app_id~ +** Processing line: ~ @app_id = ios_metadata.appid~ +** Processing line: ~ raise_ios_metadata_required if @app_id.strip.length == 0~ +** Processing line: ~ log_info "App Identifier is set to: #{@app_id}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def team_identifier_from_provisioning_profile environment~ -** Processing line: ~ team_identifer_index = (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children][0][:children][0][:data]~ -** Processing line: ~~ -** Processing line: ~ (provisioning_profile_xml environment)[:children][0][:children][0][:children][13][:children].each.with_index do |node, i|~ -** Processing line: ~ if node[:children] && node[:children][0] && node[:children][0][:data] == "com.apple.developer.team-identifier"~ -** Processing line: ~ team_identifer_index = i~ -** Processing line: ~ break~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ (provisioning_profile_xml environment)[:children].first[:children].first[:children][13][:children][team_identifer_index + 1][:children].first[:data]~ +** Processing line: ~ def determine_devcert~ +** Processing line: ~ @certificate_name = ios_metadata.devcert~ +** Processing line: ~ raise_ios_metadata_required if @certificate_name.strip.length == 0~ +** Processing line: ~ log_info "Dev Certificate is set to: #{@certificate_name}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def determine_app_id~ -** Processing line: ~ @app_id = app_id_from_provisioning_profile @opts[:env]~ -** Processing line: ~~ -** Processing line: ~ log_info "App Identifier is set to : #{@app_id}"~ +** Processing line: ~ def determine_prodcert~ +** Processing line: ~ @certificate_name = ios_metadata.prodcert~ +** Processing line: ~ raise_ios_metadata_required if @certificate_name.strip.length == 0~ +** Processing line: ~ log_info "Production (Distribution) Certificate is set to: #{@certificate_name}"~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_app_name name~ @@ -223219,16 +245617,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blow_away_temp~ +** Processing line: ~ def clear_tmp_directory~ ** Processing line: ~ sh "rm -rf #{tmp_directory}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def stage_app~ -** Processing line: ~ log_info "Staging."~ -** Processing line: ~ sh "mkdir -p #{tmp_directory}"~ -** Processing line: ~ sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def set_app_id id~ ** Processing line: ~ log_info = "App Id set to: #{id}"~ ** Processing line: ~ @app_id = id~ @@ -223259,34 +245651,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def check_for_certs~ ** Processing line: ~ log_info "Attempting to find certificates on your computer."~ ** Processing line: ~~ -** Processing line: ~ if !cli_app_exist?(security_cli_app)~ -** Processing line: ~ raise WizardException.new(~ -** Processing line: ~ "* It doesn't look like you have #{security_cli_app}.",~ -** Processing line: ~ "** 1. Open Disk Utility and run First Aid.",~ -** Processing line: ~ { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") },~ -** Processing line: ~ )~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if valid_certs.length == 0~ -** Processing line: ~ raise WizardException.new(~ -** Processing line: ~ "* It doesn't look like you have any valid certs installed.",~ -** Processing line: ~ "** 1. Open Xcode.",~ -** Processing line: ~ "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.",~ -** Processing line: ~ { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") },~ -** Processing line: ~ "** 3. After loggin in, select Manage Certificates...",~ -** Processing line: ~ { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") },~ -** Processing line: ~ "** 4. Add a certificate for Apple Development.",~ -** Processing line: ~ { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") },~ -** Processing line: ~ )~ -** Processing line: ~ raise "You do not have any Apple development certs on this computer."~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ if @production_build~ -** Processing line: ~ @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name]~ +** Processing line: ~ @certificate_name = ios_metadata[:prodcert]~ ** Processing line: ~ else~ -** Processing line: ~ @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name]~ +** Processing line: ~ @certificate_name = ios_metadata[:devcert]~ ** Processing line: ~ end~ -** Processing line: ~ log_info "I will be using Certificate: '#{@certificate_name}'."~ +** Processing line: ~~ +** Processing line: ~ log_info "I will be using certificate: '#{@certificate_name}'."~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def idevice_id_cli_app~ @@ -223301,24 +245672,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ "xcodebuild"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def valid_certs~ -** Processing line: ~ certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l|~ -** Processing line: ~ if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution"))~ -** Processing line: ~ l.strip~ -** Processing line: ~ else~ -** Processing line: ~ nil~ -** Processing line: ~ end~ -** Processing line: ~ end.reject_nil.map do |l|~ -** Processing line: ~ number, id, name = l.split(' ', 3)~ -** Processing line: ~ name = name.gsub("\"", "") if name~ -** Processing line: ~ {~ -** Processing line: ~ number: 1,~ -** Processing line: ~ id: id,~ -** Processing line: ~ name: name~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def connected_devices~ ** Processing line: ~ sh("idevice_id -l").strip.each_line.map do |l|~ ** Processing line: ~ l.strip~ @@ -223360,7 +245713,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ log_info "Creating Entitlements.plist"~ ** Processing line: ~~ -** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_name}.#{@app_id}").strip~ +** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.plist", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip~ +** Processing line: ~ $gtk.write_file_root "tmp/ios/Entitlements.txt", entitlement_plist_string.gsub(":app_id", "#{@team_id}.#{@app_id}").strip~ ** Processing line: ~~ ** Processing line: ~ sh "/usr/bin/plutil -convert binary1 \"#{tmp_directory}/Entitlements.plist\""~ ** Processing line: ~ sh "/usr/bin/plutil -convert xml1 \"#{tmp_directory}/Entitlements.plist\""~ @@ -223398,15 +245752,15 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ <key>CFBundleExecutable</key>~ ** Processing line: ~ <string>:app_name</string>~ ** Processing line: ~ <key>CFBundleInfoDictionaryVersion</key>~ -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundlePackageType</key>~ ** Processing line: ~ <string>APPL</string>~ ** Processing line: ~ <key>CFBundleShortVersionString</key>~ -** Processing line: ~ <string>5.6</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleSignature</key>~ ** Processing line: ~ <string>????</string>~ ** Processing line: ~ <key>CFBundleVersion</key>~ -** Processing line: ~ <string>5.6</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleIcons</key>~ ** Processing line: ~ <dict>~ ** Processing line: ~ <key>CFBundlePrimaryIcon</key>~ @@ -223555,13 +245909,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ <key>CFBundleIdentifier</key>~ ** Processing line: ~ <string>:app_id</string>~ ** Processing line: ~ <key>CFBundleInfoDictionaryVersion</key>~ -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleName</key>~ ** Processing line: ~ <string>:app_name</string>~ ** Processing line: ~ <key>CFBundlePackageType</key>~ ** Processing line: ~ <string>APPL</string>~ ** Processing line: ~ <key>CFBundleShortVersionString</key>~ -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleSignature</key>~ ** Processing line: ~ <string>????</string>~ ** Processing line: ~ <key>CFBundleSupportedPlatforms</key>~ @@ -223569,7 +245923,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ <string>iPhoneOS</string>~ ** Processing line: ~ </array>~ ** Processing line: ~ <key>CFBundleVersion</key>~ -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>DTCompiler</key>~ ** Processing line: ~ <string>com.apple.compilers.llvm.clang.1_0</string>~ ** Processing line: ~ <key>DTPlatformBuild</key>~ @@ -223655,6 +246009,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ info_plist_string.gsub!(":app_id", @app_id)~ ** Processing line: ~~ ** Processing line: ~ $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip~ +** Processing line: ~ $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip~ ** Processing line: ~~ ** Processing line: ~ @info_plist_written = true~ ** Processing line: ~ end~ @@ -223708,13 +246063,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ <key>CFBundleIdentifier</key>~ ** Processing line: ~ <string>:app_id</string>~ ** Processing line: ~ <key>CFBundleInfoDictionaryVersion</key>~ -** Processing line: ~ <string>6.0</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleName</key>~ ** Processing line: ~ <string>:app_name</string>~ ** Processing line: ~ <key>CFBundlePackageType</key>~ ** Processing line: ~ <string>APPL</string>~ ** Processing line: ~ <key>CFBundleShortVersionString</key>~ -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>CFBundleSignature</key>~ ** Processing line: ~ <string>????</string>~ ** Processing line: ~ <key>CFBundleSupportedPlatforms</key>~ @@ -223722,7 +246077,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ <string>iPhoneOS</string>~ ** Processing line: ~ </array>~ ** Processing line: ~ <key>CFBundleVersion</key>~ -** Processing line: ~ <string>5.2</string>~ +** Processing line: ~ <string>:app_version</string>~ ** Processing line: ~ <key>DTCompiler</key>~ ** Processing line: ~ <string>com.apple.compilers.llvm.clang.1_0</string>~ ** Processing line: ~ <key>DTPlatformBuild</key>~ @@ -223806,8 +246161,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ info_plist_string.gsub!(":app_name", @app_name)~ ** Processing line: ~ info_plist_string.gsub!(":app_id", @app_id)~ +** Processing line: ~ info_plist_string.gsub!(":app_version", @app_version)~ ** Processing line: ~~ ** Processing line: ~ $gtk.write_file_root "tmp/ios/#{@app_name}.app/Info.plist", info_plist_string.strip~ +** Processing line: ~ $gtk.write_file_root "tmp/ios/Info.txt", info_plist_string.strip~ ** Processing line: ~~ ** Processing line: ~ @info_plist_written = true~ ** Processing line: ~ end~ @@ -223829,28 +246186,56 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ "#{relative_path}/#{$gtk.cli_arguments[:dragonruby]}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def write_ip_address~ +** Processing line: ~ def embed_mobileprovision~ +** Processing line: ~ sh %Q[cp #{@provisioning_profile_path} "#{app_path}/embedded.mobileprovision"]~ +** Processing line: ~ sh %Q[/usr/bin/plutil -convert binary1 "#{app_path}/Info.plist"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def clear_payload_directory~ +** Processing line: ~ sh %Q[rm "#{@app_name}".ipa]~ +** Processing line: ~ sh %Q[rm -rf "#{app_path}/app"]~ +** Processing line: ~ sh %Q[rm -rf "#{app_path}/sounds"]~ +** Processing line: ~ sh %Q[rm -rf "#{app_path}/sprites"]~ +** Processing line: ~ sh %Q[rm -rf "#{app_path}/data"]~ +** Processing line: ~ sh %Q[rm -rf "#{app_path}/fonts"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stage_app~ +** Processing line: ~ log_info "Staging."~ +** Processing line: ~ sh "mkdir -p #{tmp_directory}"~ +** Processing line: ~ sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""~ +** Processing line: ~ sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"]~ +** Processing line: ~ sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"]~ +** Processing line: ~ sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"]~ +** Processing line: ~ sh %Q[cp -r "#{root_folder}/data/" "#{app_path}/data/"]~ +** Processing line: ~ sh %Q[cp -r "#{root_folder}/fonts/" "#{app_path}/fonts/"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def create_payload~ +** Processing line: ~ sh %Q[mkdir -p #{tmp_directory}/ipa_root/Payload]~ +** Processing line: ~ sh %Q[cp -r "#{app_path}" "#{tmp_directory}/ipa_root/Payload"]~ +** Processing line: ~ sh %Q[chmod -R 755 "#{tmp_directory}/ipa_root/Payload"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def create_payload_directory_dev~ +** Processing line: ~ # write dev machine's ip address for hotloading~ ** Processing line: ~ $gtk.write_file "app/server_ip_address.txt", $gtk.ffi_misc.get_local_ip_address.strip~ +** Processing line: ~~ +** Processing line: ~ embed_mobileprovision~ +** Processing line: ~ clear_payload_directory~ +** Processing line: ~ stage_app~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def create_payload_directory~ -** Processing line: ~ sh "cp #{@provisioning_profile_path} \"#{app_path}/embedded.mobileprovision\""~ -** Processing line: ~ sh "/usr/bin/plutil -convert binary1 \"#{app_path}/Info.plist\""~ -** Processing line: ~ write_ip_address~ -** Processing line: ~ sh "rm \"#{@app_name}\".ipa"~ -** Processing line: ~ sh "rm -rf \"#{app_path}/app\""~ -** Processing line: ~ sh "rm -rf \"#{app_path}/sounds\""~ -** Processing line: ~ sh "rm -rf \"#{app_path}/sprites\""~ -** Processing line: ~ sh "rm -rf \"#{app_path}/data\""~ -** Processing line: ~ sh "rm -rf \"#{app_path}/fonts\""~ -** Processing line: ~ sh "cp -r \"#{root_folder}/app/\" \"#{app_path}/app/\""~ -** Processing line: ~ sh "cp -r \"#{root_folder}/sounds/\" \"#{app_path}/sounds/\""~ -** Processing line: ~ sh "cp -r \"#{root_folder}/sprites/\" \"#{app_path}/sprites/\""~ -** Processing line: ~ sh "cp -r \"#{root_folder}/data/\" \"#{app_path}/data/\""~ -** Processing line: ~ sh "cp -r \"#{root_folder}/fonts/\" \"#{app_path}/fonts/\""~ -** Processing line: ~ sh "mkdir -p #{tmp_directory}/ipa_root/Payload"~ -** Processing line: ~ sh "cp -r \"#{app_path}\" \"#{tmp_directory}/ipa_root/Payload\""~ -** Processing line: ~ sh "chmod -R 755 \"#{tmp_directory}/ipa_root/Payload\""~ +** Processing line: ~ def create_payload_directory_prod~ +** Processing line: ~ # production builds does not hotload ip address~ +** Processing line: ~ sh %Q[rm "#{root_folder}/app/server_ip_address.txt"]~ +** Processing line: ~~ +** Processing line: ~ embed_mobileprovision~ +** Processing line: ~ stage_app~ +** Processing line: ~~ +** Processing line: ~ # production build marker~ +** Processing line: ~ sh %Q[mkdir -p "#{app_path}/metadata/"]~ +** Processing line: ~ sh %Q[touch metadata/DRAGONRUBY_PRODUCTION_BUILD]~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def create_ipa~ @@ -223883,10 +246268,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def print_publish_help~ -** Processing line: ~ log_info "Go to https://appstoreconnect.apple.com/apps and create an App if you haven't already done so."~ -** Processing line: ~ log_info "Go to https://appleid.apple.com and create a 'Application Specific Password'."~ -** Processing line: ~ log_info "To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12."~ -** Processing line: ~ log_info "Your app is located at ./tmp/ios/#{@app_name}.ipa"~ +** Processing line: ~ has_transporter = (sh "ls /Applications/Transporter.app").include? "Contents"~ +** Processing line: ~ if !has_transporter~ +** Processing line: ~ $gtk.openurl "https://apps.apple.com/us/app/transporter/id1450874784?mt=12"~ +** Processing line: ~ $console.set_command "$wizards.ios.start env: :#{@opts[:env]}, version: \"#{@opts[:version]}\""~ +** Processing line: ~ raise WizardException.new(~ +** Processing line: ~ "* To upload your app, Download Transporter from the App Store https://apps.apple.com/us/app/transporter/id1450874784?mt=12."~ +** Processing line: ~ )~ +** Processing line: ~ else~ +** Processing line: ~ sh "mkdir ./tmp/ios/intermediary_artifacts"~ +** Processing line: ~ sh "mv \"#{tmp_directory}/#{@app_name}.app\" #{tmp_directory}/intermediary_artifacts/"~ +** Processing line: ~ sh "mv \"#{tmp_directory}/do_zip.sh\" #{tmp_directory}/intermediary_artifacts"~ +** Processing line: ~ sh "mv \"#{tmp_directory}/Entitlements.plist\" #{tmp_directory}/intermediary_artifacts"~ +** Processing line: ~ sh "mv \"#{tmp_directory}/ipa_root\" #{tmp_directory}/intermediary_artifacts/"~ +** Processing line: ~ sh "open /Applications/Transporter.app"~ +** Processing line: ~ sh "open ./tmp/ios/"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def compile_icons~ @@ -223907,6 +246304,26 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ sh "cp -r \"#{root_folder}/native/\" \"#{app_path}/native/\""~ ** Processing line: ~ sh "CODESIGN_ALLOCATE=\"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate\" /usr/bin/codesign -f -s \"#{@certificate_name}\" --entitlements #{tmp_directory}/Entitlements.plist \"#{tmp_directory}/#{@app_name}.app/native/ios-device/ext.dylib\""~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_version version~ +** Processing line: ~ @app_version = version~ +** Processing line: ~ start env: @opts[:env], version: version~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def app_version~ +** Processing line: ~ log_info "Attempting to retrieve App Version from metadata/ios_metadata.txt."~ +** Processing line: ~ ios_version_number = (ios_metadata.version || "").strip~ +** Processing line: ~ if ios_version_number.length == 0~ +** Processing line: ~ log_info "Not found. Attempting to retrieve App Version from metadata/game_metadata.txt."~ +** Processing line: ~ ios_version_number = (game_metadata.version || "").strip~ +** Processing line: ~ end~ +** Processing line: ~ ios_version_number~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def determine_app_version~ +** Processing line: ~ @app_version = app_version~ +** Processing line: ~ return if @app_version~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -223929,42 +246346,19 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/itch_wizard.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # itch_wizard.rb has been released under MIT (*only this file*).~ ** Processing line: ~~ -** Processing line: ~ class ItchWizard~ +** Processing line: ~ class ItchWizard < Wizard~ ** Processing line: ~ def steps~ ** Processing line: ~ [~ ** Processing line: ~ :check_metadata,~ -** Processing line: ~ :deploy~ +** Processing line: ~ :deploy,~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def metadata_file_path~ -** Processing line: ~ "metadata/game_metadata.txt"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def get_metadata~ -** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ -** Processing line: ~~ -** Processing line: ~ if !metadata~ -** Processing line: ~ write_blank_metadata~ -** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ -** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ dev_id: dev_id.strip,~ -** Processing line: ~ dev_title: dev_title.strip,~ -** Processing line: ~ game_id: game_id.strip,~ -** Processing line: ~ game_title: game_title.strip,~ -** Processing line: ~ version: version.strip,~ -** Processing line: ~ icon: icon.strip~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def write_blank_metadata~ ** Processing line: ~ $gtk.write_file metadata_file_path, <<-S.strip~ ** Processing line: ~ #devid=myname~ @@ -223982,7 +246376,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ write_blank_metadata~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if metadata_text.each_line.to_a.length != 6~ +** Processing line: ~ if metadata_text.strip.each_line.to_a.length < 6~ ** Processing line: ~ write_blank_metadata~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -223994,70 +246388,67 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ if metadata[:dev_id].start_with?("#") || !@dev_id~ ** Processing line: ~ log "* PROMPT: Please provide your username for Itch."~ -** Processing line: ~ $console.set_command "$wizards.itch.set_dev_id \"your-itch-username\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_dev_id \"#{metadata[:dev_id]}\""~ ** Processing line: ~ return :need_dev_id~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if metadata[:dev_title].start_with?("#") || !@dev_title~ ** Processing line: ~ log "* PROMPT: Please provide developer's/company's name that you want displayed."~ -** Processing line: ~ $console.set_command "$wizards.itch.set_dev_title \"Your Name\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_dev_title \"#{metadata[:dev_title]}\""~ ** Processing line: ~ return :need_dev_title~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if metadata[:game_id].start_with?("#") || !@game_id~ ** Processing line: ~ log "* PROMPT: Please provide the id for you game. This is the id you specified when you set up a new game page on Itch."~ -** Processing line: ~ $console.set_command "$wizards.itch.set_game_id \"your-game-id\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_game_id \"#{metadata[:game_id]}\""~ ** Processing line: ~ return :need_game_id~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if metadata[:game_title].start_with?("#") || !@game_title~ ** Processing line: ~ log "* PROMPT: Please provide the display name for your game. (This can include spaces)"~ -** Processing line: ~ $console.set_command "$wizards.itch.set_game_title \"Your Game\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_game_title \"#{metadata[:game_title]}\""~ ** Processing line: ~ return :need_game_title~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if metadata[:version].start_with?("#") || !@version~ ** Processing line: ~ log "* PROMPT: Please provide the version for your game."~ -** Processing line: ~ $console.set_command "$wizards.itch.set_version \"1.0\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_version \"#{metadata[:version]}\""~ ** Processing line: ~ return :need_version~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if metadata[:icon].start_with?("#") || !@icon~ ** Processing line: ~ log "* PROMPT: Please provide icon path for your game."~ -** Processing line: ~ $console.set_command "$wizards.itch.set_icon \"icon.png\""~ +** Processing line: ~ $console.set_command "$wizards.itch.set_icon \"#{metadata[:icon]}\""~ ** Processing line: ~ return :need_icon~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ puts "here!! success!!!"~ +** Processing line: ~~ ** Processing line: ~ return :success~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_dev_id value~ ** Processing line: ~ @dev_id = value~ -** Processing line: ~ write_metadata~ ** Processing line: ~ start~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_dev_title value~ ** Processing line: ~ @dev_title = value~ -** Processing line: ~ write_metadata~ ** Processing line: ~ start~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_game_id value~ ** Processing line: ~ @game_id = value~ -** Processing line: ~ write_metadata~ ** Processing line: ~ start~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_game_title value~ ** Processing line: ~ @game_title = value~ -** Processing line: ~ write_metadata~ ** Processing line: ~ start~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def set_version value~ ** Processing line: ~ @version = value~ -** Processing line: ~ write_metadata~ ** Processing line: ~ start~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -224100,7 +246491,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ if @icon~ -** Processing line: ~ text += "icon=metadata/#{@icon}\n"~ +** Processing line: ~ text += "icon=#{@icon}\n"~ ** Processing line: ~ else~ ** Processing line: ~ text += "#icon=metadata/icon.png\n"~ ** Processing line: ~ end~ @@ -224118,10 +246509,25 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def deploy~ ** Processing line: ~ log_info "* Running dragonruby-publish: #{package_command}"~ -** Processing line: ~ results = $gtk.exec package_command~ +** Processing line: ~ $gtk.openurl "http://itch.io/dashboard" if $gtk.platform == "Mac OS X"~ +** Processing line: ~ if $gtk.platform? :mac~ +** Processing line: ~ $gtk.exec "rm -rf ./builds"~ +** Processing line: ~ end~ +** Processing line: ~ results = $gtk.exec "#{package_command} --only-package"~ +** Processing line: ~ puts File.expand_path("./builds")~ +** Processing line: ~~ ** Processing line: ~ log "#+begin_src"~ ** Processing line: ~ log results~ ** Processing line: ~ log "#+end_src"~ +** Processing line: ~~ +** Processing line: ~ if $gtk.platform? :mac~ +** Processing line: ~ $gtk.exec "open ./builds/"~ +** Processing line: ~ elsif $gtk.platform? :windows~ +** Processing line: ~ $gtk.exec "powershell \"ii .\""~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.openurl "https://itch.io/dashboard"~ +** Processing line: ~~ ** Processing line: ~ :success~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -224132,7 +246538,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ steps.each do |m|~ ** Processing line: ~ begin~ ** Processing line: ~ log_info "Running Itch Wizard Step: ~$wizards.itch.#{m}~"~ -** Processing line: ~ result = (send m) || :success if @wizard_status[m][:result] != :success~ +** Processing line: ~ result = (send m) || :success~ ** Processing line: ~ @wizard_status[m][:result] = result~ ** Processing line: ~ if result != :success~ ** Processing line: ~ log_info "Exiting wizard. :#{result}"~ @@ -224218,6 +246624,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/layout.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # layout.rb has been released under MIT (*only this file*).~ @@ -224496,10 +246903,18 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ device.grid_area.row_count~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def row_max_index~ +** Processing line: ~ row_count - 1~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def col_count~ ** Processing line: ~ device.grid_area.col_count~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def col_max_index~ +** Processing line: ~ col_count - 1~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def gutter_height~ ** Processing line: ~ device.grid_area.gutter~ ** Processing line: ~ end~ @@ -224522,18 +246937,124 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def rect_defaults~ ** Processing line: ~ {~ -** Processing line: ~ row: nil,~ -** Processing line: ~ col: nil,~ -** Processing line: ~ h: 1,~ -** Processing line: ~ w: 1,~ -** Processing line: ~ dx: 0,~ -** Processing line: ~ dy: 0,~ -** Processing line: ~ rect: :control_rect~ +** Processing line: ~ row: nil,~ +** Processing line: ~ col: nil,~ +** Processing line: ~ h: 1,~ +** Processing line: ~ w: 1,~ +** Processing line: ~ dx: 0,~ +** Processing line: ~ dx_ratio: 1,~ +** Processing line: ~ dy: 0,~ +** Processing line: ~ dy_ratio: 1,~ +** Processing line: ~ dh_ratio: 1,~ +** Processing line: ~ dw_ratio: 1,~ +** Processing line: ~ merge: nil,~ +** Processing line: ~ rect: :control_rect~ ** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def rect opts~ +** Processing line: ~ def row n~ +** Processing line: ~ (rect row: n, col: 0, w: 0, h: 0).x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def row_from_bottom n~ +** Processing line: ~ (rect row: row_count - n, col: 0, w: 0, h: 0).x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def col n~ +** Processing line: ~ (rect row: 0, col: n, w: 0, h: 0).y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def col_from_right n~ +** Processing line: ~ (rect row: 0, col: col_max_index - n, w: 0, h: 0).y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def w n~ +** Processing line: ~ (rect row: 0, col: 0, w: n, h: 1).w~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def h n~ +** Processing line: ~ (rect row: 0, col: 0, w: 1, h: n).h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def rect_group opts~ +** Processing line: ~ group = opts.group~ +** Processing line: ~ r = opts.row || 0~ +** Processing line: ~ r = row_max_index - opts.row_from_bottom if opts.row_from_bottom~ +** Processing line: ~ c = opts.col || 0~ +** Processing line: ~ c = col_max_index - opts.col_from_right if opts.col_from_right~ +** Processing line: ~ drow = opts.drow || 0~ +** Processing line: ~ dcol = opts.dcol || 0~ +** Processing line: ~ w = opts.w || 0~ +** Processing line: ~ h = opts.h || 0~ +** Processing line: ~ merge = opts[:merge]~ +** Processing line: ~~ +** Processing line: ~ running_row = r~ +** Processing line: ~ running_col = c~ +** Processing line: ~~ +** Processing line: ~ running_col = calc_col_offset(opts.col_offset) if opts.col_offset~ +** Processing line: ~ running_row = calc_row_offset(opts.row_offset) if opts.row_offset~ +** Processing line: ~~ +** Processing line: ~ group.map do |i|~ +** Processing line: ~ group_layout_opts = i.layout || {}~ +** Processing line: ~ group_layout_opts = group_layout_opts.merge row: running_row,~ +** Processing line: ~ col: running_col,~ +** Processing line: ~ merge: merge,~ +** Processing line: ~ w: w, h: h~ +** Processing line: ~ result = (rect group_layout_opts).merge i~ +** Processing line: ~~ +** Processing line: ~ if (i.is_a? Hash) && (i.primitive_marker == :label)~ +** Processing line: ~ if i.alignment_enum == 1~ +** Processing line: ~ result.x += result.w.half~ +** Processing line: ~ elsif i.alignment_enum == 2~ +** Processing line: ~ result.x += result.w~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ running_row += drow~ +** Processing line: ~ running_col += dcol~ +** Processing line: ~ result~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_row_offset opts = {}~ +** Processing line: ~ count = opts[:count] || opts[:length] || 0~ +** Processing line: ~ h = opts.h || 1~ +** Processing line: ~ (row_count - (count * h)) / 2.0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_col_offset opts = {}~ +** Processing line: ~ count = opts[:count] || opts[:length] || 0~ +** Processing line: ~ w = opts.w || 1~ +** Processing line: ~ (col_count - (count * w)) / 2.0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def point opts = {}~ +** Processing line: ~ opts.w = 1~ +** Processing line: ~ opts.h = 1~ +** Processing line: ~ opts.row ||= 0~ +** Processing line: ~ opts.col ||= 0~ +** Processing line: ~ r = rect opts~ +** Processing line: ~ r.x += r.w * opts.col_anchor if opts.col_anchor~ +** Processing line: ~ r.y += r.h * opts.row_anchor if opts.row_anchor~ +** Processing line: ~ r~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def rect *all_opts~ +** Processing line: ~ if all_opts.length == 1~ +** Processing line: ~ opts = all_opts.first~ +** Processing line: ~ else~ +** Processing line: ~ opts = {}~ +** Processing line: ~ all_opts.each do |o|~ +** Processing line: ~ opts.merge! o~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ opts.row = row_max_index - opts.row_from_bottom if opts.row_from_bottom~ +** Processing line: ~ opts.col = col_max_index - opts.col_from_right if opts.col_from_right~ ** Processing line: ~ opts = rect_defaults.merge opts~ +** Processing line: ~ opts.row ||= 0~ +** Processing line: ~ opts.col ||= 0~ +** Processing line: ~~ ** Processing line: ~ result = send opts[:rect]~ ** Processing line: ~ if opts[:row] && opts[:col] && opts[:w] && opts[:h]~ ** Processing line: ~ col = rect_col opts[:col], opts[:w]~ @@ -224541,7 +247062,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ result = control_rect.merge x: col.x,~ ** Processing line: ~ y: row.y,~ ** Processing line: ~ w: col.w,~ -** Processing line: ~ h: row.h~ +** Processing line: ~ h: row.h,~ +** Processing line: ~ center_x: col.center_x,~ +** Processing line: ~ center_y: row.center_y~ ** Processing line: ~ elsif opts[:row] && !opts[:col]~ ** Processing line: ~ result = rect_row opts[:row], opts[:h]~ ** Processing line: ~ elsif !opts[:row] && opts[:col]~ @@ -224579,13 +247102,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ result[:h] += device.grid_area.gutter * 2~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ result[:x] += opts[:dx] if opts[:dx]~ -** Processing line: ~ result[:y] += opts[:dy] if opts[:dy]~ -** Processing line: ~ result[:w] += opts[:dw] if opts[:dw]~ -** Processing line: ~ result[:h] += opts[:dh] if opts[:dh]~ +** Processing line: ~ result[:x] += opts[:dx] if opts[:dx]~ +** Processing line: ~ result[:x] *= opts[:dx_ratio] if opts[:dx_ratio]~ +** Processing line: ~ result[:y] += opts[:dy] if opts[:dy]~ +** Processing line: ~ result[:y] *= opts[:dy_ratio] if opts[:dy_ratio]~ +** Processing line: ~ result[:w] += opts[:dw] if opts[:dw]~ +** Processing line: ~ result[:w] *= opts[:dw_ratio] if opts[:dw_ratio]~ +** Processing line: ~ result[:h] += opts[:dh] if opts[:dh]~ +** Processing line: ~ result[:h] *= opts[:dh_ratio] if opts[:dh_ratio]~ +** Processing line: ~ result.merge! opts[:merge] if opts[:merge]~ ** Processing line: ~ result[:row] = opts[:row]~ ** Processing line: ~ result[:col] = opts[:col]~ ** Processing line: ~~ +** Processing line: ~ result[:h] = result[:h].clamp 0~ +** Processing line: ~ result[:w] = result[:w].clamp 0~ +** Processing line: ~~ ** Processing line: ~ if $gtk.args.grid.name == :center~ ** Processing line: ~ result[:x] -= 640~ ** Processing line: ~ result[:y] -= 360~ @@ -224620,7 +247151,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ row_y = device.h - row_y - row_h~ ** Processing line: ~~ -** Processing line: ~ result = control_rect.merge y: row_y, h: row_h~ +** Processing line: ~ result = control_rect.merge y: row_y, h: row_h, center_y: (row_y + row_h.half)~ ** Processing line: ~ @rect_cache[:row][index][h] = result~ ** Processing line: ~ @rect_cache[:row][index][h]~ ** Processing line: ~ end~ @@ -224643,7 +247174,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ col_w = col_w.to_i~ ** Processing line: ~ col_w -= 1 if col_w.odd?~ ** Processing line: ~~ -** Processing line: ~ result = control_rect.merge x: col_x, w: col_w~ +** Processing line: ~ result = control_rect.merge x: col_x, w: col_w, center_x: (col_x + col_w.half)~ ** Processing line: ~ @rect_cache[:col][index][w] = result~ ** Processing line: ~ @rect_cache[:col][index][w]~ ** Processing line: ~ end~ @@ -224694,6 +247225,26 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @device~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def debug_primitives opts = {}~ +** Processing line: ~ @primitives ||= col_count.map_with_index do |col|~ +** Processing line: ~ row_count.map_with_index do |row|~ +** Processing line: ~ cell = rect row: row, col: col~ +** Processing line: ~ center = Geometry.rect_center_point cell~ +** Processing line: ~ [~ +** Processing line: ~ cell.merge(opts).border,~ +** Processing line: ~ cell.merge(opts)~ +** Processing line: ~ .label!(x: center.x,~ +** Processing line: ~ y: center.y,~ +** Processing line: ~ text: "#{row},#{col}",~ +** Processing line: ~ size_enum: -3,~ +** Processing line: ~ vertical_alignment_enum: 1,~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ @primitives~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def serialize~ ** Processing line: ~ {~ ** Processing line: ~ device: @device.serialize,~ @@ -224707,6 +247258,13 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def to_s~ ** Processing line: ~ serialize.to_s~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def reset~ +** Processing line: ~ @primitives = nil~ +** Processing line: ~ @rect_cache ||= {}~ +** Processing line: ~ @rect_cache.clear~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -224861,6 +247419,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ self.puts message~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def self.reset~ +** Processing line: ~ @once = {}~ +** Processing line: ~ nil~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def self.puts_once *ids, message~ ** Processing line: ~ id = "#{ids}"~ ** Processing line: ~ @once ||= {}~ @@ -224999,6 +247562,70 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** metadata.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~metadata.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~metadata.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/metadata.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2021 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # metadata.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński~ +** Processing line: ~~ +** Processing line: ~ module Metadata~ +** Processing line: ~ def metadata_file_path~ +** Processing line: ~ "metadata/game_metadata.txt"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_metadata~ +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +** Processing line: ~~ +** Processing line: ~ if !metadata~ +** Processing line: ~ write_blank_metadata~ +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ dev_id: dev_id.strip,~ +** Processing line: ~ dev_title: dev_title.strip,~ +** Processing line: ~ game_id: game_id.strip,~ +** Processing line: ~ game_title: game_title.strip,~ +** Processing line: ~ version: version.strip,~ +** Processing line: ~ icon: icon.strip~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def write_blank_metadata~ +** Processing line: ~ $gtk.write_file metadata_file_path, <<-S.strip~ +** Processing line: ~ #devid=myname~ +** Processing line: ~ #devtitle=My Name~ +** Processing line: ~ #gameid=mygame~ +** Processing line: ~ #gametitle=My Game~ +** Processing line: ~ #version=0.1~ +** Processing line: ~ #icon=metadata/icon.png~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** numeric.rb~ - H3 detected. - Determining if line is a header. @@ -225030,6 +247657,35 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ alias_method :lte, :<=~ ** Processing line: ~ alias_method :__original_eq_eq__, :== unless Numeric.instance_methods.include? :__original_eq_eq__~ ** Processing line: ~~ +** Processing line: ~ def to_layout_row opts = {}~ +** Processing line: ~ $layout.rect(row: self,~ +** Processing line: ~ col: opts.col || 0,~ +** Processing line: ~ w: opts.w || 0,~ +** Processing line: ~ h: opts.h || 0).y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_layout_col opts = {}~ +** Processing line: ~ $layout.rect(row: 0,~ +** Processing line: ~ col: self,~ +** Processing line: ~ w: opts.w || 0,~ +** Processing line: ~ h: opts.h || 0).x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_layout_w~ +** Processing line: ~ $layout.rect(row: 0, col: 0, w: self, h: 1).w~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_layout_h~ +** Processing line: ~ $layout.rect(row: 0, col: 0, w: 1, h: self).h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_layout_row_from_bottom opts = {}~ +** Processing line: ~ ($layout.row_max_index - self).to_layout_row opts~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_layout_col_from_right opts = {}~ +** Processing line: ~ ($layout.col_max_index - self).to_layout_col opts~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ # Converts a numeric value representing seconds into frames.~ ** Processing line: ~ #~ @@ -225045,10 +247701,26 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ self / 2.0~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def third~ +** Processing line: ~ self / 3.0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def quarter~ +** Processing line: ~ self / 4.0~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def to_byte~ ** Processing line: ~ clamp(0, 255).to_i~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def clamp *opts~ +** Processing line: ~ min = (opts.at 0)~ +** Processing line: ~ max = (opts.at 1)~ +** Processing line: ~ return min if min && self < min~ +** Processing line: ~ return max if max && self > max~ +** Processing line: ~ return self~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def clamp_wrap min, max~ ** Processing line: ~ max, min = min, max if min > max~ ** Processing line: ~ return self if self >= min && self <= max~ @@ -225273,7 +247945,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ self * Math::PI.fdiv(180)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Converts a number representing an angle in radians to degress.~ +** Processing line: ~ # Converts a number representing an angle in radians to degrees.~ ** Processing line: ~ #~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def to_degrees~ @@ -225290,21 +247962,21 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Returns a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns a normal vector for a number that represents an angle in degrees.~ ** Processing line: ~ #~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def vector max_value = 1~ ** Processing line: ~ [vector_x(max_value), vector_y(max_value)]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degrees.~ ** Processing line: ~ #~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def vector_y max_value = 1~ ** Processing line: ~ max_value * Math.sin(self.to_radians)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degress.~ +** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degrees.~ ** Processing line: ~ #~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def vector_x max_value = 1~ @@ -225331,6 +248003,18 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ (self % n) == 0~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def multiply n~ +** Processing line: ~ self * n~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def fmult n~ +** Processing line: ~ self * n.to_f~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def imult n~ +** Processing line: ~ (self * n).to_i~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def mult n~ ** Processing line: ~ self * n~ ** Processing line: ~ end~ @@ -225432,32 +248116,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ (0..self).to_a~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def >= other~ -** Processing line: ~ return false if !other~ -** Processing line: ~ return gte other~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def > other~ -** Processing line: ~ return false if !other~ -** Processing line: ~ return gt other~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def <= other~ -** Processing line: ~ return false if !other~ -** Processing line: ~ return lte other~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def < other~ -** Processing line: ~ return false if !other~ -** Processing line: ~ return gt other~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def == other~ -** Processing line: ~ return true if __original_eq_eq__ other~ -** Processing line: ~ return __original_eq_eq__ other.entity_id if other.is_a? OpenEntity~ -** Processing line: ~ return false~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ # @gtk~ ** Processing line: ~ def map~ ** Processing line: ~ unless block_given?~ @@ -225543,34 +248201,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def - other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def + other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def * other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def / other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def serialize~ ** Processing line: ~ self~ ** Processing line: ~ end~ @@ -225596,6 +248226,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def self.clamp n, min, max~ ** Processing line: ~ n.clamp min, max~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mid? l, r~ +** Processing line: ~ (between? l, r) || (between? r, l)~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ class Fixnum~ @@ -225621,40 +248255,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ return !even?~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def + other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def * other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def / other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def - other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def == other~ -** Processing line: ~ return true if __original_eq_eq__ other~ -** Processing line: ~ return __original_eq_eq__ other.entity_id if other.is_a? GTK::OpenEntity~ -** Processing line: ~ return false~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ # Returns `-1` if the number is less than `0`. `+1` if the number~ ** Processing line: ~ # is greater than `0`. Returns `0` if the number is equal to `0`.~ ** Processing line: ~ #~ @@ -225710,34 +248310,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__~ ** Processing line: ~ alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__~ ** Processing line: ~~ -** Processing line: ~ def - other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :-, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def + other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :+, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def * other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :*, e~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def / other~ -** Processing line: ~ return nil unless other~ -** Processing line: ~ super~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ __raise_arithmetic_exception__ other, :/, e~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def serialize~ ** Processing line: ~ self~ ** Processing line: ~ end~ @@ -225779,6 +248351,291 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def nan?~ ** Processing line: ~ false~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def center other~ +** Processing line: ~ (self - other).abs.fdiv(2)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** recording.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~recording.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~recording.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/recording.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # recording.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ module GTK~ +** Processing line: ~ # FIXME: Gross~ +** Processing line: ~ # @gtk~ +** Processing line: ~ class Replay~ +** Processing line: ~ # @gtk~ +** Processing line: ~ def self.start file_name = nil~ +** Processing line: ~ $recording.start_replay file_name~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # @gtk~ +** Processing line: ~ def self.stop~ +** Processing line: ~ $recording.stop_replay~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # @gtk~ +** Processing line: ~ class Recording~ +** Processing line: ~ def initialize runtime~ +** Processing line: ~ @runtime = runtime~ +** Processing line: ~ @tick_count = 0~ +** Processing line: ~ @global_input_order = 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ @tick_count += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def start_recording seed_number = nil~ +** Processing line: ~ if !seed_number~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ To start recording, you must provide an integer value to~ +** Processing line: ~ seed random number generation.~ +** Processing line: ~ S~ +** Processing line: ~ $console.set_command "$recording.start SEED_NUMBER"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if @is_recording~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ You are already recording, first cancel (or stop) the current recording.~ +** Processing line: ~ S~ +** Processing line: ~ $console.set_command "$recording.cancel"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if @is_replaying~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ You are currently replaying a recording, first stop the replay.~ +** Processing line: ~ S~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ log_info <<-S~ +** Processing line: ~ Recording has begun with RNG seed value set to #{seed_number}.~ +** Processing line: ~ To stop recording use stop_recording(filename).~ +** Processing line: ~ The recording will stop without saving a file if a filename is nil.~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ $console.set_command "$recording.stop 'replay.txt'"~ +** Processing line: ~ @runtime.__reset__~ +** Processing line: ~ @seed_number = seed_number~ +** Processing line: ~ @runtime.set_rng seed_number~ +** Processing line: ~~ +** Processing line: ~ @tick_count = 0~ +** Processing line: ~ @global_input_order = 1~ +** Processing line: ~ @is_recording = true~ +** Processing line: ~ @input_history = []~ +** Processing line: ~ @runtime.notify! "Recording started. When completed, open the console to save it using $recording.stop FILE_NAME (or cancel).", 300~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # @gtk~ +** Processing line: ~ def start seed_number = nil~ +** Processing line: ~ start_recording seed_number~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def is_replaying?~ +** Processing line: ~ @is_replaying~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def is_recording?~ +** Processing line: ~ @is_recording~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # @gtk~ +** Processing line: ~ def stop file_name = nil~ +** Processing line: ~ stop_recording file_name~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # @gtk~ +** Processing line: ~ def cancel~ +** Processing line: ~ stop_recording_core~ +** Processing line: ~ @runtime.notify! "Recording cancelled."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stop_recording file_name = nil~ +** Processing line: ~ if !file_name~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ To please specify a file name when calling:~ +** Processing line: ~ $recording.stop FILE_NAME~ +** Processing line: ~~ +** Processing line: ~ If you do NOT want to save the recording, call:~ +** Processing line: ~ $recording.cancel~ +** Processing line: ~ S~ +** Processing line: ~ $console.set_command "$recording.stop 'replay.txt'"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if !@is_recording~ +** Processing line: ~ log_info "You are not currently recording. Use start_recording(seed_number) to start recording."~ +** Processing line: ~ $console.set_command "$recording.start"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if file_name~ +** Processing line: ~ text = "replay_version 2.0\n"~ +** Processing line: ~ text << "stopped_at #{@tick_count}\n"~ +** Processing line: ~ text << "seed #{@seed_number}\n"~ +** Processing line: ~ text << "recorded_at #{Time.now.to_s}\n"~ +** Processing line: ~ @input_history.each do |items|~ +** Processing line: ~ text << "#{items}\n"~ +** Processing line: ~ end~ +** Processing line: ~ @runtime.write_file file_name, text~ +** Processing line: ~ @runtime.write_file 'last_replay.txt', text~ +** Processing line: ~ log_info "The recording has been saved successfully at #{file_name}. You can use start_replay(\"#{file_name}\") to replay the recording."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $console.set_command "$replay.start '#{file_name}'"~ +** Processing line: ~ stop_recording_core~ +** Processing line: ~ @runtime.notify! "Recording saved to #{file_name}. To replay it: $replay.start \"#{file_name}\"."~ +** Processing line: ~ log_info "You can run the replay later on startup using: ./dragonruby mygame --replay #{@replay_file_name}"~ +** Processing line: ~ nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stop_recording_core~ +** Processing line: ~ @is_recording = false~ +** Processing line: ~ @input_history = nil~ +** Processing line: ~ @last_history = nil~ +** Processing line: ~ @runtime.__reset__~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def start_replay file_name = nil~ +** Processing line: ~ if !file_name~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ Please provide a file name to $recording.start.~ +** Processing line: ~ S~ +** Processing line: ~ $console.set_command "$replay.start 'replay.txt'"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ text = @runtime.read_file file_name~ +** Processing line: ~ return false unless text~ +** Processing line: ~~ +** Processing line: ~ if text.each_line.first.strip != "replay_version 2.0"~ +** Processing line: ~ raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ @replay_file_name = file_name~ +** Processing line: ~~ +** Processing line: ~ $replay_data = { input_history: { } }~ +** Processing line: ~ text.each_line do |l|~ +** Processing line: ~ if l.strip.length == 0~ +** Processing line: ~ next~ +** Processing line: ~ elsif l.start_with? 'replay_version'~ +** Processing line: ~ next~ +** Processing line: ~ elsif l.start_with? 'seed'~ +** Processing line: ~ $replay_data[:seed] = l.split(' ').last.to_i~ +** Processing line: ~ elsif l.start_with? 'stopped_at'~ +** Processing line: ~ $replay_data[:stopped_at] = l.split(' ').last.to_i~ +** Processing line: ~ elsif l.start_with? 'recorded_at'~ +** Processing line: ~ $replay_data[:recorded_at] = l.split(' ')[1..-1].join(' ')~ +** Processing line: ~ elsif l.start_with? '['~ +** Processing line: ~ name, value_1, value_2, value_count, id, tick_count = l.strip.gsub('[', '').gsub(']', '').split(',')~ +** Processing line: ~ $replay_data[:input_history][tick_count.to_i] ||= []~ +** Processing line: ~ $replay_data[:input_history][tick_count.to_i] << {~ +** Processing line: ~ id: id.to_i,~ +** Processing line: ~ name: name.gsub(':', '').to_sym,~ +** Processing line: ~ value_1: value_1.to_f,~ +** Processing line: ~ value_2: value_2.to_f,~ +** Processing line: ~ value_count: value_count.to_i~ +** Processing line: ~ }~ +** Processing line: ~ else~ +** Processing line: ~ raise "Replay data seems corrupt. I don't know how to parse #{l}."~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $replay_data[:input_history].keys.each do |key|~ +** Processing line: ~ $replay_data[:input_history][key] = $replay_data[:input_history][key].sort_by {|input| input[:id]}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ @runtime.__reset__~ +** Processing line: ~ @runtime.set_rng $replay_data[:seed]~ +** Processing line: ~ @tick_count = 0~ +** Processing line: ~ @is_replaying = true~ +** Processing line: ~ log_info "Replay has been started."~ +** Processing line: ~ @runtime.notify! "Replay started [#{@replay_file_name}]."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stop_replay notification_message = "Replay has been stopped."~ +** Processing line: ~ if !is_replaying?~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ No replay is currently running. Call $replay.start FILE_NAME to start a replay.~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ $console.set_command "$replay.start 'replay.txt'"~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~ log_info notification_message~ +** Processing line: ~ @is_replaying = false~ +** Processing line: ~ $replay_data = nil~ +** Processing line: ~ @tick_count = 0~ +** Processing line: ~ @global_input_order = 1~ +** Processing line: ~ $console.set_command_silent "$replay.start '#{@replay_file_name}'"~ +** Processing line: ~ @runtime.__reset__~ +** Processing line: ~ @runtime.notify! notification_message~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def record_input_history name, value_1, value_2, value_count, clear_cache = false~ +** Processing line: ~ return if @is_replaying~ +** Processing line: ~ return unless @is_recording~ +** Processing line: ~ @input_history << [name, value_1, value_2, value_count, @global_input_order, @tick_count]~ +** Processing line: ~ @global_input_order += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stage_replay_values~ +** Processing line: ~ return unless @is_replaying~ +** Processing line: ~ return unless $replay_data~ +** Processing line: ~~ +** Processing line: ~ if $replay_data[:stopped_at] <= @tick_count~ +** Processing line: ~ stop_replay "Replay completed [#{@replay_file_name}]. To rerun, bring up the Console and press enter."~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ inputs_this_tick = $replay_data[:input_history][@tick_count]~ +** Processing line: ~~ +** Processing line: ~ if @tick_count.zmod? 60~ +** Processing line: ~ log_info "Replay ends in #{($replay_data[:stopped_at] - @tick_count).idiv 60} second(s)."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return unless inputs_this_tick~ +** Processing line: ~ inputs_this_tick.each do |v|~ +** Processing line: ~ args = []~ +** Processing line: ~ args << v[:value_1] if v[:value_count] >= 1~ +** Processing line: ~ args << v[:value_2] if v[:value_count] >= 2~ +** Processing line: ~ args << :replay~ +** Processing line: ~ $gtk.send v[:name], *args~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ @@ -225850,7 +248707,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def local_state~ ** Processing line: ~ @local_state ||= OpenEntity.new~ ** Processing line: ~ @local_state.hotload_client ||= @local_state.new_entity(:hotload_client,~ -** Processing line: ~ notes: "This enitity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.",~ +** Processing line: ~ notes: "This entity is used by DragonRuby Game Toolkit to provide you hotloading on remote machines.",~ ** Processing line: ~ changes: { },~ ** Processing line: ~ changes_queue: [],~ ** Processing line: ~ reloaded_files_times: [])~ @@ -226015,6 +248872,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/runtime/autocomplete.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # autocomplete.rb has been released under MIT (*only this file*).~ @@ -226041,7 +248899,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ sub_index = index - previous_line[:sum]~ ** Processing line: ~ word = (cursor_line[:line][0..sub_index - 1]).strip~ ** Processing line: ~ token = (word.split " ")[-1]~ -** Processing line: ~ dots = (token.split ".")~ +** Processing line: ~ dots = (token.split ".").flat_map { |s| s.split "[" }.flat_map { |s| s.split "]" }.flat_map { |s| s.split "(" }.flat_map { |s| s.split ")" }~ ** Processing line: ~ dot = dots[-1]~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -226062,6 +248920,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ ignores ||= []~ ** Processing line: ~ ignores = [ignores].flatten~ ** Processing line: ~ keys = keys.map { |k| k.to_s }~ +** Processing line: ~ keys = keys.reject { |k| k.include? '"' }~ +** Processing line: ~ .reject { |k| k.start_with? "'" }~ +** Processing line: ~ .reject { |k| k.include? "," }~ +** Processing line: ~ .reject { |k| k.start_with? "#" }~ ** Processing line: ~ others = ["def", "end"] +~ ** Processing line: ~ [ :entity_keys_by_ref,~ ** Processing line: ~ :entity_name,~ @@ -226119,6 +248981,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ return autocomplete_filter_methods lookup_result.call if lookup_result~ ** Processing line: ~~ +** Processing line: ~ if dot[0].upcase == dot[0] && (Object.const_defined? dot.to_sym)~ +** Processing line: ~ return (Object.const_get dot.to_sym).autocomplete_methods~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ start_collecting = false~ ** Processing line: ~ dots_after_state = dots.find_all do |s|~ ** Processing line: ~ if s == "state"~ @@ -226134,10 +249000,16 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ target = target.as_hash[k.to_sym] if target.respond_to? :as_hash~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return autocomplete_filter_methods target.as_hash.keys~ +** Processing line: ~ if target.respond_to? :as_hash~ +** Processing line: ~ return autocomplete_filter_methods target.as_hash.keys~ +** Processing line: ~ else~ +** Processing line: ~ return autocomplete_filter_methods target.autocomplete_methods~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~ text = text.each_line.reject { |l| l.strip.start_with? "#" }.join "\n"~ +** Processing line: ~ text = text.each_line.map { |l| l.split("#").first }.join "\n"~ ** Processing line: ~ text.gsub!("[", " ")~ ** Processing line: ~ text.gsub!("]", " ")~ ** Processing line: ~ text.gsub!("(", " ")~ @@ -226156,167 +249028,187 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~*** runtime/draw.rb~ +** Processing line: ~*** runtime/benchmark.rb~ - H3 detected. - Determining if line is a header. - Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~runtime/draw.rb~ +- Formatting line: ~runtime/benchmark.rb~ - Line's tilde count is: 0 - Line contains link marker: false - Determining if line is a header. - Line contains ~*** ~... gsub-ing empty string -- Formatting line: ~runtime/draw.rb~ +- Formatting line: ~runtime/benchmark.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ./dragon/runtime/draw.rb~ +** Processing line: ~ # ./dragon/runtime/benchmark.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ -** Processing line: ~ # draw.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # benchmark.rb has been released under MIT (*only this file*).~ ** Processing line: ~~ ** Processing line: ~ module GTK~ ** Processing line: ~ class Runtime~ -** Processing line: ~ module Draw~ -** Processing line: ~ def primitives pass~ -** Processing line: ~ if $top_level.respond_to? :primitives_override~ -** Processing line: ~ return $top_level.tick_render @args, pass~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Don't change this draw order unless you understand~ -** Processing line: ~ # the implications.~ -** Processing line: ~~ -** Processing line: ~ # pass.solids.each { |s| draw_solid s }~ -** Processing line: ~ # while loops are faster than each with block~ +** Processing line: ~ module Benchmark~ +** Processing line: ~ def benchmark_single iterations, name, proc~ +** Processing line: ~ log <<-S~ +** Processing line: ~ ** Invoking :#{name}...~ +** Processing line: ~ S~ ** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.solids.length~ -** Processing line: ~ while idx < pass.solids.length~ -** Processing line: ~ draw_solid (pass.solids.at idx) # accessing an array using .value instead of [] is faster~ +** Processing line: ~ r = nil~ +** Processing line: ~ time_start = Time.now~ +** Processing line: ~ while idx < iterations~ +** Processing line: ~ r = proc.call~ ** Processing line: ~ idx += 1~ ** Processing line: ~ end~ +** Processing line: ~ result = (Time.now - time_start).round 3~ ** Processing line: ~~ -** Processing line: ~ # pass.static_solids.each { |s| draw_solid s }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_solids.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_solid (pass.static_solids.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ { name: name,~ +** Processing line: ~ time: result,~ +** Processing line: ~ time_ms: (result * 1000).to_i }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.sprites.each { |s| draw_sprite s }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.sprites.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_sprite (pass.sprites.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ def benchmark opts = {}~ +** Processing line: ~ iterations = opts.iterations~ ** Processing line: ~~ -** Processing line: ~ # pass.static_sprites.each { |s| draw_sprite s }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_sprites.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_sprite (pass.static_sprites.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * BENCHMARK: Started~ +** Processing line: ~ ** Caller: #{(caller || []).first}~ +** Processing line: ~ ** Iterations: #{iterations}~ +** Processing line: ~ S~ +** Processing line: ~ procs = opts.find_all { |k, v| v.respond_to? :call }~ +** Processing line: ~~ +** Processing line: ~ times = procs.map do |(name, proc)|~ +** Processing line: ~ benchmark_single iterations, name, proc~ +** Processing line: ~ end.sort_by { |r| r.time }~ +** Processing line: ~~ +** Processing line: ~ first_place = times.first~ +** Processing line: ~ second_place = times.second || first_place~ +** Processing line: ~~ +** Processing line: ~ times = times.map do |candidate|~ +** Processing line: ~ average_time = first_place.time~ +** Processing line: ~ .add(candidate.time)~ +** Processing line: ~ .abs~ +** Processing line: ~ .fdiv(2)~ +** Processing line: ~~ +** Processing line: ~ difference_percentage = 0~ +** Processing line: ~ if average_time == 0~ +** Processing line: ~ difference_percentage = 0~ +** Processing line: ~ else~ +** Processing line: ~ difference_percentage = first_place.time~ +** Processing line: ~ .subtract(candidate.time)~ +** Processing line: ~ .abs~ +** Processing line: ~ .fdiv(average_time)~ +** Processing line: ~ .imult(100)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.primitives.each { |p| draw_primitive p }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.primitives.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.primitives.at idx)~ -** Processing line: ~ idx += 1~ +** Processing line: ~ difference_time = ((first_place.time - candidate.time) * 1000).round~ +** Processing line: ~ candidate.merge(difference_percentage: difference_percentage,~ +** Processing line: ~ difference_time: difference_time)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.static_primitives.each { |p| draw_primitive p }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_primitives.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.static_primitives.at idx)~ -** Processing line: ~ idx += 1~ +** Processing line: ~ too_small_to_measure = false~ +** Processing line: ~ if (first_place.time + second_place.time) == 0~ +** Processing line: ~ too_small_to_measure = true~ +** Processing line: ~ difference_percentage = 0~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * BENCHMARK: Average time for experiments were too small. Increase the number of iterations.~ +** Processing line: ~ S~ +** Processing line: ~ else~ +** Processing line: ~ difference_percentage = (((first_place.time - second_place.time).abs.fdiv((first_place.time + second_place.time).abs.fdiv(2))) * 100).round~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.labels.each { |l| draw_label l }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.labels.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_label (pass.labels.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ difference_time = first_place.time.-(second_place.time).*(1000).abs.round~ ** Processing line: ~~ -** Processing line: ~ # pass.static_labels.each { |l| draw_label l }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_labels.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_label (pass.static_labels.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ r = {~ +** Processing line: ~ iterations: iterations,~ +** Processing line: ~ first_place: first_place,~ +** Processing line: ~ second_place: second_place,~ +** Processing line: ~ difference_time: difference_time,~ +** Processing line: ~ difference_percentage: difference_percentage,~ +** Processing line: ~ times: times,~ +** Processing line: ~ too_small_to_measure: too_small_to_measure~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ # pass.lines.each { |l| draw_line l }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.lines.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_line (pass.lines.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ log_message = []~ +** Processing line: ~ only_one_result = first_place.name == second_place.name~ ** Processing line: ~~ -** Processing line: ~ # pass.static_lines.each { |l| draw_line l }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_lines.length~ -** Processing line: ~ while idx < pass.static_lines.length~ -** Processing line: ~ draw_line (pass.static_lines.at idx)~ -** Processing line: ~ idx += 1~ +** Processing line: ~ if only_one_result~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * BENCHMARK: #{r.first_place.name} completed in #{r.first_place.time_ms}ms."~ +** Processing line: ~ S~ +** Processing line: ~ else~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * BENCHMARK: #{r.message}~ +** Processing line: ~ ** Fastest: #{r.first_place.name.inspect}~ +** Processing line: ~ ** Second: #{r.second_place.name.inspect}~ +** Processing line: ~ ** Margin: #{r.difference_percentage}% (#{r.difference_time.abs}ms) #{r.first_place.time_ms}ms vs #{r.second_place.time_ms}ms.~ +** Processing line: ~ ** Times:~ +** Processing line: ~ #{r.times.map { |t| "*** #{t.name}: #{t.time_ms}ms (#{t.difference_percentage}% #{t.difference_time.abs}ms)." }.join("\n")}~ +** Processing line: ~ S~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.borders.each { |b| draw_border b }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.borders.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_border (pass.borders.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~ r~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.static_borders.each { |b| draw_border b }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_borders.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_border (pass.static_borders.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ if !$gtk.production~ -** Processing line: ~ # pass.debug.each { |r| draw_primitive r }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.debug.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.debug.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.static_debug.each { |r| draw_primitive r }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_debug.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.static_debug.at idx)~ -** Processing line: ~ idx += 1~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~*** runtime/draw.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~runtime/draw.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~runtime/draw.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # pass.reserved.each { |r| draw_primitive r }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.reserved.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.reserved.at idx)~ -** Processing line: ~ idx += 1~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/runtime/draw.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # draw.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ module GTK~ +** Processing line: ~ class Runtime~ +** Processing line: ~ module Draw~ +** Processing line: ~ def primitives pass~ +** Processing line: ~ if $top_level.respond_to? :primitives_override~ +** Processing line: ~ return $top_level.tick_render @args, pass~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # pass.static_reserved.each { |r| draw_primitive r }~ -** Processing line: ~ idx = 0~ -** Processing line: ~ length = pass.static_reserved.length~ -** Processing line: ~ while idx < length~ -** Processing line: ~ draw_primitive (pass.static_reserved.at idx)~ -** Processing line: ~ idx += 1~ +** Processing line: ~ fn.each_send pass.solids, self, :draw_solid~ +** Processing line: ~ fn.each_send pass.static_solids, self, :draw_solid~ +** Processing line: ~ fn.each_send pass.sprites, self, :draw_sprite~ +** Processing line: ~ fn.each_send pass.static_sprites, self, :draw_sprite~ +** Processing line: ~ fn.each_send pass.primitives, self, :draw_primitive~ +** Processing line: ~ fn.each_send pass.static_primitives, self, :draw_primitive~ +** Processing line: ~ fn.each_send pass.labels, self, :draw_label~ +** Processing line: ~ fn.each_send pass.static_labels, self, :draw_label~ +** Processing line: ~ fn.each_send pass.lines, self, :draw_line~ +** Processing line: ~ fn.each_send pass.static_lines, self, :draw_line~ +** Processing line: ~ fn.each_send pass.borders, self, :draw_border~ +** Processing line: ~ fn.each_send pass.static_borders, self, :draw_border~ +** Processing line: ~~ +** Processing line: ~ if !self.production~ +** Processing line: ~ fn.each_send pass.debug, self, :draw_primitive~ +** Processing line: ~ fn.each_send pass.static_debug, self, :draw_primitive~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ fn.each_send pass.reserved, self, :draw_primitive~ +** Processing line: ~ fn.each_send pass.static_reserved, self, :draw_primitive~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ pause!~ ** Processing line: ~ pretty_print_exception_and_export! e~ @@ -226327,7 +249219,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if s.respond_to? :draw_override~ ** Processing line: ~ s.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_solid s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ +** Processing line: ~ @ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h,~ +** Processing line: ~ s.r, s.g, s.b, s.a,~ +** Processing line: ~ (s.blendmode_enum || 1)~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise_conversion_for_rendering_failed s, e, :solid~ @@ -226338,14 +249233,16 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if s.respond_to? :draw_override~ ** Processing line: ~ s.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_sprite_3 s.x, s.y, s.w, s.h,~ -** Processing line: ~ s.path.s_or_default,~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ +** Processing line: ~ @ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h,~ +** Processing line: ~ (s.path || '').to_s,~ ** Processing line: ~ s.angle,~ ** Processing line: ~ s.a, s.r, s.g, s.b,~ ** Processing line: ~ s.tile_x, s.tile_y, s.tile_w, s.tile_h,~ ** Processing line: ~ !!s.flip_horizontally, !!s.flip_vertically,~ ** Processing line: ~ s.angle_anchor_x, s.angle_anchor_y,~ -** Processing line: ~ s.source_x, s.source_y, s.source_w, s.source_h~ +** Processing line: ~ s.source_x, s.source_y, s.source_w, s.source_h,~ +** Processing line: ~ (s.blendmode_enum || 1)~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise_conversion_for_rendering_failed s, e, :sprite~ @@ -226356,7 +249253,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if s.respond_to? :draw_override~ ** Processing line: ~ s.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_screenshot s.path.s_or_default,~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ +** Processing line: ~ @ffi_draw.draw_screenshot (s.path || '').to_s,~ ** Processing line: ~ s.x, s.y, s.w, s.h,~ ** Processing line: ~ s.angle,~ ** Processing line: ~ s.a, s.r, s.g, s.b,~ @@ -226374,10 +249272,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if l.respond_to? :draw_override~ ** Processing line: ~ l.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_label l.x, l.y, l.text.s_or_default,~ -** Processing line: ~ l.size_enum, l.alignment_enum,~ -** Processing line: ~ l.r, l.g, l.b, l.a,~ -** Processing line: ~ l.font.s_or_default(nil)~ +** Processing line: ~ l = l.as_hash if l.is_a? OpenEntity~ +** Processing line: ~ @ffi_draw.draw_label_3 l.x, l.y,~ +** Processing line: ~ (l.text || '').to_s,~ +** Processing line: ~ l.size_enum, l.alignment_enum,~ +** Processing line: ~ l.r, l.g, l.b, l.a,~ +** Processing line: ~ l.font,~ +** Processing line: ~ (l.vertical_alignment_enum || 2),~ +** Processing line: ~ (l.blendmode_enum || 1)~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise_conversion_for_rendering_failed l, e, :label~ @@ -226388,7 +249290,22 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if l.respond_to? :draw_override~ ** Processing line: ~ l.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_line l.x, l.y, l.x2, l.y2, l.r, l.g, l.b, l.a~ +** Processing line: ~ l = l.as_hash if l.is_a? OpenEntity~ +** Processing line: ~ if l.x2~ +** Processing line: ~ @ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2,~ +** Processing line: ~ l.r, l.g, l.b, l.a,~ +** Processing line: ~ (l.blendmode_enum || 1)~ +** Processing line: ~ else~ +** Processing line: ~ w = l.w || 0~ +** Processing line: ~ w = 1 if w == 0~ +** Processing line: ~ h = l.h || 0~ +** Processing line: ~ h = 1 if h == 0~ +** Processing line: ~ @ffi_draw.draw_line_2 l.x, l.y,~ +** Processing line: ~ l.x + w - 1,~ +** Processing line: ~ l.y + h - 1,~ +** Processing line: ~ l.r, l.g, l.b, l.a,~ +** Processing line: ~ (l.blendmode_enum || 1)~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise_conversion_for_rendering_failed l, e, :line~ @@ -226399,7 +249316,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if s.respond_to? :draw_override~ ** Processing line: ~ s.draw_override @ffi_draw~ ** Processing line: ~ else~ -** Processing line: ~ @ffi_draw.draw_border s.x, s.y, s.w, s.h, s.r, s.g, s.b, s.a~ +** Processing line: ~ s = s.as_hash if s.is_a? OpenEntity~ +** Processing line: ~ @ffi_draw.draw_border_2 s.x, s.y, s.w, s.h,~ +** Processing line: ~ s.r, s.g, s.b, s.a,~ +** Processing line: ~ (s.blendmode_enum || 1)~ ** Processing line: ~ end~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ raise_conversion_for_rendering_failed s, e, :border~ @@ -226419,7 +249339,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ pause!~ ** Processing line: ~ pretty_print_exception_and_export! e~ ** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -226444,6 +249363,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/runtime/framerate.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # framerate.rb has been released under MIT (*only this file*).~ @@ -226479,13 +249399,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if @tick_speed_count > 60 * 2~ ** Processing line: ~ if framerate_below_threshold?~ ** Processing line: ~ @last_framerate = current_framerate~ -** Processing line: ~ if [email protected]?~ -** Processing line: ~ if !@framerate_important_notification_happened~ -** Processing line: ~ log_important framerate_warning_message~ -** Processing line: ~ else~ -** Processing line: ~ log framerate_warning_message~ -** Processing line: ~ end~ -** Processing line: ~ @framerate_important_notification_happened = true~ +** Processing line: ~ if [email protected]? && [email protected]_replaying?~ +** Processing line: ~ log framerate_warning_message~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -226548,6 +249463,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/runtime/framerate_diagnostics.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # framerate_diagnostics.rb has been released under MIT (*only this file*).~ @@ -226665,7 +249581,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~~ ** Processing line: ~ def framerate_diagnostics_primitives~ ** Processing line: ~ [~ -** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid,~ +** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid!,~ ** Processing line: ~ {~ ** Processing line: ~ x: 5,~ ** Processing line: ~ y: 5.from_top,~ @@ -226674,7 +249590,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 255,~ ** Processing line: ~ b: 255,~ ** Processing line: ~ size_enum: -2~ -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ ** Processing line: ~ {~ ** Processing line: ~ x: 5,~ ** Processing line: ~ y: 20.from_top,~ @@ -226683,7 +249599,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 255,~ ** Processing line: ~ b: 255,~ ** Processing line: ~ size_enum: -2~ -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ ** Processing line: ~ {~ ** Processing line: ~ x: 5,~ ** Processing line: ~ y: 35.from_top,~ @@ -226692,7 +249608,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 255,~ ** Processing line: ~ b: 255,~ ** Processing line: ~ size_enum: -2~ -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ ** Processing line: ~ {~ ** Processing line: ~ x: 5,~ ** Processing line: ~ y: 50.from_top,~ @@ -226701,7 +249617,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 255,~ ** Processing line: ~ b: 255,~ ** Processing line: ~ size_enum: -2~ -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ ** Processing line: ~ {~ ** Processing line: ~ x: 5,~ ** Processing line: ~ y: 65.from_top,~ @@ -226710,7 +249626,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ g: 255,~ ** Processing line: ~ b: 255,~ ** Processing line: ~ size_enum: -2~ -** Processing line: ~ }.label,~ +** Processing line: ~ }.label!,~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -226750,7 +249666,14 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ def hotload_init~ ** Processing line: ~ @hotload_if_needed = 0~ ** Processing line: ~ @mailbox_if_needed = 0~ +** Processing line: ~~ +** Processing line: ~ # schema for file_mtimes~ +** Processing line: ~ # { FILE_PATH: { current: (Time as Fixnum),~ +** Processing line: ~ # last: (Time as Fixnum) },~ +** Processing line: ~ # FILE_PATH: { current: (Time as Fixnum),~ +** Processing line: ~ # last: (Time as Fixnum) } }~ ** Processing line: ~ @file_mtimes = { }~ +** Processing line: ~~ ** Processing line: ~ @suppress_mailbox = true~ ** Processing line: ~ files_to_reload.each { |f| init_mtimes f }~ ** Processing line: ~ init_mtimes 'app/mailbox.rb'~ @@ -226788,6 +249711,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ 'dragon/symbol.rb',~ ** Processing line: ~ 'dragon/numeric_deprecated.rb',~ ** Processing line: ~ 'dragon/numeric.rb',~ +** Processing line: ~ 'dragon/hash_deprecated.rb',~ ** Processing line: ~ 'dragon/hash.rb',~ ** Processing line: ~ 'dragon/outputs_deprecated.rb',~ ** Processing line: ~ 'dragon/array_docs.rb',~ @@ -226820,6 +249744,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ 'dragon/trace.rb',~ ** Processing line: ~ 'dragon/readme_docs.rb',~ ** Processing line: ~ 'dragon/hotload_client.rb',~ +** Processing line: ~ 'dragon/wizards.rb',~ ** Processing line: ~ 'dragon/ios_wizard.rb',~ ** Processing line: ~ 'dragon/itch_wizard.rb',~ ** Processing line: ~ ] + core_files_to_reload + @required_files~ @@ -226838,10 +249763,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def init_mtimes file~ -** Processing line: ~ current_key = "current_#{file}".to_sym~ -** Processing line: ~ last_key = "last_#{file}".to_sym~ -** Processing line: ~ @file_mtimes[current_key] ||= @ffi_file.mtime(file)~ -** Processing line: ~ @file_mtimes[last_key] ||= @ffi_file.mtime(file)~ +** Processing line: ~ @file_mtimes[file] ||= { current: @ffi_file.mtime(file),~ +** Processing line: ~ last: @ffi_file.mtime(file) }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def hotload_source_files~ @@ -226873,25 +249796,36 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def hotload_if_needed~ +** Processing line: ~ return if Kernel.tick_count < 0~ ** Processing line: ~ hotload_source_files~ ** Processing line: ~ check_mailbox~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def on_load_succeeded file~ -** Processing line: ~ @rcb_sender.files_reloaded << file~ -** Processing line: ~ @rcb_sender.reloaded_files << file~ +** Processing line: ~ self.files_reloaded << file~ +** Processing line: ~ self.reloaded_files << file~ ** Processing line: ~ Trace.untrace_classes!~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def reset_all_mtimes~ +** Processing line: ~ @file_mtimes.each do |file, _|~ +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ files_to_reload.each do |file, _|~ +** Processing line: ~ @file_mtimes[file] ||= {}~ +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def reload_if_needed file, force = false~ -** Processing line: ~ current_key = "current_#{file}".to_sym~ -** Processing line: ~ last_key = "last_#{file}".to_sym~ -** Processing line: ~ @file_mtimes[current_key] ||= nil~ -** Processing line: ~ @file_mtimes[last_key] ||= nil~ -** Processing line: ~ @file_mtimes[current_key] = @ffi_file.mtime(file)~ -** Processing line: ~ return if !force && @file_mtimes[last_key] == @file_mtimes[current_key]~ +** Processing line: ~ @file_mtimes[file] ||= { current: @ffi_file.mtime(file), last: @ffi_file.mtime(file) }~ +** Processing line: ~ @file_mtimes[file].current = @ffi_file.mtime(file)~ +** Processing line: ~ return if !force && @file_mtimes[file].current == @file_mtimes[file].last~ ** Processing line: ~ on_load_succeeded file if reload_ruby_file file~ -** Processing line: ~ @file_mtimes[last_key] = @file_mtimes[current_key]~ +** Processing line: ~ @file_mtimes[file].last = @file_mtimes[file].current~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -226948,6 +249882,30 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def char_byte~ +** Processing line: ~ return nil if self.length == 0~ +** Processing line: ~ c = self.each_char.first.bytes~ +** Processing line: ~ c = c.first if c.is_a? Enumerable~ +** Processing line: ~ c~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def insert_character_at index, char~ +** Processing line: ~ t = each_char.to_a~ +** Processing line: ~ t = (t.insert index, char)~ +** Processing line: ~ t.join~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def excluding_character_at index~ +** Processing line: ~ t = each_char.to_a~ +** Processing line: ~ t.delete_at index~ +** Processing line: ~ t.join~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def excluding_last_character~ +** Processing line: ~ return "" if self.length <= 1~ +** Processing line: ~ return excluding_character_at(self.length - 1)~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def end_with_bang?~ ** Processing line: ~ self[-1] == "!"~ ** Processing line: ~ end~ @@ -227180,7 +250138,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ log "#{self.failed.length} test(s) failed."~ ** Processing line: ~ self.failed.each do |h|~ ** Processing line: ~ log "**** Test name: :#{h[:m]}"~ -** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}"~ +** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}\n#{h[:e].__backtrace_to_org__}"~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -227395,6 +250353,129 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~*** tweetcart.rb~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~tweetcart.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~tweetcart.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/tweetcart.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # tweetcart.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ def $top_level.TICK &block~ +** Processing line: ~ $top_level.define_method(:tick) do |args|~ +** Processing line: ~ args.outputs[:scene].w = 160~ +** Processing line: ~ args.outputs[:scene].h = 90~ +** Processing line: ~ args.outputs[:scene].background_color = [0, 0, 0, 0]~ +** Processing line: ~ block.call args~ +** Processing line: ~ args.outputs.sprites << { x: 0, y: 0, w: 1280, h: 720, path: :scene }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def $top_level.bg! *rgb~ +** Processing line: ~ r,g,b = rgb~ +** Processing line: ~ r ||= 255~ +** Processing line: ~ g ||= r~ +** Processing line: ~ b ||= g~ +** Processing line: ~ $args.outputs.background_color = [r, g, b]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def $top_level.slds~ +** Processing line: ~ $args.outputs[:scene].sprites~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def $top_level.slds! *os~ +** Processing line: ~ if (os.first.is_a? Numeric)~ +** Processing line: ~ sld!(*os)~ +** Processing line: ~ else~ +** Processing line: ~ os.each { |o| sld!(*o) }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def $top_level.sld! *params~ +** Processing line: ~ x, y, w, h, r, g, b, a = nil~ +** Processing line: ~ if params.length == 2~ +** Processing line: ~ x, y = params~ +** Processing line: ~ elsif params.length == 3 && (params.last.is_a? Array)~ +** Processing line: ~ x = params[0]~ +** Processing line: ~ y = params[1]~ +** Processing line: ~ r, g, b, a = params[2]~ +** Processing line: ~ r ||= 255~ +** Processing line: ~ g ||= r~ +** Processing line: ~ b ||= g~ +** Processing line: ~ a ||= 255~ +** Processing line: ~ elsif params.length == 4~ +** Processing line: ~ x, y, w, h = params~ +** Processing line: ~ elsif params.length == 5 && (params.last.is_a? Array)~ +** Processing line: ~ x = params[0]~ +** Processing line: ~ y = params[1]~ +** Processing line: ~ w = params[2]~ +** Processing line: ~ h = params[3]~ +** Processing line: ~ r,g,b,a = params[4]~ +** Processing line: ~ r ||= 255~ +** Processing line: ~ g ||= r~ +** Processing line: ~ b ||= g~ +** Processing line: ~ a ||= 255~ +** Processing line: ~ elsif params.length >= 7~ +** Processing line: ~ x, y, w, h, r, g, b = params~ +** Processing line: ~ else~ +** Processing line: ~ raise "I don't know how to render #{params} with reasonable defaults."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ w ||= 1~ +** Processing line: ~ h ||= 1~ +** Processing line: ~ r ||= 255~ +** Processing line: ~ g ||= 255~ +** Processing line: ~ b ||= 255~ +** Processing line: ~ a ||= 255~ +** Processing line: ~~ +** Processing line: ~ slds << { x: x, y: y,~ +** Processing line: ~ w: w, h: h,~ +** Processing line: ~ r: r, g: g, b: b, a: a,~ +** Processing line: ~ path: :pixel }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ =begin~ +** Processing line: ~ wht = [255] * 3~ +** Processing line: ~ red = [255, 0, 0]~ +** Processing line: ~ blu = [0, 130, 255]~ +** Processing line: ~ purp = [150, 80, 255]~ +** Processing line: ~~ +** Processing line: ~ TICK {~ +** Processing line: ~ bg! 0~ +** Processing line: ~~ +** Processing line: ~ slds << [0, 0, 3, 3, 0, 255, 0, 255]~ +** Processing line: ~~ +** Processing line: ~ sld! 10, 10~ +** Processing line: ~ sld! 20, 20, 3, 2~ +** Processing line: ~ sld! 30, 30, 2, 2, red~ +** Processing line: ~ sld! 35, 35, blu~ +** Processing line: ~~ +** Processing line: ~ slds! 40, 40~ +** Processing line: ~~ +** Processing line: ~ slds! [50, 50],~ +** Processing line: ~ [60, 60, purp],~ +** Processing line: ~ [70, 70, 10, 10, wht],~ +** Processing line: ~ [80, 80, 4, 4, 255, 0, 255]~ +** Processing line: ~ }~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~*** wizards.rb~ - H3 detected. - Determining if line is a header. @@ -227411,10 +250492,45 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~#+begin_src ruby~ - PRE start detected. ** Processing line: ~ # ./dragon/wizards.rb~ +** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # wizards.rb has been released under MIT (*only this file*).~ ** Processing line: ~~ +** Processing line: ~ class Wizard~ +** Processing line: ~ def metadata_file_path~ +** Processing line: ~ "metadata/game_metadata.txt"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def get_metadata~ +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +** Processing line: ~~ +** Processing line: ~ if !metadata~ +** Processing line: ~ write_blank_metadata~ +** Processing line: ~ metadata = $gtk.read_file metadata_file_path~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ dev_id, dev_title, game_id, game_title, version, icon = *metadata.each_line.to_a~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ dev_id: dev_id.strip.gsub("#", "").gsub("devid=", ""),~ +** Processing line: ~ dev_title: dev_title.strip.gsub("#", "").gsub("devtitle=", ""),~ +** Processing line: ~ game_id: game_id.strip.gsub("#", "").gsub("gameid=", ""),~ +** Processing line: ~ game_title: game_title.strip.gsub("#", "").gsub("gametitle=", ""),~ +** Processing line: ~ version: version.strip.gsub("#", "").gsub("version=", ""),~ +** Processing line: ~ icon: icon.strip.gsub("#", "").gsub("icon=", "")~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ class WizardException < Exception~ +** Processing line: ~ attr_accessor :console_primitives~ +** Processing line: ~~ +** Processing line: ~ def initialize *console_primitives~ +** Processing line: ~ @console_primitives = console_primitives~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ module GTK~ ** Processing line: ~ class Wizards~ ** Processing line: ~ attr_accessor :ios, :itch~ |
