Browse Source

Add Scene::getMousePos().

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
f77afa08e3
2 changed files with 13 additions and 0 deletions
  1. +1
    -0
      include/app/Scene.hpp
  2. +12
    -0
      src/app/Scene.cpp

+ 1
- 0
include/app/Scene.hpp View File

@@ -25,6 +25,7 @@ struct Scene : widget::OpaqueWidget {


Scene(); Scene();
~Scene(); ~Scene();
math::Vec getMousePos();
void step() override; void step() override;
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void onHover(const HoverEvent& e) override; void onHover(const HoverEvent& e) override;


+ 12
- 0
src/app/Scene.cpp View File

@@ -73,10 +73,17 @@ Scene::Scene() {
addChild(internal->resizeHandle); addChild(internal->resizeHandle);
} }



Scene::~Scene() { Scene::~Scene() {
delete internal; delete internal;
} }



math::Vec Scene::getMousePos() {
return mousePos;
}


void Scene::step() { void Scene::step() {
if (APP->window->isFullScreen()) { if (APP->window->isFullScreen()) {
// Expand RackScrollWidget to cover entire screen if fullscreen // Expand RackScrollWidget to cover entire screen if fullscreen
@@ -107,10 +114,12 @@ void Scene::step() {
Widget::step(); Widget::step();
} }



void Scene::draw(const DrawArgs& args) { void Scene::draw(const DrawArgs& args) {
Widget::draw(args); Widget::draw(args);
} }



void Scene::onHover(const HoverEvent& e) { void Scene::onHover(const HoverEvent& e) {
mousePos = e.pos; mousePos = e.pos;
if (mousePos.y < menuBar->box.size.y) { if (mousePos.y < menuBar->box.size.y) {
@@ -119,11 +128,13 @@ void Scene::onHover(const HoverEvent& e) {
OpaqueWidget::onHover(e); OpaqueWidget::onHover(e);
} }



void Scene::onDragHover(const DragHoverEvent& e) { void Scene::onDragHover(const DragHoverEvent& e) {
mousePos = e.pos; mousePos = e.pos;
OpaqueWidget::onDragHover(e); OpaqueWidget::onDragHover(e);
} }



void Scene::onHoverKey(const HoverKeyEvent& e) { void Scene::onHoverKey(const HoverKeyEvent& e) {
if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) { if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
// DEBUG("key '%d '%c' scancode %d '%c' keyName '%s'", e.key, e.key, e.scancode, e.scancode, e.keyName.c_str()); // DEBUG("key '%d '%c' scancode %d '%c' keyName '%s'", e.key, e.key, e.scancode, e.scancode, e.keyName.c_str());
@@ -298,6 +309,7 @@ void Scene::onHoverKey(const HoverKeyEvent& e) {
OpaqueWidget::onHoverKey(e); OpaqueWidget::onHoverKey(e);
} }



void Scene::onPathDrop(const PathDropEvent& e) { void Scene::onPathDrop(const PathDropEvent& e) {
if (e.paths.size() >= 1) { if (e.paths.size() >= 1) {
const std::string& path = e.paths[0]; const std::string& path = e.paths[0];


Loading…
Cancel
Save