diff options
| -rw-r--r-- | Rakefile | 10 | ||||
| -rw-r--r-- | core/mruby_build.rb | 6 | ||||
| -rw-r--r-- | core/mruby_build_host.rb | 94 | ||||
| -rw-r--r-- | core/mruby_build_host.rb.lock | 4 | ||||
| -rw-r--r-- | game/main.rb | 4 |
5 files changed, 114 insertions, 4 deletions
@@ -4,6 +4,7 @@ config_root = File.expand_path('.') config_core = File.expand_path("#{config_root}/core") config_build_config = File.expand_path("#{config_root}/core/mruby_build.rb") +config_build_config_fast = File.expand_path("#{config_root}/core/mruby_build_host.rb") config_build_raylib_source = File.expand_path("#{config_root}/core/raylib/src") @@ -45,6 +46,15 @@ namespace :build do end end + desc "Build the engine only for Linux" + task :mruby_fast do + Dir.chdir("core/mruby") do + Dir.mkdir(config_vendor) unless File.exists?(config_vendor) + system("env MRUBY_CONFIG=#{config_build_config_fast} rake") + FileUtils.cp("build/host/lib/libmruby.a", "#{config_tux_lib}/") + end + end + desc "Build Raylib" task :raylib do Dir.mkdir(config_vendor) unless File.exists?(config_vendor) diff --git a/core/mruby_build.rb b/core/mruby_build.rb index a0d0a56..f99d145 100644 --- a/core/mruby_build.rb +++ b/core/mruby_build.rb @@ -1,7 +1,9 @@ +require_relative 'mruby_build_host.rb' configure_project_root = File.expand_path('../..') configure_mrbgem_dir = File.expand_path("#{configure_project_root}/mrbgems") +=begin MRuby::Build.new do |conf| # load specific toolchain settings conf.toolchain :clang @@ -65,7 +67,6 @@ MRuby::Build.new do |conf| # -- YOUR GEMS -- # gems added into the mrbgems directory - puts "HERE: #{File.expand_path(configure_mrbgem_dir)}" Dir.each_child(configure_mrbgem_dir) do |mrb_gem| conf.gem "#{configure_mrbgem_dir}/#{mrb_gem}" end @@ -93,7 +94,7 @@ MRuby::Build.new do |conf| conf.enable_bintest conf.enable_test end - +=end =begin MRuby::CrossBuild.new("tux") do |conf| conf.toolchain :clang @@ -214,7 +215,6 @@ MRuby::CrossBuild.new("win") do |conf| # -- YOUR GEMS -- # gems added into the mrbgems directory - puts "HERE: #{File.expand_path(configure_mrbgem_dir)}" Dir.each_child(configure_mrbgem_dir) do |mrb_gem| conf.gem "#{configure_mrbgem_dir}/#{mrb_gem}" end diff --git a/core/mruby_build_host.rb b/core/mruby_build_host.rb new file mode 100644 index 0000000..7e0b77c --- /dev/null +++ b/core/mruby_build_host.rb @@ -0,0 +1,94 @@ +configure_project_root = File.expand_path('../..') +configure_mrbgem_dir = File.expand_path("#{configure_project_root}/mrbgems") + + +MRuby::Build.new do |conf| + # load specific toolchain settings + conf.toolchain :clang + #conf.toolchain + + disable_lock # disables being stuck on a single commit + + # -- CORE GEMS -- + conf.gembox "stdlib" + conf.gembox "stdlib-ext" + conf.gembox "math" + conf.gembox "metaprog" + #conf.gembox "stdlib-io" + + # Use standard IO/File class + conf.gem :core => "mruby-io" + + # TODO: this gem doesnt current work + # with windows export + #conf.gem :core => "mruby-socket" + + # Use standard print/puts/p + conf.gem :core => "mruby-print" + + # Generate mrbc command + conf.gem :core => "mruby-bin-mrbc" + + # Generate mirb command + conf.gem :core => "mruby-bin-mirb" + + # Generate mruby command + conf.gem :core => "mruby-bin-mruby" + + # Generate mruby-strip command + conf.gem :core => "mruby-bin-strip" + + # Generate mruby-config command + conf.gem :core => "mruby-bin-config" + + # -- POTENTIAL GEMS -- + # gems that we may want incorperated + + # Simple Http + #conf.gem :git => 'https://github.com/matsumotory/mruby-simplehttp' + + # Memory Profiler + #conf.gem :git => 'https://github.com/iij/mruby-memprof' + + # Testing Framework + #conf.gem :git => 'https://github.com/iij/mruby-mtest' + + # Regex + #conf.gem :git => 'https://github.com/iij/mruby-regexp-pcre' + + # JSON + #conf.gem :git => 'https://github.com/iij/mruby-iijson' + + # Dir + #conf.gem :git => 'https://github.com/iij/mruby-dir' + + # -- YOUR GEMS -- + # gems added into the mrbgems directory + + Dir.each_child(configure_mrbgem_dir) do |mrb_gem| + conf.gem "#{configure_mrbgem_dir}/#{mrb_gem}" + end + + # --- + + # C compiler settings + conf.cc do |cc| + cc.command = 'zig cc -target native -O2' + cc.include_paths << ["#{configure_project_root}/vendor/tux/include"] + end + + # Linker settings + conf.linker do |linker| + #linker.command = ENV['LD'] || 'gcc' + linker.command = 'zig c++ -target native -O2' + linker.flags << ['-lraylib -lGL -lm -lpthread -ldl -lrt -lX11'] + linker.library_paths << ["#{configure_project_root}/vendor/tux/lib"] + end + + conf.cxx.command = 'zig c++ -target native -O2' + + # Turn on `enable_debug` for better debugging + # conf.enable_debug + conf.enable_bintest + conf.enable_test +end diff --git a/core/mruby_build_host.rb.lock b/core/mruby_build_host.rb.lock new file mode 100644 index 0000000..bc3701e --- /dev/null +++ b/core/mruby_build_host.rb.lock @@ -0,0 +1,4 @@ +--- +mruby: + version: 3.0.0 + release_no: 30000 diff --git a/game/main.rb b/game/main.rb index afade46..5bf984d 100644 --- a/game/main.rb +++ b/game/main.rb @@ -2,6 +2,8 @@ include Test WHITE = Color.new(r: 255, g: 255, b: 255, a: 255) GRAY = Color.new(r: 100, g: 100, b: 100, a: 255) +GRAY.r += 50 + screen_width = 800 screen_height = 450 @@ -14,7 +16,7 @@ while !window_should_close do clear_background(WHITE) - draw_text(text: "Congrats! You created your first window!", posX: 190, posY: 200, fontSize: 20, color: GRAY) + draw_text(text: "Congrats! You created your first window!", pos_x: 190, pos_y: 200, font_size: 20, color: GRAY) end_drawing end |
