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



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

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

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



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

def 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



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

def 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


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

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

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



127
128
129
# File 'lib/milk_tea/bindings/vendored_raylib.rb', line 127

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

.source_root(root: MilkTea.root) ⇒ Object



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

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