dxruby64 1.4.7
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/LICENSE.txt +14 -0
- data/README-ja.md +125 -0
- data/README.md +120 -0
- data/lib/31/dxruby.so +0 -0
- data/lib/32/dxruby.so +0 -0
- data/lib/33/dxruby.so +0 -0
- data/lib/34/dxruby.so +0 -0
- data/lib/dxruby.rb +2 -0
- data/sample/classic_sample/8_puzzle.rb +55 -0
- data/sample/classic_sample/block_destroy.rb +161 -0
- data/sample/classic_sample/block_fall.rb +194 -0
- data/sample/classic_sample/data.png +0 -0
- data/sample/classic_sample/dot.rb +80 -0
- data/sample/classic_sample/drawtile.rb +173 -0
- data/sample/classic_sample/flight.rb +75 -0
- data/sample/classic_sample/hitrangeview.rb +66 -0
- data/sample/classic_sample/mapedit.rb +270 -0
- data/sample/classic_sample/meiro.rb +106 -0
- data/sample/classic_sample/minsample.rb +14 -0
- data/sample/classic_sample/race.rb +119 -0
- data/sample/classic_sample/readme_sample.txt +42 -0
- data/sample/classic_sample/sample.rb +110 -0
- data/sample/classic_sample/soundeffect.rb +46 -0
- data/sample/new_sample/biyo.rb +25 -0
- data/sample/new_sample/image/enemy1.png +0 -0
- data/sample/new_sample/image/enemy1bomb.png +0 -0
- data/sample/new_sample/image/enemy2.png +0 -0
- data/sample/new_sample/image/enemy2bomb.png +0 -0
- data/sample/new_sample/image/enemyshot1.png +0 -0
- data/sample/new_sample/image/enemyshot2.png +0 -0
- data/sample/new_sample/image/maptile.png +0 -0
- data/sample/new_sample/image/myship.png +0 -0
- data/sample/new_sample/image/myshot.png +0 -0
- data/sample/new_sample/iraira.rb +49 -0
- data/sample/new_sample/laser2.rb +292 -0
- data/sample/new_sample/raycast.rb +249 -0
- data/sample/new_sample/readme_sample.txt +27 -0
- data/sample/new_sample/rubima.rb +597 -0
- data/sample/new_sample/ruby.png +0 -0
- data/sample/new_sample/slg.rb +82 -0
- data/sample/new_sample/sprite_animation.rb +133 -0
- data/sample/new_sample/sprite_collision1.rb +216 -0
- data/sample/new_sample/sprite_collision2.rb +93 -0
- data/sample/new_sample/sprite_simple.rb +65 -0
- data/sample/new_sample2/ImageFont.dat +0 -0
- data/sample/new_sample2/ImageFont.dat.png +0 -0
- data/sample/new_sample2/autocall.rb +24 -0
- data/sample/new_sample2/effecttest.rb +136 -0
- data/sample/new_sample2/fibersprite.rb +89 -0
- data/sample/new_sample2/hitrange.rb +133 -0
- data/sample/new_sample2/hlstest.rb +27 -0
- data/sample/new_sample2/mapedit_perlin.rb +291 -0
- data/sample/new_sample2/noise.rb +33 -0
- data/sample/new_sample2/particle.rb +220 -0
- data/sample/new_sample2/readme_sample.txt +29 -0
- data/sample/new_sample2/scenetest.rb +200 -0
- data/sample/new_sample2/scenetest2.rb +120 -0
- data/sample/scroll_sample/map.dat +32 -0
- data/sample/scroll_sample/map.rb +77 -0
- data/sample/scroll_sample/map_sub.dat +32 -0
- data/sample/scroll_sample/mapedit.rb +102 -0
- data/sample/scroll_sample/readme_sample.txt +24 -0
- data/sample/scroll_sample/scroll1.rb +108 -0
- data/sample/scroll_sample/scroll2.rb +149 -0
- data/sample/scroll_sample/scroll3.rb +148 -0
- data/sample/scroll_sample/simple.rb +13 -0
- data/sample/shader_sample/Shader/Flash.rb +93 -0
- data/sample/shader_sample/Shader/RasterScroll.rb +71 -0
- data/sample/shader_sample/Shader/RgssSprite.rb +143 -0
- data/sample/shader_sample/Shader/Transition.rb +108 -0
- data/sample/shader_sample/bgimage/BG00a1_80.jpg +0 -0
- data/sample/shader_sample/bgimage/BG10a_80.jpg +0 -0
- data/sample/shader_sample/bgimage/BG13a_80.jpg +0 -0
- data/sample/shader_sample/bgimage/BG32a.jpg +0 -0
- data/sample/shader_sample/bgimage/BG42a.jpg +0 -0
- data/sample/shader_sample/bgimage/course.png +0 -0
- data/sample/shader_sample/bgimage/image1.png +0 -0
- data/sample/shader_sample/bgimage/world_map2.png +0 -0
- data/sample/shader_sample/fan.rb +53 -0
- data/sample/shader_sample/image/enemy1.png +0 -0
- data/sample/shader_sample/image/enemy2.png +0 -0
- data/sample/shader_sample/image/maptile.png +0 -0
- data/sample/shader_sample/readme_sample.txt +43 -0
- data/sample/shader_sample/rule//343/203/201/343/202/247/343/203/203/343/202/253/343/203/274.png +0 -0
- data/sample/shader_sample/rule//345/217/263/346/270/246/345/267/273/343/201/215.png +0 -0
- data/sample/shader_sample/rule//346/250/252/343/203/226/343/203/251/343/202/244/343/203/263/343/203/211.png +0 -0
- data/sample/shader_sample/sample_blur.rb +112 -0
- data/sample/shader_sample/sample_divide.rb +91 -0
- data/sample/shader_sample/sample_flash.rb +54 -0
- data/sample/shader_sample/sample_lens.rb +65 -0
- data/sample/shader_sample/sample_mapping.rb +50 -0
- data/sample/shader_sample/sample_rasterscroll.rb +48 -0
- data/sample/shader_sample/sample_rgsssprite.rb +41 -0
- data/sample/shader_sample/sample_spehari.rb +50 -0
- data/sample/shader_sample/sample_sphere.rb +66 -0
- data/sample/shader_sample/sample_transition.rb +62 -0
- data/sample/shader_sample/sample_vertexshader.rb +223 -0
- data/sample/shader_sample/sample_wingman.rb +47 -0
- data/sample/shader_sample/turn_transition.rb +74 -0
- metadata +141 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
# DXRuby �T���v�� �R�c���H
|
3
|
+
require 'dxruby'
|
4
|
+
|
5
|
+
# �}�b�v
|
6
|
+
map = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
7
|
+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
|
8
|
+
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1],
|
9
|
+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1],
|
10
|
+
[1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1],
|
11
|
+
[1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
|
12
|
+
[1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1],
|
13
|
+
[1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1],
|
14
|
+
[1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1],
|
15
|
+
[1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1],
|
16
|
+
[1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
|
17
|
+
[1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1],
|
18
|
+
[1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1],
|
19
|
+
[1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1],
|
20
|
+
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1],
|
21
|
+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
22
|
+
]
|
23
|
+
|
24
|
+
x = 1
|
25
|
+
y = 1
|
26
|
+
angle = 1
|
27
|
+
|
28
|
+
# �����ɂ�鑝��
|
29
|
+
angledata = [[0, -1], [1, 0], [0, 1], [-1, 0]]
|
30
|
+
|
31
|
+
block = Image.new(16, 16, [255, 255, 255, 255])
|
32
|
+
image = Array.new(4) {Array.new(3) {Image.new(256, 256)}}
|
33
|
+
jibun = Image.new(16, 16, [255, 255, 0, 0])
|
34
|
+
|
35
|
+
# 3D�摜����
|
36
|
+
# �v�Z�ł��Ȃ苭���ɍ���Ă���
|
37
|
+
# ���ꂼ��̋������Ƃ��Y��ȉ摜������ēǂݍ��ق����悢�Ǝv���܂�
|
38
|
+
for i in 0..3
|
39
|
+
for j in 0..2
|
40
|
+
if i != 3
|
41
|
+
x1 = ((32 + 192 * (j - 1)) - 128) / (3 - i) + 128
|
42
|
+
y1 = (32 - 128) / (3 - i) + 128
|
43
|
+
x2 = ((224 + 192 * (j - 1)) - 128) / (3 - i) + 128
|
44
|
+
y2 = (224 - 128) / (3 - i) + 128
|
45
|
+
image[i][j].boxFill(x1, y1, x2, y2, [255, 255/(3 - i), 255/(3 - i), 255/(3 - i)])
|
46
|
+
else
|
47
|
+
x1 = 256
|
48
|
+
y1 = 0
|
49
|
+
x2 = 0
|
50
|
+
y2 = 256
|
51
|
+
end
|
52
|
+
if j == 0
|
53
|
+
x3 = (((224 + 192 * (j - 1)) - 128) / (4 - i) + 128)
|
54
|
+
y3 = (32 - 128) / (4 - i) + 128
|
55
|
+
y4 = (224 - 128) / (4 - i) + 128
|
56
|
+
for k in 0..(x3-x2)
|
57
|
+
image[i][j].line(k+x2, y1 + (y3 - y1) / (x3-x2) * k, k+x2, y2 + (y4 - y2) / (x3-x2) * k, [255,128/(4 - i),128/(4 - i),255/(4 - i)])
|
58
|
+
end
|
59
|
+
elsif j == 2
|
60
|
+
x3 = (((32 + 192 * (j - 1)) - 128) / (4 - i) + 128)
|
61
|
+
y3 = (32 - 128) / (4 - i) + 128
|
62
|
+
y4 = (224 - 128) / (4 - i) + 128
|
63
|
+
for k in 0..(x1 - x3)
|
64
|
+
image[i][j].line(x1 - k, y1 + (y3 - y1) / (x1-x3) * k, x1 - k, y2 + (y4 - y2) / (x1-x3) * k, [255,128/(4 - i),128/(4 - i),255/(4 - i)])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
Window.loop do
|
71
|
+
# ���E������
|
72
|
+
angle += Input.x if Input.padPush?(P_LEFT) or Input.padPush?(P_RIGHT)
|
73
|
+
angle = 0 if angle > 3
|
74
|
+
angle = 3 if angle < 0
|
75
|
+
|
76
|
+
# �エ����
|
77
|
+
if Input.padPush?(P_UP) or Input.padPush?(P_DOWN)
|
78
|
+
newx = x + angledata[angle - Input.y - 1][0]
|
79
|
+
newy = y + angledata[angle - Input.y - 1][1]
|
80
|
+
x, y = newx, newy if map[newy][newx] == 0
|
81
|
+
end
|
82
|
+
|
83
|
+
# 3D��ʕ`��
|
84
|
+
for i in 0..3
|
85
|
+
for j in 0..2
|
86
|
+
jx = x + angledata[angle - 3][0] * (j - 1) + angledata[angle - 2][0] * (i - 3)
|
87
|
+
iy = y + angledata[angle - 2][1] * (i - 3) + angledata[angle - 3][1] * (j - 1)
|
88
|
+
next if iy < 0 or iy > 15 or jx < 0 or jx > 15
|
89
|
+
if map[iy][jx] == 1
|
90
|
+
Window.draw(0, 0, image[i][j], i - (j - 1).abs)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# �E�̃}�b�v
|
96
|
+
for i in 0..15
|
97
|
+
for j in 0..15
|
98
|
+
Window.draw(j * 16 + 288, i * 16, block) if map[i][j] == 1
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# �����i�Ԃ̎l�p�����ǁj�`��
|
103
|
+
Window.draw(x * 16 + 288, y * 16, jibun)
|
104
|
+
|
105
|
+
break if Input.keyPush?(K_ESCAPE)
|
106
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
# DXRuby data.png���J�[�\���L�[�œ����T���v��
|
3
|
+
require 'dxruby'
|
4
|
+
|
5
|
+
x = 0 # x���W�̕ϐ�
|
6
|
+
y = 0 # y���W�̕ϐ�
|
7
|
+
image = Image.load("data.png") # data.png��ǂݍ���
|
8
|
+
|
9
|
+
Window.loop do # ���C�����[�v
|
10
|
+
x = x + Input.x # �������̓��͂�x���W��ύX
|
11
|
+
y = y + Input.y # �c�����̓��͂�y���W��ύX
|
12
|
+
|
13
|
+
Window.draw(x, y, image) # data.bmp�����W�̈ʒu�ɕ\��
|
14
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
# DXRuby �T���v�� �~�j���[�V���O
|
3
|
+
# ���E�ʼn�]�AZ�ʼn����AX�Ńo�b�N�B
|
4
|
+
require 'dxruby'
|
5
|
+
|
6
|
+
Window.caption = "�~�j���[�V���O"
|
7
|
+
|
8
|
+
# �R�[�X�f�[�^
|
9
|
+
line1 = [53, 430, 568, 438, 568, 438, 607, 261, 607, 261, 520, 200, 520, 200, 531, 151,
|
10
|
+
531, 151, 602, 115, 602, 115, 562, 19, 562, 19, 113, 21, 113, 21, 34, 83,
|
11
|
+
34, 83, 81, 180, 81, 180, 221, 207, 221, 207, 251, 274, 251, 274, 204, 299,
|
12
|
+
204, 299, 61, 262, 61, 262, 26, 358, 26, 358, 53, 430]
|
13
|
+
line2 = [93, 330, 88, 380, 88, 380, 479, 392, 479, 392, 536, 302, 536, 302, 534, 267,
|
14
|
+
534, 267, 461, 210, 461, 210, 459, 151, 459, 151, 518, 91, 518, 91, 487, 53,
|
15
|
+
487, 53, 156, 77, 156, 77, 125, 110, 125, 110, 292, 197, 292, 197, 311, 268,
|
16
|
+
311, 268, 227, 342, 227, 342, 93, 330]
|
17
|
+
|
18
|
+
# �R�[�X�쐬
|
19
|
+
$course = Image.new(640, 480, [0, 200, 0])
|
20
|
+
for i in 0..(line1.size/2-2)
|
21
|
+
$course.line(line1[i*2], line1[i*2+1], line1[i*2+2], line1[i*2+3], [128, 128, 128])
|
22
|
+
end
|
23
|
+
for i in 0..(line2.size/2-2)
|
24
|
+
$course.line(line2[i*2], line2[i*2+1], line2[i*2+2], line2[i*2+3], [128, 128, 128])
|
25
|
+
end
|
26
|
+
|
27
|
+
# ���O�œh��Ԃ�
|
28
|
+
Green = [0, 200, 0]
|
29
|
+
Gray = [128, 128, 128]
|
30
|
+
def paint(x, y, col)
|
31
|
+
arr = []
|
32
|
+
loop do
|
33
|
+
px = x
|
34
|
+
flag = [1, 1]
|
35
|
+
return if y < 0 or y > 479
|
36
|
+
while px > 0 and $course.compare(px-1, y, Green) do # ���[�܂Ō���
|
37
|
+
px = px - 1
|
38
|
+
end
|
39
|
+
lx = px
|
40
|
+
while px <= 639 and $course.compare(px, y, Green) do # �E�[�܂œh��
|
41
|
+
(0..1).each do |i|
|
42
|
+
if $course.compare(px, y+i*2-1, Green) then
|
43
|
+
if flag[i] == 1 then
|
44
|
+
arr.push([px, y+i*2-1, col]) # �㉺�ɋ�����ċA�œh��o�^
|
45
|
+
flag[i] = 0
|
46
|
+
end
|
47
|
+
else
|
48
|
+
flag[i] = 1
|
49
|
+
end
|
50
|
+
end
|
51
|
+
px = px + 1
|
52
|
+
end
|
53
|
+
$course.line(lx, y, px-1, y, Gray)
|
54
|
+
|
55
|
+
if arr.size != 1 then
|
56
|
+
break
|
57
|
+
end
|
58
|
+
x = arr[0][0]
|
59
|
+
y = arr[0][1]
|
60
|
+
col = arr[0][2]
|
61
|
+
arr = []
|
62
|
+
end
|
63
|
+
|
64
|
+
arr.each do |ax, ay, acol|
|
65
|
+
paint(ax,ay,acol) # �ċA�Ăяo��
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
paint(200,300,[128,128,128])
|
71
|
+
|
72
|
+
# �ԃf�[�^
|
73
|
+
carimage = Image.new(8,8)
|
74
|
+
carimage.boxFill(0, 1, 7, 6, [255, 0, 0]).boxFill(5, 2, 6, 5, [0, 0, 255]).
|
75
|
+
line(0, 0, 1, 0, [0, 0, 0]).line(5, 0, 6, 0, [0, 0, 0]).
|
76
|
+
line(0, 7, 1, 7, [0, 0, 0]).line(5, 7, 6, 7, [0, 0, 0])
|
77
|
+
|
78
|
+
x = 200
|
79
|
+
y = 300
|
80
|
+
angle = 0
|
81
|
+
speed = 0
|
82
|
+
dx = 0
|
83
|
+
dy = 0
|
84
|
+
|
85
|
+
Window.scale = 2
|
86
|
+
Window.width = 200
|
87
|
+
Window.height = 200
|
88
|
+
|
89
|
+
image = Image.new(200, 200, Green)
|
90
|
+
|
91
|
+
Window.loop do
|
92
|
+
# �ړ�����
|
93
|
+
speed = speed + 0.1 if Input.padDown?(P_BUTTON0) and speed < 4
|
94
|
+
speed = speed - 0.1 if Input.padDown?(P_BUTTON1) and speed > -2
|
95
|
+
angle = angle - 45 if Input.padPush?(P_LEFT)
|
96
|
+
angle = angle + 45 if Input.padPush?(P_RIGHT)
|
97
|
+
|
98
|
+
dx = dx * 0.95 + Math.cos(Math::PI / 180 * angle) * speed * 0.05
|
99
|
+
dy = dy * 0.95 + Math.sin(Math::PI / 180 * angle) * speed * 0.05
|
100
|
+
x = x + dx
|
101
|
+
y = y + dy
|
102
|
+
|
103
|
+
# image�I�u�W�F�N�g�ҏW
|
104
|
+
image.copyRect(0, 0, $course, x, y, 200, 200)
|
105
|
+
|
106
|
+
# �`��
|
107
|
+
Window.draw(0, 0, image)
|
108
|
+
Window.drawRot(96, 96, carimage, angle)
|
109
|
+
|
110
|
+
if image.compare(100, 100, Green) then
|
111
|
+
dx = -dx
|
112
|
+
dy = -dy
|
113
|
+
x = x + dx
|
114
|
+
y = y + dy
|
115
|
+
speed = 0.5
|
116
|
+
end
|
117
|
+
|
118
|
+
break if Input.keyPush?(K_ESCAPE)
|
119
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
DXRuby �T���v���v���O����
|
2
|
+
|
3
|
+
�܂��ŏ��ɁA�\�[�X�������Ă��߂�Ȃ����B
|
4
|
+
�e�L�g�[�ɍ�������̂������Q�l�ɂȂ���Ċ����ŋl�ߍ���ł���܂��B
|
5
|
+
|
6
|
+
8_puzzle
|
7
|
+
�E�E�E�W�p�Y���ł��B�摜��ǂݍ���ŗV��ł݂Ă��������B
|
8
|
+
|
9
|
+
block_destory
|
10
|
+
�E�E�E�p��łȂ�Ă�����ł����ˁB�����ł����A�킩��܂���I�u���b�N�����ł��B
|
11
|
+
|
12
|
+
block_fall
|
13
|
+
�E�E�E�L���ȃA�����h�L�ł��B
|
14
|
+
|
15
|
+
dot
|
16
|
+
�E�E�E�����~���Ă���f���ł��B�}�E�X�ł������Ă��������B
|
17
|
+
|
18
|
+
drawtile
|
19
|
+
�E�E�EWindow.drawTile��RenderTarget�N���X�̃f���B�}�b�v��2���C���`������Ă��܂��B
|
20
|
+
|
21
|
+
flight
|
22
|
+
�E�E�E�����ł���ۂ��^��3D�\���̃T���v���ł��B�J�[�\���L�[�œ����܂��B
|
23
|
+
|
24
|
+
mapedit
|
25
|
+
�E�E�E�^��3D�̊ȈՃ}�b�v�G�f�B�^�ł��Bshift�����Ȃ���N���b�N�œy�n�̏グ�����ł��܂��B
|
26
|
+
|
27
|
+
meiro
|
28
|
+
�E�E�E3D���H�ł��B
|
29
|
+
|
30
|
+
minsanple
|
31
|
+
�E�E�E�ł��ȒP�ȃT���v���ł��B
|
32
|
+
|
33
|
+
race
|
34
|
+
�E�E�E���[�X���h�L�ł��BImage�I�u�W�F�N�g��copyRect���\�b�h���g���Ă��܂��B
|
35
|
+
|
36
|
+
sample
|
37
|
+
�E�E�EWindow���W���[���̊e��@�\�̃T���v���ƂȂ��Ă��܂��B
|
38
|
+
|
39
|
+
soundeffect
|
40
|
+
�E�E�ESoundEffect�N���X�̃T���v���ł��BZXC�L�[�ʼn����ł܂��B
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
# DXRuby �T���v���v���O����
|
3
|
+
|
4
|
+
# ���C�u�����̎�荞��
|
5
|
+
require 'dxruby'
|
6
|
+
|
7
|
+
# ���ʒu�B�ȗ������OS�f�t�H���g
|
8
|
+
#Window.x = 0
|
9
|
+
#Window.y = 0
|
10
|
+
|
11
|
+
# �X�N���[���C���[�W�T�C�Y�B�ȗ�����Ƃ��̃T�C�Y
|
12
|
+
#Window.width = 640
|
13
|
+
#Window.height = 480
|
14
|
+
|
15
|
+
# �E�B���h�E�̃L���v�V�����B�ȗ�����ƁuDXRuby Application�v
|
16
|
+
Window.caption = "�T���v��"
|
17
|
+
|
18
|
+
# �X�N���[���C���[�W�T�C�Y�ɑ���E�B���h�E�̔{���B�Q�ɂ���Əc��2�{�ŕ\�������B
|
19
|
+
# ����ɃA���`�G�C���A�V���O�����B
|
20
|
+
# �ȗ�����ƂP�B
|
21
|
+
#Window.scale = 1
|
22
|
+
|
23
|
+
# �E�B���h�E���[�h�ɂ��邩�ǂ����Btrue�ŃE�B���h�E�Bfalse�Ńt���X�N���[���B
|
24
|
+
# �ȗ������true�B
|
25
|
+
#Window.windowed = true
|
26
|
+
|
27
|
+
# �b�ԍX�V�p�x��ݒ肷��B
|
28
|
+
# �ȗ������60�B
|
29
|
+
#Window.fps = 60
|
30
|
+
|
31
|
+
# �d����fps�����Ȃ��ꍇ�ɕ`����X�L�b�v����w��B
|
32
|
+
# �ȗ������false
|
33
|
+
#Window.frameskip = false
|
34
|
+
|
35
|
+
# �摜�t�@�C����ǂݍ���ŃC���[�W�I�u�W�F�N�g���쐬����B
|
36
|
+
# jpg�Ƃ�bmp�Ƃ�png�Ƃ����g����B
|
37
|
+
image = Image.load("data.png")
|
38
|
+
|
39
|
+
# �L�����̏�Ԃ�ݒ肷��
|
40
|
+
x = 100
|
41
|
+
y = 100
|
42
|
+
rot = 0
|
43
|
+
scale = 1
|
44
|
+
alpha = 255
|
45
|
+
|
46
|
+
# �E�B���h�E������ꂽ�玩���I�ɏI�����郋�[�v
|
47
|
+
Window.loop do
|
48
|
+
|
49
|
+
# �L�����������肷��
|
50
|
+
# x��y���\�b�h�̓p�b�h���͂�x���W��y���W�̑���(-1�A0�A1)�ŕԂ��B
|
51
|
+
# �����̓p�b�h�ԍ��B0�̓L�[�{�[�h�ƌ��p�B�ȗ���0�B
|
52
|
+
x = x + Input.x
|
53
|
+
y = y + Input.y
|
54
|
+
|
55
|
+
# Z����������N���N�����
|
56
|
+
# ��2�����͓��͂���{�^���B
|
57
|
+
# Z�ɂ̓p�b�h�̃{�^��0���W���Ŋ��蓖�Ă��Ă���B
|
58
|
+
if Input.keyDown?(K_Z) == true then
|
59
|
+
rot = rot + 5
|
60
|
+
if rot > 359 then
|
61
|
+
rot = rot - 360
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# X����������T�C�Y�ύX
|
66
|
+
# X�ɂ̓p�b�h�̃{�^��1���W���Ŋ��蓖�Ă��Ă���B
|
67
|
+
if Input.keyDown?(K_X) == true then
|
68
|
+
scale = scale + 0.05
|
69
|
+
if scale > 2 then
|
70
|
+
scale= 0.2
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# C���������甼����
|
75
|
+
# C�ɂ̓p�b�h�̃{�^��2���W���Ŋ��蓖�Ă��Ă���B
|
76
|
+
if Input.keyDown?(K_C) == true then
|
77
|
+
alpha = alpha - 2
|
78
|
+
if alpha < 0 then
|
79
|
+
alpha= 255
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# ���ʂɕ`�悷��
|
84
|
+
Window.draw(x + 50, y + 100, image)
|
85
|
+
|
86
|
+
# �Ȃ��ăL������`�悷��
|
87
|
+
Window.drawRot(x, y, image, rot) # ��](0����ʼnE���B360�ň��)
|
88
|
+
Window.drawScale(x + 50, y, image, scale, scale) # �g��k��(1����Ŕ{����\��)
|
89
|
+
Window.drawAlpha(x + 100, y, image, alpha) # ������(0��������255���ʏ�`��)
|
90
|
+
|
91
|
+
# �S�������ɓK�p���郁�\�b�h�͂�����
|
92
|
+
Window.drawEx(x + 50, y + 50, image, :angle => rot, :scalex => scale, :scaley => scale, :alpha => alpha)
|
93
|
+
|
94
|
+
# �G�X�P�[�v�L�[�ŏI��
|
95
|
+
if Input.keyDown?(K_ESCAPE) == true then
|
96
|
+
break
|
97
|
+
end
|
98
|
+
|
99
|
+
# �X�N���[���V���b�g�@�\
|
100
|
+
if Input.keyPush?(K_F12) == true then
|
101
|
+
if ! File.exist?("screenshot") then
|
102
|
+
Dir.mkdir("screenshot")
|
103
|
+
end
|
104
|
+
Window.getScreenShot("screenshot/screenshot" + Time.now.strftime("%Y%m%d_%H%M%S") + ".jpg")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
# DXRuby ���ʉ��T���v��
|
3
|
+
# ZXC�L�[�ʼn����o�܂�
|
4
|
+
require 'dxruby'
|
5
|
+
|
6
|
+
# �����[��
|
7
|
+
v = 100.0
|
8
|
+
c = 60
|
9
|
+
f = 1300
|
10
|
+
s1 = SoundEffect.new(500) do
|
11
|
+
c = c - 1
|
12
|
+
if c < 0 then
|
13
|
+
v = v - 0.2
|
14
|
+
f = 1760
|
15
|
+
end
|
16
|
+
[f, v]
|
17
|
+
end
|
18
|
+
|
19
|
+
# �a��
|
20
|
+
s2 = SoundEffect.new(1000,WAVE_TRI) do # �ቹ�͎O�p�g
|
21
|
+
[110, 80]
|
22
|
+
end
|
23
|
+
s2.add(WAVE_RECT) do # ��`�g
|
24
|
+
[275, 40]
|
25
|
+
end
|
26
|
+
s2.add(WAVE_RECT) do # ��`�g
|
27
|
+
[330, 40]
|
28
|
+
end
|
29
|
+
|
30
|
+
# ���g���ϒ�
|
31
|
+
f = 0
|
32
|
+
v = 150.0
|
33
|
+
s3 = SoundEffect.new(500, WAVE_SIN) do
|
34
|
+
f = f + 1
|
35
|
+
v = v - 0.2
|
36
|
+
[880 + Math.sin(f) * 200, v]
|
37
|
+
end
|
38
|
+
|
39
|
+
# ���C�����[�v
|
40
|
+
Window.loop do
|
41
|
+
break if Input.keyDown?(K_ESCAPE)
|
42
|
+
s1.play if Input.keyPush?(K_Z)
|
43
|
+
s2.play if Input.keyPush?(K_X)
|
44
|
+
s3.play if Input.keyPush?(K_C)
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!ruby -Ks
|
2
|
+
require 'dxruby'
|
3
|
+
|
4
|
+
font = Font.new(100)
|
5
|
+
image = Image.new(100,100).draw_font(0,0,"��",font)
|
6
|
+
|
7
|
+
x = mx = 299
|
8
|
+
y = my = 299
|
9
|
+
dx = 0
|
10
|
+
dy = 0
|
11
|
+
Window.loop do
|
12
|
+
Window.draw_morph(200,200,299,200,x,y,200,299,image, :dividex=>10, :dividey=>10)
|
13
|
+
if Input.key_down?(K_SPACE)
|
14
|
+
x += 1
|
15
|
+
y += 1
|
16
|
+
else
|
17
|
+
dx += (mx - x) / 10
|
18
|
+
dy += (my - y) / 10
|
19
|
+
dx *= 0.95
|
20
|
+
dy *= 0.95
|
21
|
+
x += dx
|
22
|
+
y += dy
|
23
|
+
end
|
24
|
+
break if Input.key_push?(K_ESCAPE)
|
25
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'dxruby'
|
2
|
+
|
3
|
+
def create_block_sprite(*ary)
|
4
|
+
image = Image.new(640,480)
|
5
|
+
col = []
|
6
|
+
ary.each do |a|
|
7
|
+
case a.size
|
8
|
+
when 3
|
9
|
+
image.circle_fill(a[0], a[1], a[2], C_RED)
|
10
|
+
when 4
|
11
|
+
image.box_fill(a[0], a[1], a[2], a[3], C_CYAN)
|
12
|
+
end
|
13
|
+
col << a
|
14
|
+
end
|
15
|
+
s = Sprite.new(0, 0, image)
|
16
|
+
s.collision = col
|
17
|
+
return s
|
18
|
+
end
|
19
|
+
|
20
|
+
block1 = create_block_sprite([100,100,150,380], [490,100,540,380])
|
21
|
+
block2 = create_block_sprite([100,100,150,380], [490,100,540,380])
|
22
|
+
block2.angle = 90
|
23
|
+
block3 = create_block_sprite([100,100,150,380], [490,100,540,380])
|
24
|
+
block3.angle = 45
|
25
|
+
block4 = create_block_sprite([100,100,150,380], [490,100,540,380])
|
26
|
+
block4.angle = 135
|
27
|
+
circle = create_block_sprite([320, 240, 100])
|
28
|
+
bar = create_block_sprite([300, 60, 340, 420])
|
29
|
+
|
30
|
+
objects = [block1, block2, block3, block4, circle, bar]
|
31
|
+
|
32
|
+
cursor = Sprite.new(0, 0, Image.new(10, 10).circle_fill(5, 5, 5, C_WHITE))
|
33
|
+
Input.set_mouse_pos(0, 0)
|
34
|
+
|
35
|
+
Window.loop do
|
36
|
+
cursor.x, cursor.y = Input.mouse_pos_x, Input.mouse_pos_y
|
37
|
+
block1.angle += 0.05
|
38
|
+
block2.angle += 0.05
|
39
|
+
block3.angle -= 0.1
|
40
|
+
block4.angle -= 0.1
|
41
|
+
bar.angle += 1
|
42
|
+
Sprite.draw(objects)
|
43
|
+
|
44
|
+
Input.set_mouse_pos(0, 0) if cursor === objects
|
45
|
+
|
46
|
+
cursor.draw
|
47
|
+
|
48
|
+
break if Input.key_push?(K_ESCAPE)
|
49
|
+
end
|