Today: Controls and moving Inheritance and types of objects So we have have different behaviour A note again on globals: We have one keyboard, one screen, one player, one mouse, etc. On a networked game, the other players need a game object to represent them Unless we make a split-screen version for consoles... We'll carefully label our position and key status related globals Maybe an object would be a nice way to organize them! Controls and moving first: It's getting hard to deal with static camera angle! Position: Need to maintain where we are A vec3 would suffice Direction: Need to know where we're facing A float with our current heading would work Elevation: How high/low are we looking? A float will work again But this isn't what LookAt wants It needs a point we're looking at We can compute that from position, direction, and elevation Mouse control: glfwSetCursorPosCallback(window, a function to call) The function should take the window, and x position, and a y position x and y position are double-precision floating point Even if the cursor is invisible, it has a position We care how much it moved, not where it is General plan: Look at how much it moved, then put it back in the center glfwSetCursorPos can set the position Make sure we can't bend too far backwards Keyboard control: glfwSetKeyCallback(window, a function to call) The function takes (window, key, scancode, action, mods) (last 4 are ints) key is a key constant, like GLFW_KEY_F3 or GLFW_KEY_W action is 0 or 1 (or maybe 2) mods indicates control, shift, etc We don't really need the scancode Smooth movement with keys for forward/back/strafe: While the button is pressed, keep moving So we have to track status of the keys and move periodically Might need an engine management thread Something not affected by a single object being really slow While we're doing callbacks: Could we have a callback for resize? glfwSetFrameBufferCallback(window, function to call) resize function takes window, width, height Call glViewport afterward If we get this far (probably won't): An object-oriented heirarchy