Module: MilkTea::VendoredRaylib

Defined in:
lib/milk_tea/bindings/vendored_raylib.rb

Defined Under Namespace

Classes: AdaptiveArchive

Constant Summary collapse

Error =
VendoredCLibrary::Error
SOURCES =
%w[
  rcore.c
  rshapes.c
  rtextures.c
  rtext.c
  rmodels.c
  raudio.c
].freeze
DESKTOP_DEFINES =
%w[
  PLATFORM_DESKTOP_GLFW
  GRAPHICS_API_OPENGL_43
].freeze
%w[
  -lglfw
  -lm
  -ldl
  -lpthread
  -lrt
  -lX11
].freeze
WASM_DEFINES =
%w[
  PLATFORM_WEB
  GRAPHICS_API_OPENGL_ES2
  MA_ENABLE_AUDIO_WORKLETS
].freeze
%w[
  -sUSE_GLFW=3
  -sAUDIO_WORKLET=1
  -sWASM_WORKERS=1
  -sASYNCIFY
].freeze
WASM_COMPILE_FLAGS =
%w[
  -sAUDIO_WORKLET=1
  -sWASM_WORKERS=1
].freeze

Class Method Summary collapse

Class Method Details

.archive_path(root: MilkTea.root, platform: nil) ⇒ Object



115
116
117
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 115

def self.archive_path(root: MilkTea.root, platform: nil)
  build_root(root:, platform:).join("libraylib.a")
end

.build_root(root: MilkTea.root, platform: nil) ⇒ Object



110
111
112
113
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 110

def self.build_root(root: MilkTea.root, platform: nil)
  suffix = platform == :wasm ? "tmp/vendored-raylib-web" : "tmp/vendored-raylib-opengl43"
  MilkTea.writable_root_for(root).join(suffix)
end

.library(root: MilkTea.root) ⇒ Object



100
101
102
103
104
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 100

def self.library(root: MilkTea.root)
  resolved_root = Pathname.new(File.expand_path(root.to_s))
  @libraries ||= {}
  @libraries[resolved_root.to_s] ||= AdaptiveArchive.new(root: resolved_root)
end


119
120
121
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 119

def self.link_flags(root: MilkTea.root, platform: nil)
  library(root:).link_flags(platform:)
end

.prepare!(root: MilkTea.root, platform: nil, **kwargs) ⇒ Object



123
124
125
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 123

def self.prepare!(root: MilkTea.root, platform: nil, **kwargs)
  library(root:).prepare!(platform:, **kwargs)
end

.source_root(root: MilkTea.root) ⇒ Object



106
107
108
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 106

def self.source_root(root: MilkTea.root)
  MilkTea.writable_root_for(root).join("third_party/raylib-upstream/src")
end