mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 06:41:05 +08:00
Finished the Rect_Initialize function so we now also can specify two vectors as size and position.
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1669 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
810cd35cae
commit
06d6f9b81d
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Rect.hpp"
|
#include "Rect.hpp"
|
||||||
|
#include "Vector2.hpp"
|
||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
VALUE globalRectClass;
|
VALUE globalRectClass;
|
||||||
@ -96,6 +97,8 @@ static void Rect_internal_ValidateTypes( VALUE aFirst, VALUE aSecond, VALUE aThi
|
|||||||
*/
|
*/
|
||||||
static VALUE Rect_Initialize( int argc, VALUE *args VALUE self )
|
static VALUE Rect_Initialize( int argc, VALUE *args VALUE self )
|
||||||
{
|
{
|
||||||
|
VALUE arg0 = Qnil;
|
||||||
|
VALUE arg1 = Qnil;
|
||||||
switch( argc )
|
switch( argc )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -107,6 +110,14 @@ static VALUE Rect_Initialize( int argc, VALUE *args VALUE self )
|
|||||||
case 1:
|
case 1:
|
||||||
Color_internal_CopyFrom( self, args[0] );
|
Color_internal_CopyFrom( self, args[0] );
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
arg0 = Vector2_ForceType( args[0] );
|
||||||
|
arg1 = Vector2_ForceType( args[1] );
|
||||||
|
rb_iv_set( self, "@left", rb_funcall( arg0, rb_intern( "x" ), 0 ) );
|
||||||
|
rb_iv_set( self, "@top", rb_funcall( arg0, rb_intern( "y" ), 0 ) );
|
||||||
|
rb_iv_set( self, "@width", rb_funcall( arg1, rb_intern( "x" ), 0 ) );
|
||||||
|
rb_iv_set( self, "@height", rb_funcall( arg2, rb_intern( "y" ), 0 ) );
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Rect_internal_ValidateTypes( args[0], args[1], args[2], args[3] );
|
Rect_internal_ValidateTypes( args[0], args[1], args[2], args[3] );
|
||||||
rb_iv_set( self, "@left", args[0]);
|
rb_iv_set( self, "@left", args[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user