Sha256: 0bc9517972d41e20a55cb66a429f6ea8c14ed15905d0088ca73c1a1bce0ec4bc

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 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-0.4.0 lib/sgl/opengl-color.rb