dxruby64 1.4.7 → 1.4.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09456faf82b816e3acb5ab3134ac5062e9453e3f821c9f83835357ae334af644'
4
- data.tar.gz: 18f08cc9f7139915b9f334e1ad12a44fef3f4db94b82c773dfe0d458cf123091
3
+ metadata.gz: '08d94a581f72caf876b0bb2091e2476db409abc3d2533d35f068a6bfad2001aa'
4
+ data.tar.gz: fad534cf63dbd0b2745074ff7e60d9e2472956dbdb6469912ccb3d6920d3f7ab
5
5
  SHA512:
6
- metadata.gz: 4c8a65bd3b7a8f3f7c6aca47b8098e897877614dee52ffeb76ec06e6c23522c7e8ad32fc950015097d61a1f5bedd02aec854f09e4ba975212ceea99143870712
7
- data.tar.gz: af52610d33f31cdf2846dcffcff4e3b4e62e64fdefd66ff52a2c481cccddb14339ebdd34faeedd50f8d11d082bd42cf6764612f76699f52b1d34a6ceebb147b7
6
+ metadata.gz: d6abd1acc491d74b2c07cc1af34b2d56a9110da011f918971de1299383c4e43f3951b19dce44309d00f2fc00fd14e77a8d27528bccf98ae9bd0f30204c1daa47
7
+ data.tar.gz: 90a4c29b14d2ed2761f99c620e749cd765dee04ad6e028ad50056ac94ef8a0800d26508276feaa50183722f5f96ec11524ec6bf4a52b2f4e7efe02908b178660
data/README-ja.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  **DXRuby64** は 64ビット版の Ruby 3.1以降用にカスタムビルドされた **DXRuby** で、Universal C Runtime(UCRT)でビルドできるように[本家DXRuby](https://github.com/mirichi/dxruby)のソースにパッチを当てたものです。DXRuby64により、64ビット版の Rubyでも DirectX9をベースにした 2Dゲームを開発できるようになります。
4
4
 
5
- **注意:** この gem は個人によって作成された非公式バージョンであり、オリジナルの DXRubyプロジェクトではメンテナンスされていません。
5
+ **注意:**
6
+ この gem は個人によって作成された非公式バージョンであり、本家DXRubyのプロジェクトでメンテナンスされているものではありません。
6
7
 
7
8
  [English README here](README.md)
8
9
 
@@ -14,6 +15,10 @@ gem をインストールするには、以下のコマンドを実行してく
14
15
  gem install dxruby64
15
16
  ```
16
17
 
18
+ **注意:**
19
+ DXRuby64の動作に影響が出る可能性がありますので、[本家DXRuby](https://github.com/mirichi/dxruby) がインストールされていない状態で上記のコマンドを実行してください。
20
+ ([本家DXRuby](https://github.com/mirichi/dxruby)は Ruby 3.1以降のバージョンには対応していないため、基本的に gemがインストールされていることはないと思われます)
21
+
17
22
  ## 使用方法
18
23
  インストール後、従来どおり DXRubyの機能を使うことができます。
19
24
 
@@ -41,13 +46,13 @@ gem contents dxruby64
41
46
  ```
42
47
 
43
48
  ## 必要条件
44
- - **Ruby 3.1 以降 (64ビット版)** が Windows にインストールされていること。
49
+ - **Ruby 3.1 以降 (64ビット版)** が Windowsにインストールされていること。
45
50
 
46
- - `d3dx9_40.dll` が必要です。これは DirectX 9 ランタイムの一部です。もしインストールされていない場合は、[Microsoft の公式サイト](https://www.microsoft.com/en-us/download/details.aspx?id=8109)からダウンロードできます。
51
+ - **`d3dx9_40.dll`** が配置されていること。これは DirectX 9 ランタイムの一部で、[Microsoft の公式サイト](https://www.microsoft.com/en-us/download/details.aspx?id=8109)からダウンロードすることができます。
47
52
 
48
- #### 【`d3dx9_40.dll` の入手方法】
53
+ #### 【`d3dx9_40.dll` の入手および配置方法】
49
54
 
50
- 1. [DirectX End-User Runtimes (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=8109) をダウンロードします。
55
+ 1. [DirectX End-User Runtimes (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=8109) に掲載されているファイル(`directx_Jun2010_redist.exe`)をダウンロードします。
51
56
 
52
57
  2. ダウンロードした `directx_Jun2010_redist.exe` をダブルクリックして、任意のディレクトリにファイルを展開します。
53
58
 
@@ -55,11 +60,66 @@ gem contents dxruby64
55
60
 
56
61
  4. `Nov2008_d3dx9_40_x64.cab` の中にある `d3dx9_40.dll` を見つけ、Ruby のインストールフォルダ内の `bin` フォルダにコピー(または移動)します。(例:C:\Ruby34-x64\bin)
57
62
 
63
+ ## Soundクラスの改修について
64
+
65
+ ### 経緯など
66
+ [本家DXRuby](https://github.com/mirichi/dxruby) の Soundクラスは `DirectMusic` というライブラリを使用していましたが、
67
+ Windows 10/11 の 64bit 環境ではこの `DirectMusic` は正しく動作せず、以下のようなエラーが発生することが確認されています。
68
+
69
+ ```
70
+ `DXRuby::Sound#initialize': DirectMusic initialize error - CoCreateInstance (DXRuby::DXRubyError)
71
+ ```
72
+ このため、DXRuby64では `DirectMusic` の代替として `DirectSound` というライブラリを使用するように改修をおこないました。
73
+ (`DirectSound` は SoundEffectクラスでもすでに使用されており、実績のあるライブラリです)
74
+
75
+ ### 改修版 Soundクラスのサンプル
76
+
77
+ 前述のサンプルファイルの中に `wav_sample/`ディレクトリに改修版の Soundクラスを用いたサンプルを追加しましたのでお試しください。
78
+ なお、下記の制限事項などについてもあわせてご確認ください。
79
+
80
+ ### 制限事項など
81
+
82
+ `DirectSound` の機能上の制約などから、改修に伴って以下のような仕様変更をおこないました。
83
+
84
+ - Soundクラスで扱うことができるファイル形式は `.wav` および `.mp3`
85
+ ([本家DXRuby](https://github.com/mirichi/dxruby) では `.wav` および `.mid`)
86
+
87
+ - 再生時のループ回数の指定はできず、「1回のみ再生」または「無限ループ」のいずれか
88
+
89
+ - ゲームなどで利用される効果音や BGMなどの再生を念頭に、以下に記載の最小限のメソッドのみを実装
90
+
91
+ ```
92
+ ■使用できるメソッド(新規にアレンジしたものも含む)
93
+
94
+ .new オブジェクトの生成
95
+ #play 再生
96
+ #stop 停止
97
+ #volume= 音量設定(0~255)
98
+ #set_volume 音量設定(上記 #volume= のエイリアス) ※ただし従来の第2引数による音量フェード機能はなし
99
+ #loop= ループ再生の採否設定(下記 #loop_count と同じ機能で、trueまたは falseで設定するもの)
100
+ #loop_count= ループ回数設定(ただし、前述のように「1回のみ再生(0)」または「無限ループ(-1)」のみ可)
101
+ #dispose オブジェクトの破棄
102
+ #disposed? オブジェクト破棄状況のチェック
103
+ ```
104
+
105
+ ```
106
+ ■使用できないメソッド(本家DXRubyでは実装されていたもの)
107
+
108
+ .load_from_memory
109
+ #start=
110
+ #loop_start=
111
+ #loop_end=
112
+ #pan
113
+ #pan=
114
+ #frequency
115
+ #frequency=
116
+ ```
117
+
58
118
  ## ライセンス
59
119
  この gem は zlib/libpngライセンスの下で提供されています。
60
120
 
61
121
  ## 免責事項
62
- この gem は DXRubyの公式な後継ではなく、元の DXRubyプロジェクトによってメンテナンスされていません。これは、新しいバージョンの Ruby用に UCRT環境で動作することを目的としたカスタムビルドです。
122
+ この gem は DXRubyの公式な後継ではなく、新しいバージョンの Ruby用に UCRT環境で動作することを目的としたカスタムビルドです。
63
123
 
64
124
  ## リポジトリ
65
125
  ソースコードや詳細情報は、以下のリポジトリで確認できます。
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  **DXRuby64** is a custom-built version of DXRuby for 64-bit Ruby 3.1 and later, created by patching the original DXRuby source to allow building with the Universal C Runtime (UCRT). With DXRuby64, you can develop 2D games using DirectX 9 even on 64-bit Ruby environments.
4
4
 
5
- **Note:** This gem is an unofficial version created by an individual and is not maintained by the original DXRuby project.
5
+ **Note:**
6
+ This gem is an unofficial version created by an individual and is not maintained by the original DXRuby project.
6
7
 
7
8
  [日本語の README はこちら](README-ja.md)
8
9
 
@@ -14,6 +15,10 @@ To install the gem, simply run:
14
15
  gem install dxruby64
15
16
  ```
16
17
 
18
+ **Note:**
19
+ Please run the above command only when the original DXRuby is not installed, as it may interfere with the operation of DXRuby64.
20
+ (The original DXRuby does not support Ruby versions 3.1 and later, so the gem is unlikely to be installed in most environments.)
21
+
17
22
  ## Usage
18
23
  Once installed, you can use DXRuby features as usual:
19
24
 
@@ -43,11 +48,11 @@ gem contents dxruby64
43
48
  ## Requirements
44
49
  - **Ruby 3.1 or later (64-bit)** installed on Windows.
45
50
 
46
- - `d3dx9_40.dll` is required. This is part of the DirectX 9 runtime. If it's not already installed, you can download it from [Microsoft's official site](https://www.microsoft.com/en-us/download/details.aspx?id=8109).
51
+ - Ensure that **`d3dx9_40.dll`** is present. This DLL is part of the DirectX 9 runtime and can be downloaded from [the official Microsoft website](https://www.microsoft.com/en-us/download/details.aspx?id=8109).
47
52
 
48
- #### How to get `d3dx9_40.dll`
53
+ #### How to obtain and place `d3dx9_40.dll`
49
54
 
50
- 1. Download the [DirectX End-User Runtimes (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=8109).
55
+ 1. Download the file (`directx_Jun2010_redist.exe`) from [DirectX End-User Runtimes (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=8109).
51
56
 
52
57
  2. Double-click the downloaded `directx_Jun2010_redist.exe` and extract the files to a directory of your choice.
53
58
 
@@ -55,6 +60,63 @@ gem contents dxruby64
55
60
 
56
61
  4. Inside the `Nov2008_d3dx9_40_x64.cab` file, locate `d3dx9_40.dll` and copy (or move) it to the `bin` directory of your Ruby installation folder. (e.g. C:\Ruby34-x64\bin)
57
62
 
63
+
64
+
65
+
66
+
67
+ ## About the Sound Class Revision
68
+ ### Background
69
+ The [original DXRuby](https://github.com/mirichi/dxruby) Sound class used a library called `DirectMusic`.
70
+ However, on 64-bit environments of Windows 10/11, `DirectMusic` does not function correctly, and the following error has been confirmed:
71
+
72
+ ```
73
+ `DXRuby::Sound#initialize': DirectMusic initialize error - CoCreateInstance (DXRuby::DXRubyError)
74
+ ```
75
+
76
+ Therefore, in DXRuby64, we replaced `DirectMusic` with a library called `DirectSound`.
77
+ (`DirectSound` is already used in the SoundEffect class and is a proven library.)
78
+
79
+ ### Sample of the Revised Sound Class
80
+ A sample using the revised Sound class has been added to the `wav_sample/` directory within the sample files mentioned earlier.
81
+ Please give it a try.
82
+ Also, be sure to review the following limitations and changes.
83
+
84
+ ### Limitations and Specification Changes
85
+ Due to functional constraints of `DirectSound`, the following changes were made as part of the revision:
86
+
87
+ - The Sound class supports `.wav` and `.mp3` file formats
88
+ (The [original DXRuby](https://github.com/mirichi/dxruby) supports `.wav` and `.mid`)
89
+
90
+ - Loop count cannot be specified; only "play once" or "infinite loop" are supported
91
+
92
+ - Designed with use cases like sound effects and BGM for games in mind, only a minimal set of methods (listed below) is implemented
93
+
94
+ ```
95
+ Available Methods (including newly arranged ones)
96
+
97
+ .new Create an object
98
+ #play Play
99
+ #stop Stop
100
+ #volume= Set volume (0 to 255)
101
+ #set_volume Set volume (alias of #volume=, but the old fade effect via a second argument is not supported)
102
+ #loop= Set loop mode (same as #loop_count; accepts true or false)
103
+ #loop_count= Set loop count (only two options supported: 0 = play once, -1 = loop infinitely)
104
+ #dispose Dispose the object
105
+ #disposed? Check if the object has been disposed
106
+ ```
107
+ ```
108
+ Unsupported Methods (implemented in the original DXRuby)
109
+
110
+ .load_from_memory
111
+ #start=
112
+ #loop_start=
113
+ #loop_end=
114
+ #pan
115
+ #pan=
116
+ #frequency
117
+ #frequency=
118
+ ```
119
+
58
120
  ## License
59
121
  This gem is licensed under the zlib/libpng license.
60
122
 
data/lib/31/dxruby.so CHANGED
Binary file
data/lib/32/dxruby.so CHANGED
Binary file
data/lib/33/dxruby.so CHANGED
Binary file
data/lib/34/dxruby.so CHANGED
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ [ViewState]
2
+ Mode=
3
+ Vid=
4
+ FolderType=Generic
@@ -0,0 +1,17 @@
1
+ require 'dxruby'
2
+
3
+ sound = Sound.new("gameover.wav") # gameover.wav読み込み
4
+
5
+ puts sound.disposed?
6
+
7
+ Window.loop do
8
+ if Input.key_push?(K_Z) # [Z]キーで効果音を再生
9
+ sound.play
10
+ break
11
+ end
12
+ end
13
+
14
+ sleep 1
15
+ sound.dispose
16
+ puts sound.disposed?
17
+
Binary file
@@ -0,0 +1,34 @@
1
+ require 'dxruby'
2
+
3
+ sound = Sound.new("gameover.wav") # gameover.wav読み込み
4
+ sound.loop_count = 0 # 効果音は繰り返さない(「.loop_count = -1|0」形式での設定)
5
+ sound.set_volume(255) # 効果音の音量(最大)(「.set_volume(値)」形式での設定)
6
+
7
+ bgm = Sound.new("backg.mp3") # backg.mp3読み込み
8
+ bgm.loop = true # BGMは繰り返す(「.loop = true|false」形式での設定)
9
+ bgm.play # BGB再生
10
+ bgm.volume = 200 # BGMの音量(「.volume = 値」形式での設定」)
11
+
12
+ Window.loop do
13
+ Window.draw_font(20, 20, "[SPACE] BGM停止", Font.default)
14
+ Window.draw_font(20, 80, "[↑] BGM音量上げ", Font.default)
15
+ Window.draw_font(20, 110, "[↓] BGM音量下げ", Font.default)
16
+ Window.draw_font(20, 140, "音量 : #{bgm.volume}", Font.default, color: [255, 255, 0])
17
+ Window.draw_font(20, 200, "[Z] 効果音 再生", Font.default)
18
+ Window.draw_font(20, 350, "[ESCAPE] 終了", Font.default)
19
+
20
+ if Input.key_push?(K_Z) # [Z]キーで効果音を再生
21
+ sound.play
22
+ end
23
+ if Input.key_push?(K_SPACE) # SPACEキーでBGM終了
24
+ bgm.stop
25
+ end
26
+ if Input.key_push?(K_UP) # [↑]キーでBGMの音量を上げる
27
+ bgm.volume = bgm.volume + 5 #「.volume = 値」形式
28
+ end
29
+ if Input.key_push?(K_DOWN) # [↓]キーでBGMの音量を下げる
30
+ bgm.volume = bgm.volume - 5 #「.volume = 値」形式
31
+ end
32
+
33
+ break if Input.key_push?(K_ESCAPE)
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxruby64
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koki Kitamura
@@ -117,10 +117,16 @@ files:
117
117
  - sample/shader_sample/sample_vertexshader.rb
118
118
  - sample/shader_sample/sample_wingman.rb
119
119
  - sample/shader_sample/turn_transition.rb
120
+ - sample/wav_sample/backg.mp3
121
+ - sample/wav_sample/desktop.ini
122
+ - sample/wav_sample/dispose.rb
123
+ - sample/wav_sample/gameover.wav
124
+ - sample/wav_sample/sound.rb
120
125
  homepage: https://github.com/spoolkitamura/dxruby64
121
126
  licenses:
122
127
  - Zlib
123
- metadata: {}
128
+ metadata:
129
+ homepage_uri: https://github.com/spoolkitamura/dxruby64
124
130
  rdoc_options: []
125
131
  require_paths:
126
132
  - lib