cyross-ruby-miyako 2.0.5.1.0 → 2.1.0
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.
- data/README +1092 -929
- data/Rakefile +7 -7
- data/defines.h +144 -144
- data/extern.h +29 -29
- data/install_miyako.rb +87 -87
- data/lib/Miyako/API/audio.rb +572 -198
- data/lib/Miyako/API/basic_data.rb +825 -573
- data/lib/Miyako/API/bitmap.rb +534 -507
- data/lib/Miyako/API/choices.rb +481 -475
- data/lib/Miyako/API/collision.rb +486 -460
- data/lib/Miyako/API/diagram.rb +586 -561
- data/lib/Miyako/API/drawing.rb +151 -151
- data/lib/Miyako/API/exceptions.rb +105 -0
- data/lib/Miyako/API/fixedmap.rb +462 -428
- data/lib/Miyako/API/font.rb +430 -403
- data/lib/Miyako/API/input.rb +456 -447
- data/lib/Miyako/API/layout.rb +636 -433
- data/lib/Miyako/API/map.rb +583 -529
- data/lib/Miyako/API/map_event.rb +222 -198
- data/lib/Miyako/API/modules.rb +357 -109
- data/lib/Miyako/API/movie.rb +166 -154
- data/lib/Miyako/API/parts.rb +276 -189
- data/lib/Miyako/API/plane.rb +205 -166
- data/lib/Miyako/API/screen.rb +341 -325
- data/lib/Miyako/API/shape.rb +443 -443
- data/lib/Miyako/API/sprite.rb +771 -752
- data/lib/Miyako/API/sprite_animation.rb +490 -481
- data/lib/Miyako/API/sprite_list.rb +1135 -0
- data/lib/Miyako/API/spriteunit.rb +168 -147
- data/lib/Miyako/API/story.rb +350 -300
- data/lib/Miyako/API/textbox.rb +770 -725
- data/lib/Miyako/API/utility.rb +419 -388
- data/lib/Miyako/API/viewport.rb +189 -139
- data/lib/Miyako/API/yuki.rb +1226 -996
- data/lib/Miyako/EXT/miyako_cairo.rb +62 -62
- data/lib/Miyako/EXT/raster_scroll.rb +138 -138
- data/lib/Miyako/EXT/slides.rb +157 -157
- data/lib/Miyako/miyako.rb +201 -171
- data/lib/Miyako/miyako_require_only.rb +35 -0
- data/miyako_basicdata.c +590 -590
- data/miyako_bitmap.c +1225 -1225
- data/miyako_collision.c +403 -403
- data/miyako_drawing.c +187 -187
- data/miyako_font.c +334 -334
- data/miyako_hsv.c +830 -830
- data/miyako_input_audio.c +254 -0
- data/miyako_layout.c +191 -191
- data/miyako_no_katana.c +1078 -1074
- data/miyako_sprite2.c +431 -0
- data/miyako_transform.c +438 -438
- data/miyako_utility.c +288 -288
- data/sample/Animation1/m1ku.rb +68 -68
- data/sample/Animation2/lex.rb +96 -96
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +328 -386
- data/sample/Room3/blue.rb +297 -297
- data/sample/Room3/ending.rb +180 -180
- data/sample/Room3/green.rb +220 -220
- data/sample/Room3/main.rb +119 -119
- data/sample/Room3/main_component.rb +59 -59
- data/sample/Room3/red.rb +227 -227
- data/sample/Room3/room3.rb +25 -27
- data/sample/Room3/title.rb +184 -184
- data/sample/ball_action_sample.rb +204 -204
- data/sample/blit_rop.rb +70 -70
- data/sample/cairo_sample.rb +25 -25
- data/sample/circle_collision_test.rb +66 -66
- data/sample/collision_test.rb +33 -33
- data/sample/collision_test2.rb +108 -108
- data/sample/fixed_map_test/fixed_map_sample.rb +140 -140
- data/sample/fixed_map_test/readme.txt +72 -72
- data/sample/map_test/chara.rb +58 -58
- data/sample/map_test/main_parts.rb +69 -69
- data/sample/map_test/main_scene.rb +153 -153
- data/sample/map_test/map_manager.rb +75 -75
- data/sample/map_test/map_test.rb +23 -23
- data/sample/map_test/oasis.rb +71 -71
- data/sample/map_test/readme.txt +89 -89
- data/sample/map_test/route.rb +157 -157
- data/sample/map_test/town.rb +74 -74
- data/sample/polygon_test.rb +35 -35
- data/sample/rasterscroll.rb +24 -24
- data/sample/takahashi.rb +42 -42
- data/sample/textbox_sample.rb +189 -189
- data/sample/transform.rb +54 -54
- data/sample/utility_test.rb +73 -73
- data/sample/utility_test2.rb +61 -61
- data/sample/utility_test3.rb +64 -64
- data/sample/utility_test4.rb +73 -73
- data/uninstall_miyako.rb +19 -19
- data/win/miyako_no_katana.so +0 -0
- metadata +7 -2
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#! /usr/bin/env rake
|
2
|
-
|
3
|
-
task :default => :ruby_miyako
|
4
|
-
|
5
|
-
task :ruby_miyako do
|
6
|
-
system 'ruby install_miyako.rb'
|
7
|
-
end
|
1
|
+
#! /usr/bin/env rake
|
2
|
+
|
3
|
+
task :default => :ruby_miyako
|
4
|
+
|
5
|
+
task :ruby_miyako do
|
6
|
+
system 'ruby install_miyako.rb'
|
7
|
+
end
|
data/defines.h
CHANGED
@@ -1,144 +1,144 @@
|
|
1
|
-
/*
|
2
|
-
--
|
3
|
-
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
-
Copyright (C) 2008 Cyross Makoto
|
5
|
-
|
6
|
-
This library is free software; you can redistribute it and/or
|
7
|
-
modify it under the terms of the GNU Lesser General Public
|
8
|
-
License as published by the Free Software Foundation; either
|
9
|
-
version 2.1 of the License, or (at your option) any later version.
|
10
|
-
|
11
|
-
This library is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
Lesser General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU Lesser General Public
|
17
|
-
License along with this library; if not, write to the Free Software
|
18
|
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
-
++
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include <SDL.h>
|
23
|
-
#include <SDL_ttf.h>
|
24
|
-
#include <SDL_endian.h>
|
25
|
-
#include <stdlib.h>
|
26
|
-
#include <math.h>
|
27
|
-
#include "ruby.h"
|
28
|
-
#include "ruby/encoding.h"
|
29
|
-
|
30
|
-
typedef struct
|
31
|
-
{
|
32
|
-
SDL_Surface* surface;
|
33
|
-
} Surface;
|
34
|
-
|
35
|
-
typedef struct
|
36
|
-
{
|
37
|
-
Uint32 r;
|
38
|
-
Uint32 g;
|
39
|
-
Uint32 b;
|
40
|
-
Uint32 a;
|
41
|
-
} MiyakoColor;
|
42
|
-
|
43
|
-
typedef struct
|
44
|
-
{
|
45
|
-
int w;
|
46
|
-
int h;
|
47
|
-
} MiyakoSize;
|
48
|
-
|
49
|
-
typedef struct
|
50
|
-
{
|
51
|
-
VALUE unit;
|
52
|
-
SDL_Surface *surface;
|
53
|
-
SDL_PixelFormat *fmt;
|
54
|
-
SDL_Rect rect;
|
55
|
-
MiyakoColor color;
|
56
|
-
Uint32 a255;
|
57
|
-
Uint32 *ptr;
|
58
|
-
int x;
|
59
|
-
int y;
|
60
|
-
} MiyakoBitmap;
|
61
|
-
|
62
|
-
// from rubysdl.h
|
63
|
-
#define GLOBAL_DEFINE_GET_STRUCT(struct_name, fun, klass, klassstr) \
|
64
|
-
struct_name* fun(VALUE obj) \
|
65
|
-
{ \
|
66
|
-
struct_name* st; \
|
67
|
-
\
|
68
|
-
if(!rb_obj_is_kind_of(obj, klass)){ \
|
69
|
-
rb_raise(rb_eTypeError, "wrong argument type %s (expected " klassstr ")", \
|
70
|
-
rb_obj_classname(obj)); \
|
71
|
-
} \
|
72
|
-
Data_Get_Struct(obj, struct_name, st); \
|
73
|
-
return st; \
|
74
|
-
}
|
75
|
-
|
76
|
-
#define MIYAKO_GETCOLOR(COLOR) \
|
77
|
-
COLOR.r = (Uint32)(((pixel & fmt->Rmask) >> fmt->Rshift) << fmt->Rloss); \
|
78
|
-
COLOR.g = (Uint32)(((pixel & fmt->Gmask) >> fmt->Gshift) << fmt->Gloss); \
|
79
|
-
COLOR.b = (Uint32)(((pixel & fmt->Bmask) >> fmt->Bshift) << fmt->Bloss); \
|
80
|
-
COLOR.a = (Uint32)(((pixel & fmt->Amask) >> fmt->Ashift) << fmt->Aloss);
|
81
|
-
|
82
|
-
#define MIYAKO_SETCOLOR(RESULT, COLOR) \
|
83
|
-
RESULT = (COLOR.r >> fmt->Rloss) << fmt->Rshift | \
|
84
|
-
(COLOR.g >> fmt->Gloss) << fmt->Gshift | \
|
85
|
-
(COLOR.b >> fmt->Bloss) << fmt->Bshift | \
|
86
|
-
(COLOR.a >> fmt->Aloss) << fmt->Ashift;
|
87
|
-
|
88
|
-
#define MIYAKO_SET_RECT(RECT, BASE) \
|
89
|
-
RECT.x = NUM2INT(*(RSTRUCT_PTR(BASE) + 1)); \
|
90
|
-
RECT.y = NUM2INT(*(RSTRUCT_PTR(BASE) + 2)); \
|
91
|
-
RECT.w = NUM2INT(*(RSTRUCT_PTR(BASE) + 3)); \
|
92
|
-
RECT.h = NUM2INT(*(RSTRUCT_PTR(BASE) + 4));
|
93
|
-
|
94
|
-
#define MIYAKO_INIT_RECT1 \
|
95
|
-
int dlx = drect.x + x; \
|
96
|
-
int dly = drect.y + y; \
|
97
|
-
int dmx = dlx + (srect.w < drect.w ? srect.w : drect.w); \
|
98
|
-
int dmy = dly + (srect.h < drect.h ? srect.h : drect.h);
|
99
|
-
|
100
|
-
#define MIYAKO_INIT_RECT2 \
|
101
|
-
int dlx = drect.x; \
|
102
|
-
int dly = drect.y; \
|
103
|
-
int dmx = dlx + drect.w; \
|
104
|
-
int dmy = dly + drect.h;
|
105
|
-
|
106
|
-
#define MIYAKO_INIT_RECT3 \
|
107
|
-
if(s2rect.w != drect.w){ return Qnil; } \
|
108
|
-
if(s2rect.h != drect.h){ return Qnil; } \
|
109
|
-
int x1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 5)); \
|
110
|
-
int y1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 6)); \
|
111
|
-
int x2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 5)); \
|
112
|
-
int y2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 6)); \
|
113
|
-
if(s1rect.x < 0 || s1rect.y < 0 || s2rect.x < 0 || s2rect.y < 0){ return Qnil; } \
|
114
|
-
if(s1rect.w < s2rect.w && (x1+s1rect.x+s1rect.w > s2rect.w)){ return Qnil; } \
|
115
|
-
if(s2rect.w < s1rect.w && (x2+s2rect.x+s2rect.w > s1rect.w)){ return Qnil; } \
|
116
|
-
if(s1rect.h < s2rect.h && (y1+s1rect.y+s1rect.h > s2rect.h)){ return Qnil; } \
|
117
|
-
if(s2rect.h < s1rect.h && (y2+s2rect.y+s2rect.h > s1rect.h)){ return Qnil; } \
|
118
|
-
int dlx = drect.x; \
|
119
|
-
int dly = drect.y; \
|
120
|
-
int dmx = dlx + (s1rect.w < s2rect.w ? s1rect.w : s2rect.w); \
|
121
|
-
int dmy = dly + (s1rect.h < s2rect.h ? s1rect.h : s2rect.h);
|
122
|
-
|
123
|
-
#define MIYAKO_PSET(XX,YY) \
|
124
|
-
pixel = 0; \
|
125
|
-
if(dcolor.a == 0) \
|
126
|
-
{ \
|
127
|
-
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
128
|
-
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
129
|
-
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
130
|
-
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
131
|
-
continue; \
|
132
|
-
} \
|
133
|
-
if(scolor.a > 0) \
|
134
|
-
{ \
|
135
|
-
int a1 = scolor.a + 1; \
|
136
|
-
int a2 = 256 - scolor.a; \
|
137
|
-
scolor.r = (scolor.r * a1 + dcolor.r * a2) >> 8; \
|
138
|
-
scolor.g = (scolor.g * a1 + dcolor.g * a2) >> 8; \
|
139
|
-
scolor.b = (scolor.b * a1 + dcolor.b * a2) >> 8; \
|
140
|
-
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
141
|
-
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
142
|
-
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
143
|
-
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
144
|
-
}
|
1
|
+
/*
|
2
|
+
--
|
3
|
+
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
+
Copyright (C) 2008 Cyross Makoto
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
++
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <SDL.h>
|
23
|
+
#include <SDL_ttf.h>
|
24
|
+
#include <SDL_endian.h>
|
25
|
+
#include <stdlib.h>
|
26
|
+
#include <math.h>
|
27
|
+
#include "ruby.h"
|
28
|
+
#include "ruby/encoding.h"
|
29
|
+
|
30
|
+
typedef struct
|
31
|
+
{
|
32
|
+
SDL_Surface* surface;
|
33
|
+
} Surface;
|
34
|
+
|
35
|
+
typedef struct
|
36
|
+
{
|
37
|
+
Uint32 r;
|
38
|
+
Uint32 g;
|
39
|
+
Uint32 b;
|
40
|
+
Uint32 a;
|
41
|
+
} MiyakoColor;
|
42
|
+
|
43
|
+
typedef struct
|
44
|
+
{
|
45
|
+
int w;
|
46
|
+
int h;
|
47
|
+
} MiyakoSize;
|
48
|
+
|
49
|
+
typedef struct
|
50
|
+
{
|
51
|
+
VALUE unit;
|
52
|
+
SDL_Surface *surface;
|
53
|
+
SDL_PixelFormat *fmt;
|
54
|
+
SDL_Rect rect;
|
55
|
+
MiyakoColor color;
|
56
|
+
Uint32 a255;
|
57
|
+
Uint32 *ptr;
|
58
|
+
int x;
|
59
|
+
int y;
|
60
|
+
} MiyakoBitmap;
|
61
|
+
|
62
|
+
// from rubysdl.h
|
63
|
+
#define GLOBAL_DEFINE_GET_STRUCT(struct_name, fun, klass, klassstr) \
|
64
|
+
struct_name* fun(VALUE obj) \
|
65
|
+
{ \
|
66
|
+
struct_name* st; \
|
67
|
+
\
|
68
|
+
if(!rb_obj_is_kind_of(obj, klass)){ \
|
69
|
+
rb_raise(rb_eTypeError, "wrong argument type %s (expected " klassstr ")", \
|
70
|
+
rb_obj_classname(obj)); \
|
71
|
+
} \
|
72
|
+
Data_Get_Struct(obj, struct_name, st); \
|
73
|
+
return st; \
|
74
|
+
}
|
75
|
+
|
76
|
+
#define MIYAKO_GETCOLOR(COLOR) \
|
77
|
+
COLOR.r = (Uint32)(((pixel & fmt->Rmask) >> fmt->Rshift) << fmt->Rloss); \
|
78
|
+
COLOR.g = (Uint32)(((pixel & fmt->Gmask) >> fmt->Gshift) << fmt->Gloss); \
|
79
|
+
COLOR.b = (Uint32)(((pixel & fmt->Bmask) >> fmt->Bshift) << fmt->Bloss); \
|
80
|
+
COLOR.a = (Uint32)(((pixel & fmt->Amask) >> fmt->Ashift) << fmt->Aloss);
|
81
|
+
|
82
|
+
#define MIYAKO_SETCOLOR(RESULT, COLOR) \
|
83
|
+
RESULT = (COLOR.r >> fmt->Rloss) << fmt->Rshift | \
|
84
|
+
(COLOR.g >> fmt->Gloss) << fmt->Gshift | \
|
85
|
+
(COLOR.b >> fmt->Bloss) << fmt->Bshift | \
|
86
|
+
(COLOR.a >> fmt->Aloss) << fmt->Ashift;
|
87
|
+
|
88
|
+
#define MIYAKO_SET_RECT(RECT, BASE) \
|
89
|
+
RECT.x = NUM2INT(*(RSTRUCT_PTR(BASE) + 1)); \
|
90
|
+
RECT.y = NUM2INT(*(RSTRUCT_PTR(BASE) + 2)); \
|
91
|
+
RECT.w = NUM2INT(*(RSTRUCT_PTR(BASE) + 3)); \
|
92
|
+
RECT.h = NUM2INT(*(RSTRUCT_PTR(BASE) + 4));
|
93
|
+
|
94
|
+
#define MIYAKO_INIT_RECT1 \
|
95
|
+
int dlx = drect.x + x; \
|
96
|
+
int dly = drect.y + y; \
|
97
|
+
int dmx = dlx + (srect.w < drect.w ? srect.w : drect.w); \
|
98
|
+
int dmy = dly + (srect.h < drect.h ? srect.h : drect.h);
|
99
|
+
|
100
|
+
#define MIYAKO_INIT_RECT2 \
|
101
|
+
int dlx = drect.x; \
|
102
|
+
int dly = drect.y; \
|
103
|
+
int dmx = dlx + drect.w; \
|
104
|
+
int dmy = dly + drect.h;
|
105
|
+
|
106
|
+
#define MIYAKO_INIT_RECT3 \
|
107
|
+
if(s2rect.w != drect.w){ return Qnil; } \
|
108
|
+
if(s2rect.h != drect.h){ return Qnil; } \
|
109
|
+
int x1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 5)); \
|
110
|
+
int y1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 6)); \
|
111
|
+
int x2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 5)); \
|
112
|
+
int y2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 6)); \
|
113
|
+
if(s1rect.x < 0 || s1rect.y < 0 || s2rect.x < 0 || s2rect.y < 0){ return Qnil; } \
|
114
|
+
if(s1rect.w < s2rect.w && (x1+s1rect.x+s1rect.w > s2rect.w)){ return Qnil; } \
|
115
|
+
if(s2rect.w < s1rect.w && (x2+s2rect.x+s2rect.w > s1rect.w)){ return Qnil; } \
|
116
|
+
if(s1rect.h < s2rect.h && (y1+s1rect.y+s1rect.h > s2rect.h)){ return Qnil; } \
|
117
|
+
if(s2rect.h < s1rect.h && (y2+s2rect.y+s2rect.h > s1rect.h)){ return Qnil; } \
|
118
|
+
int dlx = drect.x; \
|
119
|
+
int dly = drect.y; \
|
120
|
+
int dmx = dlx + (s1rect.w < s2rect.w ? s1rect.w : s2rect.w); \
|
121
|
+
int dmy = dly + (s1rect.h < s2rect.h ? s1rect.h : s2rect.h);
|
122
|
+
|
123
|
+
#define MIYAKO_PSET(XX,YY) \
|
124
|
+
pixel = 0; \
|
125
|
+
if(dcolor.a == 0) \
|
126
|
+
{ \
|
127
|
+
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
128
|
+
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
129
|
+
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
130
|
+
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
131
|
+
continue; \
|
132
|
+
} \
|
133
|
+
if(scolor.a > 0) \
|
134
|
+
{ \
|
135
|
+
int a1 = scolor.a + 1; \
|
136
|
+
int a2 = 256 - scolor.a; \
|
137
|
+
scolor.r = (scolor.r * a1 + dcolor.r * a2) >> 8; \
|
138
|
+
scolor.g = (scolor.g * a1 + dcolor.g * a2) >> 8; \
|
139
|
+
scolor.b = (scolor.b * a1 + dcolor.b * a2) >> 8; \
|
140
|
+
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
141
|
+
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
142
|
+
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
143
|
+
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
144
|
+
}
|
data/extern.h
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
/*
|
2
|
-
--
|
3
|
-
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
-
Copyright (C) 2008 Cyross Makoto
|
5
|
-
|
6
|
-
This library is free software; you can redistribute it and/or
|
7
|
-
modify it under the terms of the GNU Lesser General Public
|
8
|
-
License as published by the Free Software Foundation; either
|
9
|
-
version 2.1 of the License, or (at your option) any later version.
|
10
|
-
|
11
|
-
This library is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
Lesser General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU Lesser General Public
|
17
|
-
License along with this library; if not, write to the Free Software
|
18
|
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
-
++
|
20
|
-
*/
|
21
|
-
|
22
|
-
extern void _miyako_setup_unit(VALUE unit, SDL_Surface *screen, MiyakoBitmap *mb, VALUE x, VALUE y, int use_yield);
|
23
|
-
extern void _miyako_setup_unit_2(VALUE unit_s, VALUE unit_d,
|
24
|
-
SDL_Surface *screen,
|
25
|
-
MiyakoBitmap *mb_s, MiyakoBitmap *mb_d,
|
26
|
-
VALUE x, VALUE y, int use_yield);
|
27
|
-
extern int _miyako_init_rect(MiyakoBitmap *src, MiyakoBitmap *dst, MiyakoSize *size);
|
28
|
-
extern void _miyako_yield_unit_1(MiyakoBitmap *src);
|
29
|
-
extern void _miyako_yield_unit_2(MiyakoBitmap *src, MiyakoBitmap *dst);
|
1
|
+
/*
|
2
|
+
--
|
3
|
+
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
+
Copyright (C) 2008 Cyross Makoto
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
++
|
20
|
+
*/
|
21
|
+
|
22
|
+
extern void _miyako_setup_unit(VALUE unit, SDL_Surface *screen, MiyakoBitmap *mb, VALUE x, VALUE y, int use_yield);
|
23
|
+
extern void _miyako_setup_unit_2(VALUE unit_s, VALUE unit_d,
|
24
|
+
SDL_Surface *screen,
|
25
|
+
MiyakoBitmap *mb_s, MiyakoBitmap *mb_d,
|
26
|
+
VALUE x, VALUE y, int use_yield);
|
27
|
+
extern int _miyako_init_rect(MiyakoBitmap *src, MiyakoBitmap *dst, MiyakoSize *size);
|
28
|
+
extern void _miyako_yield_unit_1(MiyakoBitmap *src);
|
29
|
+
extern void _miyako_yield_unit_2(MiyakoBitmap *src, MiyakoBitmap *dst);
|
data/install_miyako.rb
CHANGED
@@ -1,87 +1,87 @@
|
|
1
|
-
# Miyako2.0 install script
|
2
|
-
# 2009 Cyross Makoto
|
3
|
-
|
4
|
-
if RUBY_VERSION < '1.9.1'
|
5
|
-
puts 'Sorry. Miyako needs Ruby 1.9.1 or above...'
|
6
|
-
exit
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
require 'sdl'
|
11
|
-
rescue
|
12
|
-
puts 'Sorry. Miyako needs Ruby/SDL...'
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
|
16
|
-
if SDL::VERSION < '2.1'
|
17
|
-
puts 'Sorry. Miyako needs Ruby/SDL 2.1.0 or above...'
|
18
|
-
exit
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'rbconfig'
|
22
|
-
require 'fileutils'
|
23
|
-
require 'optparse'
|
24
|
-
|
25
|
-
option = { :noop => false, :verbose => true }
|
26
|
-
not_force = true
|
27
|
-
|
28
|
-
ARGV.options do |opt|
|
29
|
-
opt.on('--no-harm'){ option[:noop] = true }
|
30
|
-
opt.on('--force'){ not_force = false }
|
31
|
-
opt.on('--quiet'){ option[:verbose] = false }
|
32
|
-
|
33
|
-
opt.parse!
|
34
|
-
end
|
35
|
-
|
36
|
-
ext_dir = "./"
|
37
|
-
osn = Config::CONFIG["target_os"].downcase
|
38
|
-
if osn =~ /mswin|mingw|cygwin|bccwin/
|
39
|
-
ext_dir = "win/"
|
40
|
-
elsif osn =~ /darwin/ # Mac OS X
|
41
|
-
if ENV['SDL_CONFIG_PATH']
|
42
|
-
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
43
|
-
else
|
44
|
-
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
45
|
-
end
|
46
|
-
else # linux, U*IX...
|
47
|
-
if ENV['SDL_CONFIG_PATH']
|
48
|
-
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
49
|
-
else
|
50
|
-
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
sitelibdir = Config::CONFIG["sitelibdir"] + "/Miyako"
|
55
|
-
apidir = sitelibdir + "/API"
|
56
|
-
extdir = sitelibdir + "/EXT"
|
57
|
-
|
58
|
-
if FileTest.exist?(sitelibdir) && not_force
|
59
|
-
puts "#{sitelibdir} is arleady exists."
|
60
|
-
puts "Are you sure?(Y/else)"
|
61
|
-
exit unless $stdin.gets.split(//)[0].upcase == 'Y'
|
62
|
-
end
|
63
|
-
|
64
|
-
FileUtils.remove_dir(sitelibdir, true)
|
65
|
-
FileUtils.mkpath(sitelibdir, option)
|
66
|
-
FileUtils.mkpath(apidir, option)
|
67
|
-
FileUtils.mkpath(extdir, option)
|
68
|
-
|
69
|
-
if osn =~ /darwin/ # Mac OS X
|
70
|
-
Dir.glob(ext_dir + "*.bundle"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
71
|
-
else # Windows, linux, U*IX...
|
72
|
-
Dir.glob(ext_dir + "*.so"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
73
|
-
end
|
74
|
-
Dir.glob("lib/Miyako/*.rb"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
75
|
-
Dir.glob("lib/Miyako/API/*.rb"){|fname| FileUtils.install(fname, apidir, option)}
|
76
|
-
Dir.glob("lib/Miyako/EXT/*.rb"){|fname| FileUtils.install(fname, extdir, option)}
|
77
|
-
|
78
|
-
unless osn =~ /mswin|mingw|cygwin|bccwin/
|
79
|
-
FileUtils.chmod(0755, sitelibdir)
|
80
|
-
FileUtils.chmod(0755, apidir)
|
81
|
-
FileUtils.chmod(0755, extdir)
|
82
|
-
FileUtils.chmod(0644, sitelibdir+'/miyako.rb')
|
83
|
-
Dir.glob(sitelibdir+"/*.so"){|fname| FileUtils.chmod(0644, fname)} # for linux,bsd
|
84
|
-
Dir.glob(sitelibdir+"/*.bundle"){|fname| FileUtils.chmod(0644, fname)} # for macosx
|
85
|
-
Dir.glob(apidir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
86
|
-
Dir.glob(extdir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
87
|
-
end
|
1
|
+
# Miyako2.0 install script
|
2
|
+
# 2009 Cyross Makoto
|
3
|
+
|
4
|
+
if RUBY_VERSION < '1.9.1'
|
5
|
+
puts 'Sorry. Miyako needs Ruby 1.9.1 or above...'
|
6
|
+
exit
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'sdl'
|
11
|
+
rescue
|
12
|
+
puts 'Sorry. Miyako needs Ruby/SDL...'
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
if SDL::VERSION < '2.1'
|
17
|
+
puts 'Sorry. Miyako needs Ruby/SDL 2.1.0 or above...'
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rbconfig'
|
22
|
+
require 'fileutils'
|
23
|
+
require 'optparse'
|
24
|
+
|
25
|
+
option = { :noop => false, :verbose => true }
|
26
|
+
not_force = true
|
27
|
+
|
28
|
+
ARGV.options do |opt|
|
29
|
+
opt.on('--no-harm'){ option[:noop] = true }
|
30
|
+
opt.on('--force'){ not_force = false }
|
31
|
+
opt.on('--quiet'){ option[:verbose] = false }
|
32
|
+
|
33
|
+
opt.parse!
|
34
|
+
end
|
35
|
+
|
36
|
+
ext_dir = "./"
|
37
|
+
osn = Config::CONFIG["target_os"].downcase
|
38
|
+
if osn =~ /mswin|mingw|cygwin|bccwin/
|
39
|
+
ext_dir = "win/"
|
40
|
+
elsif osn =~ /darwin/ # Mac OS X
|
41
|
+
if ENV['SDL_CONFIG_PATH']
|
42
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
43
|
+
else
|
44
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
45
|
+
end
|
46
|
+
else # linux, U*IX...
|
47
|
+
if ENV['SDL_CONFIG_PATH']
|
48
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
49
|
+
else
|
50
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
sitelibdir = Config::CONFIG["sitelibdir"] + "/Miyako"
|
55
|
+
apidir = sitelibdir + "/API"
|
56
|
+
extdir = sitelibdir + "/EXT"
|
57
|
+
|
58
|
+
if FileTest.exist?(sitelibdir) && not_force
|
59
|
+
puts "#{sitelibdir} is arleady exists."
|
60
|
+
puts "Are you sure?(Y/else)"
|
61
|
+
exit unless $stdin.gets.split(//)[0].upcase == 'Y'
|
62
|
+
end
|
63
|
+
|
64
|
+
FileUtils.remove_dir(sitelibdir, true)
|
65
|
+
FileUtils.mkpath(sitelibdir, option)
|
66
|
+
FileUtils.mkpath(apidir, option)
|
67
|
+
FileUtils.mkpath(extdir, option)
|
68
|
+
|
69
|
+
if osn =~ /darwin/ # Mac OS X
|
70
|
+
Dir.glob(ext_dir + "*.bundle"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
71
|
+
else # Windows, linux, U*IX...
|
72
|
+
Dir.glob(ext_dir + "*.so"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
73
|
+
end
|
74
|
+
Dir.glob("lib/Miyako/*.rb"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
75
|
+
Dir.glob("lib/Miyako/API/*.rb"){|fname| FileUtils.install(fname, apidir, option)}
|
76
|
+
Dir.glob("lib/Miyako/EXT/*.rb"){|fname| FileUtils.install(fname, extdir, option)}
|
77
|
+
|
78
|
+
unless osn =~ /mswin|mingw|cygwin|bccwin/
|
79
|
+
FileUtils.chmod(0755, sitelibdir)
|
80
|
+
FileUtils.chmod(0755, apidir)
|
81
|
+
FileUtils.chmod(0755, extdir)
|
82
|
+
FileUtils.chmod(0644, sitelibdir+'/miyako.rb')
|
83
|
+
Dir.glob(sitelibdir+"/*.so"){|fname| FileUtils.chmod(0644, fname)} # for linux,bsd
|
84
|
+
Dir.glob(sitelibdir+"/*.bundle"){|fname| FileUtils.chmod(0644, fname)} # for macosx
|
85
|
+
Dir.glob(apidir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
86
|
+
Dir.glob(extdir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
87
|
+
end
|