diff options
| author | Tom Black <[email protected]> | 2018-12-12 01:58:37 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-12-12 18:01:00 -0800 |
| commit | 2ca4a07d60357c3b32625a706f7411997b6258c0 (patch) | |
| tree | 732e6066c895676b08b32c537609276ec8df6b98 /test | |
| parent | 241093f3ea07255af6d36fa9e07c2a1ecb7c712f (diff) | |
| download | ruby2d-2ca4a07d60357c3b32625a706f7411997b6258c0.tar.gz ruby2d-2ca4a07d60357c3b32625a706f7411997b6258c0.zip | |
Add an interactive console
Also moves `bin/ruby2d` functionality to new `lib/ruby2d/cli` dir
Diffstat (limited to 'test')
| -rw-r--r-- | test/console.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/console.rb b/test/console.rb new file mode 100644 index 0000000..c7d29c4 --- /dev/null +++ b/test/console.rb @@ -0,0 +1,25 @@ +require 'ruby2d' + +s1 = Square.new(x: 0, y: 0, size: 100, color: 'white') +s2 = Square.new(x: 100, y: 100, size: 50, color: 'green') +c = 0.0 +switch = true + +update do + + if switch + c += 0.01 + if c > 1.0 + switch = false + end + else + c -= 0.01 + if c < 0.0 + switch = true + end + end + + s1.color = [1, 1, 1, c] +end + +show |
