Sha256: 80b1bf26770d9be08a8d16db9beee6a024bd597806c87a1b23715f2d68dc38b8

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
# License: Ruby License

module SGL
  def background(*a)	$__a__.background(*a)	end
  def backgroundHSV(*a)	$__a__.backgroundHSV(*a)	end
  def color(*a)		$__a__.color(*a)	end
  def colorHSV(*a)	$__a__.colorHSV(*a)	end

  class Application
    def initialize_color
      @bg_color = @cur_color = nil
      @rgb = ColorTranslatorRGB.new(100, 100, 100, 100)
      @hsv = ColorTranslatorHSV.new(100, 100, 100, 100)
    end
    private :initialize_color

    attr_reader :cur_color # for test

    def background(x, y = nil, z = nil, a = nil)
      GL.ClearColor(*@rgb.norm(x, y, z, a))
      clear
    end

    def backgroundHSV(x, y = nil, z = nil, a = nil)
      GL.ClearColor(*@hsv.norm(x, y, z, a))
      clear
    end

    def clear
      GL.Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT)
    end
    private :clear

    def color(x, y = nil, z = nil, a = nil)
      @cur_color = [x, y, z, a]
      GL.Color(*@rgb.norm(x, y, z, a))
    end

    def colorHSV(x, y = nil, z = nil, a = nil)
      GL.Color(*@hsv.norm(x, y, z, a))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sgl-1.0.0 lib/sgl/opengl-color.rb