mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Invalid number conversion in SFML::View, fixed now.
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1726 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
6541486967
commit
4de4d0832c
@ -55,12 +55,12 @@ static VALUE View_Initialize( int argc, VALUE *args, VALUE self )
|
|||||||
{
|
{
|
||||||
temp = Vector2_ForceType( args[0] );
|
temp = Vector2_ForceType( args[0] );
|
||||||
sf::Vector2f center;
|
sf::Vector2f center;
|
||||||
center.x = FIX2UINT( Vector2_GetX( temp ) );
|
center.x = NUM2DBL( Vector2_GetX( temp ) );
|
||||||
center.y = FIX2UINT( Vector2_GetY( temp ) );
|
center.y = NUM2DBL( Vector2_GetY( temp ) );
|
||||||
temp = Vector2_ForceType( args[1] );
|
temp = Vector2_ForceType( args[1] );
|
||||||
sf::Vector2f size;
|
sf::Vector2f size;
|
||||||
size.x = FIX2UINT( Vector2_GetX( temp ) );
|
size.x = NUM2DBL( Vector2_GetX( temp ) );
|
||||||
size.y = FIX2UINT( Vector2_GetY( temp ) );
|
size.y = NUM2DBL( Vector2_GetY( temp ) );
|
||||||
object->SetCenter( center );
|
object->SetCenter( center );
|
||||||
object->SetSize( size );
|
object->SetSize( size );
|
||||||
break;
|
break;
|
||||||
@ -69,10 +69,10 @@ static VALUE View_Initialize( int argc, VALUE *args, VALUE self )
|
|||||||
{
|
{
|
||||||
temp = Rect_ForceType( args[0] );
|
temp = Rect_ForceType( args[0] );
|
||||||
sf::FloatRect rectangle;
|
sf::FloatRect rectangle;
|
||||||
rectangle.Left = FIX2UINT( Rect_GetLeft( temp ) );
|
rectangle.Left = NUM2DBL( Rect_GetLeft( temp ) );
|
||||||
rectangle.Top = FIX2UINT( Rect_GetTop( temp ) );
|
rectangle.Top = NUM2DBL( Rect_GetTop( temp ) );
|
||||||
rectangle.Width = FIX2UINT( Rect_GetWidth( temp ) );
|
rectangle.Width = NUM2DBL( Rect_GetWidth( temp ) );
|
||||||
rectangle.Height = FIX2UINT( Rect_GetHeight( temp ) );
|
rectangle.Height = NUM2DBL( Rect_GetHeight( temp ) );
|
||||||
object->Reset( rectangle );
|
object->Reset( rectangle );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -157,11 +157,13 @@ static VALUE View_Move( int argc, VALUE * args, VALUE self )
|
|||||||
VALUE temp = Vector2_ForceType( args[0] );
|
VALUE temp = Vector2_ForceType( args[0] );
|
||||||
offsetX = NUM2DBL( Vector2_GetX( temp ) );
|
offsetX = NUM2DBL( Vector2_GetX( temp ) );
|
||||||
offsetY = NUM2DBL( Vector2_GetY( temp ) );
|
offsetY = NUM2DBL( Vector2_GetY( temp ) );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
offsetX = NUM2DBL( args[0] );
|
offsetX = NUM2DBL( args[0] );
|
||||||
offsetY = NUM2DBL( args[1] );
|
offsetY = NUM2DBL( args[1] );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
rb_raise( rb_eArgError, "Expected 1 or 2 arguments but was given %d", argc );
|
rb_raise( rb_eArgError, "Expected 1 or 2 arguments but was given %d", argc );
|
||||||
@ -225,11 +227,13 @@ static VALUE View_SetCenter( int argc, VALUE * args, VALUE self )
|
|||||||
VALUE temp = Vector2_ForceType( args[0] );
|
VALUE temp = Vector2_ForceType( args[0] );
|
||||||
x = NUM2DBL( Vector2_GetX( temp ) );
|
x = NUM2DBL( Vector2_GetX( temp ) );
|
||||||
y = NUM2DBL( Vector2_GetY( temp ) );
|
y = NUM2DBL( Vector2_GetY( temp ) );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
x = NUM2DBL( args[0] );
|
x = NUM2DBL( args[0] );
|
||||||
y = NUM2DBL( args[1] );
|
y = NUM2DBL( args[1] );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
rb_raise( rb_eArgError, "Expected 1 or 2 arguments but was given %d", argc );
|
rb_raise( rb_eArgError, "Expected 1 or 2 arguments but was given %d", argc );
|
||||||
|
Loading…
Reference in New Issue
Block a user