PGD Home

P-156: Update 15: Text Input

by on Mar.23, 2015, under Software and Games, Software Engines

I have been working on adding basic text input to this project, and it is turning out to be surprisingly difficult.

I know that I can use glfwGetKey() to get a specific key, such as: if (glfwGetKey(window, GLFW_KEY_UP ) == GLFW_PRESS), however, I had some issues figuring out how to accept a text string from the user.

Eventually, I figured out that to capture a text string, I needed to use a keyboard callback, something like this:

 

static void KeyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
{

if(action == GLFW_PRESS){

//This fires when ANY key is pressed

}

}

Text input is not fully working yet, but it is very close.

Facebooktwitterredditpinterestlinkedinmail

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!