diff options
| author | Tom Black <[email protected]> | 2019-01-03 21:25:37 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2019-01-03 23:26:39 -0800 |
| commit | 3947ca0a07fdbe27a737522b366cca026a757c65 (patch) | |
| tree | 40cd92960a8ba6c283e385134ec7446f0da73029 /ext | |
| parent | 8095e56c9d8532f6558316d4426c72baad50e043 (diff) | |
| download | ruby2d-3947ca0a07fdbe27a737522b366cca026a757c65.tar.gz ruby2d-3947ca0a07fdbe27a737522b366cca026a757c65.zip | |
Add an assets path variable
Adds `Ruby2D.assets/=`. By default, will resolve to `./assets`. If run in a macOS app bundle, will resolve to `App.app/Contents/Resources/assets`, for example.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ruby2d/ruby2d.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c index 3d300dc..300c8e0 100644 --- a/ext/ruby2d/ruby2d.c +++ b/ext/ruby2d/ruby2d.c @@ -155,6 +155,18 @@ double normalize_controller_axis(int val) { /* + * Ruby2D#self.ext_base_path + */ +#if MRUBY +static R_VAL ruby2d_ext_base_path(mrb_state* mrb, R_VAL self) { +#else +static R_VAL ruby2d_ext_base_path(R_VAL self) { +#endif + return r_str_new(SDL_GetBasePath()); +} + + +/* * Ruby2D#self.ext_screenshot */ #if MRUBY @@ -1102,6 +1114,9 @@ void Init_ruby2d() { // Ruby2D R_CLASS ruby2d_module = r_define_module("Ruby2D"); + // Ruby2D#self.ext_base_path + r_define_class_method(ruby2d_module, "ext_base_path", ruby2d_ext_base_path, r_args_none); + // Ruby2D::Triangle R_CLASS ruby2d_triangle_class = r_define_class(ruby2d_module, "Triangle"); |
