diff options
| author | Tom Black <[email protected]> | 2018-09-04 00:36:52 -0700 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-09-12 15:35:16 -0700 |
| commit | 6acf6c8bd0cd8051bdb6cb6ec75fb7d67959e47b (patch) | |
| tree | 28c87e64f1b17e64194c335145fc4ab0748fb5c9 /ext | |
| parent | 8e8755972a55b75b7f38f2da503c40e12dd4a344 (diff) | |
| download | ruby2d-6acf6c8bd0cd8051bdb6cb6ec75fb7d67959e47b.tar.gz ruby2d-6acf6c8bd0cd8051bdb6cb6ec75fb7d67959e47b.zip | |
Add ability to rotate textures
Includes images, sprites, and text.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ruby2d/ruby2d.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c index 2705e03..c723e4f 100644 --- a/ext/ruby2d/ruby2d.c +++ b/ext/ruby2d/ruby2d.c @@ -328,6 +328,8 @@ static R_VAL ruby2d_image_ext_render(R_VAL self) { if (r_test(w)) img->width = NUM2INT(w); if (r_test(h)) img->height = NUM2INT(h); + S2D_RotateImage(img, NUM2DBL(r_iv_get(self, "@rotate")), S2D_CENTER); + R_VAL c = r_iv_get(self, "@color"); img->color.r = NUM2DBL(r_iv_get(c, "@r")); img->color.g = NUM2DBL(r_iv_get(c, "@g")); @@ -398,6 +400,8 @@ static R_VAL ruby2d_sprite_ext_render(R_VAL self) { R_VAL h = r_iv_get(self, "@flip_height"); if (r_test(h)) spr->height = NUM2DBL(h); + S2D_RotateSprite(spr, NUM2DBL(r_iv_get(self, "@rotate")), S2D_CENTER); + S2D_ClipSprite( spr, NUM2INT(r_iv_get(self, "@clip_x")), @@ -487,6 +491,8 @@ static R_VAL ruby2d_text_ext_render(R_VAL self) { txt->x = NUM2DBL(r_iv_get(self, "@x")); txt->y = NUM2DBL(r_iv_get(self, "@y")); + S2D_RotateText(txt, NUM2DBL(r_iv_get(self, "@rotate")), S2D_CENTER); + R_VAL c = r_iv_get(self, "@color"); txt->color.r = NUM2DBL(r_iv_get(c, "@r")); txt->color.g = NUM2DBL(r_iv_get(c, "@g")); |
