More callbacks implemented

This commit is contained in:
Alexander Bock
2014-12-06 12:46:52 +01:00
parent 9f7e1581de
commit 0a0543cc94
3 changed files with 20 additions and 4 deletions
+13
View File
@@ -25,6 +25,8 @@
#include <openspace/engine/gui.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/texture.h>
#include <imgui.h>
#include <sgct.h>
@@ -47,6 +49,8 @@ namespace {
size_t vbo_max_size = 20000;
GLuint vao_handle;
ghoul::opengl::Texture* _texture;
static void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count) {
@@ -272,6 +276,15 @@ bool GUI::mouseButtonCallback(int key, int action) {
return consumeEvent;
}
bool GUI::mouseWheelCallback(int position) {
ImGuiIO& io = ImGui::GetIO();
bool consumeEvent = io.WantCaptureMouse;
if (consumeEvent)
io.MouseWheel = static_cast<float>(position);
return consumeEvent;
}
bool GUI::keyCallback(int key, int action) {
ImGuiIO& io = ImGui::GetIO();
bool consumeEvent = io.WantCaptureKeyboard;
+6 -4
View File
@@ -569,19 +569,21 @@ void OpenSpaceEngine::mousePositionCallback(int x, int y) {
}
void OpenSpaceEngine::mouseScrollWheelCallback(int pos) {
bool isConsumed = _gui->mouseWheelCallback(pos);
if (isConsumed)
return;
_interactionHandler.mouseScrollWheelCallback(pos);
}
void OpenSpaceEngine::encode()
{
void OpenSpaceEngine::encode() {
if (_syncBuffer) {
_renderEngine.serialize(_syncBuffer);
_syncBuffer->write();
}
}
void OpenSpaceEngine::decode()
{
void OpenSpaceEngine::decode() {
if (_syncBuffer) {
_syncBuffer->read();
_renderEngine.deserialize(_syncBuffer);