Sha256: 7478324e8e0b9c23acf21663060113628778845661cf70b2f1f7df8bfa3458b8

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

# Ruby2D::Text

module Ruby2D
    class Texture
      attr_reader :width, :height, :texture_id

      def initialize(pixel_data, width, height)
        @pixel_data = pixel_data
        @width = width
        @height = height
        @texture_id = 0
      end

      def draw(coordinates, texture_coordinates, color)
        if @texture_id == 0
          @texture_id = ext_create(@pixel_data, @width, @height)
          @pixel_data = nil
        end

        color = [color.r, color.g, color.b, color.a]
        ext_draw(coordinates, texture_coordinates, color, @texture_id)
      end

      def delete
        ext_delete(@texture_id)
      end
    end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ruby2d-rpeck-windows-0.11.1 lib/ruby2d/texture.rb
ruby2d-0.11.1 lib/ruby2d/texture.rb
ruby2d-0.11.0 lib/ruby2d/texture.rb