doom 0.11.0 → 0.11.1

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: e8f1be6b4e908fb60c850e5ac7e4e9d5ade8fff60fd7c9744d89da3132625e5a
4
- data.tar.gz: bdbc30dcb9141292e4c6ae8d974b604b0d8cdb440dac964bc637615fd9cf53b4
3
+ metadata.gz: '08767e4f911ccfa133987896b1a26669e9c8e4e61aac202d9f15af080f6df789'
4
+ data.tar.gz: c281b8a23b05e748522069b538519ee321b43a6621a5f4dac5fa94379c2e9815
5
5
  SHA512:
6
- metadata.gz: e5a2273db5baa4bb26c5d9d08cc78b734ef102d7b8d354a95109e44e72bb8deaf901b743aa59a9a3ff4f1770059d13b2e7069f3f8be5d6ccaec942b7b69d3053
7
- data.tar.gz: 6cb2b7e235928e9a72ab95a87a44c7be3c84dbc0f59bcd45d7c0e40f0f3ebee54a46198baea930191b2355cc7a713e326d8c412354ab6eee103adf7ebe9bf5c9
6
+ metadata.gz: 787fdb4e71f127f091f5d8fbcc523189b1edc9a8075e5a34b0f1625c599ca7912fdc6b9532026ebb7d25d7f3581655df0318a47d3af0f1b7159348d03c8c9443
7
+ data.tar.gz: e3807b2509c349b09c9c473ed0372e9f04f1e3fa53e89c714c0e3ca3c20f2c91d81332f57c962e0e2396cbe0a22ca71c86a23691611b7e115cff149dd9a41557
data/README.md CHANGED
@@ -127,6 +127,9 @@ to present every frame the old way.
127
127
  brew install sdl2
128
128
  ```
129
129
 
130
+ If an older installation reports `symbol not found in flat namespace _OBJC_CLASS_$_NSScreen`,
131
+ update the gem with `gem update doom`. This is fixed in Doom Ruby 0.11.1.
132
+
130
133
  **Ubuntu/Debian:**
131
134
  ```bash
132
135
  sudo apt-get install build-essential libsdl2-dev libgl1-mesa-dev libopenal-dev libsndfile1-dev libmpg123-dev libfontconfig1-dev
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rbconfig'
4
+
5
+ module Doom
6
+ module Platform
7
+ # Gosu 1.4.6's macOS extension can be linked without its AppKit and SDL2
8
+ # dependencies when sdl2-config does not implement --static-libs. Load the
9
+ # frameworks globally first so dyld can resolve the extension's symbols.
10
+ module GosuLoader
11
+ APPKIT = '/System/Library/Frameworks/AppKit.framework/AppKit'
12
+ SDL2_CANDIDATES = %w[
13
+ /opt/homebrew/opt/sdl2/lib/libSDL2.dylib
14
+ /usr/local/opt/sdl2/lib/libSDL2.dylib
15
+ /opt/homebrew/lib/libSDL2.dylib
16
+ /usr/local/lib/libSDL2.dylib
17
+ ].freeze
18
+
19
+ module_function
20
+
21
+ def prepare!
22
+ return unless RbConfig::CONFIG['host_os'].include?('darwin')
23
+
24
+ require 'fiddle'
25
+ flags = Fiddle::RTLD_GLOBAL | Fiddle::RTLD_LAZY
26
+ @handles ||= []
27
+ @handles << Fiddle::Handle.new(APPKIT, flags)
28
+
29
+ sdl2 = SDL2_CANDIDATES.find { |path| File.file?(path) }
30
+ unless sdl2
31
+ raise LoadError,
32
+ 'Could not find Homebrew SDL2 required by Gosu. Install it with `brew install sdl2`.'
33
+ end
34
+
35
+ @sdl2_handle = Fiddle::Handle.new(sdl2, flags)
36
+ @handles << @sdl2_handle
37
+ rescue Fiddle::DLError => e
38
+ raise LoadError, "Could not load macOS frameworks required by Gosu: #{e.message}"
39
+ end
40
+
41
+ def sdl2_handle
42
+ @sdl2_handle
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'gosu_loader'
4
+ Doom::Platform::GosuLoader.prepare!
3
5
  require 'gosu'
4
6
  require_relative 'sdl'
5
7
  require_relative 'window_logic'
@@ -9,12 +9,13 @@ module Doom
9
9
  gosu_spec = Gem.loaded_specs['gosu']
10
10
  lib_ext = RbConfig::CONFIG['DLEXT'] || 'so'
11
11
  bundle = File.join(gosu_spec.full_gem_path, 'lib', "gosu.#{lib_ext}")
12
- @lib = Fiddle.dlopen(bundle)
12
+ @gosu_lib = Fiddle.dlopen(bundle)
13
+ @sdl_lib = Doom::Platform::GosuLoader.sdl2_handle || @gosu_lib
13
14
  @shared_window = Fiddle::Function.new(
14
- @lib['_ZN4Gosu13shared_windowEv'], [], Fiddle::TYPE_VOIDP
15
+ @gosu_lib['_ZN4Gosu13shared_windowEv'], [], Fiddle::TYPE_VOIDP
15
16
  )
16
17
  @set_kb_grab = Fiddle::Function.new(
17
- @lib['SDL_SetWindowKeyboardGrab'],
18
+ @sdl_lib['SDL_SetWindowKeyboardGrab'],
18
19
  [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT], Fiddle::TYPE_VOID
19
20
  )
20
21
  @ready = true
@@ -52,7 +53,8 @@ module Doom
52
53
  require 'fiddle'
53
54
  gosu_spec = Gem.loaded_specs['gosu']
54
55
  lib_ext = RbConfig::CONFIG['DLEXT'] || 'so'
55
- lib = Fiddle.dlopen(File.join(gosu_spec.full_gem_path, 'lib', "gosu.#{lib_ext}"))
56
+ bundle = File.join(gosu_spec.full_gem_path, 'lib', "gosu.#{lib_ext}")
57
+ lib = Doom::Platform::GosuLoader.sdl2_handle || Fiddle.dlopen(bundle)
56
58
 
57
59
  get_mode = Fiddle::Function.new(
58
60
  lib['SDL_GetCurrentDisplayMode'],
data/lib/doom/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Doom
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hasinski
@@ -148,6 +148,7 @@ files:
148
148
  - lib/doom/net/protocol.rb
149
149
  - lib/doom/net/session.rb
150
150
  - lib/doom/net/transport.rb
151
+ - lib/doom/platform/gosu_loader.rb
151
152
  - lib/doom/platform/gosu_window.rb
152
153
  - lib/doom/platform/sdl.rb
153
154
  - lib/doom/platform/window_logic.rb
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  - !ruby/object:Gem::Version
197
198
  version: '0'
198
199
  requirements: []
199
- rubygems_version: 4.0.16
200
+ rubygems_version: 4.0.20
200
201
  specification_version: 4
201
202
  summary: Doom engine port with multiplayer and modern renderers
202
203
  test_files: []