-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I made a few changes to the event system to ensure they work with our current windowing system. Added more comments, especially to the event system. While making a bit few changes to the Windows API by removing one of the update functions and replacing that with the `InputPoll::UpdateEvents()` function instead to ensure all events being handled are successfully updated
- Loading branch information
Showing
12 changed files
with
94 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#pragma once | ||
// #include <Core/Core.hpp> | ||
#include <Core/Core.hpp> | ||
#include <string> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <Core/ApplicationInstance.hpp> | ||
#include <Core/internal/VulkanCpp/Vulkan.hpp> | ||
#include <GLFW/glfw3.h> | ||
#include <Core/Event/InputPoll.hpp> | ||
|
||
|
||
namespace engine3d{ | ||
bool InputPoll::IsKeyPressed(KeyCode keycode){ | ||
// auto window = ApplicationInstance::Get().GetCurrentWindow(); | ||
auto window = ApplicationInstance::GetWindow().GetNativeWindow(); | ||
|
||
auto state = glfwGetKey(window, static_cast<int32_t>(keycode)); | ||
return state == GLFW_PRESS || state == GLFW_REPEAT; | ||
} | ||
|
||
bool InputPoll::IsMousePressed(MouseCode mouseCode){ | ||
auto window = ApplicationInstance::GetWindow().GetNativeWindow(); | ||
auto state = glfwGetMouseButton(window, static_cast<int32_t>(mouseCode)); | ||
return state == GLFW_PRESS; | ||
} | ||
|
||
glm::vec2 InputPoll::GetMousePosition(){ | ||
auto window = ApplicationInstance::GetWindow().GetNativeWindow(); | ||
double xPos, yPos; | ||
glfwGetCursorPos(window, &xPos, &yPos); | ||
|
||
return {xPos, yPos}; | ||
} | ||
|
||
float InputPoll::GetMouseX(){ | ||
return GetMousePosition().x; | ||
} | ||
|
||
float InputPoll::GetMouseY(){ | ||
return GetMousePosition().y; | ||
} | ||
|
||
void InputPoll::UpdateEvents(){ | ||
glfwPollEvents(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters