Skip to content

Commit

Permalink
allow dragging and dropping to import (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
GameParrot authored Jan 6, 2025
1 parent e77c62b commit da164f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/window_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void WindowCallbacks::registerCallbacks() {
window.setTouchEndCallback(std::bind(&WindowCallbacks::onTouchEnd, this, _1, _2, _3));
window.setKeyboardCallback(std::bind(&WindowCallbacks::onKeyboard, this, _1, _2));
window.setKeyboardTextCallback(std::bind(&WindowCallbacks::onKeyboardText, this, _1));
window.setDropCallback(std::bind(&WindowCallbacks::onDrop, this, _1));
window.setPasteCallback(std::bind(&WindowCallbacks::onPaste, this, _1));
window.setGamepadStateCallback(std::bind(&WindowCallbacks::onGamepadState, this, _1, _2));
window.setGamepadButtonCallback(std::bind(&WindowCallbacks::onGamepadButton, this, _1, _2, _3));
Expand Down Expand Up @@ -591,6 +592,9 @@ void WindowCallbacks::onKeyboardText(std::string const& c) {
else
jniSupport.getTextInputHandler().onTextInput(c);
}
void WindowCallbacks::onDrop(std::string const &path) {
jniSupport.importFile(path);
}
void WindowCallbacks::onPaste(std::string const& str) {
#ifdef USE_IMGUI
Settings::clipboard = str;
Expand Down
1 change: 1 addition & 0 deletions src/window_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class WindowCallbacks {
void onTouchEnd(int id, double x, double y);
void onKeyboard(KeyCode key, KeyAction action);
void onKeyboardText(std::string const &c);
void onDrop(std::string const &path);
void onPaste(std::string const &str);
void onGamepadState(int gamepad, bool connected);
void onGamepadButton(int gamepad, GamepadButtonId btn, bool pressed);
Expand Down

0 comments on commit da164f0

Please sign in to comment.