added keyboard input

This commit is contained in:
Luna 2025-06-06 17:26:09 +02:00
parent bc7db2106a
commit 8265015529

View file

@ -238,6 +238,13 @@ std::pair<vk::DeviceMemory, vk::Buffer> create_buffer(const vk::Device &device,
return std::make_pair(vertex_buffer_memory, vertex_buffer);
}
void keyboard_handle(GLFWwindow *window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
std::println("JUMP!");
std::println("Key {} pressed!", key);
}
int main()
{
using clock = std::chrono::system_clock;
@ -581,6 +588,7 @@ int main()
float angle = 0.0f;
float vel2 = 0.005f;
//std::thread phy_thread(simple_physics);
glfwSetKeyCallback(window, keyboard_handle);
auto before = clock::now();
while(!glfwWindowShouldClose(window))
{