From 548bd9fc01cbad4ae4b65c1e9f2a542c95a3822c Mon Sep 17 00:00:00 2001 From: realtradam Date: Sat, 7 Aug 2021 14:06:57 -0400 Subject: initial test --- .gitignore | 8 ++ .rubocop.yml | 13 +++ CHANGELOG.md | 5 + Gemfile | 11 +- LICENSE.txt | 21 ++++ Rakefile | 8 ++ bin/console | 15 +++ bin/setup | 8 ++ lib/ruby2d/camera.rb | 132 +++++++++++++++++++++ lib/ruby2d/camera/triangle.rb | 102 +++++++++++++++++ lib/ruby2d/camera/version.rb | 7 ++ lib/ruby2d/camera/wrappers/circle_wrapper.rb | 47 ++++++++ lib/ruby2d/camera/wrappers/image_wrapper.rb | 73 ++++++++++++ lib/ruby2d/camera/wrappers/line_wrapper.rb | 91 +++++++++++++++ lib/ruby2d/camera/wrappers/quad_wrapper.rb | 108 ++++++++++++++++++ lib/ruby2d/camera/wrappers/rectangle_wrapper.rb | 138 ++++++++++++++++++++++ lib/ruby2d/camera/wrappers/sprite_wrapper.rb | 86 ++++++++++++++ lib/ruby2d/camera/wrappers/square_wrapper.rb | 146 ++++++++++++++++++++++++ lib/ruby2d/camera/wrappers/text_wrapper.rb | 84 ++++++++++++++ lib/ruby2d/camera/wrappers/triangle_wrapper.rb | 90 +++++++++++++++ ruby2d-camera-0.1.0.gem | Bin 0 -> 1452032 bytes ruby2d-camera.gemspec | 38 ++++++ test.rb | 10 ++ 23 files changed, 1239 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 .rubocop.yml create mode 100644 CHANGELOG.md create mode 100644 LICENSE.txt create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 lib/ruby2d/camera.rb create mode 100644 lib/ruby2d/camera/triangle.rb create mode 100644 lib/ruby2d/camera/version.rb create mode 100644 lib/ruby2d/camera/wrappers/circle_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/image_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/line_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/quad_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/rectangle_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/sprite_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/square_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/text_wrapper.rb create mode 100644 lib/ruby2d/camera/wrappers/triangle_wrapper.rb create mode 100644 ruby2d-camera-0.1.0.gem create mode 100644 ruby2d-camera.gemspec create mode 100644 test.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9106b2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..bfef2d0 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +AllCops: + TargetRubyVersion: 2.4 + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..29886ab --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## [Unreleased] + +## [0.1.0] - 2021-08-07 + +- Initial release diff --git a/Gemfile b/Gemfile index 64e3e1c..d4cf82f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,10 @@ -ruby '2.7.2' +# frozen_string_literal: true -gem 'ruby2d', '3.1.4' +source "https://rubygems.org" + +# Specify your gem's dependencies in ruby2d-camera.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "rubocop", "~> 1.7" diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..82abdd9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 realtradam + +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. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1924143 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: :rubocop diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..f814e79 --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "ruby2d/camera" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/lib/ruby2d/camera.rb b/lib/ruby2d/camera.rb new file mode 100644 index 0000000..c8f1667 --- /dev/null +++ b/lib/ruby2d/camera.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +require_relative "camera/version" +require_relative "camera/triangle" + +#Dir[File.join(__dir__, 'camera', '*.rb')].sort.each { |file| require file } + +# Handles rendering objects relative +# to a camera location +module Ruby2D + module Camera + class < 1.0" + spec.add_dependency "ruby2d", "~> 0.10" + + # For more information and examples about making a new gem, checkout our + # guide at: https://bundler.io/guides/creating_gem.html +end diff --git a/test.rb b/test.rb new file mode 100644 index 0000000..6c60c53 --- /dev/null +++ b/test.rb @@ -0,0 +1,10 @@ +require 'ruby2d' +require 'ruby2d/camera' + +@tri = Ruby2D::Camera::Triangle.new + +update do + Ruby2D::Camera.redraw +end + +show -- cgit v1.2.3