Compare commits
7
Commits
9f4c345c74
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a3da07c6c
|
||
|
|
e188501d19
|
||
|
|
e0994b42c0
|
||
|
|
d484db4e84
|
||
|
|
f82ab718f3
|
||
|
|
2f70c44ad5
|
||
|
|
2006ee55ab
|
@@ -2,3 +2,12 @@
|
|||||||
path = libs/mruby
|
path = libs/mruby
|
||||||
url = https://github.com/mruby/mruby.git
|
url = https://github.com/mruby/mruby.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
[submodule "libs/mgems/mruby-process"]
|
||||||
|
path = libs/mgems/mruby-process
|
||||||
|
url = https://github.com/katzer/mruby-process
|
||||||
|
[submodule "libs/mgems/mruby-env"]
|
||||||
|
path = libs/mgems/mruby-env
|
||||||
|
url = https://github.com/iij/mruby-env.git
|
||||||
|
[submodule "libs/mgems/mruby-marshal-c"]
|
||||||
|
path = libs/mgems/mruby-marshal-c
|
||||||
|
url = https://github.com/LanzaSchneider/mruby-marshal-c.git
|
||||||
|
|||||||
@@ -29,14 +29,12 @@ MRUBY_LIBS := $(MRUBY_LIB)
|
|||||||
CFLAGS_DEBUG := \
|
CFLAGS_DEBUG := \
|
||||||
-std=c++20 -Wall -Wextra \
|
-std=c++20 -Wall -Wextra \
|
||||||
-Og -g -fno-omit-frame-pointer \
|
-Og -g -fno-omit-frame-pointer \
|
||||||
-Wno-unused-command-line-argument \
|
|
||||||
-I./include -I./libs/mruby/build/host/include \
|
-I./include -I./libs/mruby/build/host/include \
|
||||||
$(SDL_CFLAGS) $(MRUBY_CFLAGS)
|
$(SDL_CFLAGS) $(MRUBY_CFLAGS)
|
||||||
|
|
||||||
CFLAGS_RELEASE := \
|
CFLAGS_RELEASE := \
|
||||||
-std=c++20 -O3 -mtune=generic \
|
-std=c++20 -O3 -mtune=generic \
|
||||||
-fno-rtti -fomit-frame-pointer -DNDEBUG -s \
|
-fno-rtti -fomit-frame-pointer -DNDEBUG -s \
|
||||||
-Wno-unused-command-line-argument \
|
|
||||||
-I./include -I./libs/mruby/build/host/include \
|
-I./include -I./libs/mruby/build/host/include \
|
||||||
$(SDL_CFLAGS) $(MRUBY_CFLAGS)
|
$(SDL_CFLAGS) $(MRUBY_CFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,20 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pythonEnv = pkgs.python3.withPackages (
|
||||||
|
ps: with ps; [
|
||||||
|
pandas
|
||||||
|
matplotlib
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.${system} = {
|
packages.${system} = {
|
||||||
default = misth;
|
default = misth;
|
||||||
misth = misth;
|
misth = misth;
|
||||||
mruby = mruby;
|
mruby = mruby;
|
||||||
|
pythonEnv = pythonEnv;
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.${system}.default = pkgs.mkShell {
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
@@ -104,6 +112,9 @@
|
|||||||
sdl3
|
sdl3
|
||||||
sdl3-ttf
|
sdl3-ttf
|
||||||
sdl3-image
|
sdl3-image
|
||||||
|
|
||||||
|
pythonEnv
|
||||||
|
ruff
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|||||||
+1
-1
@@ -38,4 +38,4 @@ private:
|
|||||||
|
|
||||||
inline app::App *app_ = nullptr;
|
inline app::App *app_ = nullptr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -60,4 +60,4 @@ inline void setup() {
|
|||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -124,4 +124,4 @@ DEF_SYM(w)
|
|||||||
DEF_SYM(h)
|
DEF_SYM(h)
|
||||||
DEF_SYM(z)
|
DEF_SYM(z)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,4 +47,4 @@ Key key_from_sym(mrb_state *mrb, mrb_sym sym);
|
|||||||
std::string get_key_name(Key key);
|
std::string get_key_name(Key key);
|
||||||
} // namespace Localization
|
} // namespace Localization
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-3
@@ -226,8 +226,7 @@ struct Pool {
|
|||||||
bool is_valid(uint64_t index) const {
|
bool is_valid(uint64_t index) const {
|
||||||
uint32_t id = (uint32_t)(index & 0xFFFFFFFFULL);
|
uint32_t id = (uint32_t)(index & 0xFFFFFFFFULL);
|
||||||
uint32_t gen = (uint32_t)(index >> 32);
|
uint32_t gen = (uint32_t)(index >> 32);
|
||||||
return id >= 0
|
return id < slots.size()
|
||||||
&& id < slots.size()
|
|
||||||
&& slots[id].alive
|
&& slots[id].alive
|
||||||
&& slots[id].generation == gen;
|
&& slots[id].generation == gen;
|
||||||
}
|
}
|
||||||
@@ -243,4 +242,4 @@ private:
|
|||||||
std::vector<uint32_t> free_indices;
|
std::vector<uint32_t> free_indices;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -218,4 +218,4 @@ inline Key get_key(std::string &name) {
|
|||||||
return get_key_from_name(name);
|
return get_key_from_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,17 @@
|
|||||||
|
|
||||||
# Use mrbgems
|
# Use mrbgems
|
||||||
# conf.gem 'examples/mrbgems/ruby_extension_example'
|
# conf.gem 'examples/mrbgems/ruby_extension_example'
|
||||||
|
@@ -16,6 +28,10 @@
|
||||||
|
# include the GEM box
|
||||||
|
conf.gembox 'default'
|
||||||
|
|
||||||
|
+ conf.gem '../mgems/mruby-env'
|
||||||
|
+ conf.gem '../mgems/mruby-process'
|
||||||
|
+ conf.gem '../mgems/mruby-marshal-c'
|
||||||
|
+
|
||||||
|
# C compiler settings
|
||||||
|
# conf.cc do |cc|
|
||||||
|
# cc.command = ENV['CC'] || 'gcc'
|
||||||
@@ -79,5 +79,5 @@
|
@@ -79,5 +79,5 @@
|
||||||
# Turn on `enable_debug` for better debugging
|
# Turn on `enable_debug` for better debugging
|
||||||
# conf.enable_debug
|
# conf.enable_debug
|
||||||
@@ -28,3 +39,15 @@
|
|||||||
+ # conf.enable_bintest
|
+ # conf.enable_bintest
|
||||||
+ # conf.enable_test
|
+ # conf.enable_test
|
||||||
end
|
end
|
||||||
|
--- ./mgems/mruby-process/mrbgem.rake
|
||||||
|
+++ ./mgems/mruby-process/mrbgem.rake
|
||||||
|
@@ -54,4 +54,9 @@
|
||||||
|
else
|
||||||
|
spec.objs.delete objfile("#{build_dir}/src/win32")
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ spec.objs.delete objfile("#{build_dir}/src/internal")
|
||||||
|
+ spec.objs.delete objfile("#{build_dir}/src/dln")
|
||||||
|
+ spec.objs.delete objfile("#{build_dir}/src/signal")
|
||||||
|
+ spec.objs.delete objfile("#{build_dir}/src/status")
|
||||||
|
end
|
||||||
|
|||||||
Submodule
+1
Submodule libs/mgems/mruby-env added at 056ae32445
Submodule
+1
Submodule libs/mgems/mruby-marshal-c added at fc40e2ec0f
Submodule
+1
Submodule libs/mgems/mruby-process added at 715014b1d9
+1
-1
@@ -19,7 +19,7 @@ bg_image1_a = Animation.from(bg_image1)
|
|||||||
App.language = :en
|
App.language = :en
|
||||||
App.localize(:en, :btn_text, "Click %{name}!")
|
App.localize(:en, :btn_text, "Click %{name}!")
|
||||||
|
|
||||||
text = ElementText.new :btn_text, default_font, 0xFFFF00, {name: "Me"}, position: {x: 50, y: 50}, z: 1, click_mode: :block, alpha: 1
|
text = ElementText.new :btn_text, default_font, 0xFFFF00, {name: ENV.fetch("name", "me")}, position: {x: 50, y: 50}, z: 1, click_mode: :block, alpha: 1
|
||||||
|
|
||||||
rect = ElementRect.new 100, 25, 0xFF0000, position: {x: 50, y: 50}, z: 0, rotation: 60, scale: { x: 1, y: 1 }, alpha: 0.8, click_mode: :block
|
rect = ElementRect.new 100, 25, 0xFF0000, position: {x: 50, y: 50}, z: 0, rotation: 60, scale: { x: 1, y: 1 }, alpha: 0.8, click_mode: :block
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -74,4 +74,4 @@ Vec2<float> ERect::size() {
|
|||||||
void ERect::render(uint64_t) {
|
void ERect::render(uint64_t) {
|
||||||
window.draw_rect(Rect::from(position, shape), color, z, rotation, pivot, scale, alpha);
|
window.draw_rect(Rect::from(position, shape), color, z, rotation, pivot, scale, alpha);
|
||||||
}
|
}
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|||||||
+1
-1
@@ -88,4 +88,4 @@ Vec2<float> Scene::world_to_local(Vec2<float> p, Element *e) {
|
|||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|||||||
@@ -323,4 +323,4 @@ void register_element_image() {
|
|||||||
|
|
||||||
bindings.ElementImage = {ElementImage_class, &ElementImage_type};
|
bindings.ElementImage = {ElementImage_class, &ElementImage_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -346,4 +346,4 @@ void register_element_rect() {
|
|||||||
|
|
||||||
bindings.ElementRect = {ElementRect_class, &ElementRect_type};
|
bindings.ElementRect = {ElementRect_class, &ElementRect_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -408,4 +408,4 @@ void register_element_text() {
|
|||||||
|
|
||||||
bindings.ElementText = {ElementText_class, &ElementText_type};
|
bindings.ElementText = {ElementText_class, &ElementText_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -69,4 +69,4 @@ void register_font() {
|
|||||||
ADD_METHOD(Font, "hash", font_hash, MRB_ARGS_NONE());
|
ADD_METHOD(Font, "hash", font_hash, MRB_ARGS_NONE());
|
||||||
bindings.Font = {Font_class, &Font_type};
|
bindings.Font = {Font_class, &Font_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -157,4 +157,4 @@ void register_image() {
|
|||||||
|
|
||||||
bindings.Image = {Image_class, &Image_type};
|
bindings.Image = {Image_class, &Image_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -65,4 +65,4 @@ void register_params() {
|
|||||||
ADD_METHOD(Params, "[]=", params_set, MRB_ARGS_REQ(2));
|
ADD_METHOD(Params, "[]=", params_set, MRB_ARGS_REQ(2));
|
||||||
bindings.Params = {Params_class, &Params_type};
|
bindings.Params = {Params_class, &Params_type};
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -87,4 +87,4 @@ mrb_value Vec2_wrap(uint64_t id, Vec2<float> *vec) {
|
|||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
} // namespace definitions
|
} // namespace definitions
|
||||||
|
|||||||
@@ -111,4 +111,4 @@ std::string get_key_name(Key key) {
|
|||||||
return str;
|
return str;
|
||||||
return "Unknown Key";
|
return "Unknown Key";
|
||||||
}
|
}
|
||||||
} // namespace Localization
|
} // namespace Localization
|
||||||
|
|||||||
+9
-1
@@ -15,7 +15,15 @@ int main(int argc, char *argv[]) {
|
|||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
|
||||||
char *script_content = (char *)malloc(size + 1);
|
char *script_content = (char *)malloc(size + 1);
|
||||||
fread(script_content, 1, size, file);
|
size_t read = fread(script_content, 1, size, file);
|
||||||
|
|
||||||
|
if (read != size) {
|
||||||
|
fprintf(stderr, "Failed to read startup script: %s\n", startup_script);
|
||||||
|
free(script_content);
|
||||||
|
fclose(file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
script_content[size] = '\0';
|
script_content[size] = '\0';
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|||||||
+1
-1
@@ -37,4 +37,4 @@ end
|
|||||||
def anti(query)
|
def anti(query)
|
||||||
query.type = :"not_#{query.type}"
|
query.type = :"not_#{query.type}"
|
||||||
query
|
query
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -653,4 +653,4 @@ bool Window::mouse_in_window(const Vec2<float> real_position, Vec2<float> &virtu
|
|||||||
virtual_position = (real_position - offset) / scale;
|
virtual_position = (real_position - offset) / scale;
|
||||||
|
|
||||||
return virtual_position.x >= 0 && virtual_position.x <= virtual_size.x && virtual_position.y >= 0 && virtual_position.y <= virtual_size.y;
|
return virtual_position.x >= 0 && virtual_position.x <= virtual_size.x && virtual_position.y >= 0 && virtual_position.y <= virtual_size.y;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -21,4 +21,4 @@ plt.legend()
|
|||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
plt.savefig("benchmark.png", dpi=200, bbox_inches="tight")
|
plt.savefig("benchmark.png", dpi=200, bbox_inches="tight")
|
||||||
|
|||||||
Reference in New Issue
Block a user