torch-wip

There is no input manager in camera mode (so the control msg is never
sent), so it does not work.

We need a specific access to the controller in camera mode.
This commit is contained in:
Romain Vimont
2024-02-27 21:22:39 +01:00
parent 5a9e8ec7ba
commit e68e865d65
8 changed files with 99 additions and 6 deletions

View File

@@ -330,6 +330,19 @@ open_hard_keyboard_settings(struct sc_input_manager *im) {
}
}
static void
set_camera_torch(struct sc_input_manager *im, bool enabled) {
assert(im->controller);
struct sc_control_msg msg;
msg.type = SC_CONTROL_MSG_TYPE_SET_CAMERA_TORCH;
msg.set_camera_torch.enabled = enabled;
if (!sc_controller_push_msg(im->controller, &msg)) {
LOGW("Could not request setting camera torch");
}
}
static void
apply_orientation_transform(struct sc_input_manager *im,
enum sc_orientation transform) {
@@ -569,6 +582,11 @@ sc_input_manager_process_key(struct sc_input_manager *im,
open_hard_keyboard_settings(im);
}
return;
case SDLK_l:
if (control && !repeat && down) {
set_camera_torch(im, !shift);
}
return;
}
return;