Add keyboard event callback for Python passive viewer.
Fixes #766 Fixes #846 PiperOrigin-RevId: 549449372 Change-Id: I37d17f1162c66d0e8482d402aae22d9a16b59deb
This commit is contained in:
committed by
Copybara-Service
parent
f7847ba73e
commit
06b70832ce
@@ -76,6 +76,8 @@ void PlatformUIAdapter::OnKey(int key, int scancode, int act) {
|
||||
if (event_callback_) {
|
||||
event_callback_(&state_);
|
||||
}
|
||||
|
||||
last_key_ = mj_key;
|
||||
}
|
||||
|
||||
void PlatformUIAdapter::OnMouseButton(int button, int act) {
|
||||
|
||||
@@ -77,7 +77,7 @@ class PlatformUIAdapter {
|
||||
|
||||
// Event handlers
|
||||
void OnFilesDrop(int count, const char** paths);
|
||||
void OnKey(int key, int scancode, int act);
|
||||
virtual void OnKey(int key, int scancode, int act);
|
||||
void OnMouseButton(int button, int act);
|
||||
void OnMouseMove(double x, double y);
|
||||
void OnScroll(double xoffset, double yoffset);
|
||||
@@ -85,6 +85,7 @@ class PlatformUIAdapter {
|
||||
void OnWindowResize(int width, int height);
|
||||
|
||||
mjuiState state_;
|
||||
int last_key_;
|
||||
void (*event_callback_)(mjuiState*);
|
||||
void (*layout_callback_)(mjuiState*);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user