diff options
| author | Amir Rajan <[email protected]> | 2020-02-27 20:14:39 -0600 |
|---|---|---|
| committer | Amir Rajan <[email protected]> | 2020-02-27 20:14:39 -0600 |
| commit | 5d0c0305854633122b3e800dd9058e93c2950eb6 (patch) | |
| tree | 0283825a7055cebd59ad1b3aff1b3dec1f2ac03c /deploy_template/mygame/documentation/99-todo.md | |
| parent | 07468bf3f309c21ea3f7fcf47195ca275177dc7f (diff) | |
| download | dragonruby-game-toolkit-contrib-5d0c0305854633122b3e800dd9058e93c2950eb6.tar.gz dragonruby-game-toolkit-contrib-5d0c0305854633122b3e800dd9058e93c2950eb6.zip | |
open sourced parts of game toolkit.
Diffstat (limited to 'deploy_template/mygame/documentation/99-todo.md')
| -rw-r--r-- | deploy_template/mygame/documentation/99-todo.md | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/deploy_template/mygame/documentation/99-todo.md b/deploy_template/mygame/documentation/99-todo.md new file mode 100644 index 0000000..39c542a --- /dev/null +++ b/deploy_template/mygame/documentation/99-todo.md @@ -0,0 +1,89 @@ +# Documentation That Needs to be Organized + +## Class macro gtk_args + +Here's how you can use the `gtk_args` class method: + +```ruby +class Game + gtk_args + attr_accessor :current_scene, :other_custom_attrs + + def tick + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.tick +end +``` + +The code above is the similar to: + +```ruby +class Game + attr_accessor :args, :grid, :state, :inputs, :outputs, :gtk, :passes, + :current_scene, :other_custom_attrs + + def tick + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.grid = args.grid + $game.state = args.state + $game.outputs = args.outputs + $game.gtk = args.gtk + $game.passes = args.passes + $game.tick +end +``` + +## Monkey patching the runtime + +You're on your own if you do this :grimacing: + +```ruby +module GTK + class Runtime + alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) + + def tick_core + __original_tick_core__ + $top_level.oh @args + $top_level.god @args + $top_level.why @args + end + end +end + +def tick args +end + +def oh args +end + +def god args +end + +def why args +end +``` + +## MP3's to Wav converstion script: + +```ruby +`ls .`.each_line.to_a.map do |l| + l = l.strip + if l.end_with? "mp3" + `ffmpeg -i #{l} -acodec pcm_s16le -ar 44100 prep-#{l.split(".")[0]}.wav` + `ffmpeg -y -i prep-#{l.split(".")[0]}.wav -f wav -bitexact -acodec pcm_s16le -ar 44100 -ac 1 #{l.split(".")[0]}.wav` + end +end +``` |
