ruby2d 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/ruby2d/tileset.c DELETED
@@ -1,30 +0,0 @@
1
- // tileset.c
2
-
3
- #include "ruby2d.h"
4
-
5
-
6
- /*
7
- * Draw a tile
8
- */
9
- void R2D_DrawTile(R2D_Image *img, int tw, int th, int padding, int spacing, int tx, int ty, int x, int y) {
10
- if (!img) return;
11
-
12
- if (img->texture_id == 0) {
13
- R2D_GL_CreateTexture(&img->texture_id, img->format,
14
- img->width, img->height,
15
- img->surface->pixels, GL_NEAREST);
16
- SDL_FreeSurface(img->surface);
17
- }
18
-
19
- GLfloat tx1 = (double)(padding + ((spacing + tw) * tx)) / (double) img->width ;
20
- GLfloat tx2 = tx1 + ((double)tw / (double) img->width);
21
- GLfloat tx3 = tx2;
22
- GLfloat tx4 = tx1;
23
-
24
- GLfloat ty1 = (double)(padding + ((spacing + th) * ty)) / (double) img ->height;
25
- GLfloat ty2 = ty1;
26
- GLfloat ty3 = ty1 + ((double)th / (double) img->height);
27
- GLfloat ty4 = ty3;
28
-
29
- R2D_GL_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
30
- }