Well I made a test to check if Drawable worked, and it didn't... I had made some really bad mistakes but they are fixed now and the drawable test is working currently. Though it will be extended with functionality to render too. Will have to wait with that test for now as the function is actually not finished.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1680 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
groogy 2010-11-19 14:29:21 +00:00
parent 8153ec8db8
commit 738b02c308
4 changed files with 20 additions and 16 deletions

View File

@ -248,12 +248,12 @@ void Init_Color( void )
rb_define_attr( globalColorClass, "a", 1, 1 ); rb_define_attr( globalColorClass, "a", 1, 1 );
// Class constants // Class constants
rb_define_const( globalColorClass, "Black", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 0, 0 ) ); rb_define_const( globalColorClass, "Black", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 0 ), INT2FIX( 0 ), INT2FIX( 0 ) ) );
rb_define_const( globalColorClass, "White", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 255, 255 ) ); rb_define_const( globalColorClass, "White", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 255 ), INT2FIX( 255 ), INT2FIX( 255 ) ) );
rb_define_const( globalColorClass, "Red", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 0, 0 ) ); rb_define_const( globalColorClass, "Red", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 255 ), INT2FIX( 0 ), INT2FIX( 0 ) ) );
rb_define_const( globalColorClass, "Green", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 255, 0 ) ); rb_define_const( globalColorClass, "Green", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 0 ), INT2FIX( 255 ), INT2FIX( 0 ) ) );
rb_define_const( globalColorClass, "Blue", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 0, 255 ) ); rb_define_const( globalColorClass, "Blue", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 0 ), INT2FIX( 0 ), INT2FIX( 255 ) ) );
rb_define_const( globalColorClass, "Yellow", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 255, 0 ) ); rb_define_const( globalColorClass, "Yellow", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 255 ), INT2FIX( 255 ), INT2FIX( 0 ) ) );
rb_define_const( globalColorClass, "Magneta", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 255, 0, 255 ) ); rb_define_const( globalColorClass, "Magneta", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 255 ), INT2FIX( 0 ), INT2FIX( 255 ) ) );
rb_define_const( globalColorClass, "Cyan", rb_funcall( globalColorClass, rb_intern( "new" ), 3, 0, 255, 255 ) ); rb_define_const( globalColorClass, "Cyan", rb_funcall( globalColorClass, rb_intern( "new" ), 3, INT2FIX( 0 ), INT2FIX( 255 ), INT2FIX( 255 ) ) );
} }

View File

@ -486,20 +486,14 @@ void Init_Drawable( void )
rb_define_alias( globalDrawableModule, "position=", "setPosition" ); rb_define_alias( globalDrawableModule, "position=", "setPosition" );
rb_define_alias( globalDrawableModule, "position", "getPosition" ); rb_define_alias( globalDrawableModule, "position", "getPosition" );
rb_define_alias( globalDrawableModule, "x=", "setX" ); rb_define_alias( globalDrawableModule, "x=", "setX" );
rb_define_alias( globalDrawableModule, "x", "getX" );
rb_define_alias( globalDrawableModule, "y=", "setY" ); rb_define_alias( globalDrawableModule, "y=", "setY" );
rb_define_alias( globalDrawableModule, "y", "getY" );
rb_define_alias( globalDrawableModule, "scale=", "setScale" ); rb_define_alias( globalDrawableModule, "scale=", "setScale" );
rb_define_alias( globalDrawableModule, "scale", "getScale" ); rb_define_alias( globalDrawableModule, "scale", "getScale" );
rb_define_alias( globalDrawableModule, "scaleX=", "setScaleX" ); rb_define_alias( globalDrawableModule, "scaleX=", "setScaleX" );
rb_define_alias( globalDrawableModule, "scaleX", "getScaleX" );
rb_define_alias( globalDrawableModule, "scale_x=", "setScaleX" ); rb_define_alias( globalDrawableModule, "scale_x=", "setScaleX" );
rb_define_alias( globalDrawableModule, "scale_x", "getScaleX" );
rb_define_alias( globalDrawableModule, "scaleY=", "setScaleY" ); rb_define_alias( globalDrawableModule, "scaleY=", "setScaleY" );
rb_define_alias( globalDrawableModule, "scaleY", "getScaleY" );
rb_define_alias( globalDrawableModule, "scale_y=", "setScaleY" ); rb_define_alias( globalDrawableModule, "scale_y=", "setScaleY" );
rb_define_alias( globalDrawableModule, "scale_y", "getScaleY" );
rb_define_alias( globalDrawableModule, "origin=", "setOrigin" ); rb_define_alias( globalDrawableModule, "origin=", "setOrigin" );
rb_define_alias( globalDrawableModule, "origin", "getOrigin" ); rb_define_alias( globalDrawableModule, "origin", "getOrigin" );

View File

@ -48,6 +48,7 @@ static bool CheckDependencies( void )
/* Available blending modes for drawable objects. */ /* Available blending modes for drawable objects. */
static void CreateBlendEnum( void ) static void CreateBlendEnum( void )
{ {
globalBlendNamespace = rb_define_module_under( globalSFMLNamespace, "Blend" );
rb_define_const( globalBlendNamespace, "Alpha", INT2FIX( sf::Blend::Alpha ) ); rb_define_const( globalBlendNamespace, "Alpha", INT2FIX( sf::Blend::Alpha ) );
rb_define_const( globalBlendNamespace, "Add", INT2FIX( sf::Blend::Add ) ); rb_define_const( globalBlendNamespace, "Add", INT2FIX( sf::Blend::Add ) );
rb_define_const( globalBlendNamespace, "Multiply", INT2FIX( sf::Blend::Multiply ) ); rb_define_const( globalBlendNamespace, "Multiply", INT2FIX( sf::Blend::Multiply ) );
@ -65,11 +66,10 @@ void Init_graphics( void )
globalVector2Class = RetrieveSFMLClass( "Vector2" ); globalVector2Class = RetrieveSFMLClass( "Vector2" );
globalVector3Class = RetrieveSFMLClass( "Vector3" ); globalVector3Class = RetrieveSFMLClass( "Vector3" );
globalWindowClass = RetrieveSFMLClass( "Window" ); globalWindowClass = RetrieveSFMLClass( "Window" );
rb_define_const(globalSFMLNamespace, "GraphicsLoaded", Qtrue);
CreateBlendEnum(); CreateBlendEnum();
rb_define_const(globalSFMLNamespace, "GraphicsLoaded", Qtrue);
Init_Color(); Init_Color();
Init_Rect(); Init_Rect();
Init_Drawable(); Init_Drawable();

View File

@ -0,0 +1,10 @@
require 'sfml/system'
require 'sfml/window'
require 'sfml/graphics'
class MyDrawable
include SFML::Drawable
end
drawable = MyDrawable.new
p drawable.position