diff --git a/src/Renderer.h b/src/Renderer.h index 626429e..30b1faa 100644 --- a/src/Renderer.h +++ b/src/Renderer.h @@ -12,6 +12,8 @@ struct Entity; struct InputState { + int32_t mousedX; + int32_t mousedY; int32_t mouseX; int32_t mouseY; uint8_t mouseButton; diff --git a/src/TestModule.cc b/src/TestModule.cc index 62654c0..d03e14e 100644 --- a/src/TestModule.cc +++ b/src/TestModule.cc @@ -48,6 +48,14 @@ void handle_keyboard () { direction -= right; } + if (glfwGetKey(gWindow, GLFW_KEY_SPACE) == GLFW_PRESS) { + direction += Vector3f (0.f, 1.f, 0.f); + } + + if (glfwGetKey(gWindow, GLFW_KEY_C) == GLFW_PRESS) { + direction += Vector3f (0.f, -1.f, 0.f); + } + float step = 0.1f; eye += direction * step; poi += direction * step; @@ -85,7 +93,7 @@ static void module_unload(struct module_state *state) { static bool module_step(struct module_state *state) { bool enabled = true; - ImGui::Begin("yoyoyoxi2"); + ImGui::Begin("Ddebug"); if (ImGui::Button("Hallo Katrina")) { if (gRenderer->drawDebug) { gRenderer->drawDebug = false; @@ -96,6 +104,10 @@ static bool module_step(struct module_state *state) { } ImGui::End(); + + static bool imgui_test_window = true; + ImGui::ShowTestWindow(); + float deltaTime = 0.3; std::ostringstream s; s << "TestModule: 2 Runtime Object 4 " << deltaTime << " update called!"; diff --git a/src/main.cc b/src/main.cc index 9f2614b..d6e1fb9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -79,17 +79,6 @@ int main(void) gRenderer = &renderer; -// bgfx::init(); -// bgfx::reset(width, height, BGFX_RESET_VSYNC); - -// printf("bgfx renderer is %s\n", bgfx::getRendererName(bgfx::getRendererType())); - - // Enable debug text. -// bgfx::setDebug(BGFX_DEBUG_TEXT); - - // Set view 0 clear state. -// bgfx::setViewClear(0, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x3070F0FF); - printf("Initializing ModuleManager...\n"); RuntimeModuleManager module_manager; module_manager.RegisterModule("libTestModule.so"); @@ -118,22 +107,13 @@ int main(void) renderer.paintGL(); -// bgfx::setViewRect(0, 0, 0, width, height); - - // Dummy submit call to make sure view 0 is cleared -// bgfx::touch(0); - -// bgfx::dbgTextClear(); -// bgfx::dbgTextPrintf(0, 1, 0x4f, "Test text"); -// bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); -// -// bgfx::frame(); - glfwPollEvents(); // send inputs to the input state of the renderer double mouse_x, mouse_y; glfwGetCursorPos(gWindow, &mouse_x, &mouse_y); + renderer.inputState.mousedX = mouse_x - renderer.inputState.mouseX; + renderer.inputState.mousedY = mouse_y - renderer.inputState.mouseY; renderer.inputState.mouseX = mouse_x; renderer.inputState.mouseY = mouse_y; renderer.inputState.mouseButton =