From 8c45dc9d6bf3f97bdf733f430298c06ed287fef7 Mon Sep 17 00:00:00 2001 From: groogy Date: Wed, 17 Nov 2010 08:59:23 +0000 Subject: [PATCH] Added the predefined colors git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1666 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/ruby/sfml-graphics/graphics/Color.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bindings/ruby/sfml-graphics/graphics/Color.cpp b/bindings/ruby/sfml-graphics/graphics/Color.cpp index 3fa4a562..8105b9fb 100644 --- a/bindings/ruby/sfml-graphics/graphics/Color.cpp +++ b/bindings/ruby/sfml-graphics/graphics/Color.cpp @@ -204,4 +204,14 @@ void Init_Color( void ) rb_define_attr( globalColorClass, "g", 1, 1 ); rb_define_attr( globalColorClass, "b", 1, 1 ); rb_define_attr( globalColorClass, "a", 1, 1 ); + + // Class constants + rb_define_const( globalColorClass, "Black", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 0, 0 ) ); + rb_define_const( globalColorClass, "White", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 255, 255 ) ); + rb_define_const( globalColorClass, "Red", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 0, 0 ) ); + rb_define_const( globalColorClass, "Green", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 255, 0 ) ); + rb_define_const( globalColorClass, "Blue", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 0, 255 ) ); + rb_define_const( globalColorClass, "Yellow", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 255, 0 ) ); + rb_define_const( globalColorClass, "Magneta", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 0, 255 ) ); + rb_define_const( globalColorClass, "Cyan", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 255, 255 ) ); }