summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTom Black <[email protected]>2015-10-04 20:12:32 -0400
committerTom Black <[email protected]>2015-10-04 20:12:32 -0400
commitd70e4d425eab3848226215d42b3a81b8e191de1a (patch)
tree197bd95fe7bf5a6479aceb646a8549cb1cf57183 /examples
downloadruby2d-d70e4d425eab3848226215d42b3a81b8e191de1a.tar.gz
ruby2d-d70e4d425eab3848226215d42b3a81b8e191de1a.zip
First!
Diffstat (limited to 'examples')
-rw-r--r--examples/input.rb50
-rw-r--r--examples/simple.rb13
-rw-r--r--examples/triangle.rb10
3 files changed, 73 insertions, 0 deletions
diff --git a/examples/input.rb b/examples/input.rb
new file mode 100644
index 0000000..a39a29c
--- /dev/null
+++ b/examples/input.rb
@@ -0,0 +1,50 @@
+require 'ruby2d'
+
+set width: 200, height: 100
+
+on key: 'a' do
+ puts "a pressed!"
+end
+
+show
+
+# on :mouse 'up' do
+#
+# end
+#
+# on :mouse 'down' do
+#
+# end
+#
+# on :key 'a' do
+#
+# end
+#
+# on :key_down 'a' do
+#
+# end
+#
+# on :mouse 'click' do
+#
+# end
+#
+# on :mouse 'right' do
+#
+# end
+#
+# on :mouse 'left' do
+#
+# end
+#
+#
+# on key: 'any' do
+#
+# end
+#
+# on key: 'a' do
+#
+# end
+#
+# on key: 'shift' do
+#
+# end
diff --git a/examples/simple.rb b/examples/simple.rb
new file mode 100644
index 0000000..ca8e99f
--- /dev/null
+++ b/examples/simple.rb
@@ -0,0 +1,13 @@
+require 'ruby2d'
+
+# Set the window size
+set width: 300, height: 200
+
+# Create a new shape
+s = Square.new
+
+# Give it some color
+s.color = 'red'
+
+# Show the window
+show
diff --git a/examples/triangle.rb b/examples/triangle.rb
new file mode 100644
index 0000000..71f0bbf
--- /dev/null
+++ b/examples/triangle.rb
@@ -0,0 +1,10 @@
+require 'ruby2d'
+
+Triangle.new(320, 50, 540, 430, 100, 430,
+[
+ [1.0, 0, 0, 1.0],
+ [0, 1.0, 0, 1.0],
+ [0, 0, 1.0, 1.0]
+])
+
+show