texplay 0.4.3 → 0.4.4.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +225 -222
- data/README.markdown +48 -48
- data/Rakefile +16 -16
- data/examples/common.rb +18 -18
- data/examples/example_alpha_blend.rb +29 -29
- data/examples/example_bezier.rb +41 -41
- data/examples/example_blank.rb +37 -37
- data/examples/example_cache.rb +21 -21
- data/examples/example_color_control.rb +69 -69
- data/examples/example_color_transform.rb +62 -62
- data/examples/example_color_transform_circle.rb +34 -34
- data/examples/example_darken.rb +24 -24
- data/examples/example_dup.rb +73 -73
- data/examples/example_each.rb +39 -39
- data/examples/example_effect.rb +34 -34
- data/examples/example_fill.rb +43 -43
- data/examples/example_fill_old.rb +48 -48
- data/examples/example_fluent.rb +29 -29
- data/examples/example_font.rb +31 -31
- data/examples/example_hash_arguments.rb +46 -46
- data/examples/example_ippa.rb +23 -23
- data/examples/example_light.rb +75 -75
- data/examples/example_light_multiply.rb +18 -18
- data/examples/example_lsystem.rb +61 -61
- data/examples/example_melt.rb +25 -25
- data/examples/example_meyet.rb +62 -62
- data/examples/example_polyline.rb +42 -42
- data/examples/example_scale.rb +27 -27
- data/examples/example_select.rb +36 -36
- data/examples/example_select2.rb +25 -25
- data/examples/example_simple.rb +46 -46
- data/examples/example_splice.rb +26 -26
- data/examples/example_sync.rb +59 -59
- data/examples/example_tiles.rb +41 -41
- data/examples/example_trace.rb +22 -22
- data/examples/example_transparent.rb +28 -28
- data/examples/example_transparent2.rb +24 -24
- data/examples/example_transparent3.rb +20 -20
- data/examples/example_turtle.rb +39 -39
- data/examples/example_weird.rb +22 -22
- data/examples/example_window_render_to_image.rb +41 -41
- data/examples/example_window_to_blob.rb +35 -35
- data/examples/media/maria.png +0 -0
- data/examples/media/rose.bmp +0 -0
- data/ext/texplay/actions.c +1011 -1006
- data/ext/texplay/actions.h +60 -60
- data/ext/texplay/bindings.c +1130 -1125
- data/ext/texplay/bindings.h +46 -46
- data/ext/texplay/cache.c +123 -118
- data/ext/texplay/cache.h +24 -24
- data/ext/texplay/compat.h +21 -27
- data/ext/texplay/extconf.rb +38 -38
- data/ext/texplay/graphics_utils.c +1318 -1313
- data/ext/texplay/graphics_utils.h +22 -22
- data/ext/texplay/texplay.c +206 -201
- data/ext/texplay/texplay.h +153 -153
- data/ext/texplay/utils.c +896 -891
- data/ext/texplay/utils.h +153 -153
- data/lib/texplay-contrib.rb +147 -147
- data/lib/texplay.rb +347 -347
- data/lib/texplay/alone.rb +20 -20
- data/lib/texplay/c_function_docs.rb +178 -178
- data/lib/texplay/live.rb +84 -84
- data/lib/texplay/version.rb +3 -3
- data/live/live.rb +85 -85
- data/test/image_spec.rb +45 -45
- data/test/texplay_spec.rb +144 -144
- metadata +42 -52
- data/lib/texplay/1.8/texplay.so +0 -0
- data/lib/texplay/1.9/texplay.so +0 -0
data/ext/texplay/bindings.h
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
#ifndef GUARD_BINDINGS_H
|
|
2
|
-
#define GUARD_BINDINGS_H
|
|
3
|
-
|
|
4
|
-
/* class methods */
|
|
5
|
-
VALUE M_create_macro(VALUE self , VALUE method_name);
|
|
6
|
-
VALUE M_remove_macro(VALUE self, VALUE method_name);
|
|
7
|
-
VALUE M_refresh_cache_all(VALUE self);
|
|
8
|
-
VALUE M_create_blank(VALUE self, VALUE window, VALUE width, VALUE height);
|
|
9
|
-
|
|
10
|
-
/* instance methods */
|
|
11
|
-
VALUE m_paint(int argc, VALUE * argv, VALUE self);
|
|
12
|
-
VALUE m_getpixel(int argc, VALUE * argv, VALUE self);
|
|
13
|
-
VALUE m_circle(int argc, VALUE * argv, VALUE self);
|
|
14
|
-
VALUE m_line(int argc, VALUE * argv, VALUE self);
|
|
15
|
-
VALUE m_rect(int argc, VALUE * argv, VALUE self);
|
|
16
|
-
VALUE m_pixel(int argc, VALUE * argv, VALUE self);
|
|
17
|
-
VALUE m_flood_fill(int argc, VALUE * argv, VALUE self);
|
|
18
|
-
VALUE m_bezier(int argc, VALUE * argv, VALUE self);
|
|
19
|
-
VALUE m_polyline(int argc, VALUE * argv, VALUE self);
|
|
20
|
-
VALUE m_ngon(int argc, VALUE * argv, VALUE self);
|
|
21
|
-
VALUE m_special_pixel(int argc, VALUE * argv, VALUE self);
|
|
22
|
-
VALUE m_splice(int argc, VALUE * argv, VALUE self);
|
|
23
|
-
VALUE m_clear(int argc, VALUE * argv, VALUE self);
|
|
24
|
-
VALUE m_offset(int argc, VALUE * argv, VALUE self);
|
|
25
|
-
VALUE m_color(int argc, VALUE * argv, VALUE self);
|
|
26
|
-
VALUE m_missing(int argc, VALUE * argv, VALUE self);
|
|
27
|
-
VALUE m_bitmask(int argc, VALUE * argv, VALUE self);
|
|
28
|
-
VALUE m_lshift(int argc, VALUE * argv, VALUE self);
|
|
29
|
-
VALUE m_rshift(int argc, VALUE * argv, VALUE self);
|
|
30
|
-
|
|
31
|
-
VALUE m_each(int argc, VALUE * argv, VALUE self);
|
|
32
|
-
|
|
33
|
-
VALUE m_quad_cached(VALUE self);
|
|
34
|
-
VALUE m_cache_refresh(VALUE self);
|
|
35
|
-
|
|
36
|
-
VALUE m_user_set_options(VALUE self, VALUE options);
|
|
37
|
-
VALUE m_user_delete_options(VALUE self);
|
|
38
|
-
VALUE m_get_options(VALUE self);
|
|
39
|
-
VALUE m_force_sync(VALUE self, VALUE ary);
|
|
40
|
-
|
|
41
|
-
VALUE m_dup_image(VALUE self);
|
|
42
|
-
VALUE m_clone_image(VALUE self);
|
|
43
|
-
|
|
44
|
-
VALUE m_to_blob(VALUE self);
|
|
45
|
-
|
|
46
|
-
#endif
|
|
1
|
+
#ifndef GUARD_BINDINGS_H
|
|
2
|
+
#define GUARD_BINDINGS_H
|
|
3
|
+
|
|
4
|
+
/* class methods */
|
|
5
|
+
VALUE M_create_macro(VALUE self , VALUE method_name);
|
|
6
|
+
VALUE M_remove_macro(VALUE self, VALUE method_name);
|
|
7
|
+
VALUE M_refresh_cache_all(VALUE self);
|
|
8
|
+
VALUE M_create_blank(VALUE self, VALUE window, VALUE width, VALUE height);
|
|
9
|
+
|
|
10
|
+
/* instance methods */
|
|
11
|
+
VALUE m_paint(int argc, VALUE * argv, VALUE self);
|
|
12
|
+
VALUE m_getpixel(int argc, VALUE * argv, VALUE self);
|
|
13
|
+
VALUE m_circle(int argc, VALUE * argv, VALUE self);
|
|
14
|
+
VALUE m_line(int argc, VALUE * argv, VALUE self);
|
|
15
|
+
VALUE m_rect(int argc, VALUE * argv, VALUE self);
|
|
16
|
+
VALUE m_pixel(int argc, VALUE * argv, VALUE self);
|
|
17
|
+
VALUE m_flood_fill(int argc, VALUE * argv, VALUE self);
|
|
18
|
+
VALUE m_bezier(int argc, VALUE * argv, VALUE self);
|
|
19
|
+
VALUE m_polyline(int argc, VALUE * argv, VALUE self);
|
|
20
|
+
VALUE m_ngon(int argc, VALUE * argv, VALUE self);
|
|
21
|
+
VALUE m_special_pixel(int argc, VALUE * argv, VALUE self);
|
|
22
|
+
VALUE m_splice(int argc, VALUE * argv, VALUE self);
|
|
23
|
+
VALUE m_clear(int argc, VALUE * argv, VALUE self);
|
|
24
|
+
VALUE m_offset(int argc, VALUE * argv, VALUE self);
|
|
25
|
+
VALUE m_color(int argc, VALUE * argv, VALUE self);
|
|
26
|
+
VALUE m_missing(int argc, VALUE * argv, VALUE self);
|
|
27
|
+
VALUE m_bitmask(int argc, VALUE * argv, VALUE self);
|
|
28
|
+
VALUE m_lshift(int argc, VALUE * argv, VALUE self);
|
|
29
|
+
VALUE m_rshift(int argc, VALUE * argv, VALUE self);
|
|
30
|
+
|
|
31
|
+
VALUE m_each(int argc, VALUE * argv, VALUE self);
|
|
32
|
+
|
|
33
|
+
VALUE m_quad_cached(VALUE self);
|
|
34
|
+
VALUE m_cache_refresh(VALUE self);
|
|
35
|
+
|
|
36
|
+
VALUE m_user_set_options(VALUE self, VALUE options);
|
|
37
|
+
VALUE m_user_delete_options(VALUE self);
|
|
38
|
+
VALUE m_get_options(VALUE self);
|
|
39
|
+
VALUE m_force_sync(VALUE self, VALUE ary);
|
|
40
|
+
|
|
41
|
+
VALUE m_dup_image(VALUE self);
|
|
42
|
+
VALUE m_clone_image(VALUE self);
|
|
43
|
+
|
|
44
|
+
VALUE m_to_blob(VALUE self);
|
|
45
|
+
|
|
46
|
+
#endif
|
data/ext/texplay/cache.c
CHANGED
|
@@ -1,118 +1,123 @@
|
|
|
1
|
-
/* cache.c */
|
|
2
|
-
|
|
3
|
-
#include <ruby.h>
|
|
4
|
-
|
|
5
|
-
#ifdef __APPLE__
|
|
6
|
-
#include <
|
|
7
|
-
#
|
|
8
|
-
#include <
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
cache.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
1
|
+
/* cache.c */
|
|
2
|
+
|
|
3
|
+
#include <ruby.h>
|
|
4
|
+
|
|
5
|
+
#ifdef __APPLE__
|
|
6
|
+
# include <AvailabilityMacros.h>
|
|
7
|
+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
|
|
8
|
+
# include <GLUT/glut.h>
|
|
9
|
+
#else
|
|
10
|
+
# include <GL/glut.h>
|
|
11
|
+
#endif
|
|
12
|
+
#else
|
|
13
|
+
# include <GL/glut.h>
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#include "cache.h"
|
|
17
|
+
#include "texplay.h"
|
|
18
|
+
|
|
19
|
+
typedef struct {
|
|
20
|
+
int len;
|
|
21
|
+
cache_entry entry[CACHE_SIZE];
|
|
22
|
+
} cache_t;
|
|
23
|
+
|
|
24
|
+
/* var has internal linkage, static duration */
|
|
25
|
+
/* contains cache data */
|
|
26
|
+
static cache_t cache = {0};
|
|
27
|
+
|
|
28
|
+
/* create a new cache entry */
|
|
29
|
+
cache_entry*
|
|
30
|
+
cache_create_entry(int tname) {
|
|
31
|
+
float * new_array;
|
|
32
|
+
int sidelength, new_element = cache.len;
|
|
33
|
+
|
|
34
|
+
if(cache.len >= CACHE_SIZE) { rb_raise(rb_eRuntimeError, "cache is full! increase CACHE_SIZE"); }
|
|
35
|
+
|
|
36
|
+
/* opengl initialization code */
|
|
37
|
+
glEnable(GL_TEXTURE_2D);
|
|
38
|
+
glBindTexture(GL_TEXTURE_2D, tname);
|
|
39
|
+
|
|
40
|
+
/* get length of a side, since square texture */
|
|
41
|
+
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &sidelength);
|
|
42
|
+
|
|
43
|
+
/* initialize texture data array, mult. by 4 because {rgba} */
|
|
44
|
+
new_array = malloc(sidelength * sidelength * 4 * sizeof(float));
|
|
45
|
+
|
|
46
|
+
/* get texture data from video memory */
|
|
47
|
+
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT,(void*)(new_array));
|
|
48
|
+
|
|
49
|
+
/* save texture data in the cache */
|
|
50
|
+
cache.entry[new_element].tname = tname;
|
|
51
|
+
cache.entry[new_element].sidelength = sidelength;
|
|
52
|
+
cache.entry[new_element].tdata = new_array;
|
|
53
|
+
|
|
54
|
+
/* update size of cache */
|
|
55
|
+
cache.len++;
|
|
56
|
+
|
|
57
|
+
glDisable(GL_TEXTURE_2D);
|
|
58
|
+
|
|
59
|
+
return &cache.entry[new_element];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* return the entry if it exists, otherwise return NULL */
|
|
63
|
+
cache_entry*
|
|
64
|
+
find_in_cache(int tname) {
|
|
65
|
+
/* check if entry exists in cache */
|
|
66
|
+
int index;
|
|
67
|
+
for(index = 0; index < cache.len; index++)
|
|
68
|
+
if(cache.entry[index].tname == tname)
|
|
69
|
+
return &cache.entry[index];
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
return NULL;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* if the entry doesn't exist then create it and return it.
|
|
76
|
+
otherwise just return it */
|
|
77
|
+
cache_entry*
|
|
78
|
+
find_or_create_cache_entry(int tname) {
|
|
79
|
+
cache_entry * entry;
|
|
80
|
+
|
|
81
|
+
if((entry=find_in_cache(tname)))
|
|
82
|
+
return entry;
|
|
83
|
+
else
|
|
84
|
+
return cache_create_entry(tname);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* refresh the cache for all quads */
|
|
88
|
+
void
|
|
89
|
+
cache_refresh_all(void) {
|
|
90
|
+
float * tdata;
|
|
91
|
+
int tname, index;
|
|
92
|
+
|
|
93
|
+
/* opengl initialization code */
|
|
94
|
+
glEnable(GL_TEXTURE_2D);
|
|
95
|
+
|
|
96
|
+
for(index = 0; index < cache.len; index++) {
|
|
97
|
+
tdata = cache.entry[index].tdata;
|
|
98
|
+
tname = cache.entry[index].tname;
|
|
99
|
+
|
|
100
|
+
glBindTexture(GL_TEXTURE_2D, tname);
|
|
101
|
+
|
|
102
|
+
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, (void*)(tdata));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
glDisable(GL_TEXTURE_2D);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* refresh the cache for a specific quad */
|
|
109
|
+
void
|
|
110
|
+
cache_refresh_entry(int tname) {
|
|
111
|
+
cache_entry * entry;
|
|
112
|
+
|
|
113
|
+
entry = find_in_cache(tname);
|
|
114
|
+
|
|
115
|
+
/* opengl initialization code */
|
|
116
|
+
glEnable(GL_TEXTURE_2D);
|
|
117
|
+
glBindTexture(GL_TEXTURE_2D, entry->tname);
|
|
118
|
+
|
|
119
|
+
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, (void*)(entry->tdata));
|
|
120
|
+
|
|
121
|
+
glDisable(GL_TEXTURE_2D);
|
|
122
|
+
}
|
|
123
|
+
|
data/ext/texplay/cache.h
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/* cache.h */
|
|
2
|
-
/* see cache.c for annotations */
|
|
3
|
-
|
|
4
|
-
#ifndef GUARD_CACHE_H
|
|
5
|
-
#define GUARD_CACHE_H
|
|
6
|
-
|
|
7
|
-
/* defines */
|
|
8
|
-
#define CACHE_SIZE 10000
|
|
9
|
-
|
|
10
|
-
/* data types */
|
|
11
|
-
typedef struct {
|
|
12
|
-
int tname;
|
|
13
|
-
int sidelength;
|
|
14
|
-
float * tdata;
|
|
15
|
-
} cache_entry;
|
|
16
|
-
|
|
17
|
-
/* functions */
|
|
18
|
-
void cache_refresh_all(void);
|
|
19
|
-
void cache_refresh_entry(int tname);
|
|
20
|
-
cache_entry * cache_create_entry(int texture_name);
|
|
21
|
-
cache_entry * find_in_cache(int texture_name);
|
|
22
|
-
cache_entry * find_or_create_cache_entry(int texture_name);
|
|
23
|
-
|
|
24
|
-
#endif
|
|
1
|
+
/* cache.h */
|
|
2
|
+
/* see cache.c for annotations */
|
|
3
|
+
|
|
4
|
+
#ifndef GUARD_CACHE_H
|
|
5
|
+
#define GUARD_CACHE_H
|
|
6
|
+
|
|
7
|
+
/* defines */
|
|
8
|
+
#define CACHE_SIZE 10000
|
|
9
|
+
|
|
10
|
+
/* data types */
|
|
11
|
+
typedef struct {
|
|
12
|
+
int tname;
|
|
13
|
+
int sidelength;
|
|
14
|
+
float * tdata;
|
|
15
|
+
} cache_entry;
|
|
16
|
+
|
|
17
|
+
/* functions */
|
|
18
|
+
void cache_refresh_all(void);
|
|
19
|
+
void cache_refresh_entry(int tname);
|
|
20
|
+
cache_entry * cache_create_entry(int texture_name);
|
|
21
|
+
cache_entry * find_in_cache(int texture_name);
|
|
22
|
+
cache_entry * find_or_create_cache_entry(int texture_name);
|
|
23
|
+
|
|
24
|
+
#endif
|
data/ext/texplay/compat.h
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
/* contains basic macros to facilitate ruby 1.8 and ruby 1.9 compatibility */
|
|
2
|
-
|
|
3
|
-
#ifndef GUARD_COMPAT_H
|
|
4
|
-
#define GUARD_COMPAT_H
|
|
5
|
-
|
|
6
|
-
#include <ruby.h>
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
#endif
|
|
23
|
-
|
|
24
|
-
/* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
|
|
25
|
-
#define KLASS_OF(c) (RBASIC(c)->klass)
|
|
26
|
-
|
|
27
|
-
#endif
|
|
1
|
+
/* contains basic macros to facilitate ruby 1.8 and ruby 1.9 compatibility */
|
|
2
|
+
|
|
3
|
+
#ifndef GUARD_COMPAT_H
|
|
4
|
+
#define GUARD_COMPAT_H
|
|
5
|
+
|
|
6
|
+
#include <ruby.h>
|
|
7
|
+
|
|
8
|
+
/* macros for backwards compatibility with 1.8 */
|
|
9
|
+
#ifndef RCLASS_M_TBL
|
|
10
|
+
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#ifndef RCLASS_SUPER
|
|
14
|
+
# define RCLASS_SUPER(c) (RCLASS(c)->super)
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#ifndef RCLASS_IV_TBL
|
|
18
|
+
# define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#endif
|
data/ext/texplay/extconf.rb
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
require 'mkmf'
|
|
2
|
-
|
|
3
|
-
name = 'texplay/texplay'
|
|
4
|
-
|
|
5
|
-
dir_config name
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# linux
|
|
9
|
-
if RUBY_PLATFORM =~ /linux/
|
|
10
|
-
exit unless have_library("glut")
|
|
11
|
-
exit unless have_library("GL")
|
|
12
|
-
|
|
13
|
-
# macosx
|
|
14
|
-
elsif RUBY_PLATFORM =~ /darwin/
|
|
15
|
-
$LDFLAGS += " -framework GLUT"
|
|
16
|
-
$CFLAGS += " -I/System/Library/Frameworks/GLUT.framework/Headers"
|
|
17
|
-
|
|
18
|
-
# windows
|
|
19
|
-
else
|
|
20
|
-
freeglut_path = File.expand_path "vendor/freeglut", File.dirname(__FILE__)
|
|
21
|
-
|
|
22
|
-
$CFLAGS << " -I#{File.join freeglut_path, "include"}"
|
|
23
|
-
|
|
24
|
-
exit unless find_library "freeglut_static", 'main', File.join(freeglut_path, "lib")
|
|
25
|
-
exit unless have_library "opengl32"
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Stop getting annoying warnings for valid C99 code.
|
|
30
|
-
$warnflags.gsub!('-Wdeclaration-after-statement', '') if $warnflags
|
|
31
|
-
|
|
32
|
-
# 1.9 compatibility
|
|
33
|
-
$CFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /^1\.9/
|
|
34
|
-
|
|
35
|
-
# let's use c99
|
|
36
|
-
$CFLAGS += " -std=c99"
|
|
37
|
-
|
|
38
|
-
create_makefile name
|
|
1
|
+
require 'mkmf'
|
|
2
|
+
|
|
3
|
+
name = 'texplay/texplay'
|
|
4
|
+
|
|
5
|
+
dir_config name
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# linux
|
|
9
|
+
if RUBY_PLATFORM =~ /linux/
|
|
10
|
+
exit unless have_library("glut")
|
|
11
|
+
exit unless have_library("GL")
|
|
12
|
+
|
|
13
|
+
# macosx
|
|
14
|
+
elsif RUBY_PLATFORM =~ /darwin/
|
|
15
|
+
$LDFLAGS += " -framework GLUT"
|
|
16
|
+
$CFLAGS += " -I/System/Library/Frameworks/GLUT.framework/Headers"
|
|
17
|
+
|
|
18
|
+
# windows
|
|
19
|
+
else
|
|
20
|
+
freeglut_path = File.expand_path "vendor/freeglut", File.dirname(__FILE__)
|
|
21
|
+
|
|
22
|
+
$CFLAGS << " -I#{File.join freeglut_path, "include"}"
|
|
23
|
+
|
|
24
|
+
exit unless find_library "freeglut_static", 'main', File.join(freeglut_path, "lib")
|
|
25
|
+
exit unless have_library "opengl32"
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Stop getting annoying warnings for valid C99 code.
|
|
30
|
+
$warnflags.gsub!('-Wdeclaration-after-statement', '') if $warnflags
|
|
31
|
+
|
|
32
|
+
# 1.9 compatibility
|
|
33
|
+
$CFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /^1\.9/
|
|
34
|
+
|
|
35
|
+
# let's use c99
|
|
36
|
+
$CFLAGS += " -std=c99"
|
|
37
|
+
|
|
38
|
+
create_makefile name
|