mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
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:
parent
8153ec8db8
commit
738b02c308
@ -248,12 +248,12 @@ void Init_Color( void )
|
||||
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 ) );
|
||||
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, INT2FIX( 255 ), INT2FIX( 255 ), INT2FIX( 255 ) ) );
|
||||
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, INT2FIX( 0 ), INT2FIX( 255 ), INT2FIX( 0 ) ) );
|
||||
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, INT2FIX( 255 ), INT2FIX( 255 ), INT2FIX( 0 ) ) );
|
||||
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, INT2FIX( 0 ), INT2FIX( 255 ), INT2FIX( 255 ) ) );
|
||||
}
|
||||
|
@ -486,20 +486,14 @@ void Init_Drawable( void )
|
||||
rb_define_alias( globalDrawableModule, "position=", "setPosition" );
|
||||
rb_define_alias( globalDrawableModule, "position", "getPosition" );
|
||||
rb_define_alias( globalDrawableModule, "x=", "setX" );
|
||||
rb_define_alias( globalDrawableModule, "x", "getX" );
|
||||
rb_define_alias( globalDrawableModule, "y=", "setY" );
|
||||
rb_define_alias( globalDrawableModule, "y", "getY" );
|
||||
|
||||
rb_define_alias( globalDrawableModule, "scale=", "setScale" );
|
||||
rb_define_alias( globalDrawableModule, "scale", "getScale" );
|
||||
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", "getScaleX" );
|
||||
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", "getScaleY" );
|
||||
|
||||
rb_define_alias( globalDrawableModule, "origin=", "setOrigin" );
|
||||
rb_define_alias( globalDrawableModule, "origin", "getOrigin" );
|
||||
|
@ -48,6 +48,7 @@ static bool CheckDependencies( void )
|
||||
/* Available blending modes for drawable objects. */
|
||||
static void CreateBlendEnum( void )
|
||||
{
|
||||
globalBlendNamespace = rb_define_module_under( globalSFMLNamespace, "Blend" );
|
||||
rb_define_const( globalBlendNamespace, "Alpha", INT2FIX( sf::Blend::Alpha ) );
|
||||
rb_define_const( globalBlendNamespace, "Add", INT2FIX( sf::Blend::Add ) );
|
||||
rb_define_const( globalBlendNamespace, "Multiply", INT2FIX( sf::Blend::Multiply ) );
|
||||
@ -65,11 +66,10 @@ void Init_graphics( void )
|
||||
globalVector2Class = RetrieveSFMLClass( "Vector2" );
|
||||
globalVector3Class = RetrieveSFMLClass( "Vector3" );
|
||||
globalWindowClass = RetrieveSFMLClass( "Window" );
|
||||
rb_define_const(globalSFMLNamespace, "GraphicsLoaded", Qtrue);
|
||||
|
||||
CreateBlendEnum();
|
||||
|
||||
rb_define_const(globalSFMLNamespace, "GraphicsLoaded", Qtrue);
|
||||
|
||||
Init_Color();
|
||||
Init_Rect();
|
||||
Init_Drawable();
|
||||
|
10
bindings/ruby/testing/drawable-mixin.rb
Normal file
10
bindings/ruby/testing/drawable-mixin.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user