[quote]Nehe lessons 1-20, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 42, 45
Source
Binaries
[/quote]
Dude try calling a function that checks the keyboard input from within the display method; It’ll make the controls much, much smoother.
Example:
void ProcessKeyboard(){
// Most functions has been moved to the camera class
if(g_Camera.keys[KeyEvent.VK_SPACE]){
// To get a few different ideas of what a detail texture
// could look like, we want to change it's scale value.
// Times the current scale value by 2 and loop when it get's to 128
terrain.g_DetailScale = (terrain.g_DetailScale * 2) % 128;
// If the scale value is 0, set it to 1 again
if(terrain.g_DetailScale == 0)
terrain.g_DetailScale = 1;
g_Camera.keys[KeyEvent.VK_SPACE] = false;
}
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
// To make the tutorial more interesting, we add an option to increase
// and decrease the height of the fog by using the + and - keys.
if(g_Camera.keys[KeyEvent.VK_ADD]){ // Check if we hit the + key
terrain.g_FogDepth += 1; // Increase the fog height
if(terrain.g_FogDepth > 200)
terrain.g_FogDepth = 200; // Make sure we don't go past 200
g_Camera.keys[KeyEvent.VK_ADD] = false;
}
if(g_Camera.keys[KeyEvent.VK_SUBTRACT]){ // Check if we hit the - key
terrain.g_FogDepth -= 1; // Decrease the fog height
if(terrain.g_FogDepth < 0)
terrain.g_FogDepth = 0; // Make sure we don't go below 0
g_Camera.keys[KeyEvent.VK_SUBTRACT] = false;
}
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
}
